Package org.eclipse.graphiti.features.impl

# Class AbstractFeatureProvider

java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeatureProvider

All Implemented Interfaces:
  `IFeatureProvider`, `IMappingProvider`

Direct Known Subclasses:
  `DefaultFeatureProvider`

public abstract class AbstractFeatureProvider extends Object implements IFeatureProvider
The Class AbstractFeatureProvider.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final PictogramElement[]`
`EMPTY_PICTOGRAM_ELEMENTS`
The Constant EMPTY_PICTOGRAM_ELEMENTS.
`protected static final org.eclipse.emf.ecore.EObject[]`
`NO_OBJECTS`
The Constant EMPTY_REF_OBJECTS.

## Constructor Summary

Constructors
Constructor
Description
`AbstractFeatureProvider(IDiagramTypeProvider diagramTypeProvider)`
Creates a new `AbstractFeatureProvider`.

## Method Summary

Modifier and Type
Method
Description
`PictogramElement`
`addIfPossible(IAddContext context)`
Adds the if possible.
`IReason`
`canAdd(IAddContext context)`
Can add.
`IReason`
`canLayout(ILayoutContext context)`
Checks if an layout process can be processed.
`IReason`
`canUpdate(IUpdateContext context)`
Checks if an update process can be processed.
`void`
`dispose()`
This is called to dispose the object.
`IAddBendpointFeature`
`getAddBendpointFeature(IAddBendpointContext context)`
Add bendpoint features handle the user's requst to have more connection bendpoints.
`IAddFeature`
`getAddFeature(IAddContext context)`
Add features create graphical representations of domain model objects.
`Object[]`
`getAllBusinessObjectsForPictogramElement(PictogramElement pictogramElement)`
Returns all business objects which are linked to the given pictogram element.
`PictogramElement[]`
`getAllPictogramElementsForBusinessObject(Object businessObject)`
Provides the pictogram elements which represents the given business object.
`Object`
`getBusinessObjectForPictogramElement(PictogramElement pictogramElement)`
Returns the first of possibly several business objects which are linked to the given pictogram element.
`ICreateConnectionFeature[]`
`getCreateConnectionFeatures()`
Gets the create connection features.
`ICreateFeature[]`
`getCreateFeatures()`
Provides all create features.
`ICustomFeature[]`
`getCustomFeatures(ICustomContext context)`
Custom features can do anything.
`IDeleteFeature`
`getDeleteFeature(IDeleteContext context)`
Delete features remove the grapical representations of domain model objects as well as the domain model objects itself.
`IDiagramTypeProvider`
`getDiagramTypeProvider()`
Returns the diagram type provider.
`IDirectEditingFeature`
`getDirectEditingFeature(IDirectEditingContext context)`
Direct editing features handle direct editing functionality (including drop down lists and text completion).
`final IDirectEditingInfo`
`getDirectEditingInfo()`
If a creation feature wants to switch directly into the direct editing mode (after the object creation),
it must provide the necessary information via this object.
`IFeature[]`
`getDragAndDropFeatures(IPictogramElementContext context)`
if the user should be able to create connections directly from a pictogram element without using the connection tool you can provide an array of features.
`protected final IIndependenceSolver`
`getIndependenceSolver()`
Gets the independence solver.
`ILayoutFeature`
`getLayoutFeature(ILayoutContext context)`
Layout features do the layouting work (sizes and dimensions) inside (and/or) outside a pictogram element.
`protected ILinkService`
`getLinkService()`
`IMoveAnchorFeature`
`getMoveAnchorFeature(IMoveAnchorContext context)`
Move features respond to user's move requests.
`IMoveBendpointFeature`
`getMoveBendpointFeature(IMoveBendpointContext context)`
Move features respond to user's move requests.
`IMoveConnectionDecoratorFeature`
`getMoveConnectionDecoratorFeature(IMoveConnectionDecoratorContext context)`
Move features respond to user's move requests.
`IMoveShapeFeature`
`getMoveShapeFeature(IMoveShapeContext context)`
Move shape features respond to user's move requests.
`PictogramElement`
`getPictogramElementForBusinessObject(Object businessObject)`
Provides the first pictogram element which represents the given business object.
`abstract IPrintFeature`
`getPrintFeature()`
It is planned to use this for printing support.
`IReconnectionFeature`
`getReconnectionFeature(IReconnectionContext context)`
Reconnection features handle the change of a connection's start or end anchor.
`IRemoveBendpointFeature`
`getRemoveBendpointFeature(IRemoveBendpointContext context)`
Add bendpoint features handle the user's requst to remove connection bendpoints.
`IRemoveFeature`
`getRemoveFeature(IRemoveContext context)`
Remove features remove the grapical representations of domain model objects.
`IResizeShapeFeature`
`getResizeShapeFeature(IResizeShapeContext context)`
Resize shape features respond to user's resize requests.
`abstract ISaveImageFeature`
`getSaveImageFeature()`
It is planned to use this for save as image support.
`IUpdateFeature`
`getUpdateFeature(IUpdateContext context)`
Update features do the synchronization work and transport data from domain model to pictograms model elements.
`boolean`
`hasPictogramElementForBusinessObject(Object businessObject)`
Check does there have pictogram element linked to this business object.
`IReason`
`layoutIfPossible(ILayoutContext context)`
Process the layout process.
`void`
`link(PictogramElement pictogramElement, Object businessObject)`
Links the pictogram element with a business object.
`void`
`link(PictogramElement pictogramElement, Object[] businessObjects)`
Links the pictogram element with several business objects.
`protected final void`
`setIndependenceSolver(IIndependenceSolver independenceSolver)`
Sets the independence solver.
`IReason`
`updateIfPossible(IUpdateContext context)`
Process the update process.
`IReason`
`updateIfPossibleAndNeeded(IUpdateContext context)`
Update if possible and needed.
`IReason`
`updateNeeded(IUpdateContext context)`
Checks if an update process is needed and has be processed.

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

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

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

`getCopyFeature, getPasteFeature`

## Field Details

### NO_OBJECTS

protected static final org.eclipse.emf.ecore.EObject[] NO_OBJECTS
The Constant EMPTY_REF_OBJECTS.

### EMPTY_PICTOGRAM_ELEMENTS

protected static final PictogramElement[] EMPTY_PICTOGRAM_ELEMENTS
The Constant EMPTY_PICTOGRAM_ELEMENTS.

## Constructor Details

### AbstractFeatureProvider

public AbstractFeatureProvider(IDiagramTypeProvider diagramTypeProvider)
Creates a new `AbstractFeatureProvider`.

Parameters:
  `diagramTypeProvider` - the diagram type provider

## Method Details

### getAddFeature

public IAddFeature getAddFeature(IAddContext context)
Description copied from interface: `IFeatureProvider`
Add features create graphical representations of domain model objects.

Specified by:
  `getAddFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  add feature according to the given context
