public class EcoreUtil2
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
defaultPattern |
| Constructor and Description |
|---|
EcoreUtil2() |
| Modifier and Type | Method and Description |
|---|---|
static void |
attachLikeSourceContainer(org.eclipse.emf.ecore.EObject srcElt,
org.eclipse.emf.ecore.EObject tgtElt)
Attach 'tgtElt' to the same container as 'srcElt', with the same containment feature.
|
static void |
attachLikeSourceContainmentFeature(org.eclipse.emf.ecore.EObject srcElt,
org.eclipse.emf.ecore.EObject tgtElt,
org.eclipse.emf.ecore.EObject tgtContainer)
Attach 'tgtElt' to its container 'tgtContainer' with the same containment feature as the one between 'srcElt' and its own container.
|
static java.util.Collection<?> |
getAllContents(java.util.Collection<?> elements)
Get all contents for given elements.
Returned collection contains given elements and their subtree elements. |
static org.eclipse.emf.ecore.EObject |
getCommonAncestor(java.util.Collection<? extends org.eclipse.emf.ecore.EObject> list) |
static org.eclipse.emf.ecore.EObject |
getCommonAncestor(org.eclipse.emf.ecore.EObject e1,
org.eclipse.emf.ecore.EObject e2) |
static int |
getContainmentLevel(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
This method returns the number of container to be parsed before to reach the specified class type
|
static org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomain(java.util.Collection<org.eclipse.emf.ecore.EObject> elements)
If all objects in elements have the same editing domain return that domain, otherwise return null.
|
static IFile |
getFile(org.eclipse.emf.ecore.resource.Resource resource)
Return the file where is persisted given EMF object.
|
static org.eclipse.emf.ecore.EObject |
getFirstContainer(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
Gets the first container with the specified class type of the specified element.
|
static org.eclipse.emf.ecore.EObject |
getFirstContainer(org.eclipse.emf.ecore.EObject elt,
java.util.List<org.eclipse.emf.ecore.EClass> cls)
Gets the first container with the specified class type of the specified elements.
|
static IProject |
getProject(org.eclipse.emf.ecore.EObject eObject)
Return the project where is persisted given EMF object.
|
static java.util.Collection<org.eclipse.emf.ecore.EObject> |
getReferencingElements(org.eclipse.emf.ecore.EObject referencedElement,
org.eclipse.emf.ecore.util.ECrossReferenceAdapter crossReferencer)
Collect all elements that reference (containment relationships are not taken into account) given one.
In fact that collects Non Navigable Inverse References for given element. Derived features are ignored too. |
static org.eclipse.emf.ecore.EObject |
getResourceContainer(org.eclipse.emf.ecore.EObject eObject)
Get the resource container i.e the first parent container serialized in its own resource.
|
static org.eclipse.emf.common.util.URI |
getResourceURI(org.eclipse.emf.ecore.resource.Resource resource)
Get resource URI.
|
static java.lang.String |
getUniqueName(org.eclipse.emf.ecore.EObject namedElement,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.String prefix,
boolean space,
boolean recursive) |
static java.lang.String |
getUniqueName(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.String defaultString)
Gets a unique name for the specified object.
|
static org.eclipse.emf.common.util.URI |
getURI(IFile file)
Returns the URI from the path (with compatible encoding for EMF.getResource(URI) method)
|
static boolean |
isContainedBy(org.eclipse.emf.ecore.EObject eObject,
java.lang.Class<?> containerClass)
Is given object contained by an object which is an instance of specified container class.
|
static boolean |
isContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
Checks if the specified element container class is same as specified class.
|
static boolean |
isContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EObject container)
Checks if the specified element is contained by the specified container.
|
static boolean |
isEqualOrSuperClass(org.eclipse.emf.ecore.EClass class1,
org.eclipse.emf.ecore.EClass class2)
Allows to know if an
EClass is equal or a super class of another EClass |
static boolean |
isOrIsContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls) |
static boolean |
isOrIsContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EObject container) |
static boolean |
isReadOnly(org.eclipse.emf.ecore.resource.Resource resource)
Is given file resource in read only ?
|
static void |
removeContainer(org.eclipse.emf.ecore.EObject elt)
Removes the element's container.
|
public static void attachLikeSourceContainer(org.eclipse.emf.ecore.EObject srcElt,
org.eclipse.emf.ecore.EObject tgtElt)
srcElt - tgtElt - public static void attachLikeSourceContainmentFeature(org.eclipse.emf.ecore.EObject srcElt,
org.eclipse.emf.ecore.EObject tgtElt,
org.eclipse.emf.ecore.EObject tgtContainer)
srcElt - tgtElt - tgtContainer - public static java.util.Collection<?> getAllContents(java.util.Collection<?> elements)
elements - null collection.public static org.eclipse.emf.ecore.EObject getCommonAncestor(java.util.Collection<? extends org.eclipse.emf.ecore.EObject> list)
public static org.eclipse.emf.ecore.EObject getCommonAncestor(org.eclipse.emf.ecore.EObject e1,
org.eclipse.emf.ecore.EObject e2)
e1 - e2 - public static int getContainmentLevel(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
elt - public static IFile getFile(org.eclipse.emf.ecore.resource.Resource resource)
resource - null if given object is not persisted.public static org.eclipse.emf.common.util.URI getURI(IFile file)
public static IProject getProject(org.eclipse.emf.ecore.EObject eObject)
eObject - null if given object is not persisted.public static org.eclipse.emf.ecore.EObject getFirstContainer(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
elt - The element to check container.cls - The expected container class.null.public static org.eclipse.emf.ecore.EObject getFirstContainer(org.eclipse.emf.ecore.EObject elt,
java.util.List<org.eclipse.emf.ecore.EClass> cls)
elt - The element to check container.cls - The expected container classes list.null.public static java.util.Collection<org.eclipse.emf.ecore.EObject> getReferencingElements(org.eclipse.emf.ecore.EObject referencedElement,
org.eclipse.emf.ecore.util.ECrossReferenceAdapter crossReferencer)
referencedElement - crossReferencer - cross referencer used to retrieve referencing elements.null collection.public static org.eclipse.emf.ecore.EObject getResourceContainer(org.eclipse.emf.ecore.EObject eObject)
eObject - null.public static org.eclipse.emf.common.util.URI getResourceURI(org.eclipse.emf.ecore.resource.Resource resource)
resource - public static java.lang.String getUniqueName(org.eclipse.emf.ecore.EObject namedElement,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.String prefix,
boolean space,
boolean recursive)
namedElement - attribute - prefix - space - recursive - public static java.lang.String getUniqueName(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.String defaultString)
object - the object to set name.container - the object container.feature - the feature.attribute - The name attribute.defaultString - The default string.public static boolean isContainedBy(org.eclipse.emf.ecore.EObject eObject,
java.lang.Class<?> containerClass)
eObject - the element to check the container.containerClass - The expected container class.true if the container class matches, false otherwise.public static boolean isContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
elt - the element to check the container.cls - The expected container class.True if the container class is good else false.public static boolean isContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EObject container)
elt - the element to check.container - The container to check.True if the container class is good else false.public static boolean isEqualOrSuperClass(org.eclipse.emf.ecore.EClass class1,
org.eclipse.emf.ecore.EClass class2)
EClass is equal or a super class of another EClassclass1 - an EClassclass2 - an EClasstrue if class1 is equal to class_2 or is a super class of class_2, false otherwise.public static boolean isOrIsContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EClass cls)
elt - cls - public static boolean isOrIsContainedBy(org.eclipse.emf.ecore.EObject elt,
org.eclipse.emf.ecore.EObject container)
elt - container - public static boolean isReadOnly(org.eclipse.emf.ecore.resource.Resource resource)
resource - false if given resource is not file-based; otherwise it depends on the underlying file.public static void removeContainer(org.eclipse.emf.ecore.EObject elt)
elt - public static org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain(java.util.Collection<org.eclipse.emf.ecore.EObject> elements)
elements -