Interface EditPolicy
- All Known Implementing Classes:
- AbstractEditPolicy,- AbstractTreeContainerEditPolicy,- BendpointEditPolicy,- ComponentEditPolicy,- ConnectionEditPolicy,- ConnectionEndpointEditPolicy,- ConstrainedLayoutEditPolicy,- ContainerEditPolicy,- DirectEditPolicy,- FlowLayoutEditPolicy,- GraphicalEditPolicy,- GraphicalNodeEditPolicy,- LayoutEditPolicy,- NonResizableEditPolicy,- OrderedLayoutEditPolicy,- ResizableEditPolicy,- RootComponentEditPolicy,- ScrollableSelectionFeedbackEditPolicy,- SelectionEditPolicy,- SelectionHandlesEditPolicy,- SnapFeedbackPolicy,- TreeContainerEditPolicy,- XYLayoutEditPolicy
- Command Creation - Returning a Commandin response togetCommand(Request)
- Feedback Management - Showing/erasing source and/or target feedback in response to Requests.
- Delegation/Forwarding - Collecting contributions from other
 EditParts (and therefore their EditPolicies). In response to a given
 Request, an EditPolicy may create a derived Request and forward it to other EditParts. For example, during the deletion of a composite EditPart, that composite may consult its children for contributions to the delete command. Then, if the children have any additional work to do, they will return additional comands to be executed.
EditPolicies should determine an EditPart's editing capabilities. It is possible to implement an EditPart such that it handles all editing responsibility. However, it is much more flexible and object-oriented to use EditPolicies. Using policies, you can pick and choose the editing behavior for an EditPart without being bound to its class hierarchy. Code reuse is increased, and code management is easier.
 IMPORTANT: This interface is not intended to be implemented by
 clients. Clients should inherit from
 AbstractEditPolicy. New methods may be
 added in the future.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe key used to install a component EditPolicy.static final StringThe key used to install a bendpoint EditPolicy.static final StringThe key used to install a connection endpoint EditPolicy.static final StringThe key used to install a connection EditPolicy.static final StringThe key used to install a container EditPolicy.static final StringThe key used to install a direct edit EditPolicy.static final StringThe key used to install a graphical node EditPolicy.static final StringThe key used to install a layout EditPolicy.static final StringThe key used to install a node EditPolicy.static final StringThe key used to install a primary drag EditPolicy.static final StringThe key used to install a selection feedback EditPolicy.static final StringThe key used to install a tree container EditPolicy.
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivate()Activates this EditPolicy.voidDeactivates the EditPolicy, the inverse ofactivate().voideraseSourceFeedback(Request request) Erases source feedback based on the givenRequest.voideraseTargetFeedback(Request request) Erases target feedback based on the givenRequest.getCommand(Request request) Returns theCommandcontribution for the givenRequest, ornull.getHost()getTargetEditPart(Request request) Returnsnullor the appropriateEditPartfor the specifiedRequest.voidSets the host in which this EditPolicy is installed.voidshowSourceFeedback(Request request) Shows or updates source feedback for the specifiedRequest.voidshowTargetFeedback(Request request) Shows or updates target feedback for the specifiedRequest.booleanunderstandsRequest(Request request) Returnstrueif this EditPolicy understand the specified request.
- 
Field Details- 
COMPONENT_ROLEThe key used to install a component EditPolicy. A component is defined as anything in the model. This EditPolicy should handle the fundamental operations that do not fit under any other EditPolicy role. For example, delete is a fundamental operation. Generally the component EditPolicy knows only about the model, and can be used in any type of EditPartViewer.- See Also:
 
- 
CONNECTION_ENDPOINTS_ROLEThe key used to install a connection endpoint EditPolicy. A connection endpoint EditPolicy is usually aSelectionHandlesEditPolicysubclass. Besides rendering selection by displayingHandles at then ends of the connection, the EditPolicy also understands how to move the endpoints of the connection. If the endpoints are moveable, the EditPolicy will show feedback and provideCommandsto perform the move.- See Also:
 
