Program: 65954
Project: 65954
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.equals(cmbTypes)) {
    String selectedAxisType=cmbTypes.getSelectedItemData();
    final AxisType axisType=(selectedAxisType == null) ? getDefaultValueAxis().getType() : AxisType.getByName(selectedAxisType);
    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 (selectedAxisType != null) {
      getAxisForProcessing().setType(axisType);
      if (btnCategoryAxis != null) {
        boolean disableCategoryAxisUI=AxisType.TEXT_LITERAL.equals(axisType);
        getAxisForProcessing().setCategoryAxis(disableCategoryAxisUI);
        btnCategoryAxis.setSelectionState(ChartCheckbox.STATE_SELECTED);
        updateCategoryAxisUI(!disableCategoryAxisUI);
        updateReverseStateByCategoryAxisUI();
      }
    }
    refreshPopupSheet();
  }
 else   if (e.widget.equals(cmbOrigin)) {
    String selectedOriginType=cmbOrigin.getSelectedItemData();
    if (selectedOriginType != null && IntersectionType.VALUE_LITERAL.getName().equals(selectedOriginType)) {
      lblValue.setEnabled(true);
      txtValue.setEnabled(true);
      getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(selectedOriginType));
    }
 else {
      boolean enabled=false;
      if (selectedOriginType == null) {
        enabled=true;
      }
 else {
        getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(selectedOriginType));
      }
      getAxisForProcessing().getOrigin().setValue(null);
      lblValue.setEnabled(enabled);
      txtValue.setEnabled(enabled);
    }
    if (selectedOriginType != null && getAxisForProcessing().getOrigin().getType().getValue() == IntersectionType.VALUE) {
      getAxisForProcessing().getOrigin().setValue(txtValue.getDataElement());
    }
  }
 else   if (e.widget.equals(btnCategoryAxis)) {
    int state=btnCategoryAxis.getSelectionState();
    if (state == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetCategoryAxis();
    }
 else {
      getAxisForProcessing().setCategoryAxis(state == ChartCheckbox.STATE_SELECTED);
    }
    ChartCacheManager.getInstance().cacheCategory(((ChartWithAxes)getChart()).getType(),state == ChartCheckbox.STATE_SELECTED);
    refreshPopupSheet();
    updateReverseStateByCategoryAxisUI();
  }
 else   if (e.widget.equals(btnReverse)) {
    if (btnReverse.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      ((ChartWithAxes)getChart()).unsetReverseCategory();
    }
 else {
      ((ChartWithAxes)getChart()).setReverseCategory(btnReverse.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleVisible) {
    if (btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getTitle().unsetVisible();
    }
 else {
      getAxisForProcessing().getTitle().setVisible(btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
    setStateOfTitle();
    Button btnAxisTitle=getToggleButton(BUTTON_TITLE);
    if (!(btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED) && btnAxisTitle.getSelection()) {
      btnAxisTitle.setSelection(false);
      detachPopup(btnAxisTitle);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget == btnLabelVisible) {
    if (btnLabelVisible.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getLabel().unsetVisible();
    }
 else {
      getAxisForProcessing().getLabel().setVisible(btnLabelVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
    setStateOfLabel();
    Button btnAxisLabel=getToggleButton(BUTTON_LABEL);
    if (!(btnLabelVisible.getSelectionState() == ChartCheckbox.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() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetStaggered();
    }
 else {
      getAxisForProcessing().setStaggered(btnStaggered.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
  }
}

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.equals(cmbTypes)) {
    String selectedAxisType=cmbTypes.getSelectedItemData();
    final AxisType axisType=(selectedAxisType == null) ? getDefaultValueAxis().getType() : AxisType.getByName(selectedAxisType);
    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 (selectedAxisType != null) {
      getAxisForProcessing().setType(axisType);
    }
    if (btnCategoryAxis != null) {
      boolean disableCategoryAxisUI=(selectedAxisType != null && AxisType.TEXT_LITERAL.equals(axisType));
      updateCategoryAxisUI(!disableCategoryAxisUI);
      updateReverseStateByCategoryAxisUI();
    }
    refreshPopupSheet();
  }
 else   if (e.widget.equals(cmbOrigin)) {
    String selectedOriginType=cmbOrigin.getSelectedItemData();
    if (selectedOriginType != null && IntersectionType.VALUE_LITERAL.getName().equals(selectedOriginType)) {
      lblValue.setEnabled(true);
      txtValue.setEnabled(true);
      getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(selectedOriginType));
    }
 else {
      boolean enabled=false;
      if (selectedOriginType == null) {
        enabled=true;
      }
 else {
        getAxisForProcessing().getOrigin().setType(IntersectionType.getByName(selectedOriginType));
      }
      getAxisForProcessing().getOrigin().setValue(null);
      lblValue.setEnabled(enabled);
      txtValue.setEnabled(enabled);
    }
    if (selectedOriginType != null && getAxisForProcessing().getOrigin().getType().getValue() == IntersectionType.VALUE) {
      getAxisForProcessing().getOrigin().setValue(txtValue.getDataElement());
    }
  }
 else   if (e.widget.equals(btnCategoryAxis)) {
    int state=btnCategoryAxis.getSelectionState();
    if (state == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetCategoryAxis();
    }
 else {
      getAxisForProcessing().setCategoryAxis(state == ChartCheckbox.STATE_SELECTED);
    }
    ChartCacheManager.getInstance().cacheCategory(((ChartWithAxes)getChart()).getType(),state == ChartCheckbox.STATE_SELECTED);
    refreshPopupSheet();
    updateReverseStateByCategoryAxisUI();
  }
 else   if (e.widget.equals(btnReverse)) {
    if (btnReverse.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      ((ChartWithAxes)getChart()).unsetReverseCategory();
    }
 else {
      ((ChartWithAxes)getChart()).setReverseCategory(btnReverse.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
  }
 else   if (e.widget == btnTitleVisible) {
    if (btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getTitle().unsetVisible();
    }
 else {
      getAxisForProcessing().getTitle().setVisible(btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
    setStateOfTitle();
    Button btnAxisTitle=getToggleButton(BUTTON_TITLE);
    if (!(btnTitleVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED) && btnAxisTitle.getSelection()) {
      btnAxisTitle.setSelection(false);
      detachPopup(btnAxisTitle);
    }
 else {
      refreshPopupSheet();
    }
  }
 else   if (e.widget == btnLabelVisible) {
    if (btnLabelVisible.getSelectionState() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().getLabel().unsetVisible();
    }
 else {
      getAxisForProcessing().getLabel().setVisible(btnLabelVisible.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
    setStateOfLabel();
    Button btnAxisLabel=getToggleButton(BUTTON_LABEL);
    if (!(btnLabelVisible.getSelectionState() == ChartCheckbox.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() == ChartCheckbox.STATE_GRAYED) {
      getAxisForProcessing().unsetStaggered();
    }
 else {
      getAxisForProcessing().setStaggered(btnStaggered.getSelectionState() == ChartCheckbox.STATE_SELECTED);
    }
  }
}