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 final String`
  `APPLICATION_TOOL_EXTENSION`
  `static final String`
  `APPLICATION_TOOLS_DIR_NAME`

- ## Method Summary

  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(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.
  `URL[]`
  `getRecentViewedProjects()`
  Get list of projects that user most recently viewed.
  `RepositoryServerAdapter`
  `getRepositoryServerAdapter(String host, int portNumber, boolean forceConnect)`
  Establish a connection to the given host and port number.
  `ToolChest`
  `getUserToolChest()`
  Return the user's ToolChest
  `Project`
  `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(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 Details

  - ### APPLICATION_TOOL_EXTENSION

    static final String APPLICATION_TOOL_EXTENSION
    See Also:
      - Constant Field Values

  - ### APPLICATION_TOOLS_DIR_NAME

    static final String APPLICATION_TOOLS_DIR_NAME
    See Also:
      - Constant Field Values

- ## Method Details

  - ### createProject

    Project createProject(ProjectLocator projectLocator, RepositoryAdapter repAdapter, boolean remember) throws IOException
    Create a project on the local filesystem.
    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

  - ### getRecentProjects

    ProjectLocator[] getRecentProjects()
    Get list of projects that user most recently opened.
    Returns:
      list of project URLs

  - ### getRecentViewedProjects

    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(URL url)
    Keep the url on the list of known projects.
    Parameters:
      `url` - project identifier

  - ### forgetViewedProject

    void forgetViewedProject(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 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

  - ### 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(String host, int portNumber, boolean forceConnect)
    Establish a connection to the given host and port number.
    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

    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