Package 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,DebugFeature,DefaultAddBendpointFeature,DefaultDeleteFeature,DefaultMoveAnchorFeature,DefaultMoveBendpointFeature,DefaultMoveConnectionDecoratorFeature,DefaultMoveShapeFeature,DefaultPrintFeature,DefaultReconnectionFeature,DefaultRemoveBendpointFeature,DefaultRemoveFeature,DefaultResizeShapeFeature,DefaultSaveImageFeature,DefaultUpdateDiagramFeature,DeleteFeatureForPattern,DirectEditingFeatureForPattern,LayoutFeatureForPattern,MoveShapeFeatureForPattern,ReconnectionFeatureForPattern,RemoveFeatureForPattern,ResizeShapeFeatureForPattern,UpdateFeatureForPattern,UpdateNoBoFeature
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:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecute(IContext context) Decides if the current feature can execute with the given context.booleanDecides if the current feature can be undone - this is the undo of the execute operation.voidExecutes the current feature with the given context.booleanIs 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.booleanisAvailable(IContext context) Decides if the current feature is available with the given context.Methods inherited from interface org.eclipse.graphiti.IDescription
getDescriptionMethods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Method Details
-
isAvailable
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:
-
canExecute
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:
-
execute
Executes the current feature with the given context.- Parameters:
context- this is the general input for this method- See Also:
-
canUndo
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:
-
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 inAbstractFeature), 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
falsealthough the feature did changes.- Returns:
trueif the feature should appear in the undo stack,falseotherwise
-