Package ghidra.framework.project
Class DefaultProjectManager
java.lang.Object
ghidra.framework.project.DefaultProjectManager
- All Implemented Interfaces:
ProjectManager
- Direct Known Subclasses:
TestProjectManager
Implementation for a ProjectManager; creates, opens,
and deletes Projects. It also keeps track of recently opened projects.
-
Field Summary
Fields inherited from interface ghidra.framework.model.ProjectManager
APPLICATION_TOOL_EXTENSION, APPLICATION_TOOLS_DIR_NAME
-
Constructor Summary
ModifierConstructorDescriptionprotected
Construct the single project manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaultTools
(ToolChest toolChest) Add the default tools to the given tool chest.createProject
(ProjectLocator projectLocator, RepositoryAdapter repAdapter, boolean remember) Create a project on the local filesystem.protected ToolChest
boolean
deleteProject
(ProjectLocator projectLocator) Delete the project in the given location and remove it from the list of known projects.void
forgetViewedProject
(URL url) Remove the project url from the list of known viewed projects.Get the project that is currently open.Get the last opened (active) project.Get the information that was last used to access a repository managed by a Ghidra server.Get list of project locations that user most recently opened.URL[]
Get list of projects that user most recently viewed.getRepositoryServerAdapter
(String host, int portNumber, boolean forceConnect) Establish a connection to the given host and port number.Return the user's ToolChestopenProject
(ProjectLocator projectLocator, boolean doRestore, boolean resetOwner) Open a project from the file system.boolean
projectExists
(ProjectLocator projectLocator) Returns true if the specified project exists.void
rememberProject
(ProjectLocator projectLocator) Keep the specified project on the list of known projects.void
rememberViewedProject
(URL url) Keep the url on the list of known projects.void
setLastOpenedProject
(ProjectLocator projectLocator) Update the last opened project preference.
-
Constructor Details
-
DefaultProjectManager
protected DefaultProjectManager()Construct the single project manager.
-
-
Method Details
-
getActiveProject
Description copied from interface:ProjectManager
Get the project that is currently open.- Specified by:
getActiveProject
in interfaceProjectManager
- Returns:
- currently open project, return null if there is no project opened
-
createProject
public Project createProject(ProjectLocator projectLocator, RepositoryAdapter repAdapter, boolean remember) throws IOException Description copied from interface:ProjectManager
Create a project on the local filesystem.- Specified by:
createProject
in interfaceProjectManager
- Parameters:
projectLocator
- location for where the project should be createdrepAdapter
- repository adapter if this project is to be a shared project; may be null if the project is not shared.remember
- if false the new project should not be remembered (i.e., recently opened, etc.)- Returns:
- the new project
- Throws:
IOException
- if user cannot access/write the project location
-
openProject
public Project openProject(ProjectLocator projectLocator, boolean doRestore, boolean resetOwner) throws NotFoundException, NotOwnerException, LockException Description copied from interface:ProjectManager
Open a project from the file system. Add the project url to the list of known projects.- Specified by:
openProject
in interfaceProjectManager
- Parameters:
projectLocator
- project locationdoRestore
- true if the project should be restoredresetOwner
- if true, the owner of the project will be changed to the current user.- Returns:
- opened project
- Throws:
NotFoundException
- if the file for the project was not found.NotOwnerException
- if the project owner is not the userLockException
- if the project is already opened by another user
-
getRecentProjects
Get list of project locations that user most recently opened.- Specified by:
getRecentProjects
in interfaceProjectManager
- Returns:
- list of project locations
-
getRecentViewedProjects
Description copied from interface:ProjectManager
Get list of projects that user most recently viewed.- Specified by:
getRecentViewedProjects
in interfaceProjectManager
- Returns:
- list of project URLs
-
getLastOpenedProject
Get the last opened (active) project.- Specified by:
getLastOpenedProject
in interfaceProjectManager
- Returns:
- project last opened by the user; returns NULL if a project was never opened OR the last opened project is no longer valid
-
setLastOpenedProject
Update the last opened project preference.- Specified by:
setLastOpenedProject
in interfaceProjectManager
- Parameters:
projectLocator
- project location of last project that was opened
-
deleteProject
Delete the project in the given location and remove it from the list of known projects.- Specified by:
deleteProject
in interfaceProjectManager
- Parameters:
projectLocator
- project location- Returns:
- false if no project was deleted.
-
rememberProject
Keep the specified project on the list of known projects.- Specified by:
rememberProject
in interfaceProjectManager
- Parameters:
projectLocator
- project location
-
forgetViewedProject
Description copied from interface:ProjectManager
Remove the project url from the list of known viewed projects.- Specified by:
forgetViewedProject
in interfaceProjectManager
- Parameters:
url
- project identifier
-
rememberViewedProject
Description copied from interface:ProjectManager
Keep the url on the list of known projects.- Specified by:
rememberViewedProject
in interfaceProjectManager
- Parameters:
url
- project identifier
-
projectExists
Returns true if the specified project exists.- Specified by:
projectExists
in interfaceProjectManager
- Parameters:
projectLocator
- project location
-
getRepositoryServerAdapter
public RepositoryServerAdapter getRepositoryServerAdapter(String host, int portNumber, boolean forceConnect) Description copied from interface:ProjectManager
Establish a connection to the given host and port number.- Specified by:
getRepositoryServerAdapter
in interfaceProjectManager
- Parameters:
host
- server name or IP addressportNumber
- server port or 0 for defaultforceConnect
- if true and currently not connected, an attempt will be be to connect- Returns:
- a handle to the remote server containing shared repositories
-
getMostRecentServerInfo
Description copied from interface:ProjectManager
Get the information that was last used to access a repository managed by a Ghidra server.- Specified by:
getMostRecentServerInfo
in interfaceProjectManager
-
addDefaultTools
Add the default tools to the given tool chest. This method does not attempt to merge the user's previous tools, as doesinstallTools(ToolChest)
.- Parameters:
toolChest
- tool chest which to add the default tools
-
getUserToolChest
Description copied from interface:ProjectManager
Return the user's ToolChest- Specified by:
getUserToolChest
in interfaceProjectManager
-
createUserToolChest
-