Community
Participate
Working Groups
In our scenario we have registered a generic placeholder to define the position where multiple instances of the same view have to be displayed. This placeholder is defined in the createInitialLayout method of our perspective according to the following code: public class MyPerspective implements IPerspectiveFactory { public void createInitialLayout((IPageLayout layout){ .................. IFolderLayout folderMainContent = layout.createFolder("main", IPageLayout.RIGHT, 0.25f, editorId); folderMainContent.addView(WelcomeView.ID_VIEW); IViewLayout vlx = layout.getViewLayout(WelcomeView.ID_VIEW); vlx.setMoveable(false); vlx.setCloseable(false); folderMainContent.addPlaceholder(PlaceHolderView.ID_VIEW +":*"); layout.getViewLayout(PlaceHolderView.ID_VIEW+":*" ).setCloseable(false); ................. } } The views identified by PlaceHolderView.ID_VIEW and a unique secondary id are opened later using: IWorkbenchPage activePage = TellerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(). getActivePage(); (PlaceHolderView)activePage.showView(PlaceHolderView.ID_VIEW, generateUniqueId(), IWorkbenchPage.VIEW_ACTIVATE); All the generated views should be not closeable because, according to requirements, views can be closed only using push buttons . Despite the views have been defined as not closeable, they are (the red icon appears on the folder tab).
I believe the current behaviour is necessary to support the LWP use case of allow document views to be closeable, even though they have a placeholder in a fixed perspective In a fixed perspective, all initial views are marked as non-closeable and non-moveable, and currently placeholders are too, but this is ignored for placeholders. This is unintuitive, and doesn't allow us to support Sabina's scenario. It should be possible to fix this (in a backwards compatible way) by making the default state for placeholders be closeable and moveable, even if the perspective is fixed, but to honour these settings if they are explicitly overridden.
LWP perspectives are always generated dynamically, we are not using "fixed" perspectives at the moment but we do use fixed views extensively. I'm not sure I understand the problem here though. Seems to me there is just a bug with IViewLayout not honoring moveable/closable settings for placeholder layouts. I Think this actually a problem that LWP has hit once or twice and a bugzilla was just never opened. For the LWP use cases we would like to add placeholders for fixed views.
I have almost the exact same code (using a fixed perspective) and have also run into this problem. The placeholder is fixed - views added with showView always are added as an additional tab to the folder containing the view added with addView(). In the originator's case - with the WelcomeView. Even if you move a view added with showView elsewhere in the perspective, a future showView will add the view in the original placeholder location. It appears views added to a placeholder are not inheriting the placeholder's moveable/closeable settings.
Will investigate for 3.1.1.
We won't be able to address this for 3.1.1. Marking for 3.2.
Sorry - late in the game, a lot of bugs were moved around and too many 3.2 items ended up on my plate. Moving to 3.3 since I was not able to address this for 3.2.
I just noticed how many votes this bug had (even though almost all are from Italy :) If this is just a bug and fixing it does not involve API changes I can look at it for 3.2.1.
I think I can fix this - does anybody really care about putting it in 3.2.1? If yes, would you be willing to help me test my fix? If this is not a high priority, this will be fixed for 3.3.
I've been having problems in relation to this. I was wondering if this would make sense: In org.eclipse.ui.internal.Perspective, for the getViewLayoutRec(IViewReference ref, boolean create) method, change to this: /** * Returns the view layout rec for the given view reference, * or null if not found. If create is true, it creates the record * if not already created. */ private ViewLayoutRec getViewLayoutRec(IViewReference ref, boolean create) { ViewLayoutRec rec = getViewLayoutRec(ViewFactory.getKey(ref), create); if (rec == null) { rec = getViewLayoutRec(ref.getId(), false); } } This way if you are using views with wildcards (like someTestView:*), when it fails to find, say, "someTestView:1" it can look for "someTestView" instead, and use the values from that. Does this make sense?
(In reply to comment #9) > Does this make sense? Yes, although I am not sure if the fix should be put into getViewLayoutRec() or just isMoveable()/isCloseable(). I will look at this for M4.
Fixed >20061212.
Verified on Windows XP using I20061213-0800.
the fix doesn't work if you use secondary ids in placeholder views, as reported in the initial snippet when this bug was opened. The test has been made using eclipse 3.3M6 on Windows XP.
Created attachment 63805 [details] Testcase to show that the proposed fiz doesn't work when secondary ids in placeholder views are used In the attachment there is a simple RCP application with a Perspective and two Views. The first view , ButtonView , has a button used to create multiple instances of PlaceholderView that are placed in a folder layout. The layout of placeholderView states that the instances of this View should be NOT closeable but once created, they are.
Moving to RC1 for investigation. Not sure if I will be able to come up with a fix.
I should have explained this on the bug when I fixed it. In createInitialLayout, write folderMainContent.addPlaceholder(PlaceHolderView.ID_VIEW); layout.getViewLayout(PlaceHolderView.ID_VIEW).setCloseable(false); instead of folderMainContent.addPlaceholder(PlaceHolderView.ID_VIEW +":*"); layout.getViewLayout(PlaceHolderView.ID_VIEW+":*").setCloseable(false); Setting resolution back to fixed.