Project: Eclipse_Platform_UI
Bug 246131 [ViewMgmt] PagePartSelectionTracker does not call setPart() for View opend in another Perspective
Reported: 2008-09-03 14:39:34 | Status: verified fixed

Build ID: M20080221-1800 Steps To Reproduce: 1. Perspective1 has View1 opened. 2. We switched to Perspective2 that does not have View1 opened. 3. We add Postselection Listener to View1 using getSite().getPage().addPostSelectionListener(View1.VIEW_ID, m_selectionListenerForView1); 4. Our listener m_selectionListenerForView1 is not notified. More information: The Problem explanation. View1 is already opened but not in Perspective2. So constructor PagePartSelectionTracker could not find this Part with page.findView(partId); This causes that setPart() is not called. The second chance to call setPart() is in the IPartListener.partOpened(IWorkbenchPart). But this callback is never called because this View1 has been already created. (Our analysis shows that partOpened event is actually partCreated event. is it correct?) A possible solution could be to use partActivated(IWorkbenchPart part) callback and call setPart() (the same way as partOpened() does) if part has not been set yet.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java