Yesterday I was hit with the requirement to not restore/set to be hidden certain views after workbench restart. Unfortunately this isn't supported in the current (latest) incarnation of the org.eclipse.ui.views EP, though it shouldn't be too hard to extend the EP schema. But since changing org.eclipse.ui code isn't a short term solution anyway, I reverted to a poor mans version of an EP (btw. thanks to pwebster for inspiration). Basically the RCP checks for a given substring in all secondary ids of open ViewReferences in the WorkbenchWindowAdvisor#postWindowCreate startup hook. The implementation is pretty much straight forward:
// do not restore certain views whose secondary view ID contains "NO_RESTORE"
IWorkbenchPage[] pages = getWindowConfigurer().getWindow().getPages();
for(int i = 0; i < pages.length; i++) {
IWorkbenchPage workbenchPage = pages[i];
IViewReference[] viewReferences = workbenchPage.getViewReferences();
for(int j = 0; j < viewReferences.length; j++) {
IViewReference viewReference = viewReferences[j];
String secondaryId = viewReference.getSecondaryId();
if(secondaryId != null && secondaryId.contains("NO_RESTORE")) {
workbenchPage.hideView(viewReference);
}
}
}
To define a view to be non-restorable is done by concatenating "NO_RESTORE" into the secondary view id string.
Hard coding the view id in WorkbenchWindow#postWindowCreate is a bad alternative, because it unnecessarily separates the view properties from the bundle hosting the view. Also it makes the RCP bundle specific for certain views. It's IMO simply the wrong location. Personally I find this functionality important enough to be included, so I've create Bug #215797. If you agree, please give it a vote.
The next item on my todo list, is to get rid of unwanted "Show View" shortcuts, because leaning back waiting for 3.4 to hit the road unfortunately isn't an option. :(