Bug 339360 - MultiPage Editor's selectionProvider does not notify PropertySheet
Summary: MultiPage Editor's selectionProvider does not notify PropertySheet
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.6.2+   Edit
Assignee: Remy Suen CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2011-03-09 09:45 EST by Per Digre CLA
Modified: 2011-05-10 13:23 EDT (History)
8 users (show)

See Also:
bokowski: review+


Attachments
MultiPageEditorSite patch v1 (1.66 KB, patch)
2011-03-17 08:59 EDT, Remy Suen CLA
no flags Details | Diff
Code to reproduce the issue (20.44 KB, application/zip)
2011-03-17 09:37 EDT, Oleg Besedin CLA
no flags Details
PropertySheetPage patch v1 (1.79 KB, patch)
2011-03-31 10:39 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Digre CLA 2011-03-09 09:45:27 EST
Build Identifier: M20110210-1200

After upgrading last week to Build id: M20110210-1200 with Eclipse for RCP and RAP Developers - 1.3.2.20110301-1807 the problems started occuring.

The Tabbed Propertysheet no longer gets the new selection as the selection changes in the MultiPageEditorPart. This is specific to the Multipage editor as I have no problems with the EditorPart. If I go back to the 1.3.1 version then the Tabbed PropertySheet tracks the MultiPage editor as expected. I am not sure whether it is specific to the Tabbed Property sheet either, but that's what I have been using.

I believe the MultiPageSelectionProvider doesn't relay the events, but unfortunately I seem unable to debug it fruther since I am no longer able to see the code for MultiPageEditorPart. This source seems protected by "The JAR of this class file belongs to container 'Plug-in dependencies' which does not allow modifications to source attachements of its entries".

A sidenote, previous version had a problem where it was impossible to garbage collect the MultiPage editor because it didn't remove the selectionProvider on close, but I think that's noted in different bug report.
  


Reproducible: Always

