|
GEF (MVC) 3.8.1.201211122107 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool
public abstract class AbstractTool
The base implementation for Tool
s. The base implementation provides a
framework for a state machine which processes mouse and keyboard
input. The state machine consists of a series of states identified by
int
s. Each mouse or keyboard event results in a transition,
sometimes to the same state in which the input was received. The interesting
transitions have corresponding actions assigned to them, such as
handleDragStarted()
.
The base implementation performs no state transitions by default, but does route events to different method handlers based on state. It is up to subclasses to set the appropriate states.
There are two broad "categories" of methods on AbstractTool. There are the
methods defined on the Tool
interface which handle the job of
receiving raw user input. For example,
mouseDrag(MouseEvent, EditPartViewer)
. Then, there are the methods
which correspond to higher-level interpretation of these events, such as
handleDragInProgress()
, which is called from
mouseMove(...)
, but only when the drag threshold has
been passed. These methods are generally more subclass-friendly. Subclasses
should not override the methods which receive raw input.
Nested Class Summary | |
---|---|
static class |
AbstractTool.Input
Allows the user to access mouse and keyboard input. |
Field Summary | |
---|---|
protected static int |
MAX_FLAG
The highest-bit flag being used. |
protected static int |
MAX_STATE
The maximum state flag defined by this class |
protected static int |
MOUSE_BUTTON_ANY
Deprecated. Use SWT.BUTTON_MASK instead. |
protected static int |
MOUSE_BUTTON1
Deprecated. Use SWT.BUTTON1 instead. |
protected static int |
MOUSE_BUTTON2
Deprecated. Use SWT.BUTTON2 instead. |
protected static int |
MOUSE_BUTTON3
Deprecated. Use SWT.BUTTON3 instead. |
static java.lang.Object |
PROPERTY_UNLOAD_WHEN_FINISHED
The property to be used in setProperties(Map) for
setUnloadWhenFinished(boolean) |
protected static int |
STATE_ACCESSIBLE_DRAG
The state indicating that the keyboard is being used to perform a drag that is normally done using the mouse. |
protected static int |
STATE_ACCESSIBLE_DRAG_IN_PROGRESS
The state indicating that a keyboard drag is in progress. |
protected static int |
STATE_DRAG
The state indicating that one or more buttons are pressed, but the user has not moved past the drag threshold. |
protected static int |
STATE_DRAG_IN_PROGRESS
The state indicating that the drag detection theshold has been passed, and a drag is in progress. |
protected static int |
STATE_INITIAL
The first state that a tool is in. |
protected static int |
STATE_INVALID
The state indicating that an input event has invalidated the interaction. |
protected static int |
STATE_TERMINAL
The final state for a tool to be in. |
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 | |
---|---|
AbstractTool()
|
Method Summary | |
---|---|
protected boolean |
acceptArrowKey(KeyEvent e)
Returns true if the event corresponds to an arrow key with the appropriate modifiers and if the system is in a state where the arrow key should be accepted. |
void |
activate()
Activates the tool. |
protected void |
addFeedback(IFigure figure)
Convenience method to add the given figure to the feedback layer. |
protected void |
applyProperty(java.lang.Object key,
java.lang.Object value)
This method is invoked from setProperties(Map) . |
protected Cursor |
calculateCursor()
Returns the appropriate cursor for the tools current state. |
void |
commitDrag()
Added for compatibility. |
protected java.util.List |
createOperationSet()
Returns a new List of editparts that this tool is operating on. |
void |
deactivate()
Deactivates the tool. |
protected void |
debug(java.lang.String message)
Deprecated. |
protected void |
executeCommand(Command command)
Executes the given command on the command stack. |
protected void |
executeCurrentCommand()
Execute the currently active command. |
void |
focusGained(FocusEvent event,
EditPartViewer viewer)
Called when a viewer that the editor controls gains focus. |
void |
focusLost(FocusEvent event,
EditPartViewer viewer)
Called when a viewer that the editor controls loses focus. |
protected Command |
getCommand()
Returns a new, updated command based on the tool's current properties. |
protected abstract java.lang.String |
getCommandName()
Returns the identifier of the command that is being sought. |
protected Command |
getCurrentCommand()
Returns the currently cached command. |
protected AbstractTool.Input |
getCurrentInput()
Returns the input object encapsulating the current mouse and keyboard state. |
protected EditPartViewer |
getCurrentViewer()
Return the viewer that the tool is currently receiving input from, or null . |
protected java.lang.String |
getDebugName()
Returns the debug name for this tool. |
protected java.lang.String |
getDebugNameForState(int state)
Returns a String representation of the given state for debug purposes. |
protected Cursor |
getDefaultCursor()
Returns the cursor used under normal conditions. |
protected Cursor |
getDisabledCursor()
Returns the cursor used under abnormal conditions. |
protected EditDomain |
getDomain()
Returns the EditDomain. |
protected Dimension |
getDragMoveDelta()
Return the number of pixels that the mouse has been moved since that drag was started. |
protected Point |
getLocation()
Returns the current x, y position of the mouse cursor. |
protected java.util.List |
getOperationSet()
Lazily creates and returns the list of editparts on which the tool operates. |
protected Point |
getStartLocation()
Returns the starting mouse location for the current tool operation. |
protected int |
getState()
Returns the tool's current state. |
protected boolean |
handleButtonDown(int button)
Called when the mouse button has been pressed. |
protected boolean |
handleButtonUp(int button)
Called when the mouse button has been released. |
protected boolean |
handleCommandStackChanged()
Called when the command stack has changed, for instance, when a delete or undo command has been executed. |
protected boolean |
handleDoubleClick(int button)
Called when a mouse double-click occurs. |
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 |
handleDragStarted()
Called only one time during a drag when the drag threshold has been exceeded. |
protected void |
handleFinished()
Called when the current tool operation is to be completed. |
protected boolean |
handleFocusGained()
Handles high-level processing of a focus gained event. |
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 |
handleKeyDown(KeyEvent e)
Handles high-level processing of a key down event. |
protected void |
handleKeyTraversed(TraverseEvent event)
Override to process a traverse event. |
protected boolean |
handleKeyUp(KeyEvent e)
Handles high-level processing of a key up event. |
protected boolean |
handleMove()
Handles high-level processing of a mouse move. |
protected boolean |
handleNativeDragFinished(DragSourceEvent event)
Handles when a native drag has ended. |
protected boolean |
handleNativeDragStarted(DragSourceEvent event)
Handles when a native drag has started. |
protected boolean |
handleViewerEntered()
Called when the mouse enters an EditPartViewer. |
protected boolean |
handleViewerExited()
Called when the mouse exits an EditPartViewer. |
protected boolean |
isActive()
Returns true if the tool is active. |
protected boolean |
isHoverActive()
Returns true if the tool is hovering. |
protected boolean |
isInState(int state)
Returns true if the tool is in the given state. |
protected boolean |
isViewerImportant(EditPartViewer viewer)
Default implementation always returns true . |
void |
keyDown(KeyEvent evt,
EditPartViewer viewer)
Receives a KeyDown event for the given viewer. |
void |
keyTraversed(TraverseEvent event,
EditPartViewer viewer)
Receives a traversal event for the given viewer. |
void |
keyUp(KeyEvent evt,
EditPartViewer viewer)
Receives a KeyUp event for the given viewer. |
void |
mouseDoubleClick(MouseEvent me,
EditPartViewer viewer)
Handles mouse double click events within a viewer. |
void |
mouseDown(MouseEvent me,
EditPartViewer viewer)
Handles mouse down events within a viewer. |
void |
mouseDrag(MouseEvent me,
EditPartViewer viewer)
Handles mouse drag events within a viewer. |
void |
mouseHover(MouseEvent me,
EditPartViewer viewer)
Handles mouse hover event. within a viewer. |
void |
mouseMove(MouseEvent me,
EditPartViewer viewer)
Handles mouse moves (if the mouse button is up) within a viewer. |
void |
mouseUp(MouseEvent me,
EditPartViewer viewer)
Handles mouse up within a viewer. |
void |
mouseWheelScrolled(Event event,
EditPartViewer viewer)
Handles mouse-wheel scrolling for a viewer. |
protected boolean |
movedPastThreshold()
Returns true if the threshold has been exceeded during a
mouse drag. |
void |
nativeDragFinished(DragSourceEvent event,
EditPartViewer viewer)
Called when a native drag ends on a Viewer. |
void |
nativeDragStarted(DragSourceEvent event,
EditPartViewer viewer)
Called when a native drag begins on a Viewer. |
protected void |
performViewerMouseWheel(Event event,
EditPartViewer viewer)
Delegates mouse-wheel event handling to registered MouseWheelHandlers based on the given Event's
statemask. |
protected void |
placeMouseInViewer(Point p)
Places the mouse in the viewer based on the point given. |
protected void |
reactivate()
Calls deactivate() and then activate() . |
protected void |
refreshCursor()
Sets the cursor being displayed to the appropriate cursor. |
protected void |
releaseToolCapture()
Releases tool capture. |
protected void |
removeFeedback(IFigure figure)
Convenience method to removes a figure from the feedback layer. |
protected void |
resetFlags()
Resets all stateful flags to their initial values. |
protected void |
setCurrentCommand(Command c)
Used to cache a command obtained from getCommand() . |
protected void |
setCursor(Cursor cursor)
Shows the given cursor on the current viewer. |
void |
setDefaultCursor(Cursor cursor)
Sets the default cursor. |
void |
setDisabledCursor(Cursor cursor)
Sets the disabled cursor. |
void |
setEditDomain(EditDomain domain)
Sets the EditDomain. |
protected void |
setHoverActive(boolean value)
Sets whether the hover flag is true or false. |
void |
setProperties(java.util.Map properties)
An example is PROPERTY_UNLOAD_WHEN_FINISHED -> Boolean. |
protected void |
setStartLocation(Point p)
Sets the start mouse location, typically for a drag operation. |
protected void |
setState(int state)
Sets the tools state. |
protected void |
setToolCapture()
Sets tool capture. |
void |
setUnloadWhenFinished(boolean value)
Setting this to true will cause the tool to be unloaded
after one operation has completed. |
void |
setViewer(EditPartViewer viewer)
Sets the active EditPartViewer. |
protected boolean |
stateTransition(int start,
int end)
Returns true if the give state transition succeeds. |
protected boolean |
unloadWhenFinished()
Returns true if the tool is set to unload when its current
operation is complete. |
void |
viewerEntered(MouseEvent me,
EditPartViewer viewer)
Receives the mouse entered event. |
void |
viewerExited(MouseEvent me,
EditPartViewer viewer)
Handles the mouse exited event. |
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 |
---|
public static final java.lang.Object PROPERTY_UNLOAD_WHEN_FINISHED
setProperties(Map)
for
setUnloadWhenFinished(boolean)
protected static final int MAX_FLAG
protected static final int MAX_STATE
protected static final int MOUSE_BUTTON1
SWT.BUTTON1
instead.
protected static final int MOUSE_BUTTON2
SWT.BUTTON2
instead.
protected static final int MOUSE_BUTTON3
SWT.BUTTON3
instead.
protected static final int MOUSE_BUTTON_ANY
SWT.BUTTON_MASK
instead.
protected static final int STATE_ACCESSIBLE_DRAG
protected static final int STATE_ACCESSIBLE_DRAG_IN_PROGRESS
protected static final int STATE_DRAG
STATE_DRAG_IN_PROGRESS
is entered.
protected static final int STATE_DRAG_IN_PROGRESS
protected static final int STATE_INITIAL
activate()
.
protected static final int STATE_INVALID
protected static final int STATE_TERMINAL
Constructor Detail |
---|
public AbstractTool()
Method Detail |
---|
protected boolean acceptArrowKey(KeyEvent e)
e
- the key event
public void activate()
activate
in interface Tool
deactivate()
protected void addFeedback(IFigure figure)
figure
- the feedback being addedprotected void applyProperty(java.lang.Object key, java.lang.Object value)
setProperties(Map)
. Sub-classes can
override to add support for more properties. This method should fail
silently in case of any error.
AbstractTool uses introspection to match any keys with properties. For
instance, the key "defaultCursor" would lead to the invocation of
setDefaultCursor(Cursor)
with the provided value.
key
- the key; may be null
value
- the new valuesetProperties(Map)
protected Cursor calculateCursor()
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.
null
or a cursor to be displayed.getDefaultCursor()
,
getDisabledCursor()
,
getCurrentCommand()
public void commitDrag()
DragTracker.commitDrag()
was added for
accessibility reasons. Since all tool implementations must inherit from
this base class, then implementing this method here avoids breaking
subclasses that implemented the DragTracker
interface.
protected java.util.List createOperationSet()
getOperationSet()
, and its result
is cached.
By default, the operations set is the current viewer's entire selection. Subclasses may override this method to filter or alter the operation set as necessary.
public void deactivate()
deactivate
in interface Tool
activate()
protected void debug(java.lang.String message)
message
- a message for the debug trace toolprotected void executeCommand(Command command)
command
- the command to executeprotected void executeCurrentCommand()
public void focusGained(FocusEvent event, EditPartViewer viewer)
focusGained
in interface Tool
event
- The SWT focus eventviewer
- The viewer that the focus event is over.public void focusLost(FocusEvent event, EditPartViewer viewer)
focusLost
in interface Tool
event
- The SWT focus eventviewer
- The viewer that the focus event is over.protected Command getCommand()
protected abstract java.lang.String getCommandName()
protected Command getCurrentCommand()
setCurrentCommand(Command)
protected AbstractTool.Input getCurrentInput()
protected EditPartViewer getCurrentViewer()
null
. The last viewer to dispatch an event is defined as the
current viewer. Current viewer is automatically updated as events are
received, and is set to null
on deactivate()
.
protected java.lang.String getDebugName()
protected java.lang.String getDebugNameForState(int state)
state
- the state
protected Cursor getDefaultCursor()
setDefaultCursor(Cursor)
protected Cursor getDisabledCursor()
calculateCursor()
,
setDisabledCursor(Cursor)
protected EditDomain getDomain()
protected Dimension getDragMoveDelta()
getStartLocation()
protected Point getLocation()
protected java.util.List getOperationSet()
null
, in which case
createOperationSet()
is called, and its results cached until the
tool is deactivated.
protected Point getStartLocation()
protected int getState()
protected boolean handleButtonDown(int button)
false
is returned. Subclasses may override this
method to interpret the meaning of a mouse down. Returning
true
indicates that the button down was handled in some way.
button
- which button went down
true
if the buttonDown was handledprotected boolean handleButtonUp(int button)
false
is returned. Subclasses may override this
method to interpret the mouse up. Returning true
indicates
that the mouse up was handled in some way.
button
- the button being released
true
if the button up was handledmouseUp(MouseEvent, EditPartViewer)
protected boolean handleCommandStackChanged()
STATE_INVALID
and handleInvalidInput is called. Subclasses
may override this method to change what happens when the command stack
changes. Returning true
indicates that the change was
handled in some way.
true
if the change was handled in some wayprotected boolean handleDoubleClick(int button)
false
is returned. Subclasses may override this method to
interpret double-clicks. Returning true
indicates that the
event was handled in some way.
button
- which button was double-clicked
true
if the event was handledmouseDoubleClick(MouseEvent, EditPartViewer)
protected boolean handleDrag()
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.
true
if the drag is handledmouseDrag(MouseEvent, EditPartViewer)
protected boolean handleDragInProgress()
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.
true
if the drag was handledmovedPastThreshold()
,
mouseDrag(MouseEvent, EditPartViewer)
protected boolean handleDragStarted()
false
is returned.
Subclasses may override to interpret the drag starting. Returning
true
indicates that the event was handled.
movedPastThreshold()
,
mouseDrag(MouseEvent, EditPartViewer)
protected void handleFinished()
Subclasses should extend this method to first do whatever it is that the
tool does, and then call super
.
unloadWhenFinished()
protected boolean handleFocusGained()
false
is returned. Subclasses may
override this method to interpret the focus gained event. Return
true
to indicate that the event was processed.
true
if the event was handledfocusGained(FocusEvent, EditPartViewer)
protected boolean handleFocusLost()
false
is returned. Subclasses may override this
method to interpret the focus lost event. Return true
to
indicate that the event was processed.
true
if the event was handledfocusLost(FocusEvent, EditPartViewer)
protected boolean handleHover()
false
is returned. Subclasses may override this
method to interpret the hover. Return true
to indicate that
the hover was handled.
true
if the hover was handledmouseHover(MouseEvent, EditPartViewer)
protected boolean handleInvalidInput()
STATE_INVALID
.
true
protected boolean handleKeyDown(KeyEvent e)
true
is returned. Subclasses
may extend this method to interpret additional key down events. Returns
true
if the given key down was handled.
e
- the key event
true
if the key down was handled.keyDown(KeyEvent, EditPartViewer)
protected void handleKeyTraversed(TraverseEvent event)
doit
field is set to false
, the
traversal will be prevented from occurring. Otherwise, a traverse will
occur.
event
- the SWT traverse eventprotected boolean handleKeyUp(KeyEvent e)
false
. Subclasses may extend this method to
process key up events. Returns true
if the key up was
processed in some way.
e
- the key event
true
if the event was handledkeyUp(KeyEvent, EditPartViewer)
protected boolean handleMove()
false
. Subclasses may extend this method to
process mouse moves. Returns true
if the mouse move was
processed.
true
if the mouse move was handledmouseMove(MouseEvent, EditPartViewer)
protected boolean handleNativeDragFinished(DragSourceEvent event)
false
. Subclasses may extend this method to process
native drags ending.
event
- the drag event
true
if the native drag finished was handledprotected boolean handleNativeDragStarted(DragSourceEvent event)
false
. Subclasses may extend this method to process
native drag starts.
When a native drag starts, all subsequent mouse events will not be received, including the mouseUp event. The only event that will be received is the drag finished event.
event
- the drag event
true
if the native drag start was handledprotected boolean handleViewerEntered()
false
. Subclasses may extend this method to
process the viewer enter. Returns true
to indicate if the
viewer entered was process in some way.
true
if the viewer entered was handledprotected boolean handleViewerExited()
false
. Subclasses may extend this method to
process viewer exits. Returns true
to indicate if the viewer
exited was process in some way.
true
if the viewer exited was handledprotected boolean isActive()
true
if the tool is active.
true
if activeprotected boolean isHoverActive()
true
if the tool is hovering.
true
if hoveringprotected boolean isInState(int state)
true
if the tool is in the given state.
state
- the state being queried
true
if the tool is in the given stateprotected boolean isViewerImportant(EditPartViewer viewer)
true
. Sub-classes may
override.
viewer
- the viewer where the event occured
true
if this tool is interested in events occuring
in the given viewer; false
otherwisepublic void keyDown(KeyEvent evt, EditPartViewer viewer)
handleKeyDown(KeyEvent)
.
keyDown
in interface Tool
evt
- the key eventviewer
- the originating viewerpublic void keyTraversed(TraverseEvent event, EditPartViewer viewer)
handleKeyTraversed(TraverseEvent)
.
keyTraversed
in interface Tool
event
- the traverse eventviewer
- the originating viewerpublic void keyUp(KeyEvent evt, EditPartViewer viewer)
handleKeyUp(KeyEvent)
.
keyUp
in interface Tool
evt
- the key eventviewer
- the originating viewerpublic void mouseDoubleClick(MouseEvent me, EditPartViewer viewer)
handleDoubleClick(int)
.
mouseDoubleClick
in interface Tool
me
- the mouse eventviewer
- the originating viewerpublic void mouseDown(MouseEvent me, EditPartViewer viewer)
handleButtonDown(int)
.
mouseDown
in interface Tool
me
- the mouse eventviewer
- the originating viewerpublic void mouseDrag(MouseEvent me, EditPartViewer viewer)
handleDrag()
and/or
handleDragInProgress()
.
mouseDrag
in interface Tool
me
- the mouse eventviewer
- the originating viewerpublic void mouseHover(MouseEvent me, EditPartViewer viewer)
handleHover()
.
mouseHover
in interface Tool
me
- the mouse eventviewer
- the originating viewerMouseTrackListener.mouseHover(MouseEvent)
public void mouseMove(MouseEvent me, EditPartViewer viewer)
handleMove()
.
mouseMove
in interface Tool
me
- the mouse eventviewer
- the originating viewerTool.mouseDrag(MouseEvent, EditPartViewer)
public void mouseUp(MouseEvent me, EditPartViewer viewer)
handleButtonUp(int)
.
mouseUp
in interface Tool
me
- the mouse eventviewer
- the originating viewerpublic void mouseWheelScrolled(Event event, EditPartViewer viewer)
performViewerMouseWheel(Event, EditPartViewer)
IFF the tool is
in the initial state. Mouse-wheel events generated at other times are
ignored.
mouseWheelScrolled
in interface Tool
event
- the SWT scroll eventviewer
- the originating viewerperformViewerMouseWheel(Event, EditPartViewer)
protected boolean movedPastThreshold()
true
if the threshold has been exceeded during a
mouse drag.
true
if the threshold has been exceededpublic void nativeDragFinished(DragSourceEvent event, EditPartViewer viewer)
Tool
mouseUp(..)
will not occur once a native drag has started. The Tool should correct
its state to handle this lost Event.
nativeDragFinished
in interface Tool
event
- the SWT DragSourceEventviewer
- the Viewer on which a native drag startedTool.nativeDragFinished(DragSourceEvent,
EditPartViewer)
public void nativeDragStarted(DragSourceEvent event, EditPartViewer viewer)
Tool
mouseUp(..)
will not occur once a native drag has started. The Tool should correct
its state to handle this lost Event.
nativeDragStarted
in interface Tool
event
- the SWT DragSourceEventviewer
- the Viewer on which a native drag startedTool.nativeDragStarted(DragSourceEvent,
EditPartViewer)
protected void performViewerMouseWheel(Event event, EditPartViewer viewer)
MouseWheelHandlers
based on the given Event's
statemask. Does nothing if there are no matching handlers found.
event
- the SWT scroll eventviewer
- the originating viewerprotected void placeMouseInViewer(Point p)
p
- the pointprotected void reactivate()
deactivate()
and then activate()
.
protected void refreshCursor()
calculateCursor()
.
protected void releaseToolCapture()
setToolCapture()
protected void removeFeedback(IFigure figure)
figure
- the figure being removedprotected void resetFlags()
protected void setCurrentCommand(Command c)
getCommand()
.
c
- the commandgetCurrentCommand()
protected void setCursor(Cursor cursor)
cursor
- the cursor to displaypublic void setDefaultCursor(Cursor cursor)
cursor
- the cursorgetDefaultCursor()
public void setDisabledCursor(Cursor cursor)
cursor
- the cursorgetDisabledCursor()
public void setEditDomain(EditDomain domain)
setEditDomain
in interface Tool
domain
- the edit domaingetDomain()
protected void setHoverActive(boolean value)
value
- whether hover is activepublic void setProperties(java.util.Map properties)
PROPERTY_UNLOAD_WHEN_FINISHED
-> Boolean.
AbstractTool uses introspection to set properties that are not explicitly
specified. For instance, the key "defaultCursor" will cause
setDefaultCursor(Cursor)
to be invoked with the given value.
setProperties
in interface Tool
properties
- a mapping of the properties to be set and their new values;
can be null
Tool.setProperties(java.util.Map)
protected void setStartLocation(Point p)
p
- the start locationprotected void setState(int state)
state
- the new stateprotected void setToolCapture()
public void setUnloadWhenFinished(boolean value)
true
will cause the tool to be unloaded
after one operation has completed. The default value is true
. The tool is unloaded, and the edit domains default tool will be
activated.
value
- whether the tool should be unloaded on completionpublic void setViewer(EditPartViewer viewer)
setViewer
in interface Tool
viewer
- the viewerprotected boolean stateTransition(int start, int end)
true
if the give state transition succeeds. This is
a "test and set" operation, where the tool is tested to be in the
specified start state, and if so, is set to the given end state. The
method returns the result of the first test.
start
- the start state being testedend
- the end state
true
if the state transition is successfulprotected final boolean unloadWhenFinished()
true
if the tool is set to unload when its current
operation is complete.
true
if the tool should be unloaded when finishedpublic void viewerEntered(MouseEvent me, EditPartViewer viewer)
handleViewerEntered()
.
FEATURE in SWT: mouseExit comes after mouseEntered on the new control.
Therefore, if the current viewer is not null
, it means the
exit has not been sent yet by SWT. To maintain proper ordering, GEF fakes
the exit and calls handleViewerExited()
. The real exit will then
be ignored.
viewerEntered
in interface Tool
me
- the mouse eventviewer
- the originating viewerpublic void viewerExited(MouseEvent me, EditPartViewer viewer)
handleViewerExited()
.
viewerExited
in interface Tool
me
- the mouse eventviewer
- the originating viewer
|
GEF (MVC) 3.8.1.201211122107 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |