Eclipse GEF
2.1

org.eclipse.gef.tools
Class ConnectionEndpointTracker

java.lang.Object
  |
  +--org.eclipse.gef.util.FlagSupport
        |
        +--org.eclipse.gef.tools.AbstractTool
              |
              +--org.eclipse.gef.tools.TargetingTool
                    |
                    +--org.eclipse.gef.tools.ConnectionEndpointTracker
All Implemented Interfaces:
DragTracker, RequestConstants, Tool

public class ConnectionEndpointTracker
extends TargetingTool
implements DragTracker

A DragTracker that moves the endpoint of a connection to another location.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.tools.AbstractTool
AbstractTool.Input
 
Field Summary
protected static int MAX_FLAG
          The max flag
 
Fields inherited from class org.eclipse.gef.tools.AbstractTool
MAX_STATE, MOUSE_BUTTON_ANY, MOUSE_BUTTON1, MOUSE_BUTTON2, MOUSE_BUTTON3, 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_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
ConnectionEndpointTracker(ConnectionEditPart cep)
          Constructs a new ConnectionEndpointTracker for the given ConnectionEditPart.
 
Method Summary
protected  Cursor calculateCursor()
          Returns a custom "plug" cursor if this tool is in the initial, drag or accessible drag state.
 void commitDrag()
          Erases source and target feedback and executes the current command.
protected  Request createTargetRequest()
          Creates the target request, a ReconnectRequest.
 void deactivate()
          Erases feedback and sets the viewer's focus to null.
protected  void eraseSourceFeedback()
          Erases the source feedback.
protected  String getCommandName()
          Returns the identifier of the command that is being sought.
protected  Connection getConnection()
          Returns the ConnectionEditPart's figure.
protected  ConnectionEditPart getConnectionEditPart()
          Returns the ConnectionEditPart.
protected  String getDebugName()
          Returns the debug name for this tool.
protected  Collection getExclusionSet()
          Returns a List of objects that should be excluded as potential targets for the operation.
protected  boolean handleButtonUp(int button)
          If currently in the drag-in-progress state, it goes into the terminal state erases feedback and executes the current command.
protected  boolean handleDragInProgress()
          Updates the request and the mouse target, asks to show feedback, and gets the current command.
protected  boolean handleDragStarted()
          Called only one time during a drag when the drag threshold has been exceeded.
protected  boolean handleHover()
          Handles high-level processing of a mouse hover event.
protected  boolean handleKeyDown(KeyEvent e)
          Processes the arrow keys (to choose a different source or target edit part) and forwardslash and backslash keys (to try to connect to another connection).
 void setCommandName(String newCommandName)
          Sets the command name.
 void setConnectionEditPart(ConnectionEditPart cep)
          Sets the connection edit part that is being reconnected.
protected  void showSourceFeedback()
          Asks the ConnectionEditPart to show source feedback.
protected  void updateTargetRequest()
          Updates the request location.
 
Methods inherited from class org.eclipse.gef.tools.TargetingTool
doAutoexpose, eraseTargetFeedback, getCommand, getTargetEditPart, getTargetingConditional, getTargetRequest, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleInvalidInput, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, setAutoexposeHelper, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse
 
Methods inherited from class org.eclipse.gef.tools.AbstractTool
activate, addFeedback, createOperationSet, debug, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleButtonDown, handleDoubleClick, handleDrag, handleFinished, handleFocusGained, handleFocusLost, handleKeyUp, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, isActive, isHoverActive, isInState, keyDown, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, movedPastThreshold, nativeDragFinished, nativeDragStarted, reactivate, refreshCursor, releaseToolCapture, removeFeedback, resetFlags, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setStartLocation, setState, 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, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, nativeDragFinished, nativeDragStarted, setEditDomain, setViewer, viewerEntered, viewerExited
 

Field Detail

MAX_FLAG

protected static final int MAX_FLAG
The max flag

See Also:
Constant Field Values
Constructor Detail

ConnectionEndpointTracker

public ConnectionEndpointTracker(ConnectionEditPart cep)
Constructs a new ConnectionEndpointTracker for the given ConnectionEditPart.

Parameters:
cep - the ConnectionEditPart
Method Detail

calculateCursor

protected Cursor calculateCursor()
Returns a custom "plug" cursor if this tool is in the initial, drag or accessible drag state. Otherwise defers to super.

Overrides:
calculateCursor in class AbstractTool
Returns:
the cursor
See Also:
AbstractTool.getDefaultCursor(), AbstractTool.getDisabledCursor(), AbstractTool.getCurrentCommand()

commitDrag

public void commitDrag()
Erases source and target feedback and executes the current command.

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

createTargetRequest

protected Request createTargetRequest()
Creates the target request, a ReconnectRequest.

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

deactivate

public void deactivate()
Erases feedback and sets the viewer's focus to null. This will remove any focus rectangles that were painted to show the new target or source edit part.

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

eraseSourceFeedback

protected void eraseSourceFeedback()
Erases the source feedback.


getCommandName

protected 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.

Specified by:
getCommandName in class AbstractTool
Returns:
the identifier for the command
See Also:
AbstractTool.getCommandName()

getConnection

protected Connection getConnection()
Returns the ConnectionEditPart's figure.

Returns:
the connection

getConnectionEditPart

protected ConnectionEditPart getConnectionEditPart()
Returns the ConnectionEditPart.

Returns:
the ConnectionEditPart

getDebugName

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

Specified by:
getDebugName in class AbstractTool
Returns:
the debug name
See Also:
AbstractTool.getDebugName()

getExclusionSet

protected Collection getExclusionSet()
Description copied from class: TargetingTool
Returns a List of objects that should be excluded as potential targets for the operation.

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

handleButtonUp

protected boolean handleButtonUp(int button)
If currently in the drag-in-progress state, it goes into the terminal state erases feedback and executes the current command.

Overrides:
handleButtonUp in class AbstractTool
Parameters:
button - the button being released
Returns:
true if the button up was handled
See Also:
AbstractTool.handleButtonUp(int)

handleDragInProgress

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

Overrides:
handleDragInProgress in class AbstractTool
Returns:
true
See Also:
AbstractTool.movedPastThreshold(), AbstractTool.mouseDrag(MouseEvent, EditPartViewer)

handleDragStarted

protected boolean handleDragStarted()
Description copied from class: AbstractTool
Called only one time during a drag when the drag threshold has been exceeded. By default, nothing happens and false is returned. Subclasses may override to interpret the drag starting. Returning true indicates that the event was handled.

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

handleHover

protected boolean handleHover()
Description copied from class: AbstractTool
Handles high-level processing of a mouse hover event. By default, nothing happens and false is returned. Subclasses may override this method to interpret the hover. Return true to indicate that the hover was handled.

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

handleKeyDown

protected boolean handleKeyDown(KeyEvent e)
Processes the arrow keys (to choose a different source or target edit part) and forwardslash and backslash keys (to try to connect to another connection).

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

setCommandName

public void setCommandName(String newCommandName)
Sets the command name.

Parameters:
newCommandName - the new command name

setConnectionEditPart

public void setConnectionEditPart(ConnectionEditPart cep)
Sets the connection edit part that is being reconnected.

Parameters:
cep - the connection edit part

showSourceFeedback

protected void showSourceFeedback()
Asks the ConnectionEditPart to show source feedback.


updateTargetRequest

protected void updateTargetRequest()
Updates the request location.

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

Eclipse GEF
2.1

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