Modelers

org.topcased.modeler.editor.palette
Class MarqueeSelectionTool

java.lang.Object
  extended by org.eclipse.gef.util.FlagSupport
      extended by org.eclipse.gef.tools.AbstractTool
          extended by org.topcased.modeler.editor.palette.MarqueeSelectionTool
All Implemented Interfaces:
org.eclipse.gef.DragTracker, org.eclipse.gef.RequestConstants, org.eclipse.gef.Tool
Direct Known Subclasses:
ExtMarqueeSelectionTool

public class MarqueeSelectionTool
extends org.eclipse.gef.tools.AbstractTool
implements org.eclipse.gef.DragTracker

A Tool which selects multiple objects inside a rectangular area of a Graphical Viewer. If the SHIFT key is pressed at the beginning of the drag, the enclosed items will be appended to the current selection. If the MOD1 key is pressed at the beginning of the drag, the enclosed items will have their selection state inverted.

By default, only editparts whose figure's are on the primary layer will be considered within the enclosed rectangle.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractTool
org.eclipse.gef.tools.AbstractTool.Input
 
Field Summary
static int BEHAVIOR_CONNECTIONS_TOUCHED
          This behaviour selects connections that intersect the marquee rectangle.
static int BEHAVIOR_NODES_AND_CONNECTIONS
          This behaviour selects nodes completely encompassed by the marquee rectangle, and all connections between those nodes.
static int BEHAVIOR_NODES_CONTAINED
          This behaviour selects nodes completely encompassed by the marquee rectangle.
protected static org.eclipse.gef.Request MARQUEE_REQUEST
           
static java.lang.Object PROPERTY_MARQUEE_BEHAVIOR
          The property to be used in AbstractTool.setProperties(java.util.Map) for setMarqueeBehavior(int).
 
Fields inherited from class org.eclipse.gef.tools.AbstractTool
MAX_FLAG, MAX_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_TERMINAL
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_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 Summary
MarqueeSelectionTool()
          Creates a new MarqueeSelectionTool of default type BEHAVIOR_NODES_CONTAINED.
 
Method Summary
protected  void applyProperty(java.lang.Object key, java.lang.Object value)
           
protected  void calculateConnections(java.util.Collection newSelections, java.util.Collection deselections)
           
protected  void calculateNewSelection(java.util.Collection newSelections, java.util.Collection deselections)
           
 void deactivate()
          Erases feedback if necessary and puts the tool into the terminal state.
protected  java.util.Set getAllChildren()
           
protected  void getAllChildren(org.eclipse.gef.EditPart editPart, java.util.Set allChildren)
           
protected  java.lang.String getCommandName()
           
protected  java.lang.String getDebugName()
           
protected  int getMarqueeBehavior()
           
protected  org.eclipse.draw2d.geometry.Rectangle getMarqueeSelectionRectangle()
           
protected  int getSelectionMode()
           
protected  boolean handleButtonDown(int button)
           
protected  boolean handleButtonUp(int button)
           
protected  boolean handleDragInProgress()
           
protected  boolean handleFocusLost()
           
protected  boolean handleInvalidInput()
          This method is called when mouse or keyboard input is invalid and erases the feedback.
protected  boolean handleKeyDown(org.eclipse.swt.events.KeyEvent e)
          Handles high-level processing of a key down event.
protected  boolean isFigureVisible(org.eclipse.draw2d.IFigure fig)
           
protected  boolean isViewerImportant(org.eclipse.gef.EditPartViewer viewer)
          MarqueeSelectionTool is only interested in GraphicalViewers, not TreeViewers.
 void setMarqueeBehavior(int type)
          Sets the type of parts that this tool will select.
 void setViewer(org.eclipse.gef.EditPartViewer viewer)
           
 
Methods inherited from class org.eclipse.gef.tools.AbstractTool
activate, addFeedback, calculateCursor, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCommand, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDoubleClick, handleDrag, handleDragStarted, handleFinished, handleFocusGained, handleHover, handleKeyTraversed, handleKeyUp, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, handleViewerExited, isActive, isHoverActive, isInState, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, reactivate, refreshCursor, releaseToolCapture, removeFeedback, resetFlags, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setState, setToolCapture, setUnloadWhenFinished, 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
 
Methods inherited from interface org.eclipse.gef.DragTracker
commitDrag
 
Methods inherited from interface org.eclipse.gef.Tool
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, viewerEntered, viewerExited
 

Field Detail

PROPERTY_MARQUEE_BEHAVIOR

public static final java.lang.Object PROPERTY_MARQUEE_BEHAVIOR
The property to be used in AbstractTool.setProperties(java.util.Map) for setMarqueeBehavior(int).


