nus-yam/ex-repair huggingface dataset:
Program: 140531
Project: 140531
Buggy source:
private IFolder createNewFoler(IProject project,String folderName) throws CoreException {
  IFolder desFolder=project.getFolder(folderName);
  if (!desFolder.exists()) {
    desFolder.create(false,true,null);
  }
  desFolder.setPersistentProperty(FOLDER_FIRM_KEY,FOLDER_FIRM_PROPERTY);
  return desFolder;
}

Fixed version (ground truth):
private IFolder createNewFoler(IProject project,String folderName) throws CoreException {
  IFolder desFolder=project.getFolder(folderName);
  if (!desFolder.exists()) {
    desFolder.create(false,true,null);
  }
  desFolder.setPersistentProperty(FOLDER_READONLY_KEY,FOLDER_READONLY_PROPERTY);
  return desFolder;
}
Program: 140532
Project: 140532
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    try {
      if (currentSelection.getPersistentProperty(DQStructureManager.FOLDER_FIRM_KEY) != null) {
        return;
      }
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
  }
  DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
  menu.add(createSubFolderAction);
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    try {
      if (currentSelection.getPersistentProperty(DQStructureManager.FOLDER_READONLY_KEY) != null) {
        return;
      }
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
  }
  DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
  menu.add(createSubFolderAction);
}
Program: 140534
Project: 140534
Buggy source:
@Override public IStatus validateDrop(Object target,int operation,TransferData transferType){
  if (!(target instanceof IResource)) {
    return Status.CANCEL_STATUS;
  }
  IResource targetRes=(IResource)target;
  for (  IResource res : getSelectedResources()) {
    if (res.getType() == IResource.FILE) {
      if (targetRes.getType() == IResource.FOLDER) {
        return Status.OK_STATUS;
      }
 else       if (res.getName().endsWith(PluginConstant.ANA_SUFFIX) && (targetRes.getType() == IResource.FILE)) {
        IFile tfile=(IFile)targetRes;
        if (tfile.getFileExtension().equals(FactoriesUtil.REP)) {
          return Status.OK_STATUS;
        }
      }
    }
  }
  return Status.CANCEL_STATUS;
}

Fixed version (ground truth):
@Override public IStatus validateDrop(Object target,int operation,TransferData transferType){
  if (!(target instanceof IResource)) {
    return Status.CANCEL_STATUS;
  }
  IResource targetRes=(IResource)target;
  for (  IResource res : getSelectedResources()) {
    if (res.getType() == IResource.FILE) {
      if ((targetRes.getType() == IResource.FOLDER)) {
        IFolder targetFolder=(IFolder)targetRes;
        IFolder sourceFolder=(IFolder)res.getParent();
        try {
          if (sourceFolder.getPersistentProperty(DQStructureManager.FOLDER_CLASSIFY_KEY).equals(targetFolder.getPersistentProperty(DQStructureManager.FOLDER_CLASSIFY_KEY))) {
            return Status.OK_STATUS;
          }
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
 else       if (res.getName().endsWith(PluginConstant.ANA_SUFFIX) && (targetRes.getType() == IResource.FILE)) {
        IFile tfile=(IFile)targetRes;
        if (tfile.getFileExtension().equals(FactoriesUtil.REP)) {
          return Status.OK_STATUS;
        }
      }
    }
  }
  return Status.CANCEL_STATUS;
}
Program: 140535
Project: 140535
Buggy source:
/** 
 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 */
@Override public boolean performFinish(){
  String folderName=mainPage.getName();
  if (defaultLabel == null) {
    IFolder folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
    IFolder newFolder=folder.getFolder(folderName);
    try {
      newFolder.create(false,true,null);
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
      DQRespositoryView findView=(DQRespositoryView)CorePlugin.getDefault().findView(DQRespositoryView.ID);
      findView.getCommonViewer().refresh();
      findView.getCommonViewer().setExpandedState(newFolder,true);
    }
 catch (    CoreException e) {
      MessageDialog.openError(getShell(),"String_Node_Str","String_Node_Str");
      ExceptionHandler.process(e);
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.wizard.Wizard#performFinish()
 */
@Override public boolean performFinish(){
  String folderName=mainPage.getName();
  if (defaultLabel == null) {
    IFolder folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
    IFolder newFolder=folder.getFolder(folderName);
    try {
      newFolder.create(false,true,null);
      newFolder.setPersistentProperty(DQStructureManager.FOLDER_CLASSIFY_KEY,folder.getPersistentProperty(DQStructureManager.FOLDER_CLASSIFY_KEY));
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
      DQRespositoryView findView=(DQRespositoryView)CorePlugin.getDefault().findView(DQRespositoryView.ID);
      findView.getCommonViewer().refresh();
      findView.getCommonViewer().setExpandedState(newFolder,true);
    }
 catch (    CoreException e) {
      MessageDialog.openError(getShell(),"String_Node_Str","String_Node_Str");
      ExceptionHandler.process(e);
      return false;
    }
  }
  return true;
}
Program: 140537
Project: 140537
Buggy source:
private void addTreeListener(Tree tree){
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setFocus();
      }
    }
  }
);
  tree.addTreeListener(new TreeAdapter(){
    @Override public void treeCollapsed(    TreeEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setExpanded(false);
      }
      masterPage.getForm().reflow(true);
    }
    @Override public void treeExpanded(    TreeEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setExpanded(true);
      }
      masterPage.getForm().reflow(true);
    }
  }
);
}

