Bug 463962 - [ProblemsView] View content doesn't follow selection after hiding/unhiding view
Summary: [ProblemsView] View content doesn't follow selection after hiding/unhiding view
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.5   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: 4.5 M7   Edit
Assignee: Dirk Fauth CLA
QA Contact:
URL:
Whiteboard:
Keywords: greatfix
: 463957 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-04-06 04:41 EDT by Andrey Loskutov CLA
Modified: 2015-04-28 16:15 EDT (History)
1 user (show)

See Also:


Attachments
test workspace to reproduce (5.35 MB, application/zip)
2015-04-06 06:14 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2015-04-06 04:41:07 EDT
Build id: N20150404-1500

This seems to be a regression in the recent (post-M6) UI code: Problems view stops to change it's content while selecting different projects in the package explorer.

The view description changes (shows the right number of markers), but the tree is not updated.

I have selected "Show->All Errors/Warnings on Project" option. Changing to "Show All" doesn't help.

Closing and reopening view helps, but then for whatever reason the content stops to be updated again after hiding/unhiding the view.

This is not always reproducible, the root cause seems to be related to bug 463957, as a side-effect of bug 457939 fix, but this is just a guess. Once I see the exception stack below, the bug can be reproduced always.

To reproduce (after the error below):

1) Open Problems view
2) Check "Show->All Errors/Warnings on Project" option
3) Have at least two projects in the workspace with different number of warnings
4) Select each of the projects in the packages explorer, check that Problems view change the content properly
5) Open "errors" view in the same part stack as problems view (problems view is now invisible).
6) Click on the Problems view to make it visible again
7) From now on, selecting the projects in the package explorer doesn't change the Problems view content, only description with the number of warnings.


Error which seems to be related:

null
org.eclipse.equinox.event
Error
Mon Apr 06 10:32:11 CEST 2015
Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/ElementContainer/selectedElement/SET] {ChangedElement=org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl@4390f46e (elementId: bottom, tags: [newtablook, org.eclipse.e4.secondaryDataStack, Team, Git, General, Debug, Java, Plug-in Development, Icons Editor, active], contributorURI: null) (widget: CTabFolder {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer@2506e949, toBeRendered: true, onTop: false, visible: true, containerData: 4404, accessibilityPhrase: null), Widget=CTabFolder {}, AttName=selectedElement, NewValue=org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl@1948ea69 (elementId: org.eclipse.ui.views.ProblemView, tags: [], contributorURI: null) (widget: Composite {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer@4f820f42, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (closeable: false), EventType=SET, OldValue=org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl@27c04377 (elementId: org.eclipse.pde.runtime.LogView, tags: [], contributorURI: null) (widget: Composite {}, renderer: org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer@4f820f42, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (closeable: false)} to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@4ec28534

java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:95)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:186)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:145)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4601)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:212)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:85)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:59)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:488)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:454)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:721)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:698)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:636)
	at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:106)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.handleEvent(ContributedPartRenderer.java:62)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4449)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1317)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1341)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1326)
	at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1722)
	at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1685)
	at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:3894)
	at org.eclipse.swt.widgets.Control.gtk_event_after(Control.java:3194)
	at org.eclipse.swt.widgets.Tree.gtk_event_after(Tree.java:1915)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1941)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5584)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:3546)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4685)
	at org.eclipse.swt.internal.gtk.OS._gtk_widget_grab_focus(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_widget_grab_focus(OS.java:14268)
	at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2491)
	at org.eclipse.swt.widgets.Composite.forceFocus(Composite.java:571)
	at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2484)
	at org.eclipse.swt.widgets.Control.setFocus(Control.java:4422)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1454)
	at org.eclipse.ui.internal.views.markers.ExtendedMarkersView.setFocus(ExtendedMarkersView.java:1252)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.delegateSetFocus(CompatibilityPart.java:204)
	at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:253)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:225)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:107)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.focusGui(PartRenderingEngine.java:755)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$2.setFocus(ContributedPartRenderer.java:101)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1452)
	at org.eclipse.swt.custom.CTabItem.setFocus(CTabItem.java:332)
	at org.eclipse.swt.custom.CTabFolder.setFocus(CTabFolder.java:2602)
	at org.eclipse.swt.widgets.Control.fixFocus(Control.java:214)
	at org.eclipse.swt.widgets.Control.setVisible(Control.java:4915)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3146)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3154)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1841)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:330)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4449)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1317)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3787)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3398)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1120)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1001)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Comment 1 Andrey Loskutov CLA 2015-04-06 04:53:00 EDT
OK, found how to reproduce.
Open few text editors in Eclipse. Restart and now steps are reproducible. The errors from bug 463957 are not appearing.

The key thing seems to be opened but not initialized editor tabs, eventually side effect of bug 457939?
Comment 2 Andrey Loskutov CLA 2015-04-06 06:14:15 EDT
Created attachment 252172 [details]
test workspace to reproduce
Comment 3 Eclipse Genie CLA 2015-04-06 06:40:20 EDT
New Gerrit change created: https://git.eclipse.org/r/45317
Comment 4 Andrey Loskutov CLA 2015-04-06 07:48:44 EDT
Dirk, as far as I can see, bug 463957 is the same as this one and will be fixed by your patch too. If yes, I will make it duplicate.
Comment 5 Dirk Fauth CLA 2015-04-06 07:54:44 EDT
(In reply to Andrey Loskutov from comment #4)
> Dirk, as far as I can see, bug 463957 is the same as this one and will be
> fixed by your patch too. If yes, I will make it duplicate.

Yes it looks similar.
Comment 6 Andrey Loskutov CLA 2015-04-06 07:55:40 EDT
*** Bug 463957 has been marked as a duplicate of this bug. ***
Comment 8 Brian de Alwis CLA 2015-04-06 10:03:55 EDT
By way of background: MPlaceholders are a way to reference the same part instance from multiple perspectives (MPlaceholder#ref).  They're necessary as the E3.x model had parts be shared across perspectives within a window (e.g., the Problems view on the Java perspective was the same Problems view as shown in the Debug view).  Each part maintains a link back to its currently visible placeholder (MPart#curSharedRef).

Dirk's fix in bug 457939 corrected an issue such that when the MPlaceholder was destroyed (e.g., due to a perspective being closed) its the corresponding part's curSharedRef is nulled out, if that MPlaceholder was the currently visible reference.

It's perfectly valid for the curSharedRef to be null.  For example, when the currently visible perspective isn't showing a view that is open in another perspective.  But it rarely occurred previously.  

I'll review the rest of the callers of #getCurSharedRef() today.
Comment 9 Brian de Alwis CLA 2015-04-06 10:07:23 EDT
I'll add one other thing: there's a few small windows when MPart's curSharedRef will be out of sync with what's happening.  A selection event, like what this code in PartServiceImpl was handling, is one of them.  The other one I can think of is when a perspective is realized.
Comment 10 Brian de Alwis CLA 2015-04-06 10:10:25 EDT
I'll mark this as closed and continue any discussion in bug 457939.
Comment 11 Dirk Fauth CLA 2015-04-28 16:15:01 EDT
Tested with Eclipse 4.5.0 Integration Build: I20150428-0100 and it looks good.