- 
CONNECTION_BENDPOINTS_ROLEThe key used to install a bendpoint EditPolicy. A bendpoint EditPolicy is an optional EditPolicy for connections that are visibile. As withendpoints, bendpoint EditPolicies are porbablySelectionHandlesEditPolicy.- See Also:
 
- 
CONNECTION_ROLEThe key used to install a connection EditPolicy. The behavior of aConnectionEditPartmay be implemented in its component EditPolicy,- See Also:
 
- 
CONTAINER_ROLEThe key used to install a container EditPolicy.- See Also:
 
- 
DIRECT_EDIT_ROLEThe key used to install a direct edit EditPolicy.- See Also:
 
- 
GRAPHICAL_NODE_ROLEThe key used to install a graphical node EditPolicy.- See Also:
 
- 
LAYOUT_ROLEThe key used to install a layout EditPolicy.- See Also:
 
- 
NODE_ROLEThe key used to install a node EditPolicy.- See Also:
 
- 
PRIMARY_DRAG_ROLEThe key used to install a primary drag EditPolicy.- See Also:
 
- 
SELECTION_FEEDBACK_ROLEThe key used to install a selection feedback EditPolicy.- See Also:
 
- 
TREE_CONTAINER_ROLEThe key used to install a tree container EditPolicy.- See Also:
 
 
- 
- 
Method Details- 
activatevoid activate()Activates this EditPolicy. The EditPolicy might need to hook listeners. These listeners should be unhooked indeactivate(). The EditPolicy might also contribute feedback/visuals immediately, such as selection handles if the EditPart was selected at the time of activation.Activate is called after the host has been set, and that host has been activated. - See Also:
 
- 
deactivatevoid deactivate()Deactivates the EditPolicy, the inverse ofactivate(). Deactivate is called when the host is deactivated, or when the EditPolicy is uninstalled from an active host. Deactivate unhooks any listeners, and removes all feedback.- See Also:
 
- 
eraseSourceFeedbackErases source feedback based on the givenRequest. Does nothing if the EditPolicy does not apply to the given Request.This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies.- Parameters:
- request- the Request
 
- 
eraseTargetFeedbackErases target feedback based on the givenRequest. Does nothing if the EditPolicy does not apply to the given Request.This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies.- Parameters:
- request- the Request
 
- 
getCommandReturns theCommandcontribution for the givenRequest, ornull.nullis treated as a no-op by the caller, or an empty contribution. The EditPolicy must return anUnexecutableCommandif it wishes to disallow the Request.This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies. The EditPart will combine each EditPolicy's contribution into aCompoundCommand.- Parameters:
- request- the Request
- Returns:
- nullor a Command contribution
 
- 
getHostEditPart getHost()- Returns:
- the host EditPart on which this policy is installed.
 
- 
getTargetEditPartReturnsnullor the appropriateEditPartfor the specifiedRequest. In general, this EditPolicy will return its host EditPart if it understands the Request. Otherwise, it will returnnull.This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies. The first non-nullresult returned by an EditPolicy is returned by the EditPart.- Parameters:
- request- the Request
- Returns:
- nullor the appropriate target- EditPart
 
- 
setHostSets the host in which this EditPolicy is installed.- Parameters:
- editpart- the host EditPart
 
- 
showSourceFeedbackShows or updates source feedback for the specifiedRequest. This method may be called repeatedly for the purpose of updating feedback based on changes to the Request.Does nothing if the EditPolicy does not recognize the given Request. This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies.- Parameters:
- request- the Request
 
- 
showTargetFeedbackShows or updates target feedback for the specifiedRequest. This method may be called repeatedly for the purpose of updating feedback based on changes to the Request.Does nothing if the EditPolicy does not recognize the given request. This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies.- Parameters:
- request- the Request
 
- 
understandsRequestReturnstrueif this EditPolicy understand the specified request.This method is declared on EditPart, and is redeclared here so that EditPart can delegate its implementation to each of its EditPolicies.EditPartreturnstrueif any of its EditPolicies returnstrue. In other words, it performs a logical OR.- Parameters:
- request- the Request
- Returns:
- boolean trueif the EditPolicy understands the specified request
- See Also:
 
 
-