Interface Tool
- All Known Subinterfaces:
- DragTracker
- All Known Implementing Classes:
- AbstractConnectionCreationTool,- AbstractTool,- ConnectionBendpointTracker,- ConnectionCreationTool,- ConnectionDragCreationTool,- ConnectionEndpointTracker,- CreationTool,- DeselectAllTracker,- DragEditPartsTracker,- DragTreeItemsTracker,- MarqueeDragTracker,- MarqueeSelectionTool,- PanningSelectionTool,- ResizeTracker,- SelectEditPartTracker,- SelectionTool,- SimpleDragTracker,- TargetingTool
Tool interprets Mouse and Keyboard input from an
 EditDomain and its EditPartViewers. The active
 Tool and its state determines how the EditDomain will interpret input. Input
 flows from a Viewer, to the EditDomain, to the EditDomain's active Tool.
 
 Tools process low-level events and turn them into higher-level
 operations. These operations are encapsulated by Requests.
 The Requests are then used to communicate with EditParts in the Viewer to
 perform the User's operation. Using Requests, Tools will:
 
- Ask EditParts for Commandsto perform changes on the model.
- Ask EditParts to show and erase feedback during an operation.
- Ask EditParts to perform a generic function, using
EditPart.performRequest(Request)
 
 Tools also perform operations that do not involve the EditParts directly,
 such as changing the Viewer's selection, scrolling the viewer, or invoking an
 Action.
 
|   | All feedback should be erased and temporary changes reverted prior to executing any command. | 
|   | Tools should process most keystrokes. For example, the DELETE key should
 not be handled by adding a KeyListener to the Viewer's Control.
 Doing so would mean that pressing DELETE would not be sensitive to
 which Tool is currently active, and the state of the Tool. See KeyHandlerfor how keystrokes are generally
 processed. | 
 IMPORTANT: This interface is not intended to be implemented by
 clients. Clients should inherit from
 AbstractTool. New methods may be added in the
 future.
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivate()Called when this tool becomes the active tool for the EditDomain.voidCalled when another Tool becomes the active tool for the EditDomain.voidfocusGained(FocusEvent event, EditPartViewer viewer) Called when a Viewer's Control gains keyboard focus.voidfocusLost(FocusEvent event, EditPartViewer viewer) Called when a Viewer's Control loses keyboard focus.voidkeyDown(KeyEvent keyEvent, EditPartViewer viewer) Called when a Viewer receives a key press.voidkeyTraversed(TraverseEvent event, EditPartViewer viewer) Called when a viewer receives a key traversal.voidkeyUp(KeyEvent keyEvent, EditPartViewer viewer) Called when a Viewer receives a key up.voidmouseDoubleClick(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a double-click.voidmouseDown(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse down.voidmouseDrag(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse drag.voidmouseHover(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse hover.voidmouseMove(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse move.voidmouseUp(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse up.voidmouseWheelScrolled(Event event, EditPartViewer viewer) Called when the mouse wheel has been scrolled.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.voidsetEditDomain(EditDomain domain) Called to set the EditDomain for this Tool.voidsetProperties(Map properties) This method can be invoked to set any properties of this tool.voidsetViewer(EditPartViewer viewer) Called to set the current Viewer receiving events.voidviewerEntered(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse enter.voidviewerExited(MouseEvent mouseEvent, EditPartViewer viewer) Called when a Viewer receives a mouse exit.
- 
Method Details- 
activatevoid activate()Called when this tool becomes the active tool for the EditDomain. implementors can perform any necessary initialization here.- See Also:
 
- 
deactivatevoid deactivate()Called when another Tool becomes the active tool for the EditDomain. implementors can perform state clean-up or to free resources.
- 
focusGainedCalled when a Viewer's Control gains keyboard focus.- Parameters:
- event- The SWT focus event
- viewer- The Viewer which gained focus
 
- 
focusLostCalled when a Viewer's Control loses keyboard focus.- Parameters:
- event- The SWT focus event
- viewer- The viewer that is losing focus
 
- 
keyDownCalled when a Viewer receives a key press.- Parameters:
- keyEvent- the SWT KeyEvent
- viewer- the Viewer which received a key press
 
- 
keyTraversedCalled when a viewer receives a key traversal. A tool can prevent the traversal from occuring by setting the doit field tofalse.- Parameters:
- event- the SWT event
- viewer- the viewer which received the traversal
- Since:
- 3.1
 
- 
keyUpCalled when a Viewer receives a key up.- Parameters:
- keyEvent- the SWT KeyEvent
- viewer- the Viewer which received a key up
 
- 
mouseDoubleClickCalled when a Viewer receives a double-click.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a double-click
 
- 
mouseDownCalled when a Viewer receives a mouse down.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse down
 
- 
mouseDragCalled when a Viewer receives a mouse drag. SWT does not distinguish between mouse drags and mouse moves, but GEF Viewers will make this distinction when dispatching events. A drag occurs if any mouse button is down.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a drag
 
- 
mouseHoverCalled when a Viewer receives a mouse hover.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse down
- See Also:
 
- 
mouseMoveCalled when a Viewer receives a mouse move.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse move
- See Also:
 
- 
mouseUpCalled when a Viewer receives a mouse up.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse up
 
- 
mouseWheelScrolledCalled when the mouse wheel has been scrolled.- Parameters:
- event- The SWT event
- viewer- The source of the event
 
- 
nativeDragFinishedCalled 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.- Parameters:
- event- the SWT DragSourceEvent
- viewer- the Viewer on which a native drag started
 
- 
nativeDragStartedCalled 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.- Parameters:
- event- the SWT DragSourceEvent
- viewer- the Viewer on which a native drag started
 
- 
setEditDomainCalled to set the EditDomain for this Tool. This is called right beforeactivate().- Parameters:
- domain- The EditDomain to which this Tool belongs
 
- 
setViewerCalled to set the current Viewer receiving events. This method is rarely called, since the Viewer is always passed along with the events themselves. This method really just applies toDragTrackers.- Parameters:
- viewer- The current Viewer
 
- 
viewerEnteredCalled when a Viewer receives a mouse enter.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse enter
 
- 
viewerExitedCalled when a Viewer receives a mouse exit.- Parameters:
- mouseEvent- the SWT mouse event
- viewer- the Viewer which received a mouse exit
 
- 
setPropertiesThis method can be invoked to set any properties of this tool. This allows clients who do not have direct access to a Tool to still be able to configure that tool. The given Map should have the property's key and value. This method will ignore unrecognized keys and values that are not of the expected type.This method should only be invoked once when the tool is first constructed and is being initialized. Invoking this method at other times may have undesired effects. - Parameters:
- properties- a mapping of the properties to be set and their new values; can be- null
- Since:
- 3.1
 
 
-