Program: 76257
Project: 76257
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (e.getSource().equals(btnUseReportData)) {
    ColorPalette.getInstance().restore();
    if (!btnUseReportData.getSelection()) {
      return;
    }
    boolean bException=false;
    try {
      switchDataSet(null);
    }
 catch (    ChartException e1) {
      bException=true;
      ChartWizard.showException(e1.getLocalizedMessage());
    }
    if (!bException) {
      WizardBase.removeException();
    }
    cmbDataSet.add(BLANK_DATASET,0);
    cmbDataSet.select(0);
    cmbDataSet.setEnabled(false);
    btnNewData.setEnabled(false);
    btnFilters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnParameters.setEnabled(false);
    btnBinding.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnFilters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnBinding.setVisible(getDataServiceProvider().isEclipseModeSupported());
  }
 else   if (e.getSource().equals(btnUseDataSet)) {
    if (!btnUseDataSet.getSelection()) {
      return;
    }
    WizardBase.removeException();
    cmbDataSet.removeAll();
    cmbDataSet.add(BLANK_DATASET,0);
    String[] dataSets=getDataServiceProvider().getAllDataSets();
    if (dataSets != null)     for (int i=0; i < dataSets.length; i++) {
      cmbDataSet.add(dataSets[i],i + 1);
    }
    cmbDataSet.select(0);
    cmbDataSet.setEnabled(true);
    btnNewData.setEnabled(getDataServiceProvider().isInvokingSupported());
    btnNewData.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
  }
 else   if (e.getSource().equals(cmbDataSet)) {
    boolean bException=false;
    try {
      ColorPalette.getInstance().restore();
      if (!cmbDataSet.getText().equals(BLANK_DATASET)) {
        int bCancel=switchDataSet(cmbDataSet.getText());
        if (bCancel == Window.OK && cmbDataSet.getItem(0).equals(BLANK_DATASET)) {
          cmbDataSet.remove(BLANK_DATASET);
        }
 else         if (bCancel == Window.CANCEL) {
          String[] datasetNames=cmbDataSet.getItems();
          for (int i=0; i < datasetNames.length; i++) {
            if (datasetNames[i].equals(getDataServiceProvider().getBoundDataSet())) {
              cmbDataSet.select(i);
              if (cmbDataSet.getItem(0).equals(BLANK_DATASET)) {
                cmbDataSet.remove(BLANK_DATASET);
              }
              return;
            }
          }
          cmbDataSet.select(0);
        }
      }
    }
 catch (    ChartException e1) {
      bException=true;
      ChartWizard.displayException(e1);
    }
    if (!bException) {
      WizardBase.removeException();
    }
    btnNewData.setEnabled(getDataServiceProvider().isInvokingSupported());
    btnFilters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnParameters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnBinding.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnFilters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnBinding.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnNewData.setVisible(getDataServiceProvider().isEclipseModeSupported());
  }
 else   if (e.getSource().equals(btnNewData)) {
    int result=getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_NEW_DATASET);
    if (result == Window.CANCEL) {
      return;
    }
    String[] sAllDS=getDataServiceProvider().getAllDataSets();
    String currentDataSet=cmbDataSet.getText();
    int dataSetCount=cmbDataSet.getItemCount();
    if (currentDataSet.equals(BLANK_DATASET)) {
      dataSetCount=dataSetCount - 1;
    }
    if (sAllDS.length == dataSetCount) {
      return;
    }
    if (currentDataSet.equals(BLANK_DATASET)) {
      cmbDataSet.removeAll();
      cmbDataSet.add(BLANK_DATASET,0);
      for (int i=0; i < sAllDS.length; i++) {
        cmbDataSet.add(sAllDS[i],i + 1);
      }
    }
 else {
      cmbDataSet.setItems(sAllDS);
    }
    cmbDataSet.setText(currentDataSet);
  }
 else   if (e.getSource().equals(btnFilters)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_FILTER) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource().equals(btnParameters)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_PARAMETER) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource().equals(btnBinding)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_BINDING) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource() instanceof MenuItem) {
    MenuItem item=(MenuItem)e.getSource();
    IAction action=(IAction)item.getData();
    action.setChecked(!action.isChecked());
    action.run();
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (e.getSource().equals(btnUseReportData)) {
    ColorPalette.getInstance().restore();
    if (!btnUseReportData.getSelection()) {
      return;
    }
    boolean bException=false;
    try {
      switchDataSet(null);
    }
 catch (    ChartException e1) {
      bException=true;
      ChartWizard.showException(e1.getLocalizedMessage());
    }
    if (!bException) {
      WizardBase.removeException();
    }
    cmbDataSet.add(BLANK_DATASET,0);
    cmbDataSet.select(0);
    cmbDataSet.setEnabled(false);
    btnNewData.setEnabled(false);
    btnFilters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnParameters.setEnabled(false);
    btnBinding.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnFilters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnBinding.setVisible(getDataServiceProvider().isEclipseModeSupported());
  }
 else   if (e.getSource().equals(btnUseDataSet)) {
    if (!btnUseDataSet.getSelection()) {
      return;
    }
    WizardBase.removeException();
    cmbDataSet.removeAll();
    cmbDataSet.add(BLANK_DATASET,0);
    String[] dataSets=getDataServiceProvider().getAllDataSets();
    if (dataSets != null)     for (int i=0; i < dataSets.length; i++) {
      cmbDataSet.add(dataSets[i],i + 1);
    }
    cmbDataSet.select(0);
    cmbDataSet.setEnabled(true);
    btnNewData.setEnabled(getDataServiceProvider().isInvokingSupported());
    btnNewData.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setEnabled(getDataServiceProvider().getBoundDataSet() != null && getDataServiceProvider().isInvokingSupported());
  }
 else   if (e.getSource().equals(cmbDataSet)) {
    boolean bException=false;
    try {
      ColorPalette.getInstance().restore();
      if (!cmbDataSet.getText().equals(BLANK_DATASET)) {
        int bCancel=switchDataSet(cmbDataSet.getText());
        if (bCancel == Window.OK && cmbDataSet.getItem(0).equals(BLANK_DATASET)) {
          cmbDataSet.remove(BLANK_DATASET);
        }
 else         if (bCancel == Window.CANCEL) {
          String[] datasetNames=cmbDataSet.getItems();
          for (int i=0; i < datasetNames.length; i++) {
            if (datasetNames[i].equals(getDataServiceProvider().getBoundDataSet())) {
              cmbDataSet.select(i);
              if (cmbDataSet.getItem(0).equals(BLANK_DATASET)) {
                cmbDataSet.remove(BLANK_DATASET);
              }
              return;
            }
          }
          cmbDataSet.select(0);
        }
      }
    }
 catch (    ChartException e1) {
      bException=true;
      ChartWizard.displayException(e1);
    }
    if (!bException) {
      WizardBase.removeException();
    }
    btnNewData.setEnabled(getDataServiceProvider().isInvokingSupported());
    btnFilters.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnParameters.setEnabled(getDataServiceProvider().getBoundDataSet() != null && getDataServiceProvider().isInvokingSupported());
    btnBinding.setEnabled(hasDataSet() && getDataServiceProvider().isInvokingSupported());
    btnFilters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnParameters.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnBinding.setVisible(getDataServiceProvider().isEclipseModeSupported());
    btnNewData.setVisible(getDataServiceProvider().isEclipseModeSupported());
  }
 else   if (e.getSource().equals(btnNewData)) {
    int result=getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_NEW_DATASET);
    if (result == Window.CANCEL) {
      return;
    }
    String[] sAllDS=getDataServiceProvider().getAllDataSets();
    String currentDataSet=cmbDataSet.getText();
    int dataSetCount=cmbDataSet.getItemCount();
    if (currentDataSet.equals(BLANK_DATASET)) {
      dataSetCount=dataSetCount - 1;
    }
    if (sAllDS.length == dataSetCount) {
      return;
    }
    if (currentDataSet.equals(BLANK_DATASET)) {
      cmbDataSet.removeAll();
      cmbDataSet.add(BLANK_DATASET,0);
      for (int i=0; i < sAllDS.length; i++) {
        cmbDataSet.add(sAllDS[i],i + 1);
      }
    }
 else {
      cmbDataSet.setItems(sAllDS);
    }
    cmbDataSet.setText(currentDataSet);
  }
 else   if (e.getSource().equals(btnFilters)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_FILTER) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource().equals(btnParameters)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_PARAMETER) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource().equals(btnBinding)) {
    if (getDataServiceProvider().invoke(IDataServiceProvider.COMMAND_EDIT_BINDING) == Window.OK) {
      refreshTablePreview();
      doLivePreview();
      updateApplyButton();
    }
  }
 else   if (e.getSource() instanceof MenuItem) {
    MenuItem item=(MenuItem)e.getSource();
    IAction action=(IAction)item.getData();
    action.setChecked(!action.isChecked());
    action.run();
  }
}