Class AbstractTool
- All Implemented Interfaces:
- RequestConstants,- Tool
- Direct Known Subclasses:
- MarqueeSelectionTool,- SimpleDragTracker,- TargetingTool
Tools. The base implementation provides a
 framework for a state machine which processes mouse and keyboard
 input. The state machine consists of a series of states identified by
 ints. Each mouse or keyboard event results in a transition,
 sometimes to the same state in which the input was received. The interesting
 transitions have corresponding actions assigned to them, such as
 handleDragStarted().
 The base implementation performs no state transitions by default, but does route events to different method handlers based on state. It is up to subclasses to set the appropriate states.
 There are two broad "categories" of methods on AbstractTool. There are the
 methods defined on the Tool interface which handle the job of
 receiving raw user input. For example,
 mouseDrag(MouseEvent, EditPartViewer). Then, there are the methods
 which correspond to higher-level interpretation of these events, such as
 handleDragInProgress(), which is called from
 mouseMove(...), but only when the drag threshold has
 been passed. These methods are generally more subclass-friendly. Subclasses
 should not override the methods which receive raw input.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAllows the user to access mouse and keyboard input.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intThe highest-bit flag being used.protected static final intThe maximum state flag defined by this classprotected static final intDeprecated.protected static final intDeprecated.UseSWT.BUTTON1instead.protected static final intDeprecated.UseSWT.BUTTON2instead.protected static final intDeprecated.UseSWT.BUTTON3instead.static final ObjectThe property to be used insetProperties(Map)forsetUnloadWhenFinished(boolean)protected static final intThe state indicating that the keyboard is being used to perform a drag that is normally done using the mouse.protected static final intThe state indicating that a keyboard drag is in progress.protected static final intThe state indicating that one or more buttons are pressed, but the user has not moved past the drag threshold.protected static final intThe state indicating that the drag detection theshold has been passed, and a drag is in progress.protected static final intThe first state that a tool is in.protected static final intThe state indicating that an input event has invalidated the interaction.protected static final intThe final state for a tool to be in.Fields 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 booleanReturns true if the event corresponds to an arrow key with the appropriate modifiers and if the system is in a state where the arrow key should be accepted.protected intReturn the accessible step.protected voidIncrement the accessible step.protected voidReset the accessible step.voidactivate()Activates the tool.protected voidaddFeedback(IFigure figure) Convenience method to add the given figure to the feedback layer.protected voidapplyProperty(Object key, Object value) This method is invoked fromsetProperties(Map).protected CursorReturns the appropriate cursor for the tools current state.voidAdded for compatibility.Returns a new List of editparts that this tool is operating on.voidDeactivates the tool.protected voidDeprecated.protected voidexecuteCommand(Command command) Executes the given command on the command stack.protected voidExecute the currently active command.voidfocusGained(FocusEvent event, EditPartViewer viewer) Called when a viewer that the editor controls gains focus.voidfocusLost(FocusEvent event, EditPartViewer viewer) Called when a viewer that the editor controls loses focus.protected CommandReturns a new, updated command based on the tool's current properties.protected abstract StringReturns the identifier of the command that is being sought.protected CommandReturns the currently cached command.protected AbstractTool.InputReturns the input object encapsulating the current mouse and keyboard state.protected EditPartViewerReturn the viewer that the tool is currently receiving input from, ornull.protected StringReturns the debug name for this tool.protected StringgetDebugNameForState(int state) Returns a String representation of the given state for debug purposes.protected CursorReturns the cursor used under normal conditions.protected CursorReturns the cursor used under abnormal conditions.protected EditDomainReturns the EditDomain.protected DimensionReturn the number of pixels that the mouse has been moved since that drag was started.protected PointReturns the current x, y position of the mouse cursor.Lazily creates and returns the list of editparts on which the tool operates.protected PointReturns the starting mouse location for the current tool operation.protected intgetState()Returns the tool's current state.protected booleanhandleButtonDown(int button) Called when the mouse button has been pressed.protected booleanhandleButtonUp(int button) Called when the mouse button has been released.protected booleanCalled when the command stack has changed, for instance, when a delete or undo command has been executed.protected booleanhandleDoubleClick(int button) Called when a mouse double-click occurs.protected booleanCalled whenever the mouse is being dragged.protected booleanCalled whenever a mouse is being dragged and the drag threshold has been exceeded.protected booleanCalled only one time during a drag when the drag threshold has been exceeded.protected voidCalled when the current tool operation is to be completed.protected booleanHandles high-level processing of a focus gained event.protected booleanHandles high-level processing of a focus lost event.protected booleanHandles high-level processing of a mouse hover event.protected booleanCalled when invalid input is encountered.protected booleanHandles high-level processing of a key down event.protected voidhandleKeyTraversed(TraverseEvent event) Override to process a traverse event.protected booleanHandles high-level processing of a key up event.protected booleanHandles high-level processing of a mouse move.protected booleanHandles when a native drag has ended.protected booleanHandles when a native drag has started.protected booleanCalled when the mouse enters an EditPartViewer.protected booleanCalled when the mouse exits an EditPartViewer.protected booleanisActive()Returnstrueif the tool is active.protected booleanReturnstrueif the tool is hovering.protected booleanisInState(int state) Returnstrueif the tool is in the given state.protected booleanisViewerImportant(EditPartViewer viewer) Default implementation always returnstrue.voidkeyDown(KeyEvent evt, EditPartViewer viewer) Receives a KeyDown event for the given viewer.voidkeyTraversed(TraverseEvent event, EditPartViewer viewer) Receives a traversal event for the given viewer.voidkeyUp(KeyEvent evt, EditPartViewer viewer) Receives a KeyUp event for the given viewer.voidmouseDoubleClick(MouseEvent me, EditPartViewer viewer) Handles mouse double click events within a viewer.voidmouseDown(MouseEvent me, EditPartViewer viewer) Handles mouse down events within a viewer.voidmouseDrag(MouseEvent me, EditPartViewer viewer) Handles mouse drag events within a viewer.voidmouseHover(MouseEvent me, EditPartViewer viewer) Handles mouse hover event. within a viewer.voidmouseMove(MouseEvent me, EditPartViewer viewer) Handles mouse moves (if the mouse button is up) within a viewer.voidmouseUp(MouseEvent me, EditPartViewer viewer) Handles mouse up within a viewer.voidmouseWheelScrolled(Event event, EditPartViewer viewer) Handles mouse-wheel scrolling for a viewer.protected booleanReturnstrueif the threshold has been exceeded during a mouse drag.voidnativeDragFinished(DragSourceEvent event, EditPartViewer viewer) Called when a native drag ends on a Viewer.voidnativeDragStarted(DragSourceEvent event, EditPartViewer viewer) Called when a native drag begins on a Viewer.protected voidperformViewerMouseWheel(Event event, EditPartViewer viewer) Delegates mouse-wheel event handling to registeredMouseWheelHandlersbased on the given Event's statemask.protected voidPlaces the mouse in the viewer based on the point given.protected voidCallsdeactivate()and thenactivate().protected voidSets the cursor being displayed to the appropriate cursor.protected voidReleases tool capture.protected voidremoveFeedback(IFigure figure) Convenience method to removes a figure from the feedback layer.protected voidResets all stateful flags to their initial values.protected voidUsed to cache a command obtained fromgetCommand().protected voidShows the given cursor on the current viewer.voidsetDefaultCursor(Cursor cursor) Sets the default cursor.voidsetDisabledCursor(Cursor cursor) Sets the disabled cursor.voidsetEditDomain(EditDomain domain) Sets the EditDomain.protected voidsetHoverActive(boolean value) Sets whether the hover flag is true or false.voidsetProperties(Map properties) An example isPROPERTY_UNLOAD_WHEN_FINISHED-> Boolean.protected voidSets the start mouse location, typically for a drag operation.protected voidsetState(int state) Sets the tools state.protected voidSets tool capture.voidsetUnloadWhenFinished(boolean value) Setting this totruewill cause the tool to be unloaded after one operation has completed.voidsetViewer(EditPartViewer viewer) Sets the active EditPartViewer.protected booleanstateTransition(int start, int end) Returnstrueif the give state transition succeeds.protected final booleanReturnstrueif the tool is set to unload when its current operation is complete.voidviewerEntered(MouseEvent me, EditPartViewer viewer) Receives the mouse entered event.voidviewerExited(MouseEvent me, EditPartViewer viewer) Handles the mouse exited event.Methods inherited from class org.eclipse.gef.util.FlagSupportgetFlag, setFlag
