How do I change command's name show in toolbar programmatically in rcp? [message #1706799] |
Mon, 31 August 2015 08:51 |
Cata E. Messages: 2 Registered: August 2015 |
Junior Member |
|
|
If I define programmatically a new command for the first time with a unique id, add it to the toolbar and Run the app, I see it's name in the toolbar. But if I close the plugin, change the name of the command in code where i define it and launch the plugin again, I still get the old name in the toolbar. My command's name simply doesn't want to update..
My code..
I am creating a command programmaticaly:
final Command commandAdd = commandService.getCommand( "editor.commands.macro.add1");
commandAdd.define( "Add", "Add Macro", commandService
.getCategory( "editor.category.macrogroup" ) );
Then I create a Contribution item and add it to the toolbar:
CommandContributionItemParameter addMacroParameter =
new CommandContributionItemParameter( serviceLocator , "", commandAdd.getId(),
CommandContributionItem.STYLE_PUSH );
CommandContributionItem add = new CommandContributionItem(addMacroParameter);
toolBarManager.add(add);
Right now if I launch the plugin app, the toolbar has the button "Add" in it. My problem is if I change the name from "add" to lets say "Insert" in code and relaunch the app, I still see "Add" in my toolbar instead of insert.
final Command commandAdd = commandService.getCommand( "editor.commands.macro.add1");
commandAdd.define( "Insert", "Add Macro", commandService
.getCategory( "editor.category.macrogroup" ) );
I also tried to set addMacroParameter.label = "Insert", but it still doesn't make any difference. If instead I change the command's id, the changes appear: if I use "editor.commands.macro.add2" instead of "editor.commands.macro.add1". But I want to be able to update command's name programmatically, without creating another one with another unique id.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03434 seconds