Programmatic added Commands and Handler throw Exception [message #1393764] |
Fri, 04 July 2014 08:27  |
Eclipse User |
|
|
|
Hello,
I switched the platform from 3.8 to 4.3 for an old RCP-Application, where commands and handlers are added programmatically, not in the plugin.xml. I've got the problem that I get a NotHandledException in the command, because no handler has been found.
The commands and handlers are added, as described in https://wiki.eclipse.org/Platform_Command_Framework. I would expect that the following code snippet work:
ICommandService commandService = getCommandService();
Category category = commandService.getCategory("some.category");
if (!category.isDefined()) {
category.define("SomeCategory", "The Category of the RCP");
}
Command command = commandService.getCommand("someId");
if (!command.isEnabled()) {
command.define("SomeName", "SomeDescription", category);
}
IHandlerService handlerService = getHandlerService();
handlerService.activateHandler(menuCommand.getName(), getHandler());
I execute the command as follows:
getHandlerService().executeCommand("someId", null);
I also tried to execute the command with a ParameterizedCommand, but had the some problem:
Command command = getCommandService().getCommand("someId");
ParameterizedCommand pCommand = new ParameterizedCommand(command, null);
getHandlerService().executeCommand(pCommand, null);
As I have seen the handler is ever added to the command. Is this code snippet not valid any more, when using Eclipse 4.3?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03914 seconds