Program: 102075
Project: 102075
Buggy source:
private Composite createColumnTableGroup(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,1);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  Composite buttonPanel=WidgetFactory.createPanel(thePanel,SWT.NONE,1,4);
  GridLayoutFactory.fillDefaults().numColumns(4).applyTo(buttonPanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(buttonPanel);
  addColumnButton=new Button(buttonPanel,SWT.PUSH);
  addColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.ADD));
  GridDataFactory.fillDefaults().applyTo(addColumnButton);
  addColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      getRelationalReference().createColumn();
      handleInfoChanged();
    }
  }
);
  deleteColumnButton=new Button(buttonPanel,SWT.PUSH);
  deleteColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DELETE));
  GridDataFactory.fillDefaults().applyTo(deleteColumnButton);
  deleteColumnButton.setEnabled(false);
  deleteColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn column=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          column=(RelationalColumn)obj;
          break;
        }
      }
      if (column != null) {
        getRelationalReference().removeColumn(column);
        deleteColumnButton.setEnabled(false);
        handleInfoChanged();
      }
    }
  }
);
  upColumnButton=new Button(buttonPanel,SWT.PUSH);
  upColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.MOVE_UP));
  GridDataFactory.fillDefaults().applyTo(upColumnButton);
  upColumnButton.setEnabled(false);
  upColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn info=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          info=(RelationalColumn)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=columnsViewer.getTable().getSelectionIndex();
        getRelationalReference().moveColumnUp(info);
        handleInfoChanged();
        columnsViewer.getTable().select(selectedIndex - 1);
        downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(info));
        upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(info));
      }
    }
  }
);
  downColumnButton=new Button(buttonPanel,SWT.PUSH);
  downColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.MOVE_DOWN));
  GridDataFactory.fillDefaults().applyTo(downColumnButton);
  downColumnButton.setEnabled(false);
  downColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn info=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          info=(RelationalColumn)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=columnsViewer.getTable().getSelectionIndex();
        getRelationalReference().moveColumnDown(info);
        handleInfoChanged();
        columnsViewer.getTable().select(selectedIndex + 1);
        downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(info));
        upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(info));
      }
    }
  }
);
  Table columnTable=new Table(thePanel,SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER);
  columnTable.setHeaderVisible(true);
  columnTable.setLinesVisible(true);
  columnTable.setLayout(new TableLayout());
  this.columnsViewer=new TableViewer(columnTable);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(columnsViewer.getControl());
  TableViewerColumn column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.columnNameLabel + "String_Node_Str");
  column.setEditingSupport(new ColumnNameEditingSupport(this.columnsViewer));
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.dataTypeLabel + "String_Node_Str");
  column.setLabelProvider(new ColumnDataLabelProvider(1));
  column.setEditingSupport(new DatatypeEditingSupport(this.columnsViewer));
  column.getColumn().pack();
  column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.lengthLabel);
  column.setLabelProvider(new ColumnDataLabelProvider(2));
  column.setEditingSupport(new ColumnWidthEditingSupport(this.columnsViewer));
  column.getColumn().pack();
  if (getRelationalReference() != null) {
    for (    RelationalColumn row : this.getRelationalReference().getColumns()) {
      this.columnsViewer.add(row);
    }
  }
  this.columnsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)event.getSelection();
      if (sel.isEmpty()) {
        deleteColumnButton.setEnabled(false);
        upColumnButton.setEnabled(false);
        downColumnButton.setEnabled(false);
      }
 else {
        boolean enable=true;
        Object[] objs=sel.toArray();
        RelationalColumn columnInfo=null;
        for (        Object obj : objs) {
          if (!(obj instanceof RelationalColumn)) {
            enable=false;
            break;
          }
 else {
            columnInfo=(RelationalColumn)obj;
          }
        }
        if (objs.length == 0) {
          enable=false;
        }
        deleteColumnButton.setEnabled(enable);
        if (enable) {
          upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(columnInfo));
          downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(columnInfo));
        }
      }
    }
  }
);
  return thePanel;
}

