Eclipse GEF
2.1

org.eclipse.gef.tools
Class SelectionTool

java.lang.Object
  |
  +--org.eclipse.gef.util.FlagSupport
        |
        +--org.eclipse.gef.tools.AbstractTool
              |
              +--org.eclipse.gef.tools.TargetingTool
                    |
                    +--org.eclipse.gef.tools.SelectionTool
All Implemented Interfaces:
RequestConstants, Tool

public class SelectionTool
extends TargetingTool

Tool to select and manipulate figures. A selection tool is in one of three states, e.g., background selection, figure selection, handle manipulation. The different states are handled by different child tools.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.tools.AbstractTool
AbstractTool.Input
 
Field Summary
protected static int MAX_FLAG
           
protected static int MAX_STATE
           
protected static int STATE_TRAVERSE_HANDLE
           
 
Fields inherited from class org.eclipse.gef.tools.AbstractTool
MOUSE_BUTTON_ANY, MOUSE_BUTTON1, MOUSE_BUTTON2, MOUSE_BUTTON3, 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_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
SelectionTool()
           
 
Method Summary
protected  void createHoverRequest()
           
protected  Request createTargetRequest()
           
 void deactivate()
          Deactivates the tool.
protected  void eraseHoverFeedback()
           
protected  String getCommandName()
          Returns the name identifier of the command that the tool is currently looking for.
protected  String getDebugName()
          Returns the debug name for this tool.
protected  String getDebugNameForState(int state)
          Returns a String representation of the given state for debug purposes.
protected  DragTracker getDragTracker()
           
protected  Request getTargetHoverRequest()
           
protected  EditPartViewer.Conditional getTargetingConditional()
           
protected  boolean handleButtonDown(int button)
          Called when the mouse button has been pressed.
protected  boolean handleButtonUp(int button)
          Handles the high-level processing of a mouse release.
protected  boolean handleFocusLost()
          Handles high-level processing of a focus lost event.
protected  boolean handleHover()
          Handles high-level processing of a mouse hover event.
protected  boolean handleHoverStop()
           
protected  boolean handleKeyDown(KeyEvent e)
          Handles high-level processing of a key down event.
protected  boolean handleKeyUp(KeyEvent e)
          Handles high-level processing of a key up event.
protected  boolean handleMove()
          Handles high-level processing of a mouse move.
 boolean handleNativeDragFinished(DragSourceEvent event)
           
 boolean handleNativeDragStarted(DragSourceEvent event)
           
protected  boolean handleViewerExited()
          Called when the mouse exits an EditPartViewer.
 void keyDown(KeyEvent evt, EditPartViewer viewer)
          Processes a KeyDown event for the given viewer.
 void keyUp(KeyEvent evt, EditPartViewer viewer)
          Processes a KeyUp event for the given viewer.
 void mouseDoubleClick(MouseEvent e, EditPartViewer viewer)
          Handles mouse double click events within a viewer.
 void mouseDown(MouseEvent e, EditPartViewer viewer)
          Handles mouse down events within a viewer.
 void mouseDrag(MouseEvent e, EditPartViewer viewer)
          Handles mouse drag events.
 void mouseHover(MouseEvent me, EditPartViewer viewer)
          Handles mouse moves (if the mouse button is up) within a viewer.
 void mouseMove(MouseEvent me, EditPartViewer viewer)
          Handles mouse moves (if the mouse button is up) within a viewer.
 void mouseUp(MouseEvent e, EditPartViewer viewer)
          Handles mouse up events.
protected  void refreshCursor()
          Selects the appropriate cursor.
 void setDragTracker(DragTracker newDragTracker)
           
protected  void showHoverFeedback()
           
protected  void updateHoverRequest()
           
protected  void updateTargetRequest()
          Subclasses should override to update the target request.
 
Methods inherited from class org.eclipse.gef.tools.TargetingTool
doAutoexpose, eraseTargetFeedback, getCommand, getExclusionSet, getTargetEditPart, getTargetRequest, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleInvalidInput, handleLeavingEditPart, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, setAutoexposeHelper, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse
 
Methods inherited from class org.eclipse.gef.tools.AbstractTool
activate, addFeedback, calculateCursor, commitDrag, createOperationSet, debug, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleDoubleClick, handleDrag, handleDragInProgress, handleDragStarted, handleFinished, handleFocusGained, handleViewerEntered, isActive, isHoverActive, isInState, movedPastThreshold, nativeDragFinished, nativeDragStarted, reactivate, releaseToolCapture, removeFeedback, resetFlags, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setStartLocation, setState, 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
 

