Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Changing MenuItem Text when contributed via plugin.xml in 3.8.1 (4.2.1)(Changing MenuItem Text when contributed via plugin.xml in 3.8.1 (4.2.1))
Changing MenuItem Text when contributed via plugin.xml in 3.8.1 (4.2.1) [message #1048734] Wed, 24 April 2013 22:28
Andy Mising name is currently offline Andy Mising nameFriend
Messages: 5
Registered: July 2009
Junior Member
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());
                    }
                }
            }
Previous Topic:MApplication.getDescriptors() returns an empty list
Next Topic:Display not available when plugin starts()
Goto Forum:
  


Current Time: Fri Apr 26 22:37:47 GMT 2024

Powered by FUDForum. Page generated in 0.02643 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top