X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.ui%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fui%2Feditor2%2FOpenSCLDefinition.java;h=bc7f9feac702b7951de422c3a254469eeea78cac;hp=7731bf2acdccb3ba5a74ab1d535e72ab15099742;hb=22fc89ea8f464540eab16db50e271b89c16c2842;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java index 7731bf2ac..bc7f9feac 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/OpenSCLDefinition.java @@ -1,48 +1,48 @@ -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(); - } - } - -} +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(); + } + } + +}