Program: 67371
Project: 67371
Buggy source:
private void createDynamicParamsPart(Composite parent){
  Composite comp=new Composite(parent,SWT.NULL);
  GridLayout layout=UIUtil.createGridLayoutWithoutMargin();
  layout.numColumns=2;
  comp.setLayout(layout);
  comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Label label=new Label(comp,SWT.NULL);
  label.setText(LABEL_PARAMETERS);
  new Label(comp,SWT.NULL);
  table=new Table(comp,SWT.FULL_SELECTION | SWT.BORDER);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.heightHint=100;
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  table.addKeyListener(new KeyAdapter(){
    public void keyReleased(    KeyEvent e){
      if (e.keyCode == SWT.DEL) {
        deleteRow();
      }
    }
  }
);
  int[] columnWidths=new int[]{120,100,120,135};
  String[] columns=new String[]{COLUMN_NAME,COLUMN_DATA_SET,COLUMN_VALUE,COLUMN_DISPLAY_TEXT};
  for (int i=0; i < columns.length; i++) {
    TableColumn column=new TableColumn(table,SWT.LEFT);
    column.setResizable(true);
    column.setText(columns[i]);
    column.setWidth(columnWidths[i]);
  }
  table.setLayoutData(data);
  table.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
      int index=table.getSelectionIndex();
      boolean setBtnEnable=true;
      if (index == -1) {
        setBtnEnable=false;
      }
      editBtn.setEnabled(setBtnEnable);
      delBtn.setEnabled(setBtnEnable);
    }
    public void focusLost(    FocusEvent e){
      int index=table.getSelectionIndex();
      boolean setBtnEnable=true;
      if (index == -1) {
        setBtnEnable=false;
      }
      editBtn.setEnabled(setBtnEnable);
      delBtn.setEnabled(setBtnEnable);
    }
  }
);
  valueTable=new TableViewer(table);
  valueTable.setColumnProperties(columns);
  valueTable.setContentProvider(contentProvider);
  valueTable.setLabelProvider(labelProvider);
  valueTable.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      ISelection selection=event.getSelection();
      Object param=((StructuredSelection)selection).getFirstElement();
      if (param != selectedParameter) {
        if (param instanceof ScalarParameterHandle) {
          try {
            saveParameterProperties();
            saveSortingProperties();
            selectedParameter=(ScalarParameterHandle)param;
            defaultValueList=selectedParameter.getDefaultValueList();
          }
 catch (          SemanticException e) {
            ExceptionHandler.handle(e);
            valueTable.setSelection(new StructuredSelection(selectedParameter));
          }
          refreshParameterProperties();
          initSorttingArea();
          updateButtons();
        }
      }
    }
  }
);
  valueTable.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      editParameter(selectedParameter);
    }
  }
);
  Composite composite=new Composite(comp,SWT.NULL);
  composite.setLayout(new GridLayout());
  composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
  addBtn=new Button(composite,SWT.NONE);
  addBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  addBtn.setText(Messages.getString("String_Node_Str"));
  addBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      AddEditCascadingParameterDialog dialog=new AddEditCascadingParameterDialog(Messages.getString("String_Node_Str"));
      if (dialog.open() != Dialog.OK) {
        return;
      }
      try {
        inputParameterGroup.getParameters().add(dialog.getParameter());
        for (int i=0; i < inputParameterGroup.getParameters().getCount() - 1; i++) {
          ScalarParameterHandle parameter=(ScalarParameterHandle)inputParameterGroup.getParameters().get(i);
          parameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_SIMPLE);
          List valueLisit=parameter.getDefaultValueList();
          if (valueLisit != null && valueLisit.size() > 0) {
            Expression expression=getFirstDefaultValue();
            valueLisit.clear();
            valueLisit.add(expression);
          }
          parameter.setDefaultValueList(valueLisit);
        }
      }
 catch (      ContentException e1) {
        ExceptionHandler.handle(e1);
      }
catch (      NameException e1) {
        ExceptionHandler.handle(e1);
      }
catch (      SemanticException e1) {
        ExceptionHandler.handle(e1);
      }
      refreshValueTable();
      valueTable.setSelection(new StructuredSelection(dialog.getParameter()));
      updateButtons();
    }
  }
);
  editBtn=new Button(composite,SWT.NONE);
  editBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  editBtn.setText(Messages.getString("String_Node_Str"));
  editBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      editParameter(selectedParameter);
    }
  }
);
  delBtn=new Button(composite,SWT.NONE);
  delBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  delBtn.setText(Messages.getString("String_Node_Str"));
  delBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      deleteRow();
      updateButtons();
    }
  }
);
}

