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
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 a
CellEditor. This EditPolicy is typically
installed using EditPolicy.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_ROLEFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voideraseDirectEditFeedback(DirectEditRequest request) If feedback is being shown, this method callsrevertOldEditValue(DirectEditRequest).voideraseSourceFeedback(Request request) Does nothing by default.getCommand(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, getHost, getHostFigure, getLayer, removeFeedbackMethods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
activate, deactivate, debugFeedback, eraseTargetFeedback, getTargetEditPart, setHost, showTargetFeedback, toString
-
Constructor Details
-
DirectEditPolicy
public DirectEditPolicy()
-
-
Method Details
-
eraseSourceFeedback
Description copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
eraseSourceFeedbackin interfaceEditPolicy- Overrides:
eraseSourceFeedbackin classAbstractEditPolicy- Parameters:
request- the Request- See Also:
-
eraseDirectEditFeedback
If feedback is being shown, this method callsrevertOldEditValue(DirectEditRequest).- Parameters:
request- the DirectEditRequest
-
getCommand
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:
-
getDirectEditCommand
Returns theCommandto perform the direct edit.- Parameters:
request- the DirectEditRequest- Returns:
- the command to perform the direct edit
-
revertOldEditValue
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:
-
showSourceFeedback
Description copied from class:AbstractEditPolicyDoes nothing by default.- Specified by:
showSourceFeedbackin interfaceEditPolicy- Overrides:
showSourceFeedbackin classAbstractEditPolicy- Parameters:
request- the Request- See Also:
-
showDirectEditFeedback
Pushes the original edit value if necessary, and shows feedback.- Parameters:
request- the DirectEditRequest
-
showCurrentEditValue
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
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
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:
-