Runtime

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

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.services.dnd.drop.DropTargetContext

All Implemented Interfaces:
  IDropTargetContext

    public class DropTargetContext

extends java.lang.Object
implements IDropTargetContext

Concrete implementation of `IDropTargetContext`

Field Summary
`protected Point` `location` Attribute for the current location.
`protected static int` `LOCATION_EPSILON` The threshold used to determine if the mouse is before or after a target item.
`protected int` `relativeLocation` Attribute for the relative location.
`protected java.lang.Object` `target` Attribute for the target.

Fields inherited from interface org.eclipse.gmf.runtime.common.ui.services.dnd.drop.IDropTargetContext
`LOCATION_AFTER, LOCATION_BEFORE, LOCATION_NONE, LOCATION_ON`

Constructor Summary
`DropTargetContext(IWorkbenchPart anActivePart, Control aViewerControl)` Constructor for DropTargetContext.

Method Summary
`protected void` `dragEnter(DropTargetEvent event)` Set details of the event upon entering the drop target
`protected void` `dragLeave(DropTargetEvent event)` Called when leaving the drop target or cancelling
`protected void` `dragOperationChanged(DropTargetEvent event)` Called when the drag operation has changed
`protected void` `dragOver(DropTargetEvent event)` Called when over the drop target
`protected void` `drop(DropTargetEvent event)` Called upon a drop
`protected void` `dropAccept(DropTargetEvent event)` Called immediately before a drop
`IWorkbenchPart` `getActivePart()` Returns the active `IWorkbenchPart` associated with the drop target viewer.
`Point` `getCurrentLocation()` Returns the coordinates of the current location of the mouse.
`java.lang.Object` `getCurrentTarget()` Returns the current target on the drop target viewer
`int` `getRelativeLocation()` Constant describing the position of the cursor relative to the target object
`Control` `getViewerControl()` Returns the control associated with the drop target viewer.
`protected void` `setCurrentTargetAndLocation(DropTargetEvent event)` Sets the target item of the given drop event as the current target.

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

Field Detail

### LOCATION_EPSILON

    protected static final int LOCATION_EPSILON

  The threshold used to determine if the mouse is before or after a target item.

  See Also:
    Constant Field Values

### target

    protected java.lang.Object target

  Attribute for the target.

### location

    protected Point location

  Attribute for the current location.

### relativeLocation

    protected int relativeLocation

  Attribute for the relative location.

Constructor Detail

### DropTargetContext

    public DropTargetContext(IWorkbenchPart anActivePart,
                             Control aViewerControl)

  Constructor for DropTargetContext.

  Parameters:
    `anActivePart` - the active IWorkbenchPart
    `aViewerControl` - Control of the drop target

Method Detail

### getActivePart

    public final IWorkbenchPart getActivePart()

  Description copied from interface: `IDropTargetContext`
  Returns the active `IWorkbenchPart` associated with the drop target viewer.

  Specified by:
    `getActivePart` in interface `IDropTargetContext`
  Returns:
    Returns the active `IWorkbenchPart`

### getCurrentTarget

    public final java.lang.Object getCurrentTarget()

  Description copied from interface: `IDropTargetContext`
  Returns the current target on the drop target viewer

  Specified by:
    `getCurrentTarget` in interface `IDropTargetContext`
  Returns:
    Returns the current target on the drop target viewer

### getCurrentLocation

    public final Point getCurrentLocation()

  Description copied from interface: `IDropTargetContext`
  Returns the coordinates of the current location of the mouse.

  Specified by:
    `getCurrentLocation` in interface `IDropTargetContext`
  Returns:
    Point the location

### getViewerControl

    public final Control getViewerControl()

  Description copied from interface: `IDropTargetContext`
  Returns the control associated with the drop target viewer.

  Specified by:
    `getViewerControl` in interface `IDropTargetContext`
  Returns:
    Control

### setCurrentTargetAndLocation

    protected void setCurrentTargetAndLocation(DropTargetEvent event)

  Sets the target item of the given drop event as the current target. Also sets the current coordinates of the current location of the mouse.

  Parameters:
    `event` - the event

### dragEnter

    protected void dragEnter(DropTargetEvent event)

  Set details of the event upon entering the drop target

  Parameters:
    `event` - DropTargetEvent to have its detail field reset
  See Also:
    `DropTargetListener.dragEnter(org.eclipse.swt.dnd.DropTargetEvent)`

### dragOperationChanged

    protected void dragOperationChanged(DropTargetEvent event)

  Called when the drag operation has changed

  Parameters:
    `event` - DropTargetEvent to update
  See Also:
    `DropTargetListener.dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)`

### dragOver

    protected void dragOver(DropTargetEvent event)

  Called when over the drop target

  Parameters:
    `event` - DropTargetEvent to update
  See Also:
    `DropTargetListener.dragOver(org.eclipse.swt.dnd.DropTargetEvent)`

### drop

    protected void drop(DropTargetEvent event)

  Called upon a drop

  Parameters:
    `event` - DropTargetEvent to update
  See Also:
    `DropTargetListener.drop(org.eclipse.swt.dnd.DropTargetEvent)`

### dropAccept

    protected void dropAccept(DropTargetEvent event)

  Called immediately before a drop

  Parameters:
    `event` - DropTargetEvent to have its detail field reset
  See Also:
    `DropTargetListener.dropAccept(org.eclipse.swt.dnd.DropTargetEvent)`

### dragLeave

    protected void dragLeave(DropTargetEvent event)

  Called when leaving the drop target or cancelling

  Parameters:
    `event` - DropTargetEvent to update
  See Also:
    `DropTargetListener.dragLeave(org.eclipse.swt.dnd.DropTargetEvent)`

### getRelativeLocation

    public final int getRelativeLocation()

  Description copied from interface: `IDropTargetContext`
  Constant describing the position of the cursor relative to the target object

  Specified by:
    `getRelativeLocation` in interface `IDropTargetContext`
  Returns:
    int the location

Runtime

Guidelines for using Eclipse APIs.

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