@Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   HandlerUtil.toggleCommandState(event.getCommand());
   IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
   if (part instanceof RepositoriesView) {
     CommonViewer viewer = ((RepositoriesView) part).getCommonViewer();
     viewer.refresh();
   }
   return null;
 }
Ejemplo n.º 2
0
  public void run(IAction action) {
    if (navigator != null) {
      CommonViewer viewer = navigator.getCommonViewer();
      BugContentProvider provider =
          BugContentProvider.getProvider(navigator.getNavigatorContentService());
      // provider.setRefreshRequested(true);

      Object[] expandedElements = viewer.getExpandedElements();
      Object input = viewer.getInput();
      if (provider.getChildren(input).length == 0) {
        viewer.setInput(null);
        if (input instanceof IWorkingSet || input instanceof IWorkspaceRoot) {
          viewer.setInput(input);
        } else {
          viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
        }
        viewer.refresh(true);
      } else {
        provider.reSetInput();
      }
      viewer.setExpandedElements(expandedElements);
    }
  }