This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 410049 - [Perspectives] Complex Placeholderfolder construct does not get rendered
Summary: [Perspectives] Complex Placeholderfolder construct does not get rendered
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 4.4 M4   Edit
Assignee: Daniel Rolka CLA
QA Contact: Wojciech Sudol CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-06 05:55 EDT by Wim Jongman CLA
Modified: 2013-12-10 12:05 EST (History)
4 users (show)

See Also:
pwebster: review? (emoffatt)


Attachments
Effect of perspective (72.62 KB, image/png)
2013-06-06 06:50 EDT, Wim Jongman CLA
no flags Details
Model state (132.73 KB, image/png)
2013-06-06 06:56 EDT, Wim Jongman CLA
no flags Details
Complete RCP app that demonstrates the problem (20.93 KB, application/x-zip-compressed)
2013-06-07 03:50 EDT, Wim Jongman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wim Jongman CLA 2013-06-06 05:55:52 EDT
We are using this construct which does not work in juno rcp:

layout.createPlaceholderFolder(ID + ".folder.left", IPageLayout.LEFT, 0.3f, layout.getEditorArea()); //$NON-NLS-1$
layout.createPlaceholderFolder(ID + ".folder.left.bottom", IPageLayout.BOTTOM, 0.65f, ID + ".folder.left"); //$NON-NLS-1$
layout.createPlaceholderFolder(ID + ".folder.bottom", IPageLayout.BOTTOM, 0.65f, layout.getEditorArea()); //$NON-NLS-1$

What does work in juno is this

layout.createPlaceholderFolder(ID + ".folder.left_top", IPageLayout.LEFT, 0.3f, layout.getEditorArea()); //$NON-NLS-1$
layout.createPlaceholderFolder(ID + ".folder.left_bottom", IPageLayout.BOTTOM, 0.65f, ID + ".folder.left_top"); //$NON-NLS-1$
layout.createPlaceholderFolder(ID + ".folder.bottom", IPageLayout.BOTTOM, 0.65f, layout.getEditorArea()); //$NON-NLS-1$
Comment 1 Wim Jongman CLA 2013-06-06 06:47:12 EDT
I'm sorry but that is probably not what is causing the problems. Even with the latter construct (which seemingly solved the problem in a different perspective) the views are not rendered. 


I believe now that it has to do with the rendering of the "left corner" placeholder that I am trying to create. If I open the live application model, I see that the placeholder construct is created correctly but that the "to be rendered" flag is off. The views are correcly placed in the stacks and if I flip the "to be rendered"flag of the partstack then the views become visible.

If I change strategy and put the construct like so:

layout.createPlaceholderFolder(ID + ".folder.left", IPageLayout.LEFT, 0.3f, layout.getEditorArea());
layout.createPlaceholderFolder(ID + ".folder.bottom", IPageLayout.BOTTOM, 0.65f, layout.getEditorArea()); 
layout.createPlaceholderFolder(ID + ".folder.corner", IPageLayout.LEFT, 0.3f, ID + ".folder.bottom"); 

apart from the not rendered flag the construct looks fine in the application model.
Comment 2 Wim Jongman CLA 2013-06-06 06:50:22 EDT
Created attachment 232034 [details]
Effect of perspective

