From b3fd827c297b7d73879348cf6763fbb208a2deba Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Wed, 20 Mar 2013 14:15:23 +0000 Subject: [PATCH] Merge - CommandUtils fails to call command with no parameter https://www.argeo.org/bugzilla/show_bug.cgi?id=145 git-svn-id: https://svn.argeo.org/commons/branches/1.x@6181 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/eclipse/ui/utils/CommandUtils.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/base/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/utils/CommandUtils.java b/base/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/utils/CommandUtils.java index e020ecf3e..d150551bb 100644 --- a/base/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/utils/CommandUtils.java +++ b/base/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/utils/CommandUtils.java @@ -171,6 +171,8 @@ public class CommandUtils { Command cmd = cmdService.getCommand(commandID); ArrayList parameters = null; + ParameterizedCommand pc; + if (paramMap != null) { // Set parameters of the command to launch : parameters = new ArrayList(); @@ -181,15 +183,17 @@ public class CommandUtils { cmd.getParameter(id), paramMap.get(id)); parameters.add(parameterization); } - } - // build the parameterized command - ParameterizedCommand pc = new ParameterizedCommand(cmd, - parameters.toArray(new Parameterization[parameters.size()])); + pc = new ParameterizedCommand(cmd, + parameters.toArray(new Parameterization[parameters + .size()])); + } else + pc = new ParameterizedCommand(cmd, null); + // execute the command handlerService.executeCommand(pc, null); } catch (Exception e) { - throw new ArgeoException( - "Unexepected exception while opening node editor", e); + throw new ArgeoException("Unexpected error while" + + " calling the command " + commandID, e); } } } \ No newline at end of file -- 2.30.2