|
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.SelectionTool
Tool to select and manipulate figures. A selection tool is in one of three states, e.g., background selection, figure selection, handle manipulation. The different states are handled by different child tools.
Nested Class Summary |
Nested classes inherited from class org.eclipse.gef.tools.AbstractTool |
AbstractTool.Input |
Field Summary | |
protected static int |
MAX_FLAG
Max flag |
protected static int |
MAX_STATE
Max state |
protected static int |
STATE_TRAVERSE_HANDLE
Traverse handle state |
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 | |
SelectionTool()
Default constructor. |
Method Summary | |
protected void |
createHoverRequest()
Creates the hover request (a LocationRequest ) and sets its type to
RequestConstants.REQ_SELECTION_HOVER . |
protected Request |
createTargetRequest()
Creates a SelectionRequest for the target request. |
void |
deactivate()
Deactivates the tool. |
protected void |
eraseHoverFeedback()
Erases the hover feedback by calling EditPart.eraseTargetFeedback(Request) . |
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 state)
Returns a String representation of the given state for debug purposes. |
protected DragTracker |
getDragTracker()
Returns the current drag tracker. |
protected Request |
getTargetHoverRequest()
Returns the target hover request. |
protected EditPartViewer.Conditional |
getTargetingConditional()
Returns a new Conditional that evaluates to true if the queried edit
part's EditPart.isSelectable() method returns true . |
protected boolean |
handleButtonDown(int button)
If there is a Handle under the mouse, this method sets the drag tracker
returned from the handle. |
protected boolean |
handleButtonUp(int button)
Resets this tool when the last button is released. |
protected boolean |
handleFocusLost()
Sets the drag tracker to null and goes into the initial state when focus
is lost. |
protected boolean |
handleHover()
Called when the mouse hovers. |
protected boolean |
handleHoverStop()
Called when the mouse hover stops (i.e. the mouse moves or a button is clicked). |
protected boolean |
handleKeyDown(KeyEvent e)
Processes key down events. |
protected boolean |
handleKeyUp(KeyEvent e)
If in the initial state and the viewer has a KeyHandler , calls
KeyHandler.keyReleased(KeyEvent) sending it the given key event. |
protected boolean |
handleMove()
If in the initial state, updates the request and the mouse target and asks to show target feedback. |
boolean |
handleNativeDragFinished(DragSourceEvent event)
If there's a drag tracker, calls handleNativeDragFinished() on the drag tracker and then sets the drag tracker to null . |
boolean |
handleNativeDragStarted(DragSourceEvent event)
If there's a drag tracker, calls nativeDragStarted() on the drag tracker. |
protected boolean |
handleViewerExited()
If there's a drag tracker, sets it to null and then sets this tool's
state to the initial state. |
void |
keyDown(KeyEvent evt,
EditPartViewer viewer)
Forwards the key down event to the drag tracker, if one exists. |
void |
keyUp(KeyEvent evt,
EditPartViewer viewer)
Forwards the key up event to the drag tracker, if one exists. |
void |
mouseDoubleClick(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse double clicked event to the drag tracker, if one exists. |
void |
mouseDown(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse down event to the drag tracker, if one exists. |
void |
mouseDrag(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse drag event to the drag tracker, if one exists. |
void |
mouseHover(MouseEvent me,
EditPartViewer viewer)
Forwards the mouse hover event to the drag tracker, if one exists. |
void |
mouseMove(MouseEvent me,
EditPartViewer viewer)
Forwards the mouse move event to the drag tracker, if one exists. |
void |
mouseUp(MouseEvent e,
EditPartViewer viewer)
Forwards the mouse up event to the drag tracker, if one exists. |
protected void |
refreshCursor()
If there is a drag tracker, this method does nothing so that the drag tracker can take care of the cursor. |
void |
setDragTracker(DragTracker newDragTracker)
Sets the drag tracker for this SelectionTool. |
protected void |
showHoverFeedback()
Asks the target edit part (if there is one) to show hover feedback via EditPart.showTargetFeedback(Request) with a hover request. |
protected void |
updateHoverRequest()
Updates the location of the hover request. |
protected void |
updateTargetRequest()
Sets the modifiers , type and location of the target request (which is a SelectionRequest ) and then calls updateHoverRequest() . |
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 MAX_FLAG
protected static final int STATE_TRAVERSE_HANDLE
protected static final int MAX_STATE
Constructor Detail |
public SelectionTool()
Method Detail |
protected void createHoverRequest()
LocationRequest
) and sets its type to
RequestConstants.REQ_SELECTION_HOVER
.
protected Request createTargetRequest()
SelectionRequest
for the target request.
createTargetRequest
in class TargetingTool
TargetingTool.createTargetRequest()
public void deactivate()
null
.
deactivate
in interface Tool
deactivate
in class TargetingTool
Tool.deactivate()
protected void eraseHoverFeedback()
EditPart.eraseTargetFeedback(Request)
.
protected String getCommandName()
AbstractTool
getCommandName
in class AbstractTool
AbstractTool.getCommandName()
protected String getDebugName()
AbstractTool
getDebugName
in class AbstractTool
AbstractTool.getDebugName()
protected DragTracker getDragTracker()
protected EditPartViewer.Conditional getTargetingConditional()
true
if the queried edit
part's EditPart.isSelectable()
method returns true
.
getTargetingConditional
in class TargetingTool
TargetingTool.getTargetingConditional()
protected Request getTargetHoverRequest()
null
, it will be created via
createHoverRequest()
.
protected boolean handleButtonDown(int button)
Handle
under the mouse, this method sets the drag tracker
returned from the handle. If there's an EditPart
under the mouse, this method
sets the drag tracker returned from the edit part.
handleButtonDown
in class AbstractTool
button
- which button went down
true
if the buttonDown was handledAbstractTool.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 handleFocusLost()
null
and goes into the initial state when focus
is lost.
handleFocusLost
in class AbstractTool
true
if the event was handledAbstractTool.handleFocusLost()
protected boolean handleHover()
showHoverFeedback()
.
handleHover
in class AbstractTool
true
if the hover was handledAbstractTool.handleHover()
protected boolean handleHoverStop()
eraseHoverFeedback()
.
handleHoverStop
in class TargetingTool
true
if the hover stop is processed in some wayTargetingTool.handleHoverStop()
protected boolean handleKeyDown(KeyEvent e)
KeyHandler
, it calls KeyHandler.keyPressed(KeyEvent)
.
handleKeyDown
in class AbstractTool
e
- the key event
true
if the key down was handled.AbstractTool.handleKeyDown(org.eclipse.swt.events.KeyEvent)
protected boolean handleKeyUp(KeyEvent e)
KeyHandler
, calls
KeyHandler.keyReleased(KeyEvent)
sending it the given key event.
handleKeyUp
in class AbstractTool
e
- the key event
true
if the event was handledAbstractTool.handleKeyUp(org.eclipse.swt.events.KeyEvent)
protected boolean handleMove()
handleMove
in class AbstractTool
true
if the mouse move was handledAbstractTool.handleMove()
public boolean handleNativeDragFinished(DragSourceEvent event)
null
.
handleNativeDragFinished
in class AbstractTool
event
- the drag event
true
if the native drag finished was handledTool.nativeDragFinished(DragSourceEvent, EditPartViewer)
public boolean handleNativeDragStarted(DragSourceEvent event)
handleNativeDragStarted
in class AbstractTool
event
- the drag event
true
if the native drag start was handledTool.nativeDragStarted(DragSourceEvent, EditPartViewer)
protected boolean handleViewerExited()
null
and then sets this tool's
state to the initial state.
handleViewerExited
in class TargetingTool
AbstractTool.handleViewerExited()
public void keyDown(KeyEvent evt, EditPartViewer viewer)
keyDown
in interface Tool
keyDown
in class AbstractTool
evt
- the key eventviewer
- the origininating viewerTool.keyDown(org.eclipse.swt.events.KeyEvent,
org.eclipse.gef.EditPartViewer)
public void keyUp(KeyEvent evt, EditPartViewer viewer)
keyUp
in interface Tool
keyUp
in class AbstractTool
evt
- the key eventviewer
- the origininating viewerTool.keyUp(org.eclipse.swt.events.KeyEvent,
org.eclipse.gef.EditPartViewer)
public void mouseDown(MouseEvent e, EditPartViewer viewer)
mouseDown
in interface Tool
mouseDown
in class AbstractTool
e
- the mouse eventviewer
- the originating viewerTool.mouseDown(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
public void mouseDoubleClick(MouseEvent e, EditPartViewer viewer)
mouseDoubleClick
in interface Tool
mouseDoubleClick
in class AbstractTool
e
- the mouse eventviewer
- the originating viewerTool.mouseDoubleClick(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
public void mouseDrag(MouseEvent e, EditPartViewer viewer)
mouseDrag
in interface Tool
mouseDrag
in class AbstractTool
e
- the mouse eventviewer
- the originating viewerTool.mouseDrag(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
public void mouseHover(MouseEvent me, EditPartViewer viewer)
mouseHover
in interface Tool
mouseHover
in class AbstractTool
me
- the mouse eventviewer
- the originating viewerTool.mouseHover(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
public void mouseMove(MouseEvent me, EditPartViewer viewer)
mouseMove
in interface Tool
mouseMove
in class AbstractTool
me
- the mouse eventviewer
- the originating viewerTool.mouseMove(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
public void mouseUp(MouseEvent e, EditPartViewer viewer)
mouseUp
in interface Tool
mouseUp
in class AbstractTool
e
- the mouse eventviewer
- the originating viewerTool.mouseUp(org.eclipse.swt.events.MouseEvent,
org.eclipse.gef.EditPartViewer)
protected void refreshCursor()
super
.
refreshCursor
in class AbstractTool
AbstractTool.refreshCursor()
public void setDragTracker(DragTracker newDragTracker)
null
, this method deactivates it. If the new drag tracker is not
null
, this method will activate it and set the EditDomain
and
EditPartViewer
.
newDragTracker
- the new drag trackerprotected void showHoverFeedback()
EditPart.showTargetFeedback(Request)
with a hover request.
protected void updateHoverRequest()
protected void updateTargetRequest()
SelectionRequest
) and then calls updateHoverRequest()
.
updateTargetRequest
in class TargetingTool
TargetingTool.updateTargetRequest()
protected String getDebugNameForState(int state)
AbstractTool
getDebugNameForState
in class AbstractTool
state
- the state
AbstractTool.getDebugNameForState(int)
|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |