Program: 139879
Project: 139879
Buggy source:
/** 
 * DOC xqliu Comment method "showAddDQRuleDialog".
 * @param treeItem
 * @param tableIndicator
 */
private void showAddDQRuleDialog(final TreeItem treeItem,final TableIndicator tableIndicator){
  CheckedTreeSelectionDialog dialog=new CheckedTreeSelectionDialog(null,new DQRuleLabelProvider(),new WorkbenchContentProvider());
  dialog.setInput(ResourceManager.getLibrariesFolder());
  dialog.setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      IStatus status=Status.OK_STATUS;
      for (      Object whereRule : selection) {
        if (whereRule instanceof IFile) {
          IFile file=(IFile)whereRule;
          if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
            WhereRule findWhereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(file);
            boolean validStatus=TaggedValueHelper.getValidStatus(findWhereRule);
            if (!validStatus) {
              status=new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,DefaultMessagesImpl.getString("String_Node_Str"));
            }
          }
        }
      }
      return status;
    }
  }
);
  dialog.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
          return true;
        }
      }
 else       if (element instanceof IFolder) {
        IFolder folder=(IFolder)element;
        return DQRuleUtilities.isLibraiesSubfolder(folder,DQStructureManager.DQ_RULES);
      }
      return false;
    }
  }
);
  dialog.setContainerMode(true);
  dialog.setTitle(DefaultMessagesImpl.getString("String_Node_Str"));
  dialog.setMessage(DefaultMessagesImpl.getString("String_Node_Str"));
  dialog.setSize(80,30);
  dialog.create();
  if (dialog.open() == Window.OK) {
    for (    Object obj : dialog.getResult()) {
      if (obj instanceof IFile) {
        IFile file=(IFile)obj;
        TableIndicatorUnit addIndicatorUnit=DQRuleUtilities.createIndicatorUnit(file,tableIndicator,getAnalysis());
        if (addIndicatorUnit != null) {
          createOneUnit(treeItem,addIndicatorUnit);
          setDirty(true);
        }
 else {
          WhereRule whereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(file);
          MessageUI.openError("String_Node_Str" + whereRule.getName() + "String_Node_Str");
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "showAddDQRuleDialog".
 * @param treeItem
 * @param tableIndicator
 */
private void showAddDQRuleDialog(final TreeItem treeItem,final TableIndicator tableIndicator){
  IndicatorCheckedTreeSelectionDialog dialog=new IndicatorCheckedTreeSelectionDialog(null,new DQRuleLabelProvider(),new WorkbenchContentProvider());
  dialog.setInput(ResourceManager.getLibrariesFolder());
  dialog.setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      IStatus status=Status.OK_STATUS;
      for (      Object whereRule : selection) {
        if (whereRule instanceof IFile) {
          IFile file=(IFile)whereRule;
          if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
            WhereRule findWhereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(file);
            boolean validStatus=TaggedValueHelper.getValidStatus(findWhereRule);
            if (!validStatus) {
              status=new Status(IStatus.ERROR,CorePlugin.PLUGIN_ID,DefaultMessagesImpl.getString("String_Node_Str"));
            }
          }
        }
      }
      return status;
    }
  }
);
  dialog.addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      if (element instanceof IFile) {
        IFile file=(IFile)element;
        if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
          return true;
        }
      }
 else       if (element instanceof IFolder) {
        IFolder folder=(IFolder)element;
        return DQRuleUtilities.isLibraiesSubfolder(folder,DQStructureManager.DQ_RULES);
      }
      return false;
    }
  }
);
  dialog.setContainerMode(true);
  dialog.setTitle(DefaultMessagesImpl.getString("String_Node_Str"));
  dialog.setMessage(DefaultMessagesImpl.getString("String_Node_Str"));
  dialog.setSize(80,30);
  dialog.create();
  IFolder whereRuleFolder=ResourceManager.getLibrariesFolder().getFolder(DQStructureManager.DQ_RULES);
  Object[] ownedWhereRuleFiles=getOwnedWhereRuleFiles(tableIndicator,whereRuleFolder);
  dialog.setCheckedElements(ownedWhereRuleFiles);
  if (dialog.open() == Window.OK) {
    removeUncheckedWhereRuleIndicator(ownedWhereRuleFiles,dialog.getResult(),tableIndicator,whereRuleFolder);
    Object[] results=clearAddedResult(ownedWhereRuleFiles,dialog.getResult());
    for (    Object obj : results) {
      if (obj instanceof IFile) {
        IFile file=(IFile)obj;
        TableIndicatorUnit addIndicatorUnit=DQRuleUtilities.createIndicatorUnit(file,tableIndicator,getAnalysis());
        if (addIndicatorUnit != null) {
          createOneUnit(treeItem,addIndicatorUnit);
          setDirty(true);
        }
 else {
          WhereRule whereRule=DQRuleResourceFileHelper.getInstance().findWhereRule(file);
          MessageUI.openError("String_Node_Str" + whereRule.getName());
        }
      }
    }
  }
}