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.swt.finder.finders
Class Finder

    java.lang.Object
      org.eclipse.swtbot.swt.finder.finders.Finder

    public class Finder

extends Object

A wrapper around `ControlFinder` and `MenuFinder` that delegates to either of them.

Version:
  $Id$
Author:
  Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Constructor Summary
`Finder(ControlFinder controlFinder, MenuFinder menuFinder)` Constructs the finder with the given control and menu finder.
`Finder(Finder finder, MenuFinder menuFinder)` Establishes the finder from an existing finder (control finder only) and the given new menu finder.

Method Summary
`Shell` | `activeShell()` Gets the currently active shell.
`
`<T extends Widget> List<T>`
` | `findControls(List<Widget> children, Matcher<T> matcher, boolean recursive)` Finds the controls matching one of the widgets using the given matcher.
`
`<T extends Widget> List<T>`
` | `findControls(Matcher<T> matcher)` Finds the controls in the active shell matching the given matcher.
`
`<T extends Widget> List<T>`
` | `findControls(Widget widget, Matcher<T> matcher, boolean recursive)` Finds the controls starting with the given parent widget and uses the given matcher.
`List<MenuItem>` | `findMenus(Matcher<MenuItem> matcher)` Finds a menu matching the given item in all available shells.
`List<MenuItem>` | `findMenus(Menu bar, Matcher<MenuItem> matcher, boolean recursive)` Fins all the menus in the given menu bar matching the given matcher.
`List<MenuItem>` | `findMenus(Shell[] shells, Matcher<MenuItem> matcher, boolean recursive)` Finds all the menus using the given matcher in the set of shells provided.
`List<MenuItem>` | `findMenus(Shell shell, Matcher<MenuItem> matcher, boolean recursive)` Finds the menus in the given shell using the given matcher.
`List<Shell>` | `findShells(String text)` Finds the shell matching the given text (shell.getText()).
`Display` | `getDisplay()` Gets the display that has been set.
`TreePath` | `getPath(Widget w)` Gets the path to the widget.
`Shell[]` | `getShells()` Gets the shells registered with the display.
`void` | `setShouldFindInvisibleControls(boolean shouldFindInVisibleControls)` This sets the flag to know if items should be returned if they are not visible.
`boolean` | `shouldFindInvisibleControls()` Checks if this should return items that are not visible when performing the search for controls.

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

Constructor Detail

### Finder

    public Finder(ControlFinder controlFinder,
                  MenuFinder menuFinder)

  Constructs the finder with the given control and menu finder.

  Parameters:
    `controlFinder` - the finder that finds controls.
    `menuFinder` - the finder that finds menus.

### Finder

    public Finder(Finder finder,
                  MenuFinder menuFinder)

  Establishes the finder from an existing finder (control finder only) and the given new menu finder.

  Parameters:
    `finder` - the finder
    `menuFinder` - the finder that finds menus.

Method Detail

### activeShell

    public Shell activeShell()

  Gets the currently active shell.

  Returns:
    the active shell.
  See Also:
    `ControlFinder.activeShell()`

### findControls

    public <T extends Widget> List<T> findControls(Matcher<T> matcher)

  Finds the controls in the active shell matching the given matcher.

  This method is thread safe.

  Parameters:
    `matcher` - the matcher used to find controls in the active shell.
  Returns:
    all controls in the active shell that the matcher matches.
  See Also:
    `ControlFinder.findControls(Matcher)`

### findControls

    public <T extends Widget> List<T> findControls(List<Widget> children,
                                                   Matcher<T> matcher,
                                                   boolean recursive)

  Finds the controls matching one of the widgets using the given matcher. If recursive is set, it will attempt to recursively find the controls in each `children` widget if they exist.

  Parameters:
    `children` - the list of widgets.
    `matcher` - the matcher used to match the widgets.
    `recursive` - if the match should be recursive.
  Returns:
    all visible widgets in the children that the matcher matches. If recursive is `true` then find the widgets within each of the widget.
  See Also:
    `ControlFinder.findControls(List, Matcher, boolean)`

