Program: 149275
Project: 149275
Buggy source:
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=3;
  labelText=new Text(composite,SWT.BORDER | SWT.SINGLE);
  labelText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,2,1));
  ((GridData)labelText.getLayoutData()).minimumWidth=300;
  labelText.addKeyListener(new KeyListener(){
    public void keyPressed(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
      if ((e.stateMask == 0) && (e.character == SWT.CR)) {
        xPaths.add(labelText.getText());
        viewer.refresh();
      }
    }
  }
);
  Button addLabelButton=new Button(composite,SWT.PUSH | SWT.CENTER);
  addLabelButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  addLabelButton.setText("String_Node_Str");
  addLabelButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      xPaths.add(labelText.getText());
      viewer.refresh();
    }
  }
);
  final String COLUMN=columnName;
  viewer=new TableViewer(composite,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER| SWT.FULL_SELECTION);
  viewer.getControl().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,2,1));
  ((GridData)viewer.getControl().getLayoutData()).heightHint=100;
  Table table=viewer.getTable();
  new TableColumn(table,SWT.CENTER).setText(COLUMN);
  table.getColumn(0).setWidth(400);
  for (int i=1, n=table.getColumnCount(); i < n; i++) {
    table.getColumn(i).pack();
  }
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  CellEditor[] editors=new CellEditor[2];
  editors[0]=new TextCellEditor(table);
  viewer.setCellEditors(editors);
  viewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    public Object[] getElements(    Object inputElement){
      ArrayList<String> xPaths=(ArrayList<String>)inputElement;
      ArrayList<DescriptionLine> lines=new ArrayList<DescriptionLine>();
      for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
        String xPath=((String)iter.next());
        DescriptionLine line=new DescriptionLine(xPath);
        lines.add(line);
      }
      return lines.toArray(new DescriptionLine[lines.size()]);
    }
  }
);
  viewer.setLabelProvider(new ITableLabelProvider(){
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void dispose(){
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void removeListener(    ILabelProviderListener listener){
    }
    public String getColumnText(    Object element,    int columnIndex){
      DescriptionLine line=(DescriptionLine)element;
switch (columnIndex) {
case 0:
        return line.getLabel();
    }
    return "String_Node_Str";
  }
  public Image getColumnImage(  Object element,  int columnIndex){
    return null;
  }
}
);
viewer.setColumnProperties(new String[]{COLUMN});
viewer.setCellModifier(new ICellModifier(){
  public boolean canModify(  Object element,  String property){
    return false;
  }
  public void modify(  Object element,  String property,  Object value){
  }
  public Object getValue(  Object element,  String property){
    DescriptionLine line=(DescriptionLine)element;
    if (COLUMN.equals(property)) {
      return line.getLabel();
    }
    return null;
  }
}
);
viewer.addSelectionChangedListener(new ISelectionChangedListener(){
  public void selectionChanged(  SelectionChangedEvent event){
  }
}
);
viewer.getTable().addKeyListener(new KeyListener(){
  public void keyPressed(  KeyEvent e){
  }
  public void keyReleased(  KeyEvent e){
    if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
      DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
      ArrayList<String> xPaths=(ArrayList<String>)viewer.getInput();
      xPaths.remove(line.getLabel());
      viewer.refresh();
    }
  }
}
);
viewer.setInput(xPaths);
viewer.refresh();
Composite rightButtonsComposite=new Composite(composite,SWT.NULL);
rightButtonsComposite.setLayout(new GridLayout(1,true));
rightButtonsComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
Button upButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
upButton.setText("String_Node_Str");
upButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line == null)     return;
    int i=0;
    for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
      String xPath=(String)iter.next();
      if (xPath.equals(line.getLabel())) {
        if (i > 0) {
          xPaths.remove(i);
          xPaths.add(i - 1,xPath);
          viewer.refresh();
          viewer.getTable().setSelection(i - 1);
          viewer.getTable().showSelection();
        }
        return;
      }
      i++;
    }
  }
}
);
Button downButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
downButton.setText("String_Node_Str");
downButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line == null)     return;
    int i=0;
    for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
      String xPath=(String)iter.next();
      if (xPath.equals(line.getLabel())) {
        if (i < xPaths.size() - 1) {
          xPaths.remove(i);
          xPaths.add(i + 1,xPath);
          viewer.refresh();
          viewer.getTable().setSelection(i + 1);
          viewer.getTable().showSelection();
        }
        return;
      }
      i++;
    }
  }
}
);
Button delButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
delButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
delButton.setText("String_Node_Str");
delButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line != null) {
      ArrayList<String> xPaths=(ArrayList<String>)viewer.getInput();
      xPaths.remove(line.getLabel());
      viewer.refresh();
    }
  }
}
);
labelText.setFocus();
return composite;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  parent.getShell().setText(this.title);
  Composite composite=(Composite)super.createDialogArea(parent);
  GridLayout layout=(GridLayout)composite.getLayout();
  layout.numColumns=3;
  if (actionType == AnnotationOrderedListsDialog.AnnotationWrite_ActionType) {
    textControl=new CCombo(composite,SWT.BORDER);
    List<String> roles=Util.getCachedXObjectsNameSet(this.xObject,TreeObject.ROLE);
    ((CCombo)textControl).setItems(roles.toArray(new String[roles.size()]));
  }
 else {
    textControl=new Text(composite,SWT.BORDER | SWT.SINGLE);
  }
  if (actionType == AnnotationOrderedListsDialog.AnnotationForeignKeyInfo_ActionType) {
    textControl.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  }
 else {
    textControl.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,2,1));
  }
  ((GridData)textControl.getLayoutData()).minimumWidth=300;
  textControl.addKeyListener(new KeyListener(){
    public void keyPressed(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
      if ((e.stateMask == 0) && (e.character == SWT.CR)) {
        xPaths.add(AnnotationOrderedListsDialog.getControlText(textControl));
        viewer.refresh();
      }
    }
  }
);
  if (actionType == AnnotationOrderedListsDialog.AnnotationForeignKeyInfo_ActionType) {
    Button xpathButton=new Button(composite,SWT.PUSH | SWT.CENTER);
    xpathButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
    xpathButton.setText("String_Node_Str");
    xpathButton.setToolTipText("String_Node_Str");
    xpathButton.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      SelectionEvent e){
      }
      public void widgetSelected(      SelectionEvent e){
        XpathSelectDialog dlg=new XpathSelectDialog(parentPage.getSite().getShell(),xObject.getParent(),"String_Node_Str",parentPage.getSite());
        dlg.setBlockOnOpen(true);
        dlg.open();
        if (dlg.getReturnCode() == Window.OK) {
          ((Text)textControl).setText(dlg.getXpath());
          dlg.close();
        }
      }
    }
);
  }
  Button addLabelButton=new Button(composite,SWT.PUSH | SWT.CENTER);
  addLabelButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  addLabelButton.setText("String_Node_Str");
  addLabelButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      xPaths.add(getControlText(textControl));
      viewer.refresh();
    }
  }
);
  final String COLUMN=columnName;
  viewer=new TableViewer(composite,SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL| SWT.BORDER| SWT.FULL_SELECTION);
  viewer.getControl().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,2,1));
  ((GridData)viewer.getControl().getLayoutData()).heightHint=100;
  Table table=viewer.getTable();
  new TableColumn(table,SWT.CENTER).setText(COLUMN);
  table.getColumn(0).setWidth(400);
  for (int i=1, n=table.getColumnCount(); i < n; i++) {
    table.getColumn(i).pack();
  }
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  CellEditor[] editors=new CellEditor[2];
  editors[0]=new TextCellEditor(table);
  viewer.setCellEditors(editors);
  viewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    public Object[] getElements(    Object inputElement){
      ArrayList<String> xPaths=(ArrayList<String>)inputElement;
      ArrayList<DescriptionLine> lines=new ArrayList<DescriptionLine>();
      for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
        String xPath=((String)iter.next());
        DescriptionLine line=new DescriptionLine(xPath);
        lines.add(line);
      }
      return lines.toArray(new DescriptionLine[lines.size()]);
    }
  }
);
  viewer.setLabelProvider(new ITableLabelProvider(){
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void dispose(){
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void removeListener(    ILabelProviderListener listener){
    }
    public String getColumnText(    Object element,    int columnIndex){
      DescriptionLine line=(DescriptionLine)element;
switch (columnIndex) {
case 0:
        return line.getLabel();
    }
    return "String_Node_Str";
  }
  public Image getColumnImage(  Object element,  int columnIndex){
    return null;
  }
}
);
viewer.setColumnProperties(new String[]{COLUMN});
viewer.setCellModifier(new ICellModifier(){
  public boolean canModify(  Object element,  String property){
    return false;
  }
  public void modify(  Object element,  String property,  Object value){
  }
  public Object getValue(  Object element,  String property){
    DescriptionLine line=(DescriptionLine)element;
    if (COLUMN.equals(property)) {
      return line.getLabel();
    }
    return null;
  }
}
);
viewer.addSelectionChangedListener(new ISelectionChangedListener(){
  public void selectionChanged(  SelectionChangedEvent event){
  }
}
);
viewer.getTable().addKeyListener(new KeyListener(){
  public void keyPressed(  KeyEvent e){
  }
  public void keyReleased(  KeyEvent e){
    if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
      DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
      ArrayList<String> xPaths=(ArrayList<String>)viewer.getInput();
      xPaths.remove(line.getLabel());
      viewer.refresh();
    }
  }
}
);
viewer.setInput(xPaths);
viewer.refresh();
Composite rightButtonsComposite=new Composite(composite,SWT.NULL);
rightButtonsComposite.setLayout(new GridLayout(1,true));
rightButtonsComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
Button upButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
upButton.setText("String_Node_Str");
upButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line == null)     return;
    int i=0;
    for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
      String xPath=(String)iter.next();
      if (xPath.equals(line.getLabel())) {
        if (i > 0) {
          xPaths.remove(i);
          xPaths.add(i - 1,xPath);
          viewer.refresh();
          viewer.getTable().setSelection(i - 1);
          viewer.getTable().showSelection();
        }
        return;
      }
      i++;
    }
  }
}
);
Button downButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
downButton.setText("String_Node_Str");
downButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line == null)     return;
    int i=0;
    for (Iterator iter=xPaths.iterator(); iter.hasNext(); ) {
      String xPath=(String)iter.next();
      if (xPath.equals(line.getLabel())) {
        if (i < xPaths.size() - 1) {
          xPaths.remove(i);
          xPaths.add(i + 1,xPath);
          viewer.refresh();
          viewer.getTable().setSelection(i + 1);
          viewer.getTable().showSelection();
        }
        return;
      }
      i++;
    }
  }
}
);
Button delButton=new Button(rightButtonsComposite,SWT.PUSH | SWT.CENTER);
delButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
delButton.setText("String_Node_Str");
delButton.addSelectionListener(new SelectionListener(){
  public void widgetDefaultSelected(  org.eclipse.swt.events.SelectionEvent e){
  }
  public void widgetSelected(  org.eclipse.swt.events.SelectionEvent e){
    DescriptionLine line=(DescriptionLine)((IStructuredSelection)viewer.getSelection()).getFirstElement();
    if (line != null) {
      ArrayList<String> xPaths=(ArrayList<String>)viewer.getInput();
      xPaths.remove(line.getLabel());
      viewer.refresh();
    }
  }
}
);
textControl.setFocus();
return composite;
}