GEF v2.0

org.eclipse.gef.tools
Class SelectionTool

java.lang.Object
  |
  +--org.eclipse.gef.internal.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.


Inner 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_CHILD, REQ_ALIGN_CHILDREN, REQ_ANCESTOR_DELETED, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_BENDPOINT, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILD, REQ_MOVE_CHILDREN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_END, REQ_RECONNECT_SOURCE, REQ_RECONNECT_START, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILD, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER, REQ_SOURCE_DELETED, REQ_TARGET_DELETED
 
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  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.
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()
           
 
Methods inherited from class org.eclipse.gef.tools.TargetingTool
eraseTargetFeedback, getCommand, getExclusionSet, getTargetEditPart, getTargetRequest, handleEnteredEditPart, handleExitingEditPart, handleInvalidInput, handleLeavingEditPart, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, 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, 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.internal.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

STATE_TRAVERSE_HANDLE

protected static final int STATE_TRAVERSE_HANDLE

MAX_STATE

protected static final int MAX_STATE
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.
Overrides:
deactivate in class TargetingTool
Following copied from class: org.eclipse.gef.tools.AbstractTool
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.
Overrides:
getCommandName in class AbstractTool

getDebugName

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

getDragTracker

protected DragTracker getDragTracker()

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
Following copied from class: org.eclipse.gef.tools.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
Following copied from class: org.eclipse.gef.tools.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
Following copied from class: org.eclipse.gef.tools.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
Following copied from class: org.eclipse.gef.tools.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
Following copied from class: org.eclipse.gef.tools.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
Following copied from class: org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.mouseMove(MouseEvent, 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).
Overrides:
keyDown in class AbstractTool

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).
Overrides:
keyUp in class AbstractTool

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).
Overrides:
mouseDown in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

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).
Overrides:
mouseDoubleClick in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

mouseDrag

public void mouseDrag(MouseEvent e,
                      EditPartViewer viewer)
Handles mouse drag events. The events are forwarded to the current tracker.
Overrides:
mouseDrag in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

mouseHover

public void mouseHover(MouseEvent me,
                       EditPartViewer viewer)
Handles mouse moves (if the mouse button is up) within a viewer.
Overrides:
mouseHover in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

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().
Overrides:
mouseMove in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

mouseUp

public void mouseUp(MouseEvent e,
                    EditPartViewer viewer)
Handles mouse up events. The events are forwarded to the current tracker.
Overrides:
mouseUp in class AbstractTool
Following copied from interface: org.eclipse.gef.Tool
Parameters:
mouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse event
viewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.

refreshCursor

protected void refreshCursor()
Description copied from class: AbstractTool
Selects the appropriate cursor.
Overrides:
refreshCursor in class AbstractTool
Following copied from class: org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.calculateCursor()

setDragTracker

public void setDragTracker(DragTracker newDragTracker)

showHoverFeedback

protected void showHoverFeedback()

updateHoverRequest

protected void updateHoverRequest()

updateTargetRequest

protected void updateTargetRequest()
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

GEF v2.0