Runtime

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

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
                  extended byorg.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerNodeEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants

public class ContainerNodeEditPolicy
extends GraphicalNodeEditPolicy

This is installed on a container editpart. It is responsible for creating connections from a source shape to an unspecified target and a target shape to an unspecified source. A popup will appear asking the user to select or create a new source or target element. This will handle both single create connection requests and multi connection requests (i.e. where the popup also prompts the user for the type of relationship to created).


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
ContainerNodeEditPolicy()
           
 
Method Summary
 Command getCommand(Request request)
          Only handles connection end requests.
protected  Command getConnectionAndEndCommands(CreateConnectionRequest request)
          Creates the command to prompt the user for the relationship type (optionally) and the element to be used for the unspecified end, and the create commands necessary to create the views and elements.
protected  ICommand getCreateConnectionCommand(CreateRequest request, IAdaptable typeInfoAdapter, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter)
          Called by ContainerNodeEditPolicy.getConnectionAndEndCommands(org.eclipse.gef.requests.CreateConnectionRequest) .
protected  CreateViewAndOptionallyElementCommand getCreateOtherEndCommand(IAdaptable endAdapter, Point location)
          Called by ContainerNodeEditPolicy.getConnectionAndEndCommands(org.eclipse.gef.requests.CreateConnectionRequest).
protected  PromptForConnectionAndEndCommand getPromptForConnectionAndEndCommand(CreateConnectionRequest request)
          Gets a command that pops up a menu which can allow the user to select the type of connector to be created and whether they want to create a new type or select an existing element for the other end of the connector.
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy
createDummyConnection, getConnectableEditPart, getConnectionAndRelationshipCompleteCommand, getConnectionAndRelationshipCreateCommand, getConnectionCompleteCommand, getConnectionCompleteCommand, getConnectionCompleteEditPart, getConnectionCreateCommand, getConnectionMenuContent, getConnectionTargetAnchor, 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

ContainerNodeEditPolicy

public ContainerNodeEditPolicy()
Method Detail

getCommand

public Command getCommand(Request request)
Only handles connection end requests. Cannot start a connection on a container.

Specified by:
getCommand in interface EditPolicy
Overrides:
getCommand in class GraphicalNodeEditPolicy

getConnectionAndEndCommands

protected Command getConnectionAndEndCommands(CreateConnectionRequest request)
Creates the command to prompt the user for the relationship type (optionally) and the element to be used for the unspecified end, and the create commands necessary to create the views and elements.

Parameters:
request - A single create connection request or unspecified connection requests (i.e. where the popup also prompts the user for the type of relationship to created).
Returns:
the command

getPromptForConnectionAndEndCommand

protected PromptForConnectionAndEndCommand getPromptForConnectionAndEndCommand(CreateConnectionRequest request)
Gets a command that pops up a menu which can allow the user to select the type of connector to be created and whether they want to create a new type or select an existing element for the other end of the connector.

Parameters:
request - A single create connection request or unspecified connection requests (i.e. where the popup also prompts the user for the type of relationship to created).
Returns:
the command to popup up the menu

getCreateOtherEndCommand

protected CreateViewAndOptionallyElementCommand getCreateOtherEndCommand(IAdaptable endAdapter,
                                                                         Point location)
Called by ContainerNodeEditPolicy.getConnectionAndEndCommands(org.eclipse.gef.requests.CreateConnectionRequest).

Parameters:
endAdapter - the end adapter
location - the location
Returns:
command

getCreateConnectionCommand

protected ICommand getCreateConnectionCommand(CreateRequest request,
                                              IAdaptable typeInfoAdapter,
                                              IAdaptable sourceViewAdapter,
                                              IAdaptable targetViewAdapter)
Called by ContainerNodeEditPolicy.getConnectionAndEndCommands(org.eclipse.gef.requests.CreateConnectionRequest) .

Parameters:
request - the create connection request
typeInfoAdapter -
sourceViewAdapter -
targetViewAdapter -
Returns:
a DeferredCreateConnectionViewAndElementCommand

Runtime

Guidelines for using Eclipse APIs.

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