diff options
author | Tomas O'Connor <toconnor@openoffice.org> | 2003-06-02 14:33:29 +0000 |
---|---|---|
committer | Tomas O'Connor <toconnor@openoffice.org> | 2003-06-02 14:33:29 +0000 |
commit | 3390552d381a692780aec5e3dd48ec2c4918426e (patch) | |
tree | 423bc8d410f1404cdc235e6e3b697f7942c47b71 /scripting/examples/java/debugger | |
parent | 6ce9bc07f2cbae812bfb342a6e7482493120b8ed (diff) |
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/debugger')
-rw-r--r-- | scripting/examples/java/debugger/OOBeanShellDebugger.java | 4 | ||||
-rw-r--r-- | scripting/examples/java/debugger/OORhinoDebugger.java | 25 |
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) { |