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

Bug 311277

Summary: [PresentationAPI] Values set by IPlaceholderFolderLayout.setProperty not found in PresentationFactory
Product: [Eclipse Project] Platform Reporter: Julian <youhoo2000>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WONTFIX QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: youhoo2000
Version: 3.5.2Keywords: helpwanted
Target Milestone: 4.4 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Julian CLA 2010-05-01 06:08:01 EDT
Build Identifier: 20100218-1602

In the method "createInitialLayout" of my PerspectiveFactory class, 
I create a IPlaceholderFolderLayout using layout.createPlaceholderFolder, 
then I set some properties using IPlaceholderFolderLayout.setProperty

But in my PresentationFactory's methods, I cannot get these properties.

If I create a IFolderLayout (means using the "layout.createFolder") and set some properties, it works! I can get these properties in PresentationFactory's methods.

But in my case, I hope to use IPlaceholderFolderLayout, how to fix this??

PS: Sorry for my poor english, hope that you can read this.

Thanks.



Reproducible: Always

Steps to Reproduce:
.
Comment 1 Paul Webster CLA 2010-05-10 09:29:47 EDT
In org.eclipse.ui.internal.PlaceholderFolderLayout.setProperty(String, String) it only can set a property if placeholder.getRealContainer() is a PartStack.  We don't support this on non-realized stacks.

Maybe the properties have to be passed onto ContainerPlaceholder and buffered until org.eclipse.ui.internal.ContainerPlaceholder.setRealContainer(ILayoutContainer) is called?

PW
Comment 2 Julian CLA 2010-05-30 09:25:26 EDT
What I want to do is :

1. In PerspectiveFactory class, I create a "place holder" named "LeftPlaceFolder", and set one property "holderId" with the value "LEFT":

IPlaceholderFolderLayout holder = layout.createPlaceholderFolder("LeftPlaceFolder", IPageLayout.BOTTOM, 0.75f, editorAreaId);
holder.setProperty("holderId", "LEFT");

2. In other plugin, I contribute some views into this "place holder" via extensions :

<extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <view
               id="test.views.GeneralView"
               relationship="stack"
               relative="LeftPlaceFolder">
         </view>
      </perspectiveExtension>
</extension>

3. In the PresentationFactory class, I want to provider special presentation for    these views and this "place holder":

public StackPresentation createViewPresentation(Composite parent,
			IStackPresentationSite site) {
		
	if (site.getProperty("holderId") == "LEFT") {
		return new MyPresentation(parent, site);
	} else {
		return new WorkbenchPresentationFactory().createViewPresentation(parent, site);
		}
			
}

The problem is I cannot get value of the property that I set before.
Comment 3 Julian CLA 2010-05-30 09:28:20 EDT
If I use layout.createFolder, I can get the property value later, but if I user this, I cannot contibute views into the "folder".

Maybe I'm wrong somewhere, can you help me? Thanks.
Comment 4 Paul Webster CLA 2010-05-31 08:22:13 EDT
(In reply to comment #3)
> If I use layout.createFolder, I can get the property value later, but if I user
> this, I cannot contibute views into the "folder".

What do you mean?  perspectiveExtensions can contribute views to existing folders more easily than placeholder folders.

> Maybe I'm wrong somewhere, can you help me? Thanks.

Not getting properties from placeholder folders ... that's the bug I mentioned in comment #1

PW
Comment 5 Julian CLA 2010-05-31 09:39:08 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > If I use layout.createFolder, I can get the property value later, but if I user
> > this, I cannot contibute views into the "folder".
> 
> What do you mean?  perspectiveExtensions can contribute views to existing
> folders more easily than placeholder folders.
> 

Why I can not contribute views to existing folders? Is something wrong with following ?
-----------------------------------
PerspectiveFactory class:
-----------------------------------
public void createInitialLayout(IPageLayout layout) {
	//1. createFolder
	layout.createFolder("LeftFolder", IPageLayout.LEFT, 0.3f, IPageLayout.ID_EDITOR_AREA);

	//2. layout.createPlaceholderFolder
	//layout.createPlaceholderFolder("LeftFolder", IPageLayout.LEFT, 0.3f, IPageLayout.ID_EDITOR_AREA);
}
--------------------------------------------
plugin.xml:
--------------------------------------------
   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="*">
         <view
               id="test.view1"
               minimized="false"
               relationship="stack"
               relative="LeftFolder">
         </view>
      </perspectiveExtension>
   </extension>


If I use "createFolder", "view1" does not appear in the folder, it appeared at the right side of the editor area.

If I use "createPlaceholderFolder", "view1" appear in the folder.
Comment 6 Paul Webster CLA 2010-05-31 09:45:30 EDT
(In reply to comment #5)
> > What do you mean?  perspectiveExtensions can contribute views to existing
> > folders more easily than placeholder folders.
> > 
> 
> Why I can not contribute views to existing folders? Is something wrong with
> following ?

I meant stack on an existing folder with a view, sorry.  Your scenario is a separate bug, bug 118693

PW
Comment 7 Julian CLA 2010-05-31 10:12:35 EDT
(In reply to comment #6)
> I meant stack on an existing folder with a view, sorry.  Your scenario is a
> separate bug, bug 118693
> 
> PW

Thank your quick answer! You are so kind !

Now I use following solution instead:

1. create a folder and add a first view into the folder by code.

2. contribute other views, stack on the first view

Although I need to create a "hardcode" view first, but in the present circumstances it can be accepted.
Comment 8 Lars Vogel CLA 2014-05-02 04:47:51 EDT
The PresentationAPI has been deprecated with the Eclipse 4.x release and it has been replaced with the CSS engine. I therefore close this bugs as WONTFIX. In case your bug report is still valid for the Eclipse 4.4 release, please open a new bug report for it.