Class ECPProjectImpl

    • Field Summary

      • Fields inherited from interface org.eclipse.emf.ecp.core.ECPProject

        TYPE
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canDelete()
      Whether this instance can be deleted or not.
      InternalProject clone​(java.lang.String name)
      This method clones a project.
      void close()
      This closes an opened object.
      boolean contains​(java.lang.Object object)
      Check whether a project contains an Object.
      void delete()
      Deletes the current instance.
      void deleteElements​(java.util.Collection<java.lang.Object> objects)
      Deletes a collection of Objects by delegating the task to the provider.
      void disposed​(ECPDisposable disposable)
      Callback method being used to notify listeners about a dispose.
      java.lang.Object getAdapter​(java.lang.Class adapterType)
      Returns an object which is an instance of the given class associated with this object.
      org.eclipse.emf.common.util.EList<java.lang.Object> getContents()
      Returns the list of the direct content objects; each is of type Object.
      org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
      InternalProject getProject()
      This returns the project this object belongs to or references in any way.
      InternalProvider getProvider()
      This method returns the provider of this project.
      java.lang.Object getProviderSpecificData()
      This method returns the provider specific data of this project.
      java.util.Iterator<org.eclipse.emf.ecore.EObject> getReferenceCandidates​(org.eclipse.emf.ecore.EObject modelElement, org.eclipse.emf.ecore.EReference eReference)
      Get all possible EObjects from the provider to which a reference can be added from a certain EObject based on the type of the EReference.
      InternalRepository getRepository()
      This method returns the repository this project is shared on.
      java.lang.String getType()
      This return the type of the object.
      java.util.Set<org.eclipse.emf.ecore.EPackage> getUnsupportedEPackages()
      Returns a collection of EPackages which are not supported by the provider.
      java.util.Set<org.eclipse.emf.ecore.EClass> getVisibleEClasses()
      Get the currently visible EClasses.
      java.util.Set<org.eclipse.emf.ecore.EPackage> getVisiblePackages()
      Get the currently visible EPackages.
      boolean hasDirtyContents()
      Checks whether the model, associated with this project is dirty.
      boolean isModelRoot​(java.lang.Object object)
      This method checks whether the provided object is the model root of the project.
      boolean isOpen()
      Whether an object is open or not.
      boolean isStorable()
      void notifyObjectsChanged​(java.util.Collection<java.lang.Object> objects, boolean structural)
      This method is a callback for the provider to notify the project about changes.
      void notifyProvider​(InternalProvider.LifecycleEvent event)
      This method is used to notify the provider about a InternalProvider.LifecycleEvent of this project.
      void open()
      This opens a closed object.
      protected void propertiesChanged​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> oldProperties, java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> newProperties)
      Called if the properties of the element change.
      void saveContents()
      Saves the currently pending changes of the model.
      void saveProperties()
      Deprecated.
      void setProviderSpecificData​(java.lang.Object providerSpecificData)
      This method sets the provider specific data of this project.
      void setVisibleEClasses​(java.util.Set<org.eclipse.emf.ecore.EClass> filteredEClasses)
      Set the visible EClasses.
      void setVisiblePackages​(java.util.Set<org.eclipse.emf.ecore.EPackage> filteredPackages)
      Set the visible EPackages.
      void undispose​(InternalRepository repository)
      This method undisposes the project based on a repository.
      void write​(java.io.ObjectOutput out)
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Constructor Detail

      • ECPProjectImpl

        public ECPProjectImpl​(InternalProvider provider,
                              java.lang.String name,
                              ECPProperties properties)
        Constructor used when an offline project is created.
        Parameters:
        provider - the InternalProvider of this project
        name - the name of the project
        properties - the properties of the project
      • ECPProjectImpl

        public ECPProjectImpl​(ECPRepository repository,
                              java.lang.String name,
                              ECPProperties properties)
        Constructor used when an online project is created.
        Parameters:
        repository - the ECPRepository of this project
        name - the name of the project
        properties - the properties of the project
      • ECPProjectImpl

        public ECPProjectImpl​(java.io.ObjectInput in)
                       throws java.io.IOException
        Constructor used to load persisted projects on startup.
        Parameters:
        in - the ObjectInput to parse
        Throws:
        java.io.IOException - is thrown when file can't be read.
    • Method Detail

      • getType

        public java.lang.String getType()
        This return the type of the object.
        Specified by:
        getType in class Element
        Returns:
        the type
      • getProviderSpecificData

        public java.lang.Object getProviderSpecificData()
        This method returns the provider specific data of this project.
        Specified by:
        getProviderSpecificData in interface InternalProject
        Returns:
        the provider specific data of this project
      • setProviderSpecificData

        public void setProviderSpecificData​(java.lang.Object providerSpecificData)
        This method sets the provider specific data of this project.
        Specified by:
        setProviderSpecificData in interface InternalProject
        Parameters:
        providerSpecificData - the provider specific data of this project
      • notifyObjectsChanged

        public void notifyObjectsChanged​(java.util.Collection<java.lang.Object> objects,
                                         boolean structural)
        This method is a callback for the provider to notify the project about changes.
        Specified by:
        notifyObjectsChanged in interface InternalProject
        Parameters:
        objects - the objects that have changed
        structural - if the changes where structural (e.g. delete)
      • getEditingDomain

        public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
        Specified by:
        getEditingDomain in interface org.eclipse.emf.edit.domain.IEditingDomainProvider
      • getAdapter

        public java.lang.Object getAdapter​(java.lang.Class adapterType)
        Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

        This implementation of the method declared by IAdaptable passes the request along to the platform's adapter manager; roughly Platform.getAdapterManager().getAdapter(this, adapter). Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted).

        Parameters:
        adapterType - the class to adapt to
        Returns:
        the adapted object or null
        See Also:
        IAdaptable#getAdapter(Class)
      • canDelete

        public boolean canDelete()
        Whether this instance can be deleted or not.
        Specified by:
        canDelete in interface ECPContainer
        Returns:
        true if this instance can be deleted, false otherwise.
      • delete

        public void delete()
        Deletes the current instance.
        Specified by:
        delete in interface ECPContainer
      • isOpen

        public boolean isOpen()
        Whether an object is open or not.
        Specified by:
        isOpen in interface ECPProject
        Returns:
        true if it is open, false otherwise
      • open

        public void open()
        This opens a closed object. If the object was already opened, nothing happens.
        Specified by:
        open in interface ECPProject
      • close

        public void close()
        This closes an opened object. If the object was already closed, nothing happens.
        Specified by:
        close in interface ECPProject
      • undispose

        public void undispose​(InternalRepository repository)
        This method undisposes the project based on a repository.
        Specified by:
        undispose in interface InternalProject
        Parameters:
        repository - the repository
      • getContents

        public org.eclipse.emf.common.util.EList<java.lang.Object> getContents()
        Returns the list of the direct content objects; each is of type Object. The contents may be directly modified. Adding an object will remove it from the previous container;
        Specified by:
        getContents in interface ECPProject
        Returns:
        A list of Object
      • getUnsupportedEPackages

        public java.util.Set<org.eclipse.emf.ecore.EPackage> getUnsupportedEPackages()
        Returns a collection of EPackages which are not supported by the provider. EObjects from these packages cannot be created within the project.
        Specified by:
        getUnsupportedEPackages in interface InternalProject
        Returns:
        Collection of unsupported EPackages
      • setVisiblePackages

        public void setVisiblePackages​(java.util.Set<org.eclipse.emf.ecore.EPackage> filteredPackages)
        Set the visible EPackages. New model elements can only be created from EPackages contained in the visiblePackages and the InternalProject.setVisibleEClasses(Set).
        Specified by:
        setVisiblePackages in interface InternalProject
        Parameters:
        filteredPackages - the EPackages to be visible
      • getVisiblePackages

        public java.util.Set<org.eclipse.emf.ecore.EPackage> getVisiblePackages()
        Get the currently visible EPackages. If no filter is set, then all EPackages supported by the provider are returned.
        Specified by:
        getVisiblePackages in interface InternalProject
        Returns:
        Set of EPackages that should be available, or all supported EPackages
      • getVisibleEClasses

        public java.util.Set<org.eclipse.emf.ecore.EClass> getVisibleEClasses()
        Get the currently visible EClasses. If no visible EClasses are set, then an empty Set is returned.
        Specified by:
        getVisibleEClasses in interface InternalProject
        Returns:
        Set of EClasses that should be available, or empty.
      • setVisibleEClasses

        public void setVisibleEClasses​(java.util.Set<org.eclipse.emf.ecore.EClass> filteredEClasses)
        Set the visible EClasses.
        Specified by:
        setVisibleEClasses in interface InternalProject
        Parameters:
        filteredEClasses - the classes that should be available
      • getReferenceCandidates

        public java.util.Iterator<org.eclipse.emf.ecore.EObject> getReferenceCandidates​(org.eclipse.emf.ecore.EObject modelElement,
                                                                                        org.eclipse.emf.ecore.EReference eReference)
        Get all possible EObjects from the provider to which a reference can be added from a certain EObject based on the type of the EReference.
        Specified by:
        getReferenceCandidates in interface InternalProject
        Parameters:
        modelElement - - the EObject for which the reference should be set.
        eReference - - the EReference to be set.
        Returns:
        Iterator over all EObject that can be added as a reference
      • saveContents

        public void saveContents()
        Saves the currently pending changes of the model. This method delegates to the provider.
        Specified by:
        saveContents in interface ECPProject
      • hasDirtyContents

        public boolean hasDirtyContents()
        Checks whether the model, associated with this project is dirty.
        Specified by:
        hasDirtyContents in interface ECPProject
        Returns:
        true if model is dirty, false otherwise
      • deleteElements

        public void deleteElements​(java.util.Collection<java.lang.Object> objects)
        Deletes a collection of Objects by delegating the task to the provider.
        Specified by:
        deleteElements in interface ECPProject
        Parameters:
        objects - the collection of Objects to delete
      • clone

        public InternalProject clone​(java.lang.String name)
        This method clones a project.
        Specified by:
        clone in interface InternalProject
        Parameters:
        name - the name of the project to create
        Returns:
        the cloned project
      • propertiesChanged

        protected void propertiesChanged​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> oldProperties,
                                         java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> newProperties)
        Description copied from class: PropertiesElement
        Called if the properties of the element change. Can be implemented by subclasses
        Overrides:
        propertiesChanged in class PropertiesElement
        Parameters:
        oldProperties - the old properties
        newProperties - the new properties
      • saveProperties

        @Deprecated
        public void saveProperties()
        Deprecated.
        You must not call this anymore as properties are save automatically now.
        Specified by:
        saveProperties in interface InternalProject
      • isModelRoot

        public boolean isModelRoot​(java.lang.Object object)
        This method checks whether the provided object is the model root of the project.
        Specified by:
        isModelRoot in interface InternalProject
        Parameters:
        object - the object to check
        Returns:
        true if the object is the root of the model of this project, false otherwise
      • contains

        public boolean contains​(java.lang.Object object)
        Check whether a project contains an Object.
        Specified by:
        contains in interface InternalProject
        Parameters:
        object - the object to check for containment
        Returns:
        true if the object is in the project, false otherwise