Program: 125609
Project: 125609
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>();
  final IWorkspaceRunnable op=new IWorkspaceRunnable(){
    @Override public void run(    IProgressMonitor monitor){
      monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
      Object[] selections=((IStructuredSelection)selection).toArray();
      List<RepositoryNode> selectNodes=new ArrayList<RepositoryNode>();
      for (      Object obj : selections) {
        if (obj instanceof RepositoryNode) {
          if (!isContainParentNode(selectNodes,(RepositoryNode)obj)) {
            selectNodes.add((RepositoryNode)obj);
          }
        }
      }
      final List<ItemReferenceBean> unDeleteItems=RepositoryNodeDeleteManager.getInstance().getUnDeleteItems(selectNodes,deleteActionCache);
      List<RepositoryNode> accessNodes=new ArrayList<RepositoryNode>();
      for (      RepositoryNode node : selectNodes) {
        try {
          accessNodes.add(node);
          if (sourceFileOpening(node)) {
            continue;
          }
          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(){
                    @Override 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;
            }
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
              IDesignerCoreService coreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
              IRepositoryViewObject object=node.getObject();
              if (coreService != null && object != null && object.getProperty() != null) {
                Item item=object.getProperty().getItem();
                IProcess iProcess=coreService.getProcessFromItem(item);
                if (iProcess != null && iProcess instanceof IProcess2) {
                  IProcess2 process=(IProcess2)iProcess;
                  process.removeProblems4ProcessDeleted();
                }
              }
            }
            if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET) {
              needToUpdataPalette=true;
            }
            boolean needReturn=deleteElements(factory,deleteActionCache,node);
            if (needReturn) {
              if (accessNodes.containsAll(selectNodes)) {
                return;
              }
 else {
                continue;
              }
            }
            types.add(node.getObjectType());
          }
 else           if (node.getType() == ENodeType.SIMPLE_FOLDER) {
            if (node.getChildren().size() > 0 && !node.getObject().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(){
                      @Override 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;
                    }
                  }
                }
              }
            }
            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);
        }
      }
      if (unDeleteItems.size() > 0) {
        Display.getDefault().syncExec(new Runnable(){
          @Override public void run(){
            ItemReferenceDialog dialog=new ItemReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),unDeleteItems);
            dialog.open();
          }
        }
);
      }
      try {
        factory.saveProject(ProjectManager.getInstance().getCurrentProject());
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
    }
    /** 
 * DOC xqliu Comment method "sourceFileOpening".
 * @param node
 * @return
 */
    private boolean sourceFileOpening(    RepositoryNode node){
      boolean result=false;
      if (node != null) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
          ITDQRepositoryService service=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
          if (service != null) {
            result=service.sourceFileOpening(node);
          }
        }
      }
      return result;
    }
  }
;
  IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
    @Override 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);
    if (forceBuild) {
      IRunProcessService service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
      service.buildJavaProject();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  synchUI(deleteActionCache);
}

Fixed version (ground truth):
@Override protected void doRun(){
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject() || factory.getRepositoryContext().isOffline() || factory.getRepositoryContext().isEditableAsReadOnly()) {
    return;
  }
  final ISelection selection=getSelection();
  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(){
    @Override public void run(    IProgressMonitor monitor){
      monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
      Object[] selections=((IStructuredSelection)selection).toArray();
      List<RepositoryNode> selectNodes=new ArrayList<RepositoryNode>();
      for (      Object obj : selections) {
        if (obj instanceof RepositoryNode) {
          if (!isContainParentNode(selectNodes,(RepositoryNode)obj)) {
            selectNodes.add((RepositoryNode)obj);
          }
        }
      }
      final List<ItemReferenceBean> unDeleteItems=RepositoryNodeDeleteManager.getInstance().getUnDeleteItems(selectNodes,deleteActionCache);
      List<RepositoryNode> accessNodes=new ArrayList<RepositoryNode>();
      for (      RepositoryNode node : selectNodes) {
        try {
          accessNodes.add(node);
          if (sourceFileOpening(node)) {
            continue;
          }
          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(){
                    @Override 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;
            }
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
              IDesignerCoreService coreService=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
              IRepositoryViewObject object=node.getObject();
              if (coreService != null && object != null && object.getProperty() != null) {
                Item item=object.getProperty().getItem();
                IProcess iProcess=coreService.getProcessFromItem(item);
                if (iProcess != null && iProcess instanceof IProcess2) {
                  IProcess2 process=(IProcess2)iProcess;
                  process.removeProblems4ProcessDeleted();
                }
              }
            }
            if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET) {
              needToUpdataPalette=true;
            }
            boolean needReturn=deleteElements(factory,deleteActionCache,node);
            if (needReturn) {
              if (accessNodes.containsAll(selectNodes)) {
                return;
              }
 else {
                continue;
              }
            }
            types.add(node.getObjectType());
          }
 else           if (node.getType() == ENodeType.SIMPLE_FOLDER) {
            if (node.getChildren().size() > 0 && !node.getObject().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(){
                      @Override 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;
                    }
                  }
                }
              }
            }
            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);
        }
      }
      if (unDeleteItems.size() > 0) {
        Display.getDefault().syncExec(new Runnable(){
          @Override public void run(){
            ItemReferenceDialog dialog=new ItemReferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),unDeleteItems);
            dialog.open();
          }
        }
);
      }
      try {
        factory.saveProject(ProjectManager.getInstance().getCurrentProject());
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
      }
    }
    /** 
 * DOC xqliu Comment method "sourceFileOpening".
 * @param node
 * @return
 */
    private boolean sourceFileOpening(    RepositoryNode node){
      boolean result=false;
      if (node != null) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
          ITDQRepositoryService service=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
          if (service != null) {
            result=service.sourceFileOpening(node);
          }
        }
      }
      return result;
    }
  }
;
  IRunnableWithProgress iRunnableWithProgress=new IRunnableWithProgress(){
    @Override 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);
    if (forceBuild) {
      IRunProcessService service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
      service.buildJavaProject();
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  synchUI(deleteActionCache);
}