Program: 140548
Project: 140548
Buggy source:
/** 
 * DOC qzhang Comment method "createOneUnit".
 * @param treeItem
 * @param indicatorUnit
 */
public void createOneUnit(final TreeItem treeItem,IndicatorUnit indicatorUnit){
  final TreeItem indicatorItem=new TreeItem(treeItem,SWT.NONE);
  final IndicatorUnit unit=indicatorUnit;
  IndicatorEnum type=indicatorUnit.getType();
  final IndicatorEnum indicatorEnum=type;
  indicatorItem.setData(COLUMN_INDICATOR_KEY,treeItem.getData(COLUMN_INDICATOR_KEY));
  indicatorItem.setData(INDICATOR_UNIT_KEY,unit);
  indicatorItem.setData(VIEWER_KEY,this);
  String label=indicatorUnit.getIndicatorName();
  if (IndicatorEnum.RegexpMatchingIndicatorEnum.compareTo(type) == 0 || IndicatorEnum.SqlPatternMatchingIndicatorEnum.compareTo(type) == 0) {
    indicatorItem.setImage(0,ImageLib.getImage(ImageLib.PATTERN_REG));
  }
  indicatorItem.setText(0,label);
  TreeEditor optionEditor;
  optionEditor=new TreeEditor(tree);
  Label optionLabel=new Label(tree,SWT.NONE);
  optionLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION));
  optionLabel.setToolTipText("String_Node_Str");
  optionLabel.pack();
  optionLabel.setData(indicatorUnit);
  optionLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      IndicatorUnit indicatorUnit=(IndicatorUnit)((Label)e.getSource()).getData();
      IndicatorOptionsWizard wizard=new IndicatorOptionsWizard(indicatorUnit);
      String href=FormEnum.getFirstFormHelpHref(indicatorUnit);
      CheatSheetWizardDialog optionDialog=new CheatSheetWizardDialog(null,wizard,href);
      optionDialog.create();
      if (Window.OK == optionDialog.open()) {
        setDirty(wizard.isDirty());
        createIndicatorParameters(indicatorItem,indicatorUnit);
      }
    }
  }
);
  optionEditor.minimumWidth=WIDTH1_CELL;
  optionEditor.horizontalAlignment=SWT.CENTER;
  optionEditor.setEditor(optionLabel,indicatorItem,1);
  TreeEditor delEditor=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("String_Node_Str");
  delLabel.pack();
  delLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      ColumnIndicator columnIndicator=(ColumnIndicator)treeItem.getData(COLUMN_INDICATOR_KEY);
      deleteIndicatorItems(columnIndicator,unit);
      if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
        setElements(columnIndicators);
      }
 else {
        removeItemBranch(indicatorItem);
      }
    }
  }
);
  delEditor.minimumWidth=WIDTH1_CELL;
  delEditor.horizontalAlignment=SWT.CENTER;
  delEditor.setEditor(delLabel,indicatorItem,3);
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorEnum.hasChildren()) {
    indicatorItem.setData(treeItem.getData(COLUMN_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
  createIndicatorParameters(indicatorItem,indicatorUnit);
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "createOneUnit".
 * @param treeItem
 * @param indicatorUnit
 */
public void createOneUnit(final TreeItem treeItem,IndicatorUnit indicatorUnit){
  final TreeItem indicatorItem=new TreeItem(treeItem,SWT.NONE);
  final IndicatorUnit unit=indicatorUnit;
  IndicatorEnum type=indicatorUnit.getType();
  final IndicatorEnum indicatorEnum=type;
  indicatorItem.setData(COLUMN_INDICATOR_KEY,treeItem.getData(COLUMN_INDICATOR_KEY));
  indicatorItem.setData(INDICATOR_UNIT_KEY,unit);
  indicatorItem.setData(VIEWER_KEY,this);
  String label=indicatorUnit.getIndicatorName();
  if (IndicatorEnum.RegexpMatchingIndicatorEnum.compareTo(type) == 0 || IndicatorEnum.SqlPatternMatchingIndicatorEnum.compareTo(type) == 0) {
    indicatorItem.setImage(0,ImageLib.getImage(ImageLib.PATTERN_REG));
  }
  indicatorItem.setText(0,label);
  TreeEditor optionEditor;
  optionEditor=new TreeEditor(tree);
  Label optionLabel=new Label(tree,SWT.NONE);
  optionLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
  optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION));
  optionLabel.setToolTipText("String_Node_Str");
  optionLabel.pack();
  optionLabel.setData(indicatorUnit);
  optionLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      IndicatorUnit indicatorUnit=(IndicatorUnit)((Label)e.getSource()).getData();
      IndicatorOptionsWizard wizard=new IndicatorOptionsWizard(indicatorUnit);
      String href=FormEnum.getFirstFormHelpHref(indicatorUnit);
      OpeningHelpWizardDialog optionDialog=new OpeningHelpWizardDialog(null,wizard,href);
      optionDialog.create();
      if (Window.OK == optionDialog.open()) {
        setDirty(wizard.isDirty());
        createIndicatorParameters(indicatorItem,indicatorUnit);
      }
    }
  }
);
  optionEditor.minimumWidth=WIDTH1_CELL;
  optionEditor.horizontalAlignment=SWT.CENTER;
  optionEditor.setEditor(optionLabel,indicatorItem,1);
  TreeEditor delEditor=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("String_Node_Str");
  delLabel.pack();
  delLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      ColumnIndicator columnIndicator=(ColumnIndicator)treeItem.getData(COLUMN_INDICATOR_KEY);
      deleteIndicatorItems(columnIndicator,unit);
      if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
        setElements(columnIndicators);
      }
 else {
        removeItemBranch(indicatorItem);
      }
    }
  }
);
  delEditor.minimumWidth=WIDTH1_CELL;
  delEditor.horizontalAlignment=SWT.CENTER;
  delEditor.setEditor(delLabel,indicatorItem,3);
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorEnum.hasChildren()) {
    indicatorItem.setData(treeItem.getData(COLUMN_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
  createIndicatorParameters(indicatorItem,indicatorUnit);
}