summaryrefslogtreecommitdiff
path: root/scripting/examples/beanshell
diff options
context:
space:
mode:
authorSander Vesik <svesik@openoffice.org>2004-04-19 21:59:46 +0000
committerSander Vesik <svesik@openoffice.org>2004-04-19 21:59:46 +0000
commite2c494ae09fb5b2eff115568a115e45997d64be5 (patch)
tree51e501f4a6f95bb55077f423780bca7b37c82ae4 /scripting/examples/beanshell
parent543a031e01c1789d86bd7b37a15105196eb31217 (diff)
INTEGRATION: CWS scriptingf5 (1.1.2); FILE ADDED
2004/03/22 16:27:26 toconnor 1.1.2.2: #i22570# - Update URL usage in examples to new non hierarchical scheme 2004/02/19 17:50:02 toconnor 1.1.2.1: #i25271# Modify BeanShell Highlight script to use DialogProvider
Diffstat (limited to 'scripting/examples/beanshell')
-rw-r--r--scripting/examples/beanshell/Highlight/ShowDialog.bsh57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripting/examples/beanshell/Highlight/ShowDialog.bsh b/scripting/examples/beanshell/Highlight/ShowDialog.bsh
new file mode 100644
index 000000000000..27a7bcc8a8ac
--- /dev/null
+++ b/scripting/examples/beanshell/Highlight/ShowDialog.bsh
@@ -0,0 +1,57 @@
+import com.sun.star.uno.UnoRuntime;
+import drafts.com.sun.star.script.provider.XScriptContext;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.script.XLibraryContainer;
+import com.sun.star.awt.*;
+import com.sun.star.util.*;
+
+// UNO awt components of the Highlight dialog
+XMultiComponentFactory xmcf =
+ context.getComponentContext().getServiceManager();
+
+Object[] args = new Object[1];
+args[0] = context.getDocument();
+
+Object obj;
+try {
+ obj = xmcf.createInstanceWithArgumentsAndContext(
+ "com.sun.star.awt.DialogProvider", args,
+ context.getComponentContext());
+ /*
+ obj = xmcf.createInstanceWithContext(
+ "com.sun.star.awt.DialogProvider",
+ context.getComponentContext());
+ */
+}
+catch (com.sun.star.uno.Exception e) {
+ System.err.println("Error getting DialogProvider object");
+ return 0;
+}
+
+XDialogProvider xDialogProvider = (XDialogProvider)
+ UnoRuntime.queryInterface(XDialogProvider.class, obj);
+
+System.err.println("Got DialogProvider, now get dialog");
+
+try {
+ findDialog = xDialogProvider.createDialog("vnd.sun.star.script:" +
+ "ScriptBindingLibrary.Highlight?location=application");
+}
+catch (java.lang.Exception e) {
+ System.err.println("Got exception on first creating dialog: " +
+ e.getMessage());
+}
+
+Thread t = new Thread() {
+ public void run() {
+ findDialog.execute();
+ }
+};
+t.start();
+
+return 0;