See Also:
  - `IAddFeature`

### getCreateConnectionFeatures

public ICreateConnectionFeature[] getCreateConnectionFeatures()
Description copied from interface: `IFeatureProvider`
Gets the create connection features.

Specified by:
  `getCreateConnectionFeatures` in interface `IFeatureProvider`
Returns:
  all features to create connections
See Also:
  - `ICreateConnectionFeature`

### getCreateFeatures

public ICreateFeature[] getCreateFeatures()
Description copied from interface: `IFeatureProvider`
Provides all create features. In the graphics framework they will be visualized in an editor as create tools.

Specified by:
  `getCreateFeatures` in interface `IFeatureProvider`
Returns:
  all create features
See Also:
  - `ICreateFeature`

### getCustomFeatures

public ICustomFeature[] getCustomFeatures(ICustomContext context)
Description copied from interface: `IFeatureProvider`
Custom features can do anything. Their functionality can not be planned by the graphics framework (team).

Specified by:
  `getCustomFeatures` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  custom feature according to the given context
See Also:
  - `ICustomFeature`

### getDeleteFeature

public IDeleteFeature getDeleteFeature(IDeleteContext context)
Description copied from interface: `IFeatureProvider`
Delete features remove the grapical representations of domain model objects as well as the domain model objects itself.

