Community
Participate
Working Groups
I20061129-1340 + ZRH-plugins from 20061204-0928 - Open an Ant file with the Ant editor, e.g. test.xml: <?xml version="1.0" encoding="UTF-8"?> <project name="testsuite" default="run" basedir="."> <target name="run"> </target> </project> => Error dialog and exception below. I'm not sure whose fault this is. AFAICS, the problem is that AntEditorActionContributor.contributeToMenu(IMenuManager) does not call super.contributeToMenu(menu) when it is first invoked. However, I didn't find a contract that would forbid reimplementing the method (and the Ant code has not been changed in 3.3. I'll try to work around it in TextEditorActionContributor for now, but Dani will have to make the final decision. Error Mon Dec 04 15:24:53 CET 2006 Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". java.lang.NullPointerException at org.eclipse.ui.editors.text.TextEditorActionContributor.doSetActiveEditor(TextEditorActionContributor.java:106) at org.eclipse.ui.editors.text.TextEditorActionContributor.setActiveEditor(TextEditorActionContributor.java:131) at org.eclipse.ant.internal.ui.editor.AntEditorActionContributor.doSetActiveEditor(AntEditorActionContributor.java:69) at org.eclipse.ant.internal.ui.editor.AntEditorActionContributor.setActiveEditor(AntEditorActionContributor.java:145) at org.eclipse.ui.internal.EditorActionBars.partChanged(EditorActionBars.java:335) at org.eclipse.ui.internal.WorkbenchPage$3.run(WorkbenchPage.java:603) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:850) at org.eclipse.ui.internal.WorkbenchPage.activatePart(WorkbenchPage.java:592) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3179) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:585) at org.eclipse.ui.internal.WorkbenchPage.makeActive(WorkbenchPage.java:1147) at org.eclipse.ui.internal.WorkbenchPage.updateActivePart(WorkbenchPage.java:1127) at org.eclipse.ui.internal.WorkbenchPage.handleDeferredEvents(WorkbenchPage.java:1303) at org.eclipse.ui.internal.WorkbenchPage.deferUpdates(WorkbenchPage.java:1292) at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1266) at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1321) at org.eclipse.ui.internal.EditorPane.doHide(EditorPane.java:58) at org.eclipse.ui.internal.PartStack.close(PartStack.java:502) at org.eclipse.ui.internal.EditorStack.close(EditorStack.java:205) at org.eclipse.ui.internal.PartStack$1.close(PartStack.java:109) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:81) at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267) at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276) at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1) at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$1.closeButtonPressed(DefaultTabFolder.java:67) at org.eclipse.ui.internal.presentations.PaneFolder.notifyCloseListeners(PaneFolder.java:580) at org.eclipse.ui.internal.presentations.PaneFolder$3.close(PaneFolder.java:187) at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2107) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:292) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:927) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3463) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3077) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1945) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1909) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:425) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165) 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:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341) at org.eclipse.core.launcher.Main.basicRun(Main.java:285) at org.eclipse.core.launcher.Main.run(Main.java:987) at org.eclipse.core.launcher.Main.main(Main.java:962)
Created attachment 54978 [details] Fix
Released the fix to HEAD. Dani, please review.
The fix a workaround. More problems might/will arise in the future due to the workflow change done in AntEditorActionContributor. The menu should be built at the time when init(...) calls contributeToMenu(...), see Javadoc of init(...) for details. If Ant wants to stay with this hack then it must at least ensure that the menu is built before super.setActiveEditor(part) gets called. This isn't currently the case. Platform Text will leave the workaround in place since this doesn't harm on our side.
Resetting target to 3.3 as this probably won't make it into M4.
I can revisit as time allows but I do not believe this Ant code has changed for almost 2 yrs.
Didn't say so. It was probably bad since then and not discovered up to now ;-)
Not sure if this is even a problem anymore, Markus have you seen this issue recently? Is there a recent version of the ZRH-plugins I can get to try and reproduce?
> Not sure if this is even a problem anymore, Markus have you seen this issue > recently? No, I haven't, but that's because our workaround from comment 1 made the NPE go away. I haven't checked the Ant editor, but comment 3 probably still applies. > Is there a recent version of the ZRH-plugins I can get to try and reproduce? "ZRH-plugins" just means "all the plug-ins that are maintained in Zurich". I found this problem during our smoke test and committed the workaround to HEAD before the problem even appeared in a build. To reproduce the original problem, just revert the attached Fix in HEAD, i.e. move fQuickAssistMenuEntry= new ActionContributionItem(fQuickAssistAction); from the constructor of TextEditorActionContributor to after if (editMenu != null) { in TextEditorActionContributor#contributeToMenu(..).
The bug is still present in Ant. Actually there are three issues here: 1. the Javadoc says: * The <code>EditorActionBarContributor</code> implementation of this method * does nothing. Subclasses may reimplement to add to the menu portion of this * contribution. i.e. clients are allowed to *add* things but not suppress things from your super class. However, in the first call to this method by the editor framework this is not done because of this code: if (fOpenDeclarationAction == null) { return; } and because fOpenDeclaration is null. 2. Ant itself calls contributeToMenu (a second time) which is not good 3. OpenDeclarationAction.setEditor is broken as the editor site which is stored in the action is not updated As said in comment 3, future changes in any super class of AntEditorActionContributor might break Ant again.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.