- 
Field Details- 
PROPERTY_UNLOAD_WHEN_FINISHEDThe property to be used insetProperties(Map)forsetUnloadWhenFinished(boolean)
- 
MAX_FLAGprotected static final int MAX_FLAGThe highest-bit flag being used.- See Also:
 
- 
MAX_STATEprotected static final int MAX_STATEThe maximum state flag defined by this class- See Also:
 
- 
MOUSE_BUTTON1Deprecated.UseSWT.BUTTON1instead.constant used for mouse button 1.- See Also:
 
- 
MOUSE_BUTTON2Deprecated.UseSWT.BUTTON2instead.constant used for mouse button 2.- See Also:
 
- 
MOUSE_BUTTON3Deprecated.UseSWT.BUTTON3instead.constant used for mouse button 3.- See Also:
 
- 
MOUSE_BUTTON_ANYDeprecated.UseSWT.BUTTON_MASKinstead.constant used to indicate any of the mouse buttons.
- 
STATE_ACCESSIBLE_DRAGprotected static final int STATE_ACCESSIBLE_DRAGThe state indicating that the keyboard is being used to perform a drag that is normally done using the mouse.- See Also:
 
- 
STATE_ACCESSIBLE_DRAG_IN_PROGRESSprotected static final int STATE_ACCESSIBLE_DRAG_IN_PROGRESSThe state indicating that a keyboard drag is in progress. The threshold for keyboard drags is non-existent, so this state would be entered very quickly.- See Also:
 
