Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.swtbot.eclipse.gef.finder.widgets
Class SWTBotGefEditor

    java.lang.Object
      org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart<IEditorReference>
          org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor
              org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor

    public class SWTBotGefEditor

extends SWTBotEditor

represent a graphical editor that uses the GEF framework. The underlying editor must adapt to a `GraphicalViewer` which must extend `GraphicalViewerImpl` (this is the default for all GEF-based editors that extend `GraphicalEditor`). Unlike most of SWTBot, this editor uses `edit parts` to target UI events instead of SWT widgets. This is due to the fact that GEF editors paint on a canvas and rarely use widgets at all.

Author:
  David Green

Field Summary
`protected SWTBotGefViewer` | `viewer`

Fields inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart
`bot, log, partReference`

Constructor Summary
`SWTBotGefEditor(IEditorReference reference, SWTWorkbenchBot bot)` Create a new bot GEF editor instance.

Method Summary
`void` | `activateDefaultTool()` Activate the default tool.
`SWTBotGefEditor` | `activateTool(String label)` Activate the tool with the specified label.
`SWTBotGefEditor` | `activateTool(String label, int index)` Activate the tool with the specified label and the specified index.
`void` | `clear()` clear the cache of edit parts
`void` | `click(int xPosition, int yPosition)` Click on the editor at the specified location.
`void` | `click(String label)` Click on the edit part which owns the specified label at the top left hand corner of its bounds.
`void` | `click(SWTBotGefEditPart editPart)` Click on the specified edit part at the top left hand corner of its bounds.
`SWTBotGefEditor` | `clickContextMenu(String text)`
`protected SWTBotGefConnectionEditPart` | `createEditPart(org.eclipse.gef.ConnectionEditPart part)` lazily creates a `SWTBotGefConnectionEditPart` if this edit part does not exist yet.
`protected SWTBotGefEditPart` | `createEditPart(org.eclipse.gef.EditPart part)` lazily creates a `SWTBotGefEditPart` if this edit part does not exist yet.
`void` | `directEditType(String text)` type the given text into the graphical editor, presuming that it is already in 'direct edit' mode.
`void` | `doubleClick(int xPosition, int yPosition)` Double click on the editor at the specified location.
`void` | `doubleClick(String label)` Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its bounds.
`void` | `doubleClick(SWTBotGefEditPart editPart)` Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its bounds.
`void` | `drag(int fromXPosition, int fromYPosition, int toXPosition, int toYPosition)` Drag and drop from the specified to the specified location.
`void` | `drag(String label, int toXPosition, int toYPosition)` Drag and drop the edit part which owns the specified label to the specified location
`void` | `drag(SWTBotGefEditPart editPart, int toXPosition, int toYPosition)` Drag and drop the specified edit part to the specified location.
`List<SWTBotGefEditPart>` | `editParts(Matcher<? extends org.eclipse.gef.EditPart> matcher)`
`org.eclipse.gef.palette.ToolEntry` | `getActiveTool()` Get the active tool.
`SWTBotGefEditPart` | `getEditPart(String label)` get this edit part with the label as a single selection.
`SWTBotGefEditPart` | `getEditpart(String label, List<SWTBotGefEditPart> allEditParts)` Deprecated.
`SWTBotGefViewer` | `getSWTBotGefViewer()` Get the wrapped SWTBotGefViewer instance.
`boolean` | `isActive()`
`SWTBotGefEditPart` | `mainEditPart()`
`void` | `mouseDrag(int fromXPosition, int fromYPosition, int toXPosition, int toYPosition)` Deprecated.
`void` | `mouseDrag(String label, int toXPosition, int toYPosition)` Deprecated.
`void` | `mouseMoveDoubleClick(int xPosition, int yPosition)` Deprecated.
`void` | `mouseMoveDoubleClick(String label)` Deprecated.
`void` | `mouseMoveLeftClick(int xPosition, int yPosition)` Deprecated.
`void` | `mouseMoveLeftClick(String label)` Deprecated.
`SWTBotGefEditPart` | `rootEditPart()` retrieve the root edit part.
`SWTBotGefEditor` | `select(Collection<SWTBotGefEditPart> parts)` select this edit part as a single selection
`SWTBotGefEditor` | `select(String label)` select the edit part with the label as a single selection.
`SWTBotGefEditor` | `select(SWTBotGefEditPart... parts)` select this edit part as a single selection
`List<SWTBotGefEditPart>` | `selectedEditParts()` Get the selected edit parts.
`void` | `setFocus()` Sets focus on the current part.

