public final class ModelClipboard
extends java.lang.Object
Clipboard.| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<org.eclipse.emf.ecore.EObject> |
duplicateAndPaste(java.lang.Object target,
org.eclipse.emf.transaction.TransactionalEditingDomain transactionalEditingDomain)
Duplicates the clipboard's content using EMF's deep copy service.
|
org.eclipse.emf.ecore.EObject[] |
getContentAsEObjects(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Returns the SWT
Clipboard content in form of EObjects. |
static ModelClipboard |
getDefault() |
boolean |
isCompositionAllowed(org.eclipse.emf.ecore.EObject parent,
org.eclipse.emf.ecore.EObject[] objects)
Answers whether at least one of the given objects can be aggregated below
the given parent as composite children.
|
void |
setContent(org.eclipse.emf.ecore.EObject[] objects)
Sets the content of the
Clipboard and deletes all previous data. |
java.lang.String |
toString() |
public static ModelClipboard getDefault()
ModelClipboard instance to represent a global
ModelClipboard to the user, which is connected to the SWT
Clipboard.public void setContent(org.eclipse.emf.ecore.EObject[] objects)
throws java.lang.IllegalStateException
Clipboard and deletes all previous data.
Must be called in the UI thread.objects - the EObject objects to storejava.lang.IllegalStateException - if not called from UI threadjava.lang.IllegalArgumentException - if objects parameter is nullpublic org.eclipse.emf.ecore.EObject[] getContentAsEObjects(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
throws java.lang.IllegalStateException
Clipboard content in form of EObjects.resourceSet - the ResourceSet to resolve the stored URI informationjava.lang.IllegalStateException - if not called from UI threadjava.lang.IllegalArgumentException - if resourceSet parameter is nullpublic boolean isCompositionAllowed(org.eclipse.emf.ecore.EObject parent,
org.eclipse.emf.ecore.EObject[] objects)
parent - the composite parentobjects - the objects to checktrue if at least one object may be a composite child
of parentpublic java.util.Collection<org.eclipse.emf.ecore.EObject> duplicateAndPaste(java.lang.Object target,
org.eclipse.emf.transaction.TransactionalEditingDomain transactionalEditingDomain)
throws java.lang.IllegalStateException
EObjects are
considered, pure EObjects like packages cannot be duplicated.target - an object acting as composite parent for the copies.
null if the copied elements should be top-level
elements.transactionalEditingDomain - the TransactionalEditingDomain to write the copies into. Must
not be null nor dead.null in case of an empty
clipboardjava.lang.IllegalStateException - if not called from UI threadjava.lang.IllegalArgumentException - if transactionalEditingDomain parameter is nulljava.lang.IllegalArgumentException - if transactionalEditingDomain parameter is not
equal to the TransactionalEditingDomain of
target parameterisCompositionAllowed(EObject, EObject[]),
getContentAsEObjects(ResourceSet)public java.lang.String toString()
toString in class java.lang.Object