Interface IV8ProjectManager

  • All Superinterfaces:
    IManagedService

    public interface IV8ProjectManager
    extends IManagedService
    The entry point for accessing known V8 projects and their project-specific managers. The manager may return projects by some filters, such as project type or return V8 project by some metadata context.

    Also, clients may register listeners to listen to V8 project changes:

    • V8 project properties changes: project version, compatibility mode, script variant, etc.
    • V8 project relations and dependencies changes.
    • V8 project lifecycle changes: new V8 project creation or deletion.

    In order to create specific V8 projects or perform project-level alterations of V8 projects, clients must use the corresponding project-specific managers.

    See Also:
    IV8Project
    Restriction:
    This interface is not intended to be extended by clients.
    Restriction:
    This interface is not intended to be implemented by clients.
    • Field Detail

      • SERVICE_NAME

        static final String SERVICE_NAME
        Service name. May be used in service recovery or service lifecycle orchestration.
        See Also:
        Constant Field Values
    • Method Detail

      • getProjects

        Collection<IV8Project> getProjects()
        Returns all known V8 projects. The returned collection is immutable.
        Returns:
        all known V8 projects, never null
      • getProjects

        Collection<IV8Project> getProjects​(Predicate<IV8Project> filter)
        Returns all known V8 projects filtered by the provided filter. The returned collection is immutable.
        Parameters:
        filter - the filter to filter V8 projects, cannot be null
        Returns:
        all known V8 projects filtered by the provided filter, never null
      • getProjects

        <T extends IV8ProjectCollection<T> getProjects​(Class<T> projectType)
        Returns all known V8 projects of the the specified project type. The returned collection is immutable.
        Parameters:
        projectType - a type of the V8 project, cannot be null
        Returns:
        all known V8 projects of the specified project type.
      • getProject

        IV8Project getProject​(String name)
        Returns the V8 project with the specified project name. May return null if there is no V8 project known with the given name.
        Parameters:
        name - the name of V8 project to get, cannot be null
        Returns:
        the V8 project with the given project name or null if not found
      • getProject

        IV8Project getProject​(org.eclipse.core.resources.IProject project)
        Returns the V8 project by the specified workspace IProject. May return null if there is no V8 project with the given workspace project.
        Parameters:
        project - the workspace project of V8 project to get, cannot be null
        Returns:
        the V8 project with the given project workspace project or null if not found
      • getProject

        IV8Project getProject​(org.eclipse.emf.ecore.EObject context)
        Returns a V8 project by the specified context metadata object. The returned project will contain the given context object. May return null if there is no V8 project containing the given context object.
        Parameters:
        context - the context metadata object, cannot be null
        Returns:
        the V8 project with the given metadata object or null if not found
      • getProject

        IV8Project getProject​(org.eclipse.emf.common.util.URI context)
        Returns the V8 project by the specified context metadata URI. The returned project will contain the metadata object with the given URI. May return null if there is no V8 project containing the given context object.
        Parameters:
        context - the context metadata object URI, cannot be null
        Returns:
        the V8 project with the given metadata object URI or null if not found
      • getProject

        IV8Project getProject​(IDtProject project)
        Returns the V8 project by the specified IDtProject.
        Parameters:
        project - The target IDtProject handle, cannot be null
        Returns:
        the V8 project with the given DT project or null if not found
      • getProjectSpecificManager

        <T extends IProjectSpecificManager> T getProjectSpecificManager​(IV8Project v8project,
                                                                        Class<T> managerType)
        Returns the project-specific manager dealing with the specified V8 project.

        Notice that if the type of a V8 project is known in the client code, it is perfectly safe to directly inject the instance of the specific manager to work with that V8 project.

        This method is primarily intended to deal with higher-level specific managers, for example, when the client code is used for a certain subset of V8 projects such that all their specific managers implement a common specific interface. In this situation, the client is ensured to obtain the correct specific manager using this method.

        Type Parameters:
        T - the manager type
        Parameters:
        v8project - the V8 project to get its specific manager for, not null
        managerType - the required class
        Returns:
        the project-specific manager of the specified type or null if no project-specific manager of the required type is known for the specified V8 project
      • addProjectListener

        void addProjectListener​(org.eclipse.core.resources.IProject project,
                                IEventListener listener,
                                Class<? extends IV8ProjectEvent> eventType)
        Adds the specified V8 project properties listener. The listener will be notified about the provided V8 project changes, based on the provided event type: lifecycle, dependencies or properties changes, such as project version, compatibility mode, script variant, etc.

        The listener may be later removed with removeListener(IEventListener) method.

        Parameters:
        project - the project to add listener for, cannot be null
        listener - the listener to add, cannot be null
        eventType - the event type to listen, cannot be null
        See Also:
        IV8ProjectEvent
      • addProjectsListener

        void addProjectsListener​(IEventListener listener,
                                 Class<? extends IV8ProjectEvent> eventType)
        Adds the specified V8 project properties listener. The listener will be notified about all known V8 projects changes, based on the provided event type: lifecycle, dependencies or properties changes, such as project version, compatibility mode, script variant, etc.

        The listener may be later removed with removeListener(IEventListener) method.

        Parameters:
        listener - the listener to add, cannot be null
        eventType - the event type to listen, cannot be null
        See Also:
        IV8ProjectEvent
      • removeListener

        void removeListener​(IEventListener listener)
        Removes a previously registered event listener (regardless of the kind of events it listened to).
        Parameters:
        listener - the listener to remove, cannot be null
      • isServiceContextActive

        boolean isServiceContextActive​(IV8Project project)
        Checks if the service context (ProjectContext is active at the moment. Could be used by other non-LC aware services/clients to check the ability to work with the project service infrastructure.
        Parameters:
        project - The project to check context activity for, cannot be null
        Returns:
        True if the context is active; false otherwise
      • isServiceContextActive

        boolean isServiceContextActive​(org.eclipse.core.resources.IProject project)
        Checks if the service context (ProjectContext is active at the moment. Could be used by other non-LC aware services/clients to check the ability to work with the project service infrastructure.
        Parameters:
        project - The project to check context activity for, cannot be null
        Returns:
        True if the context is active; false otherwise