Program: 67128
Project: 67128
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) {
            Orientation currentOrientation=this.orientation;
            this.orientation=ChartUIUtil.getChartType(sType).getDefaultOrientation();
            if (currentOrientation != this.orientation) {
              this.rotateAxisTitle((ChartWithAxes)chartModel);
            }
          }
        }
      }
      if (chartModel != null && chartModel instanceof ChartWithAxes && ChartCacheManager.getInstance().findCategory(sType) != null) {
        boolean bCategory=ChartCacheManager.getInstance().findCategory(sType).booleanValue();
        ((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=((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) {
      ChartCacheManager.getInstance().cacheSeriesType(null);
      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=xAxis.getAssociatedAxes().get(1);
        String sDisplayName=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;
      ChartCacheManager.getInstance().cacheDimension(sType,sDimension);
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      populateSeriesTypesList();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbSeriesType)) {
    needUpdateModel=true;
    changeOverlaySeriesType();
    updateDimensionCombo(sType);
  }
  if (needUpdateModel) {
    ChartAdapter.notifyUpdateApply();
    refreshChart();
    if (oSelected.getClass().equals(Table.class)) {
      populateSeriesTypesList();
    }
 else     if (oSelected.equals(cbOrientation)) {
      if (chartModel instanceof ChartWithAxes) {
        rotateAxisTitle((ChartWithAxes)chartModel);
      }
    }
    doPreview();
  }
}

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();
      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) {
            Orientation currentOrientation=this.orientation;
            this.orientation=ChartUIUtil.getChartType(sType).getDefaultOrientation();
            if (currentOrientation != this.orientation) {
              this.rotateAxisTitle((ChartWithAxes)chartModel);
            }
          }
        }
      }
      if (chartModel != null && chartModel instanceof ChartWithAxes && ChartCacheManager.getInstance().findCategory(sType) != null) {
        boolean bCategory=ChartCacheManager.getInstance().findCategory(sType).booleanValue();
        ((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=((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) {
      ChartCacheManager.getInstance().cacheSeriesType(null);
      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=xAxis.getAssociatedAxes().get(1);
        String sDisplayName=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=((String[])cbDimension.getData())[cbDimension.getSelectionIndex()];
    if (!newDimension.equals(sDimension)) {
      sDimension=newDimension;
      ChartCacheManager.getInstance().cacheDimension(sType,sDimension);
      createAndDisplayTypesSheet(sType);
      setDefaultSubtypeSelection();
      populateSeriesTypesList();
      needUpdateModel=true;
    }
  }
 else   if (oSelected.equals(cbSeriesType)) {
    needUpdateModel=true;
    changeOverlaySeriesType();
    updateDimensionCombo(sType);
  }
  if (needUpdateModel) {
    ChartAdapter.notifyUpdateApply();
    refreshChart();
    if (oSelected.getClass().equals(Table.class)) {
      populateSeriesTypesList();
    }
 else     if (oSelected.equals(cbOrientation)) {
      if (chartModel instanceof ChartWithAxes) {
        rotateAxisTitle((ChartWithAxes)chartModel);
      }
    }
    doPreview();
  }
}