|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swtbot.swt.finder.finders.MenuFinder org.eclipse.swtbot.swt.finder.finders.EventContextMenuFinder
public class EventContextMenuFinder
Context menu finder that uses events to get the current context menu. It must be used instead of ContextMenuFinder when the context menu is not associated with a Widget. It must be registered before the context menu appears.
Here is a sample usage:
EventContextMenuFinder eventContextMenuFinder = new EventContextMenuFinder(); try { eventContextMenuFinder.register(); button.click(); // a popup menu appears below the button SWTBotMenu menu = new SWTBotMenu(new Finder(new ControlFinder(), eventContextMenuFinder), "Menu Text"); menu.click(); } finally { eventContextMenuFinder.unregister(); }This is not convenient to use but the need for this is not so frequent. In case you have better idea on the implementation or usage please add a comment to this bug.
Constructor Summary | |
---|---|
EventContextMenuFinder()
Creates an event based context menu finder. |
|
EventContextMenuFinder(Display display)
Creates an event based context menu finder. |
Method Summary | |
---|---|
protected Menu |
menuBar(Shell shell)
Gets the menu bar that has been found. |
void |
register()
Registers this finder so that it may start 'looking for' controls. |
void |
unregister()
Unregisters this finder so that it may stop 'looking for' controls. |
Methods inherited from class org.eclipse.swtbot.swt.finder.finders.MenuFinder |
---|
findMenus, findMenus, findMenus, findMenus, getShells |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventContextMenuFinder(Display display)
display
- the display
NullPointerException
- Thrown if the display is null
.public EventContextMenuFinder()
Method Detail |
---|
public void register()
SWT.Show
and SWT.Hide
events on menus.
public void unregister()
SWT.Show
and SWT.Hide
events on menus.
protected Menu menuBar(Shell shell)
null
if one had not been found yet.
menuBar
in class MenuFinder
shell
- This is not used.
null
if not yet found.MenuFinder.menuBar(org.eclipse.swt.widgets.Shell)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |