sk.uniba.euromath.editor.xmlEditor.tools
Class XMLStructureDragTracker

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 sk.uniba.euromath.editor.xmlEditor.tools.XMLStructureDragTracker
All Implemented Interfaces:
org.eclipse.gef.DragTracker, org.eclipse.gef.RequestConstants, org.eclipse.gef.Tool
Direct Known Subclasses:
TextDragTracker

public class XMLStructureDragTracker
extends org.eclipse.gef.tools.TargetingTool
implements org.eclipse.gef.DragTracker

Drag tracker handling drags interpreting them as selections. Local selection is created translating start-point end-point to DOMPointers making DOMInterval. Depending on input is local selection combined with viewer's selection.
Start(end) point translation is always to DOMPinters pointing between nodes, not into.

Author:
Martin Kollar 23.09.2005

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractTool
org.eclipse.gef.tools.AbstractTool.Input
 
Field Summary
 
Fields inherited from class org.eclipse.gef.tools.TargetingTool
MAX_FLAG
 
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
XMLStructureDragTracker(IXMLEditPart sourceEditPart)
          Constructs new XMLDragTracker with the given XMLEditPart
 
Method Summary
protected  DOMIntervalSet computeGlobalSelection()
          Computes actual selection to set to viewer.
protected  DOMIntervalSet computeLocalSelection()
          Computes local selection corresponding to drag.
protected  boolean evaluate(org.eclipse.gef.EditPart editpart)
          Test editpart, if is acceptable as end point of selection under mouse.
protected  void finishDrag()
          Is called at termination of drag to perfom and finish selection and drag related tasks.
protected  String getCommandName()
           
protected  org.eclipse.gef.EditPart getSourceEditPart()
           
protected  XMLAccess getXMLAccess()
           
protected  IXMLGraphicalViewer getXMLGraphicalViewer()
           
protected  boolean handleButtonDown(int button)
           
protected  boolean handleButtonUp(int button)
          If in the drag state, the tool selects the source edit part.
protected  boolean handleDrag()
           
protected  boolean handleDragInProgress()
           
protected  boolean handleDragStarted()
           
protected  boolean handleEnteredEditPart()
           
protected  boolean handleExitingEditPart()
           
protected  boolean handleKeyDown(KeyEvent e)
           
protected  boolean handleKeyUp(KeyEvent e)
           
 void setViewer(org.eclipse.gef.EditPartViewer viewer)
          Retreives selection from viewer, before drag started.
protected  boolean updateTargetUnderMouse()
          Simpler implementation than super, as target is directly taken editpart at mouse cursor location, which must be XMLEditPart with not null element id.
 
Methods inherited from class org.eclipse.gef.tools.TargetingTool
createTargetRequest, deactivate, doAutoexpose, eraseTargetFeedback, getCommand, getExclusionSet, getTargetEditPart, getTargetingConditional, getTargetRequest, handleAutoexpose, handleHoverStop, handleInvalidInput, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetFlags, setAutoexposeHelper, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetRequest
 
Methods inherited from class org.eclipse.gef.tools.AbstractTool
activate, addFeedback, applyProperty, calculateCursor, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugName, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDoubleClick, handleFinished, handleFocusGained, handleFocusLost, handleHover, handleKeyTraversed, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, reactivate, refreshCursor, releaseToolCapture, removeFeedback, 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, deactivate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, viewerEntered, viewerExited
 

Constructor Detail

XMLStructureDragTracker

public XMLStructureDragTracker(IXMLEditPart sourceEditPart)
Constructs new XMLDragTracker with the given XMLEditPart

Parameters:
sourceEditPart - source editPart where selection starts
Method Detail

setViewer

public void setViewer(org.eclipse.gef.EditPartViewer viewer)
Retreives selection from viewer, before drag started.

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

handleDragStarted

protected boolean handleDragStarted()
Overrides:
handleDragStarted in class org.eclipse.gef.tools.AbstractTool

handleDrag

protected boolean handleDrag()
Overrides:
handleDrag in class org.eclipse.gef.tools.AbstractTool

handleDragInProgress

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

handleExitingEditPart

protected boolean handleExitingEditPart()
Overrides:
handleExitingEditPart in class org.eclipse.gef.tools.TargetingTool

handleEnteredEditPart

protected boolean handleEnteredEditPart()
Overrides:
handleEnteredEditPart in class org.eclipse.gef.tools.TargetingTool

handleButtonDown

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

computeLocalSelection

protected DOMIntervalSet computeLocalSelection()
Computes local selection corresponding to drag.

Returns:
selection made by this drag

handleButtonUp

protected boolean handleButtonUp(int button)
If in the drag state, the tool selects the source edit part. If the edit part was already selected, #performDirectEdit() is called. If the edit part is newly selected and not completely visible, EditPartViewer.reveal(EditPart) is called to show the selected edit part.

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

computeGlobalSelection

protected DOMIntervalSet computeGlobalSelection()
Computes actual selection to set to viewer. Pressed ctrl and shift keys influence how selection is computed. The user needs 3 styles of selecting: simple interval (nothing pressed), union interval with current selection(shift pressed) and xor interval with current selection(ctrl pressed).

Returns:
global selection uctual to current state of drag, returned by copy

getXMLAccess

protected XMLAccess getXMLAccess()

getXMLGraphicalViewer

protected IXMLGraphicalViewer getXMLGraphicalViewer()

getCommandName

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

getSourceEditPart

protected org.eclipse.gef.EditPart getSourceEditPart()

updateTargetUnderMouse

protected boolean updateTargetUnderMouse()
Simpler implementation than super, as target is directly taken editpart at mouse cursor location, which must be XMLEditPart with not null element id. In case when drag started at location where editpart hasn't id (source edit part hasn't id), source editpart is set to target, if not yet.

Overrides:
updateTargetUnderMouse in class org.eclipse.gef.tools.TargetingTool

evaluate

protected boolean evaluate(org.eclipse.gef.EditPart editpart)
Test editpart, if is acceptable as end point of selection under mouse.

Parameters:
editpart - to test for potential target - end point of selection
Returns:
true if is suitable for end point of selection

finishDrag

protected void finishDrag()
Is called at termination of drag to perfom and finish selection and drag related tasks.


handleKeyDown

protected boolean handleKeyDown(KeyEvent e)
Overrides:
handleKeyDown in class org.eclipse.gef.tools.AbstractTool

handleKeyUp

protected boolean handleKeyUp(KeyEvent e)
Overrides:
handleKeyUp in class org.eclipse.gef.tools.AbstractTool


Copyright © 2003-2006 null. All Rights Reserved.