Package org.eclipse.gef.dnd
Class TemplateTransferDragSourceListener
- java.lang.Object
-
- org.eclipse.gef.dnd.AbstractTransferDragSourceListener
-
- org.eclipse.gef.dnd.TemplateTransferDragSourceListener
-
- All Implemented Interfaces:
java.util.EventListener,TransferDragSourceListener,TransferDragSourceListener,DragSourceListener,SWTEventListener
public class TemplateTransferDragSourceListener extends AbstractTransferDragSourceListener
Allows a singlePaletteTemplateEntryto be dragged from an EditPartViewer. The PaletteTemplateEntry's template object is the data that is being transfered to theDropTarget.- Since:
- 2.1
-
-
Constructor Summary
Constructors Constructor Description TemplateTransferDragSourceListener(EditPartViewer viewer)Constructs a new listener for the specified EditPartViewer.TemplateTransferDragSourceListener(EditPartViewer viewer, Transfer xfer)Deprecated.Use the constructor without the transfer specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddragFinished(DragSourceEvent event)voiddragSetData(DragSourceEvent event)Get the template from the selectedPaletteTemplateEntryand sets it as the event data to be dropped.voiddragStart(DragSourceEvent event)Cancels the drag if the selected item does not represent a PaletteTemplateEntry.protected java.lang.ObjectgetTemplate()A helper method that returnsnullor the template Object from the currently selected EditPart.-
Methods inherited from class org.eclipse.gef.dnd.AbstractTransferDragSourceListener
getTransfer, getViewer, setTransfer, setViewer
-
-
-
-
Constructor Detail
-
TemplateTransferDragSourceListener
public TemplateTransferDragSourceListener(EditPartViewer viewer, Transfer xfer)
Deprecated.Use the constructor without the transfer specified.- Parameters:
viewer- viewerxfer- xfer
-
TemplateTransferDragSourceListener
public TemplateTransferDragSourceListener(EditPartViewer viewer)
Constructs a new listener for the specified EditPartViewer. The provided Viewer should be one that is displaying a Palette. The TemplateTransferDragSourceListener will only be enabled when a single EditPart is selected, and the EditPart's model is aPaletteTemplateEntry.- Parameters:
viewer- the EditPartViewer that is the drag source
-
-
Method Detail
-
dragFinished
public void dragFinished(DragSourceEvent event)
- Specified by:
dragFinishedin interfaceDragSourceListener- Overrides:
dragFinishedin classAbstractTransferDragSourceListener- See Also:
AbstractTransferDragSourceListener.dragFinished(DragSourceEvent)
-
dragSetData
public void dragSetData(DragSourceEvent event)
Get the template from the selectedPaletteTemplateEntryand sets it as the event data to be dropped.- Parameters:
event- the DragSourceEvent
-
dragStart
public void dragStart(DragSourceEvent event)
Cancels the drag if the selected item does not represent a PaletteTemplateEntry.- Specified by:
dragStartin interfaceDragSourceListener- Overrides:
dragStartin classAbstractTransferDragSourceListener- See Also:
DragSourceListener.dragStart(DragSourceEvent)
-
getTemplate
protected java.lang.Object getTemplate()
A helper method that returnsnullor the template Object from the currently selected EditPart.- Returns:
- the template
-
-