org.eclipse.swtbot.eclipse.finder.widgets
Class SWTBotCommand

java.lang.Object
  extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewMenu
      extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotCommand

public class SWTBotCommand
extends SWTBotViewMenu

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
 
Fields inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewMenu
cmdItem, commandID, menuClickResult
 
Constructor Summary
SWTBotCommand(Command command)
          Constructs a SWTBot command 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 name for this item.
 boolean isEnabled()
          Gets if the command is enabled.
 
Methods inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewMenu
isChecked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTBotCommand

public SWTBotCommand(Command command)
              throws WidgetNotFoundException
Constructs a SWTBot command item.

Parameters:
command - The command 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.

Overrides:
click in class SWTBotViewMenu
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.

Overrides:
getClickResult in class SWTBotViewMenu
Returns:
The object data from the click or null if a click never occurred.

getText

public String getText()
               throws WidgetNotFoundException
Gets the text name for this item.

Overrides:
getText in class SWTBotViewMenu
Returns:
The text name of this item.
Throws:
WidgetNotFoundException - Thrown if the command name has not been defined.

isEnabled

public boolean isEnabled()
Gets if the command is enabled.

Returns:
true if enabled. Otherwise false.