org.eclipse.graphiti.pattern
Class DeleteFeatureForPattern

java.lang.Object
  extended by org.eclipse.graphiti.features.impl.AbstractFeature
      extended by org.eclipse.graphiti.ui.features.DefaultDeleteFeature
          extended by org.eclipse.graphiti.pattern.DeleteFeatureForPattern
All Implemented Interfaces:
ICustomUndoableFeature, IDeleteFeature, IFeature, IFeatureProviderHolder, IDelete, IDescription, IName

public class DeleteFeatureForPattern
extends DefaultDeleteFeature
implements ICustomUndoableFeature

This feature wraps the delete functionality of a pattern for calls of the Graphiti framework. Clients should not need to use this class directly.

Since:
0.8.0

Field Summary
private  IFeatureForPattern delegate
           
 
Constructor Summary
DeleteFeatureForPattern(IFeatureProvider featureProvider, IPattern pattern)
          Creates a new DeleteFeatureForPattern.
 
Method Summary
 boolean canDelete(IDeleteContext context)
          Can delete hook.
 boolean canRedo(IContext context)
          Decides if the processed feature can be re-done.
 boolean canUndo(IContext context)
          Decides if the current feature can be undone - this is the undo of the execute operation.
 void delete(IDeleteContext context)
          Hook to implement the actual delete functionality.
 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.
 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.
 void redo(IContext context)
          This method will be called to actually do the work needed for redo.
 void undo(IContext context)
          This method will be called to actually do the work needed for undo.
 
Methods inherited from class org.eclipse.graphiti.ui.features.DefaultDeleteFeature
canExecute, deleteBusinessObject, deleteBusinessObjects, execute, getDeleteName, getDescription, getName, getUserDecision, setDoneChanges
 
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDiagram, getDiagramEditor, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, setProgressCallback, toString, updatePictogramElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.graphiti.features.IFeature
isAvailable
 
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
 

Field Detail

delegate

private IFeatureForPattern delegate
Constructor Detail

DeleteFeatureForPattern

public DeleteFeatureForPattern(IFeatureProvider featureProvider,
                               IPattern pattern)
Creates a new DeleteFeatureForPattern.

Parameters:
featureProvider - the feature provider
pattern - the pattern
Method Detail

canDelete

public boolean canDelete(IDeleteContext context)
Description copied from interface: IDelete
Can delete hook. Needs to be implemented in order to decide if a feature can (and wants to) handle a delete request.

Specified by:
canDelete in interface IDelete
Overrides:
canDelete in class DefaultDeleteFeature
Parameters:
context - the context describing the request
Returns:
true, if the feature can perform the delete operation

preDelete

public void preDelete(IDeleteContext context)
Description copied from interface: IDelete
Pre delete hook that can be implemented by users to perform any operations that need to be done before the standard delete functionality starts. Be sure to call DefaultDeleteFeature#setDoneChanges(boolean) in case you modify any EMF objects to enable that the command stack gets updated.

Specified by:
preDelete in interface IDelete
Overrides:
preDelete in class DefaultDeleteFeature
Parameters:
context - the context

delete

public void delete(IDeleteContext context)
Description copied from interface: IDelete
Hook to implement the actual delete functionality.

Specified by:
delete in interface IDelete
Overrides:
delete in class DefaultDeleteFeature
Parameters:
context - the context

postDelete

public void postDelete(IDeleteContext context)
Description copied from interface: IDelete
Post delete hook that can be implemented by users to perform any operations that need to be done after the standard delete functionality ends.

Specified by:
postDelete in interface IDelete
Overrides:
postDelete in class DefaultDeleteFeature
Parameters:
context - the context

canUndo

public boolean canUndo(IContext context)
Description copied from interface: IFeature
Decides if the current feature can be undone - this is the undo of the execute operation.

Specified by:
canUndo in interface ICustomUndoableFeature
Specified by:
canUndo in interface IFeature
Overrides:
canUndo in class AbstractFeature
Parameters:
context - this is the general input for this method
Returns:
true if the feature can be undone, false if not
See Also:
IContext

undo

public void undo(IContext context)
Description copied from interface: ICustomUndoableFeature
This method will be called to actually do the work needed for undo. Customers may revert their non-EMF changes done by the feature here.

Specified by:
undo in interface ICustomUndoableFeature
Parameters:
context - this is the instance of the IContext object that was in use when executing the feature

canRedo

public boolean canRedo(IContext context)
Description copied from interface: ICustomUndoableFeature
Decides if the processed feature can be re-done.

Note that as soon as any feature reports false here, also all consecutive entries in the command stack are no longer reachable for redo.

Specified by:
canRedo in interface ICustomUndoableFeature
Parameters:
context - this is the instance of the IContext object that was in use when executing the feature
Returns:
true if the feature can be re-done, false if not

redo

public void redo(IContext context)
Description copied from interface: ICustomUndoableFeature
This method will be called to actually do the work needed for redo. Customers may re-apply their non-EMF changes done by the feature here. (Usually it might be sufficient to delegate to the execution method of the feature.)

Specified by:
redo in interface ICustomUndoableFeature
Parameters:
context - this is the instance of the IContext object that was in use when executing the feature

hasDoneChanges

public boolean hasDoneChanges()
Description copied from interface: IFeature
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.

Specified by:
hasDoneChanges in interface IFeature
Overrides:
hasDoneChanges in class DefaultDeleteFeature
Returns:
true if the feature should appear in the undo stack, false otherwise


Copyright (c) SAP AG 2005, 2012.