Runtime

org.eclipse.gmf.runtime.common.ui.services.dnd.drag
Class AbstractDragSourceListener

java.lang.Object
  extended by org.eclipse.gmf.runtime.common.ui.services.dnd.drag.AbstractDragSourceListener
All Implemented Interfaces:
java.util.EventListener, IDragSourceListener, DragSourceListener, org.eclipse.swt.internal.SWTEventListener

public abstract class AbstractDragSourceListener
extends java.lang.Object
implements IDragSourceListener

Abstract parent of all the drag source listeners


Constructor Summary
AbstractDragSourceListener(java.lang.String[] transferIdArray)
          Constructor for AbstractDragSourceListener.
 
Method Summary
protected  java.lang.Object[] combineArraysInList(java.util.List list, java.lang.Object[] resultingArrayType)
          Combines the arrays in the passed list into one array.
 void dragFinished(DragSourceEvent event)
           
 void dragSetData(DragSourceEvent event)
           
 void dragStart(DragSourceEvent event)
           
protected  IDragSourceContext getContext()
          Returns the context.
 java.lang.String[] getSupportingTransferIds()
          Returns the supporting transfer agent ids.
protected abstract  boolean isDraggable()
          Checks if the selection contained in the context is draggable.
 boolean isDraggable(IDragSourceContext cntxt)
          Determines if the selection in the context is draggable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDragSourceListener

public AbstractDragSourceListener(java.lang.String[] transferIdArray)
Constructor for AbstractDragSourceListener.

Parameters:
transferIdArray - The transfer agent ids
Method Detail

isDraggable

public final boolean isDraggable(IDragSourceContext cntxt)
Description copied from interface: IDragSourceListener
Determines if the selection in the context is draggable. This method is invoked when the drag starts

Specified by:
isDraggable in interface IDragSourceListener
Parameters:
cntxt - The context associated with the drag source
Returns:
true if the drag allowed and false otherwise.

getSupportingTransferIds

public final java.lang.String[] getSupportingTransferIds()
Description copied from interface: IDragSourceListener
Returns the supporting transfer agent ids.

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

dragStart

public final void dragStart(DragSourceEvent event)
Specified by:
dragStart in interface DragSourceListener

dragSetData

public void dragSetData(DragSourceEvent event)
Specified by:
dragSetData in interface DragSourceListener

dragFinished

public void dragFinished(DragSourceEvent event)
Specified by:
dragFinished in interface DragSourceListener

getContext

protected final IDragSourceContext getContext()
Returns the context.

Returns:
IDragSourceContext

isDraggable

protected abstract boolean isDraggable()
Checks if the selection contained in the context is draggable. Derived classes can get context using the getContext() method.

Returns:
true if draggable, false otherwise

combineArraysInList

protected final java.lang.Object[] combineArraysInList(java.util.List list,
                                                       java.lang.Object[] resultingArrayType)
Combines the arrays in the passed list into one array.

Parameters:
list - The List of arrays to combine together
resultingArrayType - the Object[] used to define the type of the combined array
Returns:
Object[] the combined array of the proper type

Runtime

Guidelines for using Eclipse APIs.

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