I have a RCP application with different perspectives. In one perspective, there are several views defined as such:
p_layout.addStandaloneView(View1.ID, true, IPageLayout.LEFT, lf_ratioView1, p_layout.getEditorArea());
p_layout.addStandaloneView(MyView.ID, false, IPageLayout.TOP, lf_ratioMyView, View1.ID);
final IFolderLayout lf_detailsFolder = p_layout.createFolder("Details", IPageLayout.RIGHT, lf_ratioDetailsView, View1.ID);
lf_detailsFolder.addPlaceholder(DetailsView.ID);
lf_detailsFolder.addPlaceholder(View2.ID);
lf_detailsFolder.addPlaceholder(View3.ID + ":*");
lf_detailsFolder.addView(View4.ID);
p_layout.addStandaloneView(View 5.ID, true, IPageLayout.BOTTOM, lf_ratioView5, "Details");
p_layout.addStandaloneView(View6.ID, false, IPageLayout.BOTTOM, lf_ratioView6, View5.ID);
Where the p_layout is a IPageLayout object. These views are closed and opened by pressing different buttons.
I would like to disable the close option for the views in the FolderLayout: DetailsView, View2, View3 and View 4 so that the user can only close them by using those buttons.
I tried by setting the attribute closable from the view extension point in the plugin.xml to true, but it did not work.
I also tried by code:
p_layout.getViewLayout(DetailsView.ID).setCloseable(false);
p_layout.getViewLayout(View2.ID).setCloseable(false);
p_layout.getViewLayout(View3.ID).setCloseable(false);
p_layout.getViewLayout(View24.ID).setCloseable(false);
Also did not work.
The RCP application is built from Eclipse Mars.
Apparently the method setCloseable(false)
for each View that I didn't want to be able to close was the correct answer.
I had start the application with the "clean the workspace" attribute activated so that the function could be effective.