]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - base/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/utils/CommandUtils.java
fix bug 145 ( https://www.argeo.org/bugzilla/show_bug.cgi?id=145 ).
[lgpl/argeo-commons.git] / base / runtime / org.argeo.eclipse.ui / src / main / java / org / argeo / eclipse / ui / utils / CommandUtils.java
index 7bb5c27916c504669562f4f723f0d95ae2fb9236..d150551bb67f1ad7cde8da54524142d83a270d6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -171,6 +171,8 @@ public class CommandUtils {
                        Command cmd = cmdService.getCommand(commandID);
 
                        ArrayList<Parameterization> parameters = null;
+                       ParameterizedCommand pc;
+
                        if (paramMap != null) {
                                // Set parameters of the command to launch :
                                parameters = new ArrayList<Parameterization>();
@@ -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