|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
| 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
org.eclipse.gef.tools.TargetingTool
public abstract class TargetingTool
The base implementation for tools which perform targeting of editparts.
Targeting tools may operate using either mouse drags or just mouse moves.
Targeting tools work with a target request. This request is used along
with the mouse location to obtain an active target from the current
EditPartViewer. This target is then asked for the Command that
performs the given request. The target is also asked to show target feedback.
TargetingTool also provides support for auto-expose (a.k.a. auto-scrolling).
Subclasses that wish to commence auto-expose can do so by calling
updateAutoexposeHelper(). An an AutoExposeHelper is found,
auto-scrolling begins. Whenever that helper scrolls the diagram of performs
any other change, handleMove will be called as if the mouse had
moved. This is because the target has probably moved, but there is no input
event to trigger an update of the operation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.gef.tools.AbstractTool |
|---|
AbstractTool.Input |
| Field Summary | |
|---|---|
protected static int |
MAX_FLAG
The max flag. |
| Fields inherited from class org.eclipse.gef.tools.AbstractTool |
|---|
MAX_STATE, MOUSE_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_TERMINAL |
| 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 | |
|---|---|
TargetingTool()
|
|
| Method Summary | |
|---|---|
protected Request |
createTargetRequest()
Creates the target request that will be used with the target editpart. |
void |
deactivate()
Deactivates the tool. |
protected void |
doAutoexpose()
Called to perform an iteration of the autoexpose process. |
protected void |
eraseTargetFeedback()
Asks the current target editpart to erase target feedback using the target request. |
protected AutoexposeHelper |
getAutoexposeHelper()
Returns null or the current autoexpose helper. |
protected Command |
getCommand()
Queries the target editpart for a command. |
protected Collection |
getExclusionSet()
Returns a List of objects that should be excluded as potential targets for the operation. |
protected EditPart |
getTargetEditPart()
Returns null or the current target editpart. |
protected EditPartViewer.Conditional |
getTargetingConditional()
Returns the conditional object used for obtaining the target editpart from the current viewer. |
protected Request |
getTargetRequest()
Lazily creates and returns the request used when communicating with the target editpart. |
protected void |
handleAutoexpose()
This method is called whenever an autoexpose occurs. |
protected boolean |
handleEnteredEditPart()
Called whenever the target editpart has changed. |
protected boolean |
handleExitingEditPart()
Called whenever the target editpart is about to change. |
protected boolean |
handleHoverStop()
Called from resetHover() iff hover is active. |
protected boolean |
handleInvalidInput()
Called when invalid input is encountered. |
protected void |
handleLeavingEditPart()
An archaic method name that has been left here to force use of the new name. |
protected boolean |
handleViewerExited()
Sets the target to null. |
protected boolean |
isShowingTargetFeedback()
Returns true if target feedback is being shown. |
protected boolean |
isTargetLocked()
Return true if the current target is locked. |
protected void |
lockTargetEditPart(EditPart editpart)
Locks-in the given editpart as the target. |
protected void |
resetFlags()
Extended to reset the target lock flag. |
protected void |
resetHover()
Resets hovering to inactive. |
protected void |
setAutoexposeHelper(AutoexposeHelper helper)
Sets the active autoexpose helper to the given helper, or null. |
protected void |
setTargetEditPart(EditPart editpart)
Sets the target editpart. |
protected void |
setTargetRequest(Request req)
Sets the target request. |
protected void |
showTargetFeedback()
Asks the target editpart to show target feedback and sets the target feedback flag. |
protected void |
unlockTargetEditPart()
Releases the targeting lock, and updates the target in case the mouse is already over a new target. |
protected void |
updateAutoexposeHelper()
Updates the active AutoexposeHelper. |
protected void |
updateTargetRequest()
Subclasses should override to update the target request. |
protected boolean |
updateTargetUnderMouse()
Updates the target editpart and returns true if the target
changes. |
| 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
| Constructor Detail |
|---|
public TargetingTool()
| Method Detail |
|---|
protected Request createTargetRequest()
getTargetRequest()public void deactivate()
AbstractTool
deactivate in interface Tooldeactivate in class AbstractToolTool.deactivate()protected void doAutoexpose()
protected void eraseTargetFeedback()
protected Command getCommand()
getCommand in class AbstractToolAbstractTool.getCommand()protected Collection getExclusionSet()
protected EditPartViewer.Conditional getTargetingConditional()
EditPart.getTargetEditPart(Request). If null is
returned, then the conditional fails, and the search continues.
EditPartViewer.findObjectAtExcluding(Point, Collection,
EditPartViewer.Conditional)protected EditPart getTargetEditPart()
null or the current target editpart.
null or a target partprotected Request getTargetRequest()
protected void handleAutoexpose()
handleMove() is
called to simulate the mouse moving even though it didn't.
protected boolean handleEnteredEditPart()
trueprotected boolean handleExitingEditPart()
trueprotected boolean handleHoverStop()
true if
something was done in response to the call.
true if the hover stop is processed in some wayAbstractTool.isHoverActive()protected boolean handleInvalidInput()
AbstractTool.STATE_INVALID.
handleInvalidInput in class AbstractTooltrue
protected final void handleLeavingEditPart()
throws Exception
Exception - excprotected boolean handleViewerExited()
null.
handleViewerExited in class AbstractTooltrue if the viewer exited was handledAbstractTool.handleViewerExited()protected boolean isShowingTargetFeedback()
true if target feedback is being shown.
true if showing target feedbackprotected boolean isTargetLocked()
true if the current target is locked.
true if the target is lockedlockTargetEditPart(EditPart)protected void lockTargetEditPart(EditPart editpart)
unlockTargetEditPart() is called.
editpart - the target to be locked-inprotected void resetFlags()
resetFlags in class AbstractToolAbstractTool.resetFlags(),
lockTargetEditPart(EditPart)protected void resetHover()
protected void setAutoexposeHelper(AutoexposeHelper helper)
null. If the helper is not null, a runnable is
queued on the event thread that will trigger a subsequent
doAutoexpose(). The helper is typically updated only on a hover
event.
helper - the new autoexpose helper or nullprotected void setTargetEditPart(EditPart editpart)
handleExitingEditPart() for the previous target if not
null, and handleEnteredEditPart() for the new
target, if not null.
editpart - the new targetprotected void setTargetRequest(Request req)
createTargetRequest().
req - the target requestprotected void showTargetFeedback()
protected void unlockTargetEditPart()
protected void updateAutoexposeHelper()
AutoexposeHelper. Does nothing if there is
still an active helper. Otherwise, obtains a new helper (possible
null) at the current mouse location and calls
setAutoexposeHelper(AutoexposeHelper).
protected void updateTargetRequest()
protected boolean updateTargetUnderMouse()
true if the target
changes. The target is updated by using the target conditional and the
target request. If the target has been locked, this method does nothing
and returns false.
true if the target was changedprotected AutoexposeHelper getAutoexposeHelper()
null or the current autoexpose helper.
|
Eclipse GEF 3.8.0.201206112118 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||