Interface IEmfService
-
- All Superinterfaces:
IEmfService
- All Known Implementing Classes:
EmfService
public interface IEmfService extends IEmfService
Provides EMF Services, in particular with respect toEObject,URI,ResourceSet, andTransactionalEditingDomain.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DiagramgetDiagramFromFile(org.eclipse.core.resources.IFile file, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)If given file is a valid emf resource and it contains a diagram as first root element, this methods return the diagram.org.eclipse.emf.ecore.EObjectgetEObject(java.lang.Object object)Tries to convert the given object to aEObjectusing#adaptObject(Object, Class), unwrapping anIStructuredSelection.org.eclipse.core.resources.IFilegetFile(org.eclipse.emf.common.util.URI uri)Returns the Eclipse file for the givenURI.org.eclipse.core.resources.IFilegetFile(org.eclipse.emf.ecore.EObject object)Returns the Eclipse file for the givenEObject'sResource.org.eclipse.emf.common.util.URIgetFileURI(org.eclipse.core.resources.IFile file)Retrieves the workspace-local string location of the givenIFile, constructs a potentially normalized platform resourceURIfrom it and returns it.java.lang.StringgetObjectName(java.lang.Object obj)Returns the human readable name of a given object or the EMF id if no name can be found.org.eclipse.emf.common.util.URImapDiagramFileUriToDiagramUri(org.eclipse.emf.common.util.URI diagramFileUri)Maps the fileURI to an URI which points directly to the Diagram Object.java.lang.StringBuildertoString(org.eclipse.emf.ecore.EObject o, java.lang.StringBuilder result)Creates an extended string presentation of the givenEObject, including its type and attributes-
Methods inherited from interface org.eclipse.graphiti.ui.services.IEmfService
createResourceSetAndEditingDomain
-
-
-
-
Method Detail
-
getObjectName
java.lang.String getObjectName(java.lang.Object obj)
Returns the human readable name of a given object or the EMF id if no name can be found. The method tries to access a modeled attribute "name" or "id" in this order. If no attribute with this name is modeled, the first attribute whose value is a String orTranslatableTextFragmentis returned, otherwisenull.- Parameters:
obj- the object to get a name for- Returns:
- the value of attribute "name" or the EMF id if no attribute "name" exists
-
getEObject
org.eclipse.emf.ecore.EObject getEObject(java.lang.Object object)
Tries to convert the given object to aEObject- using
#adaptObject(Object, Class), - unwrapping an
IStructuredSelection.
- Parameters:
object- the object to convert- Returns:
- the target object or
null - See Also:
getEObject(Object)
- using
-
getFile
org.eclipse.core.resources.IFile getFile(org.eclipse.emf.ecore.EObject object)
Returns the Eclipse file for the givenEObject'sResource. Note that the file isnullfor objects in- archives,
- closed projects,
- not yet persisted resources or not yet persisted EObjects in already
persisted resources. In this respect this methods behaves asymmetric to
the handle-only resource APIs like
IProject.getFile(String).
- Parameters:
object- the model object to get the file for- Returns:
- the partition file or
nullunder the mentioned circumstances - See Also:
getFile(URI)
-
getFile
org.eclipse.core.resources.IFile getFile(org.eclipse.emf.common.util.URI uri)
Returns the Eclipse file for the givenURI. Note that the file isnullfor objects in- archives,
- closed projects,
- not yet persisted resources or not yet persisted EObjects in already
persisted resources. In this respect this methods behaves asymmetric to
the handle-only resource APIs like
IProject.getFile(String).
- Parameters:
uri- the URI to get the file for- Returns:
- the file or
nullunder the mentioned circumstances - Since:
- 0.9
- See Also:
getFile(EObject)
-
toString
java.lang.StringBuilder toString(org.eclipse.emf.ecore.EObject o, java.lang.StringBuilder result)Creates an extended string presentation of the givenEObject, including its type and attributes- Parameters:
o- the object to create a string presentation forresult- the string buffer to store the result into- Returns:
- the same string buffer as
resultper convenience - See Also:
#toString(EObject)
-
getDiagramFromFile
Diagram getDiagramFromFile(org.eclipse.core.resources.IFile file, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
If given file is a valid emf resource and it contains a diagram as first root element, this methods return the diagram. Otherwise this method returns null.- Parameters:
file- a valid emf (diagram) resource- Returns:
- diagram or null
-
getFileURI
org.eclipse.emf.common.util.URI getFileURI(org.eclipse.core.resources.IFile file)
Retrieves the workspace-local string location of the givenIFile, constructs a potentially normalized platform resourceURIfrom it and returns it.- Parameters:
file- The file to construct the URI forresourceSet- TheResourceSetto use for the normalization (can benull, in this case no normalization is done).- Returns:
- The platform resource URI for the given file.
-
mapDiagramFileUriToDiagramUri
org.eclipse.emf.common.util.URI mapDiagramFileUriToDiagramUri(org.eclipse.emf.common.util.URI diagramFileUri)
Maps the fileURI to an URI which points directly to the Diagram Object. This methods assumes the Diagram object is the first root object in the given file.- Parameters:
diagramFileUri- URI of the diagramFile- Returns:
- URI of the diagram
-
-