Steps to Reproduce:
1. Create MultiPageEditorPart
2. Link to Tabbed Property sheet
3. See it doesn't follow the selection in the MultiPageEditorPart
Comment 1 Remy Suen CLA 2011-03-09 10:06:20 EST
Do all your editor page's selection providers implement IPostSelectionProvider?
Comment 2 Per Digre CLA 2011-03-10 02:23:58 EST
(In reply to comment #1)
> Do all your editor page's selection providers implement IPostSelectionProvider?
No I had not. it works ok after I added the IPostSelectionProvider, thanks!
You may close the issue.
Comment 3 Per Digre CLA 2011-03-10 02:38:36 EST
After updating the Eclipse installation today, SDK-3.6.2 I am now again able to see the source code, making debugging a lot simpler :-)
Comment 4 Prakash Rangaraj CLA 2011-03-10 02:41:09 EST
(In reply to comment #2)
> No I had not. it works ok after I added the IPostSelectionProvider, thanks!

Marking as works-for-me
Comment 5 Remy Suen CLA 2011-03-10 06:32:54 EST
(In reply to comment #4)
> (In reply to comment #2)
> > No I had not. it works ok after I added the IPostSelectionProvider, thanks!
> 
> Marking as works-for-me

I am reopening this as I am not satisfied with the "resolution" of this issue. Plug-ins that worked before 3.6.1 will simply not work anymore after the user upgrades their system to 3.6.2.

We need to figure out _why_ this is happening and automatically forward a post selection event if the selection provider doesn't implement IPostSelectionProvider and maybe add an entry into the migration guide (I say "maybe" because  this change is in both 3.6.2 and 3.7.0).

Per, please provide some code to reproduce this problem.
Comment 6 Per Digre CLA 2011-03-10 07:32:57 EST
I have been using this for a modelling framework, but my problem editor is a little hard to pull-out so I will have to come up with an example from scratch if it is necessary.

Maybe this gives some clues....

It's basically a MultiPageEditorPart with two pages extending EditorPart who each uses a org.eclipse.jface.viewers.TreeViewer. 
The multipage editor part implements ITabbedPropertySheetPageContributor and such connects to the Tabbed property Sheet.
The EditorPart implements the IPostSelectionProvider / ISelectionProvider and just relays the implementation methods of the TreeViewer's default implementation.

As such it works better with the IPostSelectionProvider than the plain ISelectionProvider :-)
Comment 7 Remy Suen CLA 2011-03-10 07:42:58 EST
(In reply to comment #6)
> The EditorPart implements the IPostSelectionProvider / ISelectionProvider and
> just relays the implementation methods of the TreeViewer's default
> implementation.

So what is the difference here? Your nested editor parts used to just implement ISelectionProvider and now it implements IPostSelectionProvider?
Comment 8 Per Digre CLA 2011-03-10 07:56:19 EST
(In reply to comment #7)
> (In reply to comment #6)
> > The EditorPart implements the IPostSelectionProvider / ISelectionProvider and
> > just relays the implementation methods of the TreeViewer's default
> > implementation.
> 
> So what is the difference here? Your nested editor parts used to just implement
> ISelectionProvider and now it implements IPostSelectionProvider?

Exactly, it works like before when I changed to the IPostSelectionProvider!
Comment 9 Dani Megert CLA 2011-03-15 04:31:29 EDT
I agree with comment 5.

Per it would be good to have a little sample. I suspect that a performance fix we mad in 3.7 (bug 162079) and which we backported to 3.6.2 (bug 332041), reveals a bug in MultiPageSelectionProvider or MultiPageEditorPart.
Comment 10 Per Digre CLA 2011-03-15 05:29:28 EDT
(In reply to comment #9)
> I agree with comment 5.
> 
> Per it would be good to have a little sample. I suspect that a performance fix
> we mad in 3.7 (bug 162079) and which we backported to 3.6.2 (bug 332041),
> reveals a bug in MultiPageSelectionProvider or MultiPageEditorPart.

Ok, I will do. I may be able to do so before the end of this week.
Comment 11 Remy Suen CLA 2011-03-17 08:59:40 EDT
Created attachment 191412 [details]
MultiPageEditorSite patch v1

The MultiPageSelectionProvider implements IPostSelectionProvider but may end up not forwarding the selections of its inner editors if those selection providers don't implement IPostSelectionProvider. The fix is to hook up our post selection listeners even if the inner selection providers don't implement IPostSelectionProvider.

Should add a test for this.
Comment 12 Oleg Besedin CLA 2011-03-17 09:37:35 EDT
Created attachment 191416 [details]
Code to reproduce the issue

This plugin reproduces the issue. To setup:

- In the debug workspace create a project and copy paste file \abc\data\data.frt from this plugin. 
- Open the file with "Fruit Multi-page Editor"
- Open the Properties view

To duplicate:

- Expand any top-level category and select a second level item in the tree. 
In 3.6 properties are shown in the properties view
In 3.6.2 and 3.7 they are only shown when MultiPageEditor switches pages.
Comment 13 Oleg Besedin CLA 2011-03-17 10:37:48 EDT
To clarify:

This issue is the result of the change made in the bug 162079 (Eclipse 3.7) / bug 332041 (Eclipse 3.6.2).

The problem:

All multi-part editor containing pages that does not support post-selection listeners will stop providing updates to the Properties view.

Fix for the immediate problem:

Remy’s patch fixes the problem form MPE, similarly to what was done for PageBookView in the bug 162079 comment 20.

Concerns:

This is the second issue that came from the performance fix for the bug 162079. It makes it clear that that change breaks “selection aggregators” that work on parts that don’t supply post-selection events.

Due to the nature of the selection code, unless the person is fully aware of the change in the bug 162079, it will be rather hard for affected Eclipse developers to figure out why their application broke with the update to 3.6.2 / 3.7.

As such, my vote goes to rolling back the change made in the bug 162079 in 3.6.2+ and 3.7 streams.
Comment 14 Dani Megert CLA 2011-03-17 10:51:21 EDT
If a selection provider doesn't correctly handle post selection listeners then the bug is clearly there. Having said that, I could agree to revert the performance fix in 3.6.2 again but we should leave it in 3.7 and add a note to the migration guide.
Comment 15 Oleg Besedin CLA 2011-03-24 10:17:59 EDT
Boris and Paul, what's you take on this?
Comment 16 Paul Webster CLA 2011-03-24 10:46:25 EDT
(In reply to comment #15)
> Boris and Paul, what's you take on this?

I agree with Dani.  We should roll it back (in 3.6.2+) but keep it in 3.7.  We should also mention it soon on cross-project-issues so the release train is aware.

PW
Comment 17 Dani Megert CLA 2011-03-24 11:12:50 EDT
I can take this bug if you want, given I broke it :-(
Comment 18 Remy Suen CLA 2011-03-24 11:21:09 EDT
(In reply to comment #17)
> I can take this bug if you want, given I broke it :-(

I'm planning to open a new bug next week (for the MPSP problem itself) and then leave this one open for the discussion of rollback/migration guide/what-not. I also wanted to add a test for the MPSP selection problem and probably another test to check that the 'Properties' view reacts properly.
Comment 19 Dani Megert CLA 2011-03-24 11:41:04 EDT
Good. Looks like you want to drive/own this ;-)
Comment 20 Remy Suen CLA 2011-03-29 08:23:21 EDT
Opened bug 341219 for the changes required for MultiPageEditorSite and bug 341220 for an update to the migration guide.
Comment 21 Remy Suen CLA 2011-03-31 09:31:09 EDT
Should I rollback all the changes from attachment 184778 [details] or just the changes to PropertySheet? I would like to avoid changing excessive amounts of code if necessary.
Comment 22 Dani Megert CLA 2011-03-31 09:51:06 EDT
(In reply to comment #21)
> Should I rollback all the changes from attachment 184778 [details] [diff] or just the changes to
> PropertySheet? I would like to avoid changing excessive amounts of code if
> necessary.
I agree: we should only change back to use the normal selection listener. However, Remy it would be good to review the other changes again - just to be sure.
Comment 23 Remy Suen CLA 2011-03-31 10:39:30 EDT
Created attachment 192282 [details]
PropertySheetPage patch v1

Marking attachment 191412 [details] as obsolete as that bug has been fixed by bug 341219. Thank you very much for the bug report, Per!

(In reply to comment #22)
> However, Remy it would be good to review the other changes again - just to be
> sure.

There doesn't seem to be anything suspicious here. The changes to TabbedPropertySheetPageTextTest have been modified to be on a timeout instead so it shouldn't get into an infinite loop even if things go wrong.

The changes for PageBookView are legitimate given that the selection provider does indeed implement IPostSelectionProvider but may not actually forward any such events out depending on what page is currently shown.
Comment 24 Remy Suen CLA 2011-03-31 10:40:18 EDT
Boris, please review attachment 192282 [details]. Please refer to comment 13 for context.
Comment 25 Boris Bokowski CLA 2011-05-10 12:03:15 EDT
After discussing with Remy, I can give my +1 for rolling back the change in PropertySheet.java in 3.6.2.
Comment 26 Remy Suen CLA 2011-05-10 13:22:51 EDT
(In reply to comment #23)
> Created attachment 192282 [details]
> PropertySheetPage patch v1

Patch released to R3_6_maintenance branch.

Thank you to all parties involved and thank you again Per for reporting this bug.
Comment 27 Remy Suen CLA 2011-05-10 13:23:04 EDT
Whoops. :)