Program: 129641
Project: 129641
Buggy source:
protected void deleteElements(IProxyRepositoryFactory factory,RepositoryNode currentNode) throws PersistenceException, BusinessException {
  IRepositoryViewObject objToDelete=currentNode.getObject();
  if (objToDelete == null) {
    return;
  }
  if (objToDelete instanceof ISubRepositoryObject) {
    ISubRepositoryObject subRepositoryObject=(ISubRepositoryObject)objToDelete;
    if (!isRootNodeDeleted(currentNode)) {
      Item item=subRepositoryObject.getProperty().getItem();
      subRepositoryObject.removeFromParent();
      factory.save(item);
    }
  }
 else {
    IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    for (    IEditorReference editors : page.getEditorReferences()) {
      String nameInEditor=editors.getName();
      if (objToDelete.getLabel().equals(nameInEditor.substring(nameInEditor.indexOf("String_Node_Str") + 1))) {
        page.closeEditor(editors.getEditor(false),false);
      }
    }
    if (objToDelete.getRepositoryObjectType() != ERepositoryObjectType.JOB_DOC && objToDelete.getRepositoryObjectType() != ERepositoryObjectType.JOBLET_DOC) {
      if (currentNode.getType() == ENodeType.SIMPLE_FOLDER) {
        for (        IRepositoryNode curNode : currentNode.getChildren()) {
          deleteElements(factory,(RepositoryNode)curNode);
        }
        factory.deleteFolder(ProjectManager.getInstance().getCurrentProject(),currentNode.getContentType(),RepositoryNodeUtilities.getFolderPath(currentNode.getObject().getProperty().getItem()),true);
      }
 else {
        factory.deleteObjectPhysical(ProjectManager.getInstance().getCurrentProject(),objToDelete,null,true);
      }
    }
  }
}

Fixed version (ground truth):
protected void deleteElements(final IProxyRepositoryFactory factory,final RepositoryNode currentNode) throws PersistenceException, BusinessException {
  final IRepositoryViewObject objToDelete=currentNode.getObject();
  if (objToDelete == null) {
    return;
  }
  if (objToDelete instanceof ISubRepositoryObject) {
    ISubRepositoryObject subRepositoryObject=(ISubRepositoryObject)objToDelete;
    if (!isRootNodeDeleted(currentNode)) {
      Item item=subRepositoryObject.getProperty().getItem();
      subRepositoryObject.removeFromParent();
      factory.save(item);
    }
  }
 else {
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        try {
          IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
          for (          IEditorReference editors : page.getEditorReferences()) {
            String nameInEditor=editors.getName();
            if (objToDelete.getLabel().equals(nameInEditor.substring(nameInEditor.indexOf("String_Node_Str") + 1))) {
              page.closeEditor(editors.getEditor(false),false);
            }
          }
          if (objToDelete.getRepositoryObjectType() != ERepositoryObjectType.JOB_DOC && objToDelete.getRepositoryObjectType() != ERepositoryObjectType.JOBLET_DOC) {
            if (currentNode.getType() == ENodeType.SIMPLE_FOLDER) {
              for (              IRepositoryNode curNode : currentNode.getChildren()) {
                deleteElements(factory,(RepositoryNode)curNode);
              }
              factory.deleteFolder(ProjectManager.getInstance().getCurrentProject(),currentNode.getContentType(),RepositoryNodeUtilities.getFolderPath(currentNode.getObject().getProperty().getItem()),true);
            }
 else {
              factory.deleteObjectPhysical(ProjectManager.getInstance().getCurrentProject(),objToDelete,null,true);
            }
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
);
  }
}