- 
STATE_DRAGprotected static final int STATE_DRAGThe state indicating that one or more buttons are pressed, but the user has not moved past the drag threshold. Many tools will do nothing during this state but wait untilSTATE_DRAG_IN_PROGRESSis entered.- See Also:
 
- 
STATE_DRAG_IN_PROGRESSprotected static final int STATE_DRAG_IN_PROGRESSThe state indicating that the drag detection theshold has been passed, and a drag is in progress.- See Also:
 
- 
STATE_INITIALprotected static final int STATE_INITIALThe first state that a tool is in. The tool will generally be in this state immediately followingactivate().- See Also:
 
- 
STATE_INVALIDprotected static final int STATE_INVALIDThe state indicating that an input event has invalidated the interaction. For example, during a mouse drag, pressing additional mouse button might invalidate the drag.- See Also:
 
- 
STATE_TERMINALprotected static final int STATE_TERMINALThe final state for a tool to be in. Once a tool reaches this state, it will not change states until it is activated() again.- See Also:
 
 
- 
- 
Constructor Details- 
AbstractToolpublic AbstractTool()
 
- 
- 
Method Details- 
acceptArrowKeyReturns true if the event corresponds to an arrow key with the appropriate modifiers and if the system is in a state where the arrow key should be accepted.- Parameters:
- e- the key event
- Returns:
- true if the arrow key should be accepted by this tool
- Since:
- 3.4
 
- 
accGetStepprotected int accGetStep()Return the accessible step.- Returns:
- The accessible step.
- Since:
- 3.18
 
- 
accStepIncrementprotected void accStepIncrement()Increment the accessible step.- Since:
- 3.18
 
- 
accStepResetprotected void accStepReset()Reset the accessible step.- Since:
- 3.18
 
- 
activatepublic void activate()Activates the tool. Any initialization should be performed here. This method is called when a tool is selected.
- 
addFeedbackConvenience method to add the given figure to the feedback layer.- Parameters:
- figure- the feedback being added
 
- 
applyPropertyThis method is invoked fromsetProperties(Map). Sub-classes can override to add support for more properties. This method should fail silently in case of any error.AbstractTool uses introspection to match any keys with properties. For instance, the key "defaultCursor" would lead to the invocation of setDefaultCursor(Cursor)with the provided value.- Parameters:
- key- the key; may be- null
- value- the new value
- Since:
- 3.1
- See Also:
 
- 
calculateCursorReturns 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. - Returns:
- nullor a cursor to be displayed.
- See Also:
 
- 
commitDragpublic void commitDrag()Added 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.
- 
createOperationSetReturns a new List of editparts that this tool is operating on. This method is called once duringgetOperationSet(), and its result is cached.By default, the operations set is the current viewer's entire selection. Subclasses may override this method to filter or alter the operation set as necessary. - Returns:
- a list of editparts being operated on
 
