Runtime

## org.eclipse.gmf.runtime.diagram.ui.parts
Class DiagramDropTargetListener

    java.lang.Object
      org.eclipse.gef.dnd.AbstractTransferDropTargetListener
          org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener

All Implemented Interfaces:
  DropTargetListener, java.util.EventListener, SWTEventListener, TransferDropTargetListener, TransferDropTargetListener

public abstract class DiagramDropTargetListener
extends AbstractTransferDropTargetListener

Performs a drop of one or more semantic elements using a given transfer. The Drop is performed by using a `DropObjectsRequest` to obtain a `Command` from the targeted `EditPart`. The target edit part might re-interpret the `DropElementsRequest` to mean another request.

This class is `abstract`. Subclasses are responsible for providing the appropriate `Transfer` object based on the type of elements that are being dragged.

Constructor Summary
`DiagramDropTargetListener(EditPartViewer viewer)` Constructor for DiagramDropTargetListener.
`DiagramDropTargetListener(EditPartViewer viewer, Transfer xfer)` Constructor for DiagramDropTargetListener.

Method Summary
`protected Request` `createTargetRequest()`
`void` `dragEnter(DropTargetEvent event)`
`protected DropObjectsRequest` `getDropObjectsRequest()` A helper method that casts the target Request to a DropElementsRequest.
`protected abstract java.util.List` `getObjectsBeingDropped()` gets a list of objects being dropped on the diagram
`protected void` `handleDragEnter()` Called whenever the User enters the target.
`protected void` `handleDragOperationChanged()` The purpose of a template is to be copied.
`protected void` `handleDragOver()` The purpose of a template is to be copied.
`protected void` `handleDrop()` Overridden to select the request result if any
`boolean` `isEnabled(DropTargetEvent event)` Make sure the target can produce a command
`protected void` `updateTargetEditPart()`
`protected void` `updateTargetRequest()` Assumes that the target request is a `DropObjectsRequest`.

Methods inherited from class org.eclipse.gef.dnd.AbstractTransferDropTargetListener

`dragLeave, dragOperationChanged, dragOver, drop, dropAccept, eraseTargetFeedback, getCommand, getCurrentEvent, getDropLocation, getExclusionSet, getTargetEditPart, getTargetRequest, getTransfer, getViewer, handleEnteredEditPart, handleExitingEditPart, handleHover, handleHoverStop, isEnablementDeterminedByCommand, setAutoexposeHelper, setCurrentEvent, setEnablementDeterminedByCommand, setTargetEditPart, setTransfer, setViewer, showTargetFeedback, unload, updateAutoexposeHelper`

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

Constructor Detail

### DiagramDropTargetListener

    public DiagramDropTargetListener(EditPartViewer viewer)

  Constructor for DiagramDropTargetListener.

Parameters:
  `viewer` -

### DiagramDropTargetListener

    public DiagramDropTargetListener(EditPartViewer viewer,
                                     Transfer xfer)

  Constructor for DiagramDropTargetListener.

Parameters:
  `viewer` -
  `xfer` -

Method Detail

### createTargetRequest

    protected Request createTargetRequest()

  See Also:
    `AbstractTransferDropTargetListener.createTargetRequest()`

### getDropObjectsRequest

    protected final DropObjectsRequest getDropObjectsRequest()

  A helper method that casts the target Request to a DropElementsRequest.

  Returns:
    DropElementsRequest

### getObjectsBeingDropped

    protected abstract java.util.List getObjectsBeingDropped()

  gets a list of objects being dropped on the diagram

  Returns:
    `List`

### dragEnter

    public void dragEnter(DropTargetEvent event)

  See Also:
    `DropTargetListener.dragEnter(org.eclipse.swt.dnd.DropTargetEvent)`

### handleDragEnter

    protected void handleDragEnter()

  Called whenever the User enters the target. By default, the target Request and target EditPart are updated, and feedback is

### handleDragOperationChanged

    protected void handleDragOperationChanged()

  The purpose of a template is to be copied. Therefore, the drop operation can't be anything but `DND.DROP_COPY`.

  See Also:
    `AbstractTransferDropTargetListener.handleDragOperationChanged()`

### handleDragOver

    protected void handleDragOver()

  The purpose of a template is to be copied. Therefore, the Drop operation is set to `DND.DROP_COPY` by default.

  See Also:
    `AbstractTransferDropTargetListener.handleDragOver()`

### handleDrop

    protected void handleDrop()

  Overridden to select the request result if any

  See Also:
    `AbstractTransferDropTargetListener.handleDrop()`

### updateTargetRequest

    protected void updateTargetRequest()

  Assumes that the target request is a `DropObjectsRequest`.

### isEnabled

    public boolean isEnabled(DropTargetEvent event)

  Make sure the target can produce a command

### updateTargetEditPart

    protected void updateTargetEditPart()

  See Also:
    `AbstractTransferDropTargetListener.updateTargetEditPart()`

Runtime

Guidelines for using Eclipse APIs.

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