### findControls

    public <T extends Widget> List<T> findControls(Widget widget,
                                                   Matcher<T> matcher,
                                                   boolean recursive)

  Finds the controls starting with the given parent widget and uses the given matcher. If recursive is set, it will attempt to find the controls in each child widget if they exist.

  This method is thread safe.

  Parameters:
    `widget` - the parent widget in which controls should be found.
    `matcher` - the matcher used to match the widgets.
    `recursive` - if the match should be recursive.
  Returns:
    all visible widgets in the parentWidget that the matcher matches. If recursive is `true` then find the widget within each of the parentWidget.
  See Also:
    `ControlFinder.findControls(Widget, Matcher, boolean)`

### findShells

    public List<Shell> findShells(String text)

  Finds the shell matching the given text (shell.getText()).

  Parameters:
    `text` - The text on the Shell
  Returns:
    A Shell containing the specified text
  See Also:
    `ControlFinder.findShells(String)`

### getShells

    public Shell[] getShells()

  Gets the shells registered with the display.

  Returns:
    the shells
  See Also:
    `ControlFinder.getShells()`

### findMenus

    public List<MenuItem> findMenus(Matcher<MenuItem> matcher)

  Finds a menu matching the given item in all available shells. This searches for menus recursively.

  Parameters:
    `matcher` - the matcher that can match menus and menu items.
  Returns:
    all menus in all shells that match the matcher.
  See Also:
    `MenuFinder.findMenus(Matcher)`

### findMenus

    public List<MenuItem> findMenus(Menu bar,
                                    Matcher<MenuItem> matcher,
                                    boolean recursive)

  Fins all the menus in the given menu bar matching the given matcher. If recursive is set, it will attempt to find the controls recursively in each of the menus it that is found.

  Parameters:
    `bar` - the menu bar
    `matcher` - the matcher that can match menus and menu items.
    `recursive` - if set to true, will find sub-menus as well.
  Returns:
    all menus in the specified menubar that match the matcher.
  See Also:
    `MenuFinder.findMenus(Menu, Matcher, boolean)`

### findMenus

    public List<MenuItem> findMenus(Shell shell,
                                    Matcher<MenuItem> matcher,
                                    boolean recursive)

  Finds the menus in the given shell using the given matcher. If recursive is set, it will attempt to find the controls recursively in each of the menus it that is found.

  Parameters:
    `shell` - the shell to probe for menus.
    `matcher` - the matcher that can match menus and menu items.
    `recursive` - if set to true, will find sub-menus as well.
  Returns:
    all menus in the specified shell that match the matcher.
  See Also:
    `MenuFinder.findMenus(Shell, Matcher, boolean)`

### findMenus

    public List<MenuItem> findMenus(Shell[] shells,
                                    Matcher<MenuItem> matcher,
                                    boolean recursive)

  Finds all the menus using the given matcher in the set of shells provided. If recursive is set, it will attempt to find the controls recursively in each of the menus it that is found.

  Parameters:
    `shells` - the shells to probe for menus.
    `matcher` - the matcher that can match menus and menu items.
    `recursive` - if set to true, will find sub-menus as well.
  Returns:
    all menus in the specified shells that match the matcher.
  See Also:
    `MenuFinder.findMenus(Shell[], Matcher, boolean)`

### shouldFindInvisibleControls

    public boolean shouldFindInvisibleControls()

  Checks if this should return items that are not visible when performing the search for controls.

  Returns:
    `true` if the finder should return items that are not visible. Otherwise `false` is returned to show no items will be returned if they are not visible.
  Since:
    1.0

### setShouldFindInvisibleControls

    public void setShouldFindInvisibleControls(boolean shouldFindInVisibleControls)

  This sets the flag to know if items should be returned if they are not visible.

  Parameters:
    `shouldFindInVisibleControls` - `true` to cause controls that are not visible to be found. Use false so that controls that are visible will be returned.
  Since:
    1.0

### getDisplay

    public Display getDisplay()

  Gets the display that has been set.

  Returns:
    the display

### getPath

    public TreePath getPath(Widget w)

  Gets the path to the widget. The path is the list of all parent containers of the widget.

  Parameters:
    `w` - the widget.
  Returns:
    the path to the widget w.
  Since:
    2.0
  See Also:
    `ControlFinder.getPath(Widget)`

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