Interface Project


public interface Project
An object representing an IntelliJ project.

To get all of its modules, use ModuleManager.getInstance(project).getModules().

To iterate over all project source files and directories, use ProjectFileIndex.SERVICE.getInstance(project).iterateContent(iterator).

To get the list of all open projects, use ProjectManager.getInstance().getOpenProjects().

  • Field Details

  • Method Details

    • getName

      @NotNull @NotNull String getName()
      Returns a name ot the project. For a directory-based project it's an arbitrary string specified by user at project creation or later in a project settings. For a file-based project it's a name of a project file without extension.
      Returns:
      project name
    • getBasePath

      @Nullable @Nullable String getBasePath()
      Deprecated.
      Returns a path to a project base directory (see #getBaseDir()).
      Returns null for default project.
      See Also:
      • com.intellij.openapi.project.ProjectUtil#guessProjectDir
    • getProjectFilePath

      @Nullable @Nullable String getProjectFilePath()
      Returns:
      a path to project file (see #getProjectFile()) or null for default project.
    • getPresentableUrl

      @Nullable default @Nullable String getPresentableUrl()
      Returns presentable project path: getProjectFilePath() for file-based projects, getBasePath() for directory-based ones.
      * Returns null for default project. Note: the word "presentable" here implies file system presentation, not a UI one.
      Returns:
      presentable project path
    • getLocationHash

      @NotNull @NotNull String getLocationHash()

      Returns a workspace file:

      • path/to/project/project.iws - for file-based projects
      • path/to/project/.idea/workspace.xml - for directory-based ones
      Returns null for default project.
      Returns:
      workspace file, or null for default project
    • save

      void save()
    • isOpen

      boolean isOpen()
    • isInitialized

      boolean isInitialized()
    • isDefault

      boolean isDefault()