Class ResourceManager<T extends EObject>

  • Type Parameters:
    T - The type of the EObject the main Resource contains.

    public class ResourceManager<T extends EObject>
    extends Observable
    This class encapsulates the access to emf model files of type pcmtx and resourcetype.
    • Constructor Detail

      • ResourceManager

        public ResourceManager()
        Creates a new ResourceManager.
    • Method Detail

      • setResource

        public void setResource​(IResource workspaceResource)
        Clears the ResourceSet and sets the main model resource to the one specified by the given workspace resource. workspaceResource may be null.
        Parameters:
        workspaceResource - the workspace resource that specifies the new main Resource.
      • loadResourceToResourceSet

        public void loadResourceToResourceSet​(URI uri)
        Loads a new Resource specified by the given URI to the ResourceSet. Notifies observers afterwards.
        Parameters:
        uri - the URI of the new Resource
      • persistChangesToWorkspaceResource

        public void persistChangesToWorkspaceResource​(T eobj)
                                               throws CoreException
        Persists the given EObject to the current model resource in the workspace.
        Parameters:
        eobj - the EObject to persist
        Throws:
        CoreException - if persisting failed.
      • getResourceSetContents

        public List<EObject> getResourceSetContents()
        Returns a list of the contents contained in the resources of the resource set.
        Returns:
        a list of the contents contained in the resources of the resource set
      • removeListener

        public void removeListener()
        Removes workspace listener.
      • clear

        public void clear()
        Clears the state of the ResourceManager.