Package org.eclipse.gef.tools
Class SimpleDragTracker
java.lang.Object
org.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool
org.eclipse.gef.tools.SimpleDragTracker
- All Implemented Interfaces:
- DragTracker,- RequestConstants,- Tool
- Direct Known Subclasses:
- ConnectionBendpointTracker,- ResizeTracker
A simple drag tracker implementation that does not perform targeting. For
 example, resizing a shape or bendpoint does not involve any target editpart.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractToolAbstractTool.Input
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intThe maximum bit-mask used as a flag constant.Fields inherited from class org.eclipse.gef.tools.AbstractToolMAX_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_TERMINALFields inherited from interface org.eclipse.gef.RequestConstantsREQ_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected CursorReturns the appropriate cursor for the tools current state.voidAdded for compatibility.protected RequestCreates and returns a new Request that is used during the drag.voidDeactivates the tool.protected voidShow the source drag feedback for the drag occurring within the viewer.protected RequestReturns the request for the source of the drag, creating it if necessary.protected booleanhandleButtonDown(int button) Looks for button 1, and goes into the drag state.protected booleanhandleButtonUp(int button) If dragging is in progress, cleans up feedback and calls performDrag().protected booleanCalled whenever a mouse is being dragged and the drag threshold has been exceeded.protected booleanTransitions Drag to Drag in progress state.protected booleanCalled when the mouse and/or keyboard input is invalid.protected booleanLooks for keys which are used during accessible drags.protected booleanHandles high-level processing of a key up event.protected booleanReturnstrueif feedback is being shown.protected voidCalled once the drag has been interpreted.protected voidShow the source drag feedback for the drag occurring within the viewer.protected voidUpdates the source request.Methods inherited from class org.eclipse.gef.tools.AbstractToolacceptArrowKey, accGetStep, accStepIncrement, accStepReset, activate, addFeedback, applyProperty, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCommand, getCommandName, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugName, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDoubleClick, handleDrag, handleFinished, handleFocusGained, handleFocusLost, handleHover, handleKeyTraversed, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, handleViewerExited, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, placeMouseInViewer, reactivate, refreshCursor, releaseToolCapture, removeFeedback, resetFlags, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setState, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExitedMethods inherited from class org.eclipse.gef.util.FlagSupportgetFlag, setFlagMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.gef.Toolactivate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
- 
Field Details- 
MAX_FLAGprotected static final int MAX_FLAGThe maximum bit-mask used as a flag constant. Subclasses should start using the next highest bitmask.- See Also:
 
 
- 
- 
Constructor Details- 
SimpleDragTrackerprotected SimpleDragTracker()Null constructor.
 
- 
- 
Method Details- 
calculateCursorDescription copied from class:AbstractToolReturns the appropriate cursor for the tools current state. If the tool is in its terminal state,nullis returned. Otherwise, either the default or disabled cursor is returned, based on the existence of a current command, and whether that current command is executable.Subclasses may override or extend this method to calculate the appropriate cursor based on other conditions. - Overrides:
- calculateCursorin class- AbstractTool
- Returns:
- nullor a cursor to be displayed.
- See Also:
 
- 
commitDragpublic void commitDrag()Description copied from class:AbstractToolAdded for compatibility.DragTracker.commitDrag()was added for accessibility reasons. Since all tool implementations must inherit from this base class, then implementing this method here avoids breaking subclasses that implemented theDragTrackerinterface.- Specified by:
- commitDragin interface- DragTracker
- Overrides:
- commitDragin class- AbstractTool
- See Also:
 
- 
createSourceRequestCreates and returns a new Request that is used during the drag.- Returns:
- a new source request
 
- 
deactivatepublic void deactivate()Description copied from class:AbstractToolDeactivates the tool. This method is called whenever the user switches to another tool. Use this method to do some clean-up when the tool is switched. The abstract tool allows cursors for viewers to be changed. When the tool is deactivated it must revert to normal the cursor of the last tool it changed.- Specified by:
- deactivatein interface- Tool
- Overrides:
- deactivatein class- AbstractTool
- See Also:
 
- 
eraseSourceFeedbackprotected void eraseSourceFeedback()Show the source drag feedback for the drag occurring within the viewer.
- 
getSourceRequestReturns the request for the source of the drag, creating it if necessary.- Returns:
- the source request
 
- 
handleButtonDownprotected boolean handleButtonDown(int button) Looks for button 1, and goes into the drag state. Any other button is invalid input.- Overrides:
- handleButtonDownin class- AbstractTool
- Parameters:
- button- which button went down
- Returns:
- trueif the buttonDown was handled
- See Also:
 
- 
handleButtonUpprotected boolean handleButtonUp(int button) If dragging is in progress, cleans up feedback and calls performDrag().- Overrides:
- handleButtonUpin class- AbstractTool
- Parameters:
- button- the button being released
- Returns:
- trueif the button up was handled
- See Also:
 
- 
handleDragInProgressprotected boolean handleDragInProgress()Description copied from class:AbstractToolCalled whenever a mouse is being dragged and the drag threshold has been exceeded. Prior to the drag threshold being exceeded, onlyAbstractTool.handleDrag()is called. This method gets called repeatedly for every mouse move during the drag. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the drag. Returningtrueindicates that the drag was handled.- Overrides:
- handleDragInProgressin class- AbstractTool
- Returns:
- trueif the drag was handled
- See Also:
 
- 
handleDragStartedprotected boolean handleDragStarted()Transitions Drag to Drag in progress state.- Overrides:
- handleDragStartedin class- AbstractTool
- Returns:
- true if the drag starting was handled
- See Also:
 
- 
handleInvalidInputprotected boolean handleInvalidInput()Called when the mouse and/or keyboard input is invalid.- Overrides:
- handleInvalidInputin class- AbstractTool
- Returns:
- true
 
- 
handleKeyDownLooks for keys which are used during accessible drags.- Overrides:
- handleKeyDownin class- AbstractTool
- Parameters:
- e- the key event
- Returns:
- trueif the key down was handled.
- See Also:
 
- 
handleKeyUpDescription copied from class:AbstractToolHandles high-level processing of a key up event. By default, does nothing and returnsfalse. Subclasses may extend this method to process key up events. Returnstrueif the key up was processed in some way.- Overrides:
- handleKeyUpin class- AbstractTool
- Parameters:
- e- the key event
- Returns:
- trueif the event was handled
- See Also:
 
- 
isShowingFeedbackprotected boolean isShowingFeedback()Returnstrueif feedback is being shown.- Returns:
- trueif feedback is showing
 
- 
performDragprotected void performDrag()Called once the drag has been interpreted. This is where the real work of the drag is carried out. By default, the current command is executed.
- 
showSourceFeedbackprotected void showSourceFeedback()Show the source drag feedback for the drag occurring within the viewer.
- 
updateSourceRequestprotected void updateSourceRequest()Updates the source request.
 
-