Program: 148184
Project: 148184
Buggy source:
protected void createViewer(){
  createTable();
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,columns.size(),1);
  table.setLayoutData(gd);
  gd.heightHint=80;
  Composite stepUpDownComposite=toolkit.createComposite(mainComposite,SWT.NONE);
  stepUpDownComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  stepUpDownComposite.setLayout(new GridLayout(1,false));
  upButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
  upButton.setToolTipText("String_Node_Str");
  upButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index > 0 && index < viewer.getTable().getItemCount()) {
        if (mainPage != null) {
          mainPage.setComitting(true);
        }
        List<Line> items=(List<Line>)viewer.getInput();
        Line line=items.get(index);
        items.remove(index);
        items.add(index - 1,line);
        viewer.refresh();
        if (mainPage != null) {
          mainPage.setComitting(false);
        }
        markDirty();
      }
    }
  }
);
  downButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
  downButton.setToolTipText("String_Node_Str");
  downButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index >= 0 && index < viewer.getTable().getItemCount() - 1) {
        if (mainPage != null) {
          mainPage.setComitting(true);
        }
        List<Line> items=(List<Line>)viewer.getInput();
        Line line=items.get(index);
        items.remove(index);
        items.add(index + 1,line);
        viewer.refresh();
        if (mainPage != null) {
          mainPage.setComitting(false);
        }
        markDirty();
      }
    }
  }
);
  deleteButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  deleteButton.setToolTipText("String_Node_Str");
  deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
  deleteButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index >= 0 && index < viewer.getTable().getItemCount()) {
        List<Line> items=(List<Line>)viewer.getInput();
        items.remove(index);
        viewer.refresh();
        int pos=index - 1;
        if (pos >= 0)         viewer.getTable().select(pos);
        markDirty();
      }
    }
  }
);
  CellEditor[] editors=new CellEditor[columns.size()];
  for (int i=0; i < columns.size(); i++) {
    if (columns.get(i).isText()) {
      editors[i]=new TextCellEditor(table);
    }
 else     if (columns.get(i).isCombo()) {
      editors[i]=new ComboBoxCellEditor(table,((ComplexTableViewerColumn)columns.get(i)).getComboValues(),SWT.READ_ONLY);
    }
 else     if (columns.get(i).isXPATH()) {
      editors[i]=new XpathCellEditor(table);
    }
 else     if (columns.get(i).isMultiMessage()) {
      editors[i]=new MultiMessageEditor(table);
      multiMsg.setColumn(table.getColumn(i));
    }
 else     if (columns.get(i).isValidationRule()) {
      editors[i]=new ValidationRuleEditor(table);
      validationRule.setColumn(table.getColumn(i));
    }
  }
  viewer.setCellEditors(editors);
  viewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @SuppressWarnings("String_Node_Str") public Object[] getElements(    Object inputElement){
      ArrayList<Line> lines=(ArrayList<Line>)inputElement;
      return lines.toArray(new Line[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){
      Line line=(Line)element;
      if (columnIndex >= 0 && columnIndex < columns.size()) {
        for (        KeyValue keyvalue : line.keyValues) {
          if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
            String val=keyvalue.value;
            if (columns.get(columnIndex).isNillable()) {
              if (columns.get(columnIndex).getNillValue().equals(val))               val=columns.get(columnIndex).getNillDisplay();
            }
            return val;
          }
        }
      }
      return "String_Node_Str";
    }
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
  }
);
  ArrayList<String> columnNames=new ArrayList<String>();
  for (  ComplexTableViewerColumn column : columns) {
    columnNames.add(column.getName());
  }
  viewer.setColumnProperties(columnNames.toArray(new String[columnNames.size()]));
  viewer.setCellModifier(new ICellModifier(){
    public boolean canModify(    Object element,    String property){
      return editable;
    }
    @SuppressWarnings("String_Node_Str") public void modify(    Object element,    String property,    Object value){
      if (value instanceof Integer) {
        if (Integer.valueOf(value.toString()) == -1)         return;
      }
      TableItem item=(TableItem)element;
      Line line=(Line)item.getData();
      int columnIndex=Arrays.asList(viewer.getColumnProperties()).indexOf(property);
      if (!isForceTextCellEditor(columnIndex) && isAColumnWithCombo(columnIndex)) {
        String[] attrs=columns.get(columnIndex).getComboValues();
        value=attrs[Integer.parseInt(value.toString())];
      }
      KeyValue kv=line.keyValues.get(columnIndex);
      boolean noChange=kv.value.equals(value.toString());
      kv.value=value.toString();
      viewer.refresh();
      if (!noChange) {
        markDirty();
      }
    }
    public Object getValue(    Object element,    String property){
      int columnIndex=Arrays.asList(viewer.getColumnProperties()).indexOf(property);
      Line line=(Line)element;
      if (isAColumnWithCombo(columnIndex)) {
        String value=line.keyValues.get(columnIndex).value;
        String[] attrs=columns.get(columnIndex).getComboValues();
        return Arrays.asList(attrs).indexOf(value);
      }
      for (      KeyValue keyvalue : line.keyValues) {
        if (property.equals(keyvalue.key)) {
          if (keyvalue.value.equals("String_Node_Str")) {
            return columns.get(columnIndex).getNillDisplay();
          }
          return keyvalue.value;
        }
      }
      return null;
    }
    private boolean isAColumnWithCombo(    int columnIdx){
      return columns.get(columnIdx).isCombo();
    }
    private boolean isForceTextCellEditor(    int columnIdx){
      return columns.get(columnIdx).isText();
    }
  }
);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      Line line=(Line)((IStructuredSelection)event.getSelection()).getFirstElement();
      for (int columnIndex=0; columnIndex < columns.size(); columnIndex++) {
        if (line == null) {
          Control control=columns.get(columnIndex).getControl();
          if (control instanceof Text) {
            ((Text)control).setText("String_Node_Str");
          }
          if (control instanceof CCombo) {
            ((CCombo)control).select(0);
          }
          if (control instanceof Combo) {
            ((CCombo)control).select(0);
          }
        }
 else {
          for (          KeyValue keyvalue : line.keyValues) {
            if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
              String val=keyvalue.value;
              Control control=columns.get(columnIndex).getControl();
              if (control instanceof Text) {
                ((Text)control).setText(val);
              }
              if (control instanceof CCombo) {
                ((CCombo)control).setText(val);
              }
              if (control instanceof Combo) {
                ((CCombo)control).setText(val);
              }
            }
          }
        }
      }
    }
  }
);
  viewer.getTable().addKeyListener(new KeyListener(){
    public void keyPressed(    KeyEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void keyReleased(    KeyEvent e){
      if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
        Line line=(Line)((IStructuredSelection)viewer.getSelection()).getFirstElement();
        List<Line> items=(List<Line>)viewer.getInput();
        items.remove(line);
        viewer.refresh();
        markDirty();
      }
    }
  }
);
}

