Program: 52745
Project: 52745
Buggy source:
protected void createBottomTable(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  TableColumnLayout layout=new TableColumnLayout();
  container.setLayout(layout);
  transactions=new TableViewer(container,SWT.FULL_SELECTION);
  ColumnEditingSupport.prepare(transactions);
  transactionsColumns=new ShowHideColumnHelper(AccountListView.class.getSimpleName() + "String_Node_Str",getPreferenceStore(),transactions,layout);
  Column column=new Column(Messages.ColumnDate,SWT.None,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return Values.Date.format(t.getDate());
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str").attachTo(column,SWT.DOWN);
  new DateEditingSupport(AccountTransaction.class,"String_Node_Str").addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnTransactionType,SWT.None,100);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getType().toString();
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnAmount,SWT.RIGHT,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      long v=t.getAmount();
      if (EnumSet.of(Type.REMOVAL,Type.FEES,Type.TAXES,Type.BUY,Type.TRANSFER_OUT).contains(t.getType()))       v=-v;
      return Values.Amount.format(v);
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  new ValueEditingSupport(AccountTransaction.class,"String_Node_Str",Values.Amount).addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnSecurity,SWT.None,250);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getSecurity() != null ? String.valueOf(t.getSecurity()) : null;
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  List<Security> securities=new ArrayList<Security>(getClient().getSecurities());
  Collections.sort(securities,new Security.ByName());
  new ListEditingSupport(AccountTransaction.class,"String_Node_Str",securities){
    @Override public boolean canEdit(    Object element){
      AccountTransaction t=(AccountTransaction)element;
      return t.getType() == AccountTransaction.Type.BUY || t.getType() == AccountTransaction.Type.SELL || t.getType() == AccountTransaction.Type.DIVIDENDS;
    }
  }
.addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnShares,SWT.RIGHT,80);
  column.setLabelProvider(new SharesLabelProvider(){
    @Override public Long getValue(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      if (t.getCrossEntry() instanceof BuySellEntry) {
        return ((BuySellEntry)t.getCrossEntry()).getPortfolioTransaction().getShares();
      }
 else       if (t.getType() == Type.DIVIDENDS && t.getShares() != 0) {
        return t.getShares();
      }
 else {
        return null;
      }
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  new ValueEditingSupport(AccountTransaction.class,"String_Node_Str",Values.Share){
    @Override public boolean canEdit(    Object element){
      AccountTransaction t=(AccountTransaction)element;
      return t.getType() == AccountTransaction.Type.DIVIDENDS;
    }
  }
.addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnPurchasePrice,SWT.RIGHT,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      if (t.getCrossEntry() instanceof BuySellEntry) {
        PortfolioTransaction portfolioTransaction=((BuySellEntry)t.getCrossEntry()).getPortfolioTransaction();
        return Values.Amount.format(portfolioTransaction.getActualPurchasePrice());
      }
 else       if (t.getType() == Type.DIVIDENDS && t.getShares() != 0) {
        return Values.Amount.format(Math.round(t.getAmount() * Values.Share.divider() / t.getShares()));
      }
 else {
        return null;
      }
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnOffsetAccount,SWT.None,120);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getCrossEntry() != null ? t.getCrossEntry().getCrossEntity(t).toString() : null;
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnNote,SWT.None,200);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      return ((AccountTransaction)e).getNote();
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
    @Override public Image getImage(    Object e){
      String note=((AccountTransaction)e).getNote();
      return note != null && note.length() > 0 ? PortfolioPlugin.image(PortfolioPlugin.IMG_NOTE) : null;
    }
  }
);
  ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str").attachTo(column);
  new StringEditingSupport(AccountTransaction.class,"String_Node_Str").addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  transactionsColumns.createColumns();
  transactions.getTable().setHeaderVisible(true);
  transactions.getTable().setLinesVisible(true);
  transactions.setContentProvider(new SimpleListContentProvider());
  hookContextMenu(transactions.getTable(),new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      fillTransactionsContextMenu(manager);
    }
  }
);
  if (!getClient().getAccounts().isEmpty())   accounts.setSelection(new StructuredSelection(accounts.getElementAt(0)),true);
  if (!transactionsColumns.isUserConfigured())   ViewerHelper.pack(transactions);
}

