Program: 67208
Project: 67208
Buggy source:
protected int addButtons(Composite cmp,final Table table){
  Listener[] listeners=getAggregationButton().getListeners(SWT.Selection);
  if (listeners.length > 0) {
    getAggregationButton().removeListener(SWT.Selection,listeners[0]);
  }
  getAggregationButton().addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      DataColumnBindingDialog dialog=new DataColumnBindingDialog(true);
      dialog.setInput(inputElement,null,context);
      dialog.setExpressionProvider(expressionProvider);
      dialog.setAggreate(true);
      if (dialog.open() == Dialog.OK) {
        if (bindingTable != null) {
          refreshBindingTable();
          bindingTable.getTable().setSelection(bindingTable.getTable().getItemCount() - 1);
        }
      }
      refreshBindingTable();
      if (table.getItemCount() > 0)       setSelectionInTable(table.getItemCount() - 1);
      updateButtons();
    }
  }
);
  btnRefresh=new Button(cmp,SWT.PUSH);
  btnRefresh.setText(Messages.getString("String_Node_Str"));
  GridData data=new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
  data.widthHint=Math.max(60,btnRefresh.computeSize(SWT.DEFAULT,SWT.DEFAULT,true).x);
  btnRefresh.setLayoutData(data);
  btnRefresh.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      try {
        List<ComputedColumn> columnList=new ArrayList<ComputedColumn>();
        CubeHandle cubeHandle=ChartCubeUtil.getBindingCube(inputElement);
        if (cubeHandle != null) {
          if (inputElement.getCube() == null) {
            refreshBindingTable();
          }
 else {
            List<LevelHandle> levels=ChartCubeUtil.getAllLevels(cubeHandle);
            for (Iterator<LevelHandle> iter=levels.iterator(); iter.hasNext(); ) {
              LevelHandle levelHandle=iter.next();
              ComputedColumn column=StructureFactory.newComputedColumn(inputElement,ChartCubeUtil.createLevelBindingName(levelHandle));
              column.setDataType(levelHandle.getDataType());
              column.setExpression(ChartCubeUtil.createDimensionExpression(levelHandle));
              columnList.add(column);
            }
            List<MeasureHandle> measures=ChartCubeUtil.getAllMeasures(cubeHandle);
            for (Iterator<MeasureHandle> iter=measures.iterator(); iter.hasNext(); ) {
              MeasureHandle measureHandle=iter.next();
              ComputedColumn column=StructureFactory.newComputedColumn(inputElement,ChartCubeUtil.createMeasureBindingName(measureHandle));
              column.setDataType(measureHandle.getDataType());
              column.setExpression(ExpressionUtil.createJSMeasureExpression(measureHandle.getName()));
              column.setAggregateFunction(measureHandle.getFunction());
              columnList.add(column);
            }
            if (columnList.size() > 0) {
              for (Iterator<ComputedColumn> iter=columnList.iterator(); iter.hasNext(); ) {
                DEUtil.addColumn(inputElement,iter.next(),false);
              }
            }
          }
        }
 else {
          DataSetHandle dataSetHandle=inputElement.getDataSet();
          if (dataSetHandle == null) {
            refreshBindingTable();
          }
 else {
            List resultSetColumnList=DataUtil.getColumnList(dataSetHandle);
            for (Iterator iterator=resultSetColumnList.iterator(); iterator.hasNext(); ) {
              ResultSetColumnHandle resultSetColumn=(ResultSetColumnHandle)iterator.next();
              ComputedColumn column=StructureFactory.newComputedColumn(inputElement,resultSetColumn.getColumnName());
              column.setDataType(resultSetColumn.getDataType());
              column.setExpression(DEUtil.getExpression(resultSetColumn));
              columnList.add(column);
            }
            if (columnList.size() > 0) {
              for (Iterator<ComputedColumn> iter=columnList.iterator(); iter.hasNext(); ) {
                DEUtil.addColumn(inputElement,iter.next(),false);
              }
            }
          }
        }
        bindingTable.setInput(inputElement);
      }
 catch (      SemanticException e) {
        WizardBase.displayException(e);
      }
    }
  }
);
  return 2;
}

Fixed version (ground truth):
protected int addButtons(Composite cmp,final Table table){
  Listener[] listeners=getAggregationButton().getListeners(SWT.Selection);
  if (listeners.length > 0) {
    getAggregationButton().removeListener(SWT.Selection,listeners[0]);
  }
  getAggregationButton().addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      DataColumnBindingDialog dialog=new DataColumnBindingDialog(true);
      dialog.setInput(inputElement,null,context);
      dialog.setExpressionProvider(expressionProvider);
      dialog.setAggreate(true);
      if (dialog.open() == Dialog.OK) {
        if (bindingTable != null) {
          refreshBindingTable();
          bindingTable.getTable().setSelection(bindingTable.getTable().getItemCount() - 1);
        }
      }
      refreshBindingTable();
      if (table.getItemCount() > 0)       setSelectionInTable(table.getItemCount() - 1);
      updateButtons();
    }
  }
);
  btnRefresh=new Button(cmp,SWT.PUSH);
  btnRefresh.setText(Messages.getString("String_Node_Str"));
  GridData data=new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
  data.widthHint=Math.max(60,btnRefresh.computeSize(SWT.DEFAULT,SWT.DEFAULT,true).x);
  btnRefresh.setLayoutData(data);
  btnRefresh.addListener(SWT.Selection,new Listener(){
    public void handleEvent(    Event event){
      try {
        List<ComputedColumn> columnList=new ArrayList<ComputedColumn>();
        CubeHandle cubeHandle=ChartCubeUtil.getBindingCube(inputElement);
        if (cubeHandle != null) {
          if (inputElement.getCube() == null) {
            refreshBindingTable();
          }
 else {
            inputElement.getColumnBindings().clearValue();
            columnList=ChartXTabUIUtil.generateComputedColumns((ExtendedItemHandle)inputElement,cubeHandle);
            if (columnList.size() > 0) {
              for (Iterator<ComputedColumn> iter=columnList.iterator(); iter.hasNext(); ) {
                DEUtil.addColumn(inputElement,iter.next(),false);
              }
            }
          }
        }
 else {
          DataSetHandle dataSetHandle=inputElement.getDataSet();
          if (dataSetHandle == null) {
            refreshBindingTable();
          }
 else {
            List resultSetColumnList=DataUtil.getColumnList(dataSetHandle);
            for (Iterator iterator=resultSetColumnList.iterator(); iterator.hasNext(); ) {
              ResultSetColumnHandle resultSetColumn=(ResultSetColumnHandle)iterator.next();
              ComputedColumn column=StructureFactory.newComputedColumn(inputElement,resultSetColumn.getColumnName());
              column.setDataType(resultSetColumn.getDataType());
              column.setExpression(DEUtil.getExpression(resultSetColumn));
              columnList.add(column);
            }
            if (columnList.size() > 0) {
              for (Iterator<ComputedColumn> iter=columnList.iterator(); iter.hasNext(); ) {
                DEUtil.addColumn(inputElement,iter.next(),false);
              }
            }
          }
        }
        bindingTable.setInput(inputElement);
      }
 catch (      SemanticException e) {
        WizardBase.displayException(e);
      }
    }
  }
);
  return 2;
}