Community
Participate
Working Groups
When defining an IMP language with a parser, but no other IMP-specific extension points have been defined, the Universal Editor throws a Nullpointer Exception looking for a Token Colorer. I'm using version 0.1.106.v201004212015 (the latest version from the update site). On the other hand, I don't remember experiencing the same issue using previous versions of IMP (but I'm not sure, and cannot test it right now). Is this intended, and I'm missing something, or is this really a unwanted experience? Thank you for your help.
Hi, thanks for the bug report! No, this isn't intended. IMP should work with as many services as you provide, and gracefully handle the absence of services you don't provide. This is a regression. Do you have a stack backtrace from the Error Log?
I ask since the UniversalEditor has only one reference to the ITokenColorer, in nested class PresentationDamager.getDamageRegion(), and it's guarded by a null pointer check. That said, it looks as though the error could come from the PresentationRepairer class, which probably shouldn't be instantiated in the first place if there's no token colorer implementation.
The trace is as follows. When added a TokenColorer, this error was resolved. Error running parser for language vtml2 and input petrinet.vtml2: java.lang.NullPointerException at org.eclipse.imp.editor.internal.PresentationController.changeTokenPresentation(PresentationController.java:215) at org.eclipse.imp.editor.internal.PresentationController.aggregateTextPresentation(PresentationController.java:208) at org.eclipse.imp.editor.internal.PresentationController.changeTextPresentationForRegion(PresentationController.java:182) at org.eclipse.imp.editor.internal.PresentationController.update(PresentationController.java:159) at org.eclipse.imp.editor.ParserScheduler.notifyModelListeners(ParserScheduler.java:146) at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:96) at org.eclipse.imp.editor.UniversalEditor.initiateServiceControllers(UniversalEditor.java:1068) at org.eclipse.imp.editor.UniversalEditor.createPartControl(UniversalEditor.java:702) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180) at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270) at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1254) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1207) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1606) at org.eclipse.ui.internal.PartStack.add(PartStack.java:497) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103) at org.eclipse.ui.internal.PartStack.add(PartStack.java:483) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112) at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63) at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225) at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213) at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2860) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768) at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760) at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2682) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610) at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:99) at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:99) at org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:133) at org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:330) at org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:787) at org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:499) at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:845) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:843) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1131) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1235) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3764) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1343) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1351) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1163) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3610) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3265) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2624) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2588) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2422) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Thanks for the additional info; that helped diagnose the extent of the problem. I've added the necessary guards so that the entire presentation reconciling mechanism is disabled when there's no ITokenColorer implementation. Fixed in SVN trunk.