Fixed version (ground truth):
private void addTreeListener(final Tree tree){
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setFocus();
      }
      if (e.item instanceof TreeItem) {
        TreeItem item=(TreeItem)e.item;
        if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
          tree.setMenu(null);
          return;
        }
      }
      tree.setMenu(menu);
    }
  }
);
  tree.addTreeListener(new TreeAdapter(){
    @Override public void treeCollapsed(    TreeEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setExpanded(false);
      }
      masterPage.getForm().reflow(true);
    }
    @Override public void treeExpanded(    TreeEvent e){
      if (getTheSuitedComposite(e) != null) {
        getTheSuitedComposite(e).setExpanded(true);
      }
      masterPage.getForm().reflow(true);
    }
  }
);
}
Program: 140538
Project: 140538
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  if (getTheSuitedComposite(e) != null) {
    getTheSuitedComposite(e).setFocus();
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  if (getTheSuitedComposite(e) != null) {
    getTheSuitedComposite(e).setFocus();
  }
  if (e.item instanceof TreeItem) {
    TreeItem item=(TreeItem)e.item;
    if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
      tree.setMenu(null);
      return;
    }
  }
  tree.setMenu(menu);
}
Program: 140539
Project: 140539
Buggy source:
/** 
 * @param parent
 */
private Tree createTree(Composite parent){
  final Tree newTree=new Tree(parent,SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(newTree);
  newTree.setHeaderVisible(false);
  TreeColumn column1=new TreeColumn(newTree,SWT.CENTER);
  column1.setWidth(190);
  TreeColumn column2=new TreeColumn(newTree,SWT.CENTER);
  column2.setWidth(80);
  TreeColumn column3=new TreeColumn(newTree,SWT.CENTER);
  column3.setWidth(120);
  TreeColumn column4=new TreeColumn(newTree,SWT.CENTER);
  column4.setWidth(120);
  parent.layout();
  Menu menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText("String_Node_Str");
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
    }
  }
);
  newTree.setMenu(menu);
  AbstractAnalysisActionHandler actionHandler=new AbstractAnalysisActionHandler(parent){
    @Override protected void handleRemove(){
      removeSelectedElements(newTree);
    }
  }
;
  parent.setData(AbstractMetadataFormPage.ACTION_HANDLER,actionHandler);
  ColumnViewerDND.installDND(newTree);
  this.addTreeListener(newTree);
  return newTree;
}

Fixed version (ground truth):
/** 
 * @param parent
 */
private Tree createTree(Composite parent){
  final Tree newTree=new Tree(parent,SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(newTree);
  newTree.setHeaderVisible(false);
  TreeColumn column1=new TreeColumn(newTree,SWT.CENTER);
  column1.setWidth(190);
  TreeColumn column2=new TreeColumn(newTree,SWT.CENTER);
  column2.setWidth(80);
  TreeColumn column3=new TreeColumn(newTree,SWT.CENTER);
  column3.setWidth(120);
  TreeColumn column4=new TreeColumn(newTree,SWT.CENTER);
  column4.setWidth(120);
  parent.layout();
  menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText("String_Node_Str");
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
    }
  }
);
  newTree.setMenu(menu);
  AbstractAnalysisActionHandler actionHandler=new AbstractAnalysisActionHandler(parent){
    @Override protected void handleRemove(){
      removeSelectedElements(newTree);
    }
  }
;
  parent.setData(AbstractMetadataFormPage.ACTION_HANDLER,actionHandler);
  ColumnViewerDND.installDND(newTree);
  this.addTreeListener(newTree);
  return newTree;
}
Program: 140543
Project: 140543
Buggy source:
/** 
 * Method "initDbmsFunctions" initialize functions specific to DBMS. This is needed for ZQLParser which does not know all available functions.
 * @param dbms
 * @return the initialized map of functions with their number of parameters.
 */
private Map<String,Integer> initDbmsFunctions(String dbms){
  Map<String,Integer> functions=new HashMap<String,Integer>();
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  if (is(SQL)) {
    functions.put("String_Node_Str",1);
  }
  if (is(MYSQL)) {
    functions.put("String_Node_Str",1);
    for (    DateGrain grain : DateGrain.values()) {
      functions.put(grain.getName(),1);
    }
  }
  if (is(ORACLE)) {
    functions.put("String_Node_Str",1);
    functions.put("String_Node_Str",2);
    functions.put("String_Node_Str",1);
  }
  return functions;
}

Fixed version (ground truth):
/** 
 * Method "initDbmsFunctions" initialize functions specific to DBMS. This is needed for ZQLParser which does not know all available functions.
 * @param dbms
 * @return the initialized map of functions with their number of parameters.
 */
private Map<String,Integer> initDbmsFunctions(String dbms){
  Map<String,Integer> functions=new HashMap<String,Integer>();
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  functions.put("String_Node_Str",1);
  if (is(SQL)) {
    functions.put("String_Node_Str",1);
  }
  if (is(MYSQL)) {
    functions.put("String_Node_Str",1);
    functions.put("String_Node_Str",2);
    for (    DateGrain grain : DateGrain.values()) {
      functions.put(grain.getName(),1);
    }
  }
  if (is(ORACLE)) {
    functions.put("String_Node_Str",1);
    functions.put("String_Node_Str",2);
    functions.put("String_Node_Str",1);
    functions.put("String_Node_Str",2);
  }
  return functions;
}
Program: 140545
Project: 140545
Buggy source:
@Override public void run(){
  CreatePatternWizard fileWizard=new CreatePatternWizard(folder,type);
  IContext context=HelpSystem.getContext(HelpPlugin.PATTERN_CONTEXT_HELP_ID);
  IHelpResource[] relatedTopics=context.getRelatedTopics();
  String href=relatedTopics[0].getHref();
switch (type) {
case SQL_LIKE:
    href=relatedTopics[1].getHref();
  break;
default :
break;
}
WizardDialog dialog=new CheatSheetWizardDialog(Display.getDefault().getActiveShell(),fileWizard,href);
fileWizard.setWindowTitle(getText());
if (WizardDialog.OK == dialog.open()) {
try {
folder.refreshLocal(IResource.DEPTH_INFINITE,null);
IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(fileWizard.getLocation());
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(file),PluginConstant.PATTERN_EDITOR);
}
 catch (CoreException e) {
e.printStackTrace();
}
}
}

