Program: 139968
Project: 139968
Buggy source:
private void addItemElements(final ColumnIndicator[] elements){
  for (int i=0; i < elements.length; i++) {
    final TreeItem treeItem=new TreeItem(tree,SWT.NONE);
    treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
    final ColumnIndicator columnIndicator=(ColumnIndicator)elements[i];
    String columnName=columnIndicator.getTdColumn().getName();
    treeItem.setText(0,columnName != null ? columnName + PluginConstant.SPACE_STRING + PluginConstant.PARENTHESIS_LEFT+ columnIndicator.getTdColumn().getSqlDataType().getName()+ PluginConstant.PARENTHESIS_RIGHT : "String_Node_Str");
    treeItem.setData(COLUMN_INDICATOR_KEY,columnIndicator);
    TreeEditor comboEditor=new TreeEditor(tree);
    final CCombo combo=new CCombo(tree,SWT.BORDER);
    for (    DataminingType type : DataminingType.values()) {
      combo.add(type.getLiteral());
    }
    DataminingType dataminingType=MetadataHelper.getDataminingType(columnIndicator.getTdColumn());
    if (dataminingType == null) {
      dataminingType=MetadataHelper.getDefaultDataminingType(columnIndicator.getTdColumn().getJavaType());
    }
    if (dataminingType == null) {
      combo.select(0);
    }
 else {
      combo.setText(dataminingType.getLiteral());
    }
    combo.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        MetadataHelper.setDataminingType(DataminingType.get(combo.getText()),columnIndicator.getTdColumn());
        setDirty(true);
      }
    }
);
    combo.setEditable(false);
    comboEditor.minimumWidth=WIDTH1_CELL;
    comboEditor.setEditor(combo,treeItem,1);
    TreeEditor addPatternEditor=new TreeEditor(tree);
    Label addPatternLabl=new Label(tree,SWT.NONE);
    addPatternLabl.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    addPatternLabl.setImage(ImageLib.getImage(ImageLib.ADD_PATTERN));
    addPatternLabl.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
    addPatternLabl.pack();
    addPatternLabl.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        DataManager dm=getAnalysis().getContext().getConnection();
        if (dm == null) {
          masterPage.doSave(null);
        }
        IProject libProject=ResourcesPlugin.getWorkspace().getRoot().getProject(DQStructureManager.LIBRARIES);
        CheckedTreeSelectionDialog dialog=new CheckedTreeSelectionDialog(null,new PatternLabelProvider(),new WorkbenchContentProvider());
        dialog.setInput(libProject);
        dialog.setValidator(new ISelectionStatusValidator(){
          public IStatus validate(          Object[] selection){
            IStatus status=Status.OK_STATUS;
            for (            Object patte : selection) {
              if (patte instanceof IFile) {
                IFile file=(IFile)patte;
                if (FactoriesUtil.PATTERN.equals(file.getFileExtension())) {
                  Pattern findPattern=PatternResourceFileHelper.getInstance().findPattern(file);
                  boolean validStatus=TaggedValueHelper.getValidStatus(findPattern);
                  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.PATTERN.equals(file.getFileExtension())) {
                return true;
              }
            }
 else             if (element instanceof IFolder) {
              IFolder folder=(IFolder)element;
              return PatternUtilities.isLibraiesSubfolder(folder,DQStructureManager.PATTERNS,DQStructureManager.SQL_PATTERNS);
            }
            return false;
          }
        }
);
        dialog.setContainerMode(true);
        dialog.setTitle(DefaultMessagesImpl.getString("String_Node_Str"));
        dialog.setMessage(DefaultMessagesImpl.getString("String_Node_Str"));
        dialog.setSize(80,30);
        if (dialog.open() == Window.OK) {
          for (          Object obj : dialog.getResult()) {
            if (obj instanceof IFile) {
              IFile file=(IFile)obj;
              IndicatorUnit addIndicatorUnit=PatternUtilities.createIndicatorUnit(file,columnIndicator,getAnalysis());
              if (addIndicatorUnit != null) {
                createOneUnit(treeItem,addIndicatorUnit);
                setDirty(true);
              }
 else {
                MessageUI.openError(file.getName() + "String_Node_Str");
              }
            }
          }
        }
      }
    }
);
    addPatternEditor.minimumWidth=WIDTH1_CELL;
    addPatternEditor.setEditor(addPatternLabl,treeItem,2);
    TreeEditor delLabelEditor=new TreeEditor(tree);
    Label delLabel=new Label(tree,SWT.NONE);
    delLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    delLabel.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
    delLabel.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
    delLabel.pack();
    delLabel.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        deleteColumnItems(columnIndicator);
        if (treeItem.getParentItem() != null && treeItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
          setElements(columnIndicators);
        }
 else {
          removeItemBranch(treeItem);
        }
      }
    }
);
    delLabelEditor.minimumWidth=WIDTH1_CELL;
    delLabelEditor.horizontalAlignment=SWT.CENTER;
    delLabelEditor.setEditor(delLabel,treeItem,3);
    treeItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{comboEditor,delLabelEditor,addPatternEditor});
    if (columnIndicator.hasIndicators()) {
      createIndicatorItems(treeItem,columnIndicator.getIndicatorUnits());
    }
    treeItem.setExpanded(true);
  }
  this.setDirty(true);
}

