for example my View has an id

public static final String ID = "examplePlugin.views.SampleView"

How do I get an instance of this View (or any other thing in eclipse ) by id ?

有帮助吗?

解决方案

For views you use methods on the current workbench page IWorkbenchPage. You can find the page with:

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

(this must be called from a plugin with the workbench running).

You can find an existing view with:

page.findView(id);

and create and show a view with:

page.showView(id);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top