0

I am developing an eclipse plugin.I have given my menu,sub menu names and plugin id in plugin.xml.

I want to dynamically rename my plugin id as well my menu and sub menu name.I came across this SOF link.I am using the below code.

     MenuManager menuManager = ((WorkbenchWindow)window).getMenuManager();

     Menu menu = menuManager.getMenu();

     String itemId = "plugin_menu_id";

     IContributionItem item = menuManager.find(itemId);

     System.out.println("item.getId() --> " + item.getId());
     //gives the plugin_menu_id      

     System.out.println( "menu.getItemCount() ==> "+ menu.getItemCount());
     //gives no of menus in eclipse

But unfortunately I am unable to find an option to rename the menu from IContributionItem. So is there any other way to modify things in eclipse plugin?

Community
  • 1
  • 1
adi
  • 984
  • 15
  • 33
  • 1
    `WorkbenchWindow` is an **internal** class, you are violating the [Eclipse API Rules of Engagement](https://www.eclipse.org/articles/Article-API-Use/index.html) by using it. – greg-449 Mar 17 '17 at 07:59
  • oh,I am not aware of it.So what can be done.is there any other alternatives? – adi Mar 17 '17 at 08:05
  • I am not aware of an alternative. In any case a contribution item doesn't have a name - contribution items usually add one or more menu items directly to the menu. – greg-449 Mar 17 '17 at 08:09

1 Answers1

1

I found a temporary solution .Instead of using a MenuManager,I created a dynamic menu using Actions Framework instead of Command Framework though the former is deprecated.

So each time , I create a Menu,I am able to change the Menu name,icon etc.

I am searching for an equivalent in the Command Framework and will post as soon as I found that.

adi
  • 984
  • 15
  • 33