org.eclipse.swtbot.swt.finder.finders
Class MenuFinder

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.finders.MenuFinder
Direct Known Subclasses:
ContextMenuFinder, EventContextMenuFinder

public class MenuFinder
extends Object

Finds menus matching a particular matcher.

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

Field Summary
protected  Display display
          The display
 
Constructor Summary
MenuFinder()
          Creates a MenuFinder.
 
Method Summary
 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)
          Finds 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.
protected  Shell[] getShells()
          Gets all of the shells in the current display.
protected  Menu menuBar(Shell shell)
          Gets the menu bar in the given shell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

display

protected final Display display
The display

Constructor Detail

MenuFinder

public MenuFinder()
Creates a MenuFinder.

Method Detail

findMenus

public List<MenuItem> findMenus(Matcher<MenuItem> matcher)
Finds a menu matching the given item in all available shells. If recursive is set, it will attempt to find the controls recursively in each of the menus it that is found.

Parameters:
matcher - the matcher that can match menus and menu items.
Returns:
all menus in all shells that match the matcher.

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.

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.

menuBar

protected Menu menuBar(Shell shell)
Gets the menu bar in the given shell.

Parameters:
shell - the shell.
Returns:
the menu in the shell.
See Also:
Decorations.getMenuBar()

findMenus

public List<MenuItem> findMenus(Menu bar,
                                Matcher<MenuItem> matcher,
                                boolean recursive)
Finds 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.

getShells

protected Shell[] getShells()
Gets all of the shells in the current display.

Returns:
all shells in the display.
See Also:
Display.getShells()