We have an application that uses plugin.xml files to specify the default menu contributions (File, Help, etc.), see below. We then created API to allow specific workflows the ability to change the text of those menu items via the setText method on MenuItem (see snippet below). This worked fine with the 3.7.1 (4.1.1) [1] versions of the SWT jars, but as soon as we upgraded to 3.8.1 (4.2.1) [2] this functionality no longer works.
What changed between 4.1.1 and 4.2.1 that would have broken this? Any ideas on how we can work around this issue?
[1] org.eclipse.swt.win32.win32.x86-3.7.1-SDK-4.1.1
[2] org.eclipse.swt.win32.win32.x86-3.100.1-SDK-4.2.1
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="file" label="File">
<separator name="additions" visible="true" />
</menu>
</menuContribution>
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=file">
<menu id="help" label="Help">
<separator name="additions" visible="true" />
</menu>
</menuContribution>
</extension>
final MenuDelegate menuDelegate = MenuDelegate.create();
if (menuDelegate != null) {
final MenuLabels menuLabels = menuDelegate.getMenuLabels();
final Menu appMenuBar = window.getShell().getMenuBar();
for (final MenuItem item : appMenuBar.getItems()) {
final String id = ((MenuManager) item.getData()).getId();
if (FILE_MENU_ID.equals(id)) {
item.setText(menuLabels.getFileMenuLabel());
}
}
}