Hi, I was wondering if there was a way to check whether or not a right-click menu item is enabled/disabled in the test.
My RCP has the following pop-up ObjectContribution Action set up:
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="false"
id="ZbiIde.setDebugPopup"
objectClass="zbiide.views.IDebuggablePrinter">
<action
class="zbiide.actions.SetDebugPrinterAction"
icon="icons/debug_view.gif"
id="popup.action.SetDebugPrinterAction"
label="Create Debug Connection"
menubarPath="additions"/>
<visibility>
<not>
<objectState
name="createDebug"
value="enable"/>
</not>
</visibility>
</objectContribution>
</extension>
Now depending on some stuff in my RCP app, this action is either enabled or disabled.
In my test, I can say:
ui.contextClick(new TreeItemLocator("Virtual Printers/TestPrinter", new ViewLocator("ZbiIde.SearchView")), "Create Debug Connection");
This line will find the Item in the tree (Virtual Printers/TestPrinter) and right click on it, then in the right-click menu list find the proper action. (Create Debug Connection)
Of course, the problem is, that menu-item might be disabled.
I know the WindowTester API has the isEnabled Condition. But while looking at it, I couldn't find a way to find a menu-item, only Widget items, like Buttons, Text fields, etc.
So, is there a way to simply right click on an object, find the list of menu-items under the object which was clicked on, then check whether or not each is enabled?
Thanks