GEF v2.0

org.eclipse.gef
Interface EditPolicy

All Known Implementing Classes:
AbstractEditPolicy

public interface EditPolicy

Responsible for providing one type of editing behavior to an EditPart. An editing behavior consists of one or more of the following:

EditPolicies should determine an EditPart's editing capabilities. It is possible to implement an EditPart such that it handles all editing responsibility.  However, it is much more flexible and object-oriented to use EditPolicies.  Using policies, you can pick and choose the editing behavior for an EditPart without being bound to its class hierarchy.  Code reuse is increased, and code management is easier.


Field Summary
static String COMPONENT_ROLE
           
static String CONNECTION_BENDPOINTS_ROLE
           
static String CONNECTION_ENDPOINTS_ROLE
           
static String CONNECTION_ROLE
           
static String CONTAINER_ROLE
           
static String DIRECT_EDIT_ROLE
           
static String GRAPHICAL_NODE_ROLE
           
static String LAYOUT_ROLE
           
static String NODE_ROLE
           
static String PRIMARY_DRAG_ROLE
           
static String SELECTION_FEEDBACK_ROLE
           
static String TREE_CONTAINER_ROLE
           
 
Method Summary
 void activate()
          This policy will initialize and establish any necessary listeners.
 void deactivate()
          This policy should shutdown and remove all listeners established in activate().
 void eraseSourceFeedback(Request request)
          Erases source feedback based on the given request.
 void eraseTargetFeedback(Request request)
          Erases target feedback based on the given request.
 Command getCommand(Request request)
          Returns the command for a given request, or null if the EditPolicy does not work with that request type.
 EditPart getTargetEditPart(Request request)
          Returns the host EditPart if the EditPolicy works with the given request type, otherwise return null.
 void setHost(EditPart editpart)
          Sets the host in which this EditPolicy is installed.
 void showSourceFeedback(Request request)
          Shows or updates source feedback if the receiver works with the request type.
 void showTargetFeedback(Request request)
          Shows or updates target feedback if the receiver works with the request type.
 boolean understandsRequest(Request request)
           
 

Field Detail

COMPONENT_ROLE

public static final String COMPONENT_ROLE

CONNECTION_ENDPOINTS_ROLE

public static final String CONNECTION_ENDPOINTS_ROLE

CONNECTION_BENDPOINTS_ROLE

public static final String CONNECTION_BENDPOINTS_ROLE

CONNECTION_ROLE

public static final String CONNECTION_ROLE

CONTAINER_ROLE

public static final String CONTAINER_ROLE

DIRECT_EDIT_ROLE

public static final String DIRECT_EDIT_ROLE

GRAPHICAL_NODE_ROLE

public static final String GRAPHICAL_NODE_ROLE

LAYOUT_ROLE

public static final String LAYOUT_ROLE

NODE_ROLE

public static final String NODE_ROLE

PRIMARY_DRAG_ROLE

public static final String PRIMARY_DRAG_ROLE

SELECTION_FEEDBACK_ROLE

public static final String SELECTION_FEEDBACK_ROLE

TREE_CONTAINER_ROLE

public static final String TREE_CONTAINER_ROLE
Method Detail

activate

public void activate()
This policy will initialize and establish any necessary listeners. Activate is called after the host has been set, and that host is active. EditPolicy activation is contingent upon EditPart activation.
See Also:
EditPart.activate(), deactivate(), EditPart.installEditPolicy(Object, EditPolicy)

deactivate

public void deactivate()
This policy should shutdown and remove all listeners established in activate(). deactivate() will be called either when the host is deactivated, or when this policy is uninstalled from its host.
See Also:
EditPart.deactivate(), activate(), EditPart.removeEditPolicy(Object)

eraseSourceFeedback

public void eraseSourceFeedback(Request request)
Erases source feedback based on the given request. Does nothing if the EditPolicy does not apply to the given request.

eraseTargetFeedback

public void eraseTargetFeedback(Request request)
Erases target feedback based on the given request. Does nothing if the EditPolicy does not apply to the given request.

getCommand

public Command getCommand(Request request)
Returns the command for a given request, or null if the EditPolicy does not work with that request type. null is treated as a no-op by the caller, or a zero contribution. The EditPolicy must return an UnexectuableCommand if it wishes to prevent the operation from being performed.

getTargetEditPart

public EditPart getTargetEditPart(Request request)
Returns the host EditPart if the EditPolicy works with the given request type, otherwise return null. For all practical uses, this method has "boolean" behavior. It is possible, although rarely useful, to return an EditPart other than the host.

setHost

public void setHost(EditPart editpart)
Sets the host in which this EditPolicy is installed.

showSourceFeedback

public void showSourceFeedback(Request request)
Shows or updates source feedback if the receiver works with the request type. This method may be called repeatedly for the purpose of updating feedback based on changes to the request object. Does nothing if the EditPolicy does not recognize the given request.

showTargetFeedback

public void showTargetFeedback(Request request)
Shows or updates target feedback if the receiver works with the request type. This method may be called repeatedly for the purpose of updating feedback based on changes to the request object. Does nothing if the EditPolicy does not recognize the given request.

understandsRequest

public boolean understandsRequest(Request request)

GEF v2.0