Runtime

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

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

public abstract class OpenEditPolicy
extends AbstractEditPolicy

Open Shape Edit Policy

This edit policy handles double click (open) gestures on shapes. When the user double clicks on an edit part, GEF creates a REQ_OPEN request and subclasses of this edit policy should handle that request. This policy should be installed with the policy role OPEN_ROLE. Normally, the corresponding edit policy role would be defined in EditPolicy, but no such role currently exists.

This edit policy is different from "DirectEditPolicy" even though both are a result of a double click on a representation in a diagram. With the DIRECT_EDIT_ROLE, some type of in-diagram editing is performed (e.g., modify a text label, move line segment nodes, etc.). The OPEN_ROLE policy is typically installed on edit part whose underlying data can only be examined/modified by opening another editor window. For example, if an edit part represented another diagram, then an "open" request on that edit part should result in the corresponding diagram being opened in another editor window.

Although edit policies for both DIRECT_EDIT_ROLE and OPEN_ROLE could be installed on an edit part, typically only one of these roles is appropriate.


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_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
OpenEditPolicy()
           
 
Method Summary
 Command getCommand(Request request)
          Intercept a command request for REQ_OPEN.
protected abstract  Command getOpenCommand(Request request)
          Returns the Command to perform the open request.
 EditPart getTargetEditPart(Request request)
          By default, the target edit part is the host edit part.
 boolean understandsRequest(Request request)
          Determine if the request type is supported by this edit policy.
 
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
activate, deactivate, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, getHost, setHost, showSourceFeedback, showTargetFeedback, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenEditPolicy

public OpenEditPolicy()
Method Detail

getOpenCommand

protected abstract Command getOpenCommand(Request request)
Returns the Command to perform the open request.

Parameters:
request - the Request
Returns:
the command to perform the open

getCommand

public Command getCommand(Request request)
Intercept a command request for REQ_OPEN.

See Also:
EditPolicy.getCommand(org.eclipse.gef.Request)

understandsRequest

public boolean understandsRequest(Request request)
Determine if the request type is supported by this edit policy.

See Also:
EditPolicy.understandsRequest(org.eclipse.gef.Request)

getTargetEditPart

public EditPart getTargetEditPart(Request request)
By default, the target edit part is the host edit part.

See Also:
EditPolicy.getTargetEditPart(Request)

Runtime

Guidelines for using Eclipse APIs.

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