Runtime

## org.eclipse.gmf.runtime.common.ui.services.dnd.ide.drop
Class ResourceDropTargetListener

    java.lang.Object
      org.eclipse.swt.dnd.DropTargetAdapter
          org.eclipse.jface.viewers.ViewerDropAdapter
              org.eclipse.ui.part.PluginDropAdapter
                  org.eclipse.ui.views.navigator.NavigatorDropAdapter
                      org.eclipse.gmf.runtime.common.ui.services.dnd.ide.drop.ResourceDropTargetListener

All Implemented Interfaces:
  java.util.EventListener, IDropTargetListener, DropTargetListener, org.eclipse.swt.internal.SWTEventListener, IOverwriteQuery

    public class ResourceDropTargetListener

extends NavigatorDropAdapter
implements IDropTargetListener

Concrete class that implements the IDropTargetListener. This class handles dropping resource elements.

Field Summary

Fields inherited from class org.eclipse.ui.part.PluginDropAdapter
`ATT_CLASS`

Fields inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
`LOCATION_AFTER, LOCATION_BEFORE, LOCATION_NONE, LOCATION_ON`

Fields inherited from interface org.eclipse.ui.dialogs.IOverwriteQuery
`ALL, CANCEL, NO, NO_ALL, YES`

Constructor Summary
`ResourceDropTargetListener(StructuredViewer viewer)` Constructs a new drop listener for the given viewer.

Method Summary
`boolean` `canSupport(IDropTargetContext context, IDropTargetEvent currentEvent, ITransferAgent currentAgent)` Returns a boolean indicating whether the listener can support drop operations on the current target.
`void` `dropAccept(DropTargetEvent event)`
`protected java.lang.Object` `getCurrentTarget()`
`ICommand` `getExecutableContext(DropTargetEvent event)` Returns a command for dropping the event data on the drop target.
`java.lang.String[]` `getSupportingTransferIds()` Returns the supporting transfer agent ids.
`void` `setFeedback(DropTargetEvent event)` Provides the listener an opportunity to set the feedback when hovering over a target.
`boolean` `validateDrop(java.lang.Object target, int dragOperation, TransferData transferType)`

Methods inherited from class org.eclipse.ui.views.navigator.NavigatorDropAdapter
`dragEnter, performDrop, queryOverwrite`

Methods inherited from class org.eclipse.ui.part.PluginDropAdapter
`drop, getCurrentTransfer, getPluginAdapter`

Methods inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
`clearState, determineLocation, determineTarget, dragOperationChanged, dragOver, getBounds, getCurrentEvent, getCurrentLocation, getCurrentOperation, getFeedbackEnabled, getSelectedObject, getViewer, handleException, overrideOperation, setExpandEnabled, setFeedbackEnabled, setScrollEnabled, setScrollExpandEnabled, setSelectionFeedbackEnabled`

Methods inherited from class org.eclipse.swt.dnd.DropTargetAdapter
`dragLeave`

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

Methods inherited from interface org.eclipse.swt.dnd.DropTargetListener
`dragEnter, dragLeave, dragOperationChanged, dragOver, drop`

Constructor Detail

### ResourceDropTargetListener

    public ResourceDropTargetListener(StructuredViewer viewer)

  Constructs a new drop listener for the given viewer.

  Parameters:
    `viewer` - the viewer

Method Detail

### getExecutableContext

    public ICommand getExecutableContext(DropTargetEvent event)

  Description copied from interface: `IDropTargetListener`
  Returns a command for dropping the event data on the drop target. The event passed in corresponds to the drop event. The listener can get the current target from the context.

  Specified by:
    `getExecutableContext` in interface `IDropTargetListener`
  Parameters:
    `event` - the event associated with the drop event
  Returns:
    Returns a command for dropping the event data on the drop target.

### canSupport

    public boolean canSupport(IDropTargetContext context,
                              IDropTargetEvent currentEvent,
                              ITransferAgent currentAgent)

  Description copied from interface: `IDropTargetListener`
  Returns a boolean indicating whether the listener can support drop operations on the current target. The target context, current event and current transfer agent information is passed to the listener. This method is invoked whenever the target changes.

  Specified by:
    `canSupport` in interface `IDropTargetListener`
  Parameters:
    `context` - The drop action context
    `currentEvent` - The current drop event
    `currentAgent` - the current transfer agent
  Returns:
    Returns true or false

### setFeedback

    public void setFeedback(DropTargetEvent event)

  Description copied from interface: `IDropTargetListener`
  Provides the listener an opportunity to set the feedback when hovering over a target. The listener can decide whether drag under effect is enabled for the current target.

  Specified by:
    `setFeedback` in interface `IDropTargetListener`
  Parameters:
    `event` - The drop target event

### getSupportingTransferIds

    public java.lang.String[] getSupportingTransferIds()

  Description copied from interface: `IDropTargetListener`
  Returns the supporting transfer agent ids.

  Specified by:
    `getSupportingTransferIds` in interface `IDropTargetListener`
  Returns:
    return the supporting transfer agent ids

### dropAccept

    public void dropAccept(DropTargetEvent event)

  Specified by:
    `dropAccept` in interface `DropTargetListener`
  Overrides:
    `dropAccept` in class `ViewerDropAdapter`

### validateDrop

    public boolean validateDrop(java.lang.Object target,
                                int dragOperation,
                                TransferData transferType)

  Overrides:
    `validateDrop` in class `NavigatorDropAdapter`

### getCurrentTarget

    protected java.lang.Object getCurrentTarget()

  Overrides:
    `getCurrentTarget` in class `ViewerDropAdapter`

Runtime

Guidelines for using Eclipse APIs.

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