Package ghidra.framework.project
Class DefaultProject
- java.lang.Object
-
- ghidra.framework.project.DefaultProject
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, boolean resetOwner)Constructor for opening a project.protectedDefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, RepositoryAdapter repository)Constructor for creating a New projectprotectedDefaultProject(DefaultProjectManager projectManager, GhidraURLConnection connection)Constructor for opening a URL-based project
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProjectDataaddProjectView(java.net.URL url)Add the given project URL to this project's list project views.voidclose()Close the project.ToolChestgetLocalToolChest()Get the local tool chest for the user logged in.java.lang.StringgetName()Convenience method to get the name of this project.java.util.List<DomainFile>getOpenData()Get list of domain files that are open.ProjectDatagetProjectData()Get the root domain data folder in the project.ProjectDatagetProjectData(ProjectLocator locator)Returns the Project Data for the given Project locator.ProjectDatagetProjectData(java.net.URL url)Returns the Project Data for the given Project URL.ProjectLocatorgetProjectLocator()Get the project URL for this project.ProjectManagergetProjectManager()Returns the project manager of this project.ProjectLocator[]getProjectViews()Return the list of project views in this project.RepositoryAdaptergetRepository()Get the repository that this project is associated with.SaveStategetSaveableData(java.lang.String key)The analog forProject.setSaveableData(String, SaveState).ToolManagergetToolManager()Return the tool manager for this project.ToolServicesgetToolServices()Get the tool services for this project.ToolTemplategetToolTemplate(java.lang.String tag)Get the tool template with the given tag.ProjectData[]getViewedProjectData()Get the project data for other projects that are currently being viewed.booleanhasChanged()Return whether the project configuration has changed.booleanisClosed()Returns whether this project instance has been closedvoidreleaseFiles(java.lang.Object consumer)Releases all DomainObjects used by the given consumervoidremoveProjectView(java.net.URL url)Remove the view from this project.voidrestore()Restore this project's state.voidsave()Save the project and the list of project views.booleansaveSessionTools()Saves any tools that are associated with the opened project when the project is closed.voidsaveToolTemplate(java.lang.String tag, ToolTemplate template)Save the given tool template as part of the project.voidsetSaveableData(java.lang.String key, SaveState saveState)Allows the user to store data related to the project.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DefaultProject
protected DefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, RepositoryAdapter repository) throws java.io.IOException, LockException
Constructor for creating a New project- Parameters:
projectManager- the manager of this projectprojectLocator- location and name of projectrepository- shared repository associated with the new project. Can be null for non-shared projects- Throws:
java.io.IOException- if I/O error occurs.LockException- if unable to establish project lock
-
DefaultProject
protected DefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, boolean resetOwner) throws java.io.IOException, NotOwnerException, LockException
Constructor for opening a project.- Parameters:
projectManager- the manager of this projectprojectLocator- location and name of projectresetOwner- if true, set the owner to the current user- Throws:
java.io.FileNotFoundException- project directory not foundjava.io.IOException- if I/O error occurs.NotOwnerException- if userName is not the owner of the project.LockException- if unable to establish project lock
-
DefaultProject
protected DefaultProject(DefaultProjectManager projectManager, GhidraURLConnection connection) throws java.io.IOException
Constructor for opening a URL-based project- Parameters:
connection- project connection- Throws:
java.io.IOException- if I/O error occurs.
-
-
Method Detail
-
getProjectManager
public ProjectManager getProjectManager()
Description copied from interface:ProjectReturns the project manager of this project.- Specified by:
getProjectManagerin interfaceProject- Returns:
- the project manager of this project.
-
getProjectLocator
public ProjectLocator getProjectLocator()
Get the project URL for this project.- Specified by:
getProjectLocatorin interfaceProject
-
addProjectView
public ProjectData addProjectView(java.net.URL url) throws java.io.IOException, java.net.MalformedURLException
Description copied from interface:ProjectAdd the given project URL to this project's list project views. The project view allows users to look at data files from another project.- Specified by:
addProjectViewin interfaceProject- Parameters:
url- identifier for the project view- Returns:
- project data for this view
- Throws:
java.io.IOException- if I/O error occurs or if project/repository not foundjava.net.MalformedURLException- if projectURL is invalid
-
removeProjectView
public void removeProjectView(java.net.URL url)
Remove the view from this project.- Specified by:
removeProjectViewin interfaceProject- Parameters:
url- identifier for the project
-
getToolServices
public ToolServices getToolServices()
Get the tool services for this project.- Specified by:
getToolServicesin interfaceProject
-
getLocalToolChest
public ToolChest getLocalToolChest()
Get the local tool chest for the user logged in.- Specified by:
getLocalToolChestin interfaceProject
-
getName
public java.lang.String getName()
Description copied from interface:ProjectConvenience method to get the name of this project.
-
getToolManager
public ToolManager getToolManager()
Description copied from interface:ProjectReturn the tool manager for this project.- Specified by:
getToolManagerin interfaceProject
-
hasChanged
public boolean hasChanged()
Description copied from interface:ProjectReturn whether the project configuration has changed.- Specified by:
hasChangedin interfaceProject
-
getProjectViews
public ProjectLocator[] getProjectViews()
Description copied from interface:ProjectReturn the list of project views in this project.- Specified by:
getProjectViewsin interfaceProject
-
getRepository
public RepositoryAdapter getRepository()
Description copied from interface:ProjectGet the repository that this project is associated with.- Specified by:
getRepositoryin interfaceProject- Returns:
- null if the project is not associated with a remote repository
-
close
public void close()
Description copied from interface:ProjectClose the project.
-
isClosed
public boolean isClosed()
Description copied from interface:ProjectReturns whether this project instance has been closed
-
saveSessionTools
public boolean saveSessionTools()
Description copied from interface:ProjectSaves any tools that are associated with the opened project when the project is closed.- Specified by:
saveSessionToolsin interfaceProject- Returns:
- True if the save was not cancelled.
-
restore
public void restore()
Description copied from interface:ProjectRestore this project's state.
-
save
public void save()
Description copied from interface:ProjectSave the project and the list of project views.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
saveToolTemplate
public void saveToolTemplate(java.lang.String tag, ToolTemplate template)Description copied from interface:ProjectSave the given tool template as part of the project.- Specified by:
saveToolTemplatein interfaceProject- Parameters:
tag- ID or name for the tool templatetemplate- template to save
-
getToolTemplate
public ToolTemplate getToolTemplate(java.lang.String tag)
Description copied from interface:ProjectGet the tool template with the given tag.- Specified by:
getToolTemplatein interfaceProject- Parameters:
tag- ID or name for the tool template to get- Returns:
- tool template
-
getOpenData
public java.util.List<DomainFile> getOpenData()
Description copied from interface:ProjectGet list of domain files that are open.- Specified by:
getOpenDatain interfaceProject- Returns:
- the files; empty if no files
-
getProjectData
public ProjectData getProjectData()
Description copied from interface:ProjectGet the root domain data folder in the project.- Specified by:
getProjectDatain interfaceProject
-
setSaveableData
public void setSaveableData(java.lang.String key, SaveState saveState)Description copied from interface:ProjectAllows the user to store data related to the project.- Specified by:
setSaveableDatain interfaceProject- Parameters:
key- A value used to store and lookup saved datasaveState- a container of data that will be written out when persisted
-
getSaveableData
public SaveState getSaveableData(java.lang.String key)
Description copied from interface:ProjectThe analog forProject.setSaveableData(String, SaveState).- Specified by:
getSaveableDatain interfaceProject
-
getProjectData
public ProjectData getProjectData(ProjectLocator locator)
Description copied from interface:ProjectReturns the Project Data for the given Project locator. The Project locator must be either the current active project or an currently open project view.- Specified by:
getProjectDatain interfaceProject
-
getProjectData
public ProjectData getProjectData(java.net.URL url)
Description copied from interface:ProjectReturns the Project Data for the given Project URL. The Project URL must correspond to the current active project or an currently open project view.- Specified by:
getProjectDatain interfaceProject
-
getViewedProjectData
public ProjectData[] getViewedProjectData()
Description copied from interface:ProjectGet the project data for other projects that are currently being viewed.- Specified by:
getViewedProjectDatain interfaceProject- Returns:
- zero length array if there are no viewed projects open
-
releaseFiles
public void releaseFiles(java.lang.Object consumer)
Description copied from interface:ProjectReleases all DomainObjects used by the given consumer- Specified by:
releaseFilesin interfaceProject- Parameters:
consumer- object no longer using any DomainObjects.
-
-