Program: 129714
Project: 129714
Buggy source:
@Override protected void doRun(){
  final ISelection selection=getSelection();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  final DeleteActionCache deleteActionCache=DeleteActionCache.getInstance();
  deleteActionCache.setGetAlways(false);
  deleteActionCache.setDocRefresh(false);
  deleteActionCache.createRecords();
  final Set<ERepositoryObjectType> types=new HashSet<ERepositoryObjectType>();
  final List<RepositoryNode> deletedFolder=new ArrayList<RepositoryNode>();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
      for (      Object obj : ((IStructuredSelection)selection).toArray()) {
        if (obj instanceof RepositoryNode) {
          RepositoryNode node=(RepositoryNode)obj;
          try {
            if (containParent(node,(IStructuredSelection)selection)) {
              continue;
            }
            if (isForbidNode(node)) {
              continue;
            }
            if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
              if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                Item repoItem=node.getObject().getProperty().getItem();
                if (service != null && !repoItem.getState().isDeleted()) {
                  final StringBuffer jobNames=service.getAllTheJObNames(node);
                  if (jobNames != null) {
                    Display.getDefault().syncExec(new Runnable(){
                      public void run(){
                        String message=jobNames.toString() + Messages.getString("String_Node_Str");
                        final Shell shell=getShell();
                        confirmAssignDialog=MessageDialog.openQuestion(shell,"String_Node_Str",message);
                      }
                    }
);
                    if (!confirmAssignDialog) {
                      continue;
                    }
                  }
                }
              }
              if (isInDeletedFolder(deletedFolder,node.getParent())) {
                continue;
              }
              boolean needReturn=deleteElements(factory,deleteActionCache,node);
              if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET) {
                needToUpdataPalette=true;
              }
              if (needReturn) {
                return;
              }
              types.add(node.getObjectType());
            }
 else             if (node.getType() == ENodeType.SIMPLE_FOLDER) {
              FolderItem folderItem=(FolderItem)node.getObject().getProperty().getItem();
              if (node.getChildren().size() > 0 && !folderItem.getState().isDeleted()) {
                if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                  IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                  if (service != null) {
                    final StringBuffer jobNames=service.getAllTheJObNames(node);
                    if (jobNames != null) {
                      Display.getDefault().syncExec(new Runnable(){
                        public void run(){
                          String message=null;
                          if (jobNames.toString().contains("String_Node_Str")) {
                            message=jobNames.toString() + Messages.getString("String_Node_Str");
                          }
 else {
                            message=jobNames.toString() + Messages.getString("String_Node_Str");
                          }
                          final Shell shell=getShell();
                          confirmAssignDialog=MessageDialog.openQuestion(shell,"String_Node_Str",message);
                        }
                      }
);
                      if (!confirmAssignDialog) {
                        continue;
                      }
                    }
                  }
                }
              }
              boolean isSqlTemplate=false;
              if (node.getObject() instanceof Folder) {
                Object label=node.getProperties(EProperties.LABEL);
                if (ENodeType.SIMPLE_FOLDER.equals(node.getType()) && ERepositoryObjectType.SQLPATTERNS.equals(node.getContentType()) && (label.equals("String_Node_Str") || label.equals("String_Node_Str") || label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")) || label.equals("String_Node_Str")) {
                  isSqlTemplate=true;
                }
              }
              if (!isSqlTemplate) {
                types.add(node.getContentType());
                if (node.getContentType() == ERepositoryObjectType.PROCESS || node.getContentType() == ERepositoryObjectType.JOBLET) {
                  types.add(ERepositoryObjectType.DOCUMENTATION);
                }
                deletedFolder.add(node);
                deleteFolder(node,factory,deleteActionCache);
              }
            }
          }
 catch (          PersistenceException e) {
            MessageBoxExceptionHandler.process(e);
          }
catch (          BusinessException e) {
            MessageBoxExceptionHandler.process(e);
          }
        }
      }
    }
  }
