Program: 129480
Project: 129480
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(){
  ISelection selection=getSelection();
  connections=new ArrayList<IRepositoryViewObject>();
  procItems=new HashMap<String,Item>();
  needToUpdatePalette=false;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  final Set<ERepositoryObjectType> types=new HashSet<ERepositoryObjectType>();
  for (  Object obj : ((IStructuredSelection)selection).toArray()) {
    if (obj instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)obj;
      types.add(node.getObjectType());
      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) {
          RepositoryManager.refresh(types);
        }
        if (updatePalette && GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
          ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
          service.updatePalette();
        }
      }
    }
);
    notifySQLBuilder(connections);
    connections=null;
  }
}