I created 2 views. In the View 1 there is a button B 1 and upon button click View 1 gets hidden and View 2 opens.
But View 2 shows the close option to the user. I want this close option to be disabled. (The X mark at top right of window)
Below is my code snippet:
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewReference viewToClose = activePage.findViewReference(viewIdToClose);
activePage.hideView(viewToClose);
try {
activePage.showView(viewIdToOpen);
} catch (PartInitException e) {
e.printStackTrace();
}
How can I disable the close option in View 2?
Place the view using org.eclipse.ui.perspectiveExtensions
extension point and just set the closeable
attribute to false
.