I have a view in Eclipse (implemented by a class which extends org.eclipse.ui.part.ViewPart) which I need to close. I mean completely close, not just hide. I wa
The org.eclipse.ui.internal.ViewFactory has a method called releaseView that I think closes the view completely (though I'm not certain). It takes an IViewReference.
You can access the ViewFactory by calling Perspective.getViewFactory, and you can access the Perspective, you then pass it an IViewReference to release the view.
IWorkbenchPage page =
Workbench.getInstance().getActiveWorkbenchWindow().getActivePage()
Perspective perspective = page.getPerspective();
String viewId = "myViewId"; //defined by you
//get the reference for your viewId
IViewReference ref = page.findViewReference(viewId);
//release the view
perspective.getViewFactory.releaseView(ref);