Program: 76680
Project: 76680
Buggy source:
private void switchToList(){
  createLabel(valueArea,LABEL_VALUES);
  Composite tableAreaComposite=new Composite(valueArea,SWT.NONE);
  tableAreaComposite.setLayout(UIUtil.createGridLayoutWithoutMargin());
  tableAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  TableArea tableArea=new TableArea(tableAreaComposite,SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER,tableAreaModifier);
  tableArea.setLayoutData(new GridData(GridData.FILL_BOTH));
  Table table=tableArea.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  String[] columns;
  int[] columnWidth;
  columns=new String[]{null,COLUMN_IS_DEFAULT,COLUMN_VALUE,COLUMN_DISPLAY_TEXT};
  columnWidth=new int[]{20,70,145,145};
  for (int i=0; i < columns.length; i++) {
    TableColumn column=new TableColumn(table,SWT.LEFT);
    column.setResizable(columns[i] != null);
    if (columns[i] != null) {
      column.setText(columns[i]);
    }
    column.setWidth(columnWidth[i]);
  }
  valueTable=tableArea.getTableViewer();
  valueTable.setColumnProperties(columns);
  valueTable.setContentProvider(contentProvider);
  valueTable.setLabelProvider(labelProvider);
  tableArea.setInput(choiceList);
  valueTable.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      updateTableButtons();
    }
  }
);
  Composite buttonBar=new Composite(tableAreaComposite,SWT.NONE);
  buttonBar.setLayout(UIUtil.createGridLayoutWithoutMargin(4,false));
  buttonBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  importValue=new Button(buttonBar,SWT.PUSH);
  importValue.setText(BUTTON_LABEL_IMPORT);
  setButtonLayoutData(importValue);
  importValue.setEnabled(!inputParameter.getModuleHandle().getVisibleDataSets().isEmpty());
  importValue.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      boolean defaultValueRemoved=true;
      String type=getSelectedDataType();
      List choices=new ArrayList();
      for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
        SelectionChoice choice=(SelectionChoice)iter.next();
        choices.add(choice.getValue());
      }
      ImportValueDialog dialog=new ImportValueDialog(type,choices);
      if (dialog.open() == OK) {
        String[] importValues=(String[])dialog.getResult();
        choiceList.clear();
        for (int i=0; i < importValues.length; i++) {
          SelectionChoice choice=StructureFactory.createSelectionChoice();
          choice.setValue(importValues[i]);
          choiceList.add(choice);
          if (defaultValue != null && defaultValue.equals(importValues[i])) {
            defaultValueRemoved=false;
          }
        }
        refreshValueTable();
        if (defaultValue != null && defaultValueRemoved) {
          changeDefaultValue(null);
        }
      }
    }
  }
);
  changeDefault=new Button(buttonBar,SWT.TOGGLE);
  changeDefault.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      SelectionChoice choice=(SelectionChoice)((IStructuredSelection)valueTable.getSelection()).getFirstElement();
      if (isDefaultChoice(choice)) {
        changeDefaultValue(null);
      }
 else {
        changeDefaultValue(choice.getValue());
      }
      refreshValueTable();
      changeDefault.getParent().layout();
    }
  }
);
  createPromptLine(tableAreaComposite);
  updateTableButtons();
}

Fixed version (ground truth):
private void switchToList(){
  createLabel(valueArea,LABEL_VALUES);
  Composite tableAreaComposite=new Composite(valueArea,SWT.NONE);
  tableAreaComposite.setLayout(UIUtil.createGridLayoutWithoutMargin());
  tableAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  TableArea tableArea=new TableArea(tableAreaComposite,SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER,tableAreaModifier);
  tableArea.setLayoutData(new GridData(GridData.FILL_BOTH));
  Table table=tableArea.getTable();
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  String[] columns;
  int[] columnWidth;
  columns=new String[]{null,COLUMN_IS_DEFAULT,COLUMN_VALUE,COLUMN_DISPLAY_TEXT};
  columnWidth=new int[]{20,70,145,145};
  for (int i=0; i < columns.length; i++) {
    TableColumn column=new TableColumn(table,SWT.LEFT);
    column.setResizable(columns[i] != null);
    if (columns[i] != null) {
      column.setText(columns[i]);
    }
    column.setWidth(columnWidth[i]);
  }
  valueTable=tableArea.getTableViewer();
  valueTable.setColumnProperties(columns);
  valueTable.setContentProvider(contentProvider);
  valueTable.setLabelProvider(labelProvider);
  tableArea.setInput(choiceList);
  valueTable.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      updateTableButtons();
    }
  }
);
  Composite buttonBar=new Composite(tableAreaComposite,SWT.NONE);
  buttonBar.setLayout(UIUtil.createGridLayoutWithoutMargin(4,false));
  buttonBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  importValue=new Button(buttonBar,SWT.PUSH);
  importValue.setText(BUTTON_LABEL_IMPORT);
  setButtonLayoutData(importValue);
  importValue.setEnabled(!inputParameter.getModuleHandle().getVisibleDataSets().isEmpty());
  importValue.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      boolean defaultValueRemoved=true;
      String type=getSelectedDataType();
      List choices=new ArrayList();
      Map labelMap=new HashMap();
      for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
        SelectionChoice choice=(SelectionChoice)iter.next();
        choices.add(choice.getValue());
        if (choice.getLabel() != null) {
          labelMap.put(choice.getValue(),choice.getLabel());
        }
      }
      ImportValueDialog dialog=new ImportValueDialog(type,choices);
      if (dialog.open() == OK) {
        String[] importValues=(String[])dialog.getResult();
        choiceList.clear();
        for (int i=0; i < importValues.length; i++) {
          SelectionChoice choice=StructureFactory.createSelectionChoice();
          choice.setValue(importValues[i]);
          if (labelMap.get(importValues[i]) != null) {
            choice.setLabel((String)labelMap.get(importValues[i]));
          }
          choiceList.add(choice);
          if (defaultValue != null && defaultValue.equals(importValues[i])) {
            defaultValueRemoved=false;
          }
        }
        refreshValueTable();
        if (defaultValue != null && defaultValueRemoved) {
          changeDefaultValue(null);
        }
      }
    }
  }
);
  changeDefault=new Button(buttonBar,SWT.TOGGLE);
  changeDefault.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      SelectionChoice choice=(SelectionChoice)((IStructuredSelection)valueTable.getSelection()).getFirstElement();
      if (isDefaultChoice(choice)) {
        changeDefaultValue(null);
      }
 else {
        changeDefaultValue(choice.getValue());
      }
      refreshValueTable();
      changeDefault.getParent().layout();
    }
  }
);
  createPromptLine(tableAreaComposite);
  updateTableButtons();
}