summaryrefslogtreecommitdiff
path: root/support/jedit/console/commando/scalarun.xml
diff options
context:
space:
mode:
Diffstat (limited to 'support/jedit/console/commando/scalarun.xml')
-rw-r--r--support/jedit/console/commando/scalarun.xml80
1 files changed, 80 insertions, 0 deletions
diff --git a/support/jedit/console/commando/scalarun.xml b/support/jedit/console/commando/scalarun.xml
new file mode 100644
index 0000000000..98b7a29d48
--- /dev/null
+++ b/support/jedit/console/commando/scalarun.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!DOCTYPE COMMANDO SYSTEM "commando.dtd">
+<!-- Author(s): Manpreet Singh \junkblocker/ \at/ \yahoo/ \dot/ \com/ -->
+<!-- Stephane Micheloud (http://scala.epfl.ch/) -->
+<COMMANDO>
+ <UI>
+ <CAPTION LABEL="Scala Settings">
+ <!-- See http://www.rgagnon.com/javadetails/java-0150.html -->
+ <DIR_ENTRY LABEL="Scala Home Path" VARNAME="home" EVAL='
+ envProps = new Properties();
+ osname = System.getProperty("os.name", "unknown").toLowerCase();
+ if (osname.indexOf("windows 9") != -1) {
+ cmd = "command.com /c set";
+ isWin32 = true;
+ }
+ else if ( (osname.indexOf("nt") != -1) ||
+ (osname.indexOf("windows 20") != -1) ||
+ (osname.indexOf("windows xp") != -1) ) {
+ cmd = "cmd.exe /c set";
+ isWin32 = true;
+ }
+ else {
+ cmd = "env";
+ isWin32 = false;
+ }
+ p = Runtime.getRuntime().exec(cmd);
+ is = new InputStreamReader(p.getInputStream());
+ rd = new BufferedReader(is);
+ line = null;
+ while ((line = rd.readLine()) != null) {
+ index = -1;
+ if ((index = line.indexOf("=")) > -1) {
+ key = line.substring(0, index).trim();
+ value = line.substring(index + 1).trim();
+ envProps.setProperty(key, value);
+ }
+ else
+ envProps.setProperty(line, "");
+ }
+ is.close();
+
+ value = envProps.getProperty("SCALA_HOME");
+ if (value == null) {
+ value = (isWin32) ? "c:\\\\Progra~1\\Scala" : "/usr/local/scala";
+ }
+ value
+ '/>
+ </CAPTION>
+ <CAPTION LABEL="Source File(s)">
+ <FILE_ENTRY LABEL="File Name" VARNAME="file" EVAL="buffer.getPath()"/>
+ <!--
+ <DIR_ENTRY LABEL="Running Directory" VARNAME="dir" EVAL="buffer.getDirectory()"/>
+ -->
+ <!-- the following awaits creation of a dynamic CHOICE element -->
+ <ENTRY LABEL="Main class" VARNAME="main" EVAL='
+ import java.util.regex.Pattern;
+ p = Pattern.compile(".*object\\s+([A-Za-z_][A-Za-z0-9_]*).*?def\\s+main\\s*\\(.*", Pattern.MULTILINE | Pattern.DOTALL).matcher(buffer.getText(0, buffer.getLength()));
+ packageName = console.ConsolePlugin.getPackageName(buffer);
+ p.matches() ? ((packageName == null) ? "" : packageName + ".") + p.group(1) : console.ConsolePlugin.getClassName(buffer)
+ '/>
+ </CAPTION>
+
+ <CAPTION LABEL="Application Settings">
+ <ENTRY LABEL="Application Parameters" VARNAME="arguments"/>
+ </CAPTION>
+ </UI>
+ <COMMANDS>
+ <COMMAND SHELL="System" CONFIRM="FALSE">
+ buf = new StringBuffer();
+ if (home.length() > 0) buf.append(home + File.separator + "bin" + File.separator);
+ buf.append("scalarun");
+ buf.append(" " + file);
+ buf.append(" -- " + main);
+ if (arguments.length() > 0) buf.append(" ").append(arguments);
+ buf.toString()
+ </COMMAND>
+ </COMMANDS>
+</COMMANDO>
+
+<!-- $Id$ -->