Runtime

## org.eclipse.gmf.runtime.diagram.ui.tools
Class CreationTool

    java.lang.Object
      org.eclipse.gef.util.FlagSupport
          org.eclipse.gef.tools.AbstractTool
              org.eclipse.gef.tools.TargetingTool
                  org.eclipse.gef.tools.CreationTool
                      org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool

All Implemented Interfaces:
  RequestConstants, Tool

Direct Known Subclasses:
  UnspecifiedTypeCreationTool

public class CreationTool
extends CreationTool

Generic Creation Tool - creates a semantic model element and a view for it The usual usecase is to create "one" element and view. However, in case multiple elements are needed, specialized Semantic and View requests are needed to create new adapters that can adapt to multiple semantic elements and views in the same time

Nested Class Summary

Nested classes inherited from class org.eclipse.gef.tools.AbstractTool
`AbstractTool.Input`

Field Summary
`protected boolean` `antiScroll` the anti scroll flag

Fields inherited from class org.eclipse.gef.tools.CreationTool
`PROPERTY_CREATION_FACTORY`

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, 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
`protected` `CreationTool()` Default constructor to allow subclasses to not require an element type.
`` `CreationTool(IElementType elementType)` Method CreationTool.

Method Summary
`Request` `createCreateRequest()` Creates the request.
`protected void` `createShapeAt(Point point)` Create the shape corresponding to the current selected tool on the current diagram at the `point` specified
`protected Request` `createTargetRequest()`
`void` `deactivate()` Since both the view and semantic requests contain results we need to free them when the tool is deactivated
`protected void` `doAutoexpose()`
`protected Command` `getCommand()`
`IElementType` `getElementType()`
`protected PreferencesHint` `getPreferencesHint()` Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.
`protected boolean` `handleDoubleClick(int button)` Handles double click to create the shape in defualt position
`protected void` `handleFinished()` Overridden so that the current tool will remain active (locked) if the user is pressing the ctrl key.
`protected boolean` `handleKeyUp(KeyEvent e)`
`protected boolean` `handleMove()`
`protected void` `performCreation(int button)`
`protected void` `revealEditPart(EditPart editPart)` Reveals the newly created editpart
`protected void` `selectAddedObject(EditPartViewer viewer, java.util.Collection objects)` Select the newly added shape view by default
`void` `selectNewShapes(EditPartViewer viewer, java.util.Collection objects)` Selects the new shapes and puts them in direct edit mode if desired.
`protected void` `setTargetEditPart(EditPart editpart)`

Methods inherited from class org.eclipse.gef.tools.CreationTool
`applyProperty, calculateCursor, getCommandName, getCreateRequest, getDebugName, getFactory, handleButtonDown, handleButtonUp, handleDragInProgress, handleDragStarted, handleFocusLost, handleHover, setFactory, updateTargetRequest`

Methods inherited from class org.eclipse.gef.tools.TargetingTool

`eraseTargetFeedback, getAutoexposeHelper, getExclusionSet, getTargetEditPart, getTargetingConditional, getTargetRequest, handleAutoexpose, handleEnteredEditPart, handleExitingEditPart, handleHoverStop, handleInvalidInput, handleLeavingEditPart, handleViewerExited, isShowingTargetFeedback, isTargetLocked, lockTargetEditPart, resetFlags, setAutoexposeHelper, setTargetRequest, showTargetFeedback, unlockTargetEditPart, updateAutoexposeHelper, updateTargetUnderMouse`

Methods inherited from class org.eclipse.gef.tools.AbstractTool

`activate, addFeedback, commitDrag, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDrag, handleFocusGained, handleKeyDown, handleKeyTraversed, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, reactivate, refreshCursor, releaseToolCapture, removeFeedback, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setState, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExited`

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

### antiScroll

    protected boolean antiScroll

  the anti scroll flag

Constructor Detail

### CreationTool

    public CreationTool(IElementType elementType)

  Method CreationTool. Creates a new CreationTool with the given elementTypeInfo, and a defailt viewKind equals IShapeView and a default empty semanticHint

Parameters:
  `elementType` -

### CreationTool

    protected CreationTool()

  Default constructor to allow subclasses to not require an element type.

Method Detail

### getPreferencesHint

    protected PreferencesHint getPreferencesHint()

  Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

  Returns:
    the preferences hint

### createTargetRequest

    protected Request createTargetRequest()

### deactivate

    public void deactivate()

  Since both the view and semantic requests contain results we need to free them when the tool is deactivated

### performCreation

    protected void performCreation(int button)

### selectAddedObject

    protected void selectAddedObject(EditPartViewer viewer,
                                     java.util.Collection objects)

  Select the newly added shape view by default

  Parameters:
    `viewer` -
    `objects` -

### handleDoubleClick

    protected boolean handleDoubleClick(int button)

  Handles double click to create the shape in defualt position

### createShapeAt

    protected void createShapeAt(Point point)

  Create the shape corresponding to the current selected tool on the current diagram at the `point` specified

  Parameters:
    `point` - to create shape at

### handleKeyUp

    protected boolean handleKeyUp(KeyEvent e)

### setTargetEditPart

    protected void setTargetEditPart(EditPart editpart)

### getElementType

    public IElementType getElementType()

  Returns:
    Returns the elementType.

### handleFinished

    protected void handleFinished()

  Overridden so that the current tool will remain active (locked) if the user is pressing the ctrl key.

### handleMove

    protected boolean handleMove()

### doAutoexpose

    protected void doAutoexpose()

### getCommand

    protected Command getCommand()

### revealEditPart

    protected void revealEditPart(EditPart editPart)

  Reveals the newly created editpart

  Parameters:
    `editPart` -

### createCreateRequest

    public final Request createCreateRequest()

  Creates the request.

  See Also:
    `CreationTool.createTargetRequest()`

### selectNewShapes

    public final void selectNewShapes(EditPartViewer viewer,
                                      java.util.Collection objects)

  Selects the new shapes and puts them in direct edit mode if desired.

  Parameters:
    `viewer` - the editpart viewer
    `objects` - the collection of new shapes
  See Also:
    `CreationTool.selectAddedObject(EditPartViewer, Collection)`

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.