|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.emf.clipboard.core.ClipboardSupportUtil
public final class ClipboardSupportUtil
Utilities to assist the implementation of IClipboardSupport
s by
plug-ins extending the clipboardSupport extension point.
Field Summary | |
---|---|
static int |
NONE
Index in an array or list indicating absence of the element sought. |
Method Summary | |
---|---|
static org.eclipse.emf.ecore.EObject |
appendEObject(org.eclipse.emf.ecore.resource.Resource resource,
org.eclipse.emf.ecore.EObject referencedObject)
Appends a resource's contents with an additional reference. |
static org.eclipse.emf.ecore.EObject |
appendEObjectAt(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EObject referencedObject)
Appends an object's many reference with an additional reference. |
static java.util.List |
appendEObjectListAt(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
java.util.List referencedObjects)
Appends an object's many reference with a list of additional references. |
static boolean |
containsAny(java.util.Collection collection1,
java.util.Collection collection2)
Queries whether two collections intersect. |
static void |
destroyEObject(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference)
Clears an object's scalar reference. |
static void |
destroyEObjectInCollection(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EObject referencedObject)
Removes an element from an object's many reference. |
static void |
destroyEObjectInResource(org.eclipse.emf.ecore.EObject referencedObject)
Removes an element from a resource. |
static java.util.Collection |
getCopyElements(java.util.Collection elements)
Removes from a collection of elements any elements that
should not be copied. |
static org.eclipse.emf.ecore.EReference |
getPasteContainmentFeature(org.eclipse.emf.ecore.EObject parentEObject,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference originalReference)
Obtains the containment feature of a parent element into which a child should be pasted, that best matches the child's original containment feature. |
static boolean |
hasNameCollision(java.util.Collection list,
org.eclipse.emf.ecore.EObject eObject)
Queries whether an object is nameable and have the same name (ignoring case) as any element in a list . |
static boolean |
hasNameCollision(org.eclipse.emf.ecore.EObject eObject1,
org.eclipse.emf.ecore.EObject eObject2)
Queries whether two elements are both nameable and have the same name (ignoring case). |
static boolean |
isChild(org.eclipse.emf.ecore.EObject eParent,
org.eclipse.emf.ecore.EObject eObject)
Queries whether the specified eObject is contained within
another. |
static boolean |
isOkToAppendEObjectAt(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EObject referencedObject)
Queries whether a many reference may be appended with an new EObject . |
static boolean |
isOkToDestroyEObject(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference)
Queries whether a scalar reference may be cleared. |
static boolean |
isOkToDestroyEObjectInCollection(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference)
Queries whether a many reference may have a reference removed from it. |
static boolean |
isOkToSetEAttribute(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.Object value)
Queries whether an attribute may be set to the specified new value. |
static boolean |
isOkToSetEList(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference)
Queries whether a many reference may be replaced with an entirely new list of EObject s. |
static boolean |
isOkToSetEObject(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EObject referencedObject)
Queries whether a scalar reference may be set to an new EObject . |
static void |
rename(java.util.Collection list,
org.eclipse.emf.ecore.EObject eObject,
java.lang.String prefix)
Given an object that has a name collision with one or more elements in a list , renames it to have a unique name. |
static org.eclipse.emf.ecore.EObject |
resolve(org.eclipse.emf.ecore.EObject proxy,
java.util.Map idToEObjectMap)
Resolves a proxy , using the specified ID map. |
static org.eclipse.emf.ecore.EObject |
resolve(org.eclipse.emf.ecore.EObject proxy,
org.eclipse.emf.ecore.xmi.XMLResource resource)
Resolves a proxy , using the specified resource. |
static void |
sendCreateEvent(org.eclipse.emf.ecore.EObject eObject)
Broadcasts a creatio notification for a new EObject
via the appropriate clipboard support utility, if the metamodel support
such notifications. |
static void |
sendCreateEvent(java.util.List eObjects)
Broadcasts creation notifications for a list of new EObject s
via the appropriate clipboard support utility, if the metamodel support
such notifications. |
static void |
setEAttribute(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EAttribute attribute,
java.lang.Object value)
Replaces an object's attribute with an new value. |
static org.eclipse.emf.ecore.EObject |
setEObject(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EObject referencedObject)
Replaces an object's scalar reference with an new element. |
static java.util.List |
setEObjectList(org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EReference reference,
java.util.List referencedObjects)
Replaces an object's many reference with an entirely new list of references. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NONE
Method Detail |
---|
public static java.util.Collection getCopyElements(java.util.Collection elements)
elements
any elements that
should not be copied. These are those that have containers that are
already in the elements
collection.
elements
- the collection of elements to be whittled down to those
that should be copied. Note that this collection is modified
in place
elements
collection, againpublic static java.util.List setEObjectList(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, java.util.List referencedObjects)
reference
specified is
not settable.
eObject
- the element owning the reference to be setreference
- the many reference to be setreferencedObjects
- the new value of the reference; must be an
EList
of EObject
s
referencedObjects
isOkToSetEList(EObject, EReference)
public static boolean isOkToSetEList(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference)
EObject
s.
eObject
- the owner of the reference
reference
- a many reference to query whether it is settable
true
if the reference
is changeable
and is not derived; false
, otherwisepublic static java.util.List appendEObjectListAt(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, java.util.List referencedObjects)
eObject
- the element owning the reference list to be appendedreference
- the many reference to be appendedreferencedObjects
- EObject
s to append to the list
referencedObjects
that were
successfully appendedappendEObjectAt(EObject, EReference, EObject)
public static org.eclipse.emf.ecore.EObject appendEObjectAt(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject referencedObject)
reference
cannot be
appended.
eObject
- the element owning the reference list to be appendedreference
- the many reference to be appendedreferencedObject
- an object to append to the list
referencedObject
if it was successfully appended
to the reference; null
, otherwiseappendEObjectAt(EObject, EReference, EObject)
,
isOkToAppendEObjectAt(EObject, EReference, EObject)
public static org.eclipse.emf.ecore.EObject appendEObject(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.EObject referencedObject)
resource
- the resourcereferencedObject
- an object to append to the list
referencedObject
if it was successfully appended
to the resource; null
, otherwisepublic static org.eclipse.emf.ecore.EObject setEObject(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject referencedObject)
reference
specified is not
settable.
eObject
- the element owning the reference to be setreference
- the scalar reference to be setreferencedObject
- the new value of the reference
referencedObjects
isOkToSetEObject(EObject, EReference, EObject)
public static void setEAttribute(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EAttribute attribute, java.lang.Object value)
attribute
specified is not
settable.
eObject
- the element owning the attribute to be setattribute
- the attribute to be setvalue
- the new value of the attributeisOkToSetEAttribute(EObject, EAttribute, Object)
public static void sendCreateEvent(org.eclipse.emf.ecore.EObject eObject)
EObject
via the appropriate clipboard support utility, if the metamodel support
such notifications.
eObject
- a newly created EObject
IClipboardSupport.sendCreateNotification(EObject)
public static void sendCreateEvent(java.util.List eObjects)
EObject
s
via the appropriate clipboard support utility, if the metamodel support
such notifications.
eObjects
- a list of newly created EObject
ssendCreateEvent(EObject)
public static boolean isOkToSetEAttribute(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EAttribute attribute, java.lang.Object value)
eObject
- the owner of the attribute
attribute
- an attribute to query whether it is settablevalue
- the proposed new value of the attribute
true
if the attribute
is changeable
and the value
is not null
;
false
, otherwisepublic static void destroyEObject(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference)
reference
cannot be
cleared.
eObject
- the element owning the reference to be clearedreference
- the scalar reference to be clearedisOkToDestroyEObject(EObject, EReference)
public static void destroyEObjectInCollection(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject referencedObject)
reference
cannot be
removed.
eObject
- the element owning the reference list to be reducedreference
- the many reference to be reducedreferencedObject
- an object to remove from the listisOkToDestroyEObjectInCollection(EObject, EReference)
public static void destroyEObjectInResource(org.eclipse.emf.ecore.EObject referencedObject)
referencedObject
- an object to remove from the resourcepublic static boolean isOkToAppendEObjectAt(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject referencedObject)
EObject
.
eObject
- the owner of the reference
reference
- a many reference to query whether it is appendablereferencedObject
- an object that is proposed to be appended
to the reference
true
if the reference
is changeable
and is not derived, and does not already contain the
referencedObject
or appending it would not violate
the reference
's declared upper bound;
false
, otherwisepublic static boolean isOkToSetEObject(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject referencedObject)
EObject
.
eObject
- the owner of the reference
reference
- a scalar reference to query whether it is settablereferencedObject
- an object that is proposed to be assigned
to the reference
true
if the reference
is changeable
and is not derived, and does not already contain the
referencedObject
or the referencedObject
is null
; false
, otherwisepublic static boolean isOkToDestroyEObject(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference)
eObject
- the owner of the reference
reference
- a scalar reference to query whether it is clearable
true
if the reference
is changeable
and its value is not already null
;
false
, otherwisepublic static boolean isOkToDestroyEObjectInCollection(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference reference)
eObject
- the owner of the reference
reference
- a many reference to query whether it is removable
true
if the reference
is changeable
and is not derived, and removing an element would not violate
its declared lower bound; false
, otherwisepublic static boolean isChild(org.eclipse.emf.ecore.EObject eParent, org.eclipse.emf.ecore.EObject eObject)
eObject
is contained within
another. This differs from the
EcoreUtil.isAncestor(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
method in checking for equality rather than identity.
eParent
- an elementeObject
- an element to see whether it is contained in the
eParent
true
if the eObject
is contained within
an element equal to the eParent
;
false
, otherwisepublic static boolean hasNameCollision(org.eclipse.emf.ecore.EObject eObject1, org.eclipse.emf.ecore.EObject eObject2)
eObject1
- an objecteObject2
- another object
true
if both objects are nameable and have the
same name (ignoring case); false
, otherwiseIClipboardSupport.isNameable(EObject)
public static boolean hasNameCollision(java.util.Collection list, org.eclipse.emf.ecore.EObject eObject)
list
.
list
- a ist of objectseObject
- another object
true
if the eObject
is nameable and
has the same name (ignoring case) as any object in the
list
; false
, otherwiseIClipboardSupport.isNameable(EObject)
public static void rename(java.util.Collection list, org.eclipse.emf.ecore.EObject eObject, java.lang.String prefix)
list
, renames it to have a unique name.
list
- a list of objectseObject
- another object whose name collides with the list
prefix
- the prefix to append; it will be modified by '_1', '_2',
etc. as necessaryhasNameCollision(Collection, EObject)
public static boolean containsAny(java.util.Collection collection1, java.util.Collection collection2)
collection1
- a collectioncollection2
- another
true
if they have any elements in common;
false
, otherwisepublic static org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject proxy, java.util.Map idToEObjectMap)
proxy
, using the specified ID map. If a proxy
resolves to another proxy, then this procedure repeats until either a
non-proxy is found or it is not resolved.
proxy
- a proxyidToEObjectMap
- a mapping of element ID strings to EObject
s
proxy
(this is different from the behaviour of the
EcoreUtil.resolve(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
methodpublic static org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject proxy, org.eclipse.emf.ecore.xmi.XMLResource resource)
proxy
, using the specified resource. If a proxy
resolves to another proxy, then this procedure repeats until either a
non-proxy is found or it is not resolved.
proxy
- a proxyresource
- the resource containing a mapping of element ID strings to EObject
s
proxy
(this is different from the behaviour of the
EcoreUtil.resolve(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
methodpublic static org.eclipse.emf.ecore.EReference getPasteContainmentFeature(org.eclipse.emf.ecore.EObject parentEObject, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference originalReference)
parentEObject
- the target element into which a child is to be
pastedeObject
- the child element to be pasted into the parentoriginalReference
- the child's original containment reference
null
if
child eObject
simply cannot be contained by the
parentEObject
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.