Fixed version (ground truth):
private void createDynamicParamsPart(Composite parent){
  Composite comp=new Composite(parent,SWT.NULL);
  GridLayout layout=UIUtil.createGridLayoutWithoutMargin();
  layout.numColumns=2;
  comp.setLayout(layout);
  comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Label label=new Label(comp,SWT.NULL);
  label.setText(LABEL_PARAMETERS);
  new Label(comp,SWT.NULL);
  table=new Table(comp,SWT.FULL_SELECTION | SWT.BORDER);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.heightHint=100;
  table.setLinesVisible(true);
  table.setHeaderVisible(true);
  table.addKeyListener(new KeyAdapter(){
    public void keyReleased(    KeyEvent e){
      if (e.keyCode == SWT.DEL) {
        deleteRow();
      }
    }
  }
);
  int[] columnWidths=new int[]{120,100,120,135};
  String[] columns=new String[]{COLUMN_NAME,COLUMN_DATA_SET,COLUMN_VALUE,COLUMN_DISPLAY_TEXT};
  for (int i=0; i < columns.length; i++) {
    TableColumn column=new TableColumn(table,SWT.LEFT);
    column.setResizable(true);
    column.setText(columns[i]);
    column.setWidth(columnWidths[i]);
  }
  table.setLayoutData(data);
  table.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
      int index=table.getSelectionIndex();
      boolean setBtnEnable=true;
      if (index == -1) {
        setBtnEnable=false;
      }
      editBtn.setEnabled(setBtnEnable);
      delBtn.setEnabled(setBtnEnable);
    }
    public void focusLost(    FocusEvent e){
      int index=table.getSelectionIndex();
      boolean setBtnEnable=true;
      if (index == -1) {
        setBtnEnable=false;
      }
      editBtn.setEnabled(setBtnEnable);
      delBtn.setEnabled(setBtnEnable);
    }
  }
);
  valueTable=new TableViewer(table);
  valueTable.setColumnProperties(columns);
  valueTable.setContentProvider(contentProvider);
  valueTable.setLabelProvider(labelProvider);
  valueTable.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      ISelection selection=event.getSelection();
      Object param=((StructuredSelection)selection).getFirstElement();
      if (param != selectedParameter) {
        if (param instanceof ScalarParameterHandle) {
          try {
            saveParameterProperties();
            saveSortingProperties();
            selectedParameter=(ScalarParameterHandle)param;
            defaultValueList=selectedParameter.getDefaultValueList();
          }
 catch (          SemanticException e) {
            ExceptionHandler.handle(e);
            valueTable.setSelection(new StructuredSelection(selectedParameter));
          }
          refreshParameterProperties();
          initSorttingArea();
          updateButtons();
        }
      }
    }
  }
);
  valueTable.addDoubleClickListener(new IDoubleClickListener(){
    public void doubleClick(    DoubleClickEvent event){
      editParameter(selectedParameter);
    }
  }
);
  Composite composite=new Composite(comp,SWT.NULL);
  composite.setLayout(new GridLayout());
  composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
  addBtn=new Button(composite,SWT.NONE);
  addBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  addBtn.setText(Messages.getString("String_Node_Str"));
  addBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      AddEditCascadingParameterDialog dialog=new AddEditCascadingParameterDialog(Messages.getString("String_Node_Str"));
      if (dialog.open() != Dialog.OK) {
        return;
      }
      try {
        inputParameterGroup.getParameters().add(dialog.getParameter());
        for (int i=0; i < inputParameterGroup.getParameters().getCount() - 1; i++) {
          ScalarParameterHandle parameter=(ScalarParameterHandle)inputParameterGroup.getParameters().get(i);
          parameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_SIMPLE);
          List valueLisit=parameter.getDefaultValueList();
          if (valueLisit != null && valueLisit.size() > 0) {
            Object expression=valueLisit.get(0);
            valueLisit.clear();
            valueLisit.add(expression);
          }
          parameter.setDefaultValueList(valueLisit);
        }
      }
 catch (      ContentException e1) {
        ExceptionHandler.handle(e1);
      }
catch (      NameException e1) {
        ExceptionHandler.handle(e1);
      }
catch (      SemanticException e1) {
        ExceptionHandler.handle(e1);
      }
      refreshValueTable();
      valueTable.setSelection(new StructuredSelection(dialog.getParameter()));
      updateButtons();
    }
  }
);
  editBtn=new Button(composite,SWT.NONE);
  editBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  editBtn.setText(Messages.getString("String_Node_Str"));
  editBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      editParameter(selectedParameter);
    }
  }
);
  delBtn=new Button(composite,SWT.NONE);
  delBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  delBtn.setText(Messages.getString("String_Node_Str"));
  delBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      deleteRow();
      updateButtons();
    }
  }
);
}