|
GEF v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.eclipse.gef.internal.FlagSupport
|
+--org.eclipse.gef.tools.AbstractTool
Default implementation support for Tools.
| Inner Class Summary | |
static class |
AbstractTool.Input
Allows the user to access mouse and keyboard input. |
| Field Summary | |
protected static int |
MAX_FLAG
|
protected static int |
MAX_STATE
|
protected static int |
MOUSE_BUTTON_ANY
|
protected static int |
MOUSE_BUTTON1
|
protected static int |
MOUSE_BUTTON2
|
protected static int |
MOUSE_BUTTON3
|
protected static int |
STATE_ACCESSIBLE_DRAG
|
protected static int |
STATE_ACCESSIBLE_DRAG_IN_PROGRESS
|
protected static int |
STATE_DRAG
|
protected static int |
STATE_DRAG_IN_PROGRESS
|
protected static int |
STATE_INITIAL
|
protected static int |
STATE_INVALID
|
protected static int |
STATE_TERMINAL
|
| Constructor Summary | |
AbstractTool()
|
|
| Method Summary | |
void |
activate()
Activates the tool. |
protected void |
addFeedback(IFigure figure)
Adds the given figure to the feedback layer. |
protected Cursor |
calculateCursor()
Determines (and returns) the appropriate cursur. |
void |
commitDrag()
|
protected List |
createOperationSet()
Creates and returns a List of EditParts that the tool
will be working with. |
void |
deactivate()
Deactivates the tool. |
protected void |
debug(String message)
Prints a string in the GEF Debug console if the Tools debug option is selected. |
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()
Re-queries the target viewer object for a command |
protected abstract String |
getCommandName()
Returns the name identifier of the command that the tool is currently looking for. |
protected Command |
getCurrentCommand()
Returns the currently active command. |
protected AbstractTool.Input |
getCurrentInput()
Returns the current mouse and keyboard input. |
protected EditPartViewer |
getCurrentViewer()
Return the viewer that the tool is currently operating on. |
protected abstract 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 Cursor |
getDefaultCursor()
Returns the default Cursor. |
protected Cursor |
getDisabledCursor()
Returns the disabled Cursor. |
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()
Return the current x, y position of the cursor. |
protected List |
getOperationSet()
Returns the collection of editparts that the drag is operating on. |
protected Point |
getStartLocation()
Returns the starting location for the current tool operation. |
protected int |
getState()
Returns the current state. |
protected boolean |
handleButtonDown(int button)
Called when the mouse button has been pressed. |
protected boolean |
handleButtonUp(int button)
Handles the high-level processing of a mouse release. |
protected boolean |
handleDoubleClick(int button)
Handles high-level processing of a double click. |
protected boolean |
handleDrag()
Handles high-level processing of a mouse drag. |
protected boolean |
handleDragInProgress()
Handles high-level processing of a mouse drag once the threshold has been passed. |
protected boolean |
handleDragStarted()
Called once when the drag threshold has been passed. |
protected void |
handleFinished()
Called when the current tool operation is complete. |
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 |
handleKeyDown(KeyEvent e)
Handles high-level processing of a key down 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 |
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. |
void |
keyDown(KeyEvent evt,
EditPartViewer viewer)
Processes a KeyDown event for the given viewer. |
void |
keyUp(KeyEvent evt,
EditPartViewer viewer)
Processes 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. |
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. |
protected boolean |
movedPastThreshold()
Returns true if the mouse has been dragged past
the drag threshold. |
protected void |
reactivate()
Deactivates and then activates
this tool. |
protected void |
refreshCursor()
Selects the appropriate cursor. |
protected void |
releaseToolCapture()
Events will also be sent to the figures after
this method is called. |
protected void |
removeFeedback(IFigure figure)
Removes the given figure from the feedback layer. |
protected void |
resetFlags()
Resets the flags. |
protected void |
setCurrentCommand(Command c)
Sets the current command. |
protected void |
setCursor(Cursor cursor)
Set the cursor on the argument to the not cursor Record the fact we have altered the cursor of this viewer so that when we are deactivated we can go back and set it to normal |
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 the hover flag to true. |
protected void |
setStartLocation(Point p)
|
protected void |
setState(int state)
Sets the tool state. |
protected void |
setToolCapture()
Captures all events and sends them to the tool. |
void |
setUnloadWhenFinished(boolean value)
Setting this to true will cause the tool
to be unloaded after one operation has finished |
void |
setViewer(EditPartViewer viewer)
Sets the viewer to the given EditPartViewer. |
protected boolean |
stateTransition(int start,
int end)
This method attempts to transistion the tool from state start to state end and returns
true if successful. |
protected boolean |
unloadWhenFinished()
Returns true if the tool is set to unload when
its current operation is complete. |
void |
viewerEntered(MouseEvent me,
EditPartViewer viewer)
Handles the mouse entering a viewer. |
void |
viewerExited(MouseEvent me,
EditPartViewer viewer)
Handles the mouse exiting a viewer. |
| Methods inherited from class org.eclipse.gef.internal.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_TERMINAL
protected static final int STATE_INITIAL
protected static final int STATE_DRAG
protected static final int STATE_DRAG_IN_PROGRESS
protected static final int STATE_INVALID
protected static final int STATE_ACCESSIBLE_DRAG
protected static final int STATE_ACCESSIBLE_DRAG_IN_PROGRESS
protected static final int MAX_STATE
protected static final int MOUSE_BUTTON1
protected static final int MOUSE_BUTTON2
protected static final int MOUSE_BUTTON3
protected static final int MOUSE_BUTTON_ANY
protected static final int MAX_FLAG
| Constructor Detail |
public AbstractTool()
| Method Detail |
public void activate()
activate in interface Tooldeactivate()protected void addFeedback(IFigure figure)
protected Cursor calculateCursor()
public void commitDrag()
protected List createOperationSet()
EditParts that the tool
will be working with.public void deactivate()
deactivate in interface Toolactivate()protected void debug(String message)
public void focusGained(FocusEvent event,
EditPartViewer viewer)
focusGained in interface Toolevent - The SWT focus eventviewer - The viewer that the focus event is over.
public void focusLost(FocusEvent event,
EditPartViewer viewer)
focusLost in interface Toolevent - The SWT focus eventviewer - The viewer that the focus event is over.protected void executeCurrentCommand()
protected Command getCommand()
protected abstract String getCommandName()
protected Command getCurrentCommand()
protected AbstractTool.Input getCurrentInput()
protected EditPartViewer getCurrentViewer()
protected abstract String getDebugName()
protected String getDebugNameForState(int state)
protected Cursor getDefaultCursor()
Cursor.protected Cursor getDisabledCursor()
Cursor.protected EditDomain getDomain()
protected Dimension getDragMoveDelta()
protected Point getLocation()
protected List getOperationSet()
protected Point getStartLocation()
protected int getState()
protected boolean handleButtonDown(int button)
protected boolean handleButtonUp(int button)
mouseUp(MouseEvent, EditPartViewer)protected boolean handleDoubleClick(int button)
mouseDoubleClick(MouseEvent, EditPartViewer)protected boolean handleDrag()
mouseDrag(MouseEvent, EditPartViewer)protected boolean handleDragInProgress()
movedPastThreshold(),
mouseDrag(MouseEvent, EditPartViewer)protected boolean handleDragStarted()
movedPastThreshold(),
mouseDrag(MouseEvent, EditPartViewer)protected void handleFinished()
protected boolean handleFocusGained()
focusGained(FocusEvent, EditPartViewer)protected boolean handleFocusLost()
focusLost(FocusEvent, EditPartViewer)protected boolean handleHover()
mouseHover(MouseEvent, EditPartViewer)protected boolean handleKeyDown(KeyEvent e)
keyDown(KeyEvent, EditPartViewer)protected boolean handleKeyUp(KeyEvent e)
keyUp(KeyEvent, EditPartViewer)protected boolean handleMove()
mouseMove(MouseEvent, EditPartViewer)protected boolean handleViewerEntered()
protected boolean handleViewerExited()
protected boolean isActive()
true if the tool is active.protected boolean isHoverActive()
true if the tool is hovering.protected boolean isInState(int state)
true if the tool is in the given state.
public void keyDown(KeyEvent evt,
EditPartViewer viewer)
handleKeyDown(KeyEvent).keyDown in interface Tool
public void keyUp(KeyEvent evt,
EditPartViewer viewer)
handleKeyUp(KeyEvent).keyUp in interface Toolprotected boolean movedPastThreshold()
true if the mouse has been dragged past
the drag threshold.
public void mouseDoubleClick(MouseEvent me,
EditPartViewer viewer)
handleDoubleClick(int).mouseDoubleClick in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.
public void mouseDown(MouseEvent me,
EditPartViewer viewer)
handleButtonDown(int).mouseDown in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.
public void mouseDrag(MouseEvent me,
EditPartViewer viewer)
handleDrag() and/or
handleDragInProgress().mouseDrag in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.
public void mouseHover(MouseEvent me,
EditPartViewer viewer)
handleHover().mouseHover in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.
public void mouseMove(MouseEvent me,
EditPartViewer viewer)
handleMove().mouseMove in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.
public void mouseUp(MouseEvent me,
EditPartViewer viewer)
handleButtonUp(int).mouseUp in interface Toolorg.eclipse.gef.ToolmouseEvent - org.eclipse.swt.events.MouseEvent The SWT mouse eventviewer - org.eclipse.gef.IViewer The viewer that the mouse event is over.protected void reactivate()
Deactivates and then activates
this tool.protected void refreshCursor()
calculateCursor()protected void releaseToolCapture()
figures after
this method is called.setToolCapture()protected void removeFeedback(IFigure figure)
protected void resetFlags()
protected void setCurrentCommand(Command c)
protected void setCursor(Cursor cursor)
public void setDefaultCursor(Cursor cursor)
public void setDisabledCursor(Cursor cursor)
public void setEditDomain(EditDomain domain)
setEditDomain in interface Toolprotected void setHoverActive(boolean value)
protected void setStartLocation(Point p)
protected void setState(int state)
protected void setToolCapture()
releaseToolCapture()public void setUnloadWhenFinished(boolean value)
true will cause the tool
to be unloaded after one operation has finishedpublic void setViewer(EditPartViewer viewer)
setViewer in interface Tool
protected boolean stateTransition(int start,
int end)
start to state end and returns
true if successful. If the tool is not in
state start, the tool remains in its current
state and false is returned to indicate
the failure.protected final boolean unloadWhenFinished()
true if the tool is set to unload when
its current operation is complete.
public void viewerEntered(MouseEvent me,
EditPartViewer viewer)
handleViewerEntered().viewerEntered in interface Tool
public void viewerExited(MouseEvent me,
EditPartViewer viewer)
handleViewerExited().viewerExited in interface Tool
|
GEF v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||