public class DragEditPartsTracker extends SelectEditPartTracker
EditParts
.AbstractTool.Input
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_FLAG
Max flag
|
FLAG_SELECTION_PERFORMED
MAX_STATE, MOUSE_BUTTON_ANY, MOUSE_BUTTON1, MOUSE_BUTTON2, MOUSE_BUTTON3, PROPERTY_UNLOAD_WHEN_FINISHED, STATE_ACCESSIBLE_DRAG, STATE_ACCESSIBLE_DRAG_IN_PROGRESS, STATE_DRAG, STATE_DRAG_IN_PROGRESS, STATE_INITIAL, STATE_INVALID, STATE_TERMINAL
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
Constructor and Description |
---|
DragEditPartsTracker(EditPart sourceEditPart)
Constructs a new DragEditPartsTracker with the given source edit part.
|
Modifier and Type | Method and Description |
---|---|
void |
commitDrag()
Erases feedback and calls
performDrag() . |
protected java.util.List |
createOperationSet()
Returns a List of top-level edit parts excluding dependants (by calling
ToolUtilities.getSelectionWithoutDependants(EditPartViewer) that
understand the current target request (by calling
ToolUtilities.filterEditPartsUnderstanding(List, Request) . |
protected Request |
createTargetRequest()
Creates a
ChangeBoundsRequest . |
void |
deactivate()
Erases source feedback and sets the autoexpose helper to
null . |
protected void |
eraseSourceFeedback()
Asks the edit parts in the
operation set to erase their source feedback. |
protected Command |
getCommand()
Asks each edit part in the
operation set to contribute to a CompoundCommand after first
setting the request type to either RequestConstants.REQ_MOVE or
RequestConstants.REQ_ORPHAN , depending on the result of
isMove() . |
protected java.lang.String |
getCommandName()
Returns the identifier of the command that is being sought.
|
protected java.lang.String |
getDebugName()
Returns the debug name for this tool.
|
protected Cursor |
getDefaultCursor()
Returns the cursor used under normal conditions.
|
protected java.util.Collection |
getExclusionSet()
Returns a list of all the edit parts in the
operation set , plus the
ConnectionLayer . |
protected PrecisionRectangle |
getOperationSetBounds()
Returns the unioned bounds of the
operation set
edit parts' figures in absolute coordinates. |
protected SnapToHelper |
getSnapToHelper()
Returns the
SnapToHelper used by this
DragEditPartsTracker . |
protected PrecisionRectangle |
getSourceBounds()
Returns the bounds of the
source edit part's
figure in absolute coordinates. |
protected void |
handleAutoexpose()
This method is called whenever an autoexpose occurs.
|
protected boolean |
handleButtonUp(int button)
Erases feedback and calls
performDrag() . |
protected boolean |
handleDragInProgress()
Updates the target request and mouse target, asks to show feedback, and
sets the current command.
|
protected boolean |
handleHover()
Calls
TargetingTool.updateAutoexposeHelper() if a drag is in
progress. |
protected boolean |
handleInvalidInput()
Erases source feedback.
|
protected boolean |
handleKeyDown(KeyEvent e)
Processes arrow keys used to move edit parts.
|
protected boolean |
handleKeyUp(KeyEvent e)
Interprets and processes clone deactivation, constrained move
deactivation, and accessibility navigation reset.
|
protected boolean |
isCloneActive()
Returns true if the current drag is a clone operation.
|
protected boolean |
isMove()
Returns
true if the source edit part is being moved within
its parent. |
protected void |
performDrag()
|
protected void |
repairStartLocation()
If auto scroll (also called auto expose) is being performed, the start
location moves during the scroll.
|
protected void |
setAutoexposeHelper(AutoexposeHelper helper)
Sets the active autoexpose helper to the given helper, or
null . |
protected void |
setCloneActive(boolean cloneActive)
Enables cloning if the value is true.
|
protected void |
setState(int state)
Extended to activate cloning and to update the captured source dimensions
when applicable.
|
protected void |
setTargetEditPart(EditPart editpart)
Extended to update the current snap-to strategy.
|
protected void |
showSourceFeedback()
Asks the edit parts in the
operation set to show source feedback. |
protected void |
snapPoint(ChangeBoundsRequest request)
This method can be overridden by clients to customize the snapping
behavior.
|
protected void |
updateTargetRequest()
Calls
repairStartLocation() in case auto scroll is being
performed. |
calculateCursor, getSourceEditPart, handleButtonDown, handleDoubleClick, handleDragStarted, hasSelectionOccurred, performConditionalSelection, performDirectEdit, performOpen, performSelection, resetFlags, setSourceEditPart
doAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getTargetEditPart, getTargetingConditional, getTargetRequest, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetHover, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse
acceptArrowKey, activate, addFeedback, applyProperty, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDrag, handleFinished, handleFocusGained, handleFocusLost, handleKeyTraversed, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, placeMouseInViewer, reactivate, refreshCursor, releaseToolCapture, removeFeedback, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExited
getFlag, setFlag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
protected static final int MAX_FLAG
public DragEditPartsTracker(EditPart sourceEditPart)
sourceEditPart
- the source edit partprotected Cursor getDefaultCursor()
getDefaultCursor
in class AbstractTool
AbstractTool.setDefaultCursor(Cursor)
protected PrecisionRectangle getSourceBounds()
source edit part's
figure in absolute coordinates. In case the source figure implements
HandleBounds
the handle
bounds
are returned in absolute coordinates, other wise the
figure bounds
.protected PrecisionRectangle getOperationSetBounds()
operation set
edit parts'
figures in absolute coordinates. In case the figures
implement HandleBounds
their
handle bounds
will be used,
otherwise their figure bounds
.protected SnapToHelper getSnapToHelper()
SnapToHelper
used by this
DragEditPartsTracker
.SnapToHelper
used by this
DragEditPartsTracker
.public void commitDrag()
performDrag()
. Sets the state to
terminal.commitDrag
in interface DragTracker
commitDrag
in class AbstractTool
AbstractTool.commitDrag()
protected java.util.List createOperationSet()
ToolUtilities.getSelectionWithoutDependants(EditPartViewer)
that
understand the current target request (by calling
ToolUtilities.filterEditPartsUnderstanding(List, Request)
.createOperationSet
in class AbstractTool
AbstractTool.createOperationSet()
protected Request createTargetRequest()
ChangeBoundsRequest
. By default, the type is
RequestConstants.REQ_MOVE
. Later on when the edit parts are asked
to contribute to the overall command, the request type will be either
RequestConstants.REQ_MOVE
or RequestConstants.REQ_ORPHAN
,
depending on the result of isMove()
.createTargetRequest
in class TargetingTool
TargetingTool.createTargetRequest()
public void deactivate()
null
.deactivate
in interface Tool
deactivate
in class TargetingTool
Tool.deactivate()
protected void eraseSourceFeedback()
operation set
to erase their source feedback.protected Command getCommand()
operation set
to contribute to a CompoundCommand
after first
setting the request type to either RequestConstants.REQ_MOVE
or
RequestConstants.REQ_ORPHAN
, depending on the result of
isMove()
.getCommand
in class TargetingTool
AbstractTool.getCommand()
protected java.lang.String getCommandName()
AbstractTool
getCommandName
in class SelectEditPartTracker
AbstractTool.getCommandName()
protected java.lang.String getDebugName()
AbstractTool
getDebugName
in class SelectEditPartTracker
AbstractTool.getDebugName()
protected java.util.Collection getExclusionSet()
operation set
, plus the
ConnectionLayer
.getExclusionSet
in class TargetingTool
TargetingTool.getExclusionSet()
protected void handleAutoexpose()
TargetingTool
handleMove()
is
called to simulate the mouse moving even though it didn't.handleAutoexpose
in class TargetingTool
TargetingTool.handleAutoexpose()
protected boolean handleButtonUp(int button)
performDrag()
.handleButtonUp
in class SelectEditPartTracker
button
- the button being releasedtrue
if the button up was handledAbstractTool.handleButtonUp(int)
protected boolean handleDragInProgress()
handleDragInProgress
in class AbstractTool
true
if the drag was handledAbstractTool.handleDragInProgress()
protected boolean handleHover()
TargetingTool.updateAutoexposeHelper()
if a drag is in
progress.handleHover
in class AbstractTool
true
if the hover was handledAbstractTool.handleHover()
protected boolean handleInvalidInput()
handleInvalidInput
in class TargetingTool
true
TargetingTool.handleInvalidInput()
protected boolean handleKeyDown(KeyEvent e)
handleKeyDown
in class AbstractTool
e
- the key eventtrue
if the key down was handled.AbstractTool.handleKeyDown(org.eclipse.swt.events.KeyEvent)
protected boolean handleKeyUp(KeyEvent e)
handleKeyUp
in class AbstractTool
e
- the key eventtrue
if the event was handledAbstractTool.handleKeyUp(org.eclipse.swt.events.KeyEvent)
protected boolean isCloneActive()
protected boolean isMove()
true
if the source edit part is being moved within
its parent. If the source edit part is being moved to another parent,
this returns false
.true
if the source edit part is not being reparentedprotected void performDrag()
protected void repairStartLocation()
protected void setAutoexposeHelper(AutoexposeHelper helper)
TargetingTool
null
. If the helper is not null
, a runnable is
queued on the event thread that will trigger a subsequent
TargetingTool.doAutoexpose()
. The helper is typically updated only on a hover
event.setAutoexposeHelper
in class TargetingTool
helper
- the new autoexpose helper or null
TargetingTool.setAutoexposeHelper(org.eclipse.gef.AutoexposeHelper)
protected void setCloneActive(boolean cloneActive)
cloneActive
- true
if cloning should be activeprotected void setTargetEditPart(EditPart editpart)
setTargetEditPart
in class TargetingTool
editpart
- the new targetTargetingTool.setTargetEditPart(org.eclipse.gef.EditPart)
protected void showSourceFeedback()
operation set
to show source feedback.protected void setState(int state)
setState
in class AbstractTool
state
- the new stateAbstractTool.setState(int)
protected void updateTargetRequest()
repairStartLocation()
in case auto scroll is being
performed. Updates the request with the current
operation set
, move delta,
location and type.updateTargetRequest
in class TargetingTool
TargetingTool.updateTargetRequest()
protected void snapPoint(ChangeBoundsRequest request)
request
- the ChangeBoundsRequest
from which the move delta
can be extracted and updatedCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.