Program: 72602
Project: 72602
Buggy source:
public void widgetSelected(SelectionEvent e){
  boolean needUpdateModel=false;
  Object oSelected=e.getSource();
  if (oSelected.getClass().equals(Button.class)) {
    needUpdateModel=true;
    if (oSelected.equals(cbOrientation)) {
      if (cbOrientation.getSelection()) {
        orientation=Orientation.HORIZONTAL_LITERAL;
      }
 else {
        orientation=Orientation.VERTICAL_LITERAL;
      }
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      populateSeriesTypesList();
      ChartCacheManager.getInstance().cacheOrientation(sType,orientation);
    }
 else {
      Button btn=(Button)e.getSource();
      if (btn.getSelection()) {
        if (this.sSubType != null && !getSubtypeFromButton(btn).equals(sSubType)) {
          int iTypeIndex=vSubTypeNames.indexOf(sSubType);
          if (iTypeIndex >= 0) {
            ((Button)cmpTypeButtons.getChildren()[iTypeIndex]).setSelection(false);
            cmpTypeButtons.redraw();
          }
        }
        ChartUIUtil.saveLabelPositionIntoCache(getSeriesDefinitionForProcessing());
        sSubType=getSubtypeFromButton(btn);
        ChartCacheManager.getInstance().cacheSubtype(sType,sSubType);
      }
 else {
        if (this.sSubType != null && getSubtypeFromButton(btn).equals(sSubType)) {
          btn.setSelection(true);
        }
      }
    }
  }
 else   if (oSelected.getClass().equals(Table.class)) {
    sType=((String)((TableItem)e.item).getData()).trim();
    if (!sOldType.equals(sType)) {
      sOldType=sType;
      if (!getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART)) {
        if (chartModel != null && chartModel instanceof ChartWithAxes) {
          Orientation lastOrientation=ChartCacheManager.getInstance().findOrientation(sType);
          if (lastOrientation != null && this.orientation != lastOrientation) {
            this.orientation=lastOrientation;
            this.rotateAxisTitle((ChartWithAxes)chartModel);
          }
          if (lastOrientation == null) {
            this.orientation=htTypes.get(sType).getDefaultOrientation();
          }
        }
      }
      if (chartModel != null && chartModel instanceof ChartWithAxes && ChartCacheManager.getInstance().findCategory(sType) != null) {
        boolean bCategory=ChartCacheManager.getInstance().findCategory(sType).booleanValue();
        ((Axis)((ChartWithAxes)chartModel).getAxes().get(0)).setCategoryAxis(bCategory);
      }
      sSubType=null;
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      cmpMisc.layout();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbMultipleY)) {
    needUpdateModel=true;
    lblSeriesType.setEnabled(isTwoAxesEnabled());
    Axis xAxis=((Axis)((ChartWithAxes)chartModel).getAxes().get(0));
    ((ChartWizardContext)getContext()).setMoreAxesSupported(cbMultipleY.getSelectionIndex() == 2);
    if (chartModel instanceof ChartWithoutAxes) {
      throw new IllegalArgumentException(Messages.getString("String_Node_Str"));
    }
    ChartAdapter.beginIgnoreNotifications();
    int iAxisNumber=ChartUIUtil.getOrthogonalAxisNumber(chartModel);
    if (cbMultipleY.getSelectionIndex() == 0) {
      if (iAxisNumber > 1) {
        ChartUIUtil.removeLastAxes((ChartWithAxes)chartModel,iAxisNumber - 1);
      }
    }
 else     if (cbMultipleY.getSelectionIndex() == 1) {
      if (iAxisNumber == 1) {
        ChartUIUtil.addAxis((ChartWithAxes)chartModel);
      }
 else       if (iAxisNumber > 2) {
        ChartUIUtil.removeLastAxes((ChartWithAxes)chartModel,iAxisNumber - 2);
      }
    }
    ChartAdapter.endIgnoreNotifications();
    if (xAxis.getAssociatedAxes().size() > 1) {
      String lastSeriesType=ChartCacheManager.getInstance().findSeriesType();
      if (lastSeriesType != null) {
        cbSeriesType.setText(lastSeriesType);
      }
 else {
        Axis overlayAxis=(Axis)xAxis.getAssociatedAxes().get(1);
        String sDisplayName=((SeriesDefinition)overlayAxis.getSeriesDefinitions().get(0)).getDesignTimeSeries().getDisplayName();
        cbSeriesType.setText(sDisplayName);
      }
      changeOverlaySeriesType();
    }
    cbSeriesType.setEnabled(isTwoAxesEnabled());
    if (updateDimensionCombo(sType)) {
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
    }
    cmpMisc.layout();
  }
 else   if (oSelected.equals(cbDimension)) {
    String newDimension=cbDimension.getItem(cbDimension.getSelectionIndex());
    if (!newDimension.equals(sDimension)) {
      sDimension=newDimension;
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbSeriesType)) {
    needUpdateModel=true;
    changeOverlaySeriesType();
  }
 else   if (oSelected.equals(cbOutput)) {
    ((ChartWizardContext)getContext()).setOutputFormat(cbOutput.getText());
    if (container != null && container instanceof ChartWizard) {
      ((ChartWizard)container).updateApplayButton();
    }
  }
  if (needUpdateModel) {
    ChartAdapter.notifyUpdateApply();
    refreshChart();
    doPreview();
    if (oSelected.getClass().equals(Table.class)) {
      populateSeriesTypesList();
    }
 else     if (oSelected.equals(cbOrientation)) {
      if (chartModel instanceof ChartWithAxes) {
        rotateAxisTitle((ChartWithAxes)chartModel);
      }
    }
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  boolean needUpdateModel=false;
  Object oSelected=e.getSource();
  if (oSelected.getClass().equals(Button.class)) {
    needUpdateModel=true;
    if (oSelected.equals(cbOrientation)) {
      if (cbOrientation.getSelection()) {
        orientation=Orientation.HORIZONTAL_LITERAL;
      }
 else {
        orientation=Orientation.VERTICAL_LITERAL;
      }
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      populateSeriesTypesList(true);
      ChartCacheManager.getInstance().cacheOrientation(sType,orientation);
    }
 else {
      Button btn=(Button)e.getSource();
      if (btn.getSelection()) {
        if (this.sSubType != null && !getSubtypeFromButton(btn).equals(sSubType)) {
          int iTypeIndex=vSubTypeNames.indexOf(sSubType);
          if (iTypeIndex >= 0) {
            ((Button)cmpTypeButtons.getChildren()[iTypeIndex]).setSelection(false);
            cmpTypeButtons.redraw();
          }
        }
        ChartUIUtil.saveLabelPositionIntoCache(getSeriesDefinitionForProcessing());
        sSubType=getSubtypeFromButton(btn);
        ChartCacheManager.getInstance().cacheSubtype(sType,sSubType);
      }
 else {
        if (this.sSubType != null && getSubtypeFromButton(btn).equals(sSubType)) {
          btn.setSelection(true);
        }
      }
    }
  }
 else   if (oSelected.getClass().equals(Table.class)) {
    sType=((String)((TableItem)e.item).getData()).trim();
    if (!sOldType.equals(sType)) {
      sOldType=sType;
      if (!getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART)) {
        if (chartModel != null && chartModel instanceof ChartWithAxes) {
          Orientation lastOrientation=ChartCacheManager.getInstance().findOrientation(sType);
          if (lastOrientation != null && this.orientation != lastOrientation) {
            this.orientation=lastOrientation;
            this.rotateAxisTitle((ChartWithAxes)chartModel);
          }
          if (lastOrientation == null) {
            this.orientation=htTypes.get(sType).getDefaultOrientation();
          }
        }
      }
      if (chartModel != null && chartModel instanceof ChartWithAxes && ChartCacheManager.getInstance().findCategory(sType) != null) {
        boolean bCategory=ChartCacheManager.getInstance().findCategory(sType).booleanValue();
        ((Axis)((ChartWithAxes)chartModel).getAxes().get(0)).setCategoryAxis(bCategory);
      }
      sSubType=null;
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      cmpMisc.layout();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbMultipleY)) {
    needUpdateModel=true;
    lblSeriesType.setEnabled(isTwoAxesEnabled());
    Axis xAxis=((Axis)((ChartWithAxes)chartModel).getAxes().get(0));
    ((ChartWizardContext)getContext()).setMoreAxesSupported(cbMultipleY.getSelectionIndex() == 2);
    if (chartModel instanceof ChartWithoutAxes) {
      throw new IllegalArgumentException(Messages.getString("String_Node_Str"));
    }
    ChartAdapter.beginIgnoreNotifications();
    int iAxisNumber=ChartUIUtil.getOrthogonalAxisNumber(chartModel);
    if (cbMultipleY.getSelectionIndex() == 0) {
      if (iAxisNumber > 1) {
        ChartUIUtil.removeLastAxes((ChartWithAxes)chartModel,iAxisNumber - 1);
      }
    }
 else     if (cbMultipleY.getSelectionIndex() == 1) {
      if (iAxisNumber == 1) {
        ChartUIUtil.addAxis((ChartWithAxes)chartModel);
      }
 else       if (iAxisNumber > 2) {
        ChartUIUtil.removeLastAxes((ChartWithAxes)chartModel,iAxisNumber - 2);
      }
    }
    ChartAdapter.endIgnoreNotifications();
    if (xAxis.getAssociatedAxes().size() > 1) {
      String lastSeriesType=ChartCacheManager.getInstance().findSeriesType();
      if (lastSeriesType != null) {
        cbSeriesType.setText(lastSeriesType);
      }
 else {
        Axis overlayAxis=(Axis)xAxis.getAssociatedAxes().get(1);
        String sDisplayName=((SeriesDefinition)overlayAxis.getSeriesDefinitions().get(0)).getDesignTimeSeries().getDisplayName();
        cbSeriesType.setText(sDisplayName);
      }
      changeOverlaySeriesType();
    }
    cbSeriesType.setEnabled(isTwoAxesEnabled());
    if (updateDimensionCombo(sType)) {
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
    }
    cmpMisc.layout();
  }
 else   if (oSelected.equals(cbDimension)) {
    String newDimension=cbDimension.getItem(cbDimension.getSelectionIndex());
    if (!newDimension.equals(sDimension)) {
      sDimension=newDimension;
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbSeriesType)) {
    needUpdateModel=true;
    changeOverlaySeriesType();
  }
 else   if (oSelected.equals(cbOutput)) {
    ((ChartWizardContext)getContext()).setOutputFormat(cbOutput.getText());
    if (container != null && container instanceof ChartWizard) {
      ((ChartWizard)container).updateApplayButton();
    }
  }
  if (needUpdateModel) {
    ChartAdapter.notifyUpdateApply();
    refreshChart();
    doPreview();
    if (oSelected.getClass().equals(Table.class)) {
      populateSeriesTypesList(true);
    }
 else     if (oSelected.equals(cbOrientation)) {
      if (chartModel instanceof ChartWithAxes) {
        rotateAxisTitle((ChartWithAxes)chartModel);
      }
    }
  }
}