Fixed version (ground truth):
private void addItemElements(final ColumnIndicator[] elements){
  for (int i=0; i < elements.length; i++) {
    final TreeItem treeItem=new TreeItem(tree,SWT.NONE);
    treeItem.setImage(ImageLib.getImage(ImageLib.TD_COLUMN));
    final ColumnIndicator columnIndicator=(ColumnIndicator)elements[i];
    String columnName=columnIndicator.getTdColumn().getName();
    treeItem.setText(0,columnName != null ? columnName + PluginConstant.SPACE_STRING + PluginConstant.PARENTHESIS_LEFT+ columnIndicator.getTdColumn().getSqlDataType().getName()+ PluginConstant.PARENTHESIS_RIGHT : "String_Node_Str");
    treeItem.setData(COLUMN_INDICATOR_KEY,columnIndicator);
    TreeEditor comboEditor=new TreeEditor(tree);
    final CCombo combo=new CCombo(tree,SWT.BORDER);
    for (    DataminingType type : DataminingType.values()) {
      combo.add(type.getLiteral());
    }
    DataminingType dataminingType=MetadataHelper.getDataminingType(columnIndicator.getTdColumn());
    if (dataminingType == null) {
      dataminingType=MetadataHelper.getDefaultDataminingType(columnIndicator.getTdColumn().getJavaType());
    }
    if (dataminingType == null) {
      combo.select(0);
    }
 else {
      combo.setText(dataminingType.getLiteral());
    }
    combo.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        MetadataHelper.setDataminingType(DataminingType.get(combo.getText()),columnIndicator.getTdColumn());
        setDirty(true);
      }
    }
);
    combo.setEditable(false);
    comboEditor.minimumWidth=WIDTH1_CELL;
    comboEditor.setEditor(combo,treeItem,1);
    TreeEditor addPatternEditor=new TreeEditor(tree);
    Label addPatternLabl=new Label(tree,SWT.NONE);
    addPatternLabl.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    addPatternLabl.setImage(ImageLib.getImage(ImageLib.ADD_PATTERN));
    addPatternLabl.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
    addPatternLabl.pack();
    addPatternLabl.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        DataManager dm=getAnalysis().getContext().getConnection();
        if (dm == null) {
          masterPage.doSave(null);
        }
        IProject libProject=ResourcesPlugin.getWorkspace().getRoot().getProject(DQStructureManager.LIBRARIES);
        CheckedTreeSelectionDialog dialog=new CheckedTreeSelectionDialog(null,new PatternLabelProvider(),new WorkbenchContentProvider());
        dialog.setInput(libProject);
        dialog.setValidator(new ISelectionStatusValidator(){
          public IStatus validate(          Object[] selection){
            IStatus status=Status.OK_STATUS;
            for (            Object patte : selection) {
              if (patte instanceof IFile) {
                IFile file=(IFile)patte;
                if (FactoriesUtil.PATTERN.equals(file.getFileExtension())) {
                  Pattern findPattern=PatternResourceFileHelper.getInstance().findPattern(file);
                  boolean validStatus=TaggedValueHelper.getValidStatus(findPattern);
                  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.PATTERN.equals(file.getFileExtension())) {
                return true;
              }
            }
 else             if (element instanceof IFolder) {
              IFolder folder=(IFolder)element;
              return PatternUtilities.isLibraiesSubfolder(folder,DQStructureManager.PATTERNS,DQStructureManager.SQL_PATTERNS);
            }
            return false;
          }
        }
);
        dialog.setContainerMode(true);
        dialog.setTitle(DefaultMessagesImpl.getString("String_Node_Str"));
        dialog.setMessage(DefaultMessagesImpl.getString("String_Node_Str"));
        dialog.setSize(80,30);
        if (dialog.open() == Window.OK) {
          for (          Object obj : dialog.getResult()) {
            if (obj instanceof IFile) {
              IFile file=(IFile)obj;
              IndicatorUnit addIndicatorUnit=PatternUtilities.createIndicatorUnit(file,columnIndicator,getAnalysis());
              if (addIndicatorUnit != null) {
                createOneUnit(treeItem,addIndicatorUnit);
                setDirty(true);
              }
 else {
                Pattern pattern=PatternResourceFileHelper.getInstance().findPattern(file);
                MessageUI.openError("String_Node_Str" + pattern.getName() + "String_Node_Str");
              }
            }
          }
        }
      }
    }
);
    addPatternEditor.minimumWidth=WIDTH1_CELL;
    addPatternEditor.setEditor(addPatternLabl,treeItem,2);
    TreeEditor delLabelEditor=new TreeEditor(tree);
    Label delLabel=new Label(tree,SWT.NONE);
    delLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    delLabel.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
    delLabel.setToolTipText(DefaultMessagesImpl.getString("String_Node_Str"));
    delLabel.pack();
    delLabel.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        deleteColumnItems(columnIndicator);
        if (treeItem.getParentItem() != null && treeItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
          setElements(columnIndicators);
        }
 else {
          removeItemBranch(treeItem);
        }
      }
    }
);
    delLabelEditor.minimumWidth=WIDTH1_CELL;
    delLabelEditor.horizontalAlignment=SWT.CENTER;
    delLabelEditor.setEditor(delLabel,treeItem,3);
    treeItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{comboEditor,delLabelEditor,addPatternEditor});
    if (columnIndicator.hasIndicators()) {
      createIndicatorItems(treeItem,columnIndicator.getIndicatorUnits());
    }
    treeItem.setExpanded(true);
  }
  this.setDirty(true);
}