]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java
Preventing unnecessary ModuleSource compilation in SCL-editor
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / editor2 / OpenSCLDefinition.java
index 7731bf2acdccb3ba5a74ab1d535e72ab15099742..bc7f9feac702b7951de422c3a254469eeea78cac 100644 (file)
@@ -1,48 +1,48 @@
-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
-import org.simantics.scl.compiler.elaboration.modules.SCLValue;\r
-import org.simantics.scl.compiler.errors.Locations;\r
-import org.simantics.scl.ui.browser.SCLDefinitionSelectionDialog;\r
-\r
-public class OpenSCLDefinition extends AbstractHandler {\r
-\r
-    @Override\r
-    public Object execute(ExecutionEvent event) throws ExecutionException {\r
-        SCLDefinitionSelectionDialog dialog = new SCLDefinitionSelectionDialog(\r
-                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());\r
-        if(dialog.open() == SCLDefinitionSelectionDialog.OK) {\r
-            SCLValue value = (SCLValue)dialog.getFirstResult();\r
-            if(value != null)\r
-                openDefinition(value);\r
-        }\r
-        return null;\r
-    }\r
-    \r
-    public static void openDefinition(SCLValue value) {\r
-        openDefinition(value.getName().module, value.definitionLocation);\r
-    }\r
-    \r
-    public static void openDefinition(String moduleName, long location) {\r
-        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();\r
-        if(page == null)\r
-            return;\r
-        SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);\r
-        try {\r
-            SCLModuleEditor2 editor = (SCLModuleEditor2)page.openEditor(input, "org.simantics.scl.ui.editor2");\r
-            if(location != Locations.NO_LOCATION) {\r
-                int begin = Locations.beginOf(location);\r
-                int end = Locations.endOf(location);\r
-                editor.selectAndReveal(begin, end-begin);\r
-            }\r
-        } catch (PartInitException e) {\r
-            e.printStackTrace();\r
-        }\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;
+import org.simantics.scl.compiler.elaboration.modules.SCLValue;
+import org.simantics.scl.compiler.errors.Locations;
+import org.simantics.scl.ui.browser.SCLDefinitionSelectionDialog;
+
+public class OpenSCLDefinition extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        SCLDefinitionSelectionDialog dialog = new SCLDefinitionSelectionDialog(
+                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        if(dialog.open() == SCLDefinitionSelectionDialog.OK) {
+            SCLValue value = (SCLValue)dialog.getFirstResult();
+            if(value != null)
+                openDefinition(value);
+        }
+        return null;
+    }
+    
+    public static void openDefinition(SCLValue value) {
+        openDefinition(value.getName().module, value.definitionLocation);
+    }
+    
+    public static void openDefinition(String moduleName, long location) {
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        if(page == null)
+            return;
+        SCLModuleEditorInput input = new StandardSCLModuleEditorInput(moduleName);
+        try {
+            SCLModuleEditor2 editor = (SCLModuleEditor2)page.openEditor(input, "org.simantics.scl.ui.editor2");
+            if(location != Locations.NO_LOCATION) {
+                int begin = Locations.beginOf(location);
+                int end = Locations.endOf(location);
+                editor.selectAndReveal(begin, end-begin);
+            }
+        } catch (PartInitException e) {
+            e.printStackTrace();
+        }
+    }
+
+}