org.eclipse.gmf.runtime.emf.clipboard.core
Interface IClipboardSupport
-
All Known Implementing Classes:
-
AbstractClipboardSupport,
AbstractClipboardSupport
-
public interface IClipboardSupport
An interface to be implemented by EMF metamodel providers to inject
metamodel-specific semantics into copy/paste operations.
Basically it has hints (e.g., what to do when pasted elements collide, what
related elements should always be copied together, etc.) that helps the
framework to make decisions. For maximal flexibility, it is even possible
to override the paste operstion altogether.
This interface is intended to be implemented by plug-ins on the
clipboardSupport extension point.
See the
AbstractClipboardSupport
for a convenient superclass for
your implementation.
-
See Also:
-
AbstractClipboardSupport
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)
Destroys an eObject , to ensure that it no longer exists in
its containing resource. |
java.util.Collection
|
getExcludedCopyObjects
(java.util.Set eObjects)
Queries whether any of a set of EObject s, or any objects
contained in their sub-trees,
should be excluded altogether 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. |
OverridePasteChildOperation
|
getOverrideChildPasteOperation
(
PasteChildOperation overriddenChildPasteOperation)
Obtains an override for the specified paste operation. |
OverrideCopyOperation
|
getOverrideCopyOperation
(
CopyOperation overriddenCopyOperation)
Obtains an override for the specified copy operation. |
PasteAction
|
getPasteCollisionAction
(org.eclipse.emf.ecore.EClass eClass)
Queries what to do when a paste collision occurs on instances of a
particular metaclass. |
org.eclipse.emf.ecore.xmi.XMLResource
|
getResource
(org.eclipse.emf.ecore.EObject eObject)
Obtains the resource containing an eObject or, if the
eObject is to be copied but is not attached to a resource,
the resource containing some related element that the detached
eObject would otherwise have been in. |
boolean
|
hasPasteOption
(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
PasteOption pasteOption)
Queries whether a feature supports a particular paste option. |
boolean
|
isCopyAlways
(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference eReference,
java.lang.Object value)
Queries whether a reference needs to be copied even though the referenced
element was not specifically included in the copy request. |
boolean
|
isNameable
(org.eclipse.emf.ecore.EObject eObject)
Queries whether an eObject 's metamodel supports the concept
of "naming" the eObject . |
void
|
performPostPasteProcessing
(java.util.Set pastedEObjects)
Performs what is necessary by the target paste model for the newly pasted elements
This because we disable the semantic procedures, and they used to handle migration
of profiles. now this function will end up doing that. |
void
|
sendCreateNotification
(org.eclipse.emf.ecore.EObject eObject)
Sends a notification that an eObject was created in its
host editing domain. |
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)
Queries whether it is necessary to completely override the default paste
behaviour for pasting the specified (contained) child object into its
parent. |
boolean
|
shouldOverrideCopyOperation
(java.util.Collection eObjects,
java.util.Map hintMap)
Queries whether it is necessary to completely override the default copy
behaviour for copying the specified objects. |
boolean
|
shouldSaveContainmentFeature
(org.eclipse.emf.ecore.EObject eObject)
Queries whether an eObject should have a reference to the
corresponding original element save along with a record of the original
containment feature. |
getPasteCollisionAction
PasteAction getPasteCollisionAction(org.eclipse.emf.ecore.EClass eClass)
- Queries what to do when a paste collision occurs on instances of a
particular metaclass.
-
-
Parameters:
-
eClass
- the metaclass in question
-
Returns:
- one of the enumerated paste actions
hasPasteOption
boolean hasPasteOption(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
PasteOption pasteOption)
- Queries whether a feature supports a particular paste option.
-
-
Parameters:
-
context
- 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
boolean isCopyAlways(org.eclipse.emf.ecore.EObject context,
org.eclipse.emf.ecore.EReference eReference,
java.lang.Object value)
- Queries whether a reference needs to be copied even though the referenced
element was not specifically included in the copy request. It is
recommended, though not required, that in general:
- containment references should always be copied
- transient or derived references should not be copied
-
-
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
boolean shouldOverrideChildPasteOperation(org.eclipse.emf.ecore.EObject parentElement,
org.eclipse.emf.ecore.EObject childEObject)
- Queries whether it is necessary to completely override the default paste
behaviour for pasting the specified (contained) child object into its
parent.
-
-
Parameters:
-
parentElement
- the target element into which a child is to be pasted -
childEObject
- the child element to be pasted
-
Returns:
- boolean
true
if we want to completely override the
paste operation for this child; false
, otherwise
shouldOverrideCopyOperation
boolean shouldOverrideCopyOperation(java.util.Collection eObjects,
java.util.Map hintMap)
- Queries whether it is necessary to completely override the default copy
behaviour for copying the specified objects.
-
-
Parameters:
-
eObjects
- a collection of EObject
s to be pasted -
hintMap
- the copy hints provided by the client of the
current copy operation
-
Returns:
- boolean
true
if we want to completely override the
copy operation for these objects; false
, otherwise
getOverrideChildPasteOperation
OverridePasteChildOperation getOverrideChildPasteOperation(
PasteChildOperation overriddenChildPasteOperation)
- Obtains an override for the specified paste operation. This method is
called immediately after
shouldOverrideChildPasteOperation(EObject, EObject)
, and then
only if the latter returned true
.
-
-
Parameters:
-
overriddenChildPasteOperation
- the paste operation to override
-
Returns:
- the overriding paste operation, or
null
if it is not
appropriate to override (only in the case that
shouldOverrideChildPasteOperation()
was false
) -
See Also:
-
shouldOverrideChildPasteOperation(EObject, EObject)
getOverrideCopyOperation
OverrideCopyOperation getOverrideCopyOperation(
CopyOperation overriddenCopyOperation)
- Obtains an override for the specified copy operation. This method is
called immediately after
shouldOverrideCopyOperation(Collection, Map)
, and then
only if the latter returned true
.
-
-
Parameters:
-
overriddenCopyOperation
- the copy operation to override
-
Returns:
- the overriding copy operation, or
null
if it is not
appropriate to override (only in the case that
shouldOverrideCopyOperation()
was false
) -
See Also:
-
shouldOverrideChildPasteOperation(EObject, EObject)
getExcludedCopyObjects
java.util.Collection getExcludedCopyObjects(java.util.Set eObjects)
- Queries whether any of a set of
EObject
s, or any objects
contained in their sub-trees,
should be excluded altogether from the copy operation. These objects
will not be copied. It is up to the receiver to explicitly search the
eObjects
recursively for exclusions.
-
-
Parameters:
-
eObjects
- the objects considered for copying
-
Returns:
- collection of object that we should not copy, or empty if none
getResource
org.eclipse.emf.ecore.xmi.XMLResource getResource(org.eclipse.emf.ecore.EObject eObject)
- Obtains the resource containing an
eObject
or, if the
eObject
is to be copied but is not attached to a resource,
the resource containing some related element that the detached
eObject
would otherwise have been in.
-
-
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
boolean shouldSaveContainmentFeature(org.eclipse.emf.ecore.EObject eObject)
- Queries whether an
eObject
should have a reference to the
corresponding original element save along with a record of the original
containment feature. All original top-level copy objects must have
this information saved. As for their children (recursively), it is
optional.
-
-
Parameters:
-
eObject
- the eObject to query whether the containment feature
should be saved
-
Returns:
- whether that feature information should be saved
performPostPasteProcessing
void performPostPasteProcessing(java.util.Set pastedEObjects)
- Performs what is necessary by the target paste model for the newly pasted elements
This because we disable the semantic procedures, and they used to handle migration
of profiles. now this function will end up doing that.
-
-
Parameters:
-
pastedEObjects
- the pasted objects to process
isNameable
boolean isNameable(org.eclipse.emf.ecore.EObject eObject)
- Queries whether an
eObject
's metamodel supports the concept
of "naming" the eObject
. The "name" of an element may be
assigned to copies with an adornment (e.g., "Copy of " as done by a
certain well-known file system).
-
-
Parameters:
-
eObject
- an EObject
-
Returns:
- whether the
eObject
supports a "name" of some kind -
See Also:
-
getName(EObject)
,
setName(EObject, String)
getName
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.
-
-
Parameters:
-
eObject
- an element
-
Returns:
- the element's "name" if it has any, or
null
if not -
See Also:
-
isNameable(EObject)
setName
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.
-
-
Parameters:
-
eObject
- an element -
name
- the element's new "name", or null
to clear it
-
Throws:
-
java.lang.IllegalArgumentException
- if the eObject
is not
nameable -
See Also:
-
isNameable(EObject)
destroy
void destroy(org.eclipse.emf.ecore.EObject eObject)
- Destroys an
eObject
, to ensure that it no longer exists in
its containing resource. At a minimum, this method must remove the
eObject
from its container. It may also do more, such as
cleaning up references to the eObject
.
-
-
Parameters:
-
eObject
- the object to be destroyed
sendCreateNotification
void sendCreateNotification(org.eclipse.emf.ecore.EObject eObject)
- Sends a notification that an
eObject
was created in its
host editing domain. This is an optional operation, for those
applications that support the "create" notification type that is
currently deprecated in EMF.
-
-
Parameters:
-
eObject
- an object newly created in the editing domain
canContain
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. The containment conditions
may be stricter than merely conformance to the declared type of the
containment reference.
-
-
Parameters:
-
container
- a prospective containing object -
reference
- the containment reference to check -
containedType
- the type of the prospective contained object
-
Returns:
-
true
if an element of the specified type is
permitted to be contained as indicated; false
, otherwise
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.