Package org.eclipse.gef.tools
Class AbstractConnectionCreationTool
java.lang.Object
org.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool
org.eclipse.gef.tools.TargetingTool
org.eclipse.gef.tools.AbstractConnectionCreationTool
- All Implemented Interfaces:
- RequestConstants,- Tool
- Direct Known Subclasses:
- ConnectionCreationTool,- ConnectionDragCreationTool
The base implementation for tools which create a connection. A connection is
 a link between two existing GraphicalEditParts.
 
 A connection creation tool uses a CreateConnectionRequest to perform
 the creation. This request is sent to both graphical editparts which serve as
 the "nodes" at each end of the connection. The first node clicked on is the
 source. The source is asked for a Command that represents
 creating the first half of the connection. This command is then passed to the
 target editpart, which is reponsible for creating the final Command that is
 executed.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractToolAbstractTool.Input
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intThe max flag.protected static final intThe max state.protected static final intThe state which indicates that the connection creation has begun.Fields inherited from class org.eclipse.gef.tools.AbstractToolMOUSE_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_TERMINALFields inherited from interface org.eclipse.gef.RequestConstantsREQ_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 SummaryConstructorsConstructorDescriptionThe default constructorConstructs a new abstract creation tool with the given creation factory.
- 
Method SummaryModifier and TypeMethodDescriptionprotected CursorReturns the appropriate cursor for the tools current state.protected RequestCreates the target request that will be used with the target editpart.voidErases feedback and sets fields tonull.protected voidAsks the source editpart to erase connection creation feedback.protected StringReturns the identifier of the command that is being sought.protected StringReturns the debug name for this tool.protected StringgetDebugNameForState(int s) Returns a String representation of the given state for debug purposes.protected CreationFactoryReturns the creation factory that will be used with the create connection request.protected RequestReturns the request sent to the source node.protected CreateConnectionRequestLazily creates and returns the request used when communicating with the target editpart.protected booleanhandleButtonDown(int button) When the button is first pressed, the source node and its command contribution are determined and locked in.protected booleanhandleButtonUp(int button) Unloads or resets the tool if the state is in the terminal or invalid state.protected booleanCalled when the command stack has changed, for instance, when a delete or undo command has been executed.protected booleanMethod that is called when the gesture to create the connection has been received.protected booleanCalled whenever the mouse is being dragged.protected booleanCalled whenever a mouse is being dragged and the drag threshold has been exceeded.protected booleanHandles high-level processing of a focus lost event.protected booleanHandles high-level processing of a mouse hover event.protected booleanCalled when invalid input is encountered.protected booleanHandles high-level processing of a mouse move.protected voidCalled if the source editpart is deactivated for some reason during the creation process.protected booleanReturnstrueif feedback is being shown.protected voidsetConnectionSource(EditPart source) Sets the source editpart for the creationvoidsetFactory(CreationFactory factory) Sets the creation factory used in the request.protected voidSends a show feedback request to the source editpart and sets the feedback flag.protected voidSubclasses should override to update the target request.Methods inherited from class org.eclipse.gef.tools.TargetingTooldoAutoexpose, eraseTargetFeedback, getAutoexposeHelper, getCommand, getDirection, getExclusionSet, getTargetEditPart, getTargetingConditional, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetFlags, resetHover, setAutoexposeHelper, setRefreshRate, setTargetEditPart, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouseMethods inherited from class org.eclipse.gef.tools.AbstractToolacceptArrowKey, accGetStep, accStepIncrement, accStepReset, activate, addFeedback, applyProperty, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleDoubleClick, handleDragStarted, handleFinished, handleFocusGained, handleKeyDown, handleKeyTraversed, handleKeyUp, 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, viewerExitedMethods inherited from class org.eclipse.gef.util.FlagSupportgetFlag, setFlag
- 
Field Details- 
STATE_CONNECTION_STARTEDprotected static final int STATE_CONNECTION_STARTEDThe state which indicates that the connection creation has begun. This means that the source of the connection has been identified, and the user is still to determine the target.- See Also:
 
- 
MAX_STATEprotected static final int MAX_STATEThe max state.- See Also:
 
- 
MAX_FLAGprotected static final int MAX_FLAGThe max flag.- See Also:
 
 
- 
- 
Constructor Details- 
AbstractConnectionCreationToolpublic AbstractConnectionCreationTool()The default constructor
- 
AbstractConnectionCreationToolConstructs a new abstract creation tool with the given creation factory.- Parameters:
- factory- the creation factory
 
 
- 
- 
Method Details- 
calculateCursorDescription copied from class:AbstractToolReturns the appropriate cursor for the tools current state. If the tool is in its terminal state,nullis 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. - Overrides:
- calculateCursorin class- AbstractTool
- Returns:
- nullor a cursor to be displayed.
- See Also:
 
- 
createTargetRequestDescription copied from class:TargetingToolCreates the target request that will be used with the target editpart. This request will be cached and updated as needed.- Overrides:
- createTargetRequestin class- TargetingTool
- Returns:
- the new target request
- See Also:
 
- 
deactivatepublic void deactivate()Erases feedback and sets fields tonull.- Specified by:
- deactivatein interface- Tool
- Overrides:
- deactivatein class- TargetingTool
- See Also:
 
- 
eraseSourceFeedbackprotected void eraseSourceFeedback()Asks the source editpart to erase connection creation feedback.
- 
getCommandNameDescription copied from class:AbstractToolReturns 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:
- getCommandNamein class- AbstractTool
- Returns:
- the identifier for the command
- See Also:
 
- 
getDebugNameDescription copied from class:AbstractToolReturns the debug name for this tool.- Overrides:
- getDebugNamein class- AbstractTool
- Returns:
- the debug name
- See Also:
 
