Package ghidra.framework.model
Interface ProjectManager
-
- All Known Implementing Classes:
DefaultProjectManager
,TestProjectManager
public interface ProjectManager
Interface for methods to create, open, and delete projects; maintains a list of known project views that the user opened. It has a handle to the currently opened project. A project can be opened by one user at a time.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPLICATION_TOOL_EXTENSION
static java.lang.String
APPLICATION_TOOLS_DIR_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Project
createProject(ProjectLocator projectLocator, RepositoryAdapter repAdapter, boolean remember)
Create a project on the local filesystem.boolean
deleteProject(ProjectLocator projectLocator)
Delete the project in the given location.void
forgetViewedProject(java.net.URL url)
Remove the project url from the list of known viewed projects.Project
getActiveProject()
Get the project that is currently open.ProjectLocator
getLastOpenedProject()
Get the last opened (active) project.ServerInfo
getMostRecentServerInfo()
Get the information that was last used to access a repository managed by a Ghidra server.ProjectLocator[]
getRecentProjects()
Get list of projects that user most recently opened.java.net.URL[]
getRecentViewedProjects()
Get list of projects that user most recently viewed.RepositoryServerAdapter
getRepositoryServerAdapter(java.lang.String host, int portNumber, boolean forceConnect)
Establish a connection to the given host and port number.ToolChest
getUserToolChest()
Return the user's ToolChestProject
openProject(ProjectLocator projectLocator, boolean doRestore, boolean resetOwner)
Open a project from the file system.boolean
projectExists(ProjectLocator projectLocator)
Returns true if a project with the given projectLocator exists.void
rememberProject(ProjectLocator projectLocator)
Keep the projectLocator on the list of known projects.void
rememberViewedProject(java.net.URL url)
Keep the url on the list of known projects.void
setLastOpenedProject(ProjectLocator projectLocator)
Set the projectLocator of last opened (active) project; this projectLocator is returned in the getLastOpenedProject() method.
-
-
-
Field Detail
-
APPLICATION_TOOL_EXTENSION
static final java.lang.String APPLICATION_TOOL_EXTENSION
- See Also:
- Constant Field Values
-
APPLICATION_TOOLS_DIR_NAME
static final java.lang.String APPLICATION_TOOLS_DIR_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createProject
Project createProject(ProjectLocator projectLocator, RepositoryAdapter repAdapter, boolean remember) throws java.io.IOException
Create a project on the local filesystem.- 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:
java.io.IOException
- if user cannot access/write the project location
-
getRecentProjects
ProjectLocator[] getRecentProjects()
Get list of projects that user most recently opened.- Returns:
- list of project URLs
-
getRecentViewedProjects
java.net.URL[] getRecentViewedProjects()
Get list of projects that user most recently viewed.- Returns:
- list of project URLs
-
getActiveProject
Project getActiveProject()
Get the project that is currently open.- Returns:
- currently open project, return null if there is no project opened
-
getLastOpenedProject
ProjectLocator getLastOpenedProject()
Get the last opened (active) project.- 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
void setLastOpenedProject(ProjectLocator projectLocator)
Set the projectLocator of last opened (active) project; this projectLocator is returned in the getLastOpenedProject() method.- Parameters:
projectLocator
- project location of last project that was opened
-
rememberProject
void rememberProject(ProjectLocator projectLocator)
Keep the projectLocator on the list of known projects.- Parameters:
projectLocator
- project location
-
rememberViewedProject
void rememberViewedProject(java.net.URL url)
Keep the url on the list of known projects.- Parameters:
url
- project identifier
-
forgetViewedProject
void forgetViewedProject(java.net.URL url)
Remove the project url from the list of known viewed projects.- Parameters:
url
- project identifier
-
openProject
Project openProject(ProjectLocator projectLocator, boolean doRestore, boolean resetOwner) throws NotFoundException, NotOwnerException, LockException
Open a project from the file system. Add the project url to the list of known projects.- 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
-
deleteProject
boolean deleteProject(ProjectLocator projectLocator)
Delete the project in the given location.- Parameters:
projectLocator
- project location- Returns:
- false if no project was deleted.
-
projectExists
boolean projectExists(ProjectLocator projectLocator)
Returns true if a project with the given projectLocator exists.- Parameters:
projectLocator
- project location
-
getRepositoryServerAdapter
RepositoryServerAdapter getRepositoryServerAdapter(java.lang.String host, int portNumber, boolean forceConnect)
Establish a connection to the given host and port number.- 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
ServerInfo getMostRecentServerInfo()
Get the information that was last used to access a repository managed by a Ghidra server.
-
getUserToolChest
ToolChest getUserToolChest()
Return the user's ToolChest
-
-