Fixed version (ground truth):
private Composite createColumnTableGroup(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,1);
  GridLayoutFactory.fillDefaults().margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  Composite buttonPanel=WidgetFactory.createPanel(thePanel,SWT.NONE,1,4);
  GridLayoutFactory.fillDefaults().numColumns(4).applyTo(buttonPanel);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(buttonPanel);
  addColumnButton=new Button(buttonPanel,SWT.PUSH);
  addColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.ADD));
  GridDataFactory.fillDefaults().applyTo(addColumnButton);
  addColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      getRelationalReference().createColumn();
      handleInfoChanged();
    }
  }
);
  deleteColumnButton=new Button(buttonPanel,SWT.PUSH);
  deleteColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DELETE));
  GridDataFactory.fillDefaults().applyTo(deleteColumnButton);
  deleteColumnButton.setEnabled(false);
  deleteColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn column=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          column=(RelationalColumn)obj;
          break;
        }
      }
      if (column != null) {
        getRelationalReference().removeColumn(column);
        deleteColumnButton.setEnabled(false);
        handleInfoChanged();
      }
    }
  }
);
  upColumnButton=new Button(buttonPanel,SWT.PUSH);
  upColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.MOVE_UP));
  GridDataFactory.fillDefaults().applyTo(upColumnButton);
  upColumnButton.setEnabled(false);
  upColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn info=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          info=(RelationalColumn)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=columnsViewer.getTable().getSelectionIndex();
        getRelationalReference().moveColumnUp(info);
        handleInfoChanged();
        columnsViewer.getTable().select(selectedIndex - 1);
        downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(info));
        upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(info));
      }
    }
  }
);
  downColumnButton=new Button(buttonPanel,SWT.PUSH);
  downColumnButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.MOVE_DOWN));
  GridDataFactory.fillDefaults().applyTo(downColumnButton);
  downColumnButton.setEnabled(false);
  downColumnButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      RelationalColumn info=null;
      IStructuredSelection selection=(IStructuredSelection)columnsViewer.getSelection();
      for (      Object obj : selection.toArray()) {
        if (obj instanceof RelationalColumn) {
          info=(RelationalColumn)obj;
          break;
        }
      }
      if (info != null) {
        int selectedIndex=columnsViewer.getTable().getSelectionIndex();
        getRelationalReference().moveColumnDown(info);
        handleInfoChanged();
        columnsViewer.getTable().select(selectedIndex + 1);
        downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(info));
        upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(info));
      }
    }
  }
);
  this.columnsViewer=new TableViewer(thePanel,SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL| SWT.V_SCROLL| SWT.BORDER);
  Table columnTable=this.columnsViewer.getTable();
  columnTable.setHeaderVisible(true);
  columnTable.setLinesVisible(true);
  columnTable.setLayout(new TableLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(columnsViewer.getControl());
  TableViewerColumn column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.columnNameLabel + "String_Node_Str");
  column.setEditingSupport(new ColumnNameEditingSupport(this.columnsViewer));
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.dataTypeLabel + "String_Node_Str");
  column.setLabelProvider(new ColumnDataLabelProvider(1));
  column.setEditingSupport(new DatatypeEditingSupport(this.columnsViewer));
  column.getColumn().pack();
  column=new TableViewerColumn(this.columnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.lengthLabel);
  column.setLabelProvider(new ColumnDataLabelProvider(2));
  column.setEditingSupport(new ColumnWidthEditingSupport(this.columnsViewer));
  column.getColumn().pack();
  if (getRelationalReference() != null) {
    for (    RelationalColumn row : this.getRelationalReference().getColumns()) {
      this.columnsViewer.add(row);
    }
  }
  this.columnsViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      IStructuredSelection sel=(IStructuredSelection)event.getSelection();
      if (sel.isEmpty()) {
        deleteColumnButton.setEnabled(false);
        upColumnButton.setEnabled(false);
        downColumnButton.setEnabled(false);
      }
 else {
        boolean enable=true;
        Object[] objs=sel.toArray();
        RelationalColumn columnInfo=null;
        for (        Object obj : objs) {
          if (!(obj instanceof RelationalColumn)) {
            enable=false;
            break;
          }
 else {
            columnInfo=(RelationalColumn)obj;
          }
        }
        if (objs.length == 0) {
          enable=false;
        }
        deleteColumnButton.setEnabled(enable);
        if (enable) {
          upColumnButton.setEnabled(getRelationalReference().canMoveColumnUp(columnInfo));
          downColumnButton.setEnabled(getRelationalReference().canMoveColumnDown(columnInfo));
        }
      }
    }
  }
);
  return thePanel;
}