org.eclipse.graphiti.ui.features
Class DefaultDeleteFeature

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

public class DefaultDeleteFeature
extends AbstractFeature
implements IDeleteFeature

The Class DefaultDeleteFeature.


Field Summary
private  boolean doneChanges
           
private static String NAME
           
 
Constructor Summary
DefaultDeleteFeature(IFeatureProvider fp)
          Creates a new DefaultDeleteFeature.
 
Method Summary
 boolean canDelete(IDeleteContext context)
          Can delete.
 boolean canExecute(IContext context)
          Decides if the current feature can execute with the given context.
 void delete(IDeleteContext context)
          Delete.
protected  void deleteBusinessObject(Object bo)
          Delete business object.
protected  void deleteBusinessObjects(Object[] businessObjects)
          Delete business objects.
 void execute(IContext context)
          Executes the current feature with the given context.
protected  String getDeleteName(IDeleteContext context)
          Returns the delete name which will be used for the delete dialog.
 String getName()
          Gets the name.
protected  boolean getUserDecision(IDeleteContext context)
          Shows a dialog which asks the user to confirm the deletion of one or more elements.
 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.
 void postDelete(IDeleteContext context)
          Post delete.
 void preDelete(IDeleteContext context)
          Pre delete.
private  void setDoneChanges(boolean doneChanges)
           
 
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDescription, 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
canUndo, isAvailable
 
Methods inherited from interface org.eclipse.graphiti.IDescription
getDescription
 
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
 

Field Detail

doneChanges

private boolean doneChanges

NAME

private static final String NAME
Constructor Detail

DefaultDeleteFeature

public DefaultDeleteFeature(IFeatureProvider fp)
Creates a new DefaultDeleteFeature.

Parameters:
fp - the feature provider
Method Detail

canDelete

public boolean canDelete(IDeleteContext context)
Description copied from interface: IDelete
Can delete.

Specified by:
canDelete in interface IDelete
Parameters:
context - the context
Returns:
true, if successful

delete

public void delete(IDeleteContext context)
Description copied from interface: IDelete
Delete.

Specified by:
delete in interface IDelete
Parameters:
context - the context

deleteBusinessObjects

protected void deleteBusinessObjects(Object[] businessObjects)
Delete business objects.

Parameters:
businessObjects - the business objects

deleteBusinessObject

protected void deleteBusinessObject(Object bo)
Delete business object.

Parameters:
bo - the bo

preDelete

public void preDelete(IDeleteContext context)
Description copied from interface: IDelete
Pre delete.

Specified by:
preDelete in interface IDelete
Parameters:
context - the context

postDelete

public void postDelete(IDeleteContext context)
Description copied from interface: IDelete
Post delete.

Specified by:
postDelete in interface IDelete
Parameters:
context - the context

canExecute

public boolean canExecute(IContext context)
Description copied from interface: IFeature
Decides if the current feature can execute with the given context.

Specified by:
canExecute in interface IFeature
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

public void execute(IContext context)
Description copied from interface: IFeature
Executes the current feature with the given context.

Specified by:
execute in interface IFeature
Parameters:
context - this is the general input for this method
See Also:
IContext

getName

public String getName()
Description copied from interface: IName
Gets the name.

Specified by:
getName in interface IName
Overrides:
getName in class AbstractFeature
Returns:
the name

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. By default all features should appear there (see implementation in AbstractFeature), but single 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 will lead to inconsistencies if this method returns false although the feature did changes.

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

setDoneChanges

private void setDoneChanges(boolean doneChanges)

getUserDecision

protected boolean getUserDecision(IDeleteContext context)
Shows a dialog which asks the user to confirm the deletion of one or more elements.

Parameters:
context - delete context
Returns:
TRUE, delete element(s); FALSE cancel delete

getDeleteName

protected String getDeleteName(IDeleteContext context)
Returns the delete name which will be used for the delete dialog. E.g. "file test.java"

Parameters:
context - the delete context
Returns:
the delete name
Since:
0.8


Copyright (c) SAP AG 2005, 2010.