org.eclipse.graphiti.features
Interface IFeature

All Superinterfaces:
IDescription, IFeatureProviderHolder, IName
All Known Subinterfaces:
IAddBendpointFeature, IAddFeature, ICopyFeature, ICreateConnectionFeature, ICreateFeature, ICustomFeature, IDeleteFeature, IDirectEditingFeature, ILayoutFeature, IMoveAnchorFeature, IMoveBendpointFeature, IMoveConnectionDecoratorFeature, IMoveFeature, IMoveShapeFeature, IPasteFeature, IPrintFeature, IReconnectionFeature, IRemoveBendpointFeature, IRemoveFeature, IResizeFeature, IResizeShapeFeature, ISaveImageFeature, IUpdateFeature
All Known Implementing Classes:
AbstractAddFeature, AbstractAddPictogramElementFeature, AbstractAddShapeFeature, AbstractAsynchronousCustomFeature, AbstractCopyFeature, AbstractCreateConnectionFeature, AbstractCreateFeature, AbstractCustomFeature, AbstractDirectEditingFeature, AbstractDrillDownFeature, AbstractFeature, AbstractLayoutFeature, AbstractMoveShapeFeature, AbstractPasteFeature, AbstractPrintFeature, AbstractSaveImageFeature, AbstractUpdateFeature, AddFeatureForPattern, CreateConnectionFeatureForPattern, CreateFeatureForPattern, DefaultAddBendpointFeature, DefaultDeleteFeature, DefaultMoveAnchorFeature, DefaultMoveBendpointFeature, DefaultMoveConnectionDecoratorFeature, DefaultMoveShapeFeature, DefaultPrintFeature, DefaultReconnectionFeature, DefaultRemoveBendpointFeature, DefaultRemoveFeature, DefaultResizeShapeFeature, DefaultSaveImageFeature, DefaultUpdateDiagramFeature, DeleteFeatureForPattern, DirectEditingFeatureForPattern, LayoutFeatureForPattern, MoveShapeFeatureForPattern, ReconnectionFeatureForPattern, RemoveFeatureForPattern, ResizeShapeFeatureForPattern, UpdateFeatureForPattern, UpdateNoBoFeature

public interface IFeature
extends IName, IDescription, IFeatureProviderHolder

The Interface IFeature provides the common API for all kinds of features in Graphiti. Features implement a piece of functionality for a Graphiti editor. Usually they implement one aspect in the lifecycle of one domain object, e.g. creating a new domain object of a specific type or adding an existing domain object to the diagram. There are various more specific sub interfaces that define the specific API for the different kinds of feature like IAddFeature or ICreateFeature. IFeature offers similar functionality as actions and commands and contains methods that enable the Graphiti framework to check if a feature is available and enabled in the current situation and a method to execute it. Classes that implement this interface may also implement ICustomUndoableFeature to provide enhanced undo/redo functionality. This might be of interest for non-EMF domain objects but also in general if you need to trigger additional operations when an undo or redo of the feature is done.

See Also:
IContext

Method Summary
 boolean canExecute(IContext context)
          Decides if the current feature can execute with the given context.
 boolean canUndo(IContext context)
          Decides if the current feature can be undone - this is the undo of the execute operation.
 void execute(IContext context)
          Executes the current feature with the given context.
 boolean hasDoneChanges()
          Is queried by the framework after a feature has been executed to find out if this feature should appear in the undo stack of e.g.
 boolean isAvailable(IContext context)
          Decides if the current feature is available with the given context.
 
Methods inherited from interface org.eclipse.graphiti.IName
getName
 
Methods inherited from interface org.eclipse.graphiti.IDescription
getDescription
 
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
 

Method Detail

isAvailable

boolean isAvailable(IContext context)
Decides if the current feature is available with the given context.

Parameters:
context - this is the general input for this method
Returns:
true if it is available, false if not
See Also:
IContext

canExecute

boolean canExecute(IContext context)
Decides if the current feature can execute with the given context.

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

void execute(IContext context)
Executes the current feature with the given context.

Parameters:
context - this is the general input for this method
See Also:
IContext

canUndo

boolean canUndo(IContext context)
Decides if the current feature can be undone - this is the undo of the execute operation.

Parameters:
context - this is the general input for this method
Returns:
true if the feature can be undone, false if not
See Also:
IContext

hasDoneChanges

boolean hasDoneChanges()
Is queried by the framework after a feature has been executed to find out if this feature should appear in the undo stack of e.g. an editor. By default all features should appear there (see implementation in AbstractFeature), but features may decide to override this behavior. Note that this is a dynamic attribute of the feature that is queried each time after the feature has been executed.

IMPORTANT NOTE: The implementor of the feature is responsible for correctly implementing this method! It might lead to inconsistencies in the command stack if this method returns false although the feature did changes.

Returns:
true if the feature should appear in the undo stack, false otherwise


Copyright (c) SAP AG 2005, 2012.