-
- 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);
+
+ public static Runnable openDefinition(String moduleName, long location) {
+ return () -> {
+ 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) {
+ LOGGER.error("", e);