Specified by:
  `getDeleteFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  delete feature according to the given context
See Also:
  - `IDeleteFeature`

### getDiagramTypeProvider

public IDiagramTypeProvider getDiagramTypeProvider()
Description copied from interface: `IFeatureProvider`
Returns the diagram type provider.

Specified by:
  `getDiagramTypeProvider` in interface `IFeatureProvider`
Returns:
  the diagram type provider
See Also:
  - `IDiagramTypeProvider`

### getMoveAnchorFeature

public IMoveAnchorFeature getMoveAnchorFeature(IMoveAnchorContext context)
Description copied from interface: `IFeatureProvider`
Move features respond to user's move requests. This one is especially for fix point anchors ( `FixPointAnchor`).

Specified by:
  `getMoveAnchorFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  move feature according to the given context
See Also:
  - `IMoveAnchorFeature`

### getRemoveFeature

public IRemoveFeature getRemoveFeature(IRemoveContext context)
Description copied from interface: `IFeatureProvider`
Remove features remove the grapical representations of domain model objects.

Specified by:
  `getRemoveFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  remove feature according to the given context
See Also:
  - `IRemoveFeature`

### getUpdateFeature

public IUpdateFeature getUpdateFeature(IUpdateContext context)
Description copied from interface: `IFeatureProvider`
Update features do the synchronization work and transport data from domain model to pictograms model elements.

Specified by:
  `getUpdateFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  update feature according to the given context
See Also:
  - `IUpdateFeature`

### getLayoutFeature

public ILayoutFeature getLayoutFeature(ILayoutContext context)
Description copied from interface: `IFeatureProvider`
Layout features do the layouting work (sizes and dimensions) inside (and/or) outside a pictogram element.

Specified by:
  `getLayoutFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  layout feature according to the given context
See Also:
  - `ILayoutFeature`

### getMoveShapeFeature

public IMoveShapeFeature getMoveShapeFeature(IMoveShapeContext context)
Description copied from interface: `IFeatureProvider`
Move shape features respond to user's move requests.

Specified by:
  `getMoveShapeFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  move feature according to the given context
See Also:
  - `IMoveShapeFeature`

### getMoveConnectionDecoratorFeature

public IMoveConnectionDecoratorFeature getMoveConnectionDecoratorFeature(IMoveConnectionDecoratorContext context)
Description copied from interface: `IFeatureProvider`
Move features respond to user's move requests.

Specified by:
  `getMoveConnectionDecoratorFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  move feature according to the given context
See Also:
  - `IMoveConnectionDecoratorFeature`

### getMoveBendpointFeature

public IMoveBendpointFeature getMoveBendpointFeature(IMoveBendpointContext context)
Description copied from interface: `IFeatureProvider`
Move features respond to user's move requests. This one is especially for fix point anchors ( `FixPointAnchor`).

Specified by:
  `getMoveBendpointFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  move feature according to the given context
See Also:
  - `IMoveBendpointFeature`

### getResizeShapeFeature

public IResizeShapeFeature getResizeShapeFeature(IResizeShapeContext context)
Description copied from interface: `IFeatureProvider`
Resize shape features respond to user's resize requests.

Specified by:
  `getResizeShapeFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  resize feature according to the given context
See Also:
  - `IResizeShapeFeature`

### getAddBendpointFeature

public IAddBendpointFeature getAddBendpointFeature(IAddBendpointContext context)
Description copied from interface: `IFeatureProvider`
Add bendpoint features handle the user's requst to have more connection bendpoints.

Specified by:
  `getAddBendpointFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  add feature according to the given context
See Also:
  - `IAddBendpointFeature`
  - `IAddBendpointContext`

### getRemoveBendpointFeature

public IRemoveBendpointFeature getRemoveBendpointFeature(IRemoveBendpointContext context)
Description copied from interface: `IFeatureProvider`
Add bendpoint features handle the user's requst to remove connection bendpoints.

Specified by:
  `getRemoveBendpointFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  remove feature according to the given context
See Also:
  - `IRemoveBendpointFeature`

### getDirectEditingFeature

public IDirectEditingFeature getDirectEditingFeature(IDirectEditingContext context)
Description copied from interface: `IFeatureProvider`
Direct editing features handle direct editing functionality (including drop down lists and text completion).

Specified by:
  `getDirectEditingFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  direct editing feature according to the given context
