Program: 147877
Project: 147877
Buggy source:
@Override protected void createViewer(){
  super.createTable();
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,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));
  GridLayout layout=new GridLayout(8,false);
  layout.marginTop=0;
  layout.marginBottom=0;
  layout.marginHeight=0;
  stepUpDownComposite.setLayout(layout);
  addButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  addButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  addButton.setToolTipText("String_Node_Str");
  if (isXpath()) {
    addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_NEWXPATH.getPath()));
  }
 else {
    addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
  }
  addButton.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){
      List<Line> list=(List<Line>)getViewer().getInput();
      Line line=new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]),getInitValues());
      list.add(line);
      viewer.setSelection(null);
      viewer.refresh();
      viewer.getTable().select(viewer.getTable().getItemCount() - 1);
      markDirty();
    }
  }
);
  if (isAddMulti()) {
    Button selNewPathButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
    selNewPathButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
    selNewPathButton.setToolTipText("String_Node_Str");
    selNewPathButton.setImage(ImageCache.getCreatedImage(EImage.SELECT_NEWXPATH.getPath()));
    selNewPathButton.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){
        xpathDialog=getNewXpathDlgInstance();
        xpathDialog.setConceptName(conceptName);
        xpathDialog.setBlockOnOpen(true);
        xpathDialog.open();
        if (xpathDialog.getReturnCode() == Window.OK) {
          datamodelName=xpathDialog.getDataModelName();
          String[] xpaths=xpathDialog.getXpath().split("String_Node_Str");
          for (          String xpath : xpaths) {
            List<Line> list=(List<Line>)getViewer().getInput();
            Line line=new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]),getLineValues(xpath,0));
            list.add(line);
          }
          viewer.setSelection(null);
          viewer.refresh();
          viewer.getTable().select(viewer.getTable().getItemCount() - 1);
          markDirty();
        }
      }
    }
);
  }
  deleteButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteButton.setToolTipText("String_Node_Str");
  deleteButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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){
      List<Line> input=(List<Line>)viewer.getInput();
      TableItem[] items=viewer.getTable().getSelection();
      for (int i=0; i < items.length; i++) {
        input.remove(items[i].getData());
      }
      viewer.setInput(input);
      markDirty();
    }
  }
);
  deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
  Button deleteAllButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteAllButton.setToolTipText("String_Node_Str");
  deleteAllButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  deleteAllButton.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){
      List<Line> items=(List<Line>)viewer.getInput();
      items.clear();
      viewer.refresh();
      markDirty();
    }
  }
);
  deleteAllButton.setImage(ImageCache.getCreatedImage(EImage.PROGRESS_REMALL.getPath()));
  upButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  upButton.setToolTipText("String_Node_Str");
  upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
  upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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.setToolTipText("String_Node_Str");
  downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
  downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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();
      }
    }
  }
);
  copyButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  copyButton.setToolTipText("String_Node_Str");
  copyButton.setImage(ImageCache.getCreatedImage(EImage.COPY.getPath()));
  copyButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  copyButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      int[] indexs=viewer.getTable().getSelectionIndices();
      List<Line> copyLines=new ArrayList<Line>();
      for (      int index : indexs) {
        if (index >= 0 && index <= viewer.getTable().getItemCount() - 1) {
          List<Line> items=(List<Line>)viewer.getInput();
          Line line=items.get(index);
          Line copyLine=line.clone();
          copyLines.add(copyLine);
        }
      }
      if (indexs.length > 0) {
        HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
        if (btns != null)         for (        Button btn : btns) {
          if (btn != null)           btn.setEnabled(true);
        }
        WorkbenchClipboard.getWorkbenchClipboard().setLines(String.valueOf(columns.size()),copyLines);
      }
    }
  }
);
  pastButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  pastButton.setToolTipText("String_Node_Str");
  pastButton.setImage(ImageCache.getCreatedImage(EImage.PASTE.getPath()));
  pastButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  pastButton.setEnabled(false);
  pastButton.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){
      if (mainPage != null) {
        mainPage.setComitting(true);
      }
      boolean dirty=false;
      List<Line> items=(List<Line>)viewer.getInput();
      List<Line> cacheLine=WorkbenchClipboard.getWorkbenchClipboard().getLines(String.valueOf(columns.size()));
      List<Line> coloneLine=new ArrayList<Line>();
      for (      Line l : cacheLine) {
        coloneLine.add(l.clone());
      }
      if (cacheLine.size() > 0) {
        items.addAll(coloneLine);
        dirty=true;
      }
      viewer.refresh();
      if (mainPage != null) {
        mainPage.setComitting(false);
      }
      if (dirty)       markDirty();
    }
  }
);
  HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
  if (btns == null) {
    btns=new HashSet<Button>();
    pastBtns.put(String.valueOf(columns.size()),btns);
  }
  btns.add(pastButton);
  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 (columnIndex >= 0 && columnIndex < viewer.getColumnProperties().length) {
        if (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();
    }
  }
);
  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();
      }
    }
  }
);
  viewer.getTable().addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
      btns.remove(pastButton);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void createViewer(){
  super.createTable();
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,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));
  GridLayout layout=new GridLayout(8,false);
  layout.marginTop=0;
  layout.marginBottom=0;
  layout.marginHeight=0;
  stepUpDownComposite.setLayout(layout);
  addButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  addButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  addButton.setToolTipText("String_Node_Str");
  if (isXpath()) {
    addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_NEWXPATH.getPath()));
  }
 else {
    addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
  }
  addButton.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){
      List<Line> list=(List<Line>)getViewer().getInput();
      Line line=new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]),getInitValues());
      list.add(line);
      viewer.setSelection(null);
      viewer.refresh();
      viewer.getTable().select(viewer.getTable().getItemCount() - 1);
      markDirty();
    }
  }
);
  if (isAddMulti()) {
    Button selNewPathButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
    selNewPathButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
    selNewPathButton.setToolTipText("String_Node_Str");
    selNewPathButton.setImage(ImageCache.getCreatedImage(EImage.SELECT_NEWXPATH.getPath()));
    selNewPathButton.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){
        xpathDialog=getNewXpathDlgInstance();
        xpathDialog.setConceptName(conceptName);
        xpathDialog.setBlockOnOpen(true);
        xpathDialog.open();
        if (xpathDialog.getReturnCode() == Window.OK) {
          datamodelName=xpathDialog.getDataModelName();
          String[] xpaths=xpathDialog.getXpath().split("String_Node_Str");
          for (          String xpath : xpaths) {
            List<Line> list=(List<Line>)getViewer().getInput();
            Line line=new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]),getLineValues(xpath,0));
            list.add(line);
          }
          viewer.setSelection(null);
          viewer.refresh();
          viewer.getTable().select(viewer.getTable().getItemCount() - 1);
          markDirty();
        }
      }
    }
);
  }
  deleteButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteButton.setToolTipText("String_Node_Str");
  deleteButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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){
      List<Line> input=(List<Line>)viewer.getInput();
      TableItem[] items=viewer.getTable().getSelection();
      for (int i=0; i < items.length; i++) {
        input.remove(items[i].getData());
      }
      viewer.setInput(input);
      markDirty();
    }
  }
);
  deleteButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
  Button deleteAllButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  deleteAllButton.setToolTipText("String_Node_Str");
  deleteAllButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  deleteAllButton.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){
      List<Line> items=(List<Line>)viewer.getInput();
      items.clear();
      viewer.refresh();
      markDirty();
    }
  }
);
  deleteAllButton.setImage(ImageCache.getCreatedImage(EImage.PROGRESS_REMALL.getPath()));
  upButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  upButton.setToolTipText("String_Node_Str");
  upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
  upButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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.setToolTipText("String_Node_Str");
  downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
  downButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  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();
      }
    }
  }
);
  copyButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  copyButton.setToolTipText("String_Node_Str");
  copyButton.setImage(ImageCache.getCreatedImage(EImage.COPY.getPath()));
  copyButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  copyButton.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      int[] indexs=viewer.getTable().getSelectionIndices();
      List<Line> copyLines=new ArrayList<Line>();
      for (      int index : indexs) {
        if (index >= 0 && index <= viewer.getTable().getItemCount() - 1) {
          List<Line> items=(List<Line>)viewer.getInput();
          Line line=items.get(index);
          Line copyLine=line.clone();
          copyLines.add(copyLine);
        }
      }
      if (indexs.length > 0) {
        HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
        if (btns != null)         for (        Button btn : btns) {
          if (btn != null)           btn.setEnabled(true);
        }
        WorkbenchClipboard.getWorkbenchClipboard().setLines(String.valueOf(columns.size()),copyLines);
      }
    }
  }
);
  pastButton=toolkit.createButton(stepUpDownComposite,"String_Node_Str",SWT.PUSH | SWT.CENTER);
  pastButton.setToolTipText("String_Node_Str");
  pastButton.setImage(ImageCache.getCreatedImage(EImage.PASTE.getPath()));
  pastButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,false,1,1));
  pastButton.setEnabled(false);
  pastButton.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){
      if (mainPage != null) {
        mainPage.setComitting(true);
      }
      boolean dirty=false;
      List<Line> items=(List<Line>)viewer.getInput();
      List<Line> cacheLine=WorkbenchClipboard.getWorkbenchClipboard().getLines(String.valueOf(columns.size()));
      List<Line> coloneLine=new ArrayList<Line>();
      for (      Line l : cacheLine) {
        coloneLine.add(l.clone());
      }
      if (cacheLine.size() > 0) {
        items.addAll(coloneLine);
        dirty=true;
      }
      viewer.refresh();
      if (mainPage != null) {
        mainPage.setComitting(false);
      }
      if (dirty)       markDirty();
    }
  }
);
  HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
  if (btns == null) {
    btns=new HashSet<Button>();
    pastBtns.put(String.valueOf(columns.size()),btns);
  }
  btns.add(pastButton);
  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]=createValidationRuleEditor();
      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 (columnIndex >= 0 && columnIndex < viewer.getColumnProperties().length) {
        if (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();
    }
  }
);
  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();
      }
    }
  }
);
  viewer.getTable().addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      HashSet<Button> btns=pastBtns.get(String.valueOf(columns.size()));
      btns.remove(pastButton);
    }
  }
);
}