layout.createPlaceholderFolder(ID + ".folder.left", IPageLayout.LEFT, 0.3f, layout.getEditorArea());
layout.createPlaceholderFolder(ID + ".folder.bottom", IPageLayout.BOTTOM, 0.65f, layout.getEditorAre
layout.createPlaceholderFolder(ID + ".folder.corner", IPageLayout.BOTTOM, 0.65f, ID + ".folder.left"
Comment 3 Wim Jongman CLA 2013-06-06 06:56:02 EDT
Created attachment 232035 [details]
Model state
Comment 4 Wim Jongman CLA 2013-06-06 12:42:58 EDT
(In reply to comment #3)
> Created attachment 232035 [details]
> Model state

Can you point me to some classes you suspect? Then I will take a look.
Comment 5 Eric Moffatt CLA 2013-06-06 13:57:23 EDT
Wim, none of your examples show the definition of any placeholder elements nor their referenced MParts...any chance you could append a more complete snippet ?

It's not part of the normal rendering behavior to automatically make a parent's TBR true just because it has children with TBR true...

My first thought was to use 'createFolder' rather than 'createPlaceholderFolder'. The difference should be that *this* folder is created with its TBR already == true.

Note that you may be confused by the term 'placeholder' which in this case has absolutely no effect on how the views are placed (they'll always be accessed through MPlaceholders)...it's a leftover from 3.x where there were different concepts. 

If you were, for example creating a stack that shouldn't be initially shown then you'd use 'addPlaceholderFolder' but then the expectation would be that all its views were initially not to be shown; showing one of them would also make the stack visible.
Comment 6 Wim Jongman CLA 2013-06-07 03:45:14 EDT
(In reply to comment #5)

Eric, to be complete, I am taking a legacy RCP and I am just running it unmodified. The legacy RCP uses the perspectivefactory class to define the initial layout with placeholderfolder. AFAIK a valid and well know pattern. Finally, it is using perspectiveextensions to submit views into place.

The result is that the views are invisible in 4.x but the views are visible in 3.x

IMHO, when the compat layer runs the perspectivefactory then the resulting partstack should indeed have TBR:false, however, as soon as a view is placed according to the perspectiveextension then the partstack should be made visible.
Comment 7 Wim Jongman CLA 2013-06-07 03:50:28 EDT
Created attachment 232072 [details]
Complete RCP app that demonstrates the problem


Please run it and you will see that there is only one view visible. This view is placed in a placeholderfolder called "..bottom". There are two other placeholderfolders to the left of this view. These are relative to each other and are rendered as a partstack however, the flag TBR is false which gives the wrong result.

Please add the live model editor to the run config to see the resulting model.
Comment 8 Eric Moffatt CLA 2013-06-07 10:52:42 EDT
Wim, got it...you're almost certainly correct and thanks for the analysis. We need something like the inverse of the cleanup addon that, once all perspectives have been fully defined resets the TBR on any stacks that actually contain TBR 'true' entries (and or resets the TBR as part of the 'addView' code).

I've tagged this for the SR1 release since it's a regression against 3.x...
Comment 9 Wim Jongman CLA 2013-07-31 10:03:47 EDT
Moving to major since it will fail to render unmodified existing RCP applications when they are using the layout.createPlaceHolderFolder method in the perspective class.
Comment 10 Wim Jongman CLA 2013-08-19 10:42:58 EDT
A workaround is to replace PlaceholderFolder with Folder. In 4.x using Folder has the same effect as PlaceholderFolder in 3.x. Unfortunately simply replacing Placeholderfolder with Folder gives problems in 3.x.

So to remain compatible, code like this must be used in the IPerspectiveFactory Class:


// Pseudo code
String version = Platform.getBundle(Platform.PI_RUNTIME).getHeaders().get("Bundle-Version");

if (version < ("3.8.0")) {
layout.createPlaceholderFolder ...
} else {
layout.createFolder ...
}
Comment 11 Daniel Rolka CLA 2013-11-19 08:09:40 EST
The patch proposal has been sent to Gerrit: https://git.eclipse.org/r/#/c/18561/

thanks,
Daniel
Comment 12 Eric Moffatt CLA 2013-11-20 14:49:40 EST
Switching milestone to 4.4M4 since the Gerrit patch was against master...

Daniel, I tested your patch but found that it was making stacks that should not be visible show up. When going over the defect I noticed that there was a particular pattern being used; the placeholder stacks were added using the perspective factory but the views were being added using perspectiveExtensions.

The actual bug seems to be that while the view *and its stack* are both TBR true the stack's parent sash container's TBR was false...

Turns out that 'addView' (via 'insert') has code that walks up the model setting TBR to true for *all* parents of the newly added view (line 597). The corresponding code to parse the perspectiveExtensions calls 'stackView' (in PerspectiveExtensionReader) and this code was lacking the same 'set TBR to true' pattern.

I've tried the fix above locally and it works but perhaps you can find a way to re-use the 'insert' method from within 'stackView' which would clean up the code *and* fix the defect ?
Comment 13 Daniel Rolka CLA 2013-11-22 07:41:46 EST
(In reply to Eric Moffatt from comment #12)
> Switching milestone to 4.4M4 since the Gerrit patch was against master...
> 
> Daniel, I tested your patch but found that it was making stacks that should
> not be visible show up. When going over the defect I noticed that there was
> a particular pattern being used; the placeholder stacks were added using the
> perspective factory but the views were being added using
> perspectiveExtensions.
> 
> The actual bug seems to be that while the view *and its stack* are both TBR
> true the stack's parent sash container's TBR was false...
> 
> Turns out that 'addView' (via 'insert') has code that walks up the model
> setting TBR to true for *all* parents of the newly added view (line 597).
> The corresponding code to parse the perspectiveExtensions calls 'stackView'
> (in PerspectiveExtensionReader) and this code was lacking the same 'set TBR
> to true' pattern.
> 
> I've tried the fix above locally and it works but perhaps you can find a way
> to re-use the 'insert' method from within 'stackView' which would clean up
> the code *and* fix the defect ?

Could you please give the usecase where the patch does not work? I'm going to verify the next version of patch using it

Daniel
Comment 14 Daniel Rolka CLA 2013-11-25 09:53:05 EST
New version of patch has been submitted to Gerrit

Daniel
Comment 15 Paul Webster CLA 2013-11-28 13:51:57 EST
Eric, there's a new patch on https://git.eclipse.org/r/#/c/18561/ to be reviewed.

PW
Comment 16 Eric Moffatt CLA 2013-11-29 15:12:40 EST
Daniel, sorry for the delay. See bug 409834. There's a project on here that provides two perspectives A & B which initially open with just the editor area showing and has a toolbar button to open a view.

When I applied your initial patch I noticed that the perspectives were now initially showing empty stacks, not hidden as expected...

I'll review the new patch, thanks... (a quick glance looks good)
Comment 18 Daniel Rolka CLA 2013-12-10 12:02:49 EST
Verified in the build: I20131209-2000

Daniel
Comment 19 Wim Jongman CLA 2013-12-10 12:05:02 EST
(In reply to Daniel Rolka from comment #18)
> Verified in the build: I20131209-2000
> 

Thanks guys. Much appreciated.