Class GFMarqueeSelectionTool
java.lang.Object
org.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool
org.eclipse.graphiti.ui.internal.editor.GFMarqueeSelectionTool
- All Implemented Interfaces:
org.eclipse.gef.RequestConstants
,org.eclipse.gef.Tool
- Direct Known Subclasses:
GFMarqueeDragTracker
public class GFMarqueeSelectionTool
extends org.eclipse.gef.tools.AbstractTool
This is a copy of class org.eclipse.gef.tools.MarqueeSelectionTool. In this
GEF class there are too many methods declared as private. Hence overriding of
this class does not make sense. Only the implementation of
calculateNewSelection() has been changed. In this case the insets of the GF
figures will be considered.
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
Modifier and TypeFieldDescriptionstatic final int
This behaviour selects connections that intersect the marquee rectangle.static final int
This behaviour selects nodes completely encompassed by the marquee rectangle, and all connections between those nodes.static final int
This behaviour selects nodes completely encompassed by the marquee rectangle.static final Object
The property to be used inAbstractTool.setProperties(java.util.Map)
forsetMarqueeBehavior(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
ConstructorDescriptionCreates a new MarqueeSelectionTool of default typeBEHAVIOR_NODES_CONTAINED
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyProperty
(Object key, Object value) Apply property.void
Erases feedback if necessary and puts the tool into the terminal state.protected String
Gets the command name.protected String
Gets the debug name.protected boolean
handleButtonDown
(int button) Handle button down.protected boolean
handleButtonUp
(int button) Handle button up.protected boolean
Handle drag in progress.protected boolean
Handle focus lost.protected boolean
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
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) Sets the viewer.Methods inherited from class org.eclipse.gef.tools.AbstractTool
acceptArrowKey, 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, placeMouseInViewer, 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
-
Field Details
-
PROPERTY_MARQUEE_BEHAVIOR
The property to be used inAbstractTool.setProperties(java.util.Map)
forsetMarqueeBehavior(int)
. -
BEHAVIOR_NODES_CONTAINED
public static final int BEHAVIOR_NODES_CONTAINEDThis behaviour selects nodes completely encompassed by the marquee rectangle. This is the default behaviour for this tool. -
BEHAVIOR_CONNECTIONS_TOUCHED
public static final int BEHAVIOR_CONNECTIONS_TOUCHEDThis behaviour selects connections that intersect the marquee rectangle. -
BEHAVIOR_NODES_AND_CONNECTIONS
public static final int BEHAVIOR_NODES_AND_CONNECTIONSThis behaviour selects nodes completely encompassed by the marquee rectangle, and all connections between those nodes.
-
-
Constructor Details
-
GFMarqueeSelectionTool
public GFMarqueeSelectionTool()Creates a new MarqueeSelectionTool of default typeBEHAVIOR_NODES_CONTAINED
.
-
-
Method Details
-
applyProperty
Apply property.- Overrides:
applyProperty
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
key
- the keyvalue
- the value- See Also:
-
AbstractTool.applyProperty(java.lang.Object, java.lang.Object)
-
deactivate
public void deactivate()Erases feedback if necessary and puts the tool into the terminal state.- Specified by:
deactivate
in interfaceorg.eclipse.gef.Tool
- Overrides:
deactivate
in classorg.eclipse.gef.tools.AbstractTool
-
getCommandName
Gets the command name.- Specified by:
getCommandName
in classorg.eclipse.gef.tools.AbstractTool
- Returns:
- the command name
- See Also:
-
AbstractTool.getCommandName()
-
getDebugName
Gets the debug name.- Overrides:
getDebugName
in classorg.eclipse.gef.tools.AbstractTool
- Returns:
- the debug name
- See Also:
-
AbstractTool.getDebugName()
-
handleButtonDown
protected boolean handleButtonDown(int button) Handle button down.- Overrides:
handleButtonDown
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
button
- the button- Returns:
- true, if handle button down
- See Also:
-
AbstractTool.handleButtonDown(int)
-
handleButtonUp
protected boolean handleButtonUp(int button) Handle button up.- Overrides:
handleButtonUp
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
button
- the button- Returns:
- true, if handle button up
- See Also:
-
AbstractTool.handleButtonUp(int)
-
handleDragInProgress
protected boolean handleDragInProgress()Handle drag in progress.- Overrides:
handleDragInProgress
in classorg.eclipse.gef.tools.AbstractTool
- Returns:
- true, if handle drag in progress
- See Also:
-
AbstractTool.handleDragInProgress()
-
handleFocusLost
protected boolean handleFocusLost()Handle focus lost.- Overrides:
handleFocusLost
in classorg.eclipse.gef.tools.AbstractTool
- Returns:
- true, if handle focus lost
- 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 classorg.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'sKeyHandler
, viaKeyHandler.keyPressed(KeyEvent)
.- Overrides:
handleKeyDown
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
e
- the e- Returns:
- true, if handle key down
- See Also:
-
AbstractTool.handleKeyDown(KeyEvent)
-
isViewerImportant
protected boolean isViewerImportant(org.eclipse.gef.EditPartViewer viewer) MarqueeSelectionTool is only interested in GraphicalViewers, not TreeViewers.- Overrides:
isViewerImportant
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
viewer
- the viewer- Returns:
- true, if checks if is viewer important
- 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
orBEHAVIOR_NODES_CONTAINED
orBEHAVIOR_NODES_AND_CONNECTIONS
- Since:
- 3.1
-
setViewer
public void setViewer(org.eclipse.gef.EditPartViewer viewer) Sets the viewer.- Specified by:
setViewer
in interfaceorg.eclipse.gef.Tool
- Overrides:
setViewer
in classorg.eclipse.gef.tools.AbstractTool
- Parameters:
viewer
- the viewer- See Also:
-
Tool.setViewer(org.eclipse.gef.EditPartViewer)
-