Class DefaultProjectManager

java.lang.Object
ghidra.framework.project.DefaultProjectManager
All Implemented Interfaces:
ProjectManager
Direct Known Subclasses:
TestProjectManager

public class DefaultProjectManager extends Object implements ProjectManager
Implementation for a ProjectManager; creates, opens, and deletes Projects. It also keeps track of recently opened projects.
  • Constructor Details

    • DefaultProjectManager

      protected DefaultProjectManager()
      Construct the single project manager.
  • Method Details

    • getActiveProject

      public Project getActiveProject()
      Description copied from interface: ProjectManager
      Get the project that is currently open.
      Specified by:
      getActiveProject in interface ProjectManager
      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 interface ProjectManager
      Parameters:
      projectLocator - location for where the project should be created
      repAdapter - 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 interface ProjectManager
      Parameters:
      projectLocator - project location
      doRestore - true if the project should be restored
      resetOwner - 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 user
      LockException - if the project is already opened by another user
    • getRecentProjects

      public ProjectLocator[] getRecentProjects()
      Get list of project locations that user most recently opened.
      Specified by:
      getRecentProjects in interface ProjectManager
      Returns:
      list of project locations
    • getRecentViewedProjects

      public URL[] getRecentViewedProjects()
      Description copied from interface: ProjectManager
      Get list of projects that user most recently viewed.
      Specified by:
      getRecentViewedProjects in interface ProjectManager
      Returns:
      list of project URLs
    • getLastOpenedProject

      public ProjectLocator getLastOpenedProject()
      Get the last opened (active) project.
      Specified by:
      getLastOpenedProject in interface ProjectManager
      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

      public void setLastOpenedProject(ProjectLocator projectLocator)
      Update the last opened project preference.
      Specified by:
      setLastOpenedProject in interface ProjectManager
      Parameters:
      projectLocator - project location of last project that was opened
    • deleteProject

      public boolean deleteProject(ProjectLocator projectLocator)
      Delete the project in the given location and remove it from the list of known projects.
      Specified by:
      deleteProject in interface ProjectManager
      Parameters:
      projectLocator - project location
      Returns:
      false if no project was deleted.
    • rememberProject

      public void rememberProject(ProjectLocator projectLocator)
      Keep the specified project on the list of known projects.
      Specified by:
      rememberProject in interface ProjectManager
      Parameters:
      projectLocator - project location
    • forgetViewedProject

      public void forgetViewedProject(URL url)
      Description copied from interface: ProjectManager
      Remove the project url from the list of known viewed projects.
      Specified by:
      forgetViewedProject in interface ProjectManager
      Parameters:
      url - project identifier
    • rememberViewedProject

      public void rememberViewedProject(URL url)
      Description copied from interface: ProjectManager
      Keep the url on the list of known projects.
      Specified by:
      rememberViewedProject in interface ProjectManager
      Parameters:
      url - project identifier
    • projectExists

      public boolean projectExists(ProjectLocator projectLocator)
      Returns true if the specified project exists.
      Specified by:
      projectExists in interface ProjectManager
      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 interface ProjectManager
      Parameters:
      host - server name or IP address
      portNumber - server port or 0 for default
      forceConnect - if true and currently not connected, an attempt will be be to connect
      Returns:
      a handle to the remote server containing shared repositories
    • getMostRecentServerInfo

      public ServerInfo 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 interface ProjectManager
    • addDefaultTools

      public void addDefaultTools(ToolChest toolChest)
      Add the default tools to the given tool chest. This method does not attempt to merge the user's previous tools, as does installTools(ToolChest).
      Parameters:
      toolChest - tool chest which to add the default tools
    • getUserToolChest

      public ToolChest getUserToolChest()
      Description copied from interface: ProjectManager
      Return the user's ToolChest
      Specified by:
      getUserToolChest in interface ProjectManager
    • createUserToolChest

      protected ToolChest createUserToolChest()