summaryrefslogtreecommitdiffstats
path: root/scripting/examples/java
diff options
context:
space:
mode:
authorTomas O'Connor <toconnor@openoffice.org>2003-06-02 14:33:29 +0000
committerTomas O'Connor <toconnor@openoffice.org>2003-06-02 14:33:29 +0000
commit3390552d381a692780aec5e3dd48ec2c4918426e (patch)
tree423bc8d410f1404cdc235e6e3b697f7942c47b71 /scripting/examples/java
parent#109684# Deliver more specifically. (diff)
downloadcore-3390552d381a692780aec5e3dd48ec2c4918426e.tar.gz
core-3390552d381a692780aec5e3dd48ec2c4918426e.zip
IssueZilla 15105 - add support for editing Rhino scripts stored in documents
Disable editing when debugging Rhino scripts Disable Save when editing document scripts
Diffstat (limited to 'scripting/examples/java')
-rw-r--r--scripting/examples/java/debugger/OOBeanShellDebugger.java4
-rw-r--r--scripting/examples/java/debugger/OORhinoDebugger.java25
2 files changed, 22 insertions, 7 deletions
diff --git a/scripting/examples/java/debugger/OOBeanShellDebugger.java b/scripting/examples/java/debugger/OOBeanShellDebugger.java
index 97323735ec48..be91aa458163 100644
--- a/scripting/examples/java/debugger/OOBeanShellDebugger.java
+++ b/scripting/examples/java/debugger/OOBeanShellDebugger.java
@@ -123,6 +123,10 @@ public class OOBeanShellDebugger implements OOScriptDebugger, ActionListener, Do
JButton b = new JButton(labels[i]);
b.addActionListener(this);
p.add(b);
+
+ if (labels[i].equals("Save") && filename == null) {
+ b.setEnabled(false);
+ }
}
frame.getContentPane().add(sp, "Center");
diff --git a/scripting/examples/java/debugger/OORhinoDebugger.java b/scripting/examples/java/debugger/OORhinoDebugger.java
index 8369adfd882c..0aea985cc5f2 100644
--- a/scripting/examples/java/debugger/OORhinoDebugger.java
+++ b/scripting/examples/java/debugger/OORhinoDebugger.java
@@ -11,9 +11,24 @@ import drafts.com.sun.star.script.framework.runtime.XScriptContext;
public class OORhinoDebugger implements OOScriptDebugger {
+ public void go(final XScriptContext xsctxt, String filename) {
+ Main sdb = initUI(xsctxt);
+
+ // This is the method we've added to open a file when starting
+ // the Rhino debugger
+ sdb.openFile(filename);
+ }
+
+ public void go(final XScriptContext xsctxt, InputStream in) {
+ Main sdb = initUI(xsctxt);
+
+ // Open a stream in the debugger
+ sdb.openStream(in);
+ }
+
// This code is based on the main method of the Rhino Debugger Main class
// We pass in the XScriptContext in the global scope for script execution
- public void go(final XScriptContext xsctxt, String filename) {
+ private Main initUI(final XScriptContext xsctxt) {
try {
final Main sdb = new Main("Rhino JavaScript Debugger");
swingInvoke(new Runnable() {
@@ -39,15 +54,11 @@ public class OORhinoDebugger implements OOScriptDebugger {
return scope;
}
});
- // This is the method we've added to open a file when starting
- // the Rhino debugger
- sdb.openFile(filename);
+ return sdb;
} catch (Exception exc) {
exc.printStackTrace();
}
- }
-
- public void go(final XScriptContext xsctxt, InputStream in) {
+ return null;
}
static void swingInvoke(Runnable f) {