See Also:
  - `IDirectEditingFeature`

### canUpdate

public IReason canUpdate(IUpdateContext context)
Description copied from interface: `IFeatureProvider`
Checks if an update process can be processed. Usually implementers have to check the context.

Specified by:
  `canUpdate` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### canLayout

public IReason canLayout(ILayoutContext context)
Description copied from interface: `IFeatureProvider`
Checks if an layout process can be processed. Usually implementers have to check the context.

Specified by:
  `canLayout` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### updateIfPossible

public IReason updateIfPossible(IUpdateContext context)
Description copied from interface: `IFeatureProvider`
Process the update process. Usually reads businees data and modifies pictograms model.

Specified by:
  `updateIfPossible` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### layoutIfPossible

public IReason layoutIfPossible(ILayoutContext context)
Description copied from interface: `IFeatureProvider`
Process the layout process.

Specified by:
  `layoutIfPossible` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason, simply a `true` `IReason` in case the layout operation was executed, a `false` `IReason` otherwise.

### updateNeeded

public IReason updateNeeded(IUpdateContext context)
Description copied from interface: `IFeatureProvider`
Checks if an update process is needed and has be processed. Usually implementers have to compare pictograms and business data.

Specified by:
  `updateNeeded` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### updateIfPossibleAndNeeded

public IReason updateIfPossibleAndNeeded(IUpdateContext context)
Description copied from interface: `IFeatureProvider`
Update if possible and needed.

Specified by:
  `updateIfPossibleAndNeeded` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### addIfPossible

public PictogramElement addIfPossible(IAddContext context)
Description copied from interface: `IFeatureProvider`
Adds the if possible.

Specified by:
  `addIfPossible` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  added pictogram elements

### canAdd

public IReason canAdd(IAddContext context)
Description copied from interface: `IFeatureProvider`
Can add.

Specified by:
  `canAdd` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  status and reason

### getDirectEditingInfo

public final IDirectEditingInfo getDirectEditingInfo()
Description copied from interface: `IFeatureProvider`
If a creation feature wants to switch directly into the direct editing mode (after the object creation),
it must provide the necessary information via this object.

Specified by:
  `getDirectEditingInfo` in interface `IFeatureProvider`
Returns:
  `IDirectEditingInfo`

### getReconnectionFeature

public IReconnectionFeature getReconnectionFeature(IReconnectionContext context)
Description copied from interface: `IFeatureProvider`
Reconnection features handle the change of a connection's start or end anchor.

Specified by:
  `getReconnectionFeature` in interface `IFeatureProvider`
Parameters:
  `context` - the context
Returns:
  reconnection feature according to the given context
See Also:
  - `IReconnectionFeature`

### getPrintFeature

public abstract IPrintFeature getPrintFeature()
Description copied from interface: `IFeatureProvider`
It is planned to use this for printing support. Not yet supported perfectly. The default implementation in `AbstractFeatureProvider` returns the an instance of
invalid reference

    DefaultPrintFeature

which could be overridden to influence the standard behaviour.
Return `null` to disable printing.

Specified by:
  `getPrintFeature` in interface `IFeatureProvider`
Returns:
  The print feature to use or `null` to disable printing.
See Also:
  - `IPrintFeature`

### getSaveImageFeature

public abstract ISaveImageFeature getSaveImageFeature()
Description copied from interface: `IFeatureProvider`
It is planned to use this for save as image support. Not yet supported perfectly. The default implementation in `AbstractFeatureProvider` returns the an instance of
invalid reference

    DefaultSaveImageFeature

which could be overridden to influence the standard behaviour.
Return `null` to disable save as image.

Specified by:
  `getSaveImageFeature` in interface `IFeatureProvider`
Returns:
  The save feature to use or `null` to disable save as image.

### getDragAndDropFeatures

public IFeature[] getDragAndDropFeatures(IPictogramElementContext context)
Description copied from interface: `IFeatureProvider`
if the user should be able to create connections directly from a pictogram element without using the connection tool you can provide an array of features. By providing one feature this feature will be executed directly on drop. By providing 2 or more features a popup menu will let the user select the feature.

Specified by:
  `getDragAndDropFeatures` in interface `IFeatureProvider`
