diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java index 043a5ef79..183068def 100644 --- a/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java +++ b/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java @@ -109,11 +109,11 @@ public class NewElementCmd extends AbstractCommand { String name = button.getText(); // Get the AntAction - Action action = button.getAction(); - if (!(action instanceof AntAction)) { + String cmdStr = button.getActionCommand(); + AntAction antAction = getContext().getActions().getAction(cmdStr); + if (antAction == null) { return; } - AntAction antAction = (AntAction) action; ACSElement e = vals[vals.length - 1]; @@ -153,3 +153,5 @@ public class NewElementCmd extends AbstractCommand { } } + +