org.eclipse.swtbot.eclipse.finder.widgets
Class SWTBotViewMenu

java.lang.Object
  extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewMenu
Direct Known Subclasses:
SWTBotCommand

public class SWTBotViewMenu
extends Object

A SWTBotViewMenu represents a menu item within a view's menu.

Since:
1.2
Version:
$Id$
Author:
@author Stephen Paulin <paulin [at] spextreme [dot] com>

Field Summary
protected  Command cmdItem
          Holds command if setup.
protected  String commandID
          Holds the id of the command if one exists.
protected  Object menuClickResult
          Holds the results of the click action.
protected  ParameterizedCommand paraCmdItem
          Holds parameterized command if setup.
 
Constructor Summary
SWTBotViewMenu(ActionContributionItem contributionItem)
          Constructs a SWTBot View Menu item.
SWTBotViewMenu(Command commandItem)
          Constructs a SWTBot View Menu item.
SWTBotViewMenu(ParameterizedCommand commandItem)
          Constructs a SWTBot View Menu item.
 
Method Summary
 void click()
          Simulates the click action of the menu.
 Object getClickResult()
          After a click completes, this may be use to access the results returned by the command.
 String getText()
          GEts the text label for the menu item.
 boolean isChecked()
          Gets if the menu item is checked (has a check mark next to it).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menuClickResult

protected Object menuClickResult
Holds the results of the click action.


cmdItem

protected Command cmdItem
Holds command if setup.


paraCmdItem

protected ParameterizedCommand paraCmdItem
Holds parameterized command if setup.


commandID

protected String commandID
Holds the id of the command if one exists.

Constructor Detail

SWTBotViewMenu

public SWTBotViewMenu(Command commandItem)
               throws WidgetNotFoundException
Constructs a SWTBot View Menu item.

Parameters:
commandItem - The command contribution item.
Throws:
WidgetNotFoundException - Thrown if both values are null.
AssertionFailedException - If the contribution item is null.

SWTBotViewMenu

public SWTBotViewMenu(ParameterizedCommand commandItem)
               throws WidgetNotFoundException
Constructs a SWTBot View Menu item.

Parameters:
commandItem - The parameterized command contribution item.
Throws:
WidgetNotFoundException - Thrown if both values are null.
AssertionFailedException - If the contribution item is null.

SWTBotViewMenu

public SWTBotViewMenu(ActionContributionItem contributionItem)
               throws WidgetNotFoundException
Constructs a SWTBot View Menu item.

Parameters:
contributionItem - The action contribution item.
Throws:
WidgetNotFoundException - Thrown if both values are null.
AssertionFailedException - If the contribution item is null.
Method Detail

click

public void click()
           throws WidgetNotFoundException
Simulates the click action of the menu.

Throws:
WidgetNotFoundException - Thrown if the action or command id are not valid.

getClickResult

public Object getClickResult()
After a click completes, this may be use to access the results returned by the command. If a click had not previously been done then this value will be null.

Returns:
The object data from the click or null if a click never occurred.

getText

public String getText()
               throws WidgetNotFoundException
GEts the text label for the menu item.

Returns:
The text label.
Throws:
WidgetNotFoundException - Thrown if the action is null.

isChecked

public boolean isChecked()
Gets if the menu item is checked (has a check mark next to it).

Returns:
true if checked. Otherwise false.