|
 |
|
|
org.eclipse.gmf.runtime.emf.clipboard.core
Class AbstractClipboardSupport
java.lang.Object
org.eclipse.gmf.runtime.emf.clipboard.core.AbstractClipboardSupport
-
All Implemented Interfaces:
-
IClipboardSupport
-
public class AbstractClipboardSupport
- extends java.lang.Object
- implements
IClipboardSupport
A convenient default implementation of most of the features required of
a clipboard support utility.
This class is intended to be extended by clients.
Method Summary
|
boolean
|
canContain
(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EClass containedType)
Queries whether an object can contain an object of a given type
in a specified containment reference. |
void
|
destroy
(org.eclipse.emf.ecore.EObject eObject)
Simply removes an eObject from its container. |
java.util.Collection
|
getExcludedCopyObjects
(java.util.Set eObjects)
By default, don't exclude any objects from the copy operation. |
java.lang.String
|
getName
(org.eclipse.emf.ecore.EObject eObject)
Obtains the "name" of an element, if the metamodel supports the
concept of naming elements and this eObject has a name. |
protected org.eclipse.emf.ecore.EAttribute
|
getNameAttribute
(org.eclipse.emf.ecore.EClass eClass)
Obtains the cached name attribute of an eClass, or null
if it has no attribute named "name". |
OverridePasteChildOperation
|
getOverrideChildPasteOperation
(
PasteChildOperation overriddenChildPasteOperation)
By default, don't provide any child paste override behaviour. |
OverrideCopyOperation
|
getOverrideCopyOperation
(
CopyOperation overriddenCopyOperation)
By default, don't provide any copy override behaviour. |
PasteAction
|
getPasteCollisionAction
(org.eclipse.emf.ecore.EClass eClass)
By default, there are no collisions in pasting. |
org.eclipse.emf.ecore.xmi.XMLResource
|
getResource
(org.eclipse.emf.ecore.EObject eObject)
By default, assumes that the eObject is attached to
an XML resource, and returns that. |
boolean
|
hasPasteOption
(org.eclipse.emf.ecore.EObject contextEObject,
org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
PasteOption pasteOption)
By default, the following paste options are supported:
PasteOption.NORMAL : always
others: never
|
boolean
|
isCopyAlways
(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference eReference,
java.lang.Object value)
By default, transient and derived references are never copied, and
containment references always are copied. |
boolean
|
isNameable
(org.eclipse.emf.ecore.EObject eObject)
By default, elements are nameable if they have an EAttribute
named "name". |
void
|
performPostPasteProcessing
(java.util.Set pastedEObjects)
By default, there is no post processing to be done. |
void
|
sendCreateNotification
(org.eclipse.emf.ecore.EObject eObject)
Default implementation does nothing, for those applications that do not
support creation notifications. |
void
|
setName
(org.eclipse.emf.ecore.EObject eObject,
java.lang.String name)
Sets the "name" of an element, if the metamodel supports the
concept of naming elements and this eObject is nameable. |
boolean
|
shouldOverrideChildPasteOperation
(org.eclipse.emf.ecore.EObject parentElement,
org.eclipse.emf.ecore.EObject childEObject)
By default, don't provide any child paste override behaviour. |
boolean
|
shouldOverrideCopyOperation
(java.util.Collection eObjects,
java.util.Map hintMap)
By default, don't provide any copy override behaviour. |
boolean
|
shouldSaveContainmentFeature
(org.eclipse.emf.ecore.EObject eObject)
By default, we always remember the containment feature of an object,
unless it is an Ecore element (such as an annotation) or it is a
detached element. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
AbstractClipboardSupport
public AbstractClipboardSupport()
- Initializes me.
getPasteCollisionAction
public
PasteAction getPasteCollisionAction(org.eclipse.emf.ecore.EClass eClass)
- By default, there are no collisions in pasting.
-
-
Specified by:
-
getPasteCollisionAction
in interface
IClipboardSupport
-
-
Parameters:
-
eClass - the metaclass in question
-
Returns:
- the
PasteAction.ADD action, always
hasPasteOption
public boolean hasPasteOption(org.eclipse.emf.ecore.EObject contextEObject,
org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
PasteOption pasteOption)
- By default, the following paste options are supported:
-
-
Specified by:
-
hasPasteOption
in interface
IClipboardSupport
-
-
Parameters:
-
contextEObject - and object being copied or pasted -
eStructuralFeature - a feature of the contextEObject
-
pasteOption - the paste option to query
-
Returns:
- boolean whether the paste option is supported on this feature
isCopyAlways
public boolean isCopyAlways(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference eReference,
java.lang.Object value)
- By default, transient and derived references are never copied, and
containment references always are copied.
-
-
Specified by:
-
isCopyAlways
in interface
IClipboardSupport
-
-
Parameters:
-
context - an object being copied that owns the reference -
eReference - the reference being to query -
value - the object(s) referenced by the eReference .
It is either an EObject or a collection of
EObject s, according to the multiplicity of the reference
-
Returns:
- boolean whether the
value must also be copied
shouldOverrideChildPasteOperation
public boolean shouldOverrideChildPasteOperation(org.eclipse.emf.ecore.EObject parentElement,
org.eclipse.emf.ecore.EObject childEObject)
- By default, don't provide any child paste override behaviour.
-
-
Specified by:
-
shouldOverrideChildPasteOperation
in interface
IClipboardSupport
-
-
Parameters:
-
parentElement - the target element into which a child is to be pasted -
childEObject - the child element to be pasted
-
Returns:
-
false , always
shouldOverrideCopyOperation
public boolean shouldOverrideCopyOperation(java.util.Collection eObjects,
java.util.Map hintMap)
- By default, don't provide any copy override behaviour.
-
-
Specified by:
-
shouldOverrideCopyOperation
in interface
IClipboardSupport
-
-
Parameters:
-
eObjects - a collection of EObject s to be pasted -
hintMap - the copy hints provided by the client of the
current copy operation
-
Returns:
-
false , always
getOverrideChildPasteOperation
public
OverridePasteChildOperation getOverrideChildPasteOperation(
PasteChildOperation overriddenChildPasteOperation)
- By default, don't provide any child paste override behaviour.
-
-
Specified by:
-
getOverrideChildPasteOperation
in interface
IClipboardSupport
-
-
Parameters:
-
overriddenChildPasteOperation - the paste operation to override
-
Returns:
-
null , always -
See Also:
-
IClipboardSupport.shouldOverrideChildPasteOperation(EObject, EObject)
getOverrideCopyOperation
public
OverrideCopyOperation getOverrideCopyOperation(
CopyOperation overriddenCopyOperation)
- By default, don't provide any copy override behaviour.
-
-
Specified by:
-
getOverrideCopyOperation
in interface
IClipboardSupport
-
-
Parameters:
-
overriddenCopyOperation - the copy operation to override
-
Returns:
-
null , always -
See Also:
-
IClipboardSupport.shouldOverrideChildPasteOperation(EObject, EObject)
getExcludedCopyObjects
public java.util.Collection getExcludedCopyObjects(java.util.Set eObjects)
- By default, don't exclude any objects from the copy operation.
-
-
Specified by:
-
getExcludedCopyObjects
in interface
IClipboardSupport
-
-
Parameters:
-
eObjects - the objects considered for copying
-
Returns:
- an empty collection
getResource
public org.eclipse.emf.ecore.xmi.XMLResource getResource(org.eclipse.emf.ecore.EObject eObject)
- By default, assumes that the
eObject is attached to
an XML resource, and returns that.
-
-
Specified by:
-
getResource
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - the object for which we need the associated resource
-
Returns:
- the containing resource or, if the
eObject is
detached, some resource from which it is reachable via some
other attached object
shouldSaveContainmentFeature
public boolean shouldSaveContainmentFeature(org.eclipse.emf.ecore.EObject eObject)
- By default, we always remember the containment feature of an object,
unless it is an Ecore element (such as an annotation) or it is a
detached element.
-
-
Specified by:
-
shouldSaveContainmentFeature
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - the eObject to query whether the containment feature
should be saved
-
Returns:
-
false if the eObject is an Ecore
object or is detached; true , otherwise
performPostPasteProcessing
public void performPostPasteProcessing(java.util.Set pastedEObjects)
- By default, there is no post processing to be done.
-
-
Specified by:
-
performPostPasteProcessing
in interface
IClipboardSupport
-
-
Parameters:
-
pastedEObjects - the pasted objects to process
getNameAttribute
protected org.eclipse.emf.ecore.EAttribute getNameAttribute(org.eclipse.emf.ecore.EClass eClass)
- Obtains the cached name attribute of an eClass, or
null
if it has no attribute named "name".
-
-
-
Parameters:
-
eClass - an EClass
-
Returns:
- the cached "name" attribute
isNameable
public boolean isNameable(org.eclipse.emf.ecore.EObject eObject)
- By default, elements are nameable if they have an
EAttribute
named "name".
-
-
Specified by:
-
isNameable
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - an EObject
-
Returns:
- whether the
eObject supports a "name" of some kind -
See Also:
-
IClipboardSupport.getName(EObject) ,
IClipboardSupport.setName(EObject, String)
getName
public java.lang.String getName(org.eclipse.emf.ecore.EObject eObject)
-
Description copied from interface:
IClipboardSupport
- Obtains the "name" of an element, if the metamodel supports the
concept of naming elements and this
eObject has a name.
-
-
Specified by:
-
getName
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - an element
-
Returns:
- the element's "name" if it has any, or
null if not -
See Also:
-
IClipboardSupport.isNameable(EObject)
setName
public void setName(org.eclipse.emf.ecore.EObject eObject,
java.lang.String name)
-
Description copied from interface:
IClipboardSupport
- Sets the "name" of an element, if the metamodel supports the
concept of naming elements and this
eObject is nameable.
-
-
Specified by:
-
setName
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - an element -
name - the element's new "name", or null to clear it -
See Also:
-
IClipboardSupport.isNameable(EObject)
destroy
public void destroy(org.eclipse.emf.ecore.EObject eObject)
- Simply removes an
eObject from its container.
-
-
Specified by:
-
destroy
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - the object to be destroyed
sendCreateNotification
public void sendCreateNotification(org.eclipse.emf.ecore.EObject eObject)
- Default implementation does nothing, for those applications that do not
support creation notifications.
-
-
Specified by:
-
sendCreateNotification
in interface
IClipboardSupport
-
-
Parameters:
-
eObject - an object newly created in the editing domain
canContain
public boolean canContain(org.eclipse.emf.ecore.EObject container,
org.eclipse.emf.ecore.EReference reference,
org.eclipse.emf.ecore.EClass containedType)
-
Description copied from interface:
IClipboardSupport
- Queries whether an object can contain an object of a given type
in a specified containment reference. The containment conditions
may be stricter than merely conformance to the declared type of the
containment reference.
-
-
Specified by:
-
canContain
in interface
IClipboardSupport
-
-
Parameters:
-
container - a prospective containing object -
reference - the containment reference to check -
containedType - the type of the prospective contained object
-
Returns:
-
true if the reference 's type is
compatible with the containedType ; false ,
otherwise
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.
|
|
|