public class DefaultDeleteFeature extends AbstractFeature implements IDeleteFeature
IDeleteFeature
. It cares
about removing the shape(s) representing the deleted domain object(s) from
the diagram (by delegating to the IRemoveFeature
provided by the
IFeatureProvider
. After that the EMF domain objects will be deleted
using standard EMF functionality.Constructor and Description |
---|
DefaultDeleteFeature(IFeatureProvider fp)
Creates a new
DefaultDeleteFeature . |
Modifier and Type | Method and Description |
---|---|
boolean |
canDelete(IDeleteContext context)
Can delete hook.
|
boolean |
canExecute(IContext context)
Decides if the current feature can execute with the given context.
|
void |
delete(IDeleteContext context)
Hook to implement the actual delete functionality.
|
void |
execute(IContext context)
Executes the current feature with the given context.
|
java.lang.String |
getDescription()
Gets the description.
|
java.lang.String |
getName()
Hook to return the name of the delete operation e.g for display in the
context menu.
|
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 |
isDeleteAbort()
The Graphiti framework will call this method after
IDelete.preDelete(IDeleteContext) has been called and before the actual
delete is done. |
void |
postDelete(IDeleteContext context)
Post delete hook that can be implemented by users to perform any
operations that need to be done after the standard delete functionality
ends.
|
void |
preDelete(IDeleteContext context)
Pre delete hook that can be implemented by users to perform any
operations that need to be done before the standard delete functionality
starts.
|
canUndo, getFeatureProvider, isAvailable, manageFont, manageFont, setProgressCallback, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
canUndo, isAvailable
getFeatureProvider
public DefaultDeleteFeature(IFeatureProvider fp)
DefaultDeleteFeature
.fp
- the feature providerpublic boolean canDelete(IDeleteContext context)
IDelete
public void delete(IDeleteContext context)
IDelete
public void preDelete(IDeleteContext context)
IDelete
DefaultDeleteFeature#setDoneChanges(boolean)
in case you modify
any EMF objects to enable that the command stack gets updated.public boolean isDeleteAbort()
IDelete
IDelete.preDelete(IDeleteContext)
has been called and before the actual
delete is done. In case this method returns true
, the
operation will be cancelled by the Graphiti framework by throwing an
OperationCanceledException
that causes am EMF revert of the
operation.
Implementing classes might e.g. set a flag in
IDelete.preDelete(IDeleteContext)
as cancellation indication and check
that that flag here.
isDeleteAbort
in interface IDelete
true
in case you want to cancel the current
operation, false
otherwise.public void postDelete(IDeleteContext context)
IDelete
postDelete
in interface IDelete
context
- the contextpublic boolean canExecute(IContext context)
IFeature
canExecute
in interface IFeature
context
- this is the general input for this methodIContext
public void execute(IContext context)
IFeature
public java.lang.String getName()
getName
in interface IName
getName
in class AbstractFeature
public java.lang.String getDescription()
IDescription
getDescription
in interface IDescription
getDescription
in class AbstractFeature
public boolean hasDoneChanges()
IFeature
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.
hasDoneChanges
in interface IFeature
hasDoneChanges
in class AbstractFeature
true
if the feature should appear in the undo stack,
false
otherwise