Program: 139366
Project: 139366
Buggy source:
/** 
 * 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 ResourceManager.isSubFolder(ResourceManager.getRulesFolder(),folder);
      }
      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.getRulesFolder();
  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(DefaultMessagesImpl.getString("String_Node_Str",whereRule.getName()));
        }
      }
    }
  }
}

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 ResourceService.isSubFolder(ResourceManager.getRulesFolder(),folder);
      }
      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.getRulesFolder();
  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(DefaultMessagesImpl.getString("String_Node_Str",whereRule.getName()));
        }
      }
    }
  }
}