Fixed version (ground truth):
@Override public void run(){
  CreatePatternWizard fileWizard=new CreatePatternWizard(folder,type);
  IContext context=HelpSystem.getContext(HelpPlugin.PATTERN_CONTEXT_HELP_ID);
  IHelpResource[] relatedTopics=context.getRelatedTopics();
  String href=relatedTopics[0].getHref();
switch (type) {
case SQL_LIKE:
    href=relatedTopics[1].getHref();
  break;
default :
break;
}
WizardDialog dialog=new OpeningHelpWizardDialog(Display.getDefault().getActiveShell(),fileWizard,href);
fileWizard.setWindowTitle(getText());
if (WizardDialog.OK == dialog.open()) {
try {
folder.refreshLocal(IResource.DEPTH_INFINITE,null);
IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(fileWizard.getLocation());
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(file),PluginConstant.PATTERN_EDITOR);
}
 catch (CoreException e) {
e.printStackTrace();
}
}
}
Program: 140546
Project: 140546
Buggy source:
@Override public void run(){
  ImportPatternsWizard wizard=new ImportPatternsWizard(folder);
  WizardDialog dialog=new CheatSheetWizardDialog(Display.getDefault().getActiveShell(),wizard,"String_Node_Str");
  wizard.setWindowTitle(getText());
  if (WizardDialog.OK == dialog.open()) {
    try {
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  ImportPatternsWizard wizard=new ImportPatternsWizard(folder);
  WizardDialog dialog=new OpeningHelpWizardDialog(Display.getDefault().getActiveShell(),wizard,"String_Node_Str");
  wizard.setWindowTitle(getText());
  if (WizardDialog.OK == dialog.open()) {
    try {
      folder.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
  }
}
Program: 140547
Project: 140547
Buggy source:
@Override protected WizardDialog getPredefinedDialog(){
  CreateNewAnalysisWizard wizard=new CreateNewAnalysisWizard(true,AnalysisType.MULTIPLE_COLUMN);
  wizard.setForcePreviousAndNextButtons(true);
  TimeSliceOptionPage page=new TimeSliceOptionPage();
  wizard.setOtherPages(new WizardPage[]{page});
  return new CheatSheetWizardDialog(null,wizard,FormEnum.TimeSlicesForm.getHelpHref(),page);
}

Fixed version (ground truth):
@Override protected WizardDialog getPredefinedDialog(){
  CreateNewAnalysisWizard wizard=new CreateNewAnalysisWizard(true,AnalysisType.MULTIPLE_COLUMN);
  wizard.setForcePreviousAndNextButtons(true);
  TimeSliceOptionPage page=new TimeSliceOptionPage();
  wizard.setOtherPages(new WizardPage[]{page});
  return new OpeningHelpWizardDialog(null,wizard,FormEnum.TimeSlicesForm.getHelpHref(),page);
}
Program: 140549
Project: 140549
Buggy source:
@Override protected WizardDialog getPredefinedDialog(){
  String helpID=HelpPlugin.PLUGIN_ID + HelpPlugin.INDICATOR_OPTION_HELP_ID;
  CreateNewAnalysisWizard wizard=new CreateNewAnalysisWizard(true,AnalysisType.MULTIPLE_COLUMN);
  wizard.setForcePreviousAndNextButtons(true);
  TimeSliceOptionPage page=new TimeSliceOptionPage();
  wizard.setOtherPages(new WizardPage[]{page});
  Indicator indicator=(Indicator)IndicatorsFactory.eINSTANCE.create(IndicatorEnum.FrequencyIndicatorEnum.getIndicatorType());
  ColumnIndicator columnIndicator=new ColumnIndicator(getColumns()[0]);
  IndicatorUnit indicatorUnit=new IndicatorUnit(IndicatorEnum.FrequencyIndicatorEnum,indicator,columnIndicator);
  return HelpUtils.injectHelpForOnePage(getStandardAnalysisWizardDialog(),wizard,helpID,indicatorUnit,page);
}

Fixed version (ground truth):
@Override protected WizardDialog getPredefinedDialog(){
  CreateNewAnalysisWizard wizard=new CreateNewAnalysisWizard(true,AnalysisType.MULTIPLE_COLUMN);
  wizard.setForcePreviousAndNextButtons(true);
  TimeSliceOptionPage page=new TimeSliceOptionPage();
  wizard.setOtherPages(new WizardPage[]{page});
  return new CheatSheetWizardDialog(null,wizard,FormEnum.TimeSlicesForm.getHelpHref(),page);
}
Program: 140550
Project: 140550
Buggy source:
@Override public void expansionStateChanging(ExpansionEvent e){
  TreeItem theSuitedTreeItem=getTheSuitedTreeItem(getTreeViewer().getTree().getItems(),composite);
  if (e.getState()) {
    if (theSuitedTreeItem != null) {
      theSuitedTreeItem.setExpanded(true);
    }
  }
 else {
    if (theSuitedTreeItem != null) {
      theSuitedTreeItem.setExpanded(false);
    }
  }
  getTreeViewer().getTree().setSelection(theSuitedTreeItem);
}

Fixed version (ground truth):
@Override public void expansionStateChanging(ExpansionEvent e){
  TreeItem theSuitedTreeItem=getTheSuitedTreeItem(getTreeViewer().getTree().getItems(),composite);
  if (e.getState()) {
    if (theSuitedTreeItem != null) {
      theSuitedTreeItem.setExpanded(true);
    }
  }
 else {
    if (theSuitedTreeItem != null) {
      theSuitedTreeItem.setExpanded(false);
    }
  }
  getTreeViewer().getTree().layout();
  getTreeViewer().getTree().setSelection(theSuitedTreeItem);
}
Program: 140551
Project: 140551
Buggy source:
private void addExpandableCompositeListener(final ExpandableComposite composite){
  composite.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanging(    ExpansionEvent e){
      TreeItem theSuitedTreeItem=getTheSuitedTreeItem(getTreeViewer().getTree().getItems(),composite);
      if (e.getState()) {
        if (theSuitedTreeItem != null) {
          theSuitedTreeItem.setExpanded(true);
        }
      }
 else {
        if (theSuitedTreeItem != null) {
          theSuitedTreeItem.setExpanded(false);
        }
      }
      getTreeViewer().getTree().setSelection(theSuitedTreeItem);
    }
  }
);
}

Fixed version (ground truth):
private void addExpandableCompositeListener(final ExpandableComposite composite){
  composite.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanging(    ExpansionEvent e){
      TreeItem theSuitedTreeItem=getTheSuitedTreeItem(getTreeViewer().getTree().getItems(),composite);
      if (e.getState()) {
        if (theSuitedTreeItem != null) {
          theSuitedTreeItem.setExpanded(true);
        }
      }
 else {
        if (theSuitedTreeItem != null) {
          theSuitedTreeItem.setExpanded(false);
        }
      }
      getTreeViewer().getTree().layout();
      getTreeViewer().getTree().setSelection(theSuitedTreeItem);
    }
  }
);
}
Program: 140553
Project: 140553
Buggy source:
public abstract String getFormName();

