X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fspring%2FSpringCommandHandler.java;fp=eclipse%2Fplugins%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fspring%2FSpringCommandHandler.java;h=0356f57d2e850acd5cbb9930dca51974cd43bd4c;hb=dc6f911c680574a9b57c34dcf515ac8f9aa808da;hp=1fb44c50399cf83a10092d0f0ffa2c5624658403;hpb=d6b532e59ebbea777f53fe55119524234dc95144;p=lgpl%2Fargeo-commons.git diff --git a/eclipse/plugins/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringCommandHandler.java b/eclipse/plugins/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringCommandHandler.java index 1fb44c503..0356f57d2 100644 --- a/eclipse/plugins/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringCommandHandler.java +++ b/eclipse/plugins/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringCommandHandler.java @@ -35,36 +35,14 @@ public class SpringCommandHandler implements IHandler { } public Object execute(ExecutionEvent event) throws ExecutionException { + String commandId = event.getCommand().getId(); + String bundleSymbolicName = commandId.substring(0, + commandId.lastIndexOf('.')); try { - if (log.isDebugEnabled()) - log.debug("Execute " + event + " via spring command handler " + if (log.isTraceEnabled()) + log.trace("Execute " + event + " via spring command handler " + this); - - // Find the application context of the bundle defining the command - // extension - // ICommandService commandService = - // (ICommandService)ArgeoUiPlugin.getDefault().getWorkbench().getService(ICommandService.class); - // - // Command command = - // commandService.getCommand(event.getCommand().getId()); - // log.debug("command=" + command); - // log.debug("Command id " + command.getId()); - // - // Platform.getExtensionRegistry().getE - // - // IExtension extension = - // Platform.getExtensionRegistry().getExtension( - // "org.eclipse.ui.commands", command.getId()); - // log.debug("extension=" + extension); - // String bundleSymbolicName = extension.getContributor().getName(); - - // Assume that the defining bundle name is the first part of the - // command - // id // TODO: make it more flexible and robust - String commandId = event.getCommand().getId(); - String bundleSymbolicName = commandId.substring(0, commandId - .lastIndexOf('.')); ApplicationContext applicationContext = ApplicationContextTracker .getApplicationContext(bundleSymbolicName); @@ -84,8 +62,9 @@ public class SpringCommandHandler implements IHandler { return handler.execute(event); } catch (Exception e) { // TODO: use eclipse error management - log.error(e); - return null; +// log.error(e); + throw new ExecutionException("Cannot execute Spring command " + + commandId + " in bundle " + bundleSymbolicName, e); } }