Field Detail

MAX_FLAG

protected static final int MAX_FLAG
See Also:
Constant Field Values

STATE_TRAVERSE_HANDLE

protected static final int STATE_TRAVERSE_HANDLE
See Also:
Constant Field Values

MAX_STATE

protected static final int MAX_STATE
See Also:
Constant Field Values
Constructor Detail

SelectionTool

public SelectionTool()
Method Detail

createHoverRequest

protected void createHoverRequest()

createTargetRequest

protected Request createTargetRequest()
Overrides:
createTargetRequest in class TargetingTool

deactivate

public 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.

Specified by:
deactivate in interface Tool
Overrides:
deactivate in class TargetingTool
See Also:
AbstractTool.activate()

eraseHoverFeedback

protected void eraseHoverFeedback()

getCommandName

protected String getCommandName()
Description copied from class: AbstractTool
Returns the name identifier of the command that the tool is currently looking for.

Specified by:
getCommandName in class AbstractTool

getDebugName

protected String getDebugName()
Description copied from class: AbstractTool
Returns the debug name for this tool.

Specified by:
getDebugName in class AbstractTool

getDragTracker

protected DragTracker getDragTracker()

getTargetingConditional

protected EditPartViewer.Conditional getTargetingConditional()
Overrides:
getTargetingConditional in class TargetingTool
See Also:
org.eclipse.gef.tools.TargetingTool#getTargetConditional()

getTargetHoverRequest

protected Request getTargetHoverRequest()

handleButtonDown

protected boolean handleButtonDown(int button)
Description copied from class: AbstractTool
Called when the mouse button has been pressed. Should be implemented to process the users input correctly. Boolean should be used to indicate to your subclasses if you processed the event (true) or you didn't process it (false) and the subclass might process it. Key presses are a good example of this type of behavior.

Overrides:
handleButtonDown in class AbstractTool

handleButtonUp

protected boolean handleButtonUp(int button)
Description copied from class: AbstractTool
Handles the high-level processing of a mouse release.

Overrides:
handleButtonUp in class AbstractTool
See Also:
AbstractTool.mouseUp(MouseEvent, EditPartViewer)

handleFocusLost

protected boolean handleFocusLost()
Description copied from class: AbstractTool
Handles high-level processing of a focus lost event.

Overrides:
handleFocusLost in class AbstractTool
See Also:
AbstractTool.focusLost(FocusEvent, EditPartViewer)

handleHover

protected boolean handleHover()
Description copied from class: AbstractTool
Handles high-level processing of a mouse hover event.

Overrides:
handleHover in class AbstractTool
See Also:
AbstractTool.mouseHover(MouseEvent, EditPartViewer)

handleHoverStop

protected boolean handleHoverStop()
Overrides:
handleHoverStop in class TargetingTool

handleKeyDown

protected boolean handleKeyDown(KeyEvent e)
Description copied from class: AbstractTool
Handles high-level processing of a key down event.

Overrides:
handleKeyDown in class AbstractTool
See Also:
AbstractTool.keyDown(KeyEvent, EditPartViewer)

handleKeyUp

protected boolean handleKeyUp(KeyEvent e)
Description copied from class: AbstractTool
Handles high-level processing of a key up event.

Overrides:
handleKeyUp in class AbstractTool
See Also:
AbstractTool.keyUp(KeyEvent, EditPartViewer)

handleMove

protected boolean handleMove()
Description copied from class: AbstractTool
Handles high-level processing of a mouse move.

Overrides:
handleMove in class AbstractTool
See Also:
AbstractTool.mouseMove(MouseEvent, EditPartViewer)

handleNativeDragFinished

public boolean handleNativeDragFinished(DragSourceEvent event)
Overrides:
handleNativeDragFinished in class AbstractTool
See Also:
Tool.nativeDragFinished(DragSourceEvent, EditPartViewer)

handleNativeDragStarted

public boolean handleNativeDragStarted(DragSourceEvent event)
Overrides:
handleNativeDragStarted in class AbstractTool
See Also:
Tool.nativeDragStarted(DragSourceEvent, EditPartViewer)

handleViewerExited