Fixed version (ground truth):
public String getFormName(){
  return getFormEnum().getFormName();
}
Program: 140555
Project: 140555
Buggy source:
private IFolder createNewFoler(IProject project,String folderName) throws CoreException {
  IFolder desFolder=project.getFolder(folderName);
  if (!desFolder.exists()) {
    desFolder.create(false,true,null);
  }
  ResourceAttributes resAttr=new ResourceAttributes();
  resAttr.setReadOnly(true);
  desFolder.setResourceAttributes(resAttr);
  return desFolder;
}

Fixed version (ground truth):
private IFolder createNewFoler(IProject project,String folderName) throws CoreException {
  IFolder desFolder=project.getFolder(folderName);
  if (!desFolder.exists()) {
    desFolder.create(false,true,null);
  }
  desFolder.setPersistentProperty(FOLDER_FIRM_KEY,FOLDER_FIRM_PROPERTY);
  return desFolder;
}
Program: 140556
Project: 140556
Buggy source:
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    if (currentSelection.getResourceAttributes().isReadOnly()) {
      return;
    }
  }
  DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
  menu.add(createSubFolderAction);
}

Fixed version (ground truth):
/** 
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu){
  Object obj=((TreeSelection)this.getContext().getSelection()).getFirstElement();
  if (obj instanceof IFolder) {
    currentSelection=(IFolder)obj;
    try {
      if (currentSelection.getPersistentProperty(DQStructureManager.FOLDER_FIRM_KEY) != null) {
        return;
      }
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
  }
  DeleteFolderAction createSubFolderAction=new DeleteFolderAction(currentSelection);
  menu.add(createSubFolderAction);
}
Program: 140557
Project: 140557
Buggy source:
public AnalysisColumnTreeViewer(Composite parent,ColumnMasterDetailsPage masterPage){
  this(parent);
  this.masterPage=masterPage;
  this.setElements(masterPage.getCurrentColumnIndicators());
  this.addTreeListener(this.tree);
  this.setDirty(false);
}

Fixed version (ground truth):
public AnalysisColumnTreeViewer(Composite parent,ColumnMasterDetailsPage masterPage){
  this(parent);
  this.masterPage=masterPage;
  this.setElements(masterPage.getCurrentColumnIndicators());
  this.setDirty(false);
}
Program: 140558
Project: 140558
Buggy source:
/** 
 * @param parent
 */
private Tree createTree(Composite parent){
  final Tree newTree=new Tree(parent,SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(newTree);
  newTree.setHeaderVisible(false);
  TreeColumn column1=new TreeColumn(newTree,SWT.CENTER);
  column1.setWidth(190);
  TreeColumn column2=new TreeColumn(newTree,SWT.CENTER);
  column2.setWidth(80);
  TreeColumn column3=new TreeColumn(newTree,SWT.CENTER);
  column3.setWidth(120);
  TreeColumn column4=new TreeColumn(newTree,SWT.CENTER);
  column4.setWidth(120);
  parent.layout();
  Menu menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText("String_Node_Str");
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
    }
  }
);
  newTree.setMenu(menu);
  AbstractAnalysisActionHandler actionHandler=new AbstractAnalysisActionHandler(parent){
    @Override protected void handleRemove(){
      removeSelectedElements(newTree);
    }
  }
;
  parent.setData(AbstractMetadataFormPage.ACTION_HANDLER,actionHandler);
  ColumnViewerDND.installDND(newTree);
  return newTree;
}

