Class 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 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.
      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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void applyProperty​(java.lang.Object key, java.lang.Object value)
      Apply property.
      void deactivate()
      Erases feedback if necessary and puts the tool into the terminal state.
      protected java.lang.String getCommandName()
      Gets the command name.
      protected java.lang.String getDebugName()
      Gets the debug name.
      protected boolean handleButtonDown​(int button)
      Handle button down.
      protected boolean handleButtonUp​(int button)
      Handle button up.
      protected boolean handleDragInProgress()
      Handle drag in progress.
      protected boolean handleFocusLost()
      Handle focus lost.
      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 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • 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 Detail

      • GFMarqueeSelectionTool

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

      • applyProperty

        protected void applyProperty​(java.lang.Object key,
                                     java.lang.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 java.lang.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 java.lang.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)
      • 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)