public class SelectEditPartTracker extends TargetingTool implements DragTracker
EditParts
.AbstractTool.Input
Modifier and Type | Field and Description |
---|---|
protected static int |
FLAG_SELECTION_PERFORMED
Flag to indicate selection has been performed.
|
protected static int |
MAX_FLAG
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
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 and Description |
---|
SelectEditPartTracker(EditPart owner)
Constructs a new SelectEditPartTracker with the given edit part as the
source.
|
Modifier and Type | Method and Description |
---|---|
protected Cursor |
calculateCursor()
Returns the appropriate cursor for the tools current state.
|
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 EditPart |
getSourceEditPart()
Returns the source edit part.
|
protected boolean |
handleButtonDown(int button)
Performs a conditional selection if needed (if right or left mouse button
have been pressed) and goes into the drag state.
|
protected boolean |
handleButtonUp(int button)
If in the drag state, the tool selects the source edit part.
|
protected boolean |
handleDoubleClick(int button)
Calls
performOpen() if the double click was with mouse button 1. |
protected boolean |
handleDragStarted()
Called only one time during a drag when the drag threshold has been
exceeded.
|
protected boolean |
hasSelectionOccurred()
Returns
true if selection has already occured. |
protected void |
performConditionalSelection()
Calls
performSelection() if the source is not selected. |
protected void |
performDirectEdit()
Creates a
DirectEditRequest and sends it to a
DelayedDirectEditHelper to allow the user to directly edit the edit part. |
protected void |
performOpen()
Creates a
SelectionRequest and sends it to the source edit part
via EditPart.performRequest(Request) . |
protected void |
performSelection()
Performs the appropriate selection action based on the selection state of
the source and the modifiers (CTRL and SHIFT).
|
protected void |
resetFlags()
Extended to reset the target lock flag.
|
protected void |
setSourceEditPart(EditPart part)
Sets the source edit part.
|
createTargetRequest, deactivate, doAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getCommand, getExclusionSet, getTargetEditPart, getTargetingConditional, getTargetRequest, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleInvalidInput, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetHover, setAutoexposeHelper, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetRequest, updateTargetUnderMouse
acceptArrowKey, activate, addFeedback, applyProperty, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDrag, handleDragInProgress, handleFinished, handleFocusGained, handleFocusLost, handleHover, handleKeyDown, handleKeyTraversed, handleKeyUp, 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, setState, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExited
getFlag, setFlag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
commitDrag
activate, deactivate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
protected static final int FLAG_SELECTION_PERFORMED
protected static final int MAX_FLAG
public SelectEditPartTracker(EditPart owner)
owner
- the source edit partprotected Cursor calculateCursor()
AbstractTool
null
is returned. Otherwise,
either the default or disabled cursor is returned, based on the existence
of a current command, and whether that current command is executable.
Subclasses may override or extend this method to calculate the appropriate cursor based on other conditions.
calculateCursor
in class AbstractTool
null
or a cursor to be displayed.AbstractTool.calculateCursor()
protected java.lang.String getCommandName()
AbstractTool
getCommandName
in class AbstractTool
AbstractTool.getCommandName()
protected java.lang.String getDebugName()
AbstractTool
getDebugName
in class AbstractTool
AbstractTool.getDebugName()
protected EditPart getSourceEditPart()
protected boolean handleButtonDown(int button)
handleButtonDown
in class AbstractTool
button
- which button went downtrue
if the buttonDown was handledAbstractTool.handleButtonDown(int)
protected boolean handleButtonUp(int button)
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.handleButtonUp
in class AbstractTool
button
- the button being releasedtrue
if the button up was handledAbstractTool.handleButtonUp(int)
protected boolean handleDoubleClick(int button)
performOpen()
if the double click was with mouse button 1.handleDoubleClick
in class AbstractTool
button
- which button was double-clickedtrue
if the event was handledAbstractTool.handleDoubleClick(int)
protected boolean handleDragStarted()
AbstractTool
false
is returned.
Subclasses may override to interpret the drag starting. Returning
true
indicates that the event was handled.handleDragStarted
in class AbstractTool
AbstractTool.handleDragStarted()
protected boolean hasSelectionOccurred()
true
if selection has already occured.true
if selection has occuredprotected void performConditionalSelection()
performSelection()
if the source is not selected. If the
source is selected and there are no modifier keys pressed (i.e. the user
isn't selecting multiple edit parts or deselecting edit parts), sets the
direct edit flag so that when the mouse is released, a direct edit will
be performed.protected void performDirectEdit()
DirectEditRequest
and sends it to a
DelayedDirectEditHelper to allow the user to directly edit the edit part.protected void performOpen()
SelectionRequest
and sends it to the source edit part
via EditPart.performRequest(Request)
. Possible uses are to open
the selected item in another editor or replace the current editor's
contents based on the selected item.protected void performSelection()
protected void resetFlags()
TargetingTool
resetFlags
in class TargetingTool
AbstractTool.resetFlags()
protected void setSourceEditPart(EditPart part)
part
- the source edit partCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.