|
TPTP 4.3.0 Testing Tools Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.hyades.test.core.util.EMFUtil
Contains generic utility methods to work with EMF objects.
| Field Summary | |
|---|---|
static java.util.Map |
RESOURCE_OPTIONS
|
| Constructor Summary | |
|---|---|
EMFUtil()
|
|
| Method Summary | |
|---|---|
static void |
addAdapter(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
Adds the specified adapter to the notifiers in the given iterator. |
static org.eclipse.emf.ecore.EObject |
getEObject(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.ecore.EObject eObject,
boolean load)
Returns an EObject from the resource set that has the same URI fragment or id of the specifie eObject. |
static org.eclipse.emf.ecore.EObject |
getEObject(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri,
boolean loadOnDemand)
Returns the object resolved by the URI. |
static org.eclipse.emf.ecore.EObject |
getEObjectInResourceSet(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.resource.ResourceSet rs)
|
static org.eclipse.emf.ecore.EObject[] |
getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
Returns the EObjects in the specified file from the Resource Set without loading it. |
static org.eclipse.emf.ecore.EObject[] |
getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file,
boolean loadOnDemand)
Returns the EObjects in the specified file from the Resource Set. |
static org.eclipse.emf.ecore.EObject[] |
getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath)
Returns the EObjects in the specified file paht from the Resource Set without loading it. |
static org.eclipse.emf.ecore.EObject[] |
getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath,
boolean loadOnDemand)
Returns the EObjects in the specified file paht from the Resource Set. |
static org.eclipse.emf.ecore.EObject[] |
getEObjects(org.eclipse.emf.common.util.URI fileURI,
boolean load)
Returns the EObjects in the resource specified by the fileUIR. |
static java.lang.String |
getFilePath(org.eclipse.emf.ecore.EObject eObject)
Returns file path for EObject or empty string if not found |
static java.lang.String |
getFilePath(org.eclipse.emf.ecore.resource.Resource resource)
Returns file path for resource or empty string if not found |
static org.eclipse.emf.common.util.URI |
getObjectURI(java.lang.Object object)
Returns the complete EMF URI which includes the resource information. |
static org.eclipse.core.resources.IContainer |
getParent(org.eclipse.emf.ecore.resource.Resource resource)
|
static org.eclipse.emf.ecore.resource.Resource |
getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.ecore.EObject object)
Returns the resource which contains (at the first level) the given object. |
static org.eclipse.emf.ecore.resource.Resource |
getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
Returns a resource without loading it. |
static org.eclipse.emf.ecore.resource.Resource |
getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri,
boolean load)
|
static org.eclipse.emf.ecore.resource.Resource.Factory |
getResourceFactory(java.lang.String fileExtension)
Returns the resource factory associated with a given file extension. |
static org.eclipse.emf.ecore.resource.ResourceSet |
getResourceSet()
|
static org.eclipse.core.resources.IFile |
getWorkspaceFile(org.eclipse.emf.ecore.EObject eObject)
Returns the workspace file that is storing a given eObject or null if the object is not persisted. |
static org.eclipse.core.resources.IFile |
getWorkspaceFile(org.eclipse.emf.ecore.resource.Resource resource)
Returns the workspace file that corresponds to a given resource or null if the resource is not available in the
workspace. |
static org.eclipse.core.resources.IFile |
getWorkspaceFile(org.eclipse.emf.common.util.URI uri)
|
static java.lang.String |
getWorkspaceFilePath(org.eclipse.emf.ecore.resource.Resource resource)
|
static org.eclipse.emf.ecore.EObject[] |
load(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
Loads the specified file returning all the root EObjects. |
static org.eclipse.emf.ecore.EObject[] |
load(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath)
Loads the specified file returning all the root EObjects. |
static org.eclipse.emf.ecore.EObject[] |
load(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri)
Loads the specified file returning all the root EObjects. |
static org.eclipse.emf.ecore.EObject |
reload(org.eclipse.emf.ecore.EObject eObject)
Reloads a given eObject returning a new instance from the same resource. |
static org.eclipse.emf.ecore.resource.Resource[] |
remove(org.eclipse.emf.ecore.EObject eObject)
Removes the specified eObject from its container and breaks all the references to this object within the context of its resource set. |
static org.eclipse.emf.ecore.resource.Resource[] |
remove(org.eclipse.emf.ecore.resource.Resource resource)
Removes the specified resource from its resource set and breaks all the references to objects inside this resource within the context of the resource set. |
static void |
removeAdapter(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
Removes the specified adapter from the notifiers in the given iterator. |
static void |
removeAdapters(java.util.Iterator objectIterator)
Removes all adapters from the notifiers in the given iterator. |
static void |
removeAdapters(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
Removes a specific adapter from the notifiers in the given iterator. |
static void |
save(org.eclipse.emf.ecore.resource.Resource resource)
Saves a resource. |
static void |
unloadIfNeeded(org.eclipse.emf.common.util.URI uri)
Unload a resource using its URI from the test navigator resource set if this resource is not one we are currently saving This method is used in the updateContent of the resource change updater of the test navigator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.util.Map RESOURCE_OPTIONS
| Constructor Detail |
public EMFUtil()
| Method Detail |
public static void save(org.eclipse.emf.ecore.resource.Resource resource)
throws java.lang.Exception
resource -
java.lang.IllegalArgumentException - if the resource is null
java.lang.Exception - if an exception happens during the saving attempt.public static void unloadIfNeeded(org.eclipse.emf.common.util.URI uri)
uri - the URI of the resource to unload
public static org.eclipse.emf.ecore.EObject getEObject(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.ecore.EObject eObject,
boolean load)
null. If the resource set is null
the default (internal) one is used.
eObject - load -
public static org.eclipse.emf.ecore.EObject[] getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
If the file is null or if the file is not loaded
into it, this method returns an empty array.
file -
public static org.eclipse.emf.ecore.EObject[] getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file,
boolean loadOnDemand)
If the file is null or if the file is not loaded and
loadOnDemand is false, this method returns an empty array.
file - loadOnDemand -
public static org.eclipse.emf.ecore.EObject[] getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath)
If the resource set is null or if the file is not loaded
into it, this method returns an empty array.
public static org.eclipse.emf.ecore.EObject[] getEObjects(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath,
boolean loadOnDemand)
If the resource set is null or if the file is not loaded
into it and loadOnDemand is false, this method returns an empty array.
public static org.eclipse.emf.ecore.EObject[] getEObjects(org.eclipse.emf.common.util.URI fileURI,
boolean load)
fileURI - load -
public static org.eclipse.emf.ecore.EObject[] load(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
null the default one is used.
If the load attempt fails this method adds an entry to the log and returns an empty array.
file -
public static org.eclipse.emf.ecore.EObject[] load(org.eclipse.emf.ecore.resource.ResourceSet rs,
java.lang.String fullPath)
null the default one is used.
If the load attempt fails this method adds an entry to the log and returns an empty array.
fullPath -
public static org.eclipse.emf.ecore.EObject[] load(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri)
null the default one is used.
If the load attempt fails this method adds an entry to the log and returns an empty array.
public static org.eclipse.emf.ecore.resource.Resource.Factory getResourceFactory(java.lang.String fileExtension)
null or if there isn't a specifc
factory for the file extension, the this method returns the generic
factory.
fileExtension -
null if none.public static org.eclipse.core.resources.IFile getWorkspaceFile(org.eclipse.emf.ecore.EObject eObject)
null if the object is not persisted.
eObject -
public static org.eclipse.core.resources.IFile getWorkspaceFile(org.eclipse.emf.common.util.URI uri)
public static org.eclipse.core.resources.IFile getWorkspaceFile(org.eclipse.emf.ecore.resource.Resource resource)
null if the resource is not available in the
workspace.
resource -
public static org.eclipse.core.resources.IContainer getParent(org.eclipse.emf.ecore.resource.Resource resource)
public static java.lang.String getFilePath(org.eclipse.emf.ecore.resource.Resource resource)
public static java.lang.String getFilePath(org.eclipse.emf.ecore.EObject eObject)
eObject -
public static java.lang.String getWorkspaceFilePath(org.eclipse.emf.ecore.resource.Resource resource)
public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.core.resources.IFile file)
null,
a new resource is created if a resource factory is available for the file
extension.
file -
public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri,
boolean load)
public static org.eclipse.emf.ecore.EObject reload(org.eclipse.emf.ecore.EObject eObject)
This method unloads and reloads the entire eObject's resource and tries to find the object in the new resource content.
Important: after reloading the resource all the objects in that resource are reinstantiated. This has a big impact if an object is being cached somewhere.
eObject -
public static org.eclipse.emf.ecore.resource.Resource[] remove(org.eclipse.emf.ecore.EObject eObject)
eObject -
public static org.eclipse.emf.ecore.resource.Resource[] remove(org.eclipse.emf.ecore.resource.Resource resource)
resource -
public static void addAdapter(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
objectIterator - adapter -
public static void removeAdapter(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
objectIterator - adapter - public static void removeAdapters(java.util.Iterator objectIterator)
objectIterator -
public static void removeAdapters(java.util.Iterator objectIterator,
org.eclipse.emf.common.notify.Adapter adapter)
objectIterator - public static org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.ecore.EObject object)
object.
rs - resource set used to search in or null if cached one has to be used.object - the EMF element we are loking for its resource
public static org.eclipse.emf.ecore.EObject getEObjectInResourceSet(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.resource.ResourceSet rs)
public static org.eclipse.emf.ecore.EObject getEObject(org.eclipse.emf.ecore.resource.ResourceSet rs,
org.eclipse.emf.common.util.URI uri,
boolean loadOnDemand)
rs - resource set used to search in or null if cached one has to be used.uri - the URI to resolve.loadOnDemand - whether to create and load the resource, if it doesn't already exists.
ResourceSet.getEObject(org.eclipse.emf.common.util.URI, boolean)public static org.eclipse.emf.common.util.URI getObjectURI(java.lang.Object object)
object -
|
TPTP 4.3.0 Testing Tools Project Public API Specification |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||