Runtime

org.eclipse.gmf.runtime.diagram.ui.editpolicies
Class GraphicalNodeEditPolicy

java.lang.Object
  extended byorg.eclipse.gef.editpolicies.AbstractEditPolicy
      extended byorg.eclipse.gef.editpolicies.GraphicalEditPolicy
          extended byorg.eclipse.gef.editpolicies.GraphicalNodeEditPolicy
              extended byorg.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants
Direct Known Subclasses:
ContainerNodeEditPolicy, TreeGraphicalNodeEditPolicy

public class GraphicalNodeEditPolicy
extends GraphicalNodeEditPolicy

the graphical node edit policy

See Also:
GraphicalNodeEditPolicy

Nested Class Summary
protected  class GraphicalNodeEditPolicy.PromptAndCreateConnectionCommand
          Gets a command that pops up a menu which allows the user to select which type of connection to be created and then creates the connection.
 
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
GraphicalNodeEditPolicy()
           
 
Method Summary
protected  Connection createDummyConnection(Request req)
           
 Command getCommand(Request request)
           
protected  INodeEditPart getConnectableEditPart()
          get a connectable edit part
protected  Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request)
          Gets the command to complete the creation of a new connection and relationship.
protected  Command getConnectionAndRelationshipCreateCommand(CreateConnectionViewAndElementRequest request)
          Gets the command to start the creation of a new connection and relationship.
protected  Command getConnectionCompleteCommand(CreateConnectionRequest request)
          Returns a command that will create the connection.
protected  Command getConnectionCompleteCommand(java.lang.Object connectionType, CreateConnectionRequest request)
          Gets the command to create a connection based on the request and the connection identifier.
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  Command getConnectionCreateCommand(CreateConnectionRequest request)
           
protected  java.util.List getConnectionMenuContent(CreateConnectionRequest request)
          Gets a list of all the connector items that will represent the connector choices and will appear in the popup menu.
protected  ConnectionAnchor getConnectionTargetAnchor(Request request)
          getConnectionTargetAnchor Method used during reconnection to retrieve the appropriate target anchor based on a request.
protected  ConnectionRouter getDummyConnectionRouter(CreateConnectionRequest arg0)
           
protected  ICommand getPromptAndCreateConnectionCommand(java.util.List content, CreateConnectionRequest request)
          Gets a command that pops up a menu which allows the user to select which type of connection to be created and then creates the connection.
protected  Command getReconnectSourceCommand(ReconnectRequest request)
           
protected  Command getReconnectTargetCommand(ReconnectRequest request)
           
protected  Command getReversedUnspecifiedConnectionCompleteCommand(CreateUnspecifiedTypeConnectionRequest request)
          Gets the command to complete the creation of a new connection and relationship (if applicable) for an unspecified type request.
protected  Command getRoutingAdjustment(IAdaptable connection, java.lang.String connectionHint, Routing currentRouterType, EditPart target)
          getRoutingAdjustment method to adjust routing if the reorient has moved the connection into a different routing environment.
protected  java.lang.String getSemanticHint(Request request)
          getSemanticHint Retrieves the semanticHint from the request regarding the type of elemen being manipulated.
protected  ConnectionAnchor getSourceConnectionAnchor(CreateConnectionRequest request)
           
protected  ConnectionAnchor getTargetConnectionAnchor(CreateConnectionRequest request)
           
protected  Command getUnspecifiedConnectionCompleteCommand(CreateUnspecifiedTypeConnectionRequest request)
          Gets the command to complete the creation of a new connection and relationship (if applicable) for an unspecified type request.
protected  View getView()
          get this edit policy's edit part View
protected  IAdaptable getViewAdapter()
          Return the view adapter describing the element to be created.
protected  void setViewAdapter(IAdaptable viewAdapter)
          Cache the view descriptor describing the connection to be create.
 
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

GraphicalNodeEditPolicy

public GraphicalNodeEditPolicy()
Method Detail

createDummyConnection

protected Connection createDummyConnection(Request req)

getDummyConnectionRouter

protected ConnectionRouter getDummyConnectionRouter(CreateConnectionRequest arg0)

getSourceConnectionAnchor

protected ConnectionAnchor getSourceConnectionAnchor(CreateConnectionRequest request)

getTargetConnectionAnchor

protected ConnectionAnchor getTargetConnectionAnchor(CreateConnectionRequest request)

getConnectableEditPart

protected INodeEditPart getConnectableEditPart()
get a connectable edit part

Returns:
INodeEditPart

getConnectionCompleteEditPart

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. 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.

Parameters:
request - Request giving some information about the user gesture.
Returns:
INodeEditPart which will be the target connection.

getConnectionTargetAnchor

protected ConnectionAnchor getConnectionTargetAnchor(Request request)
getConnectionTargetAnchor Method used during reconnection to retrieve the appropriate target anchor based on a request.

Parameters:
request - Request giving some information about the user gesture.
Returns:
ConnectionAnchor the connections target end will connect to.

getView

protected View getView()
get this edit policy's edit part View