Fixed version (ground truth):
protected void createBottomTable(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  TableColumnLayout layout=new TableColumnLayout();
  container.setLayout(layout);
  transactions=new TableViewer(container,SWT.FULL_SELECTION);
  ColumnEditingSupport.prepare(transactions);
  transactionsColumns=new ShowHideColumnHelper(AccountListView.class.getSimpleName() + "String_Node_Str",getPreferenceStore(),transactions,layout);
  Column column=new Column(Messages.ColumnDate,SWT.None,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return Values.Date.format(t.getDate());
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str").attachTo(column,SWT.DOWN);
  new DateEditingSupport(AccountTransaction.class,"String_Node_Str").addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnTransactionType,SWT.None,100);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getType().toString();
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnAmount,SWT.RIGHT,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      long v=t.getAmount();
      if (EnumSet.of(Type.REMOVAL,Type.FEES,Type.TAXES,Type.BUY,Type.TRANSFER_OUT).contains(t.getType()))       v=-v;
      return Values.Amount.format(v);
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  new ValueEditingSupport(AccountTransaction.class,"String_Node_Str",Values.Amount).addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnSecurity,SWT.None,250);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getSecurity() != null ? String.valueOf(t.getSecurity()) : null;
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  column.setSorter(ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str"));
  List<Security> securities=new ArrayList<Security>(getClient().getSecurities());
  Collections.sort(securities,new Security.ByName());
  new ListEditingSupport(AccountTransaction.class,"String_Node_Str",securities){
    @Override public boolean canEdit(    Object element){
      AccountTransaction t=(AccountTransaction)element;
      return t.getType() == AccountTransaction.Type.BUY || t.getType() == AccountTransaction.Type.SELL || t.getType() == AccountTransaction.Type.DIVIDENDS;
    }
  }
.addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnShares,SWT.RIGHT,80);
  column.setLabelProvider(new SharesLabelProvider(){
    @Override public Long getValue(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      if (t.getCrossEntry() instanceof BuySellEntry) {
        return ((BuySellEntry)t.getCrossEntry()).getPortfolioTransaction().getShares();
      }
 else       if (t.getType() == Type.DIVIDENDS && t.getShares() != 0) {
        return t.getShares();
      }
 else {
        return null;
      }
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  new ValueEditingSupport(AccountTransaction.class,"String_Node_Str",Values.Share){
    @Override public boolean canEdit(    Object element){
      AccountTransaction t=(AccountTransaction)element;
      return t.getType() == AccountTransaction.Type.DIVIDENDS;
    }
  }
.addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnPurchasePrice,SWT.RIGHT,80);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      if (t.getCrossEntry() instanceof BuySellEntry) {
        PortfolioTransaction portfolioTransaction=((BuySellEntry)t.getCrossEntry()).getPortfolioTransaction();
        return Values.Amount.format(portfolioTransaction.getActualPurchasePrice());
      }
 else       if (t.getType() == Type.DIVIDENDS && t.getShares() != 0) {
        return Values.Amount.format(Math.round(t.getAmount() * Values.Share.divider() / t.getShares()));
      }
 else {
        return null;
      }
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnOffsetAccount,SWT.None,120);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      AccountTransaction t=(AccountTransaction)e;
      return t.getCrossEntry() != null ? t.getCrossEntry().getCrossEntity(t).toString() : null;
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
  }
);
  transactionsColumns.addColumn(column);
  column=new Column(Messages.ColumnNote,SWT.None,200);
  column.setLabelProvider(new ColumnLabelProvider(){
    @Override public String getText(    Object e){
      return ((AccountTransaction)e).getNote();
    }
    @Override public Color getForeground(    Object element){
      return colorFor((AccountTransaction)element);
    }
    @Override public Image getImage(    Object e){
      String note=((AccountTransaction)e).getNote();
      return note != null && note.length() > 0 ? PortfolioPlugin.image(PortfolioPlugin.IMG_NOTE) : null;
    }
  }
);
  ColumnViewerSorter.create(AccountTransaction.class,"String_Node_Str").attachTo(column);
  new StringEditingSupport(AccountTransaction.class,"String_Node_Str").addListener(this).attachTo(column);
  transactionsColumns.addColumn(column);
  transactionsColumns.createColumns();
  transactions.getTable().setHeaderVisible(true);
  transactions.getTable().setLinesVisible(true);
  transactions.setContentProvider(new SimpleListContentProvider());
  hookContextMenu(transactions.getTable(),new IMenuListener(){
    public void menuAboutToShow(    IMenuManager manager){
      fillTransactionsContextMenu(manager);
    }
  }
);
  if (!getClient().getAccounts().isEmpty())   accounts.setSelection(new StructuredSelection(accounts.getElementAt(0)),true);
  ViewerHelper.pack(transactions);
}