protected boolean handleViewerExited()
Description copied from class: AbstractTool
Called when the mouse exits an EditPartViewer.

Overrides:
handleViewerExited in class TargetingTool

keyDown

public void keyDown(KeyEvent evt,
                    EditPartViewer viewer)
Description copied from class: AbstractTool
Processes a KeyDown event for the given viewer. Subclasses wanting to handle this event should override AbstractTool.handleKeyDown(KeyEvent).

Specified by:
keyDown in interface Tool
Overrides:
keyDown in class AbstractTool
Parameters:
evt - the SWT KeyEvent
viewer - the Viewer which received a key press

keyUp

public void keyUp(KeyEvent evt,
                  EditPartViewer viewer)
Description copied from class: AbstractTool
Processes a KeyUp event for the given viewer. Subclasses wanting to handle this event should override AbstractTool.handleKeyUp(KeyEvent).

Specified by:
keyUp in interface Tool
Overrides:
keyUp in class AbstractTool
Parameters:
evt - the SWT KeyEvent
viewer - the Viewer which received a key up

mouseDown

public void mouseDown(MouseEvent e,
                      EditPartViewer viewer)
Description copied from class: AbstractTool
Handles mouse down events within a viewer. Subclasses wanting to handle this event should override AbstractTool.handleButtonDown(int).

Specified by:
mouseDown in interface Tool
Overrides:
mouseDown in class AbstractTool
Parameters:
e - the SWT mouse event
viewer - the Viewer which received a mouse down

mouseDoubleClick

public void mouseDoubleClick(MouseEvent e,
                             EditPartViewer viewer)
Description copied from class: AbstractTool
Handles mouse double click events within a viewer. Subclasses wanting to handle this event should override AbstractTool.handleDoubleClick(int).

Specified by:
mouseDoubleClick in interface Tool
Overrides:
mouseDoubleClick in class AbstractTool
Parameters:
e - the SWT mouse event
viewer - the Viewer which received a double-click

mouseDrag

public void mouseDrag(MouseEvent e,
                      EditPartViewer viewer)
Handles mouse drag events. The events are forwarded to the current tracker.

Specified by:
mouseDrag in interface Tool
Overrides:
mouseDrag in class AbstractTool
Parameters:
e - the SWT mouse event
viewer - the Viewer which received a drag

mouseHover

public void mouseHover(MouseEvent me,
                       EditPartViewer viewer)
Handles mouse moves (if the mouse button is up) within a viewer.

Specified by:
mouseHover in interface Tool
Overrides:
mouseHover in class AbstractTool
Parameters:
me - the SWT mouse event
viewer - the Viewer which received a mouse down
See Also:
MouseTrackListener.mouseHover(MouseEvent)

mouseMove

public void mouseMove(MouseEvent me,
                      EditPartViewer viewer)
Description copied from class: AbstractTool
Handles mouse moves (if the mouse button is up) within a viewer. Subclasses wanting to handle this event should override AbstractTool.handleMove().

Specified by:
mouseMove in interface Tool
Overrides:
mouseMove in class AbstractTool
Parameters:
me - the SWT mouse event
viewer - the Viewer which received a mouse move
See Also:
Tool.mouseDrag(MouseEvent, EditPartViewer)

mouseUp

public void mouseUp(MouseEvent e,
                    EditPartViewer viewer)
Handles mouse up events. The events are forwarded to the current tracker.

Specified by:
mouseUp in interface Tool
Overrides:
mouseUp in class AbstractTool
Parameters:
e - the SWT mouse event
viewer - the Viewer which received a mouse up

refreshCursor

protected void refreshCursor()
Description copied from class: AbstractTool
Selects the appropriate cursor.

Overrides:
refreshCursor in class AbstractTool
See Also:
AbstractTool.calculateCursor()

setDragTracker

public void setDragTracker(DragTracker newDragTracker)

showHoverFeedback

protected void showHoverFeedback()

updateHoverRequest

protected void updateHoverRequest()

updateTargetRequest

protected void updateTargetRequest()
Description copied from class: TargetingTool
Subclasses should override to update the target request.

Overrides:
updateTargetRequest in class TargetingTool

getDebugNameForState

protected String getDebugNameForState(int state)
Description copied from class: AbstractTool
Returns a String representation of the given state for debug purposes.

Overrides:
getDebugNameForState in class AbstractTool

Eclipse GEF
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.