|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.gef.util.FlagSupport | +--org.eclipse.gef.tools.AbstractTool | +--org.eclipse.gef.tools.TargetingTool | +--org.eclipse.gef.tools.AbstractConnectionCreationTool
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 Summary |
Nested classes inherited from class org.eclipse.gef.tools.AbstractTool |
AbstractTool.Input |
Field Summary | |
protected static int |
MAX_FLAG
The max flag. |
protected static int |
MAX_STATE
The max state. |
protected static int |
STATE_CONNECTION_STARTED
The state which indicates that the connection creation has begun. |
Fields inherited from class org.eclipse.gef.tools.AbstractTool |
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 | |
AbstractConnectionCreationTool()
The default constructor |
|
AbstractConnectionCreationTool(CreationFactory factory)
Constructs a new abstract creation tool with the given creation factory. |
Method Summary | |
protected Cursor |
calculateCursor()
Returns the appropriate cursor for the tools current state. |
protected Request |
createTargetRequest()
Creates the target request that will be used with the target editpart. |
void |
deactivate()
Erases feedback and sets fields to null . |
protected void |
eraseSourceFeedback()
Asks the source editpart to erase connection creation feedback. |
protected String |
getCommandName()
Returns the identifier of the command that is being sought. |
protected String |
getDebugName()
Returns the debug name for this tool. |
protected String |
getDebugNameForState(int s)
Returns a String representation of the given state for debug purposes. |
protected CreationFactory |
getFactory()
Returns the creation factory that will be used with the create connection request. |
protected Request |
getSourceRequest()
Returns the request sent to the source node. |
protected boolean |
handleButtonDown(int button)
When the button is first pressed, the source node and its command contribution are determined and locked in. |
protected boolean |
handleButtonUp(int button)
Unloads or resets the tool if the state is in the terminal or invalid state. |
protected boolean |
handleCreateConnection()
Method that is called when the gesture to create the connection has been received. |
protected boolean |
handleDrag()
Called whenever the mouse is being dragged. |
protected boolean |
handleDragInProgress()
Called whenever a mouse is being dragged and the drag threshold has been exceeded. |
protected boolean |
handleFocusLost()
Handles high-level processing of a focus lost event. |
protected boolean |
handleHover()
Handles high-level processing of a mouse hover event. |
protected boolean |
handleInvalidInput()
Called when invalid input is encountered. |
protected boolean |
handleMove()
Handles high-level processing of a mouse move. |
protected void |
handleSourceDeactivated()
Called if the source editpart is deactivated for some reason during the creation process. |
protected boolean |
isShowingSourceFeedback()
Returns true if feedback is being shown. |
protected void |
setConnectionSource(EditPart source)
Sets the source editpart for the creation |
void |
setFactory(CreationFactory factory)
Sets the creation factory used in the request. |
protected void |
showSourceFeedback()
Sends a show feedback request to the source editpart and sets the feedback flag. |
protected void |
updateTargetRequest()
Subclasses should override to update the target request. |
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 |
Field Detail |
protected static final int STATE_CONNECTION_STARTED
protected static final int MAX_STATE
protected static final int MAX_FLAG
Constructor Detail |
public AbstractConnectionCreationTool()
public AbstractConnectionCreationTool(CreationFactory factory)
factory
- the creation factoryMethod Detail |
protected 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 Request createTargetRequest()
TargetingTool
createTargetRequest
in class TargetingTool
TargetingTool.createTargetRequest()
public void deactivate()
null
.
deactivate
in interface Tool
deactivate
in class TargetingTool
Tool.deactivate()
protected void eraseSourceFeedback()
protected String getCommandName()
AbstractTool
getCommandName
in class AbstractTool
AbstractTool.getCommandName()
protected String getDebugName()
AbstractTool
getDebugName
in class AbstractTool
AbstractTool.getDebugName()
protected String getDebugNameForState(int s)
AbstractTool
getDebugNameForState
in class AbstractTool
s
- the state
AbstractTool.getDebugNameForState(int)
protected CreationFactory getFactory()
protected Request getSourceRequest()
RequestConstants.REQ_CONNECTION_START
.
protected boolean handleButtonDown(int button)
handleButtonDown
in class AbstractTool
button
- which button is pressed
true
if the button down was processedAbstractTool.handleButtonDown(int)
protected boolean handleButtonUp(int button)
handleButtonUp
in class AbstractTool
button
- the button being released
true
if the button up was handledAbstractTool.handleButtonUp(int)
protected boolean handleCreateConnection()
true
to indicate that the connection creation succeeded.
true
if the connection creation was performedprotected boolean handleDrag()
AbstractTool
AbstractTool.handleDragInProgress()
starts getting called. By default, nothing
happens, and false
is returned. Subclasses may override this method to
interpret a drag. Returning true
indicates that the drag was handled in
some way.
handleDrag
in class AbstractTool
true
if the drag is handledAbstractTool.handleDrag()
protected boolean handleDragInProgress()
AbstractTool
AbstractTool.handleDrag()
is called. This
method gets called repeatedly for every mouse move during the drag. By default, nothing
happens and false
is returned. Subclasses may override this method to
interpret the drag. Returning true
indicates that the drag was handled.
handleDragInProgress
in class AbstractTool
true
if the drag was handledAbstractTool.handleDragInProgress()
protected boolean handleFocusLost()
AbstractTool
false
is returned. Subclasses may override this method to interpret the
focus lost event. Return true
to indicate that the event was processed.
handleFocusLost
in class AbstractTool
true
if the event was handledAbstractTool.handleFocusLost()
protected boolean handleHover()
AbstractTool
false
is returned. Subclasses may override this method to interpret the
hover. Return true
to indicate that the hover was handled.
handleHover
in class AbstractTool
true
if the hover was handledAbstractTool.handleHover()
protected boolean handleInvalidInput()
TargetingTool
AbstractTool.STATE_INVALID
.
handleInvalidInput
in class TargetingTool
true
TargetingTool.handleInvalidInput()
protected boolean handleMove()
AbstractTool
false
. Subclasses may extend this method to process mouse moves.
Returns true
if the mouse move was processed.
handleMove
in class AbstractTool
true
if the mouse move was handledAbstractTool.handleMove()
protected void handleSourceDeactivated()
protected boolean isShowingSourceFeedback()
true
if feedback is being shown.
true
if showing source feedbackprotected void setConnectionSource(EditPart source)
source
- the source editpart nodepublic void setFactory(CreationFactory factory)
factory
- the factoryprotected void showSourceFeedback()
protected void updateTargetRequest()
TargetingTool
updateTargetRequest
in class TargetingTool
TargetingTool.updateTargetRequest()
|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |