Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse GEF
3.3

org.eclipse.gef.tools
Class DragEditPartsTracker

java.lang.Object
  extended by

org.eclipse.gef.util.FlagSupport
      extended by

org.eclipse.gef.tools.AbstractTool
          extended by

org.eclipse.gef.tools.TargetingTool
              extended by

org.eclipse.gef.tools.SelectEditPartTracker
                  extended by
org.eclipse.gef.tools.DragEditPartsTracker
All Implemented Interfaces:
DragTracker, RequestConstants, Tool

public class DragEditPartsTracker
extends SelectEditPartTracker

A DragTracker that moves EditParts.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.tools. AbstractTool
AbstractTool.Input
 
Field Summary
protected static int MAX_FLAG
          Max flag
 
Fields inherited from class org.eclipse.gef.tools. SelectEditPartTracker
FLAG_SELECTION_PERFORMED
 
Fields inherited from class org.eclipse.gef.tools. AbstractTool
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
DragEditPartsTracker ( EditPart sourceEditPart)
          Constructs a new DragEditPartsTracker with the given source edit part.
 
Method Summary
 void commitDrag ()
          Erases feedback and calls performDrag().
protected  java.util.List createOperationSet ()
          Returns a List of top-level edit parts excluding dependants (by calling ToolUtilities.getSelectionWithoutDependants(EditPartViewer) that understand the current target request (by calling ToolUtilities.filterEditPartsUnderstanding(List, Request).
protected   Request createTargetRequest ()
          Creates a ChangeBoundsRequest.
 void deactivate ()
          Erases source feedback and sets the autoexpose helper to null.
protected  void eraseSourceFeedback ()
          Asks the edit parts in the operation set to erase their source feedback.
protected   Command getCommand ()
          Asks each edit part in the operation set to contribute to a CompoundCommand after first setting the request type to either RequestConstants.REQ_MOVE or RequestConstants.REQ_ORPHAN, depending on the result of isMove().
protected  java.lang.String getCommandName ()
          Returns the identifier of the command that is being sought.
protected  java.lang.String getDebugName ()
          Returns the debug name for this tool.
protected  Cursor getDefaultCursor ()
          Returns the cursor used under normal conditions.
protected  java.util.Collection getExclusionSet ()
          Returns a list of all the edit parts in the operation set, plus the ConnectionLayer.
protected  void handleAutoexpose ()
          This method is called whenever an autoexpose occurs.
protected  boolean handleButtonUp (int button)
          Erases feedback and calls performDrag().
protected  boolean handleDragInProgress ()
          Updates the target request and mouse target, asks to show feedback, and sets the current command.
protected  boolean handleHover ()
          Calls TargetingTool.updateAutoexposeHelper() if a drag is in progress.
protected  boolean handleInvalidInput ()
          Erases source feedback.
protected  boolean handleKeyDown (KeyEvent e)
          Processes arrow keys used to move edit parts.
protected  boolean handleKeyUp (KeyEvent e)
          Interprets and processes clone deactivation, constrained move deactivation, and accessibility navigation reset.
protected  boolean isCloneActive ()
          Returns true if the current drag is a clone operation.
protected  boolean isMove ()
          Returns true if the source edit part is being moved within its parent.
protected  void performDrag ()
          Calls AbstractTool.executeCurrentCommand().
protected  void repairStartLocation ()
          If auto scroll (also called auto expose) is being performed, the start location moves during the scroll.
protected  void setAutoexposeHelper ( AutoexposeHelper helper)
          Sets the active autoexpose helper to the given helper, or null.
protected  void setCloneActive (boolean cloneActive)
          Enables cloning if the value is true.
protected  void setState (int state)
          Extended to activate cloning and to update the captured source dimensions when applicable.
protected  void setTargetEditPart ( EditPart editpart)
          Extended to update the current snap-to strategy.
protected  void showSourceFeedback ()
          Asks the edit parts in the operation set to show source feedback.
protected  void snapPoint ( ChangeBoundsRequest request)
          This method can be overridden by clients to customize the snapping behavior.
protected  void updateTargetRequest ()
          Calls repairStartLocation() in case auto scroll is being performed.
 
Methods inherited from class org.eclipse.gef.tools. SelectEditPartTracker
calculateCursor, getSourceEditPart, handleButtonDown, handleDoubleClick, handleDragStarted, hasSelectionOccurred, performConditionalSelection, performDirectEdit, performOpen, performSelection, resetFlags, setSourceEditPart
 
Methods inherited from class org.eclipse.gef.tools. TargetingTool
doAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getTargetEditPart, getTargetingConditional, getTargetRequest, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetHover, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse
 
Methods inherited from class org.eclipse.gef.tools. AbstractTool
acceptArrowKey, activate, addFeedback, applyProperty, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDrag, handleFinished, handleFocusGained, handleFocusLost, handleKeyTraversed, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, placeMouseInViewer, reactivate, refreshCursor, releaseToolCapture, removeFeedback, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setToolCapture, setUnloadWhenFinished, setViewer, 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. Tool
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
 

Field Detail

MAX_FLAG

protected static final int MAX_FLAG
Max flag

See Also:
Constant Field Values
Constructor Detail

DragEditPartsTracker

public DragEditPartsTracker(
EditPart sourceEditPart)
Constructs a new DragEditPartsTracker with the given source edit part.

Parameters:
sourceEditPart - the source edit part
Method Detail

getDefaultCursor

protected Cursor getDefaultCursor()
Returns the cursor used under normal conditions.

Overrides:
getDefaultCursor in class AbstractTool
Returns:
the default cursor
See Also:
AbstractTool.setDefaultCursor(Cursor)

commitDrag

public void commitDrag()
Erases feedback and calls performDrag(). Sets the state to terminal.

Specified by:
commitDrag in interface DragTracker
Overrides:
commitDrag in class AbstractTool
See Also:
AbstractTool.commitDrag()

createOperationSet

protected java.util.List createOperationSet()
Returns a List of top-level edit parts excluding dependants (by calling ToolUtilities.getSelectionWithoutDependants(EditPartViewer) that understand the current target request (by calling ToolUtilities.filterEditPartsUnderstanding(List, Request).

Overrides:
createOperationSet in class AbstractTool
Returns:
a list of editparts being operated on
See Also:
AbstractTool.createOperationSet()

createTargetRequest

protected 
Request createTargetRequest()
Creates a ChangeBoundsRequest. By default, the type is RequestConstants.REQ_MOVE. Later on when the edit parts are asked to contribute to the overall command, the request type will be either RequestConstants.REQ_MOVE or RequestConstants.REQ_ORPHAN, depending on the result of isMove().

Overrides:
createTargetRequest in class TargetingTool
Returns:
the new target request
See Also:
TargetingTool.createTargetRequest()

deactivate

public void deactivate()
Erases source feedback and sets the autoexpose helper to null.

Specified by:
deactivate in interface Tool
Overrides:
deactivate in class TargetingTool
See Also:
Tool.deactivate()

eraseSourceFeedback

protected void eraseSourceFeedback()
Asks the edit parts in the operation set to erase their source feedback.


getCommand

protected 
Command getCommand()
Asks each edit part in the operation set to contribute to a CompoundCommand after first setting the request type to either RequestConstants.REQ_MOVE or RequestConstants.REQ_ORPHAN, depending on the result of isMove().

Overrides:
getCommand in class TargetingTool
See Also:
AbstractTool.getCommand()

getCommandName

protected java.lang.String getCommandName()
Description copied from class: AbstractTool
Returns the identifier of the command that is being sought. This name is also the named that will be logged in the debug view.

Overrides:
getCommandName in class SelectEditPartTracker
See Also:
AbstractTool.getCommandName()

getDebugName

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

Overrides:
getDebugName in class SelectEditPartTracker
See Also:
AbstractTool.getDebugName()

getExclusionSet

protected java.util.Collection getExclusionSet()
Returns a list of all the edit parts in the operation set, plus the ConnectionLayer.

Overrides:
getExclusionSet in class TargetingTool
Returns:
the list of objects to be excluded as targets
See Also:
TargetingTool.getExclusionSet()

handleAutoexpose

protected void handleAutoexpose()
Description copied from class: TargetingTool
This method is called whenever an autoexpose occurs. When an autoexpose occurs, it is possible that everything in the viewer has moved a little. Therefore, by default, handleMove() is called to simulate the mouse moving even though it didn't.

Overrides:
handleAutoexpose in class TargetingTool
See Also:
TargetingTool.handleAutoexpose()

handleButtonUp

protected boolean handleButtonUp(int button)
Erases feedback and calls performDrag().

Overrides:
handleButtonUp in class SelectEditPartTracker
See Also:
AbstractTool.handleButtonUp(int)

handleDragInProgress

protected boolean handleDragInProgress()
Updates the target request and mouse target, asks to show feedback, and sets the current command.

Overrides:
handleDragInProgress in class AbstractTool
Returns:
true if the drag was handled
See Also:
AbstractTool.handleDragInProgress()

handleHover

protected boolean handleHover()
Calls TargetingTool.updateAutoexposeHelper() if a drag is in progress.

Overrides:
handleHover in class AbstractTool
Returns:
true if the hover was handled
See Also:
AbstractTool.handleHover()

handleInvalidInput

protected boolean handleInvalidInput()
Erases source feedback.

Overrides:
handleInvalidInput in class TargetingTool
Returns:
true
See Also:
TargetingTool.handleInvalidInput()

handleKeyDown

protected boolean handleKeyDown(KeyEvent e)
Processes arrow keys used to move edit parts.

Overrides:
handleKeyDown in class AbstractTool
Parameters:
e - the key event
Returns:
true if the key down was handled.
See Also:
org.eclipse.gef.tools.AbstractTool#handleKeyDown(org.eclipse.swt.events.KeyEvent)

handleKeyUp

protected boolean handleKeyUp(KeyEvent e)
Interprets and processes clone deactivation, constrained move deactivation, and accessibility navigation reset.

Overrides:
handleKeyUp in class AbstractTool
Parameters:
e - the key event
Returns:
true if the event was handled
See Also:
org.eclipse.gef.tools.AbstractTool#handleKeyUp(org.eclipse.swt.events.KeyEvent)

isCloneActive

protected boolean isCloneActive()
Returns true if the current drag is a clone operation.

Returns:
true if cloning is enabled and is currently active.

isMove

protected boolean isMove()
Returns true if the source edit part is being moved within its parent. If the source edit part is being moved to another parent, this returns false.

Returns:
true if the source edit part is not being reparented

performDrag

protected void performDrag()
Calls AbstractTool.executeCurrentCommand().


repairStartLocation

protected void repairStartLocation()
If auto scroll (also called auto expose) is being performed, the start location moves during the scroll. This method updates that location.


setAutoexposeHelper

protected void setAutoexposeHelper(
AutoexposeHelper helper)
Description copied from class: TargetingTool
Sets the active autoexpose helper to the given helper, or null. If the helper is not null, a runnable is queued on the event thread that will trigger a subsequent TargetingTool.doAutoexpose(). The helper is typically updated only on a hover event.

Overrides:
setAutoexposeHelper in class TargetingTool
Parameters:
helper - the new autoexpose helper or null
See Also:
TargetingTool.setAutoexposeHelper(org.eclipse.gef.AutoexposeHelper)

setCloneActive

protected void setCloneActive(boolean cloneActive)
Enables cloning if the value is true.

Parameters:
cloneActive - true if cloning should be active

setTargetEditPart

protected void setTargetEditPart(
EditPart editpart)
Extended to update the current snap-to strategy.

Overrides:
setTargetEditPart in class TargetingTool
Parameters:
editpart - the new target
See Also:
TargetingTool.setTargetEditPart(org.eclipse.gef.EditPart)

showSourceFeedback

protected void showSourceFeedback()
Asks the edit parts in the operation set to show source feedback.


setState

protected void setState(int state)
Extended to activate cloning and to update the captured source dimensions when applicable.

Overrides:
setState in class AbstractTool
Parameters:
state - the new state
See Also:
AbstractTool.setState(int)

updateTargetRequest

protected void updateTargetRequest()
Calls repairStartLocation() in case auto scroll is being performed. Updates the request with the current operation set, move delta, location and type.

Overrides:
updateTargetRequest in class TargetingTool
See Also:
TargetingTool.updateTargetRequest()

snapPoint

protected void snapPoint(
ChangeBoundsRequest request)
This method can be overridden by clients to customize the snapping behavior.

Parameters:
request - the ChangeBoundsRequest from which the move delta can be extracted and updated
Since:
3.4

Eclipse GEF
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire