views:

280

answers:

2

I have a tree view that is acting as a selection provider. In response to different types of selected items I would like to show a view. (Instantiate it is needed).

Can I do this by VIEW_ID and the workbench getViewRegistry?

+1  A: 

this is a dup of http://stackoverflow.com/questions/171824/programmatically-showing-a-view-from-an-eclipse-plug-in - you can find the answer there

Scott Stanchfield
+1  A: 

The basic technique is described best by the article
"Make your Eclipse applications richer with view linking",
based on a "selection provider-selection listener" pattern, which is a handy way to create views that respond to changes in other views, updated now with the Selection Service.

Something like:

IViewRegistry viewRegistry = this.getWorkbenchWindow().getWorkbench().getViewRegistry();
IViewDescriptor desc = viewRegistry.find(VIEW_ID);
window.getActivePage().showView(VIEW_ID);

should be able to open/create the view

VonC