Runtime

## org.eclipse.gmf.runtime.common.ui.services.dnd.core
Class SelectionTransfer

    java.lang.Object
      org.eclipse.swt.dnd.Transfer
          org.eclipse.swt.dnd.ByteArrayTransfer
              org.eclipse.gmf.runtime.common.ui.services.dnd.core.SelectionTransfer

public final class SelectionTransfer
extends ByteArrayTransfer

This class can be used to transfer a `ISelection` between two parts in a workbench in a drag and drop operation. This class does not marshall the data.

Method Summary
`static SelectionTransfer` `getInstance()` Return the singleton.
`ISelection` `getSelection()` Returns the selection.
`protected int[]` `getTypeIds()` Returns the type ids supported by this agent
`protected java.lang.String[]` `getTypeNames()` Returns the type names supported by this agent
`void` `javaToNative(java.lang.Object object, TransferData transferData)` Converts the `TYPE_NAME` into a `byte[]`
`java.lang.Object` `nativeToJava(TransferData transferData)` Retrieves the `byte[]` associated with `TYPE_NAME`.
`void` `setSelection(ISelection aSelection)` Sets the selection.

Methods inherited from class org.eclipse.swt.dnd.ByteArrayTransfer
`getSupportedTypes, isSupportedType`

Methods inherited from class org.eclipse.swt.dnd.Transfer
`registerType, validate`

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

Method Detail

### getInstance

    public static SelectionTransfer getInstance()

  Return the singleton.

  Returns:
    the singleton instance of the SelectionTransfer class

### javaToNative

    public void javaToNative(java.lang.Object object,
                             TransferData transferData)

  Converts the `TYPE_NAME` into a `byte[]`

  See Also:
    `Transfer.javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)`

### nativeToJava

    public java.lang.Object nativeToJava(TransferData transferData)

  Retrieves the `byte[]` associated with `TYPE_NAME`. Verifies it is the same as the `TYPE_NAME` and then returns the `selection`.

  Returns:
    `Object`
  See Also:
    `Transfer.nativeToJava(org.eclipse.swt.dnd.TransferData)`

### getTypeIds

    protected int[] getTypeIds()

  Returns the type ids supported by this agent

  Returns:
    `int[]`
  See Also:
    `Transfer.getTypeIds()`

### getTypeNames

    protected java.lang.String[] getTypeNames()

  Returns the type names supported by this agent

  Returns:
    `String[]`
  See Also:
    `Transfer.getTypeNames()`

### getSelection

    public ISelection getSelection()

  Returns the selection.

  Returns:
    `selection`

### setSelection

    public void setSelection(ISelection aSelection)

  Sets the selection.

  Parameters:
    `aSelection` - The selection to set

Runtime

Guidelines for using Eclipse APIs.

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