Program: 66145
Project: 66145
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (detachPopup(e.widget)) {
    return;
  }
  if (isRegistered(e.widget)) {
    attachPopup(((Button)e.widget).getData().toString());
  }
  if (e.widget == btnFixLabelSpan) {
    boolean bLabelThickFixed=btnFixLabelSpan.getSelection();
    lneLabelSpan.setEnabled(bLabelThickFixed);
    if (!bLabelThickFixed) {
      getAxisForProcessing().unsetLabelSpan();
    }
 else {
      if (lneLabelSpan.getValue() == 0) {
        double value=suggestLabelSpan(getAxisForProcessing());
        lneLabelSpan.setValue(value);
      }
      getAxisForProcessing().setLabelSpan(lneLabelSpan.getValue());
    }
  }
  if (e.widget == btnTxtValueAuto) {
    if (btnTxtValueAuto.getSelection()) {
      getAxisForProcessing().getOrigin().setValue(null);
      txtValue.setEnabled(false);
    }
 else {
      DataElement de=txtValue.getDataElement();
      getAxisForProcessing().getOrigin().setValue(de);
      txtValue.setEnabled(true);
    }
  }
 else   if (e.widget.equals(cmbTypes)) {
    final AxisType axisType=AxisType.getByName(LiteralHelper.axisTypeSet.getNameByDisplayName(cmbTypes.getText()));
    if (getAxisForProcessing().isSetType() && getAxisForProcessing().getType() == axisType) {
      return;
    }
    ChartAdapter.beginIgnoreNotifications();
{
      convertSampleData(axisType);
      getAxisForProcessing().setFormatSpecifier(null);
      EList<MarkerLine> markerLines=getAxisForProcessing().getMarkerLines();
      for (int i=0; i < markerLines.size(); i++) {
        markerLines.get(i).setFormatSpecifier(null);
      }
      EList<MarkerRange> markerRanges=getAxisForProcessing().getMarkerRanges();
      for (int i=0; i < markerRanges.size(); i++) {
        markerRanges.get(i).setFormatSpecifier(null);
      }
    }
    ChartAdapter.endIgnoreNotifications();
    if (cmbTypes.getSelectionIndex() == 0) {
      getAxisForProcessing().unsetType();
    }
 else {
      getAxisForProcessing().setType(axisType);
    }
    if (btnCategoryAxis != null) {
      boolean disableCategoryAxisUI=AxisType.TEXT_LITERAL.equals(axisType);
      getAxisForProcessing().setCategoryAxis(disableCategoryAxisUI);
      btnCategoryAxis.setSelectionState(TristateCheckbox.STATE_SELECTED);
      updateCategoryAxisUI(!disableCategoryAxisUI);
      updateReverseStateByCategoryAxisUI();
    }
    refreshPopupSheet();
  }
 else   if (e.widget.equals(cmbOrigin)) {
    if (IntersectionType.VALUE_LITERAL.getName().equals(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText()))) {
      lblValue.setEnabled(true);
      boolean enabled=true && (getAxisForProcessing().getOrigin().getValue() != null);
      txtValue.setEnabled(enabled && !btnTxtValueAuto.getSelection());
      btnTxtValueAuto.setEnabled(true);
      getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText())));
    }
 else {
      if (cmbOrigin.getSelectionIndex() == 0) {
        getAxisForProcessing().getOrigin().unsetType();
        getAxisForProcessing().getOrigin().setValue(null);
      }
 else {
        getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText())));
      }
      lblValue.setEnabled(false);
      txtValue.setEnabled(false);
      btnTxtValueAuto.setEnabled(false);
    }
    if (getAxisForProcessing().getOrigin().isSetType() && getAxisForProcessing().getOrigin().getType().getValue() == IntersectionType.VALUE) {
      getAxisForProcessing().getOrigin().setValue(txtValue.getDataElement());
    }
  }
 else   if (e.widget.equals(btnCategoryAxis)) {
    int state=btnCategoryAxis.getSelectionState();
    if (state == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetCategoryAxis();
    }
 else {
      getAxisForProcessing().setCategoryAxis(state == TristateCheckbox.STATE_SELECTED);
    }
    ChartCacheManager.getInstance().cacheCategory(((ChartWithAxes)getChart()).getType(),state == TristateCheckbox.STATE_SELECTED);
    refreshPopupSheet();
    updateReverseStateByCategoryAxisUI();
  }
 else   if (e.widget.equals(btnReverse)) {
    if (btnReverse.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      ((ChartWithAxes)getChart()).unsetReverseCategory();
    }
 else {
      ((ChartWithAxes)getChart()).setReverseCategory(btnReverse.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleVisible) {
    if (btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getTitle().unsetVisible();
    }
 else {
      getAxisForProcessing().getTitle().setVisible(btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
    setStateOfTitle();
    Button btnAxisTitle=getToggleButton(BUTTON_TITLE);
    if (!(btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED) && btnAxisTitle.getSelection()) {
      btnAxisTitle.setSelection(false);
      detachPopup(btnAxisTitle);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget == btnLabelVisible) {
    if (btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getLabel().unsetVisible();
    }
 else {
      getAxisForProcessing().getLabel().setVisible(btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
    setStateOfLabel();
    Button btnAxisLabel=getToggleButton(BUTTON_LABEL);
    if (!(btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED) && btnAxisLabel.getSelection()) {
      btnAxisLabel.setSelection(false);
      detachPopup(btnAxisLabel);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget.equals(btnFormatSpecifier)) {
    handleFormatBtnSelected();
  }
 else   if (e.widget == btnStaggered) {
    if (btnStaggered.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetStaggered();
    }
 else {
      getAxisForProcessing().setStaggered(btnStaggered.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleContentAuto) {
    if (btnTitleContentAuto.getSelection()) {
      getAxisForProcessing().getTitle().getCaption().setValue(null);
    }
 else {
      getAxisForProcessing().getTitle().getCaption().setValue(getDefaultAxisTitle());
    }
    setStateOfTitle();
    txtTitle.setText(getTitleValue());
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (detachPopup(e.widget)) {
    return;
  }
  if (isRegistered(e.widget)) {
    attachPopup(((Button)e.widget).getData().toString());
  }
  if (e.widget == btnFixLabelSpan) {
    boolean bLabelThickFixed=btnFixLabelSpan.getSelection();
    lneLabelSpan.setEnabled(bLabelThickFixed);
    if (!bLabelThickFixed) {
      getAxisForProcessing().unsetLabelSpan();
    }
 else {
      if (lneLabelSpan.getValue() == 0) {
        double value=suggestLabelSpan(getAxisForProcessing());
        lneLabelSpan.setValue(value);
      }
      getAxisForProcessing().setLabelSpan(lneLabelSpan.getValue());
    }
  }
  if (e.widget == btnTxtValueAuto) {
    if (btnTxtValueAuto.getSelection()) {
      getAxisForProcessing().getOrigin().setValue(null);
      txtValue.setEnabled(false);
    }
 else {
      DataElement de=txtValue.getDataElement();
      getAxisForProcessing().getOrigin().setValue(de);
      txtValue.setEnabled(true);
    }
  }
 else   if (e.widget.equals(cmbTypes)) {
    final AxisType axisType=AxisType.getByName(LiteralHelper.axisTypeSet.getNameByDisplayName(cmbTypes.getText()));
    if (getAxisForProcessing().isSetType() && getAxisForProcessing().getType() == axisType) {
      return;
    }
    ChartAdapter.beginIgnoreNotifications();
{
      convertSampleData(axisType);
      getAxisForProcessing().setFormatSpecifier(null);
      EList<MarkerLine> markerLines=getAxisForProcessing().getMarkerLines();
      for (int i=0; i < markerLines.size(); i++) {
        markerLines.get(i).setFormatSpecifier(null);
      }
      EList<MarkerRange> markerRanges=getAxisForProcessing().getMarkerRanges();
      for (int i=0; i < markerRanges.size(); i++) {
        markerRanges.get(i).setFormatSpecifier(null);
      }
    }
    ChartAdapter.endIgnoreNotifications();
    if (cmbTypes.getSelectionIndex() == 0) {
      getAxisForProcessing().unsetType();
    }
 else {
      getAxisForProcessing().setType(axisType);
    }
    if (btnCategoryAxis != null) {
      boolean disableCategoryAxisUI=AxisType.TEXT_LITERAL.equals(axisType);
      getAxisForProcessing().setCategoryAxis(disableCategoryAxisUI);
      btnCategoryAxis.setSelectionState(TristateCheckbox.STATE_SELECTED);
      updateCategoryAxisUI(!disableCategoryAxisUI);
      updateReverseStateByCategoryAxisUI();
    }
    refreshPopupSheet();
  }
 else   if (e.widget.equals(cmbOrigin)) {
    if (IntersectionType.VALUE_LITERAL.getName().equals(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText()))) {
      boolean enabled=true && (getAxisForProcessing().getOrigin().getValue() != null);
      btnTxtValueAuto.setEnabled(true);
      lblValue.setEnabled(true);
      txtValue.setEnabled(enabled && !btnTxtValueAuto.getSelection());
      getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText())));
    }
 else {
      boolean enabled=false;
      if (cmbOrigin.getSelectionIndex() == 0) {
        getAxisForProcessing().getOrigin().unsetType();
        getAxisForProcessing().getOrigin().setValue(null);
        enabled=true;
      }
 else {
        getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(LiteralHelper.intersectionTypeSet.getNameByDisplayName(cmbOrigin.getText())));
      }
      btnTxtValueAuto.setEnabled(enabled);
      lblValue.setEnabled(enabled);
      txtValue.setEnabled(enabled && !btnTxtValueAuto.getSelection());
    }
    if (getAxisForProcessing().getOrigin().isSetType() && getAxisForProcessing().getOrigin().getType().getValue() == IntersectionType.VALUE) {
      getAxisForProcessing().getOrigin().setValue(txtValue.getDataElement());
    }
  }
 else   if (e.widget.equals(btnCategoryAxis)) {
    int state=btnCategoryAxis.getSelectionState();
    if (state == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetCategoryAxis();
    }
 else {
      getAxisForProcessing().setCategoryAxis(state == TristateCheckbox.STATE_SELECTED);
    }
    ChartCacheManager.getInstance().cacheCategory(((ChartWithAxes)getChart()).getType(),state == TristateCheckbox.STATE_SELECTED);
    refreshPopupSheet();
    updateReverseStateByCategoryAxisUI();
  }
 else   if (e.widget.equals(btnReverse)) {
    if (btnReverse.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      ((ChartWithAxes)getChart()).unsetReverseCategory();
    }
 else {
      ((ChartWithAxes)getChart()).setReverseCategory(btnReverse.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleVisible) {
    if (btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getTitle().unsetVisible();
    }
 else {
      getAxisForProcessing().getTitle().setVisible(btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
    setStateOfTitle();
    Button btnAxisTitle=getToggleButton(BUTTON_TITLE);
    if (!(btnTitleVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED) && btnAxisTitle.getSelection()) {
      btnAxisTitle.setSelection(false);
      detachPopup(btnAxisTitle);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget == btnLabelVisible) {
    if (btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getLabel().unsetVisible();
    }
 else {
      getAxisForProcessing().getLabel().setVisible(btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
    setStateOfLabel();
    Button btnAxisLabel=getToggleButton(BUTTON_LABEL);
    if (!(btnLabelVisible.getSelectionState() == TristateCheckbox.STATE_SELECTED) && btnAxisLabel.getSelection()) {
      btnAxisLabel.setSelection(false);
      detachPopup(btnAxisLabel);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget.equals(btnFormatSpecifier)) {
    handleFormatBtnSelected();
  }
 else   if (e.widget == btnStaggered) {
    if (btnStaggered.getSelectionState() == TristateCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetStaggered();
    }
 else {
      getAxisForProcessing().setStaggered(btnStaggered.getSelectionState() == TristateCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleContentAuto) {
    if (btnTitleContentAuto.getSelection()) {
      getAxisForProcessing().getTitle().getCaption().setValue(null);
    }
 else {
      getAxisForProcessing().getTitle().getCaption().setValue(getDefaultAxisTitle());
    }
    setStateOfTitle();
    txtTitle.setText(getTitleValue());
  }
}