Methods inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor
`close, isDirty, save, saveAndClose, show, toTextEditor`

Methods inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart
`assertActive, bot, findWidget, findWidgets, getReference, getTitle, getToolbarButtons, getWidget, toolbarButton, toolbarDropDownButton, toolbarPushButton, toolbarRadioButton, toolbarToggleButton`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### viewer

    protected final SWTBotGefViewer viewer

Constructor Detail

### SWTBotGefEditor

    public SWTBotGefEditor(IEditorReference reference,
                           SWTWorkbenchBot bot)
                    throws WidgetNotFoundException

  Create a new bot GEF editor instance.

  Parameters:
    `reference` - the editor reference
    `bot` - the workbench bot
  Throws:
    `WidgetNotFoundException` - if widget could not be found

Method Detail

### getSWTBotGefViewer

    public SWTBotGefViewer getSWTBotGefViewer()

  Get the wrapped SWTBotGefViewer instance.

  Returns:
    a SWTBotGefViewer instance

### clear

    public void clear()

  clear the cache of edit parts

### mainEditPart

    public SWTBotGefEditPart mainEditPart()
                                   throws WidgetNotFoundException

  Throws:
    `WidgetNotFoundException`

### rootEditPart

    public SWTBotGefEditPart rootEditPart()
                                   throws WidgetNotFoundException

  retrieve the root edit part.

  Returns:
    the root edit part
  Throws:
    `WidgetNotFoundException` - if root edit part could not be found
  See Also:
    `GraphicalViewer#getRootEditPart()}`

### selectedEditParts

    public List<SWTBotGefEditPart> selectedEditParts()

  Get the selected edit parts.

  Returns:
    the selected edit parts

### createEditPart

    protected SWTBotGefEditPart createEditPart(org.eclipse.gef.EditPart part)

  lazily creates a `SWTBotGefEditPart` if this edit part does not exist yet. If an instance encapsulating the specified edit part has been created before, that instance is returned.

  Parameters:
    `part` - the edit part to create a `SWTBotGefEditPart` for
  Returns:
    the created `SWTBotGefEditPart`

### createEditPart

    protected SWTBotGefConnectionEditPart createEditPart(org.eclipse.gef.ConnectionEditPart part)

  lazily creates a `SWTBotGefConnectionEditPart` if this edit part does not exist yet. If an instance encapsulating the specified edit part has been created before, that instance is returned.

  Parameters:
    `part` - a connection edit part connecting graphical nodes
  Returns:
    a `SWTBotGefConnectionEditPart` encapsulating the connection edit part

### getActiveTool

    public org.eclipse.gef.palette.ToolEntry getActiveTool()

  Get the active tool.

  Returns:
    the active tool

### activateDefaultTool

    public void activateDefaultTool()

  Activate the default tool.

### activateTool

    public SWTBotGefEditor activateTool(String label)
                                 throws WidgetNotFoundException

  Activate the tool with the specified label. If there is many tools with the same label the first one will be used. See `activateTool(String, int)`

  Parameters:
    `label` - the label of the tool to activate
  Returns:
    the editor bot
  Throws:
    `WidgetNotFoundException` - if the tool with label specified could not be found

### activateTool

    public SWTBotGefEditor activateTool(String label,
                                        int index)
                                 throws WidgetNotFoundException

  Activate the tool with the specified label and the specified index. This method should be used only if there is many tools with the same label. See `activateTool(String)`

  Parameters:
    `label` - the label of the tool to activate
    `index` - the index to use in order to make the selection.
  Returns:
    the editor bot
  Throws:
    `WidgetNotFoundException` - if the tool with label specified could not be found

### directEditType

    public void directEditType(String text)
                        throws WidgetNotFoundException

  type the given text into the graphical editor, presuming that it is already in 'direct edit' mode.

  Parameters:
    `text` - the text to type.
  Throws:
    `WidgetNotFoundException`