Fixed version (ground truth):
/** 
 * @param parent
 */
private Tree createTree(Composite parent){
  final Tree newTree=new Tree(parent,SWT.MULTI);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(newTree);
  newTree.setHeaderVisible(false);
  TreeColumn column1=new TreeColumn(newTree,SWT.CENTER);
  column1.setWidth(190);
  TreeColumn column2=new TreeColumn(newTree,SWT.CENTER);
  column2.setWidth(80);
  TreeColumn column3=new TreeColumn(newTree,SWT.CENTER);
  column3.setWidth(120);
  TreeColumn column4=new TreeColumn(newTree,SWT.CENTER);
  column4.setWidth(120);
  parent.layout();
  Menu menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText("String_Node_Str");
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
    }
  }
);
  newTree.setMenu(menu);
  AbstractAnalysisActionHandler actionHandler=new AbstractAnalysisActionHandler(parent){
    @Override protected void handleRemove(){
      removeSelectedElements(newTree);
    }
  }
;
  parent.setData(AbstractMetadataFormPage.ACTION_HANDLER,actionHandler);
  ColumnViewerDND.installDND(newTree);
  this.addTreeListener(newTree);
  return newTree;
}
Program: 140559
Project: 140559
Buggy source:
private ExpandableComposite getTheSuitedComposite(SelectionEvent e){
  Object obj=e.item.getData(COLUMN_INDICATOR_KEY);
  if (obj instanceof ColumnIndicator) {
    ColumnIndicator columnIndicator=(ColumnIndicator)obj;
    for (    Composite comp : masterPage.getPreviewChartCompsites()) {
      if (comp.getData() == columnIndicator) {
        return (ExpandableComposite)comp;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private ExpandableComposite getTheSuitedComposite(SelectionEvent e){
  Composite[] previewChartCompsites=masterPage.getPreviewChartCompsites();
  if (previewChartCompsites == null) {
    return null;
  }
  Object obj=e.item.getData(COLUMN_INDICATOR_KEY);
  if (obj instanceof ColumnIndicator) {
    ColumnIndicator columnIndicator=(ColumnIndicator)obj;
    for (    Composite comp : previewChartCompsites) {
      if (comp.getData() == columnIndicator) {
        return (ExpandableComposite)comp;
      }
    }
  }
  return null;
}
Program: 140560
Project: 140560
Buggy source:
public Color getForeground(Object element,int columnIndex){
  ChartDataEntity entity=null;
  if (element instanceof PatternChartDataEntity) {
    entity=(PatternChartDataEntity)element;
  }
 else {
    entity=(ChartDataEntity)element;
  }
switch (columnIndex) {
case 1:
    String min=IndicatorHelper.getIndicatorThreshold(entity.getIndicator())[0];
  String max=IndicatorHelper.getIndicatorThreshold(entity.getIndicator())[1];
String currentValue=getColumnText(entity,columnIndex);
if (min != null && max != null && currentValue != null) {
if (Double.valueOf(max) < Double.valueOf(currentValue) || Double.valueOf(currentValue) < Double.valueOf(min)) {
  return Display.getDefault().getSystemColor(SWT.COLOR_RED);
}
break;
}
default :
}
return null;
}

Fixed version (ground truth):
public Color getForeground(Object element,int columnIndex){
  ChartDataEntity entity=null;
  if (element instanceof PatternChartDataEntity) {
    entity=(PatternChartDataEntity)element;
  }
 else {
    entity=(ChartDataEntity)element;
  }
  String[] indicatorThreshold=IndicatorHelper.getIndicatorThreshold(entity.getIndicator());
  if (indicatorThreshold != null) {
switch (columnIndex) {
case 1:
      String min=indicatorThreshold[0];
    String max=indicatorThreshold[1];
  String currentValue=getColumnText(entity,columnIndex);
if (min != null && max != null && currentValue != null) {
  if (Double.valueOf(max) < Double.valueOf(currentValue) || Double.valueOf(currentValue) < Double.valueOf(min)) {
    return Display.getDefault().getSystemColor(SWT.COLOR_RED);
  }
  break;
}
default :
}
}
return null;
}
Program: 140563
Project: 140563
Buggy source:
/** 
 * DOC qzhang Comment method "setTdDataProvider".
 */
private void setTdDataProvider(){
  ConnectionAnalysisParameter connectionParams=(ConnectionAnalysisParameter)AbstractAnalysisWizardPage.getConnectionParams();
  if (connectionParams.getTdDataProvider() == null) {
    TypedReturnCode<TdDataProvider> tdProvider=PrvResourceFileHelper.getInstance().getTdProvider(file);
    TdDataProvider dataProvider=tdProvider.getObject();
    connectionParams.setTdDataProvider(dataProvider);
  }
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "setTdDataProvider".
 */
private void setTdDataProvider(){
  ConnectionAnalysisParameter connectionParams=(ConnectionAnalysisParameter)AbstractAnalysisWizardPage.getConnectionParams();
  file=(IFile)getSelection().getFirstElement();
  TypedReturnCode<TdDataProvider> tdProvider=PrvResourceFileHelper.getInstance().getTdProvider(file);
  TdDataProvider dataProvider=tdProvider.getObject();
  connectionParams.setTdDataProvider(dataProvider);
}
Program: 140564
Project: 140564
Buggy source:
/** 
 * DOC qzhang Comment method "getAllPatternNames".
 * @return
 * @throws CoreException
 */
private Set<String> getAllPatternNames(){
  Set<String> list=new HashSet<String>();
  try {
    for (    IResource resource : folder.members()) {
      if (resource instanceof IFile) {
        Pattern fr=PatternResourceFileHelper.getInstance().findPattern((IFile)resource);
        list.add(fr.getName());
      }
    }
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  return list;
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "getAllPatternNames".
 * @return
 * @throws CoreException
 */
private Set<String> getAllPatternNames(){
  Set<String> list=new HashSet<String>();
  try {
    for (    IResource resource : folder.members()) {
      if (resource instanceof IFile) {
        Pattern fr=PatternResourceFileHelper.getInstance().findPattern((IFile)resource);
        if (fr != null) {
          list.add(fr.getName());
        }
      }
    }
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  return list;
}
Program: 140566
Project: 140566
Buggy source:
/** 
 * handle the parent button selection..
 * @param selection
 */
private void processParentSelection(TreeItemContainer treeItem,boolean selection){
  TreeItem parentItem=treeItem.getParentItem();
  if (parentItem != null && selection) {
    boolean allSelection=true;
    for (    TreeItem item : parentItem.getItems()) {
      allSelection=((TreeItemContainer)item).getButton(index).getSelection();
      if (!allSelection) {
        return;
      }
    }
    Button parentItemButton=((TreeItemContainer)parentItem).getButton(index);
    parentItemButton.setSelection(selection);
    IndicatorEnum enumData=((IIndicatorNode)parentItemButton.getData()).getIndicatorEnum();
    if (enumData != null) {
      currentColumnIndicator.addTempIndicatorEnum(enumData);
    }
    processParentSelection((TreeItemContainer)parentItem,selection);
  }
 else   if (parentItem != null && !selection) {
    Button parentItemButton=((TreeItemContainer)parentItem).getButton(index);
    parentItemButton.setSelection(selection);
    currentColumnIndicator.removeTempIndicatorEnum(((IIndicatorNode)parentItemButton.getData()).getIndicatorEnum());
    processParentSelection((TreeItemContainer)parentItem,selection);
  }
}

Fixed version (ground truth):
/** 
 * handle the parent button selection..
 * @param selection
 */
protected void processParentSelection(TreeItemContainer treeItem,boolean selection){
  TreeItem parentItem=treeItem.getParentItem();
  if (parentItem != null && selection) {
    boolean allSelection=true;
    for (    TreeItem item : parentItem.getItems()) {
      allSelection=((TreeItemContainer)item).getButton(index).getSelection();
      if (!allSelection) {
        return;
      }
    }
    Button parentItemButton=((TreeItemContainer)parentItem).getButton(index);
    parentItemButton.setSelection(selection);
    IndicatorEnum enumData=((IIndicatorNode)parentItemButton.getData()).getIndicatorEnum();
    if (enumData != null) {
      currentColumnIndicator.addTempIndicatorEnum(enumData);
    }
    processParentSelection((TreeItemContainer)parentItem,selection);
  }
 else   if (parentItem != null && !selection) {
    Button parentItemButton=((TreeItemContainer)parentItem).getButton(index);
    parentItemButton.setSelection(selection);
    currentColumnIndicator.removeTempIndicatorEnum(((IIndicatorNode)parentItemButton.getData()).getIndicatorEnum());
    processParentSelection((TreeItemContainer)parentItem,selection);
  }
}
Program: 140567
Project: 140567
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void widgetSelected(SelectionEvent e){
  Button currentRowBtn=(Button)e.getSource();
  if (currentRowBtn.getSelection()) {
    for (    Button btn : (List<Button>)currentRowBtn.getData(ROWINDICATORFLAG)) {
      ColumnIndicator columnIndicator=(ColumnIndicator)btn.getData(COLUMNINDICATORFLAG);
      IIndicatorNode node=(IIndicatorNode)btn.getData();
      if (ColumnIndicatorRule.match(node,columnIndicator)) {
        btn.setSelection(true);
        columnIndicator.addTempIndicatorEnum(node.getIndicatorEnum());
      }
    }
  }
 else {
    for (    Button btn : (List<Button>)currentRowBtn.getData(ROWINDICATORFLAG)) {
      ColumnIndicator columnIndicator=(ColumnIndicator)btn.getData(COLUMNINDICATORFLAG);
      IIndicatorNode node=(IIndicatorNode)btn.getData();
      btn.setSelection(false);
      columnIndicator.removeTempIndicatorEnum(node.getIndicatorEnum());
    }
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  IIndicatorNode indicatorNode=((IIndicatorNode)e.item.getData(INDICATORITEM));
  if (indicatorNode == null) {
    purposeLabel.setText(PURPOSE + ((TreeItem)e.item).getText());
    descriptionLabel.setText(DESCRIPTION + ((TreeItem)e.item).getText());
    return;
  }
  Indicator indicator=indicatorNode.getIndicatorInstance();
  IndicatorDefinition indicatorDefinition=indicator.getIndicatorDefinition();
  purposeLabel.setText(PURPOSE + TaggedValueHelper.getPurpose(indicatorDefinition));
  String description=DESCRIPTION + TaggedValueHelper.getDescription(indicatorDefinition);
  description=splitLongString(description);
  descriptionLabel.setText(description);
}
Program: 140568
Project: 140568
Buggy source:
/** 
 * handle the children button selection.
 */
private void processChildrenSelection(final TreeItemContainer treeItem,final int index,boolean selection){
  Button itemButton;
  for (  TreeItem childItem : treeItem.getItems()) {
    itemButton=((TreeItemContainer)childItem).getButton(index);
    if (itemButton.isEnabled()) {
      itemButton.setSelection(selection);
    }
 else {
      return;
    }
    if (selection) {
      currentColumnIndicator.addTempIndicatorEnum(((IIndicatorNode)itemButton.getData()).getIndicatorEnum());
    }
 else {
      currentColumnIndicator.removeTempIndicatorEnum(((IIndicatorNode)itemButton.getData()).getIndicatorEnum());
    }
    processChildrenSelection((TreeItemContainer)childItem,index,selection);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void processChildrenSelection(TreeItemContainer treeItem,int index,boolean selection){
  Button itemButton;
  for (  TreeItem childItem : treeItem.getItems()) {
    TreeItemContainer childItemContainer=(TreeItemContainer)childItem;
    itemButton=childItemContainer.getButton(index);
    if (itemButton.isEnabled()) {
      itemButton.setSelection(selection);
    }
 else {
      return;
    }
    processRowButtonSelect(selection,(List<Button>)itemButton.getData(ROWINDICATORFLAG));
    processChildrenSelection((TreeItemContainer)childItem,index,selection);
  }
}
Program: 140569
Project: 140569
Buggy source:
private ButtonSelectionListener(int index,TreeItemContainer treeItemContainer,IndicatorEnum indicatorEnum,ColumnIndicator currentColumnIndicator){
  this.index=index;
  this.treeItemContainer=treeItemContainer;
  this.indicatorEnum=indicatorEnum;
  this.currentColumnIndicator=currentColumnIndicator;
}

Fixed version (ground truth):
protected ButtonSelectionListener(int index,TreeItemContainer treeItemContainer,IndicatorEnum indicatorEnum,ColumnIndicator currentColumnIndicator){
  this.index=index;
  this.treeItemContainer=treeItemContainer;
  this.indicatorEnum=indicatorEnum;
  this.currentColumnIndicator=currentColumnIndicator;
}
Program: 140570
Project: 140570
Buggy source:
public Map<String,List<IndicatorUnit>> getIndicatorComposite(){
  List<IndicatorUnit> simpleList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> textList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> frequencyList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> summaryList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> patternList=new ArrayList<IndicatorUnit>();
  for (  IndicatorUnit one : indicatorUnits) {
switch (one.getType()) {
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
case BlankCountIndicatorEnum:
      simpleList.add(one);
    break;
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
  textList.add(one);
break;
case FrequencyIndicatorEnum:
frequencyList.add(one);
break;
case MeanIndicatorEnum:
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
case MedianIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
summaryList.add(one);
break;
case RegexpMatchingIndicatorEnum:
patternList.add(one);
break;
default :
}
}
separatedMap.put(SIMPLE_STATISTICS,simpleList);
separatedMap.put(TEXT_STATISTICS,textList);
separatedMap.put(FREQUENCE_STATISTICS,frequencyList);
separatedMap.put(SUMMARY_STATISTICS,summaryList);
separatedMap.put(PATTERN_MATCHING,patternList);
return separatedMap;
}

Fixed version (ground truth):
public Map<String,List<IndicatorUnit>> getIndicatorComposite(){
  List<IndicatorUnit> simpleList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> textList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> frequencyList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> summaryList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> patternList=new ArrayList<IndicatorUnit>();
  List<IndicatorUnit> sqlPatternList=new ArrayList<IndicatorUnit>();
  for (  IndicatorUnit one : indicatorUnits) {
switch (one.getType()) {
case RowCountIndicatorEnum:
case NullCountIndicatorEnum:
case DistinctCountIndicatorEnum:
case UniqueIndicatorEnum:
case DuplicateCountIndicatorEnum:
case BlankCountIndicatorEnum:
      simpleList.add(one);
    break;
case MinLengthIndicatorEnum:
case MaxLengthIndicatorEnum:
case AverageLengthIndicatorEnum:
  textList.add(one);
break;
case FrequencyIndicatorEnum:
frequencyList.add(one);
break;
case MeanIndicatorEnum:
case MinValueIndicatorEnum:
case MaxValueIndicatorEnum:
case MedianIndicatorEnum:
case LowerQuartileIndicatorEnum:
case UpperQuartileIndicatorEnum:
summaryList.add(one);
break;
case RegexpMatchingIndicatorEnum:
patternList.add(one);
break;
case SqlPatternMatchingIndicatorEnum:
sqlPatternList.add(one);
break;
default :
}
}
separatedMap.put(SIMPLE_STATISTICS,simpleList);
separatedMap.put(TEXT_STATISTICS,textList);
separatedMap.put(FREQUENCE_STATISTICS,frequencyList);
separatedMap.put(SUMMARY_STATISTICS,summaryList);
separatedMap.put(PATTERN_MATCHING,patternList);
separatedMap.put(SQL_PATTERN_MATCHING,sqlPatternList);
return separatedMap;
}
Program: 140572
Project: 140572
Buggy source:
private static ChartDataEntity[] getDataEnityFromUnits(List<IndicatorUnit> unitList){
  List<ChartDataEntity> list=new ArrayList<ChartDataEntity>();
  for (  IndicatorUnit unit : unitList) {
    if (unit.getType() == IndicatorEnum.FrequencyIndicatorEnum) {
      FrequencyExt[] freqExt=(FrequencyExt[])unit.getValue();
      for (      FrequencyExt one : freqExt) {
        ChartDataEntity entity=new ChartDataEntity();
        entity.setLabel(one.getKey().toString());
        entity.setValue(one.getValue().toString());
        entity.setIndicator(unit.getIndicator());
        list.add(entity);
      }
    }
 else     if (unit.getType() == IndicatorEnum.RegexpMatchingIndicatorEnum) {
      PatternMatchingExt patnExt=(PatternMatchingExt)unit.getValue();
      PatternChartDataEntity entity=new PatternChartDataEntity();
      entity.setLabel(unit.getIndicatorName());
      entity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
      entity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
      entity.setIndicator(unit.getIndicator());
      list.add(entity);
    }
 else {
      ChartDataEntity entity=new ChartDataEntity();
      entity.setLabel(unit.getIndicatorName());
      entity.setValue(unit.getValue().toString());
      entity.setIndicator(unit.getIndicator());
      list.add(entity);
    }
  }
  return list.toArray(new ChartDataEntity[list.size()]);
}

Fixed version (ground truth):
private static ChartDataEntity[] getDataEnityFromUnits(List<IndicatorUnit> unitList){
  List<ChartDataEntity> list=new ArrayList<ChartDataEntity>();
  for (  IndicatorUnit unit : unitList) {
    if (unit.getType() == IndicatorEnum.FrequencyIndicatorEnum) {
      FrequencyExt[] freqExt=(FrequencyExt[])unit.getValue();
      for (      FrequencyExt one : freqExt) {
        ChartDataEntity entity=new ChartDataEntity();
        entity.setLabel(one.getKey().toString());
        entity.setValue(one.getValue().toString());
        entity.setIndicator(unit.getIndicator());
        list.add(entity);
      }
    }
 else     if (unit.getType() == IndicatorEnum.RegexpMatchingIndicatorEnum || unit.getType() == IndicatorEnum.SqlPatternMatchingIndicatorEnum) {
      PatternMatchingExt patnExt=(PatternMatchingExt)unit.getValue();
      PatternChartDataEntity entity=new PatternChartDataEntity();
      entity.setLabel(unit.getIndicatorName());
      entity.setNumMatch(String.valueOf(patnExt.getMatchingValueCount()));
      entity.setNumNoMatch(String.valueOf(patnExt.getNotMatchingValueCount()));
      entity.setIndicator(unit.getIndicator());
      list.add(entity);
    }
 else {
      ChartDataEntity entity=new ChartDataEntity();
      entity.setLabel(unit.getIndicatorName());
      entity.setValue(unit.getValue().toString());
      entity.setIndicator(unit.getIndicator());
      list.add(entity);
    }
  }
  return list.toArray(new ChartDataEntity[list.size()]);
}
Program: 140575
Project: 140575
Buggy source:
private void computered(){
  double sum=0;
  for (  ChartDataEntity oneEntity : this.enity) {
    sum=sum + Double.valueOf(oneEntity.getValue());
  }
  for (  ChartDataEntity oneEntity : this.enity) {
    Double doub=Double.valueOf(oneEntity.getValue()) / sum;
    DecimalFormat format=(DecimalFormat)DecimalFormat.getPercentInstance();
    format.applyPattern("String_Node_Str");
    oneEntity.setPersent(format.format(doub));
  }
}

Fixed version (ground truth):
private void computered(){
  double sum=0;
  for (  ChartDataEntity oneEntity : this.enity) {
    if (oneEntity.getValue() != null) {
      sum=sum + Double.valueOf(oneEntity.getValue());
    }
  }
  for (  ChartDataEntity oneEntity : this.enity) {
    if (sum != 0) {
      Double doub=Double.valueOf(oneEntity.getValue()) / sum;
      DecimalFormat format=(DecimalFormat)DecimalFormat.getPercentInstance();
      format.applyPattern("String_Node_Str");
      oneEntity.setPersent(format.format(doub));
    }
 else {
      oneEntity.setPersent("String_Node_Str");
    }
  }
}
Program: 140578
Project: 140578
Buggy source:
@Override public void loadChildren(){
  ColumnSet columnSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(this.getParent());
  if (columnSet != null) {
    List<TdColumn> columnList=ColumnSetHelper.getColumns(columnSet);
    if (columnList.size() > 0) {
      this.setLoaded(true);
      this.setChildren(columnList.toArray());
      return;
    }
    Package parentCatalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema(columnSet);
    if (parentCatalogOrSchema == null) {
      return;
    }
    TdDataProvider provider=DataProviderHelper.getTdDataProvider(parentCatalogOrSchema);
    if (provider == null) {
      return;
    }
    try {
      columnList=DqRepositoryViewService.getColumns(provider,columnSet,null,true);
    }
 catch (    TalendException e) {
      MessageBoxExceptionHandler.process(e);
    }
    ColumnSetHelper.addColumns(columnSet,columnList);
    this.setChildren(columnList.toArray());
    NeedSaveDataProviderHelper.register(provider.eResource().getURI().path(),provider);
    this.setLoaded(true);
  }
}

Fixed version (ground truth):
@Override public void loadChildren(){
  ColumnSet columnSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(this.getParent());
  if (columnSet != null) {
    List<TdColumn> columnList=ColumnSetHelper.getColumns(columnSet);
    if (columnList.size() > 0) {
      this.setChildren(columnList.toArray());
      return;
    }
    Package parentCatalogOrSchema=ColumnSetHelper.getParentCatalogOrSchema(columnSet);
    if (parentCatalogOrSchema == null) {
      return;
    }
    TdDataProvider provider=DataProviderHelper.getTdDataProvider(parentCatalogOrSchema);
    if (provider == null) {
      return;
    }
    try {
      columnList=DqRepositoryViewService.getColumns(provider,columnSet,null,true);
    }
 catch (    TalendException e) {
      MessageBoxExceptionHandler.process(e);
    }
    ColumnSetHelper.addColumns(columnSet,columnList);
    this.setChildren(columnList.toArray());
    NeedSaveDataProviderHelper.register(provider.eResource().getURI().path(),provider);
  }
}