Program: 102069
Project: 102069
Buggy source:
private void createDelimitedColumnInfoGroup(Composite parent){
  Group theGroup=WidgetFactory.createGroup(parent,getString("String_Node_Str"),SWT.NONE,2,4);
  GridData groupGD=new GridData(GridData.FILL_BOTH);
  groupGD.heightHint=140;
  theGroup.setLayoutData(groupGD);
  Table table=new Table(theGroup,SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayout(new TableLayout());
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  this.delimitedColumnsViewer=new TableViewer(table);
  GridData data=new GridData(GridData.FILL_BOTH);
  data.horizontalSpan=4;
  this.delimitedColumnsViewer.getControl().setLayoutData(data);
  TableViewerColumn column=new TableViewerColumn(this.delimitedColumnsViewer,SWT.LEFT);
  column.getColumn().setText(getString("String_Node_Str") + getSpaces(36));
  column.setEditingSupport(new ColumnNameEditingSupport(this.delimitedColumnsViewer));
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  column=new TableViewerColumn(this.delimitedColumnsViewer,SWT.LEFT);
  column.getColumn().setText(getString("String_Node_Str") + getSpaces(12));
  column.setLabelProvider(new ColumnDataLabelProvider(1));
  column.setEditingSupport(new DatatypeEditingSupport(this.delimitedColumnsViewer));
  column.getColumn().pack();
  if (this.dataFileInfo != null) {
    for (    ITeiidColumnInfo row : this.dataFileInfo.getColumnInfoList()) {
      this.delimitedColumnsViewer.add(row);
    }
  }
  addColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  addColumnDelimitedButton.setText(getString("String_Node_Str"));
  addColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  addColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      createColumn();
    }
  }
);
  deleteColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  deleteColumnDelimitedButton.setText(getString("String_Node_Str"));
  deleteColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  deleteColumnDelimitedButton.setEnabled(false);
  deleteColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ITeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(ITeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        dataFileInfo.removeColumn(info);
        handleInfoChanged(false);
        deleteColumnDelimitedButton.setEnabled(false);
      }
    }
  }
);
  upColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  upColumnDelimitedButton.setText(getString("String_Node_Str"));
  upColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  upColumnDelimitedButton.setEnabled(false);
  upColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(TeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=delimitedColumnsViewer.getTable().getSelectionIndex();
        dataFileInfo.moveColumnUp(info);
        handleInfoChanged(false);
        delimitedColumnsViewer.getTable().select(selectedIndex - 1);
        downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(info));
        upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(info));
      }
    }
  }
);
  downColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  downColumnDelimitedButton.setText(getString("String_Node_Str"));
  downColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downColumnDelimitedButton.setEnabled(false);
  downColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(TeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=delimitedColumnsViewer.getTable().getSelectionIndex();
        dataFileInfo.moveColumnDown(info);
        handleInfoChanged(false);
        delimitedColumnsViewer.getTable().select(selectedIndex + 1);
        downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(info));
        upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(info));
      }
    }
  }
);
  this.delimitedColumnsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)event.getSelection();
      if (sel.isEmpty()) {
        deleteColumnDelimitedButton.setEnabled(false);
        upColumnDelimitedButton.setEnabled(false);
        downColumnDelimitedButton.setEnabled(false);
      }
 else {
        boolean enable=true;
        Object[] objs=sel.toArray();
        ITeiidColumnInfo columnInfo=null;
        for (        Object obj : objs) {
          if (!(obj instanceof ITeiidColumnInfo)) {
            enable=false;
            break;
          }
 else {
            columnInfo=(ITeiidColumnInfo)obj;
          }
        }
        if (objs.length == 0) {
          enable=false;
        }
        deleteColumnDelimitedButton.setEnabled(enable);
        if (enable) {
          upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(columnInfo));
          downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(columnInfo));
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void createDelimitedColumnInfoGroup(Composite parent){
  Group theGroup=WidgetFactory.createGroup(parent,getString("String_Node_Str"),SWT.NONE,2,4);
  GridData groupGD=new GridData(GridData.FILL_BOTH);
  groupGD.heightHint=140;
  theGroup.setLayoutData(groupGD);
  this.delimitedColumnsViewer=new TableViewer(theGroup,SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL| SWT.V_SCROLL| SWT.BORDER);
  Table table=this.delimitedColumnsViewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayout(new TableLayout());
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  GridData data=new GridData(GridData.FILL_BOTH);
  data.horizontalSpan=4;
  this.delimitedColumnsViewer.getControl().setLayoutData(data);
  TableViewerColumn column=new TableViewerColumn(this.delimitedColumnsViewer,SWT.LEFT);
  column.getColumn().setText(getString("String_Node_Str") + getSpaces(36));
  column.setEditingSupport(new ColumnNameEditingSupport(this.delimitedColumnsViewer));
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  column=new TableViewerColumn(this.delimitedColumnsViewer,SWT.LEFT);
  column.getColumn().setText(getString("String_Node_Str") + getSpaces(12));
  column.setLabelProvider(new ColumnDataLabelProvider(1));
  column.setEditingSupport(new DatatypeEditingSupport(this.delimitedColumnsViewer));
  column.getColumn().pack();
  if (this.dataFileInfo != null) {
    for (    ITeiidColumnInfo row : this.dataFileInfo.getColumnInfoList()) {
      this.delimitedColumnsViewer.add(row);
    }
  }
  addColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  addColumnDelimitedButton.setText(getString("String_Node_Str"));
  addColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  addColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      createColumn();
    }
  }
);
  deleteColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  deleteColumnDelimitedButton.setText(getString("String_Node_Str"));
  deleteColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  deleteColumnDelimitedButton.setEnabled(false);
  deleteColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ITeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(ITeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        dataFileInfo.removeColumn(info);
        handleInfoChanged(false);
        deleteColumnDelimitedButton.setEnabled(false);
      }
    }
  }
);
  upColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  upColumnDelimitedButton.setText(getString("String_Node_Str"));
  upColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  upColumnDelimitedButton.setEnabled(false);
  upColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(TeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=delimitedColumnsViewer.getTable().getSelectionIndex();
        dataFileInfo.moveColumnUp(info);
        handleInfoChanged(false);
        delimitedColumnsViewer.getTable().select(selectedIndex - 1);
        downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(info));
        upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(info));
      }
    }
  }
);
  downColumnDelimitedButton=new Button(theGroup,SWT.PUSH);
  downColumnDelimitedButton.setText(getString("String_Node_Str"));
  downColumnDelimitedButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  downColumnDelimitedButton.setEnabled(false);
  downColumnDelimitedButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TeiidColumnInfo info=null;
      IStructuredSelection selection=(IStructuredSelection)delimitedColumnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof ITeiidColumnInfo) {
          info=(TeiidColumnInfo)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=delimitedColumnsViewer.getTable().getSelectionIndex();
        dataFileInfo.moveColumnDown(info);
        handleInfoChanged(false);
        delimitedColumnsViewer.getTable().select(selectedIndex + 1);
        downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(info));
        upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(info));
      }
    }
  }
);
  this.delimitedColumnsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)event.getSelection();
      if (sel.isEmpty()) {
        deleteColumnDelimitedButton.setEnabled(false);
        upColumnDelimitedButton.setEnabled(false);
        downColumnDelimitedButton.setEnabled(false);
      }
 else {
        boolean enable=true;
        Object[] objs=sel.toArray();
        ITeiidColumnInfo columnInfo=null;
        for (        Object obj : objs) {
          if (!(obj instanceof ITeiidColumnInfo)) {
            enable=false;
            break;
          }
 else {
            columnInfo=(ITeiidColumnInfo)obj;
          }
        }
        if (objs.length == 0) {
          enable=false;
        }
        deleteColumnDelimitedButton.setEnabled(enable);
        if (enable) {
          upColumnDelimitedButton.setEnabled(dataFileInfo.canMoveUp(columnInfo));
          downColumnDelimitedButton.setEnabled(dataFileInfo.canMoveDown(columnInfo));
        }
      }
    }
  }
);
}