Package ghidra.framework.project
Class DefaultProject
java.lang.Object
ghidra.framework.project.DefaultProject
- All Implemented Interfaces:
Project
Implementation for a Project.
-
Constructor Summary
ModifierConstructorDescriptionprotected
DefaultProject
(DefaultProjectManager projectManager, DefaultProjectData projectData) Construct a project with specific project manager and dataprotected
DefaultProject
(DefaultProjectManager projectManager, ProjectLocator projectLocator, boolean resetOwner) Constructor for opening a project.protected
DefaultProject
(DefaultProjectManager projectManager, ProjectLocator projectLocator, RepositoryAdapter repository) Constructor for creating a New project -
Method Summary
Modifier and TypeMethodDescriptionaddProjectView
(URL url, boolean visible) Add the given project URL to this project's list project views.void
addProjectViewListener
(ProjectViewListener listener) Add a listener to be notified when a visible project view is added or removed.void
close()
Close the project.Get the local tool chest for the user logged in.getName()
Convenience method to get the name of this project.Get list of domain files that are open.Get the root domain data folder in the project.getProjectData
(ProjectLocator locator) Returns the Project Data for the given Project locator.Get the project URL for this project.Returns the project manager of this project.Return the list of visible project views in this project.Get the repository that this project is associated with.getSaveableData
(String key) The analog forProject.setSaveableData(String, SaveState)
.Return the tool manager for this project.Get the tool services for this project.getToolTemplate
(String tag) Get the tool template with the given tag.Get the project data for visible viewed projects that are managed by this project.boolean
Return whether the project configuration has changed.boolean
isClosed()
Returns whether this project instance has been closedvoid
releaseFiles
(Object consumer) Releases all DomainObjects used by the given consumervoid
removeProjectView
(URL url) Remove the view from this project.void
removeProjectViewListener
(ProjectViewListener listener) Remove a project view listener previously added.void
restore()
Restore this project's state.void
save()
Save the project and the list of project views.boolean
Saves any tools that are associated with the opened project when the project is closed.void
saveToolTemplate
(String tag, ToolTemplate template) Save the given tool template as part of the project.void
setSaveableData
(String key, SaveState saveState) Allows the user to store data related to the project.toString()
-
Constructor Details
-
DefaultProject
protected DefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, RepositoryAdapter repository) throws 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:
IOException
- if I/O error occurs.LockException
- if unable to establish project lock
-
DefaultProject
protected DefaultProject(DefaultProjectManager projectManager, ProjectLocator projectLocator, boolean resetOwner) throws 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:
FileNotFoundException
- project directory not foundIOException
- if I/O error occurs.NotOwnerException
- if userName is not the owner of the project.LockException
- if unable to establish project lock
-
DefaultProject
Construct a project with specific project manager and data- Parameters:
projectManager
- the manager of this projectprojectData
- the project data
-
-
Method Details
-
getProjectManager
Description copied from interface:Project
Returns the project manager of this project.- Specified by:
getProjectManager
in interfaceProject
- Returns:
- the project manager of this project.
-
getProjectLocator
Get the project URL for this project.- Specified by:
getProjectLocator
in interfaceProject
-
addProjectViewListener
Description copied from interface:Project
Add a listener to be notified when a visible project view is added or removed.- Specified by:
addProjectViewListener
in interfaceProject
- Parameters:
listener
- project view listener
-
removeProjectViewListener
Description copied from interface:Project
Remove a project view listener previously added.- Specified by:
removeProjectViewListener
in interfaceProject
- Parameters:
listener
- project view listener
-
addProjectView
Description copied from interface:Project
Add 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:
addProjectView
in interfaceProject
- Parameters:
url
- identifier for the project view (ghidra protocol only).visible
- true if project may be made visible or false if hidden. Hidden viewed projects are used when only life-cycle management is required (e.g., close view project when this project is closed).- Returns:
- project data for this view
- Throws:
IOException
- if I/O error occurs or if project/repository not found
-
removeProjectView
Remove the view from this project.- Specified by:
removeProjectView
in interfaceProject
- Parameters:
url
- identifier for the project
-
getToolServices
Get the tool services for this project.- Specified by:
getToolServices
in interfaceProject
-
getLocalToolChest
Get the local tool chest for the user logged in.- Specified by:
getLocalToolChest
in interfaceProject
- Returns:
- the tool chest
-
getName
Description copied from interface:Project
Convenience method to get the name of this project. -
getToolManager
Description copied from interface:Project
Return the tool manager for this project.- Specified by:
getToolManager
in interfaceProject
-
hasChanged
public boolean hasChanged()Description copied from interface:Project
Return whether the project configuration has changed.- Specified by:
hasChanged
in interfaceProject
-
getProjectViews
Description copied from interface:Project
Return the list of visible project views in this project.- Specified by:
getProjectViews
in interfaceProject
-
getRepository
Description copied from interface:Project
Get the repository that this project is associated with.- Specified by:
getRepository
in interfaceProject
- Returns:
- null if the project is not associated with a remote repository
-
close
public void close()Description copied from interface:Project
Close the project. -
isClosed
public boolean isClosed()Description copied from interface:Project
Returns whether this project instance has been closed -
saveSessionTools
public boolean saveSessionTools()Description copied from interface:Project
Saves any tools that are associated with the opened project when the project is closed.- Specified by:
saveSessionTools
in interfaceProject
- Returns:
- True if the save was not cancelled.
-
restore
public void restore()Description copied from interface:Project
Restore this project's state. -
save
public void save()Description copied from interface:Project
Save the project and the list of project views. -
toString
-
saveToolTemplate
Description copied from interface:Project
Save the given tool template as part of the project.- Specified by:
saveToolTemplate
in interfaceProject
- Parameters:
tag
- ID or name for the tool templatetemplate
- template to save
-
getToolTemplate
Description copied from interface:Project
Get the tool template with the given tag.- Specified by:
getToolTemplate
in interfaceProject
- Parameters:
tag
- ID or name for the tool template to get- Returns:
- tool template
-
getOpenData
Description copied from interface:Project
Get list of domain files that are open.- Specified by:
getOpenData
in interfaceProject
- Returns:
- the files; empty if no files
-
getProjectData
Description copied from interface:Project
Get the root domain data folder in the project.- Specified by:
getProjectData
in interfaceProject
-
setSaveableData
Description copied from interface:Project
Allows the user to store data related to the project.- Specified by:
setSaveableData
in interfaceProject
- Parameters:
key
- A value used to store and lookup saved datasaveState
- a container of data that will be written out when persisted
-
getSaveableData
Description copied from interface:Project
The analog forProject.setSaveableData(String, SaveState)
.- Specified by:
getSaveableData
in interfaceProject
-
getProjectData
Description copied from interface:Project
Returns 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:
getProjectData
in interfaceProject
-
getViewedProjectData
Description copied from interface:Project
Get the project data for visible viewed projects that are managed by this project.- Specified by:
getViewedProjectData
in interfaceProject
- Returns:
- zero length array if there are no visible viewed projects open
-
releaseFiles
Description copied from interface:Project
Releases all DomainObjects used by the given consumer- Specified by:
releaseFiles
in interfaceProject
- Parameters:
consumer
- object no longer using any DomainObjects.
-