Package org.eclipse.gef.dnd

# Class TemplateTransferDropTargetListener

java.lang.Object
org.eclipse.gef.dnd.AbstractTransferDropTargetListener
org.eclipse.gef.dnd.TemplateTransferDropTargetListener

All Implemented Interfaces:
  `EventListener`, `TransferDropTargetListener`, `TransferDropTargetListener`, `DropTargetListener`, `SWTEventListener`

public class TemplateTransferDropTargetListener extends AbstractTransferDropTargetListener
Performs a native Drop using the `TemplateTransfer`. The Drop is performed by using a `CreateRequest` to obtain a `Command` from the targeted `EditPart`.

This class is `abstract`. Subclasses are responsible for providing the appropriate `Factory` object based on the template that is being dragged.

Since:
  2.1

## Constructor Summary

Constructors
Constructor
Description
`TemplateTransferDropTargetListener(EditPartViewer viewer)`
Constructs a listener on the specified viewer.

## Method Summary

Modifier and Type
Method
Description
`protected Request`
`createTargetRequest()`
Creates and returns the `Request` that will be sent to the targeted EditPart.
`protected final CreateRequest`
`getCreateRequest()`
A helper method that casts the target Request to a CreateRequest.
`protected CreationFactory`
`getFactory(Object template)`
Returns the appropriate Factory object to be used for the specified template.
`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 created object.
`protected void`
`updateTargetRequest()`
Assumes that the target request is a `CreateRequest`.

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

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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TemplateTransferDropTargetListener

public TemplateTransferDropTargetListener(EditPartViewer viewer)
Constructs a listener on the specified viewer.

Parameters:
  `viewer` - the EditPartViewer

## Method Details

### createTargetRequest

protected Request createTargetRequest()
Description copied from class: `AbstractTransferDropTargetListener`
Creates and returns the `Request` that will be sent to the targeted EditPart. Subclasses can override to create specialized requests.

Overrides:
  `createTargetRequest` in class `AbstractTransferDropTargetListener`
Returns:
  the `Request` to be used with the target EditPart
See Also:
  - `AbstractTransferDropTargetListener.createTargetRequest()`

### getCreateRequest

protected final CreateRequest getCreateRequest()
A helper method that casts the target Request to a CreateRequest.

Returns:
  CreateRequest

### getFactory

protected CreationFactory getFactory(Object template)
Returns the appropriate Factory object to be used for the specified template. This Factory is used on the CreateRequest that is sent to the target EditPart.

Parameters:
  `template` - the template Object
Returns:
  a Factory

### 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`.

Overrides:
  `handleDragOperationChanged` in class `AbstractTransferDropTargetListener`
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.

Overrides:
  `handleDragOver` in class `AbstractTransferDropTargetListener`
See Also:
  - `AbstractTransferDropTargetListener.handleDragOver()`

### handleDrop

protected void handleDrop()
Overridden to select the created object.

Overrides:
  `handleDrop` in class `AbstractTransferDropTargetListener`
See Also:
  - `AbstractTransferDropTargetListener.handleDrop()`

### updateTargetRequest

protected void updateTargetRequest()
Assumes that the target request is a `CreateRequest`.

Specified by:
  `updateTargetRequest` in class `AbstractTransferDropTargetListener`