public class SelectionTool extends TargetingTool
AbstractTool.Input| Modifier and Type | Field and Description |
|---|---|
protected static int |
MAX_FLAG
Max flag
|
protected static int |
MAX_STATE
Max state
|
protected static int |
STATE_TRAVERSE_HANDLE
Traverse handle 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_TERMINALREQ_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 |
|---|
SelectionTool()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
createHoverRequest()
Creates the hover request (a
LocationRequest) and sets its type
to RequestConstants.REQ_SELECTION_HOVER. |
protected Request |
createTargetRequest()
Creates a
SelectionRequest for the target request. |
void |
deactivate()
Deactivates the tool.
|
protected void |
eraseHoverFeedback()
Erases the hover feedback by calling
EditPart.eraseTargetFeedback(Request). |
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 java.lang.String |
getDebugNameForState(int state)
Returns a String representation of the given state for debug purposes.
|
protected DragTracker |
getDragTracker()
Returns the current drag tracker.
|
protected Request |
getTargetHoverRequest()
Returns the target hover request.
|
protected EditPartViewer.Conditional |
getTargetingConditional()
Returns a new Conditional that evaluates to
true if the
queried edit part's EditPart.isSelectable() method returns
true. |
protected boolean |
handleButtonDown(int button)
If there is a
Handle under the mouse, this method sets the drag
tracker returned from the handle. |
protected boolean |
handleButtonUp(int button)
Resets this tool when the last button is released.
|
protected boolean |
handleCommandStackChanged()
Called when the command stack has changed, for instance, when a delete or
undo command has been executed.
|
protected boolean |
handleFocusLost()
Sets the drag tracker to
null and goes into the initial
state when focus is lost. |
protected boolean |
handleHover()
Called when the mouse hovers.
|
protected boolean |
handleHoverStop()
Called when the mouse hover stops (i.e. the mouse moves or a button is
clicked).
|
protected boolean |
handleKeyDown(KeyEvent e)
Processes key down events.
|
protected boolean |
handleKeyUp(KeyEvent e)
If in the initial state and the viewer has a
KeyHandler, calls
KeyHandler.keyReleased(KeyEvent) sending it the given key event. |
protected boolean |
handleMove()
If in the initial state, updates the request and the mouse target and
asks to show target feedback.
|
boolean |
handleNativeDragFinished(DragSourceEvent event)
If there's a drag tracker, calls handleNativeDragFinished() on the drag
tracker and then sets the drag tracker to
null. |
boolean |
handleNativeDragStarted(DragSourceEvent event)
If there's a drag tracker, calls nativeDragStarted() on the drag tracker.
|
protected boolean |
handleViewerExited()
If there's a drag tracker, sets it to
null and then sets
this tool's state to the initial state. |
void |
keyDown(KeyEvent evt,
EditPartViewer viewer)
Forwards the key down event to the drag tracker, if one exists.
|
void |
keyUp(KeyEvent evt,
EditPartViewer viewer)
Forwards the key up event to the drag tracker, if one exists.
|
void |
mouseDoubleClick(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse double clicked event to the drag tracker, if one
exists.
|
void |
mouseDown(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse down event to the drag tracker, if one exists.
|
void |
mouseDrag(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse drag event to the drag tracker, if one exists.
|
void |
mouseHover(MouseEvent me,
EditPartViewer viewer)
Forwards the mouse hover event to the drag tracker, if one exists.
|
void |
mouseMove(MouseEvent me,
EditPartViewer viewer)
Forwards the mouse move event to the drag tracker, if one exists.
|
void |
mouseUp(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse up event to the drag tracker, if one exists.
|
void |
mouseWheelScrolled(Event event,
EditPartViewer viewer)
Delegates the scrolling to the DragTracker (if there is one).
|
protected void |
refreshCursor()
If there is a drag tracker, this method does nothing so that the drag
tracker can take care of the cursor.
|
void |
setDragTracker(DragTracker newDragTracker)
Sets the drag tracker for this SelectionTool.
|
protected void |
showHoverFeedback()
Asks the target edit part (if there is one) to show hover feedback via
EditPart.showTargetFeedback(Request) with a hover request. |
protected void |
updateHoverRequest()
Updates the location of the hover request.
|
protected void |
updateTargetRequest()
Sets the modifiers , type and location of the target request (which is a
SelectionRequest) and then calls updateHoverRequest(). |
doAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getCommand, getExclusionSet, getTargetEditPart, getTargetRequest, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleInvalidInput, handleLeavingEditPart, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetFlags, resetHover, setAutoexposeHelper, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouseacceptArrowKey, activate, addFeedback, applyProperty, calculateCursor, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleDoubleClick, handleDrag, handleDragInProgress, handleDragStarted, handleFinished, handleFocusGained, handleKeyTraversed, handleViewerEntered, isActive, isHoverActive, isInState, isViewerImportant, keyTraversed, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, placeMouseInViewer, reactivate, releaseToolCapture, removeFeedback, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setState, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExitedgetFlag, setFlagprotected static final int MAX_FLAG
protected static final int STATE_TRAVERSE_HANDLE
protected static final int MAX_STATE
protected void createHoverRequest()
LocationRequest) and sets its type
to RequestConstants.REQ_SELECTION_HOVER.protected Request createTargetRequest()
SelectionRequest for the target request.createTargetRequest in class TargetingToolTargetingTool.createTargetRequest()public void deactivate()
null.deactivate in interface Tooldeactivate in class TargetingToolTool.deactivate()protected void eraseHoverFeedback()
EditPart.eraseTargetFeedback(Request).protected java.lang.String getCommandName()
AbstractToolgetCommandName in class AbstractToolAbstractTool.getCommandName()protected java.lang.String getDebugName()
AbstractToolgetDebugName in class AbstractToolAbstractTool.getDebugName()protected DragTracker getDragTracker()
protected EditPartViewer.Conditional getTargetingConditional()
true if the
queried edit part's EditPart.isSelectable() method returns
true.getTargetingConditional in class TargetingToolTargetingTool.getTargetingConditional()protected Request getTargetHoverRequest()
null, it will be
created via createHoverRequest().protected boolean handleButtonDown(int button)
Handle under the mouse, this method sets the drag
tracker returned from the handle. If there's an EditPart under
the mouse, this method sets the drag tracker returned from the edit part.handleButtonDown in class AbstractToolbutton - which button went downtrue if the buttonDown was handledAbstractTool.handleButtonDown(int)protected boolean handleButtonUp(int button)
handleButtonUp in class AbstractToolbutton - the button being releasedtrue if the button up was handledAbstractTool.handleButtonUp(int)protected boolean handleCommandStackChanged()
AbstractToolSTATE_INVALID and handleInvalidInput is called. Subclasses
may override this method to change what happens when the command stack
changes. Returning true indicates that the change was
handled in some way.handleCommandStackChanged in class AbstractTooltrue if the change was handled in some wayAbstractTool.handleCommandStackChanged()protected boolean handleFocusLost()
null and goes into the initial
state when focus is lost.handleFocusLost in class AbstractTooltrue if the event was handledAbstractTool.handleFocusLost()protected boolean handleHover()
showHoverFeedback().handleHover in class AbstractTooltrue if the hover was handledAbstractTool.handleHover()protected boolean handleHoverStop()
eraseHoverFeedback().handleHoverStop in class TargetingTooltrue if the hover stop is processed in some wayTargetingTool.handleHoverStop()protected boolean handleKeyDown(KeyEvent e)
KeyHandler, it calls
KeyHandler.keyPressed(KeyEvent).handleKeyDown in class AbstractToole - the key eventtrue if the key down was handled.AbstractTool.handleKeyDown(KeyEvent)protected boolean handleKeyUp(KeyEvent e)
KeyHandler, calls
KeyHandler.keyReleased(KeyEvent) sending it the given key event.handleKeyUp in class AbstractToole - the key eventtrue if the event was handledAbstractTool.handleKeyUp(KeyEvent)protected boolean handleMove()
handleMove in class AbstractTooltrue if the mouse move was handledAbstractTool.handleMove()public boolean handleNativeDragFinished(DragSourceEvent event)
null.handleNativeDragFinished in class AbstractToolevent - the drag eventtrue if the native drag finished was handledAbstractTool.handleNativeDragFinished(DragSourceEvent)public boolean handleNativeDragStarted(DragSourceEvent event)
handleNativeDragStarted in class AbstractToolevent - the drag eventtrue if the native drag start was handledAbstractTool.handleNativeDragStarted(DragSourceEvent)protected boolean handleViewerExited()
null and then sets
this tool's state to the initial state.handleViewerExited in class TargetingTooltrue if the viewer exited was handledAbstractTool.handleViewerExited()public void keyDown(KeyEvent evt, EditPartViewer viewer)
keyDown in interface ToolkeyDown in class AbstractToolevt - the key eventviewer - the originating viewerTool.keyDown(KeyEvent,
org.eclipse.gef.EditPartViewer)public void keyUp(KeyEvent evt, EditPartViewer viewer)
keyUp in interface ToolkeyUp in class AbstractToolevt - the key eventviewer - the originating viewerTool.keyUp(KeyEvent, org.eclipse.gef.EditPartViewer)public void mouseDown(MouseEvent e, EditPartViewer viewer)
mouseDown in interface ToolmouseDown in class AbstractToole - the mouse eventviewer - the originating viewerTool.mouseDown(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseDoubleClick(MouseEvent e, EditPartViewer viewer)
mouseDoubleClick in interface ToolmouseDoubleClick in class AbstractToole - the mouse eventviewer - the originating viewerTool.mouseDoubleClick(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseDrag(MouseEvent e, EditPartViewer viewer)
mouseDrag in interface ToolmouseDrag in class AbstractToole - the mouse eventviewer - the originating viewerTool.mouseDrag(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseHover(MouseEvent me, EditPartViewer viewer)
mouseHover in interface ToolmouseHover in class AbstractToolme - the mouse eventviewer - the originating viewerTool.mouseHover(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseMove(MouseEvent me, EditPartViewer viewer)
mouseMove in interface ToolmouseMove in class AbstractToolme - the mouse eventviewer - the originating viewerTool.mouseMove(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseUp(MouseEvent e, EditPartViewer viewer)
mouseUp in interface ToolmouseUp in class AbstractToole - the mouse eventviewer - the originating viewerTool.mouseUp(MouseEvent,
org.eclipse.gef.EditPartViewer)public void mouseWheelScrolled(Event event, EditPartViewer viewer)
mouseWheelScrolled in interface ToolmouseWheelScrolled in class AbstractToolevent - the SWT scroll eventviewer - the originating viewerTool.mouseWheelScrolled(org.eclipse.swt.widgets.Event,
org.eclipse.gef.EditPartViewer)protected void refreshCursor()
super.refreshCursor in class AbstractToolAbstractTool.refreshCursor()public void setDragTracker(DragTracker newDragTracker)
null, this method deactivates it. If the new drag
tracker is not null, this method will activate it and set
the EditDomain and EditPartViewer.newDragTracker - the new drag trackerprotected void showHoverFeedback()
EditPart.showTargetFeedback(Request) with a hover request.protected void updateHoverRequest()
protected void updateTargetRequest()
SelectionRequest) and then calls updateHoverRequest().updateTargetRequest in class TargetingToolTargetingTool.updateTargetRequest()protected java.lang.String getDebugNameForState(int state)
AbstractToolgetDebugNameForState in class AbstractToolstate - the stateAbstractTool.getDebugNameForState(int)Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.