Community
Participate
Working Groups
I've now bumped into this one more than a few times so i'm pretty sure it is a recurring eclipse or WTP bug. Sometimes when I double click on an xml file (and there is no real pattern on what type of xml) then I get a "Unable to create this part...." in the editor instead of the real editor. If I close this errored editor and do the same action (double click) it works fine. The stacktrace is as follows: java.lang.NullPointerException at org.eclipse.ui.texteditor.AbstractTextEditor.getAction(AbstractTextEditor.java:4023) at org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeActionBarContributor.getAction(XMLTableTreeActionBarContributor.java:210) at org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeActionBarContributor.setActiveEditor(XMLTableTreeActionBarContributor.java:198) at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorActionBarContributor.activateSourcePage(XMLMultiPageEditorActionBarContributor.java:54) at org.eclipse.wst.xml.ui.internal.tabletree.SourceEditorActionBarContributor.setActivePage(SourceEditorActionBarContributor.java:168) at org.eclipse.ui.part.MultiPageEditorPart.pageChange(MultiPageEditorPart.java:588) at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.pageChange(XMLMultiPageEditorPart.java:739) at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:689) at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:509) at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:275) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566) at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:214) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2537) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2470) at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2462) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2447) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2442) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2427) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:388) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:350) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:776) at org.eclipse.ui.views.markers.internal.ActionOpenMarker.run(ActionOpenMarker.java:86) at org.eclipse.ui.views.markers.internal.MarkerView.handleOpenEvent(MarkerView.java:1052) at org.eclipse.ui.views.markers.internal.TableView$2.open(TableView.java:176) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:811) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:809) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1063) at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1162) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:249) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:243) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:283) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
Amy, I think I've seen some base bugs on this too ... if you want to scan those. This might also be caused by some sort of "leak", where some editor was disposed (hence, fActions at line 4023 is null) but is being "opened again".
I've been getting this error since I started trying the 3.2 release candidates. I just got it twice on RC7 in the past 5 minutes...the exact same error message, exact same line number. But, if you close the error message, then double click on the XML again, it works.
I have not been able to recreate this in my copy of WTP 1.5 RC6. Did you already have several xml editors open? Did you just close this editor and then immediately tried to open it again? Were you opening a lot of editors really quickly? Do you open the xml editor with the design page open first or the source page? Like David pointed out, the exception is complaining of fActions being null, and the only time it is null is when the editor is disposed. So something must be disposing of it, then trying to reopen. One possibility is in StructuredTextEditor#doSetInput(). If a CoreException is caught, the editor is disposed, then throws a new CoreException. I wonder if we really need to call dispose() there.
*** Bug 148466 has been marked as a duplicate of this bug. ***
*** Bug 150935 has been marked as a duplicate of this bug. ***
*** Bug 150708 has been marked as a duplicate of this bug. ***
*** Bug 150479 has been marked as a duplicate of this bug. ***
Just to help here. I was using double click in the Package Explorer to open files and I did the following sequence to get hit with it. I had maybe another 4 to 6 editors open, but IIRC none were for XML files those editors were JSP and Java. My sequence today went something like: Double click on WEB-INF/lib/servlets.xml Whoops not the file I'm looking for, so very soon (< 1.5 seconds) I click the X in the editor tab to close it. Double click on WEB-INF/lib/servlet-mappings.xml Again very soon I click the X in the editor tab to close it. Double click on WEB-INF/lib/filters.xml Again very soon I click the X in the editor tab to close it. Double click on WEB-INF/lib/filter-mappings.xml Ah.. now I got the error! When I X to close, it closed the editors tab and I could just re-open it like normal by double cliking again, this time it worked.
Thanks everyone for their scenaros. I was finally able to reproduce this problem, and I found a completely reproducible scenario: 1. open xml editor, A 2. open a non-xml editor 3. open another xml editor, B 4. close xml editor B 5. reopen xml editor B 6. Exception occurs The problem appears to be with the action bar contributor. Basically, MultiPageActionBarContributor.setActivePage is called before MultiPageActionBarContributor.setActiveEditor. setActivePage utilizes what it thinks is the current multipageeditor when really, the multipageeditor variable is stale (it is the last editor which may have been disposed) when setActivePage is called before setActiveEditor (which is where multipageeditor is set) I opened bug 151488 on the base because the code that calls setActivePage & setActiveEditor is basically in their code. But I do have a workaround in the meantime to call setActiveEditor before setActivePage is first called when the editor is loaded. Add the following in XMLMultiPageEditorPart.createPages: // set the active editor in the action bar contributor first // before setactivepage calls action bar contributor's // setactivepage IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor(); if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) { ((MultiPageEditorActionBarContributor) contributor).setActiveEditor(this); }
Created attachment 46668 [details] org.eclipse.wst.xml.ui
Fix has been released to 1.5.1 & head.
*** Bug 152500 has been marked as a duplicate of this bug. ***
*** Bug 152509 has been marked as a duplicate of this bug. ***
*** Bug 152942 has been marked as a duplicate of this bug. ***
*** Bug 156092 has been marked as a duplicate of this bug. ***
*** Bug 159354 has been marked as a duplicate of this bug. ***
Closing as resolved since 1.5.1. If this bug should not be closed, please reopen.