Program: 123068
Project: 123068
Buggy source:
private void createButtonField(Composite parent){
  Composite btnComposite=new Composite(parent,SWT.NONE);
  btnComposite.setLayout(new GridLayout());
  GridData layoutData=new GridData(GridData.FILL_VERTICAL);
  layoutData.verticalAlignment=SWT.CENTER;
  btnComposite.setLayoutData(layoutData);
  addBtn=new Button(btnComposite,SWT.PUSH);
  addBtn.setImage(ImageProvider.getImage(EImage.ADD_ICON));
  addBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ListViewer currentViewer=getCurrentViewer();
      if (currentViewer == null) {
        return;
      }
      boolean system=(currentViewer == systemViewer);
      List<RoutineItemRecord> currentRecords=getCurrentRecords();
      ShowRoutineItemsDialog dialog=new ShowRoutineItemsDialog(getShell(),allRoutineItems,currentRecords,system);
      if (dialog.open() == Window.OK) {
        Property[] selectedItems=dialog.getSelectedItems();
        List<Property> needAddedItems=new ArrayList<Property>();
        for (        Property p : selectedItems) {
          boolean found=false;
          for (          RoutineItemRecord record : currentRecords) {
            if (system) {
              found=p.getLabel().equals(record.getLabel());
            }
 else {
              found=p.getId().equals(record.getId());
            }
          }
          if (!found) {
            needAddedItems.add(p);
          }
        }
        for (        Property p : needAddedItems) {
          RoutineItemRecord newOne=new RoutineItemRecord();
          newOne.setId(p.getId());
          newOne.setLabel(p.getLabel());
          newOne.setName(p.getLabel());
          newOne.setVersion(p.getVersion());
          currentRecords.add(newOne);
        }
        currentViewer.setInput(currentRecords);
        currentViewer.refresh();
        updateButtons();
      }
    }
  }
);
  delBtn=new Button(btnComposite,SWT.PUSH);
  delBtn.setImage(ImageProvider.getImage(EImage.DELETE_ICON));
  delBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      ListViewer currentViewer=getCurrentViewer();
      List<RoutineItemRecord> currentRecords=getCurrentRecords();
      if (currentViewer != null && !((IStructuredSelection)currentViewer.getSelection()).isEmpty()) {
        Iterator iterator=((IStructuredSelection)currentViewer.getSelection()).iterator();
        int index=0;
        while (iterator.hasNext()) {
          Object selectedRecord=iterator.next();
          if (currentRecords != null && selectedRecord != null) {
            index=currentRecords.indexOf(selectedRecord);
            currentRecords.remove(selectedRecord);
            if (index > currentRecords.size() - 1) {
              index=currentRecords.size() - 1;
            }
 else             if (index < 0) {
              index=0;
            }
          }
        }
        currentViewer.setInput(currentRecords);
        currentViewer.getList().select(index);
        currentViewer.refresh();
      }
      updateButtons();
    }
  }
);
  upBtn=new Button(btnComposite,SWT.PUSH);
  upBtn.setImage(ImageProvider.getImage(EImage.UP_ICON));
  upBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      moveDatas(true);
    }
  }
);
  downBtn=new Button(btnComposite,SWT.PUSH);
  downBtn.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
  downBtn.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      moveDatas(false);
    }
  }
);
}

Fixed version (ground truth):
private void createButtonField(Composite parent){
  Composite btnComposite=new Composite(parent,SWT.NONE);
  btnComposite.setLayout(new GridLayout());
  GridData layoutData=new GridData(GridData.FILL_VERTICAL);
  layoutData.verticalAlignment=SWT.CENTER;
  btnComposite.setLayoutData(layoutData);
  addBtn=new Button(btnComposite,SWT.PUSH);
  addBtn.setImage(ImageProvider.getImage(EImage.ADD_ICON));
  addBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ListViewer currentViewer=getCurrentViewer();
      if (currentViewer == null) {
        return;
      }
      boolean system=(currentViewer == systemViewer);
      List<RoutineItemRecord> currentRecords=getCurrentRecords();
      ShowRoutineItemsDialog dialog=new ShowRoutineItemsDialog(getShell(),allRoutineItems,currentRecords,system);
      if (dialog.open() == Window.OK) {
        Property[] selectedItems=dialog.getSelectedItems();
        List<Property> needAddedItems=new ArrayList<Property>();
        for (        Property p : selectedItems) {
          boolean found=false;
          for (          RoutineItemRecord record : currentRecords) {
            if (system) {
              found=p.getLabel().equals(record.getLabel());
            }
 else {
              found=p.getId().equals(record.getId());
            }
          }
          if (!found) {
            needAddedItems.add(p);
          }
        }
        for (        Property p : needAddedItems) {
          RoutineItemRecord newOne=new RoutineItemRecord();
          newOne.setId(p.getId());
          newOne.setLabel(p.getLabel());
          newOne.setName(p.getLabel());
          newOne.setVersion(p.getVersion());
          currentRecords.add(newOne);
        }
        currentViewer.setInput(currentRecords);
        currentViewer.refresh();
        updateButtons();
      }
    }
  }
);
  delBtn=new Button(btnComposite,SWT.PUSH);
  delBtn.setImage(ImageProvider.getImage(EImage.DELETE_ICON));
  delBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ListViewer currentViewer=getCurrentViewer();
      List<RoutineItemRecord> currentRecords=getCurrentRecords();
      if (currentViewer != null && !((IStructuredSelection)currentViewer.getSelection()).isEmpty()) {
        Iterator iterator=((IStructuredSelection)currentViewer.getSelection()).iterator();
        int index=0;
        while (iterator.hasNext()) {
          Object selectedRecord=iterator.next();
          if (currentRecords != null && selectedRecord != null) {
            index=currentRecords.indexOf(selectedRecord);
            currentRecords.remove(selectedRecord);
            if (index > currentRecords.size() - 1) {
              index=currentRecords.size() - 1;
            }
 else             if (index < 0) {
              index=0;
            }
          }
        }
        currentViewer.setInput(currentRecords);
        currentViewer.getList().select(index);
        currentViewer.refresh();
      }
      updateButtons();
    }
  }
);
  upBtn=new Button(btnComposite,SWT.PUSH);
  upBtn.setImage(ImageProvider.getImage(EImage.UP_ICON));
  upBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveDatas(true);
    }
  }
);
  downBtn=new Button(btnComposite,SWT.PUSH);
  downBtn.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
  downBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      moveDatas(false);
    }
  }
);
}