Program: 127280
Project: 127280
Buggy source:
protected void deleteElements(final IProxyRepositoryFactory factory,final RepositoryNode currentNode) throws PersistenceException, BusinessException {
  if (!validElement(currentNode)) {
    return;
  }
  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(){
      @Override 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 {
              for (              IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
                handler.deleteNode(objToDelete);
              }
              ERepositoryObjectType nodeType=(ERepositoryObjectType)currentNode.getProperties(EProperties.CONTENT_TYPE);
              if (nodeType == ERepositoryObjectType.ROUTINES || nodeType == ERepositoryObjectType.PIG_UDF) {
                forceBuild=true;
              }
              factory.deleteObjectPhysical(ProjectManager.getInstance().getCurrentProject(),objToDelete,null,true);
            }
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
protected void deleteElements(final IProxyRepositoryFactory factory,final RepositoryNode currentNode) throws PersistenceException, BusinessException {
  if (!validElement(currentNode)) {
    return;
  }
  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(){
      @Override 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 {
              for (              IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
                handler.deleteNode(objToDelete);
              }
              ERepositoryObjectType nodeType=(ERepositoryObjectType)currentNode.getProperties(EProperties.CONTENT_TYPE);
              if (nodeType == ERepositoryObjectType.ROUTINES || nodeType == ERepositoryObjectType.PIG_UDF) {
                forceBuild=true;
              }
              if (!forceBuild) {
                if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
                  ICamelDesignerCoreService camelService=(ICamelDesignerCoreService)GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
                  if (nodeType == camelService.getBeansType()) {
                    forceBuild=true;
                  }
                }
              }
              factory.deleteObjectPhysical(ProjectManager.getInstance().getCurrentProject(),objToDelete,null,true);
            }
          }
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
);
  }
}