Program: 140707
Project: 140707
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.PatternMatchingIndicatorEnum.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){
      final IndicatorUnit indicator=(IndicatorUnit)((Label)e.getSource()).getData();
      final IndicatorOptionsWizard wizard=new IndicatorOptionsWizard(indicator,analysis){
        @Override public void dispose(){
          activeCount=0;
          super.dispose();
        }
      }
;
      try {
        WizardDialog dialog=new WizardDialog(null,wizard){
          @Override public void openTray(          DialogTray tray) throws IllegalStateException, UnsupportedOperationException {
            super.openTray(tray);
            if (tray instanceof HelpTray) {
              HelpTray helpTray=(HelpTray)tray;
              ReusableHelpPart helpPart=helpTray.getHelpPart();
              helpPart.getForm().getForm().notifyListeners(SWT.Activate,new Event());
            }
          }
        }
;
        dialog.setPageSize(300,400);
        dialog.create();
        dialog.getShell().addShellListener(new ShellAdapter(){
          @Override public void shellActivated(          ShellEvent e){
            String string=HelpPlugin.PLUGIN_ID + HelpPlugin.INDICATOR_OPTION_HELP_ID;
            if (activeCount < 2) {
              Point point=e.widget.getDisplay().getCursorLocation();
              IContext context=HelpSystem.getContext(string);
              IHelpResource[] relatedTopics=context.getRelatedTopics();
              for (              IHelpResource topic : relatedTopics) {
                topic.getLabel();
                topic.getHref();
              }
              IWorkbenchHelpSystem helpSystem=PlatformUI.getWorkbench().getHelpSystem();
              helpSystem.displayContext(context,point.x + 15,point.y);
              activeCount++;
              ReusableHelpPart lastActiveInstance=ReusableHelpPart.getLastActiveInstance();
              if (lastActiveInstance != null) {
                String href=IndicatorParameterTypes.getHref(indicator);
                if (href != null) {
                  lastActiveInstance.showURL(href);
                }
              }
            }
          }
        }
);
        int open=dialog.open();
        if (Window.OK == open) {
          setDirty(wizard.isDirty());
        }
      }
 catch (      AssertionFailedException ex) {
        MessageDialogWithToggle.openInformation(null,"String_Node_Str","String_Node_Str");
      }
    }
  }
);
  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.ACTION_DELETE));
  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,2);
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorEnum.hasChildren()) {
    indicatorItem.setData(treeItem.getData(COLUMN_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
}

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.PatternMatchingIndicatorEnum.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){
      final IndicatorUnit indicator=(IndicatorUnit)((Label)e.getSource()).getData();
      final IndicatorOptionsWizard wizard=new IndicatorOptionsWizard(indicator,analysis){
        @Override public void dispose(){
          activeCount=0;
          super.dispose();
        }
      }
;
      try {
        WizardDialog dialog=new WizardDialog(null,wizard){
          @Override public void openTray(          DialogTray tray) throws IllegalStateException, UnsupportedOperationException {
            super.openTray(tray);
            if (tray instanceof HelpTray) {
              HelpTray helpTray=(HelpTray)tray;
              ReusableHelpPart helpPart=helpTray.getHelpPart();
              helpPart.getForm().getForm().notifyListeners(SWT.Activate,new Event());
            }
          }
        }
;
        dialog.setPageSize(300,400);
        dialog.create();
        dialog.getShell().addShellListener(new ShellAdapter(){
          @Override public void shellActivated(          ShellEvent e){
            String string=HelpPlugin.PLUGIN_ID + HelpPlugin.INDICATOR_OPTION_HELP_ID;
            if (activeCount < 2) {
              Point point=e.widget.getDisplay().getCursorLocation();
              IContext context=HelpSystem.getContext(string);
              IHelpResource[] relatedTopics=context.getRelatedTopics();
              for (              IHelpResource topic : relatedTopics) {
                topic.getLabel();
                topic.getHref();
              }
              IWorkbenchHelpSystem helpSystem=PlatformUI.getWorkbench().getHelpSystem();
              helpSystem.displayContext(context,point.x + 15,point.y);
              activeCount++;
              ReusableHelpPart lastActiveInstance=ReusableHelpPart.getLastActiveInstance();
              if (lastActiveInstance != null) {
                String href=IndicatorParameterTypes.getHref(indicator);
                if (href != null) {
                  lastActiveInstance.showURL(href);
                }
              }
            }
          }
        }
);
        int open=dialog.open();
        if (Window.OK == open) {
          setDirty(wizard.isDirty());
        }
      }
 catch (      AssertionFailedException ex) {
        MessageDialogWithToggle.openInformation(null,"String_Node_Str","String_Node_Str");
      }
    }
  }
);
  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,2);
  indicatorItem.setData(ITEM_EDITOR_KEY,new TreeEditor[]{optionEditor,delEditor});
  if (indicatorEnum.hasChildren()) {
    indicatorItem.setData(treeItem.getData(COLUMN_INDICATOR_KEY));
    createIndicatorItems(indicatorItem,indicatorUnit.getChildren());
  }
}