Runtime

## org.eclipse.gmf.runtime.diagram.ui.editpolicies
Class TreeGraphicalNodeEditPolicy

    java.lang.Object
      org.eclipse.gef.editpolicies.AbstractEditPolicy
          org.eclipse.gef.editpolicies.GraphicalEditPolicy
              org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy
                  org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy
                      org.eclipse.gmf.runtime.diagram.ui.editpolicies.TreeGraphicalNodeEditPolicy

All Implemented Interfaces:
  EditPolicy, RequestConstants

public class TreeGraphicalNodeEditPolicy
extends GraphicalNodeEditPolicy

This class overrides the default GraphicalNodeEditPolicy to allow for a redirection of the target editpart when connecting. Specifically it used for connections of the same semantic type and will route them using the tree routing. The common example is with generalizations. It is typical for an inheritance hierarchy to be viewed as a tree.

Nested Class Summary

Nested classes inherited from class org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy
`GraphicalNodeEditPolicy.PromptAndCreateConnectionCommand`

Field Summary

Fields inherited from class org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy
`connectionFeedback, feedbackHelper`

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
`TreeGraphicalNodeEditPolicy()`

Method Summary
`protected Command` `getConnectionCompleteCommand(CreateConnectionRequest request)` Returns a command that will create the connection.
`protected INodeEditPart` `getConnectionCompleteEditPart(Request request)` getConnectionCompleteEditPart This method is used when the connection is verified and made complete to retrieve the final connecting editpart to be used in the connection creation.
`protected ConnectionAnchor` `getConnectionTargetAnchor(Request request)` getConnectionTargetAnchor Method used during reconnection to retrieve the appropriate target anchor based on a request.

Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy

`createDummyConnection, getCommand, getConnectableEditPart, getConnectionAndRelationshipCompleteCommand, getConnectionAndRelationshipCreateCommand, getConnectionCompleteCommand, getConnectionCreateCommand, getConnectionMenuContent, getDummyConnectionRouter, getPromptAndCreateConnectionCommand, getReconnectSourceCommand, getReconnectTargetCommand, getReversedUnspecifiedConnectionCompleteCommand, getRoutingAdjustment, getSemanticHint, getSourceConnectionAnchor, getTargetConnectionAnchor, getUnspecifiedConnectionCompleteCommand, getView, getViewAdapter, setViewAdapter`

Methods inherited from class org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy
`deactivate, eraseCreationFeedback, eraseSourceFeedback, eraseTargetConnectionFeedback, eraseTargetFeedback, getFeedbackHelper, getTargetEditPart, showCreationFeedback, showSourceFeedback, showTargetConnectionFeedback, showTargetFeedback`

Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
`addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback`

Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
`activate, debugFeedback, getHost, setHost, toString, understandsRequest`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TreeGraphicalNodeEditPolicy

    public TreeGraphicalNodeEditPolicy()

Method Detail

### getConnectionCompleteEditPart

    protected INodeEditPart getConnectionCompleteEditPart(Request request)

  Description copied from class: `GraphicalNodeEditPolicy`
  getConnectionCompleteEditPart This method is used when the connection is verified and made complete to retrieve the final connecting editpart to be used in the connection creation. This is by default the "host" edit part which is what is connected to by the user feedback. Subclassing edit-policies may wish to redirect the connection to a different edit-part depending on the gesture. i.e. the tree-view for generalizations will redirect the connection to the target of the host.

  Overrides:
    `getConnectionCompleteEditPart` in class `GraphicalNodeEditPolicy`
  Parameters:
    `request` - Request giving some information about the user gesture.
  Returns:
    INodeEditPart which will be the target connection.

### getConnectionTargetAnchor

    protected ConnectionAnchor getConnectionTargetAnchor(Request request)

  Description copied from class: `GraphicalNodeEditPolicy`
  getConnectionTargetAnchor Method used during reconnection to retrieve the appropriate target anchor based on a request.

  Overrides:
    `getConnectionTargetAnchor` in class `GraphicalNodeEditPolicy`
  Parameters:
    `request` - Request giving some information about the user gesture.
  Returns:
    ConnectionAnchor the connections target end will connect to.

### getConnectionCompleteCommand

    protected Command getConnectionCompleteCommand(CreateConnectionRequest request)

  Description copied from class: `GraphicalNodeEditPolicy`
  Returns a command that will create the connection. If you must override this method, you should call super.

  Overrides:
    `getConnectionCompleteCommand` in class `GraphicalNodeEditPolicy`
  See Also:
    `GraphicalNodeEditPolicy.getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest)`

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.