public interface IFeature extends IName, IDescription, IFeatureProviderHolder
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.IContext
Modifier and Type | Method and Description |
---|---|
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.
|
getDescription
getFeatureProvider
boolean isAvailable(IContext context)
context
- this is the general input for this methodIContext
boolean canExecute(IContext context)
context
- this is the general input for this methodIContext
void execute(IContext context)
context
- this is the general input for this methodIContext
boolean canUndo(IContext context)
context
- this is the general input for this methodIContext
boolean hasDoneChanges()
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.
true
if the feature should appear in the undo stack,
false
otherwise