|
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.CreationTool
The CreationTool creates new EditParts
via a CreationFactory
.
If the user simply clicks on the viewer, the default sized EditPart will be created at
that point. If the user clicks and drags, the created EditPart will be sized based on
where the user clicked and dragged.
Nested Class Summary |
Nested classes inherited from class org.eclipse.gef.tools.AbstractTool |
AbstractTool.Input |
Field Summary |
Fields inherited from class org.eclipse.gef.tools.TargetingTool |
MAX_FLAG |
Fields inherited from class org.eclipse.gef.tools.AbstractTool |
MAX_STATE, 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 | |
CreationTool()
Default constructor. |
|
CreationTool(CreationFactory aFactory)
Constructs a new CreationTool with the given factory. |
Method Summary | |
protected Request |
createTargetRequest()
Creates a CreateRequest and sets this tool's factory on the request. |
protected String |
getCommandName()
Returns the identifier of the command that is being sought. |
protected CreateRequest |
getCreateRequest()
Cast the target request to a CreateRequest and returns it. |
protected String |
getDebugName()
Returns the debug name for this tool. |
protected CreationFactory |
getFactory()
Returns the creation factory used to create the new EditParts. |
protected boolean |
handleButtonDown(int button)
The creation tool only works by clicking mouse button 1 (the left mouse button in a right-handed world). |
protected boolean |
handleButtonUp(int button)
If the tool is currently in a drag or drag-in-progress state, it goes into the terminal state, performs some cleanup (erasing feedback, unlocking target edit part), and then calls performCreation(int) . |
protected boolean |
handleDragInProgress()
Updates the request, sets the current command, and asks to show feedback. |
protected boolean |
handleDragStarted()
Called only one time during a drag when the drag threshold has been exceeded. |
protected boolean |
handleFocusLost()
If the user is in the middle of creating a new edit part, the tool erases feedback and goes into the invalid state when focus is lost. |
protected boolean |
handleHover()
Handles high-level processing of a mouse hover event. |
protected boolean |
handleMove()
Updates the request and mouse target, gets the current command and asks to show feedback. |
protected void |
performCreation(int button)
Executes the current command and selects the newly created object. |
void |
setFactory(CreationFactory factory)
Sets the creation factory used to create the new edit parts. |
protected void |
updateTargetRequest()
Sets the location (and size if the user is performing size-on-drop) of the 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 |
Constructor Detail |
public CreationTool()
public CreationTool(CreationFactory aFactory)
aFactory
- the creation factoryMethod Detail |
protected Request createTargetRequest()
CreateRequest
and sets this tool's factory on the request.
createTargetRequest
in class TargetingTool
TargetingTool.createTargetRequest()
protected String getCommandName()
AbstractTool
getCommandName
in class AbstractTool
AbstractTool.getCommandName()
protected CreateRequest getCreateRequest()
TargetingTool.getTargetRequest()
protected String getDebugName()
AbstractTool
getDebugName
in class AbstractTool
AbstractTool.getDebugName()
protected CreationFactory getFactory()
protected boolean handleButtonDown(int button)
TargetingTool.lockTargetEditPart(EditPart)
with the edit part that was
just clicked on.
handleButtonDown
in class AbstractTool
button
- which button went down
true
if the buttonDown was handledAbstractTool.handleButtonDown(int)
protected boolean handleButtonUp(int button)
performCreation(int)
.
handleButtonUp
in class AbstractTool
button
- the button being released
true
if the button up was handledAbstractTool.handleButtonUp(int)
protected boolean handleDragInProgress()
handleDragInProgress
in class AbstractTool
true
if the drag was handledAbstractTool.handleDragInProgress()
protected boolean handleDragStarted()
AbstractTool
false
is returned. Subclasses may override
to interpret the drag starting. Returning true
indicates that the event
was handled.
handleDragStarted
in class AbstractTool
AbstractTool.handleDragStarted()
protected boolean handleFocusLost()
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 handleMove()
handleMove
in class AbstractTool
true
if the mouse move was handledAbstractTool.handleMove()
protected void performCreation(int button)
handleButtonDown(int)
goes into the invalid state if the button pressed is not button 1, this will always be
button 1.
button
- the button that was pressedpublic void setFactory(CreationFactory factory)
factory
- the factoryprotected void updateTargetRequest()
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 |