|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.dnd.AbstractTransferDropTargetListener
public abstract class AbstractTransferDropTargetListener
An abstract implementation of TransferDropTargetListener for use with
EditPartViewer
s. The Viewer's Control
should be the Drop
target. In order to communicate with EditParts in a consistent way,
DropTargetEvents are processed into Requests
.
Dropping is inherently a targeting interaction. This class handles calculating the target EditPart. It also handles common targeting behavior, such as interacting with the target EditPart or its ancestors to achieve things like auto-scroll/auto-expose.
Constructor Summary | |
---|---|
AbstractTransferDropTargetListener(EditPartViewer viewer)
Constructs a new AbstractTransferDropTargetListener and sets the EditPartViewer. |
|
AbstractTransferDropTargetListener(EditPartViewer viewer,
Transfer xfer)
Constructs a new AbstractTransferDropTargetListener and sets the EditPartViewer and Transfer. |
Method Summary | |
---|---|
protected Request |
createTargetRequest()
Creates and returns the Request that will be sent to the
targeted EditPart. |
void |
dragEnter(DropTargetEvent event)
Stores the information about the current DropTargetEvent. |
void |
dragLeave(DropTargetEvent event)
Stores the information about the current DropTargetEvent and then calls unload() . |
void |
dragOperationChanged(DropTargetEvent event)
Stores the information about the current DropTargetEvent and then calls handleDragOperationChanged() . |
void |
dragOver(DropTargetEvent event)
Stores the information about the current DropTargetEvent and then calls handleDragOver() . |
void |
drop(DropTargetEvent event)
Stores the information about the current DropTargetEvent and then calls handleDrop() , followed by unload() . |
void |
dropAccept(DropTargetEvent event)
Stores the current DropTargetEvent and does nothing. |
protected void |
eraseTargetFeedback()
Calls eraseTargetFeedback(Request) on the current
target, using the target Request. |
protected Command |
getCommand()
Returns the current command from the target EditPart. |
DropTargetEvent |
getCurrentEvent()
Returns the current DropTargetEvent . |
protected Point |
getDropLocation()
Returns the current mouse location, as a Point . |
protected Collection |
getExclusionSet()
Returns a Collection of EditParts that are to be
excluded when searching for the target EditPart. |
protected EditPart |
getTargetEditPart()
Returns the current target EditPart . |
protected Request |
getTargetRequest()
Returns the target Request . |
Transfer |
getTransfer()
|
protected EditPartViewer |
getViewer()
Returns the EditPartViewer that is the target of the drop. |
protected void |
handleDragOperationChanged()
Called when the user changes the Drag operation. |
protected void |
handleDragOver()
Called whenever the User drags over the target. |
protected void |
handleDrop()
Updates the target Request and target EditPart, and performs the drop. |
protected void |
handleEnteredEditPart()
Called when a new target EditPart has been entered. |
protected void |
handleExitingEditPart()
Called as the current target EditPart is being exited. |
protected void |
handleHover()
Called when the mouse hovers during drag and drop. |
protected void |
handleHoverStop()
Called when the mouse resumes motion after having hovered. |
boolean |
isEnabled(DropTargetEvent event)
Returns true if this TransferDropTargetListener is enabled
for the specified DropTargetEvent . |
protected boolean |
isEnablementDeterminedByCommand()
Returns true if isEnabled(DropTargetEvent) is
determined by asking the potential target for a Command. |
protected void |
setAutoexposeHelper(AutoexposeHelper helper)
Sets the current autoexpose helper. |
void |
setCurrentEvent(DropTargetEvent currentEvent)
Sets the current DropTargetEvent. |
protected void |
setEnablementDeterminedByCommand(boolean value)
Determines if the target editpart should be asked for a Command during isEnabled(DropTargetEvent) . |
protected void |
setTargetEditPart(EditPart ep)
Sets the target EditPart . |
protected void |
setTransfer(Transfer xfer)
Sets the Tranfer type that this listener can handle. |
protected void |
setViewer(EditPartViewer viewer)
Sets the EditPartViewer. |
protected void |
showTargetFeedback()
Asks the target EditPart to show target feedback if it is
not null . |
protected void |
unload()
Erases target feedback and sets the request to null . |
protected void |
updateAutoexposeHelper()
Updates the active AutoexposeHelper . |
protected void |
updateTargetEditPart()
Updates the target EditPart. |
protected abstract void |
updateTargetRequest()
Subclasses must implement this to update the target Request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTransferDropTargetListener(EditPartViewer viewer)
setTransfer(Transfer)
.
viewer
- the EditPartViewerpublic AbstractTransferDropTargetListener(EditPartViewer viewer, Transfer xfer)
viewer
- the EditPartViewerxfer
- the TransferMethod Detail |
---|
protected Request createTargetRequest()
Request
that will be sent to the
targeted EditPart. Subclasses can override to create specialized
requests.
Request
to be used with the target
EditPartpublic void dragEnter(DropTargetEvent event)
dragEnter
in interface DropTargetListener
DropTargetListener.dragEnter(DropTargetEvent)
public void dragLeave(DropTargetEvent event)
unload()
. Subclasses should override unload()
to
perform actions for this event. For some reason, SWT also calls
dragLeave()
when the actual drop is performed, even though
the mouse has not left the drop target.
dragLeave
in interface DropTargetListener
DropTargetListener.dragLeave(DropTargetEvent)
public void dragOperationChanged(DropTargetEvent event)
handleDragOperationChanged()
. Subclasses should override
handleDragOperationChanged()
to perform actions for this event.
dragOperationChanged
in interface DropTargetListener
DropTargetListener.dragOperationChanged(DropTargetEvent)
public void dragOver(DropTargetEvent event)
handleDragOver()
. Subclasses should override
handleDragOver()
to perform actions for this event.
dragOver
in interface DropTargetListener
DropTargetListener.dragOver(org.eclipse.swt.dnd.DropTargetEvent)
public void drop(DropTargetEvent event)
handleDrop()
, followed by unload()
. Subclasses should
override these methods to perform actions for this event.
drop
in interface DropTargetListener
DropTargetListener.drop(DropTargetEvent)
public void dropAccept(DropTargetEvent event)
DropTargetEvent
and does nothing. By
default, the drop is accepted.
dropAccept
in interface DropTargetListener
DropTargetListener.dropAccept(DropTargetEvent)
protected void eraseTargetFeedback()
eraseTargetFeedback(Request)
on the current
target, using the target Request. Does nothing if there is no
target, or if the target has not been requested to show target feedback.
protected Command getCommand()
public DropTargetEvent getCurrentEvent()
DropTargetEvent
.
protected Point getDropLocation()
Point
. The location is
relative to the control's client area.
protected Collection getExclusionSet()
EditParts
that are to be
excluded when searching for the target EditPart.
protected EditPart getTargetEditPart()
EditPart
.
protected Request getTargetRequest()
Request
. If the target Request is
null
, createTargetRequest()
is called and the newly
created Request is returned.
public Transfer getTransfer()
getTransfer
in interface TransferDropTargetListener
TransferDropTargetListener.getTransfer()
protected EditPartViewer getViewer()
EditPartViewer
that is the target of the drop.
protected void handleDragOperationChanged()
protected void handleDragOver()
protected void handleDrop()
If there is no target EditPart or no executable Command, the event's
detail
field is set to DND.DROP_NONE
.
protected void handleEnteredEditPart()
protected void handleExitingEditPart()
protected void handleHover()
protected void handleHoverStop()
public boolean isEnabled(DropTargetEvent event)
true
if this TransferDropTargetListener is enabled
for the specified DropTargetEvent
. By default, this is
calculated by comparing the event's dataTypes
with the Transfer's
supported types (
Transfer.isSupportedType(TransferData)
). If a dataType is
supported, an attempt is made to find a target
EditPart
at the current drop location. If a target
EditPart
is found, true
is returned, and the
DropTargetEvent's DropTargetEvent.currentDataType
is set to the
dataType that matched.
isEnabled
in interface TransferDropTargetListener
event
- the DropTargetEvent
true
if this TransferDropTargetListener is enabled
for the given DropTargetEventprotected boolean isEnablementDeterminedByCommand()
true
if isEnabled(DropTargetEvent)
is
determined by asking the potential target for a Command.
true
if the target will be queried for a
Command
protected void setAutoexposeHelper(AutoexposeHelper helper)
helper
- the autoexpose helperprotected void setEnablementDeterminedByCommand(boolean value)
isEnabled(DropTargetEvent)
. For most DND operations, the data is
not available, thus asking for a command would not make sense. The
default value is false
.
value
- true
if apublic void setCurrentEvent(DropTargetEvent currentEvent)
currentEvent
- the DropTargetEventprotected void setTargetEditPart(EditPart ep)
EditPart
. If the target is changing,
handleExitingEditPart()
is called before the target changes, and
handleEnteredEditPart()
is called afterwards.
ep
- the new target EditPartprotected void setTransfer(Transfer xfer)
xfer
- the Transferprotected void setViewer(EditPartViewer viewer)
viewer
- the EditPartViewerprotected void showTargetFeedback()
EditPart
to show target feedback if it is
not null
.
EditPart.showTargetFeedback(Request)
protected void unload()
null
.
protected void updateAutoexposeHelper()
AutoexposeHelper
. Does nothing if there is
still an active helper. Otherwise, obtains a new helper (possible
null
) at the current mouse location and calls
setAutoexposeHelper(AutoexposeHelper)
.
protected void updateTargetEditPart()
protected abstract void updateTargetRequest()
|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |