问题
I want to control a view , like if I select a .js type of file , a particular view should be visible else for all other type it shouldn't. I dont want to use perspective as for just a single selection, it will be an overhead. Please suggest me any way to achieve the same through Eclipse plug-in Development.
回答1:
When you contribute the view, you either don't mention a perspective (in which case when the view is shown it defaults to the bottom right) or you use the org.eclipse.ui.perspectiveExtensions extension point to contribute it to a specific location. You can make it visible or invisible by default.
You make the view visible/invisible at runtime using the org.eclipse.ui.IWorkbenchCommandConstants.VIEWS_SHOW_VIEW command and the view ID parameter, or by using the showView()/hideView() API in org.eclipse.ui.IWorkbenchPage
See Plugging into the Workbench for more information.
来源:https://stackoverflow.com/questions/8265534/how-to-control-a-view-on-selecting-particular-file-type-in-eclipse-editor