Program: 102120
Project: 102120
Buggy source:
private Composite createPrimaryKeyPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,2);
  GridLayoutFactory.fillDefaults().numColumns(2).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  if (isRelationalView()) {
    Text pkHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
    pkHelpText.setBackground(parent.getBackground());
    pkHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,100).span(2,1).applyTo(pkHelpText);
    pkHelpText.setText(Messages.primaryKeysNotSupportedForViews);
  }
  this.includePrimaryKeyCB=new Button(thePanel,SWT.CHECK | SWT.RIGHT);
  GridDataFactory.fillDefaults().align(SWT.LEFT,SWT.CENTER).span(2,1).applyTo(this.includePrimaryKeyCB);
  this.includePrimaryKeyCB.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.INCLUDE));
  this.includePrimaryKeyCB.addSelectionListener(new SelectionAdapter(){
    /** 
 * {@inheritDoc}
 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
    @Override public void widgetSelected(    SelectionEvent e){
      if (includePrimaryKeyCB.getSelection()) {
        if (getRelationalReference().getPrimaryKey() == null) {
          RelationalPrimaryKey key=new RelationalPrimaryKey();
          if (primaryKeyNameText.getText() != null) {
            key.setName(primaryKeyNameText.getText());
          }
          getRelationalReference().setPrimaryKey(key);
        }
      }
 else {
        getRelationalReference().setPrimaryKey(null);
      }
      handleInfoChanged();
    }
  }
);
  Label label=new Label(thePanel,SWT.NONE | SWT.RIGHT);
  label.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.NAME));
  GridDataFactory.fillDefaults().applyTo(label);
  this.primaryKeyNameText=new Text(thePanel,SWT.BORDER | SWT.SINGLE);
  this.primaryKeyNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().applyTo(this.primaryKeyNameText);
  this.primaryKeyNameText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent event){
      String value=primaryKeyNameText.getText();
      if (value == null) {
        value=EMPTY_STRING;
      }
      if (getRelationalReference().getPrimaryKey() != null) {
        RelationalPrimaryKey key=getRelationalReference().getPrimaryKey();
        key.setName(value);
      }
      handleInfoChanged();
    }
  }
);
  label=new Label(thePanel,SWT.NONE | SWT.RIGHT);
  label.setText(Messages.nameInSourceLabel);
  GridDataFactory.fillDefaults().applyTo(label);
  this.primaryKeyNISText=new Text(thePanel,SWT.BORDER | SWT.SINGLE);
  this.primaryKeyNISText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().applyTo(this.primaryKeyNISText);
  this.primaryKeyNISText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent event){
      String value=primaryKeyNISText.getText();
      if (value == null) {
        value=EMPTY_STRING;
      }
      if (getRelationalReference().getPrimaryKey() != null) {
        RelationalPrimaryKey key=getRelationalReference().getPrimaryKey();
        key.setNameInSource(value);
      }
      handleInfoChanged();
    }
  }
);
  Composite buttonPanel=new Composite(thePanel,SWT.NONE);
  GridLayoutFactory.fillDefaults().applyTo(buttonPanel);
  GridDataFactory.fillDefaults().align(SWT.LEFT,SWT.BEGINNING).applyTo(buttonPanel);
  this.changePkColumnsButton=new Button(buttonPanel,SWT.PUSH);
  this.changePkColumnsButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.CHANGE_ELIPSIS));
  GridDataFactory.fillDefaults().applyTo(this.changePkColumnsButton);
  this.changePkColumnsButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectColumnsDialog dialog=new SelectColumnsDialog(getShell(),getRelationalReference(),true);
      int result=dialog.open();
      if (result == Window.OK) {
        Collection<RelationalColumn> selectedColumns=dialog.getSelectedColumns();
        if (!selectedColumns.isEmpty()) {
          getRelationalReference().getPrimaryKey().setColumns(selectedColumns);
        }
 else {
          getRelationalReference().getPrimaryKey().setColumns(Collections.EMPTY_LIST);
        }
      }
      handleInfoChanged();
    }
  }
);
  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.pkColumnsViewer=new TableViewer(columnTable);
  GridDataFactory.fillDefaults().grab(true,false).hint(SWT.DEFAULT,100).applyTo(this.pkColumnsViewer.getControl());
  TableViewerColumn column=new TableViewerColumn(this.pkColumnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.columnNameLabel);
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  if (getRelationalReference() != null && getRelationalReference().getPrimaryKey() != null) {
    for (    RelationalColumn row : getRelationalReference().getPrimaryKey().getColumns()) {
      this.columnsViewer.add(row);
    }
  }
  return thePanel;
}

Fixed version (ground truth):
private Composite createPrimaryKeyPanel(Composite parent){
  Composite thePanel=WidgetFactory.createPanel(parent,SWT.NONE,1,2);
  GridLayoutFactory.fillDefaults().numColumns(2).margins(10,10).applyTo(thePanel);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(thePanel);
  if (isRelationalView()) {
    Text pkHelpText=new Text(thePanel,SWT.WRAP | SWT.READ_ONLY);
    pkHelpText.setBackground(parent.getBackground());
    pkHelpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
    GridDataFactory.fillDefaults().align(SWT.FILL,SWT.BEGINNING).hint(250,100).span(2,1).applyTo(pkHelpText);
    pkHelpText.setText(Messages.primaryKeysNotSupportedForViews);
  }
  this.includePrimaryKeyCB=new Button(thePanel,SWT.CHECK | SWT.RIGHT);
  GridDataFactory.fillDefaults().align(SWT.LEFT,SWT.CENTER).span(2,1).applyTo(this.includePrimaryKeyCB);
  this.includePrimaryKeyCB.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.INCLUDE));
  this.includePrimaryKeyCB.addSelectionListener(new SelectionAdapter(){
    /** 
 * {@inheritDoc}
 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
    @Override public void widgetSelected(    SelectionEvent e){
      if (includePrimaryKeyCB.getSelection()) {
        if (getRelationalReference().getPrimaryKey() == null) {
          RelationalPrimaryKey key=new RelationalPrimaryKey();
          if (primaryKeyNameText.getText() != null) {
            key.setName(primaryKeyNameText.getText());
          }
          getRelationalReference().setPrimaryKey(key);
        }
      }
 else {
        getRelationalReference().setPrimaryKey(null);
      }
      handleInfoChanged();
    }
  }
);
  Label label=new Label(thePanel,SWT.NONE | SWT.RIGHT);
  label.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.NAME));
  GridDataFactory.fillDefaults().applyTo(label);
  this.primaryKeyNameText=new Text(thePanel,SWT.BORDER | SWT.SINGLE);
  this.primaryKeyNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().applyTo(this.primaryKeyNameText);
  this.primaryKeyNameText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent event){
      String value=primaryKeyNameText.getText();
      if (value == null) {
        value=EMPTY_STRING;
      }
      if (getRelationalReference().getPrimaryKey() != null) {
        RelationalPrimaryKey key=getRelationalReference().getPrimaryKey();
        key.setName(value);
      }
      handleInfoChanged();
    }
  }
);
  label=new Label(thePanel,SWT.NONE | SWT.RIGHT);
  label.setText(Messages.nameInSourceLabel);
  GridDataFactory.fillDefaults().applyTo(label);
  this.primaryKeyNISText=new Text(thePanel,SWT.BORDER | SWT.SINGLE);
  this.primaryKeyNISText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
  GridDataFactory.fillDefaults().applyTo(this.primaryKeyNISText);
  this.primaryKeyNISText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent event){
      String value=primaryKeyNISText.getText();
      if (value == null) {
        value=EMPTY_STRING;
      }
      if (getRelationalReference().getPrimaryKey() != null) {
        RelationalPrimaryKey key=getRelationalReference().getPrimaryKey();
        key.setNameInSource(value);
      }
      handleInfoChanged();
    }
  }
);
  Composite buttonPanel=new Composite(thePanel,SWT.NONE);
  GridLayoutFactory.fillDefaults().applyTo(buttonPanel);
  GridDataFactory.fillDefaults().align(SWT.LEFT,SWT.BEGINNING).applyTo(buttonPanel);
  this.changePkColumnsButton=new Button(buttonPanel,SWT.PUSH);
  this.changePkColumnsButton.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.CHANGE_ELIPSIS));
  GridDataFactory.fillDefaults().applyTo(this.changePkColumnsButton);
  this.changePkColumnsButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SelectColumnsDialog dialog=new SelectColumnsDialog(getShell(),getRelationalReference(),true);
      int result=dialog.open();
      if (result == Window.OK) {
        Collection<RelationalColumn> selectedColumns=dialog.getSelectedColumns();
        if (!selectedColumns.isEmpty()) {
          getRelationalReference().getPrimaryKey().setColumns(selectedColumns);
        }
 else {
          getRelationalReference().getPrimaryKey().setColumns(Collections.EMPTY_LIST);
        }
      }
      handleInfoChanged();
    }
  }
);
  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.pkColumnsViewer=new TableViewer(columnTable);
  GridDataFactory.fillDefaults().grab(true,true).hint(SWT.DEFAULT,100).applyTo(this.pkColumnsViewer.getControl());
  TableViewerColumn column=new TableViewerColumn(this.pkColumnsViewer,SWT.LEFT);
  column.getColumn().setText(Messages.columnNameLabel);
  column.setLabelProvider(new ColumnDataLabelProvider(0));
  column.getColumn().pack();
  if (getRelationalReference() != null && getRelationalReference().getPrimaryKey() != null) {
    for (    RelationalColumn row : getRelationalReference().getPrimaryKey().getColumns()) {
      this.columnsViewer.add(row);
    }
  }
  return thePanel;
}