Runtime

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

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

All Implemented Interfaces:
  EditPolicy, RequestConstants

Direct Known Subclasses:
  DiagramDragDropEditPolicy

public class DragDropEditPolicy
extends GraphicalEditPolicy

Abstract Implementation for all EditPolicies that deal with the REQ_DRAG, REQ_DROP and REQ_DROP_EOBJECTS requests as defined in `org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants`The default implementation REQ_DRAG is to cast it into a REQ_ORPHAN request The default implementation REQ_DROP is to cast it into a REQ_ADD request``

Field Summary
`protected boolean` `opacity` the original opacity
`protected Color` `revertColor` the original background color

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

Method Summary
`protected DropObjectsRequest` `castToDropObjectsRequest(ChangeBoundsRequest request)` Retrieves the list of elements being dropped
`void` `eraseTargetFeedback(Request request)`
`Command` `getCommand(Request request)` This will only return a command if the host is resolvable so that trying to drop on an unresolved shape will not be allowed.
`protected Command` `getDragCommand(ChangeBoundsRequest request)` gets a drag command
`protected Command` `getDropCommand(ChangeBoundsRequest request)` gets a drop command
`protected Command` `getDropElementCommand(EObject element, DropObjectsRequest request)` getDropElementCommand Returns a command to handle a DropObjectsRequest of an EObject
`protected Command` `getDropObjectsCommand(DropObjectsRequest request)` getDropObjectsCommand This provides a generic implementation for handling the DropObjectsRequest which checks for EObject and gets a command from the getDropEementCommand method.
`protected EObject` `getHostObject()` return the host Edit Part's semantic element, if the semantic element is `null` or unresolvable it will return `null`
`protected int` `getRequiredDragDetail(Request request)`
`EditPart` `getTargetEditPart(Request request)`
`void` `showTargetFeedback(Request request)`
`boolean` `understandsRequest(Request request)` Only understands DRAG, DROP and DROP_ELEMENTS requests.

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

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

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

Field Detail

### revertColor

    protected Color revertColor

  the original background color

### opacity

    protected boolean opacity

  the original opacity

Constructor Detail

### DragDropEditPolicy

    public DragDropEditPolicy()

Method Detail

### getCommand

    public Command getCommand(Request request)

  This will only return a command if the host is resolvable so that trying to drop on an unresolved shape will not be allowed.

  See Also:
    `EditPolicy.getCommand(Request)`

### getDragCommand

    protected Command getDragCommand(ChangeBoundsRequest request)

  gets a drag command

  Parameters:
    `request` - the request
  Returns:
    command

### getDropCommand

    protected Command getDropCommand(ChangeBoundsRequest request)

  gets a drop command

  Parameters:
    `request` - the request
  Returns:
    command

### getDropElementCommand

    protected Command getDropElementCommand(EObject element,
                                            DropObjectsRequest request)

  getDropElementCommand Returns a command to handle a DropObjectsRequest of an EObject

  Parameters:
    `element` - EObject that is being dropped.
    `request` - DropObjectsRequest that the element has retrieved from.
  Returns:
    Command that handles the dropping of the EObject element.

### getDropObjectsCommand

    protected Command getDropObjectsCommand(DropObjectsRequest request)

  getDropObjectsCommand This provides a generic implementation for handling the DropObjectsRequest which checks for EObject and gets a command from the getDropEementCommand method.

  Parameters:
    `request` - DropObjectsRequest that is being handled
  Returns:
    Command that handles the request.

### getTargetEditPart

    public EditPart getTargetEditPart(Request request)

  See Also:
    `EditPolicy.getTargetEditPart(Request)`

### understandsRequest

    public boolean understandsRequest(Request request)

  Only understands DRAG, DROP and DROP_ELEMENTS requests.

  Returns:
    whether the request is supported

### showTargetFeedback

    public void showTargetFeedback(Request request)

  See Also:
    `EditPolicy.showTargetFeedback(org.eclipse.gef.Request)`

### eraseTargetFeedback

    public void eraseTargetFeedback(Request request)

  See Also:
    `EditPolicy.eraseTargetFeedback(org.eclipse.gef.Request)`

### getRequiredDragDetail

    protected int getRequiredDragDetail(Request request)

  Parameters:
    `request` -
  Returns:
    int

### getHostObject

    protected EObject getHostObject()

  return the host Edit Part's semantic element, if the semantic element is `null` or unresolvable it will return `null`

  Returns:
    EObject

### castToDropObjectsRequest

    protected DropObjectsRequest castToDropObjectsRequest(ChangeBoundsRequest request)

  Retrieves the list of elements being dropped

  Parameters:
    `request` - the request
  Returns:
    List of elements

Runtime

Guidelines for using Eclipse APIs.

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