adi
adi

Reputation: 1150

How to rename the eclipse plugin menu programmatically

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?

Upvotes: 0

Views: 287

Answers (1)

adi
adi

Reputation: 1150

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.

Upvotes: 1

Related Questions