public class EmfService extends java.lang.Object implements IEmfService
Constructor and Description |
---|
EmfService() |
Modifier and Type | Method and Description |
---|---|
org.eclipse.emf.transaction.TransactionalEditingDomain |
createResourceSetAndEditingDomain()
Creates a
TransactionalEditingDomain with a ResourceSet
resource set and a IWorkspaceCommandStack command stack. |
Diagram |
getDiagramFromFile(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.EObject |
getEObject(java.lang.Object object)
Tries to convert the given object to a
EObject
using #adaptObject(Object, Class) ,
unwrapping an IStructuredSelection .
|
IFile |
getFile(org.eclipse.emf.ecore.EObject object)
Returns the Eclipse file for the given
EObject 's Resource
. |
IFile |
getFile(org.eclipse.emf.common.util.URI uri)
Returns the Eclipse file for the given
URI . |
org.eclipse.emf.common.util.URI |
getFileURI(IFile file)
Retrieves the workspace-local string location of the given
IFile ,
constructs a potentially normalized platform resource URI from it
and returns it. |
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.
|
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.
|
java.lang.StringBuilder |
toString(org.eclipse.emf.ecore.EObject o,
java.lang.StringBuilder result)
Creates an extended string presentation of the given
EObject ,
including its type and attributes |
public java.lang.String getObjectName(java.lang.Object obj)
IEmfService
TranslatableTextFragment
is returned, otherwise null
.obj
- the object to get a name forpublic org.eclipse.emf.ecore.EObject getEObject(java.lang.Object object)
IEmfService
EObject
#adaptObject(Object, Class)
,IStructuredSelection
.object
- the object to convertnull
IEmfService.getEObject(Object)
public IFile getFile(org.eclipse.emf.ecore.EObject object)
IEmfService
EObject
's Resource
.
Note that the file is null
for objects in
IProject.getFile(String)
.object
- the model object to get the file fornull
under the mentioned
circumstancesIEmfService.getFile(URI)
public IFile getFile(org.eclipse.emf.common.util.URI uri)
IEmfService
URI
.
Note that the file is null
for objects in
IProject.getFile(String)
.uri
- the URI to get the file fornull
under the mentioned circumstancesIEmfService.getFile(EObject)
public java.lang.StringBuilder toString(org.eclipse.emf.ecore.EObject o, java.lang.StringBuilder result)
IEmfService
EObject
,
including its type and attributeso
- the object to create a string presentation forresult
- the string buffer to store the result intoresult
per convenience#toString(EObject)
public Diagram getDiagramFromFile(IFile file, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
IEmfService
file
- a valid emf (diagram) resourcepublic org.eclipse.emf.common.util.URI getFileURI(IFile file)
IEmfService
IFile
,
constructs a potentially normalized platform resource URI
from it
and returns it.file
- The file to construct the URI forpublic org.eclipse.emf.common.util.URI mapDiagramFileUriToDiagramUri(org.eclipse.emf.common.util.URI diagramFileUri)
IEmfService
diagramFileUri
- URI of the diagramFilepublic org.eclipse.emf.transaction.TransactionalEditingDomain createResourceSetAndEditingDomain()
IEmfService
TransactionalEditingDomain
with a ResourceSet
resource set and a IWorkspaceCommandStack
command stack.createResourceSetAndEditingDomain
in interface IEmfService
TransactionalEditingDomain
editing domain