- 
deactivatepublic void deactivate()Deactivates 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
- See Also:
 
- 
debugDeprecated.Prints a string in the GEF Debug console if the Tools debug option is selected.- Parameters:
- message- a message for the debug trace tool
 
- 
executeCommandExecutes the given command on the command stack.- Parameters:
- command- the command to execute
- Since:
- 3.1
 
- 
executeCurrentCommandprotected void executeCurrentCommand()Execute the currently active command.
- 
focusGainedCalled when a viewer that the editor controls gains focus.- Specified by:
- focusGainedin interface- Tool
- Parameters:
- event- The SWT focus event
- viewer- The viewer that the focus event is over.
 
- 
focusLostCalled when a viewer that the editor controls loses focus.
- 
getCommandReturns a new, updated command based on the tool's current properties. The default implementation returns an unexecutable command. Some tools do not work commands and the model, but simply change the viewer's state in some way.- Returns:
- a newly obtained command
 
- 
getCommandNameReturns the identifier of the command that is being sought. This name is also the named that will be logged in the debug view.- Returns:
- the identifier for the command
 
- 
getCurrentCommandReturns the currently cached command.- Returns:
- the current command
- See Also:
 
- 
getCurrentInputReturns the input object encapsulating the current mouse and keyboard state.- Returns:
- the current input
 
- 
getCurrentViewerReturn the viewer that the tool is currently receiving input from, ornull. The last viewer to dispatch an event is defined as the current viewer. Current viewer is automatically updated as events are received, and is set tonullondeactivate().- Returns:
- the current viewer
 
- 
getDebugNameReturns the debug name for this tool.- Returns:
- the debug name
 
- 
getDebugNameForStateReturns a String representation of the given state for debug purposes.- Parameters:
- state- the state
- Returns:
- the string for the given state
 
- 
getDefaultCursorReturns the cursor used under normal conditions.- Returns:
- the default cursor
- See Also:
 
- 
getDisabledCursorReturns the cursor used under abnormal conditions.- Returns:
- the disabled cursor
- See Also:
 
- 
getDomainReturns the EditDomain. A tool is told its EditDomain when it becomes active. A tool may need to know its edit domain prior to receiving any events from any of that domain's viewers.- Returns:
- the editdomain
 
- 
getDragMoveDeltaReturn the number of pixels that the mouse has been moved since that drag was started. The drag start is determined by where the mouse button was first pressed.- Returns:
- the drag delta
- See Also:
 
- 
getLocationReturns the current x, y position of the mouse cursor.- Returns:
- the mouse location
 
- 
getOperationSetLazily creates and returns the list of editparts on which the tool operates. The list is initiallynull, in which casecreateOperationSet()is called, and its results cached until the tool is deactivated.- Returns:
- the operation set.
 
- 
getStartLocationReturns the starting mouse location for the current tool operation. This is typically the mouse location where the user first pressed a mouse button. This is important for tools that interpret mouse drags.- Returns:
- the start location
 
- 
getStateprotected int getState()Returns the tool's current state.- Returns:
- the current state
 
- 
handleButtonDownprotected boolean handleButtonDown(int button) Called when the mouse button has been pressed. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the meaning of a mouse down. Returningtrueindicates that the button down was handled in some way.- Parameters:
- button- which button went down
- Returns:
- trueif the buttonDown was handled
 
- 
handleButtonUpprotected boolean handleButtonUp(int button) Called when the mouse button has been released. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the mouse up. Returningtrueindicates that the mouse up was handled in some way.- Parameters:
- button- the button being released
- Returns:
- trueif the button up was handled
- See Also:
 
- 
handleCommandStackChangedprotected boolean handleCommandStackChanged()Called when the command stack has changed, for instance, when a delete or undo command has been executed. By default, state is set toSTATE_INVALIDand handleInvalidInput is called. Subclasses may override this method to change what happens when the command stack changes. Returningtrueindicates that the change was handled in some way.- Returns:
- trueif the change was handled in some way
 
- 
handleDoubleClickprotected boolean handleDoubleClick(int button) Called when a mouse double-click occurs. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret double-clicks. Returningtrueindicates that the event was handled in some way.- Parameters:
- button- which button was double-clicked
- Returns:
- trueif the event was handled
- See Also:
 