Parameters:
  `context` - - the pictogram element the drag and drop should be initiated on
Returns:
  an array of features or null.

### getAllBusinessObjectsForPictogramElement

public Object[] getAllBusinessObjectsForPictogramElement(PictogramElement pictogramElement)
Description copied from interface: `IMappingProvider`
Returns all business objects which are linked to the given pictogram element. Equality is determined by calling the `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` method, but this might be changed by clients by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`.

Specified by:
  `getAllBusinessObjectsForPictogramElement` in interface `IMappingProvider`
Parameters:
  `pictogramElement` - The pictogram element for which to return the business objects.
Returns:
  The business objects which are linked to the given pictogram element. Can be empty but not null.
See Also:
  - `IMappingProvider.link(PictogramElement, Object[])`

### getBusinessObjectForPictogramElement

public Object getBusinessObjectForPictogramElement(PictogramElement pictogramElement)
Description copied from interface: `IMappingProvider`
Returns the first of possibly several business objects which are linked to the given pictogram element. Equality is determined by calling the `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` method, but this might be changed by clients by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`. This is a convenience method for `IMappingProvider.getAllBusinessObjectsForPictogramElement(PictogramElement)`, because in many usecases only a single business object is linked.

Specified by:
  `getBusinessObjectForPictogramElement` in interface `IMappingProvider`
Parameters:
  `pictogramElement` - The pictogram element for which to return the business object.
Returns:
  The first of possibly several business objects which are linked to the given pictogram element. Can be null.
See Also:
  - `IMappingProvider.link(PictogramElement, Object)`

### getAllPictogramElementsForBusinessObject

public PictogramElement[] getAllPictogramElementsForBusinessObject(Object businessObject)
Description copied from interface: `IMappingProvider`
Provides the pictogram elements which represents the given business object.

Specified by:
  `getAllPictogramElementsForBusinessObject` in interface `IMappingProvider`
Parameters:
  `businessObject` - the given business object
Returns:
  the pictogram elements

### getPictogramElementForBusinessObject

public PictogramElement getPictogramElementForBusinessObject(Object businessObject)
Provides the first pictogram element which represents the given business object.

Specified by:
  `getPictogramElementForBusinessObject` in interface `IMappingProvider`
Parameters:
  `businessObject` - the business object
Returns:
  the pictogram element for business object
See Also:
  - `IMappingProvider.getAllPictogramElementsForBusinessObject(Object)`

### hasPictogramElementForBusinessObject

public boolean hasPictogramElementForBusinessObject(Object businessObject)
Check does there have pictogram element linked to this business object.

Specified by:
  `hasPictogramElementForBusinessObject` in interface `IMappingProvider`
Parameters:
  `businessObject` - the business object
Returns:
  true when at least one pictogram element is linked, otherwise return false.

### link

public void link(PictogramElement pictogramElement, Object businessObject)
Description copied from interface: `IMappingProvider`
Links the pictogram element with a business object. This deletes all previous links of this pictogram element.

Specified by:
  `link` in interface `IMappingProvider`
Parameters:
  `pictogramElement` - The pictogram element which to link to a new business object.
  `businessObject` - The business object to link. Can be null to just delete previous links.

### link

public void link(PictogramElement pictogramElement, Object[] businessObjects)
Description copied from interface: `IMappingProvider`
Links the pictogram element with several business objects. This deletes all previous links of this pictogram element.

Specified by:
  `link` in interface `IMappingProvider`
Parameters:
  `pictogramElement` - The pictogram element which to link to new business objects.
  `businessObjects` - The business objects to link. Can be null or empty to just delete previous links.

### getIndependenceSolver

protected final IIndependenceSolver getIndependenceSolver()
Gets the independence solver.

Returns:
  the independence solver

### setIndependenceSolver

protected final void setIndependenceSolver(IIndependenceSolver independenceSolver)
Sets the independence solver.

Parameters:
  `independenceSolver` - the new independence solver

### dispose

public void dispose()
Description copied from interface: `IFeatureProvider`
This is called to dispose the object.

Specified by:
  `dispose` in interface `IFeatureProvider`

### getLinkService

protected ILinkService getLinkService()