Runtime

org.eclipse.gmf.runtime.common.ui.services.dnd.drop
Class AbstractDropTargetListener

java.lang.Object
  extended by org.eclipse.gmf.runtime.common.ui.services.dnd.drop.AbstractDropTargetListener
All Implemented Interfaces:
java.util.EventListener, IDropTargetListener, DropTargetListener, org.eclipse.swt.internal.SWTEventListener

public abstract class AbstractDropTargetListener
extends java.lang.Object
implements IDropTargetListener

Abstract parent of all the drop target listeners


Nested Class Summary
static class AbstractDropTargetListener.WorkIndicatorType
          Enumerated type for work indicator type
 
Constructor Summary
AbstractDropTargetListener()
          Default Constructor for AbstractDropTargetListener.
AbstractDropTargetListener(java.lang.String[] transferIdArray)
          Constructor for AbstractDropTargetListener.
 
Method Summary
 void addSupportingTransferId(java.lang.String transferId)
          Add transfer id to the list of transferIds.
abstract  boolean canSupport()
          Returns whether the listener can support handling drop operations on the current target context and the current event.
 boolean canSupport(IDropTargetContext cntxt, IDropTargetEvent currEvent, ITransferAgent currAgent)
          Returns a boolean indicating whether the listener can support drop operations on the current target.
 void dragEnter(DropTargetEvent event)
           
 void dragLeave(DropTargetEvent event)
           
 void dragOperationChanged(DropTargetEvent event)
           
 void dragOver(DropTargetEvent event)
           
 void drop(DropTargetEvent event)
           
 void dropAccept(DropTargetEvent event)
           
protected  IDropTargetContext getContext()
          Returns the context.
protected  ITransferAgent getCurrentAgent()
          Returns the current transfer agent.
protected  IDropTargetEvent getCurrentEvent()
          Returns the current event.
 ICommand getExecutableContext(DropTargetEvent event)
          Returns a command for dropping the event data on the drop target.
protected  Shell getShell()
          Returns the current shell.
 java.lang.String[] getSupportingTransferIds()
          Returns the supporting transfer agent ids.
protected  AbstractDropTargetListener.WorkIndicatorType getWorkIndicatorType()
          Gets type of work indicator (progress monitor, hourglass, or none).
 void setFeedback(DropTargetEvent event)
          Provides the listener an opportunity to set the feedback when hovering over a target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDropTargetListener

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

Parameters:
transferIdArray - The transfer agent ids

AbstractDropTargetListener

public AbstractDropTargetListener()
Default Constructor for AbstractDropTargetListener.

Method Detail

getSupportingTransferIds

public final 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

addSupportingTransferId

public final void addSupportingTransferId(java.lang.String transferId)
Add transfer id to the list of transferIds.

Parameters:
transferId - String id to add

dragEnter

public void dragEnter(DropTargetEvent event)
Specified by:
dragEnter in interface DropTargetListener

dragLeave

public void dragLeave(DropTargetEvent event)
Specified by:
dragLeave in interface DropTargetListener

dragOperationChanged

public void dragOperationChanged(DropTargetEvent event)
Specified by:
dragOperationChanged in interface DropTargetListener

dragOver

public void dragOver(DropTargetEvent event)
Specified by:
dragOver in interface DropTargetListener

drop

public final void drop(DropTargetEvent event)
Specified by:
drop in interface DropTargetListener

dropAccept

public void dropAccept(DropTargetEvent event)
Specified by:
dropAccept in interface DropTargetListener

getContext

protected final IDropTargetContext getContext()
Returns the context.

Returns:
IDropTargetContext

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.

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

canSupport

public abstract boolean canSupport()
Returns whether the listener can support handling drop operations on the current target context and the current event.

Returns:
true or false

canSupport

public final boolean canSupport(IDropTargetContext cntxt,
                                IDropTargetEvent currEvent,
                                ITransferAgent currAgent)
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:
cntxt - The drop action context
currEvent - The current drop event
currAgent - the current transfer agent
Returns:
Returns true or false

getCurrentEvent

protected final IDropTargetEvent getCurrentEvent()
Returns the current event.

Returns:
IDropTargetEvent

getCurrentAgent

protected final ITransferAgent getCurrentAgent()
Returns the current transfer agent.

Returns:
ITransferAgent

getShell

protected final Shell getShell()
Returns the current shell.

Returns:
Shell

getWorkIndicatorType

protected AbstractDropTargetListener.WorkIndicatorType getWorkIndicatorType()
Gets type of work indicator (progress monitor, hourglass, or none).

Returns:
type of work indicator

Runtime

Guidelines for using Eclipse APIs.

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