Program: 138220
Project: 138220
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 indicatorType=indicatorUnit.getType();
  indicatorItem.setData(MODELELEMENT_INDICATOR_KEY,treeItem.getData(MODELELEMENT_INDICATOR_KEY));
  indicatorItem.setData(INDICATOR_UNIT_KEY,unit);
  indicatorItem.setData(viewKey,this);
  indicatorItem.setImage(0,getIndicatorImage(unit));
  String indicatorName=getIndicatorName(indicatorUnit);
  String label=indicatorName == null ? "String_Node_Str" : indicatorName;
  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(DefaultMessagesImpl.getString("String_Node_Str"));
  optionLabel.pack();
  optionLabel.setData(indicatorUnit);
  optionLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      openIndicatorOptionDialog(null,indicatorItem);
    }
  }
);
  optionEditor.minimumWidth=optionLabel.getImage().getBounds().width;
  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(DefaultMessagesImpl.getString("String_Node_Str"));
  delLabel.pack();
  delLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      ModelElementIndicator meIndicator=(ModelElementIndicator)treeItem.getData(MODELELEMENT_INDICATOR_KEY);
      deleteIndicatorItems(meIndicator,unit);
      if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
        setElements(modelElementIndicators);
      }
 else {
        removeItemBranch(indicatorItem);
      }
    }
  }
);
  delEditor.minimumWidth=delLabel.getImage().getBounds().width;
  delEditor.horizontalAlignment=SWT.CENTER;
  if (AnalysisColumnTreeViewer.VIEWER_KEY.equals(viewKey)) {
    delEditor.setEditor(delLabel,indicatorItem,4);
  }
 else   if (AnalysisColumnSetTreeViewer.VIEWER_KEY.equals(viewKey)) {
    delEditor.setEditor(delLabel,indicatorItem,3);
  }
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorType.hasChildren()) {
    indicatorItem.setData(treeItem.getData(MODELELEMENT_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
  createIndicatorParameters(indicatorItem,indicatorUnit);
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      tree.setFocus();
    }
  }
);
}

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 indicatorType=indicatorUnit.getType();
  indicatorItem.setData(MODELELEMENT_INDICATOR_KEY,treeItem.getData(MODELELEMENT_INDICATOR_KEY));
  indicatorItem.setData(INDICATOR_UNIT_KEY,unit);
  indicatorItem.setData(viewKey,this);
  indicatorItem.setImage(0,getIndicatorImage(unit));
  String indicatorName=getIndicatorName(indicatorUnit);
  String label=indicatorName == null ? "String_Node_Str" : indicatorName;
  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(DefaultMessagesImpl.getString("String_Node_Str"));
  optionLabel.pack();
  optionLabel.setData(indicatorUnit);
  optionLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      openIndicatorOptionDialog(null,indicatorItem);
    }
  }
);
  optionEditor.minimumWidth=optionLabel.getImage().getBounds().width;
  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(DefaultMessagesImpl.getString("String_Node_Str"));
  delLabel.pack();
  delLabel.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      ModelElementIndicator meIndicator=(ModelElementIndicator)treeItem.getData(MODELELEMENT_INDICATOR_KEY);
      deleteIndicatorItems(meIndicator,unit);
      if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
        setElements(modelElementIndicators);
      }
 else {
        removeItemBranch(indicatorItem);
      }
    }
  }
);
  delEditor.minimumWidth=delLabel.getImage().getBounds().width;
  delEditor.horizontalAlignment=SWT.CENTER;
  if (AnalysisColumnTreeViewer.VIEWER_KEY.equals(viewKey)) {
    delEditor.setEditor(delLabel,indicatorItem,4);
  }
 else   if (AnalysisColumnSetTreeViewer.VIEWER_KEY.equals(viewKey)) {
    delEditor.setEditor(delLabel,indicatorItem,3);
  }
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorType.hasChildren()) {
    indicatorItem.setData(treeItem.getData(MODELELEMENT_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
  createIndicatorParameters(indicatorItem,indicatorUnit);
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      Rectangle bounds=tree.getBounds();
      tree.setBounds(bounds.x,bounds.y,bounds.width,bounds.height - 1);
      tree.setBounds(bounds.x,bounds.y,bounds.width,bounds.height + 1);
    }
  }
);
}