Package org.eclipse.gef.editpolicies
Class DirectEditPolicy
- java.lang.Object
-
- org.eclipse.gef.editpolicies.AbstractEditPolicy
-
- org.eclipse.gef.editpolicies.GraphicalEditPolicy
-
- org.eclipse.gef.editpolicies.DirectEditPolicy
-
- All Implemented Interfaces:
EditPolicy,RequestConstants
public abstract class DirectEditPolicy extends GraphicalEditPolicy
Shows DirectEdit feedback and creates the Command to perform a "direct edit". Direct Edit is when the User is editing a property of an EditPart directly (as opposed to in the Properties View) in the Viewer using aCellEditor. This EditPolicy is typically installed usingEditPolicy.DIRECT_EDIT_ROLE.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from interface org.eclipse.gef.EditPolicy
COMPONENT_ROLE, CONNECTION_BENDPOINTS_ROLE, CONNECTION_ENDPOINTS_ROLE, CONNECTION_ROLE, CONTAINER_ROLE, DIRECT_EDIT_ROLE, GRAPHICAL_NODE_ROLE, LAYOUT_ROLE, NODE_ROLE, PRIMARY_DRAG_ROLE, SELECTION_FEEDBACK_ROLE, TREE_CONTAINER_ROLE
-
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
-
-
Constructor Summary
Constructors Constructor Description DirectEditPolicy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voideraseDirectEditFeedback(DirectEditRequest request)If feedback is being shown, this method callsrevertOldEditValue(DirectEditRequest).voideraseSourceFeedback(Request request)Does nothing by default.CommandgetCommand(Request request)Returnsnullby default.protected abstract CommandgetDirectEditCommand(DirectEditRequest request)Returns theCommandto perform the direct edit.protected voidrevertOldEditValue(DirectEditRequest request)Helps erase feedback by reverting the original edit value.protected abstract voidshowCurrentEditValue(DirectEditRequest request)Override to show the current direct edit value in the host's Figure.protected voidshowDirectEditFeedback(DirectEditRequest request)Pushes the original edit value if necessary, and shows feedback.voidshowSourceFeedback(Request request)Does nothing by default.protected voidstoreOldEditValue(DirectEditRequest request)Called to remember the old value before direct edit feedback begins.booleanunderstandsRequest(Request request)ReturnstrueforRequestConstants.REQ_DIRECT_EDIT.-
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback
-
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
activate, deactivate, debugFeedback, eraseTargetFeedback, getHost, getTargetEditPart, setHost, showTargetFeedback, toString
-
-
-
-
Method Detail
-
eraseSourceFeedback
public void eraseSourceFeedback(Request request)
Description copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
eraseSourceFeedbackin interfaceEditPolicy- Overrides:
eraseSourceFeedbackin classAbstractEditPolicy- Parameters:
request- the Request- See Also:
EditPolicy.eraseSourceFeedback(Request)
-
eraseDirectEditFeedback
protected void eraseDirectEditFeedback(DirectEditRequest request)
If feedback is being shown, this method callsrevertOldEditValue(DirectEditRequest).- Parameters:
request- the DirectEditRequest
-
getCommand
public Command getCommand(Request request)
Description copied from class:AbstractEditPolicyReturnsnullby default.nullis used to indicate that the EditPolicy does not contribute to the specifiedRequest.- Specified by:
getCommandin interfaceEditPolicy- Overrides:
getCommandin classAbstractEditPolicy- Parameters:
request- the Request- Returns:
nullor a Command contribution- See Also:
EditPolicy.getCommand(Request)
-
getDirectEditCommand
protected abstract Command getDirectEditCommand(DirectEditRequest request)
Returns theCommandto perform the direct edit.- Parameters:
request- the DirectEditRequest- Returns:
- the command to perform the direct edit
-
revertOldEditValue
protected void revertOldEditValue(DirectEditRequest request)
Helps erase feedback by reverting the original edit value. The rule when using GEF is that all feedback is removed before changes to the model are made. By default, the host is sentEditPart.refresh(), which should cause it to refresh all properties. Subclasses can override this method to perform a more specific revert.- Parameters:
request- the DirectEditRequest- See Also:
storeOldEditValue(DirectEditRequest)
-
showSourceFeedback
public void showSourceFeedback(Request request)
Description copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
showSourceFeedbackin interfaceEditPolicy- Overrides:
showSourceFeedbackin classAbstractEditPolicy- Parameters:
request- the Request- See Also:
EditPolicy.showSourceFeedback(Request)
-
showDirectEditFeedback
protected void showDirectEditFeedback(DirectEditRequest request)
Pushes the original edit value if necessary, and shows feedback.- Parameters:
request- the DirectEditRequest
-
showCurrentEditValue
protected abstract void showCurrentEditValue(DirectEditRequest request)
Override to show the current direct edit value in the host's Figure. Although the CellEditor will probably cover the figure's display of this value, updating the figure will cause its preferred size to reflect the new value.- Parameters:
request- the DirectEditRequest
-
storeOldEditValue
protected void storeOldEditValue(DirectEditRequest request)
Called to remember the old value before direct edit feedback begins. After feedback is over,revertOldEditValue(DirectEditRequest)is called to undo the changes done by feedback. By default, this method nothing.- Parameters:
request- the DirectEditRequest
-
understandsRequest
public boolean understandsRequest(Request request)
ReturnstrueforRequestConstants.REQ_DIRECT_EDIT.DirectEditActionwill determine enablement based on whether the selected EditPart understands "direct edit".- Specified by:
understandsRequestin interfaceEditPolicy- Overrides:
understandsRequestin classAbstractEditPolicy- Parameters:
request- the Request- Returns:
- boolean
trueif the EditPolicy understands the specified request - See Also:
EditPolicy.understandsRequest(Request)
-
-