- 
handleDragprotected boolean handleDrag()Called whenever the mouse is being dragged. This method continues to be called even oncehandleDragInProgress()starts getting called. By default, nothing happens, andfalseis returned. Subclasses may override this method to interpret a drag. Returningtrueindicates that the drag was handled in some way.- Returns:
- trueif the drag is handled
- See Also:
 
- 
handleDragInProgressprotected boolean handleDragInProgress()Called whenever a mouse is being dragged and the drag threshold has been exceeded. Prior to the drag threshold being exceeded, onlyhandleDrag()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.- Returns:
- trueif the drag was handled
- See Also:
 
- 
handleDragStartedprotected boolean handleDragStarted()Called only one time during a drag when the drag threshold has been exceeded. By default, nothing happens andfalseis returned. Subclasses may override to interpret the drag starting. Returningtrueindicates that the event was handled.- Returns:
- true if the drag starting was handled
- See Also:
 
- 
handleFinishedprotected void handleFinished()Called when the current tool operation is to be completed. In other words, the "state machine" and has accepted the sequence of input (i.e. the mouse gesture). By default, the tool will either reactivate itself, or ask the edit domain to load the default tool.Subclasses should extend this method to first do whatever it is that the tool does, and then call super.- See Also:
 
- 
handleFocusGainedprotected boolean handleFocusGained()Handles high-level processing of a focus gained event. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the focus gained event. Returntrueto indicate that the event was processed.- Returns:
- trueif the event was handled
- See Also:
 
- 
handleFocusLostprotected boolean handleFocusLost()Handles high-level processing of a focus lost event. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the focus lost event. Returntrueto indicate that the event was processed.- Returns:
- trueif the event was handled
- See Also:
 
- 
handleHoverprotected boolean handleHover()Handles high-level processing of a mouse hover event. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the hover. Returntrueto indicate that the hover was handled.- Returns:
- trueif the hover was handled
- See Also:
 
- 
handleInvalidInputprotected boolean handleInvalidInput()Called when invalid input is encountered. The state does not change, so the caller must set the state toSTATE_INVALID.- Returns:
- true
 
- 
handleKeyDownHandles high-level processing of a key down event. By default, the KeyEvent is checked to see if it is the ESCAPE key. If so, the domain's default tool is reloaded, andtrueis returned. Subclasses may extend this method to interpret additional key down events. Returnstrueif the given key down was handled.- Parameters:
- e- the key event
- Returns:
- trueif the key down was handled.
- See Also:
 
- 
handleKeyTraversedOverride to process a traverse event. If the event'sdoitfield is set tofalse, the traversal will be prevented from occurring. Otherwise, a traverse will occur.- Parameters:
- event- the SWT traverse event
- Since:
- 3.1
 
- 
handleKeyUpHandles 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.- Parameters:
- e- the key event
- Returns:
- trueif the event was handled
- See Also:
 
- 
handleMoveprotected boolean handleMove()Handles high-level processing of a mouse move. By default, does nothing and returnsfalse. Subclasses may extend this method to process mouse moves. Returnstrueif the mouse move was processed.- Returns:
- trueif the mouse move was handled
- See Also:
 
- 
handleNativeDragFinishedHandles when a native drag has ended. By default, does nothing and returnsfalse. Subclasses may extend this method to process native drags ending.- Parameters:
- event- the drag event
- Returns:
- trueif the native drag finished was handled
 
- 
handleNativeDragStartedHandles when a native drag has started. By default, does nothing and returnsfalse. Subclasses may extend this method to process native drag starts.When a native drag starts, all subsequent mouse events will not be received, including the mouseUp event. The only event that will be received is the drag finished event. - Parameters:
- event- the drag event
- Returns:
- trueif the native drag start was handled
 
- 
handleViewerEnteredprotected boolean handleViewerEntered()Called when the mouse enters an EditPartViewer. By default, does nothing and returnsfalse. Subclasses may extend this method to process the viewer enter. Returnstrueto indicate if the viewer entered was process in some way.- Returns:
- trueif the viewer entered was handled
 
