|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.ui.features.DefaultDeleteFeature
public class DefaultDeleteFeature
The Graphiti default implementation of the 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.
Before the deletion process starts the tool user will be asked if he really
wants to delete; the popup appears only once for multi object deletions.
Field Summary | |
---|---|
private static String |
DESC
|
private boolean |
doneChanges
|
private static String |
NAME
|
Constructor Summary | |
---|---|
DefaultDeleteFeature(IFeatureProvider fp)
Creates a new DefaultDeleteFeature . |
Method Summary | |
---|---|
boolean |
canDelete(IDeleteContext context)
Can delete hook. |
boolean |
canExecute(IContext context)
Decides if the current feature can execute with the given context. |
private List<Object> |
collectCompositeConnectionsBOs(CompositeConnection composite)
|
void |
delete(IDeleteContext context)
Hook to implement the actual delete functionality. |
protected void |
deleteBusinessObject(Object bo)
Standard functionality to delete one domain object. |
protected void |
deleteBusinessObjects(Object[] businessObjects)
Standard functionality to delete all given domain 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 |
getDescription()
Gets the description. |
String |
getName()
Hook to return the name of the delete operation e.g for display in the context menu. |
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 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. |
protected void |
setDoneChanges(boolean doneChanges)
Can be called by users (in subclasses of DefaultDeleteFeature ) to
tell the framework that changes have been done that should reflect on the
command stack. |
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature |
---|
addGraphicalRepresentation, canUndo, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDiagram, getDiagramBehavior, getDiagramEditor, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, 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.features.IFeatureProviderHolder |
---|
getFeatureProvider |
Field Detail |
---|
private static final String NAME
private static final String DESC
private boolean doneChanges
Constructor Detail |
---|
public DefaultDeleteFeature(IFeatureProvider fp)
DefaultDeleteFeature
.
fp
- the feature providerMethod Detail |
---|
public boolean canDelete(IDeleteContext context)
IDelete
canDelete
in interface IDelete
context
- the context describing the request
true
, if the feature can perform the delete
operationpublic void delete(IDeleteContext context)
IDelete
delete
in interface IDelete
context
- the contextprivate List<Object> collectCompositeConnectionsBOs(CompositeConnection composite)
protected void deleteBusinessObjects(Object[] businessObjects)
businessObjects
- the domain objects to deleteprotected void deleteBusinessObject(Object bo)
EObject
s to EcoreUtil#delete(EObject, boolean)
; non-EMF
objects will be ignored.
bo
- the domain object to deletepublic void preDelete(IDeleteContext context)
IDelete
DefaultDeleteFeature#setDoneChanges(boolean)
in case you modify
any EMF objects to enable that the command stack gets updated.
preDelete
in interface IDelete
context
- the contextpublic 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 method
IContext
public void execute(IContext context)
IFeature
execute
in interface IFeature
context
- this is the general input for this methodIContext
public String getName()
getName
in interface IName
getName
in class AbstractFeature
public 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
otherwiseprotected void setDoneChanges(boolean doneChanges)
DefaultDeleteFeature
) to
tell the framework that changes have been done that should reflect on the
command stack. The method is called by the standard implementation in
delete(IDeleteContext)
right after the first shape has been
removed from the diagram.
doneChanges
- true
in case modifications have been made,
false
otherwiseprotected boolean getUserDecision(IDeleteContext context)
context
- delete context
true
to delete element(s); false
to
cancel deleteprotected String getDeleteName(IDeleteContext context)
null
to
indicate that the popup text refers to "this object".
context
- the delete context
null
to indicate no special name
shall be used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |