Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345696

Summary: [Workbench] possible "dead" PagePartSelectionTracker created when registering PostSelectionListener for view from another perspective
Product: [Eclipse Project] Platform Reporter: Wolfgang Pedot <wolfgang.pedot>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, prakash, pwebster, remy.suen
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Wolfgang Pedot CLA 2011-05-13 04:07:08 EDT
Build Identifier: M20110210-1200

PagePartSelectionTracker searches for the part in the current perspective if created. If that part is not contained in the current perspective it will not get a reference right away but obtain it if the part is created later on.

The problem is when the wanted part is not in the current perspective but has been created already. I guess this is a rather unusual use case but this gave me quite a headache because its not that easy to reproduce if you dont know exactly what the problem is.

There is a quite simple solution for this since PagePartSelectionTracker already implements IPartListener one can simply change the currently empty partActivation method to call partOpened if the Tracker does not have a part-reference yet:

public void partActivated(IWorkbenchPart part) {
  if(getPart() == null) {
    partOpened(part);
  }
}






Reproducible: Always

Steps to Reproduce:
Lets say we have three views (VA,VB,VC) and 3 perspectives (PA,PB,PC) containing them like this:

PA contains VA
PB contains VA and VC
PC contains VB and VC

VC registers PostSelectionListeners to both VA and VB.

The following steps produce the problem:

1.) launch App (automatically opens PA)
2.) switch to PC, this creates VC and since VC registers PostSelectionListeners it also creates two PagePartSelectionTrackers for VA and VB but since PC does not contain VA the Tracker does not have a part-reference. The Tracker would obtain this reference later on if VA was created but since its already there it will never get one
3.) switch to PB and watch nothing happen in VC when you change the selection in VA
Comment 1 Prakash Rangaraj CLA 2011-05-13 04:13:28 EDT
(In reply to comment #0)
> VC registers PostSelectionListeners to both VA and VB.

   How do you do this?
Comment 2 Wolfgang Pedot CLA 2011-05-13 04:31:05 EDT
I call the following method of ISelectionService

public void addPostSelectionListener(String partId,ISelectionListener listener);
Comment 3 Eclipse Genie CLA 2019-09-26 09:20:49 EDT
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.

--
The automated Eclipse Genie.