Returns:
View

getSemanticHint

protected java.lang.String getSemanticHint(Request request)
getSemanticHint Retrieves the semanticHint from the request regarding the type of elemen being manipulated.

Parameters:
request - Request that is sent from the user gesture
Returns:
String that is the semantic type.

getRoutingAdjustment

protected Command getRoutingAdjustment(IAdaptable connection,
                                       java.lang.String connectionHint,
                                       Routing currentRouterType,
                                       EditPart target)
getRoutingAdjustment method to adjust routing if the reorient has moved the connection into a different routing environment. Specifically, if the connection has been reoriented out of a tree structure it will change routing to the default set in preference. Likewise, if the connection has connected to a tree structure then the routing will create a tree.

Parameters:
connection - IAdaptable that is placeholder for not yet created connection. Also adapts directly to a ConnectionEditPart in the case of a reorient.
connectionHint - String that is the semantic hint of the connection being manipulated
currentRouterType - Integer current representation of the routing style
target - EditPart that is being targeted by the request.
Returns:
Command to make any routing adjustments if necessary.

getReconnectTargetCommand

protected Command getReconnectTargetCommand(ReconnectRequest request)

getReconnectSourceCommand

protected Command getReconnectSourceCommand(ReconnectRequest request)

getConnectionCompleteCommand

protected Command getConnectionCompleteCommand(CreateConnectionRequest request)
Returns a command that will create the connection. If you must override this method, you should call super.

See Also:
GraphicalNodeEditPolicy.getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest)

setViewAdapter

protected final void setViewAdapter(IAdaptable viewAdapter)
Cache the view descriptor describing the connection to be create.

Parameters:
viewAdapter -

getViewAdapter

protected final IAdaptable getViewAdapter()
Return the view adapter describing the element to be created.

Returns:
adpater that can adapt View.class
See Also:
GraphicalNodeEditPolicy.setViewAdapter(IAdaptable)

getConnectionCreateCommand

protected Command getConnectionCreateCommand(CreateConnectionRequest request)

getCommand

public Command getCommand(Request request)

getConnectionAndRelationshipCreateCommand

protected Command getConnectionAndRelationshipCreateCommand(CreateConnectionViewAndElementRequest request)
Gets the command to start the creation of a new connection and relationship. This will update the request appropriately.

Parameters:
request -
Returns:
Command

getConnectionAndRelationshipCompleteCommand

protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request)
Gets the command to complete the creation of a new connection and relationship.

Parameters:
request -
Returns:
Command

getUnspecifiedConnectionCompleteCommand

protected Command getUnspecifiedConnectionCompleteCommand(CreateUnspecifiedTypeConnectionRequest request)
Gets the command to complete the creation of a new connection and relationship (if applicable) for an unspecified type request. This command includes a command to popup a menu to prompt the user for the type of connection to be created.

Parameters:
request - the unspecified type request
Returns:
the command

getPromptAndCreateConnectionCommand

protected ICommand getPromptAndCreateConnectionCommand(java.util.List content,
                                                       CreateConnectionRequest request)
Gets a command that pops up a menu which allows the user to select which type of connection to be created and then creates the connection.

Parameters:
content - The list of items making up the content of the popup menu.
request - The relevant create connection request.
Returns:
the command to popup up the menu and create the connection

getConnectionCompleteCommand

protected Command getConnectionCompleteCommand(java.lang.Object connectionType,
                                               CreateConnectionRequest request)
Gets the command to create a connection based on the request and the connection identifier. This method is called after the user has selected the connection to be created when presented with a popup.

Parameters:
connectionType - the connection type as specified in GraphicalNodeEditPolicy.getConnectionMenuContent(CreateConnectionRequest)
request - the request, identifying the source and target
Returns:
the command to create the connection
See Also:
GraphicalNodeEditPolicy.getPromptAndCreateConnectionCommand(List, CreateConnectionRequest)

getConnectionMenuContent

protected java.util.List getConnectionMenuContent(CreateConnectionRequest request)
Gets a list of all the connector items that will represent the connector choices and will appear in the popup menu. This method will get the connector content if the given request is a CreateUnspecifiedTypeConnectionRequest using the types it holds or the types retrieved from the Modeling Assistant Service.

If a subclass wishes to provide additional element types they should consider providing these in a Modeling Assistant Provider. If a subclass wishes to provide connector choices that are not elements types they may provide them here, in this case, the label provider for GraphicalNodeEditPolicy.PromptAndCreateConnectionCommand may need to customized.

Returns:
the list of connector items to appear in the popup menu

getReversedUnspecifiedConnectionCompleteCommand

protected Command getReversedUnspecifiedConnectionCompleteCommand(CreateUnspecifiedTypeConnectionRequest request)
Gets the command to complete the creation of a new connection and relationship (if applicable) for an unspecified type request. This command includes a command to popup a menu to prompt the user for the type of relationship to be created.

Parameters:
request - the reversed unspecified type request
Returns:
the command

Runtime

Guidelines for using Eclipse APIs.

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