Program: 127569
Project: 127569
Buggy source:
@Override protected void doRun(){
  ISelection selection=getSelection();
  Boolean confirm=null;
  final List<IRepositoryViewObject> connections=new ArrayList<IRepositoryViewObject>();
  final Set<ERepositoryObjectType> types=new HashSet<ERepositoryObjectType>();
  Map<String,Item> procItems=new HashMap<String,Item>();
  for (  Object obj : ((IStructuredSelection)selection).toArray()) {
    if (obj instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)obj;
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
      if (node.getType() == ENodeType.REPOSITORY_ELEMENT && nodeType.isSubItem()) {
        Connection connection=null;
        ERepositoryObjectType parentNodeType=(ERepositoryObjectType)node.getParent().getProperties(EProperties.CONTENT_TYPE);
        if (parentNodeType == null) {
          parentNodeType=node.getParent().getParent().getObjectType();
        }
        if (parentNodeType != null) {
          types.add(parentNodeType);
        }
        ConnectionItem item=(ConnectionItem)node.getObject().getProperty().getItem();
        connection=(item).getConnection();
        ISubRepositoryObject subRepositoryObject=(ISubRepositoryObject)node.getObject();
        AbstractMetadataObject abstractMetadataObject=subRepositoryObject.getAbstractMetadataObject();
        if (abstractMetadataObject instanceof SubscriberTable) {
          return;
        }
        if (abstractMetadataObject == null) {
          return;
        }
        boolean isSave=true;
        AbstractResourceChangesService resChangeService=TDQServiceRegister.getInstance().getResourceChangeService(AbstractResourceChangesService.class);
        if (resChangeService != null) {
          List<IRepositoryNode> dependentNodes=resChangeService.getDependentNodes(node);
          if (dependentNodes != null && !dependentNodes.isEmpty()) {
            resChangeService.openDependcesDialog(dependentNodes);
            isSave=false;
          }
        }
        if (isSave) {
          String sfm=null;
          String sf=null;
          EObject eContainer=abstractMetadataObject.eContainer();
          if (eContainer != null && eContainer instanceof SalesforceModuleUnitImpl) {
            sfm=((SalesforceModuleUnitImpl)eContainer).getModuleName();
            sf=abstractMetadataObject.getLabel();
          }
          if (SubItemHelper.isDeleted(abstractMetadataObject) && isSave) {
            if (confirm == null) {
              String title=Messages.getString("String_Node_Str");
              String message=Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str");
              confirm=(MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),title,message));
            }
            if (confirm) {
              subRepositoryObject.removeFromParent();
            }
          }
 else           if (item instanceof SalesforceSchemaConnectionItem && parentNodeType.getType() != null && parentNodeType.getType().equals("String_Node_Str") && sfm != null && sf != null && sfm.equals(sf)) {
          }
 else {
            SubItemHelper.setDeleted(abstractMetadataObject,true);
          }
          final String id=item.getProperty().getId();
          Item tmpItem=procItems.get(id);
          if (tmpItem == null) {
            procItems.put(id,item);
          }
          connections.add(node.getObject());
        }
      }
    }
  }
  try {
    IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    for (    String id : procItems.keySet()) {
      Item item=procItems.get(id);
      factory.save(item);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  Display.getCurrent().syncExec(new Runnable(){
    @Override public void run(){
      RepositoryManager.refreshDeletedNode(types);
    }
  }
);
  notifySQLBuilder(connections);
}

Fixed version (ground truth):
@Override protected void doRun(){
  ISelection selection=getSelection();
  Boolean confirm=null;
  final List<IRepositoryViewObject> connections=new ArrayList<IRepositoryViewObject>();
  final Set<ERepositoryObjectType> types=new HashSet<ERepositoryObjectType>();
  Map<String,Item> procItems=new HashMap<String,Item>();
  for (  Object obj : ((IStructuredSelection)selection).toArray()) {
    if (obj instanceof RepositoryNode) {
      RepositoryNode node=(RepositoryNode)obj;
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
      if (node.getType() == ENodeType.REPOSITORY_ELEMENT && nodeType.isSubItem()) {
        IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
        IRepositoryViewObject nodeObject=node.getObject();
        boolean locked=false;
        if (!factory.getRepositoryContext().isEditableAsReadOnly()) {
          if (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER || nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_USER) {
            locked=true;
          }
        }
        if ((locked || RepositoryManager.isOpenedItemInEditor(nodeObject)) && !(DELETE_FOREVER_TITLE.equals(getText()))) {
          final String title=Messages.getString("String_Node_Str");
          String nodeName=nodeObject.getRepositoryObjectType().getLabel();
          final String message=Messages.getString("String_Node_Str",nodeName);
          Display.getDefault().syncExec(new Runnable(){
            @Override public void run(){
              MessageDialog dialog=new MessageDialog(new Shell(),title,null,message,MessageDialog.ERROR,new String[]{IDialogConstants.OK_LABEL},0);
              dialog.open();
            }
          }
);
          return;
        }
        Connection connection=null;
        ERepositoryObjectType parentNodeType=(ERepositoryObjectType)node.getParent().getProperties(EProperties.CONTENT_TYPE);
        if (parentNodeType == null) {
          parentNodeType=node.getParent().getParent().getObjectType();
        }
        if (parentNodeType != null) {
          types.add(parentNodeType);
        }
        ConnectionItem item=(ConnectionItem)node.getObject().getProperty().getItem();
        connection=(item).getConnection();
        ISubRepositoryObject subRepositoryObject=(ISubRepositoryObject)node.getObject();
        AbstractMetadataObject abstractMetadataObject=subRepositoryObject.getAbstractMetadataObject();
        if (abstractMetadataObject instanceof SubscriberTable) {
          return;
        }
        if (abstractMetadataObject == null) {
          return;
        }
        boolean isSave=true;
        AbstractResourceChangesService resChangeService=TDQServiceRegister.getInstance().getResourceChangeService(AbstractResourceChangesService.class);
        if (resChangeService != null) {
          List<IRepositoryNode> dependentNodes=resChangeService.getDependentNodes(node);
          if (dependentNodes != null && !dependentNodes.isEmpty()) {
            resChangeService.openDependcesDialog(dependentNodes);
            isSave=false;
          }
        }
        if (isSave) {
          String sfm=null;
          String sf=null;
          EObject eContainer=abstractMetadataObject.eContainer();
          if (eContainer != null && eContainer instanceof SalesforceModuleUnitImpl) {
            sfm=((SalesforceModuleUnitImpl)eContainer).getModuleName();
            sf=abstractMetadataObject.getLabel();
          }
          if (SubItemHelper.isDeleted(abstractMetadataObject) && isSave) {
            if (confirm == null) {
              String title=Messages.getString("String_Node_Str");
              String message=Messages.getString("String_Node_Str") + "String_Node_Str" + Messages.getString("String_Node_Str");
              confirm=(MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),title,message));
            }
            if (confirm) {
              subRepositoryObject.removeFromParent();
            }
          }
 else           if (item instanceof SalesforceSchemaConnectionItem && parentNodeType.getType() != null && parentNodeType.getType().equals("String_Node_Str") && sfm != null && sf != null && sfm.equals(sf)) {
          }
 else {
            SubItemHelper.setDeleted(abstractMetadataObject,true);
          }
          final String id=item.getProperty().getId();
          Item tmpItem=procItems.get(id);
          if (tmpItem == null) {
            procItems.put(id,item);
          }
          connections.add(node.getObject());
        }
      }
    }
  }
  try {
    IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
    for (    String id : procItems.keySet()) {
      Item item=procItems.get(id);
      factory.save(item);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
  Display.getCurrent().syncExec(new Runnable(){
    @Override public void run(){
      RepositoryManager.refreshDeletedNode(types);
    }
  }
);
  notifySQLBuilder(connections);
}