Ejemplo 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;
 }
Ejemplo 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;
 }