Hi All,
I am currently making last preparations for EclipseCon. To get my personal MinMax Addon running I need to bind a command to a tool item (with a parameter). Here is my source:
MCommand command = MCommandsFactory.INSTANCE.createCommand();
command.setElementId("com.toedter.e4.ui.workbench.addons.minmax.restore");
command.setCommandName("Restore Stack");
command.setDescription("xxx");
command.setContributorURI("kai");
// application.getCommands().add(command);
MHandler handler = MCommandsFactory.INSTANCE.createHandler();
handler.setContributionURI("bundleclass://com.toedter.e4.ui.workbench.addons/com.toedter.e4.ui.workbench.addons.minmax.RestoreHandler");
handler.setCommand(command);
// application.getHandlers().add(handler);
MHandledToolItem toolItem = MMenuFactory.INSTANCE.createHandledToolItem();
toolItem.setIconURI("platform:/plugin/com.toedter.e4.ui.workbench.addons/icons/fastview_restore.gif");
toolItem.setCommand(command);
MParameter parameter = MCommandsFactory.INSTANCE.createParameter();
parameter.setName(ADDONS_MINMAX_TRIM_STACK_ID);
parameter.setValue(element.getElementId());
toolItem.getParameters().add(parameter);
I see the “Restore” tool item in my left TrimBar, but when I click on it I get:
Failed to execute: org.eclipse.e4.ui.model.application.commands.impl.CommandImpl@4f087f (elementId: com.toedter.e4.ui.workbench.addons.minmax.restore, tags: null, contributorURI: kai) (commandName: Restore Stack, description: xxx)
If I commend out the MParameter block, nothing happens at all.
Any suggestions?
Thanks
Kai