- 
handleViewerExitedprotected boolean handleViewerExited()Called when the mouse exits an EditPartViewer. By default, does nothing and returnsfalse. Subclasses may extend this method to process viewer exits. Returnstrueto indicate if the viewer exited was process in some way.- Returns:
- trueif the viewer exited was handled
 
- 
isActiveprotected boolean isActive()Returnstrueif the tool is active.- Returns:
- trueif active
 
- 
isHoverActiveprotected boolean isHoverActive()Returnstrueif the tool is hovering.- Returns:
- trueif hovering
 
- 
isInStateprotected boolean isInState(int state) Returnstrueif the tool is in the given state.- Parameters:
- state- the state being queried
- Returns:
- trueif the tool is in the given state
 
- 
isViewerImportantDefault implementation always returnstrue. Sub-classes may override.- Parameters:
- viewer- the viewer where the event occured
- Returns:
- trueif this tool is interested in events occuring in the given viewer;- falseotherwise
- Since:
- 3.1
 
- 
keyDownReceives a KeyDown event for the given viewer. Subclasses wanting to handle this event should overridehandleKeyDown(KeyEvent).
- 
keyTraversedReceives a traversal event for the given viewer. Subclasses wanting to handle this event should overridehandleKeyTraversed(TraverseEvent).- Specified by:
- keyTraversedin interface- Tool
- Parameters:
- event- the traverse event
- viewer- the originating viewer
 
- 
keyUpReceives a KeyUp event for the given viewer. Subclasses wanting to handle this event should overridehandleKeyUp(KeyEvent).
- 
mouseDoubleClickHandles mouse double click events within a viewer. Subclasses wanting to handle this event should overridehandleDoubleClick(int).- Specified by:
- mouseDoubleClickin interface- Tool
- Parameters:
- me- the mouse event
- viewer- the originating viewer
 
- 
mouseDownHandles mouse down events within a viewer. Subclasses wanting to handle this event should overridehandleButtonDown(int).
- 
mouseDragHandles mouse drag events within a viewer. Subclasses wanting to handle this event should overridehandleDrag()and/orhandleDragInProgress().
- 
mouseHoverHandles mouse hover event. within a viewer. Subclasses wanting to handle this event should overridehandleHover().- Specified by:
- mouseHoverin interface- Tool
- Parameters:
- me- the mouse event
- viewer- the originating viewer
- See Also:
 
- 
mouseMoveHandles mouse moves (if the mouse button is up) within a viewer. Subclasses wanting to handle this event should overridehandleMove().
- 
mouseUpHandles mouse up within a viewer. Subclasses wanting to handle this event should overridehandleButtonUp(int).
- 
mouseWheelScrolledHandles mouse-wheel scrolling for a viewer. Sub-classes may override as needed. The default implementation delegates toperformViewerMouseWheel(Event, EditPartViewer)IFF the tool is in the initial state. Mouse-wheel events generated at other times are ignored.- Specified by:
- mouseWheelScrolledin interface- Tool
- Parameters:
- event- the SWT scroll event
- viewer- the originating viewer
- See Also:
 
- 
movedPastThresholdprotected boolean movedPastThreshold()Returnstrueif the threshold has been exceeded during a mouse drag.- Returns:
- trueif the threshold has been exceeded
 
- 
nativeDragFinishedDescription copied from interface:ToolCalled when a native drag ends on a Viewer. This event is important to Tools becausemouseUp(..)will not occur once a native drag has started. The Tool should correct its state to handle this lost Event.- Specified by:
- nativeDragFinishedin interface- Tool
- Parameters:
- event- the SWT DragSourceEvent
- viewer- the Viewer on which a native drag started
- See Also:
 
- 
nativeDragStartedDescription copied from interface:ToolCalled when a native drag begins on a Viewer. This event is important to Tools becausemouseUp(..)will not occur once a native drag has started. The Tool should correct its state to handle this lost Event.- Specified by:
- nativeDragStartedin interface- Tool
- Parameters:
- event- the SWT DragSourceEvent
- viewer- the Viewer on which a native drag started
- See Also:
 
- 
performViewerMouseWheelDelegates mouse-wheel event handling to registeredMouseWheelHandlersbased on the given Event's statemask. Does nothing if there are no matching handlers found.- Parameters:
- event- the SWT scroll event
- viewer- the originating viewer
- Since:
- 3.1
 
