Eclipse GEF
2.1

org.eclipse.gef.editpolicies
Class ComponentEditPolicy

java.lang.Object
  |
  +--org.eclipse.gef.editpolicies.AbstractEditPolicy
        |
        +--org.eclipse.gef.editpolicies.ComponentEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants
Direct Known Subclasses:
RootComponentEditPolicy

public abstract class ComponentEditPolicy
extends AbstractEditPolicy

A model-based EditPolicy for components within a container. A model-based EditPolicy only knows about the host's model and the basic operations it supports. A component is anything that is inside a container. By default, ComponentEditPolicy understands being DELETEd from its container, and being ORPHANed from its container. Subclasses can add support to handle additional behavior specific to the model.

ORPHAN is forwarded to the parent EditPart for it to handle.

DELETE is also forwarded to the parent EditPart, but subclasses may also contribute to the delete by overriding createDeleteCommand(GroupRequest).

This EditPolicy is not a GraphicalEditPolicy, and should not be used to show feedback or interact with the host's visuals in any way.

This EditPolicy should not be used with ConnectionEditPart. Connections do not really have a parent; use ConnectionEditPolicy.

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_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
ComponentEditPolicy()
           
 
Method Summary
protected  Command createDeleteCommand(GroupRequest deleteRequest)
          Override to contribute to the component's being deleted.
 Command getCommand(Request request)
          Factors the incoming Request into ORPHANs and DELETEs.
protected  Command getDeleteCommand(GroupRequest request)
          Combines the DELETE contribution from this class and the parent.
protected  Command getOrphanCommand()
          Returns the command contribution for orphaning this component from its container.
 
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
activate, deactivate, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, getHost, getTargetEditPart, setHost, showSourceFeedback, showTargetFeedback, toString, understandsRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentEditPolicy

public ComponentEditPolicy()
Method Detail

createDeleteCommand

protected Command createDeleteCommand(GroupRequest deleteRequest)
Override to contribute to the component's being deleted. DELETE will also be sent to the parent. DELETE must be handled by either the child or the parent, or both.

Parameters:
deleteRequest - the DeleteRequest
Returns:
Command null or a contribution to the delete

getCommand

public Command getCommand(Request request)
Factors the incoming Request into ORPHANs and DELETEs.

Specified by:
getCommand in interface EditPolicy
Overrides:
getCommand in class AbstractEditPolicy
See Also:
EditPolicy.getCommand(Request)

getDeleteCommand

protected Command getDeleteCommand(GroupRequest request)
Combines the DELETE contribution from this class and the parent. This classes contribution is obtained by calling createDeleteCommand(GroupRequest). The parent is sent REQ_DELETE_DEPENDANT. The parent's contribution is combined with the local contribution and returned.

Parameters:
request - the DeleteRequest
Returns:
the combined contributions from this EditPolicy and the parent EditPart

getOrphanCommand

protected Command getOrphanCommand()
Returns the command contribution for orphaning this component from its container. By default, ORPHAN is redispatched to the host's parent as an ORPHAN_CHILDREN Request. The parents contribution is then returned.

Returns:
the contribution obtained from the host's parent.

Eclipse GEF
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.