;
  try {
    PlatformUI.getWorkbench().getProgressService().run(true,true,op);
    factory.saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  final boolean updatePalette=needToUpdataPalette;
  Display.getCurrent().syncExec(new Runnable(){
    public void run(){
      if (!org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
        if (updatePalette && GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
          ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
          service.updatePalette();
        }
        if (!CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
          RepositoryManager.refresh(ERepositoryObjectType.JOB_SCRIPT);
          IRepositoryView repositoryView=RepositoryManagerHelper.getRepositoryView();
          if (repositoryView != null) {
            repositoryView.refresh();
          }
        }
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        for (        IEditorReference editors : page.getEditorReferences()) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDiagramModelService.class)) {
            IDiagramModelService service=(IDiagramModelService)GlobalServiceRegister.getDefault().getService(IDiagramModelService.class);
            service.refreshBusinessModel(editors);
          }
        }
        if (!deleteActionCache.isDocRefresh() && !CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
          RepositoryManager.refreshCreatedNode(ERepositoryObjectType.DOCUMENTATION);
        }
      }
      deleteActionCache.revertParameters();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void doRun(){
  final ISelection selection=getSelection();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  final DeleteActionCache deleteActionCache=DeleteActionCache.getInstance();
  deleteActionCache.setGetAlways(false);
  deleteActionCache.setDocRefresh(false);
  deleteActionCache.createRecords();
  final Set<ERepositoryObjectType> types=new HashSet<ERepositoryObjectType>();
  final List<RepositoryNode> deletedFolder=new ArrayList<RepositoryNode>();
  final IWorkspaceRunnable op=new IWorkspaceRunnable(){
    public void run(    IProgressMonitor monitor){
      monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
      for (      Object obj : ((IStructuredSelection)selection).toArray()) {
        if (obj instanceof RepositoryNode) {
          RepositoryNode node=(RepositoryNode)obj;
          try {
            if (containParent(node,(IStructuredSelection)selection)) {
              continue;
            }
            if (isForbidNode(node)) {
              continue;
            }
            if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
              if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                Item repoItem=node.getObject().getProperty().getItem();
                if (service != null && !repoItem.getState().isDeleted()) {
                  final StringBuffer jobNames=service.getAllTheJObNames(node);
                  if (jobNames != null) {
                    Display.getDefault().syncExec(new Runnable(){
                      public void run(){
                        String message=jobNames.toString() + Messages.getString("String_Node_Str");
                        final Shell shell=getShell();
                        confirmAssignDialog=MessageDialog.openQuestion(shell,"String_Node_Str",message);
                      }
                    }
);
                    if (!confirmAssignDialog) {
                      continue;
                    }
                  }
                }
              }
              if (isInDeletedFolder(deletedFolder,node.getParent())) {
                continue;
              }
              boolean needReturn=deleteElements(factory,deleteActionCache,node);
              if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET) {
                needToUpdataPalette=true;
              }
              if (needReturn) {
                return;
              }
              types.add(node.getObjectType());
            }
 else             if (node.getType() == ENodeType.SIMPLE_FOLDER) {
              FolderItem folderItem=(FolderItem)node.getObject().getProperty().getItem();
              if (node.getChildren().size() > 0 && !folderItem.getState().isDeleted()) {
                if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                  IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                  if (service != null) {
                    final StringBuffer jobNames=service.getAllTheJObNames(node);
                    if (jobNames != null) {
                      Display.getDefault().syncExec(new Runnable(){
                        public void run(){
                          String message=null;
                          if (jobNames.toString().contains("String_Node_Str")) {
                            message=jobNames.toString() + Messages.getString("String_Node_Str");
                          }
 else {
                            message=jobNames.toString() + Messages.getString("String_Node_Str");
                          }
                          final Shell shell=getShell();
                          confirmAssignDialog=MessageDialog.openQuestion(shell,"String_Node_Str",message);
                        }
                      }
);
                      if (!confirmAssignDialog) {
                        continue;
                      }
                    }
                  }
                }
              }
              boolean isSqlTemplate=false;
              if (node.getObject() instanceof Folder) {
                Object label=node.getProperties(EProperties.LABEL);
                if (ENodeType.SIMPLE_FOLDER.equals(node.getType()) && ERepositoryObjectType.SQLPATTERNS.equals(node.getContentType()) && (label.equals("String_Node_Str") || label.equals("String_Node_Str") || label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")|| label.equals("String_Node_Str")) || label.equals("String_Node_Str")) {
                  isSqlTemplate=true;
                }
              }
              if (!isSqlTemplate) {
                types.add(node.getContentType());
                if (node.getContentType() == ERepositoryObjectType.PROCESS || node.getContentType() == ERepositoryObjectType.JOBLET) {
                  types.add(ERepositoryObjectType.DOCUMENTATION);
                }
                deletedFolder.add(node);
                deleteFolder(node,factory,deleteActionCache);
              }
            }
          }
 catch (          PersistenceException e) {
            MessageBoxExceptionHandler.process(e);
          }
catch (          BusinessException e) {
            MessageBoxExceptionHandler.process(e);
          }
        }
      }
      try {
        factory.saveProject(ProjectManager.getInstance().getCurrentProject());
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
    }
  }
;
  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(true,true,iRunnableWithProgress);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  final boolean updatePalette=needToUpdataPalette;
  Display.getCurrent().syncExec(new Runnable(){
    public void run(){
      if (!org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
        if (updatePalette && GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
          ICoreService service=(ICoreService)GlobalServiceRegister.getDefault().getService(ICoreService.class);
          service.updatePalette();
        }
        if (!CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
          RepositoryManager.refresh(ERepositoryObjectType.JOB_SCRIPT);
          IRepositoryView repositoryView=RepositoryManagerHelper.getRepositoryView();
          if (repositoryView != null) {
            repositoryView.refresh();
          }
        }
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        for (        IEditorReference editors : page.getEditorReferences()) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDiagramModelService.class)) {
            IDiagramModelService service=(IDiagramModelService)GlobalServiceRegister.getDefault().getService(IDiagramModelService.class);
            service.refreshBusinessModel(editors);
          }
        }
        if (!deleteActionCache.isDocRefresh() && !CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
          RepositoryManager.refreshCreatedNode(ERepositoryObjectType.DOCUMENTATION);
        }
      }
      deleteActionCache.revertParameters();
    }
  }
);
}