Package org.eclipse.gef.tools
Class DragEditPartsTracker
java.lang.Object
org.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool
org.eclipse.gef.tools.TargetingTool
org.eclipse.gef.tools.SelectEditPartTracker
org.eclipse.gef.tools.DragEditPartsTracker
- All Implemented Interfaces:
DragTracker
,RequestConstants
,Tool
A DragTracker that moves
EditParts
.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractTool
AbstractTool.Input
-
Field Summary
FieldsFields inherited from class org.eclipse.gef.tools.SelectEditPartTracker
FLAG_SELECTION_PERFORMED
Fields inherited from class org.eclipse.gef.tools.AbstractTool
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
Fields inherited from interface org.eclipse.gef.RequestConstants
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 Summary
ConstructorsConstructorDescriptionDragEditPartsTracker
(EditPart sourceEditPart) Constructs a new DragEditPartsTracker with the given source edit part. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Erases feedback and callsperformDrag()
.protected List
Returns a List of top-level edit parts excluding dependants (by callingToolUtilities.getSelectionWithoutDependants(EditPartViewer)
that understand the current target request (by callingToolUtilities.filterEditPartsUnderstanding(List, Request)
.protected Request
Creates aChangeBoundsRequest
.void
Erases source feedback and sets the autoexpose helper tonull
.protected void
Asks the edit parts in theoperation set
to erase their source feedback.protected Command
Asks each edit part in theoperation set
to contribute to aCompoundCommand
after first setting the request type to eitherRequestConstants.REQ_MOVE
orRequestConstants.REQ_ORPHAN
, depending on the result ofisMove()
.protected String
Returns the identifier of the command that is being sought.protected String
Returns the debug name for this tool.protected Cursor
Returns the cursor used under normal conditions.protected Collection
Returns a list of all the edit parts in theoperation set
, plus theConnectionLayer
.protected org.eclipse.draw2d.geometry.PrecisionRectangle
Returns the unioned bounds of theoperation set edit parts'
figures in absolute coordinates.protected SnapToHelper
Returns theSnapToHelper
used by thisDragEditPartsTracker
.protected org.eclipse.draw2d.geometry.PrecisionRectangle
Returns the bounds of thesource edit part's
figure in absolute coordinates.protected void
This method is called whenever an autoexpose occurs.protected boolean
handleButtonUp
(int button) Erases feedback and callsperformDrag()
.protected boolean
Updates the target request and mouse target, asks to show feedback, and sets the current command.protected boolean
CallsTargetingTool.updateAutoexposeHelper()
if a drag is in progress.protected boolean
Erases source feedback.protected boolean
Processes arrow keys used to move edit parts.protected boolean
Interprets and processes clone deactivation, constrained move deactivation, and accessibility navigation reset.protected boolean
Returns true if the current drag is a clone operation.protected boolean
isMove()
Returnstrue
if the source edit part is being moved within its parent.protected void
protected void
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, ornull
.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
Asks the edit parts in theoperation set
to show source feedback.protected void
snapPoint
(ChangeBoundsRequest request) This method can be overridden by clients to customize the snapping behavior.protected void
CallsrepairStartLocation()
in case auto scroll is being performed.Methods inherited from class org.eclipse.gef.tools.SelectEditPartTracker
calculateCursor, getSourceEditPart, handleButtonDown, handleDoubleClick, handleDragStarted, hasSelectionOccurred, performConditionalSelection, performDirectEdit, performOpen, performSelection, resetFlags, setSourceEditPart
Methods inherited from class org.eclipse.gef.tools.TargetingTool
doAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getTargetEditPart, getTargetingConditional, getTargetRequest, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetHover, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse
Methods inherited from class org.eclipse.gef.tools.AbstractTool
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
Methods inherited from class org.eclipse.gef.util.FlagSupport
getFlag, setFlag
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.gef.Tool
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
-
Field Details
-
MAX_FLAG
protected static final int MAX_FLAGMax flag- See Also:
-
-
Constructor Details
-
DragEditPartsTracker
Constructs a new DragEditPartsTracker with the given source edit part.- Parameters:
sourceEditPart
- the source edit part
-
-
Method Details
-
getDefaultCursor
Returns the cursor used under normal conditions.- Overrides:
getDefaultCursor
in classAbstractTool
- Returns:
- the default cursor
- See Also:
-
getSourceBounds
protected org.eclipse.draw2d.geometry.PrecisionRectangle getSourceBounds()Returns the bounds of thesource edit part's
figure in absolute coordinates. In case the source figure implementsHandleBounds
thehandle bounds
are returned in absolute coordinates, other wise thefigure bounds
.- Returns:
- The bounds of the source figure in absolute coordinates.
- Since:
- 3.11
-
getOperationSetBounds
protected org.eclipse.draw2d.geometry.PrecisionRectangle getOperationSetBounds()Returns the unioned bounds of theoperation set edit parts'
figures in absolute coordinates. In case the figures implementHandleBounds
theirhandle bounds
will be used, otherwise theirfigure bounds
.- Returns:
- The unioned bounds of the operation set figures in absolute coordinates.
- Since:
- 3.11
-
getSnapToHelper
Returns theSnapToHelper
used by thisDragEditPartsTracker
.- Returns:
- The
SnapToHelper
used by thisDragEditPartsTracker
. - Since:
- 3.11
-
commitDrag
public void commitDrag()Erases feedback and callsperformDrag()
. Sets the state to terminal.- Specified by:
commitDrag
in interfaceDragTracker
- Overrides:
commitDrag
in classAbstractTool
- See Also:
-
createOperationSet
Returns a List of top-level edit parts excluding dependants (by callingToolUtilities.getSelectionWithoutDependants(EditPartViewer)
that understand the current target request (by callingToolUtilities.filterEditPartsUnderstanding(List, Request)
.- Overrides:
createOperationSet
in classAbstractTool
- Returns:
- a list of editparts being operated on
- See Also:
-
createTargetRequest
Creates aChangeBoundsRequest
. By default, the type isRequestConstants.REQ_MOVE
. Later on when the edit parts are asked to contribute to the overall command, the request type will be eitherRequestConstants.REQ_MOVE
orRequestConstants.REQ_ORPHAN
, depending on the result ofisMove()
.- Overrides:
createTargetRequest
in classTargetingTool
- Returns:
- the new target request
- See Also:
-
deactivate
public void deactivate()Erases source feedback and sets the autoexpose helper tonull
.- Specified by:
deactivate
in interfaceTool
- Overrides:
deactivate
in classTargetingTool
- See Also:
-
eraseSourceFeedback
protected void eraseSourceFeedback()Asks the edit parts in theoperation set
to erase their source feedback. -
getCommand
Asks each edit part in theoperation set
to contribute to aCompoundCommand
after first setting the request type to eitherRequestConstants.REQ_MOVE
orRequestConstants.REQ_ORPHAN
, depending on the result ofisMove()
.- Overrides:
getCommand
in classTargetingTool
- Returns:
- a newly obtained command
- See Also:
-
getCommandName
Description copied from class:AbstractTool
Returns the identifier of the command that is being sought. This name is also the named that will be logged in the debug view.- Overrides:
getCommandName
in classSelectEditPartTracker
- Returns:
- the identifier for the command
- See Also:
-
getDebugName
Description copied from class:AbstractTool
Returns the debug name for this tool.- Overrides:
getDebugName
in classSelectEditPartTracker
- Returns:
- the debug name
- See Also:
-
getExclusionSet
Returns a list of all the edit parts in theoperation set
, plus theConnectionLayer
.- Overrides:
getExclusionSet
in classTargetingTool
- Returns:
- the list of objects to be excluded as targets
- See Also:
-
handleAutoexpose
protected void handleAutoexpose()Description copied from class:TargetingTool
This method is called whenever an autoexpose occurs. When an autoexpose occurs, it is possible that everything in the viewer has moved a little. Therefore, by default,handleMove()
is called to simulate the mouse moving even though it didn't.- Overrides:
handleAutoexpose
in classTargetingTool
- See Also:
-
handleButtonUp
protected boolean handleButtonUp(int button) Erases feedback and callsperformDrag()
.- Overrides:
handleButtonUp
in classSelectEditPartTracker
- Parameters:
button
- the button being released- Returns:
true
if the button up was handled- See Also:
-
handleDragInProgress
protected boolean handleDragInProgress()Updates the target request and mouse target, asks to show feedback, and sets the current command.- Overrides:
handleDragInProgress
in classAbstractTool
- Returns:
true
if the drag was handled- See Also:
-
handleHover
protected boolean handleHover()CallsTargetingTool.updateAutoexposeHelper()
if a drag is in progress.- Overrides:
handleHover
in classAbstractTool
- Returns:
true
if the hover was handled- See Also:
-
handleInvalidInput
protected boolean handleInvalidInput()Erases source feedback.- Overrides:
handleInvalidInput
in classTargetingTool
- Returns:
true
- See Also:
-
handleKeyDown
Processes arrow keys used to move edit parts.- Overrides:
handleKeyDown
in classAbstractTool
- Parameters:
e
- the key event- Returns:
true
if the key down was handled.- See Also:
-
handleKeyUp
Interprets and processes clone deactivation, constrained move deactivation, and accessibility navigation reset.- Overrides:
handleKeyUp
in classAbstractTool
- Parameters:
e
- the key event- Returns:
true
if the event was handled- See Also:
-
isCloneActive
protected boolean isCloneActive()Returns true if the current drag is a clone operation.- Returns:
- true if cloning is enabled and is currently active.
-
isMove
protected boolean isMove()Returnstrue
if the source edit part is being moved within its parent. If the source edit part is being moved to another parent, this returnsfalse
.- Returns:
true
if the source edit part is not being reparented
-
performDrag
protected void performDrag() -
repairStartLocation
protected void repairStartLocation()If auto scroll (also called auto expose) is being performed, the start location moves during the scroll. This method updates that location. -
setAutoexposeHelper
Description copied from class:TargetingTool
Sets the active autoexpose helper to the given helper, ornull
. If the helper is notnull
, a runnable is queued on the event thread that will trigger a subsequentTargetingTool.doAutoexpose()
. The helper is typically updated only on a hover event.- Overrides:
setAutoexposeHelper
in classTargetingTool
- Parameters:
helper
- the new autoexpose helper ornull
- See Also:
-
setCloneActive
protected void setCloneActive(boolean cloneActive) Enables cloning if the value is true.- Parameters:
cloneActive
-true
if cloning should be active
-
setTargetEditPart
Extended to update the current snap-to strategy.- Overrides:
setTargetEditPart
in classTargetingTool
- Parameters:
editpart
- the new target- See Also:
-
showSourceFeedback
protected void showSourceFeedback()Asks the edit parts in theoperation set
to show source feedback. -
setState
protected void setState(int state) Extended to activate cloning and to update the captured source dimensions when applicable.- Overrides:
setState
in classAbstractTool
- Parameters:
state
- the new state- See Also:
-
updateTargetRequest
protected void updateTargetRequest()CallsrepairStartLocation()
in case auto scroll is being performed. Updates the request with the currentoperation set
, move delta, location and type.- Overrides:
updateTargetRequest
in classTargetingTool
- See Also:
-
snapPoint
This method can be overridden by clients to customize the snapping behavior.- Parameters:
request
- theChangeBoundsRequest
from which the move delta can be extracted and updated- Since:
- 3.4
-