Class ProjectsManager

    • Method Detail

      • getProjects

        @OpenApi
        public java.util.List<Project> getProjects()
        Returns list of open projects.
        Returns:
        list of open projects.
      • isProjectActive

        @OpenApi
        public boolean isProjectActive​(@CheckForNull
                                       Project project)
        Method checks if given project is active at this time.
        Parameters:
        project - project to check.
        Returns:
        true if given project is active.
      • setActiveProject

        @OpenApi
        public void setActiveProject​(@CheckForNull
                                     Project project)
        Sets given project as active. Updates GUI.
        Parameters:
        project - the project to be set as active.
      • getActiveProject

        @OpenApi
        @CheckForNull
        public Project getActiveProject()
        Returns active open project.
        Returns:
        active project.
      • addProjectListener

        @OpenApi
        public void addProjectListener​(ProjectEventListener listener)
        Adds new project listener.
        Parameters:
        listener - listener to be added.
      • removeProjectListener

        @OpenApi
        public void removeProjectListener​(ProjectEventListener listener)
        Removes project listener.
        Parameters:
        listener - listener to be removed.
      • loadProject

        @OpenApi
        public void loadProject​(ProjectDescriptor descriptor,
                                boolean silent)
        Loads project from location, described in a project descriptor. Loading is done on EDT.
        Specified by:
        loadProject in interface ProjectPersistenceManager
        Parameters:
        descriptor - the project descriptor.
        silent - if true, loads without GUI interruptions.
      • saveProject

        @OpenApi
        public boolean saveProject​(ProjectDescriptor descriptor,
                                   boolean silent)
        Saves project into location specified by descriptor.
        Specified by:
        saveProject in interface ProjectPersistenceManager
        Parameters:
        descriptor - the project descriptor.
        silent - if true, saves without GUI interruptions.
      • createProject

        @OpenApi
        public Project createProject()
        Creates new project.
        Returns:
        created project.
      • createProjectFromTemplate

        @OpenApi
        @CheckForNull
        public Project createProjectFromTemplate​(java.lang.String templatePath)
        Creates a new project from the given template.
        Parameters:
        templatePath - absolute template path
        Returns:
        created project.
      • closeProject

        @OpenApi
        public void closeProject()
        Closes current project.
      • closeProject

        @OpenApi
        public void closeProject​(Project project)
        Closes given project
        Parameters:
        project - project to close
      • useModule

        @OpenApi
        public boolean useModule​(Project project,
                                 ProjectDescriptor module)
        Use module in given project from given descriptor.

        Need to update ProjectOptions before using local module:
        String moduleDir = moduleFile.getParent();
        ProjectOptions projectOptions = project.getOptions();
        List directories = projectOptions.getModulesDirectories(true);
        if (!directories.contains(moduleDir))
        {
            projectOptions.addModuleDirectory(moduleDir);
        }

        Specified by:
        useModule in interface ProjectPersistenceManager
        Parameters:
        project - project
        module - module
        Returns:
        true if module was used
      • exportModule

        @OpenApi
        public void exportModule​(Project prj,
                                 java.util.Collection packages,
                                 java.lang.String description,
                                 ProjectDescriptor module)
        Export local (not teamwork) module into given descriptor
        Specified by:
        exportModule in interface ProjectPersistenceManager
        Parameters:
        prj - current project
        packages - "shared" packages in project
        description - module description
        module - module location descriptor
      • saveModule

        @OpenApi
        public boolean saveModule​(Project project,
                                  com.nomagic.ci.persistence.IAttachedProject module,
                                  boolean silent,
                                  boolean temporalSave)
        Save module from current project into given location.
        Specified by:
        saveModule in interface ProjectPersistenceManager
        Parameters:
        project - project
        module - module to save
        silent - do not show UI messages
        temporalSave - do not change module location after save
        Returns:
        true if module was saved
      • saveModule

        @OpenApi
        public boolean saveModule​(Project project,
                                  com.nomagic.ci.persistence.IAttachedProject module,
                                  boolean silent,
                                  ProgressStatus status)
        Saves module without any additional dependencies checking.
        Specified by:
        saveModule in interface ProjectPersistenceManager
        Parameters:
        project - project
        module - module to save
        silent - save in silent mode
        status - progress status
        Returns:
        true if operation was successful
      • saveModule

        @OpenApi
        public boolean saveModule​(Project project,
                                  com.nomagic.ci.persistence.IAttachedProject module,
                                  boolean silent,
                                  ProgressStatus status,
                                  boolean temporalSave)
        Saves module without any additional dependencies checking.
        Specified by:
        saveModule in interface ProjectPersistenceManager
        Parameters:
        project - project
        module - module to save
        silent - save in silent mode
        status - progress status
        temporalSave - do not change module location after save
        Returns:
        true if operation was successful
      • saveModule

        @OpenApi
        public boolean saveModule​(Project project,
                                  com.nomagic.ci.persistence.IAttachedProject module,
                                  boolean silent,
                                  ProgressStatus status,
                                  java.net.URI saveTo)
        Saves module without any additional dependencies checking.
        Parameters:
        project - project
        module - module to save
        status - status
        silent - save in silent mode
        saveTo - where to save module, can be null, then module is saved to module.getURI() location
        Returns:
        true if operation was successful
      • saveModule

        @OpenApi
        public boolean saveModule​(Project project,
                                  com.nomagic.ci.persistence.IAttachedProject module,
                                  boolean silent,
                                  @CheckForNull
                                  ProgressStatus status,
                                  @CheckForNull
                                  java.net.URI saveTo,
                                  boolean temporalSave)
        Saves module without any additional dependencies checking.
        Parameters:
        project - project
        module - module to save
        silent - save in silent mode
        status - progress status
        saveTo - where to save module, can be null, then module is saved to module.getURI() location
        temporalSave - do not change module location after save
        Returns:
        true if operation was successful
      • findAttachedProject

        @OpenApi
        @CheckForNull
        public com.nomagic.ci.persistence.IAttachedProject findAttachedProject​(Project project,
                                                                               ProjectDescriptor projectDescriptor)
        Find used module according given project descriptor.
        Parameters:
        project - project using module.
        projectDescriptor - project descriptor of module.
        Returns:
        found attached project or null
      • findProject

        @OpenApi
        @CheckForNull
        public Project findProject​(ProjectDescriptor projectDescriptor)
        Find loaded project according given project descriptor.
        Parameters:
        projectDescriptor - project descriptor.
        Returns:
        null if project not found.
      • sharePackage

        @OpenApi
        public void sharePackage​(Project project,
                                 java.util.List<Package> packages,
                                 @CheckForNull
                                 java.lang.String description)
        Share given list of packages in project. On CTS decomposition must be locked before sharing.
        Parameters:
        project - Project where packages will be shared.
        packages - List of packaged, dedicated for sharing.
        description - share description, null if do not change/set the description.
        Throws:
        java.lang.RuntimeException - if either some being shared package becomes invalid in the main project (that is, has been deleted or moved to a module) or is locked by another user