]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / browser / LaunchSCLDocumentationBrowser.java
diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/browser/LaunchSCLDocumentationBrowser.java
new file mode 100644 (file)
index 0000000..eab01a2
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.scl.ui.browser;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.swt.SWTError;\r
+import org.eclipse.swt.layout.FillLayout;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.ui.PlatformUI;\r
+\r
+public class LaunchSCLDocumentationBrowser extends AbstractHandler {\r
+\r
+    @Override\r
+    public Object execute(ExecutionEvent event) throws ExecutionException {\r
+        Display display = PlatformUI.getWorkbench().getDisplay();\r
+        Shell shell = new Shell(display);\r
+        shell.setText("SCL Documentation browser");\r
+        shell.setLayout(new FillLayout());\r
+        SCLDocumentationBrowser browser;\r
+        try {\r
+            browser = new SCLDocumentationBrowser(shell);\r
+        } catch (SWTError e) {\r
+            System.out.println("Could not instantiate the browser: " + e.getMessage());\r
+            display.dispose();\r
+            return null;\r
+        }\r
+        browser.setLocation("Prelude");\r
+        shell.open();\r
+        \r
+        return null;\r
+    }\r
+\r
+}\r