Class ResourceManager<T extends EObject>
- java.lang.Object
-
- java.util.Observable
-
- org.palladiosimulator.pcmtx.pcmtxviews.resource.ResourceManager<T>
-
public class ResourceManager<T extends EObject> extends Observable
This class encapsulates the access to emf model files of type pcmtx and resourcetype.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPCMTX_FILE_EXTENSIONstatic StringRESOURCETYPE_FILE_EXTENSION
-
Constructor Summary
Constructors Constructor Description ResourceManager()Creates a newResourceManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the state of theResourceManager.TgetEObject(Class<T> c)Returns the firstEObjectof the mainResourceof theResourceSetornullif theResourceSetdoes not contain anyResources or the mainResourcedoes not contain anyEObject.List<EObject>getResourceSetContents()Returns a list of the contents contained in the resources of the resource set.URIgetResourceURI()voidloadResourceToResourceSet(URI uri)voidpersistChangesToWorkspaceResource(T eobj)Persists the givenEObjectto the current model resource in the workspace.voidremoveListener()Removes workspace listener.voidsetResource(IResource workspaceResource)Clears theResourceSetand sets the main model resource to the one specified by the given workspaceresource.-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Field Detail
-
PCMTX_FILE_EXTENSION
public static final String PCMTX_FILE_EXTENSION
- See Also:
- Constant Field Values
-
RESOURCETYPE_FILE_EXTENSION
public static final String RESOURCETYPE_FILE_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
setResource
public void setResource(IResource workspaceResource)
Clears theResourceSetand sets the main model resource to the one specified by the given workspaceresource.workspaceResourcemay benull.
-
loadResourceToResourceSet
public void loadResourceToResourceSet(URI uri)
-
persistChangesToWorkspaceResource
public void persistChangesToWorkspaceResource(T eobj) throws CoreException
Persists the givenEObjectto the current model resource in the workspace.- Parameters:
eobj- theEObjectto persist- Throws:
CoreException- if persisting failed.
-
getEObject
public T getEObject(Class<T> c)
Returns the firstEObjectof the mainResourceof theResourceSetornullif theResourceSetdoes not contain anyResources or the mainResourcedoes not contain anyEObject.
-
getResourceURI
public URI getResourceURI()
- Returns:
- the
URIof the mainResourcein theResourceSet
-
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 theResourceManager.
-
-