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

    Fields
    Modifier and Type
    Field
    Description
    static 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 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

    Constructors
    Constructor
    Description
    Creates a new MarqueeSelectionTool of default type BEHAVIOR_NODES_CONTAINED.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    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
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PROPERTY_MARQUEE_BEHAVIOR

      public static final 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.
    • BEHAVIOR_CONNECTIONS_TOUCHED

      public static final int BEHAVIOR_CONNECTIONS_TOUCHED
      This behaviour selects connections that intersect the marquee rectangle.
    • 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.
  • Constructor Details

    • GFMarqueeSelectionTool

      public GFMarqueeSelectionTool()
      Creates a new MarqueeSelectionTool of default type BEHAVIOR_NODES_CONTAINED.
  • Method Details

    • applyProperty

      protected void applyProperty(Object key, Object value)
      Apply property.
      Overrides:
      applyProperty in class org.eclipse.gef.tools.AbstractTool
      Parameters:
      key - the key
      value - 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 interface org.eclipse.gef.Tool
      Overrides:
      deactivate in class org.eclipse.gef.tools.AbstractTool
    • getCommandName

      protected String getCommandName()
      Gets the command name.
      Specified by:
      getCommandName in class org.eclipse.gef.tools.AbstractTool
      Returns:
      the command name
      See Also:
      • AbstractTool.getCommandName()
    • getDebugName

      protected String getDebugName()
      Gets the debug name.
      Overrides:
      getDebugName in class org.eclipse.gef.tools.AbstractTool
      Returns:
      the debug name
      See Also:
      • AbstractTool.getDebugName()
    • handleButtonDown

      protected boolean handleButtonDown(int button)
      Handle button down.
      Overrides:
      handleButtonDown in class org.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 class org.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 class org.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 class org.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 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
      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 class org.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 or BEHAVIOR_NODES_CONTAINED or BEHAVIOR_NODES_AND_CONNECTIONS
      Since:
      3.1
    • setViewer

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