- 
getDebugNameForStateDescription copied from class:AbstractToolReturns a String representation of the given state for debug purposes.- Overrides:
- getDebugNameForStatein class- AbstractTool
- Parameters:
- s- the state
- Returns:
- the string for the given state
- See Also:
 
- 
getFactoryReturns the creation factory that will be used with the create connection request.- Returns:
- the creation factory
 
- 
getSourceRequestReturns the request sent to the source node. The source node receives the same request that is used with the target node. The only difference is that at that time the request will be typed asRequestConstants.REQ_CONNECTION_START.- Returns:
- the request used with the source node editpart
 
- 
getTargetRequestDescription copied from class:TargetingToolLazily creates and returns the request used when communicating with the target editpart.- Overrides:
- getTargetRequestin class- TargetingTool
- Returns:
- the target request
- Since:
- 3.21
 
- 
handleButtonDownprotected boolean handleButtonDown(int button) When the button is first pressed, the source node and its command contribution are determined and locked in. After that time, the tool will be looking for the target node to complete the connection- Overrides:
- handleButtonDownin class- AbstractTool
- Parameters:
- button- which button is pressed
- Returns:
- trueif the button down was processed
- See Also:
 
- 
handleButtonUpprotected boolean handleButtonUp(int button) Unloads or resets the tool if the state is in the terminal or invalid state.- Overrides:
- handleButtonUpin class- AbstractTool
- Parameters:
- button- the button being released
- Returns:
- trueif the button up was handled
- See Also:
 
- 
handleCommandStackChangedprotected boolean handleCommandStackChanged()Description copied from class:AbstractToolCalled when the command stack has changed, for instance, when a delete or undo command has been executed. By default, state is set toSTATE_INVALIDand handleInvalidInput is called. Subclasses may override this method to change what happens when the command stack changes. Returningtrueindicates that the change was handled in some way.- Overrides:
- handleCommandStackChangedin class- AbstractTool
- Returns:
- trueif the change was handled in some way
- See Also:
 
- 
handleCreateConnectionprotected boolean handleCreateConnection()Method that is called when the gesture to create the connection has been received. Subclasses may extend or override this method to do additional creation setup, such as prompting the user to choose an option about the connection being created. Returnstrueto indicate that the connection creation succeeded.- Returns:
- trueif the connection creation was performed
 
- 
handleDragprotected boolean handleDrag()Description copied from class:AbstractToolCalled whenever the mouse is being dragged. This method continues to be called even onceAbstractTool.handleDragInProgress()starts getting called. By default, nothing happens, andfalseis returned. Subclasses may override this method to interpret a drag. Returningtrueindicates that the drag was handled in some way.- Overrides:
- handleDragin class- AbstractTool
- Returns:
- trueif the drag is handled
- See Also:
 
- 
handleDragInProgressprotected boolean handleDragInProgress()Description copied from class:AbstractToolCalled whenever a mouse is being dragged and the drag threshold has been exceeded. Prior to the drag threshold being exceeded, onlyAbstractTool.handleDrag()is called. This method gets called repeatedly for every mouse move during the drag. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the drag. Returningtrueindicates that the drag was handled.- Overrides:
- handleDragInProgressin class- AbstractTool
- Returns:
- trueif the drag was handled
- See Also:
 
- 
handleFocusLostprotected boolean handleFocusLost()Description copied from class:AbstractToolHandles high-level processing of a focus lost event. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the focus lost event. Returntrueto indicate that the event was processed.- Overrides:
- handleFocusLostin class- AbstractTool
- Returns:
- trueif the event was handled
- See Also:
 
- 
handleHoverprotected boolean handleHover()Description copied from class:AbstractToolHandles high-level processing of a mouse hover event. By default, nothing happens andfalseis returned. Subclasses may override this method to interpret the hover. Returntrueto indicate that the hover was handled.- Overrides:
- handleHoverin class- AbstractTool
- Returns:
- trueif the hover was handled
- See Also:
 
- 
handleInvalidInputprotected boolean handleInvalidInput()Description copied from class:TargetingToolCalled when invalid input is encountered. By default, feedback is erased, and the current command is set to the unexecutable command. The state does not change, so the caller must set the state toAbstractTool.STATE_INVALID.- Overrides:
- handleInvalidInputin class- TargetingTool
- Returns:
- true
- See Also:
 
- 
handleMoveprotected boolean handleMove()Description copied from class:AbstractToolHandles high-level processing of a mouse move. By default, does nothing and returnsfalse. Subclasses may extend this method to process mouse moves. Returnstrueif the mouse move was processed.- Overrides:
- handleMovein class- AbstractTool
- Returns:
- trueif the mouse move was handled
- See Also:
 
- 
handleSourceDeactivatedprotected void handleSourceDeactivated()Called if the source editpart is deactivated for some reason during the creation process. For example, the user performs an Undo while in the middle of creating a connection, which undoes a prior command which created the source.
- 
isShowingSourceFeedbackprotected boolean isShowingSourceFeedback()Returnstrueif feedback is being shown.- Returns:
- trueif showing source feedback
 
- 
setConnectionSourceSets the source editpart for the creation- Parameters:
- source- the source editpart node
 
- 
setFactorySets the creation factory used in the request.- Parameters:
- factory- the factory
 
- 
showSourceFeedbackprotected void showSourceFeedback()Sends a show feedback request to the source editpart and sets the feedback flag.
- 
updateTargetRequestprotected void updateTargetRequest()Description copied from class:TargetingToolSubclasses should override to update the target request.- Overrides:
- updateTargetRequestin class- TargetingTool
- See Also:
 
 
-