Exemplo n.º 1
0
 @Nullable
 public static IViewPart findView(IWorkbenchWindow workbenchWindow, String viewId) {
   IViewReference[] references = workbenchWindow.getActivePage().getViewReferences();
   for (IViewReference ref : references) {
     if (ref.getId().equals(viewId)) {
       return ref.getView(false);
     }
   }
   return null;
 }
Exemplo n.º 2
0
 @Nullable
 public static <T> T findView(IWorkbenchWindow workbenchWindow, Class<T> viewClass) {
   IViewReference[] references = workbenchWindow.getActivePage().getViewReferences();
   for (IViewReference ref : references) {
     IViewPart view = ref.getView(false);
     if (view != null && viewClass.isAssignableFrom(view.getClass())) {
       return viewClass.cast(view);
     }
   }
   return null;
 }