Program: 129534
Project: 129534
Buggy source:
@Override protected void doRun(){
  ISelection selection=getSelection();
  connections=new ArrayList<IRepositoryViewObject>();
  procItems=new HashMap<String,Item>();
  needToUpdatePalette=false;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  for (  Object obj : ((IStructuredSelection)selection).toArray()) {
    if (obj instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)obj;
      restoreNode(node);
      while (node.getParent().getObject() != null && factory.getStatus(node.getParent().getObject()) == ERepositoryStatus.DELETED) {
        node=node.getParent();
        if (node.getObject().getProperty().getItem() instanceof FolderItem) {
          node.getObject().getProperty().getItem().getState().setDeleted(false);
        }
      }
    }
  }
  try {
    factory.saveProject(ProjectManager.getInstance().getCurrentProject());
    for (    String id : procItems.keySet()) {
      Item item=procItems.get(id);
      factory.save(item);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  procItems=null;
  if (!org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
    final boolean updatePalette=needToUpdatePalette;
    Display.getCurrent().syncExec(new Runnable(){
      public void run(){
        IRepositoryView repositoryView=RepositoryManagerHelper.getRepositoryView();
        if (repositoryView != null) {
          repositoryView.refresh();
        }
        if (updatePalette && GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
          ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
          service.updatePalette();
        }
      }
    }
);
    notifySQLBuilder(connections);
    connections=null;
  }
}

Fixed version (ground truth):
@Override protected void doRun(){
  final ISelection selection=getSelection();
  connections=new ArrayList<IRepositoryViewObject>();
  procItems=new HashMap<String,Item>();
  needToUpdatePalette=false;
  final IWorkspaceRunnable op=new IWorkspaceRunnable(){
    public void run(    IProgressMonitor monitor){
      IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
      for (      Object obj : ((IStructuredSelection)selection).toArray()) {
        if (obj instanceof RepositoryNode) {
          RepositoryNode node=(RepositoryNode)obj;
          restoreNode(node);
          while (node.getParent().getObject() != null && factory.getStatus(node.getParent().getObject()) == ERepositoryStatus.DELETED) {
            node=node.getParent();
            if (node.getObject().getProperty().getItem() instanceof FolderItem) {
              node.getObject().getProperty().getItem().getState().setDeleted(false);
            }
          }
        }
      }
      try {
        factory.saveProject(ProjectManager.getInstance().getCurrentProject());
        for (        String id : procItems.keySet()) {
          Item item=procItems.get(id);
          factory.save(item);
        }
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
      procItems=null;
    }
  }
;
  IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      IWorkspace workspace=ResourcesPlugin.getWorkspace();
      try {
        ISchedulingRule schedulingRule=workspace.getRoot();
        workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
    }
  }
;
  try {
    PlatformUI.getWorkbench().getProgressService().run(false,false,iRunnableWithProgress);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  if (!org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
    final boolean updatePalette=needToUpdatePalette;
    Display.getCurrent().syncExec(new Runnable(){
      public void run(){
        if (updatePalette && GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
          ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
          service.updatePalette();
        }
      }
    }
);
    notifySQLBuilder(connections);
    connections=null;
  }
}