0

我有一个 viewId,这就是我想要做的。唯一的问题是如果视图已经打开,则视图不会刷新。

 String viewId="";
 IWorkbenchPage page = PlatformUI.getWorkbench()
                        .getActiveWorkbenchWindow().getActivePage();
   IViewReference[] references =page.getViewReferences();
for (IViewReference ivr :references) {
  if (ivr.getId().equalsIgnoreCase(viewId)) {
    page.hideView(ivr); //if already open then hide it
    break;
   }
}
//open a new instance
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId);
4

0 回答 0