Package org.eclipse.graphiti.ui.features

## Class AbstractPasteFeature

- java.lang.Object
- - org.eclipse.graphiti.features.impl.AbstractFeature
  - - org.eclipse.graphiti.ui.features.AbstractPasteFeature

All Implemented Interfaces:
  `IFeature`, `IFeatureProviderHolder`, `IPasteFeature`, `IDescription`, `IName`

    public abstract class AbstractPasteFeature
    extends AbstractFeature
    implements IPasteFeature

The Class AbstractPasteFeature.

### Constructor Summary

Constructors
`AbstractPasteFeature​(IFeatureProvider fp)` Creates a new `AbstractPasteFeature`.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `canExecute​(IContext context)` Decides if the current feature can execute with the given context.
`void` `execute​(IContext context)` Executes the current feature with the given context.
`protected java.lang.Object[]` `getCopiesFromClipBoard​(java.lang.Object target)` Duplicates the clipboard's content.
`protected java.lang.Object[]` `getFromClipboard()` Gets original content from clipboard.
`java.lang.String` `getName()` Gets the name.
`protected 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.
`protected boolean` `isResolvable​(org.eclipse.emf.ecore.EObject object)` Checks if the given `EObject` can be resolved in the local `EditingDomain` of the current `DiagramBehavior`.

### Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature

`addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, getDiagram, getDiagramBehavior, getFeatureProvider, getProgressCallback, getUserDecision, hasDoneChanges, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString, updatePictogramElement`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.graphiti.IDescription

`getDescription`

### Methods inherited from interface org.eclipse.graphiti.features.IFeature

`canUndo, hasDoneChanges, isAvailable`

### Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder

`getFeatureProvider`

### Methods inherited from interface org.eclipse.graphiti.features.IPasteFeature

`canPaste, paste`

### Constructor Detail

#### AbstractPasteFeature

    public AbstractPasteFeature​(IFeatureProvider fp)

Creates a new `AbstractPasteFeature`.

Parameters:
  `fp` - the feature provider

### Method Detail

#### canExecute

    public boolean canExecute​(IContext context)

Description copied from interface: `IFeature`
Decides if the current feature can execute with the given context.

Specified by:
  `canExecute` in interface `IFeature`
Parameters:
  `context` - this is the general input for this method
Returns:
  true if the feature can be executed, false if not
See Also:
  `IContext`

#### execute

    public void execute​(IContext context)

Description copied from interface: `IFeature`
Executes the current feature with the given context.

Specified by:
  `execute` in interface `IFeature`
Parameters:
  `context` - this is the general input for this method
See Also:
  `IContext`

#### getName

    public java.lang.String getName()

Description copied from interface: `IName`
Gets the name.

Specified by:
  `getName` in interface `IName`
Overrides:
  `getName` in class `AbstractFeature`
Returns:
  the name

#### getFromClipboard

    protected java.lang.Object[] getFromClipboard()

Gets original content from clipboard.

Returns:
  the content from clipboard
Throws:
  `java.lang.IllegalStateException` - if not called from UI thread

#### getCopiesFromClipBoard

    protected java.lang.Object[] getCopiesFromClipBoard​(java.lang.Object target)

Duplicates the clipboard's content.

Parameters:
  `target` - an object acting as composite parent for the copies. `null` if the copied elements should be top-level elements.
Returns:
  the copy result or `null` in case of an empty clipboard
Throws:
  `java.lang.IllegalStateException` - if not called from UI thread
See Also:
  `isCompositionAllowed(EObject, EObject[])`

#### isCompositionAllowed

    protected 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.

Parameters:
  `parent` - the composite parent
  `objects` - the objects to check
Returns:
  `true` if at least one object may be a composite child of `parent`
See Also:
  `getCopiesFromClipBoard(Object)`

#### isResolvable

    protected boolean isResolvable​(org.eclipse.emf.ecore.EObject object)

Checks if the given `EObject` can be resolved in the local `EditingDomain` of the current `DiagramBehavior`. Pasting an EObject that is not resolvable (e.g. it was just created in another editor and has not yet been persisted) may cause issues with the graphical presentation of the new object: the Graphiti update will not find any domain object and will therefore mark the object as update needed (an update triggered will then remove the shape from the diagram). At least some special handling will be needed for the paste process of such an object: e.g. the domain object could be created along with its graphical presentation during `IPasteFeature.paste(IPasteContext)`, but that may lead (depending on the domain) to other follow-up issues.
Clients may use this method to check for such a situation and react accordingly. Created as part of the fix for Bugzilla 375533.

Parameters:
  `object` - The object to check
Returns:
  `true` in case the given object can be resolved in the editing domain of the current editor, `false` otherwise.
Since:
  0.9