Modifier and Type | Method and Description |
---|---|
Collection<org.eclipse.emf.ecore.EObject> |
duplicateAndPaste(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 EObject s. |
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. |
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 IllegalStateException
Clipboard
and deletes all previous data.
Must be called in the UI thread.objects
- the EObject
objects
to storeIllegalStateException
- if not called from UI threadIllegalArgumentException
- if objects
parameter is nullpublic org.eclipse.emf.ecore.EObject[] getContentAsEObjects(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) throws IllegalStateException
Clipboard
content in form of EObject
s.resourceSet
- the ResourceSet to resolve the stored URI informationIllegalStateException
- if not called from UI threadIllegalArgumentException
- 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 parent
public Collection<org.eclipse.emf.ecore.EObject> duplicateAndPaste(Object target, org.eclipse.emf.transaction.TransactionalEditingDomain transactionalEditingDomain) throws IllegalStateException
EObject
s are
considered, pure EObject
s 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
clipboardIllegalStateException
- if not called from UI threadIllegalArgumentException
- if transactionalEditingDomain
parameter is nullIllegalArgumentException
- if transactionalEditingDomain
parameter is not
equal to the TransactionalEditingDomain of
target
parameterisCompositionAllowed(EObject, EObject[])
,
getContentAsEObjects(ResourceSet)