Author: lektran
Date: Thu Aug 28 03:25:14 2008
New Revision: 689776
URL:
http://svn.apache.org/viewvc?rev=689776&view=revLog:
Add groovy support to menu actions
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java?rev=689776&r1=689775&r2=689776&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Thu Aug 28 03:25:14 2008
@@ -31,6 +31,7 @@
import org.ofbiz.base.util.BshUtil;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.GroovyUtil;
import org.ofbiz.base.util.ObjectType;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilFormatOut;
@@ -337,6 +338,14 @@
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
}
+ } else if (location.endsWith(".groovy")) {
+ try {
+ GroovyUtil.runScriptAtLocation(location, context);
+ } catch (GeneralException e) {
+ String errMsg = "Error running Groovy script at location [" + location + "]: " + e.toString();
+ Debug.logError(e, errMsg, module);
+ throw new IllegalArgumentException(errMsg);
+ }
} else {
throw new IllegalArgumentException("For screen script actions the script type is not yet support for location:" + location);
}