BEHAVIOR_NODES_CONTAINED

public static final int BEHAVIOR_NODES_CONTAINED
This behaviour selects nodes completely encompassed by the marquee rectangle. This is the default behaviour for this tool.

Since:
3.1

BEHAVIOR_CONNECTIONS_TOUCHED

public static final int BEHAVIOR_CONNECTIONS_TOUCHED
This behaviour selects connections that intersect the marquee rectangle.

Since:
3.1

BEHAVIOR_NODES_AND_CONNECTIONS

public static final int BEHAVIOR_NODES_AND_CONNECTIONS
This behaviour selects nodes completely encompassed by the marquee rectangle, and all connections between those nodes.

Since:
3.1

MARQUEE_REQUEST

protected static final org.eclipse.gef.Request MARQUEE_REQUEST
Constructor Detail

MarqueeSelectionTool

public MarqueeSelectionTool()
Creates a new MarqueeSelectionTool of default type BEHAVIOR_NODES_CONTAINED.

Method Detail

applyProperty

protected void applyProperty(java.lang.Object key,
                             java.lang.Object value)
Overrides:
applyProperty in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.applyProperty(java.lang.Object, java.lang.Object)

calculateConnections

protected void calculateConnections(java.util.Collection newSelections,
                                    java.util.Collection deselections)

calculateNewSelection

protected void calculateNewSelection(java.util.Collection newSelections,
                                     java.util.Collection deselections)

deactivate

public void deactivate()
Erases feedback if necessary and puts the tool into the terminal state.

Specified by:
deactivate in interface org.eclipse.gef.Tool
Overrides:
deactivate in class org.eclipse.gef.tools.AbstractTool

getAllChildren

protected java.util.Set getAllChildren()

getAllChildren

protected void getAllChildren(org.eclipse.gef.EditPart editPart,
                              java.util.Set allChildren)

getCommandName

protected java.lang.String getCommandName()
Specified by:
getCommandName in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.getCommandName()

getDebugName

protected java.lang.String getDebugName()
Overrides:
getDebugName in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.getDebugName()

getMarqueeSelectionRectangle

protected org.eclipse.draw2d.geometry.Rectangle getMarqueeSelectionRectangle()

getSelectionMode

protected int getSelectionMode()

handleButtonDown

protected boolean handleButtonDown(int button)
Overrides:
handleButtonDown in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.handleButtonDown(int)

handleButtonUp

protected boolean handleButtonUp(int button)
Overrides:
handleButtonUp in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.handleButtonUp(int)

handleDragInProgress

protected boolean handleDragInProgress()
Overrides:
handleDragInProgress in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.handleDragInProgress()

handleFocusLost

protected boolean handleFocusLost()
Overrides:
handleFocusLost in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.handleFocusLost()

handleInvalidInput

protected boolean handleInvalidInput()
This method is called when mouse or keyboard input is invalid and erases the feedback.

Overrides:
handleInvalidInput in class org.eclipse.gef.tools.AbstractTool
Returns:
true

handleKeyDown

protected boolean handleKeyDown(org.eclipse.swt.events.KeyEvent e)
Handles high-level processing of a key down event. KeyEvents are forwarded to the current viewer's KeyHandler, via KeyHandler.keyPressed(KeyEvent).

Overrides:
handleKeyDown in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.handleKeyDown(KeyEvent)

isFigureVisible

protected boolean isFigureVisible(org.eclipse.draw2d.IFigure fig)

isViewerImportant

protected boolean isViewerImportant(org.eclipse.gef.EditPartViewer viewer)
MarqueeSelectionTool is only interested in GraphicalViewers, not TreeViewers.

Overrides:
isViewerImportant in class org.eclipse.gef.tools.AbstractTool
See Also:
AbstractTool.isViewerImportant(org.eclipse.gef.EditPartViewer)

setMarqueeBehavior

public void setMarqueeBehavior(int type)
Sets the type of parts that this tool will select. This method should only be invoked once: when the tool is being initialized.

Parameters:
type - BEHAVIOR_CONNECTIONS_TOUCHED or BEHAVIOR_NODES_CONTAINED or BEHAVIOR_NODES_AND_CONNECTIONS
Since:
3.1

getMarqueeBehavior

protected int getMarqueeBehavior()

setViewer

public void setViewer(org.eclipse.gef.EditPartViewer viewer)
Specified by:
setViewer in interface org.eclipse.gef.Tool
Overrides:
setViewer in class org.eclipse.gef.tools.AbstractTool
See Also:
Tool.setViewer(org.eclipse.gef.EditPartViewer)

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.