- 
placeMouseInViewerPlaces the mouse in the viewer based on the point given. If the point given is outside the viewer, then the mouse is placed in the location nearest the given point but within the viewer.- Parameters:
- p- the point
- Since:
- 3.4
 
- 
reactivateprotected void reactivate()Callsdeactivate()and thenactivate().
- 
refreshCursorprotected void refreshCursor()Sets the cursor being displayed to the appropriate cursor. If the tool is active, the current cursor being displayed is updated by callingcalculateCursor().
- 
releaseToolCaptureprotected void releaseToolCapture()Releases tool capture.- See Also:
 
- 
removeFeedbackConvenience method to removes a figure from the feedback layer.- Parameters:
- figure- the figure being removed
 
- 
resetFlagsprotected void resetFlags()Resets all stateful flags to their initial values. Subclasses should extend this method to reset their own custom flags.
- 
setCurrentCommandUsed to cache a command obtained fromgetCommand().- Parameters:
- c- the command
- See Also:
 
- 
setCursorShows the given cursor on the current viewer.- Parameters:
- cursor- the cursor to display
 
- 
setDefaultCursorSets the default cursor.- Parameters:
- cursor- the cursor
- See Also:
 
- 
setDisabledCursorSets the disabled cursor.- Parameters:
- cursor- the cursor
- See Also:
 
- 
setEditDomainSets the EditDomain.- Specified by:
- setEditDomainin interface- Tool
- Parameters:
- domain- the edit domain
- See Also:
 
- 
setHoverActiveprotected void setHoverActive(boolean value) Sets whether the hover flag is true or false. Subclasses which do something on hover can use this flag to track whether they have received a hover or not.- Parameters:
- value- whether hover is active
 
- 
setPropertiesAn example isPROPERTY_UNLOAD_WHEN_FINISHED-> Boolean. AbstractTool uses introspection to set properties that are not explicitly specified. For instance, the key "defaultCursor" will causesetDefaultCursor(Cursor)to be invoked with the given value.- Specified by:
- setPropertiesin interface- Tool
- Parameters:
- properties- a mapping of the properties to be set and their new values; can be- null
- See Also:
 
- 
setStartLocationSets the start mouse location, typically for a drag operation.- Parameters:
- p- the start location
 
- 
setStateprotected void setState(int state) Sets the tools state.- Parameters:
- state- the new state
 
- 
setToolCaptureprotected void setToolCapture()Sets tool capture. When a tool has capture, viewers will make every effort to send events through the editdomain to the tool. Therefore, the default handling of some events is bypassed.
- 
setUnloadWhenFinishedpublic void setUnloadWhenFinished(boolean value) Setting this totruewill cause the tool to be unloaded after one operation has completed. The default value istrue. The tool is unloaded, and the edit domains default tool will be activated.- Parameters:
- value- whether the tool should be unloaded on completion
 
- 
setViewerSets the active EditPartViewer. The active viewer is the viewer from which the last event was received.
- 
stateTransitionprotected boolean stateTransition(int start, int end) Returnstrueif the give state transition succeeds. This is a "test and set" operation, where the tool is tested to be in the specified start state, and if so, is set to the given end state. The method returns the result of the first test.- Parameters:
- start- the start state being tested
- end- the end state
- Returns:
- trueif the state transition is successful
 
- 
unloadWhenFinishedprotected final boolean unloadWhenFinished()Returnstrueif the tool is set to unload when its current operation is complete.- Returns:
- trueif the tool should be unloaded when finished
 
- 
viewerEnteredReceives the mouse entered event. Subclasses wanting to handle this event should overridehandleViewerEntered().FEATURE in SWT: mouseExit comes after mouseEntered on the new control. Therefore, if the current viewer is not null, it means the exit has not been sent yet by SWT. To maintain proper ordering, GEF fakes the exit and callshandleViewerExited(). The real exit will then be ignored.- Specified by:
- viewerEnteredin interface- Tool
- Parameters:
- me- the mouse event
- viewer- the originating viewer
 
- 
viewerExitedHandles the mouse exited event. Subclasses wanting to handle this event should overridehandleViewerExited().- Specified by:
- viewerExitedin interface- Tool
- Parameters:
- me- the mouse event
- viewer- the originating viewer
 
 
- 
SWT.BUTTON_MASKinstead.