Fixed version (ground truth):
protected void createViewer(){
  createTable();
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,columns.size(),1);
  table.setLayoutData(gd);
  gd.heightHint=80;
  Composite stepUpDownComposite=toolkit.createComposite(mainComposite,SWT.NONE);
  stepUpDownComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
  stepUpDownComposite.setLayout(new GridLayout(1,false));
  upButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
  upButton.setToolTipText("String_Node_Str");
  upButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index > 0 && index < viewer.getTable().getItemCount()) {
        if (mainPage != null) {
          mainPage.setComitting(true);
        }
        List<Line> items=(List<Line>)viewer.getInput();
        Line line=items.get(index);
        items.remove(index);
        items.add(index - 1,line);
        viewer.refresh();
        if (mainPage != null) {
          mainPage.setComitting(false);
        }
        markDirty();
      }
    }
  }
);
  downButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
  downButton.setToolTipText("String_Node_Str");
  downButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index >= 0 && index < viewer.getTable().getItemCount() - 1) {
        if (mainPage != null) {
          mainPage.setComitting(true);
        }
        List<Line> items=(List<Line>)viewer.getInput();
        Line line=items.get(index);
        items.remove(index);
        items.add(index + 1,line);
        viewer.refresh();
        if (mainPage != null) {
          mainPage.setComitting(false);
        }
        markDirty();
      }
    }
  }
);
  deleteButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  deleteButton.setToolTipText("String_Node_Str");
  deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
  deleteButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      int index=viewer.getTable().getSelectionIndex();
      if (index >= 0 && index < viewer.getTable().getItemCount()) {
        List<Line> items=(List<Line>)viewer.getInput();
        items.remove(index);
        viewer.refresh();
        int pos=index - 1;
        if (pos >= 0)         viewer.getTable().select(pos);
        markDirty();
      }
    }
  }
);
  CellEditor[] editors=new CellEditor[columns.size()];
  for (int i=0; i < columns.size(); i++) {
    if (columns.get(i).isText()) {
      editors[i]=new TextCellEditor(table);
    }
 else     if (columns.get(i).isCombo()) {
      editors[i]=new ComboBoxCellEditor(table,((ComplexTableViewerColumn)columns.get(i)).getComboValues(),SWT.READ_ONLY);
    }
 else     if (columns.get(i).isXPATH()) {
      editors[i]=new XpathCellEditor(table);
    }
 else     if (columns.get(i).isMultiMessage()) {
      editors[i]=new MultiMessageEditor(table);
      multiMsg.setColumn(table.getColumn(i));
    }
 else     if (columns.get(i).isValidationRule()) {
      editors[i]=new ValidationRuleEditor(table);
      validationRule.setColumn(table.getColumn(i));
    }
  }
  viewer.setCellEditors(editors);
  viewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    @SuppressWarnings("String_Node_Str") public Object[] getElements(    Object inputElement){
      List<Line> lines=(List<Line>)inputElement;
      return lines.toArray(new Line[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){
      Line line=(Line)element;
      if (columnIndex >= 0 && columnIndex < columns.size()) {
        for (        KeyValue keyvalue : line.keyValues) {
          if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
            String val=keyvalue.value;
            if (columns.get(columnIndex).isNillable()) {
              if (columns.get(columnIndex).getNillValue().equals(val))               val=columns.get(columnIndex).getNillDisplay();
            }
            return val;
          }
        }
      }
      return "String_Node_Str";
    }
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
  }
);
  ArrayList<String> columnNames=new ArrayList<String>();
  for (  ComplexTableViewerColumn column : columns) {
    columnNames.add(column.getName());
  }
  viewer.setColumnProperties(columnNames.toArray(new String[columnNames.size()]));
  viewer.setCellModifier(new ICellModifier(){
    public boolean canModify(    Object element,    String property){
      return editable;
    }
    @SuppressWarnings("String_Node_Str") public void modify(    Object element,    String property,    Object value){
      if (value instanceof Integer) {
        if (Integer.valueOf(value.toString()) == -1)         return;
      }
      TableItem item=(TableItem)element;
      Line line=(Line)item.getData();
      int columnIndex=Arrays.asList(viewer.getColumnProperties()).indexOf(property);
      if (!isForceTextCellEditor(columnIndex) && isAColumnWithCombo(columnIndex)) {
        String[] attrs=columns.get(columnIndex).getComboValues();
        value=attrs[Integer.parseInt(value.toString())];
      }
      KeyValue kv=line.keyValues.get(columnIndex);
      boolean noChange=kv.value.equals(value.toString());
      kv.value=value.toString();
      viewer.refresh();
      if (!noChange) {
        markDirty();
      }
    }
    public Object getValue(    Object element,    String property){
      int columnIndex=Arrays.asList(viewer.getColumnProperties()).indexOf(property);
      Line line=(Line)element;
      if (isAColumnWithCombo(columnIndex)) {
        String value=line.keyValues.get(columnIndex).value;
        String[] attrs=columns.get(columnIndex).getComboValues();
        return Arrays.asList(attrs).indexOf(value);
      }
      for (      KeyValue keyvalue : line.keyValues) {
        if (property.equals(keyvalue.key)) {
          if (keyvalue.value.equals("String_Node_Str")) {
            return columns.get(columnIndex).getNillDisplay();
          }
          return keyvalue.value;
        }
      }
      return null;
    }
    private boolean isAColumnWithCombo(    int columnIdx){
      return columns.get(columnIdx).isCombo();
    }
    private boolean isForceTextCellEditor(    int columnIdx){
      return columns.get(columnIdx).isText();
    }
  }
);
  viewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      Line line=(Line)((IStructuredSelection)event.getSelection()).getFirstElement();
      for (int columnIndex=0; columnIndex < columns.size(); columnIndex++) {
        if (line == null) {
          Control control=columns.get(columnIndex).getControl();
          if (control instanceof Text) {
            ((Text)control).setText("String_Node_Str");
          }
          if (control instanceof CCombo) {
            ((CCombo)control).select(0);
          }
          if (control instanceof Combo) {
            ((CCombo)control).select(0);
          }
        }
 else {
          for (          KeyValue keyvalue : line.keyValues) {
            if (keyvalue.key.equals(columns.get(columnIndex).getName())) {
              String val=keyvalue.value;
              Control control=columns.get(columnIndex).getControl();
              if (control instanceof Text) {
                ((Text)control).setText(val);
              }
              if (control instanceof CCombo) {
                ((CCombo)control).setText(val);
              }
              if (control instanceof Combo) {
                ((CCombo)control).setText(val);
              }
            }
          }
        }
      }
    }
  }
);
  viewer.getTable().addKeyListener(new KeyListener(){
    public void keyPressed(    KeyEvent e){
    }
    @SuppressWarnings("String_Node_Str") public void keyReleased(    KeyEvent e){
      if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
        Line line=(Line)((IStructuredSelection)viewer.getSelection()).getFirstElement();
        List<Line> items=(List<Line>)viewer.getInput();
        items.remove(line);
        viewer.refresh();
        markDirty();
      }
    }
  }
);
}