Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically showing a View from an Eclipse Plug-in

I have a plug-in to an Eclipse RCP application that has a view. After an event occurs in the RCP application, the plug-in is instantiated, its methods are called to populate the plug-in's model, but I cannot find how to make the view appear without going to the "Show View..." menu.

I would think that there would be something in the workbench singleton that could handle this, but I have not found out how anywhere.

like image 713
Brian Avatar asked Oct 05 '08 11:10

Brian


2 Answers

You are probably looking for this:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("viewId");
like image 86
ILikeCoffee Avatar answered Oct 23 '22 11:10

ILikeCoffee


If called from handler of a command

HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().showView(viewId);

would be better, as I know.

like image 20
Imaskar Avatar answered Oct 23 '22 12:10

Imaskar