-package org.simantics.scl.ui.editor2;\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.ui.IWorkbenchPage;\r
-import org.eclipse.ui.PartInitException;\r
-import org.eclipse.ui.PlatformUI;\r
-\r
-public class OpenSCLModule extends AbstractHandler {\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- SCLModuleSelectionDialog dialog = new SCLModuleSelectionDialog(\r
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());\r
- if(dialog.open() == SCLModuleSelectionDialog.OK) {\r
- String moduleName = (String)dialog.getFirstResult();\r
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();\r
- if(page == null)\r
- return null;\r
- SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);\r
- try {\r
- page.openEditor(input, "org.simantics.scl.ui.editor2");\r
- } catch (PartInitException e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- return null;\r
- }\r
-\r
-}\r
+package org.simantics.scl.ui.editor2;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+public class OpenSCLModule extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ SCLModuleSelectionDialog dialog = new SCLModuleSelectionDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ if(dialog.open() == SCLModuleSelectionDialog.OK) {
+ String moduleName = (String)dialog.getFirstResult();
+ openModule(moduleName);
+ }
+ return null;
+ }
+
+ public static void openModule(String moduleName) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if(page == null)
+ return;
+ SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);
+ try {
+ page.openEditor(input, "org.simantics.scl.ui.editor2");
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+
+}