Clicking on menu Eclipse in Mac OSX [message #1470446] |
Wed, 12 November 2014 05:43  |
Eclipse User |
|
|
|
Hi,
I managed already to click on the "File" menu, but it seems that menu "Eclipse", the one just next to the Apple icon, is not a typical menu.
This code doesn't work for this menu:
private static SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.menu("Eclipse").menu("Preferences...").click();
Any idea how to access this menu ?
thanks,
Benoît
|
|
|
|
Re: Clicking on menu Eclipse in Mac OSX [message #1538762 is a reply to message #1532069] |
Wed, 31 December 2014 09:52  |
Eclipse User |
|
|
|
Thanks a lot Andrew for the hint !
For sake of completeness, below the full code which worked in my case.
------------------------------------------------------------------------------------------------
final IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().asyncExec(new Runnable() {
public void run() {
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window != null) {
Menu appMenu = workbench.getDisplay().getSystemMenu();
for (MenuItem item : appMenu.getItems()) {
if (item.getText().startsWith("Preferences")) {
Event event = new Event();
event.time = (int) System.currentTimeMillis();
event.widget = item;
event.display = workbench.getDisplay();
item.setSelection(true);
item.notifyListeners(SWT.Selection, event);
break;
}
}
}
}
});
[Updated on: Wed, 31 December 2014 09:53] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.07338 seconds