### editParts

    public List<SWTBotGefEditPart> editParts(Matcher<? extends org.eclipse.gef.EditPart> matcher)
                                      throws WidgetNotFoundException

  Parameters:
    `matcher` - the matcher that matches on `EditPart`
  Returns:
    a collection of `SWTBotGefEditPart`
  Throws:
    `WidgetNotFoundException`

### select

    public SWTBotGefEditor select(SWTBotGefEditPart... parts)

  select this edit part as a single selection

### select

    public SWTBotGefEditor select(Collection<SWTBotGefEditPart> parts)

  select this edit part as a single selection

### isActive

    public boolean isActive()

  Overrides:
    `isActive` in class `SWTBotEditor`
  Returns:
    `true` if the part is currently active.

### setFocus

    public void setFocus()

  Description copied from class: `SWTBotWorkbenchPart`
  Sets focus on the current part.

  Overrides:
    `setFocus` in class `SWTBotEditor`

### clickContextMenu

    public SWTBotGefEditor clickContextMenu(String text)
                                     throws WidgetNotFoundException

  Throws:
    `WidgetNotFoundException`

### click

    public void click(int xPosition,
                      int yPosition)

  Click on the editor at the specified location.

  Parameters:
    `xPosition` - the x relative position
    `yPosition` - the y relative position

### click

    public void click(SWTBotGefEditPart editPart)

  Click on the specified edit part at the top left hand corner of its bounds.

  Parameters:
    `editPart` - the edit part to click on

### click

    public void click(String label)

  Click on the edit part which owns the specified label at the top left hand corner of its bounds.

  Parameters:
    `label` - the label to retrieve edit part to click on

### doubleClick

    public void doubleClick(int xPosition,
                            int yPosition)

  Double click on the editor at the specified location.

  Parameters:
    `xPosition` - the x relative position
    `yPosition` - the y relative position

### doubleClick

    public void doubleClick(SWTBotGefEditPart editPart)

  Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its bounds.

  Parameters:
    `editPart` - the edit part to double click on

### doubleClick

    public void doubleClick(String label)

  Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its bounds.

  Parameters:
    `label` - the label to retrieve edit part to double click on

### drag

    public void drag(int fromXPosition,
                     int fromYPosition,
                     int toXPosition,
                     int toYPosition)

  Drag and drop from the specified to the specified location.

  Parameters:
    `toXPosition` - the x relative location
    `toYPosition` - the y relative location

### drag

    public void drag(SWTBotGefEditPart editPart,
                     int toXPosition,
                     int toYPosition)

  Drag and drop the specified edit part to the specified location.

  Parameters:
    `editPart` - the edit part to drag and drop
    `toXPosition` - the x relative location
    `toYPosition` - the y relative location

### drag

    public void drag(String label,
                     int toXPosition,
                     int toYPosition)

  Drag and drop the edit part which owns the specified label to the specified location

  Parameters:
    `label` - the label to retrieve the edit part to drag and drop
    `toXPosition` - the x relative position
    `toYPosition` - the y relative position

### select

    public SWTBotGefEditor select(String label)

  select the edit part with the label as a single selection.

### getEditPart

    public SWTBotGefEditPart getEditPart(String label)

  get this edit part with the label as a single selection.

### getEditpart

    @Deprecated
    public SWTBotGefEditPart getEditpart(String label,
                                                    List<SWTBotGefEditPart> allEditParts)

  Deprecated.

### mouseDrag

    @Deprecated
    public void mouseDrag(int fromXPosition,
                                     int fromYPosition,
                                     int toXPosition,
                                     int toYPosition)

  Deprecated.

### mouseDrag

    @Deprecated
    public void mouseDrag(String label,
                                     int toXPosition,
                                     int toYPosition)

  Deprecated.

### mouseMoveDoubleClick

    @Deprecated
    public void mouseMoveDoubleClick(int xPosition,
                                                int yPosition)

  Deprecated.

### mouseMoveDoubleClick

    @Deprecated
    public void mouseMoveDoubleClick(String label)

  Deprecated.

### mouseMoveLeftClick

    @Deprecated
    public void mouseMoveLeftClick(int xPosition,
                                              int yPosition)

  Deprecated.

### mouseMoveLeftClick

    @Deprecated
    public void mouseMoveLeftClick(String label)

  Deprecated.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD