private void preselectDropDowns() {
    // idea: generally one type of document (i.e. from the same bank) will
    // be imported into the same account

    List<Account> activeAccounts = client.getActiveAccounts();
    if (!activeAccounts.isEmpty()) {
      String uuid =
          preferences.getString(IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName());

      // do not trigger selection listener (-> do not user #setSelection)
      primaryAccount
          .getCombo()
          .select(
              IntStream.range(0, activeAccounts.size())
                  .filter(i -> activeAccounts.get(i).getUUID().equals(uuid))
                  .findAny()
                  .orElse(0));
      secondaryAccount.getCombo().select(0);
    }

    List<Portfolio> activePortfolios = client.getActivePortfolios();
    if (!activePortfolios.isEmpty()) {
      String uuid =
          preferences.getString(IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName());
      // do not trigger selection listener (-> do not user #setSelection)
      primaryPortfolio
          .getCombo()
          .select(
              IntStream.range(0, activePortfolios.size())
                  .filter(i -> activePortfolios.get(i).getUUID().equals(uuid))
                  .findAny()
                  .orElse(0));
      secondaryPortfolio.getCombo().select(0);
    }
  }
示例#2
0
  @Test
  public void testIndexWhenNoQuotesExist() {
    DateMidnight startDate = new DateMidnight(2012, 12, 31);
    DateMidnight endDate = new DateMidnight(2013, 3, 31);

    // create model

    Client client = new Client();

    new AccountBuilder() //
        .deposit_(startDate, 100 * Values.Amount.factor()) //
        .addTo(client);

    Security security = new Security();
    client.addSecurity(security);

    // calculate performance indices

    List<Exception> warnings = new ArrayList<Exception>();

    ReportingPeriod reportInterval =
        new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
    ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
    PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

    // asserts

    assertTrue(warnings.isEmpty());
    assertThat(securityIndex.getDates().length, is(1));
    assertThat(securityIndex.getDates()[0], is(clientIndex.getFirstDataPoint().get().toDate()));
  }
  @Test
  public void testErtragsgutschriftWhenSecurityExists() throws IOException {
    Client client = new Client();
    Security security = new Security("BASF", "DE000BASF111", null, null);
    client.addSecurity(security);

    DeutscheBankPDFExctractor extractor =
        new DeutscheBankPDFExctractor(client) {
          @Override
          String strip(File file) throws IOException {
            return from("DeutscheBankErtragsgutschrift.txt");
          }
        };
    List<Exception> errors = new ArrayList<Exception>();

    List<Item> results = extractor.extract(Arrays.asList(new File("t")), errors);

    assertThat(errors, empty());
    assertThat(results.size(), is(1));
    new AssertImportActions().check(results, CurrencyUnit.EUR);

    // check transaction
    AccountTransaction transaction = (AccountTransaction) results.get(0).getSubject();
    assertThat(transaction.getType(), is(AccountTransaction.Type.DIVIDENDS));
    assertThat(transaction.getSecurity(), is(security));
  }
示例#4
0
 @Before
 public void setupClient() {
   client = new Client();
   account = new Account();
   client.addAccount(account);
   portfolio = new Portfolio();
   client.addPortfolio(portfolio);
   security = new Security();
   client.addSecurity(security);
 }
  public static SecurityPerformanceSnapshot create(
      Client client, CurrencyConverter converter, ReportingPeriod period) {
    Map<Security, SecurityPerformanceRecord> transactions = initRecords(client);

    for (Account account : client.getAccounts())
      extractSecurityRelatedAccountTransactions(account, period, transactions);
    for (Portfolio portfolio : client.getPortfolios()) {
      extractSecurityRelatedPortfolioTransactions(portfolio, period, transactions);
      addPseudoValuationTansactions(portfolio, converter, period, transactions);
    }

    return doCreateSnapshot(client, converter, transactions, period);
  }
示例#6
0
 private static void collectAccountTransactions(
     Client client, Date start, Date end, List<Transaction> transactions) {
   for (Account account : client.getAccounts()) {
     for (AccountTransaction t : account.getTransactions()) {
       if (t.getDate().getTime() > start.getTime() && t.getDate().getTime() <= end.getTime()) {
         switch (t.getType()) {
           case DEPOSIT:
           case REMOVAL:
           case TRANSFER_IN:
           case TRANSFER_OUT:
             transactions.add(t);
             break;
           case BUY:
           case SELL:
           case FEES:
           case TAXES:
           case DIVIDENDS:
           case INTEREST:
           case TAX_REFUND:
             break;
           default:
             throw new UnsupportedOperationException();
         }
       }
     }
   }
 }
  private static Map<Security, SecurityPerformanceRecord> initRecords(Client client) {
    Map<Security, SecurityPerformanceRecord> records =
        new HashMap<Security, SecurityPerformanceRecord>();

    for (Security s : client.getSecurities()) records.put(s, new SecurityPerformanceRecord(s));
    return records;
  }
示例#8
0
  public static ClientSnapshot create(Client client, Date time) {
    ClientSnapshot snapshot = new ClientSnapshot(client, time);

    for (Account account : client.getAccounts())
      snapshot.accounts.add(AccountSnapshot.create(account, time));

    for (Portfolio portfolio : client.getPortfolios())
      snapshot.portfolios.add(PortfolioSnapshot.create(portfolio, time));

    if (snapshot.portfolios.isEmpty())
      snapshot.jointPortfolio = PortfolioSnapshot.create(new Portfolio(), time);
    else if (snapshot.portfolios.size() == 1) snapshot.jointPortfolio = snapshot.portfolios.get(0);
    else snapshot.jointPortfolio = PortfolioSnapshot.merge(snapshot.portfolios);

    return snapshot;
  }
示例#9
0
  @Test
  public void testThatSecurityIndexIsCalculated() {
    DateMidnight startDate = new DateMidnight(2012, 12, 31);
    DateMidnight endDate = new DateMidnight(2013, 4, 1);
    long startPrice = 100 * Values.Amount.factor();

    // create model

    Client client = new Client();

    Account account = new Account();
    client.addAccount(account);
    addT(account, startDate.toCalendar(Locale.getDefault()), Type.DEPOSIT, startPrice);

    Security security = new Security();
    client.addSecurity(security);

    generatePrices(security, startPrice, startDate, endDate);

    // calculate performance indices

    List<Exception> warnings = new ArrayList<Exception>();

    ReportingPeriod reportInterval =
        new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
    ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
    PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

    // asserts

    assertTrue(warnings.isEmpty());

    Date[] dates = securityIndex.getDates();
    assertThat(dates[0], is(startDate.toDate()));
    assertThat(dates[dates.length - 1], is(endDate.toDate()));

    long lastPrice = security.getSecurityPrice(endDate.toDate()).getValue();
    double performance = (double) (lastPrice - startPrice) / (double) startPrice;

    double[] accumulated = securityIndex.getAccumulatedPercentage();
    assertThat(accumulated[0], is(0d));
    assertThat(accumulated[accumulated.length - 1], IsCloseTo.closeTo(performance, 0.000001d));
  }
示例#10
0
  @Test
  public void testVolatilityIfSecurityIsSoldAndLaterBoughtDuringReportingPeriod()
      throws IOException {
    ReportingPeriod report =
        new ReportingPeriod.FromXtoY(Dates.date("2014-01-31"), Dates.date("2015-02-20"));
    List<Exception> warnings = new ArrayList<>();

    Security basf =
        client.getSecurities().stream().filter(s -> "Basf SE".equals(s.getName())).findAny().get();
    PerformanceIndex index = PerformanceIndex.forInvestment(client, basf, report, warnings);

    assertThat(warnings, empty());
    assertThat(
        index.getVolatility().getStandardDeviation(),
        closeTo(0.0134468200485513, 0.00001)); // excel
    assertThat(index.getDates()[index.getDates().length - 1], is(Dates.date("2015-02-20")));
  }
示例#11
0
  @Test
  public void testThatNotTheSamePortfolioIsMatched() {
    Portfolio second = new Portfolio();
    client.addPortfolio(second);

    portfolio.addTransaction(
        new PortfolioTransaction(
            Dates.today(),
            security, //
            PortfolioTransaction.Type.TRANSFER_IN,
            1,
            3,
            1));

    PortfolioTransaction umatched =
        new PortfolioTransaction(
            Dates.today(),
            security, //
            PortfolioTransaction.Type.TRANSFER_OUT,
            1,
            3,
            1);
    portfolio.addTransaction(umatched);

    second.addTransaction(
        new PortfolioTransaction(
            Dates.today(),
            security, //
            PortfolioTransaction.Type.TRANSFER_OUT,
            1,
            3,
            1));

    List<Issue> issues = new CrossEntryCheck().execute(client);

    assertThat(issues.size(), is(1));
    assertThat(issues.get(0), is(MissingPortfolioTransferIssue.class));

    assertThat(portfolio.getTransactions(), hasItem(umatched));
    assertThat(second.getTransactions().get(0).getCrossEntry(), notNullValue());
    assertThat(
        second.getTransactions().get(0).getType(), is(PortfolioTransaction.Type.TRANSFER_OUT));

    applyFixes(client, issues);
  }
示例#12
0
  @Override
  public boolean performFinish() {
    Object exportItem = exportPage.getExportItem();
    Class<?> exportClass = exportPage.getExportClass();

    File file = getFile(exportItem);

    try {
      // account transactions
      if (exportItem == AccountTransaction.class) {
        new CSVExporter().exportAccountTransactions(file, client.getAccounts());
      } else if (exportClass == AccountTransaction.class) {
        new CSVExporter().exportAccountTransactions(file, (Account) exportItem);
      }

      // portfolio transactions
      else if (exportItem == PortfolioTransaction.class) {
        new CSVExporter().exportPortfolioTransactions(file, client.getPortfolios());
      } else if (exportClass == PortfolioTransaction.class) {
        new CSVExporter().exportPortfolioTransactions(file, (Portfolio) exportItem);
      }

      // master data
      else if (exportItem == Security.class) {
        new CSVExporter()
            .exportSecurityMasterData(
                new File(file, Messages.ExportWizardSecurityMasterData + ".csv"),
                client.getSecurities()); // $NON-NLS-1$
      } else if (exportClass == Security.class) {
        if (Messages.ExportWizardSecurityMasterData.equals(exportItem))
          new CSVExporter().exportSecurityMasterData(file, client.getSecurities());
        else if (Messages.ExportWizardMergedSecurityPrices.equals(exportItem))
          new CSVExporter().exportMergedSecurityPrices(file, client.getSecurities());
      }

      // historical quotes
      else if (exportItem == SecurityPrice.class) {
        new CSVExporter().exportSecurityPrices(file, client.getSecurities());
      } else if (exportClass == SecurityPrice.class) {
        new CSVExporter().exportSecurityPrices(file, (Security) exportItem);
      } else {
        throw new UnsupportedOperationException(
            MessageFormat.format(Messages.ExportWizardUnsupportedExport, exportClass, exportItem));
      }
    } catch (IOException e) {
      PortfolioPlugin.log(e);
      MessageDialog.openError(getShell(), Messages.ExportWizardErrorExporting, e.getMessage());
    }

    return true;
  }
示例#13
0
  @Test
  public void testVolatilityIfBenchmarkHasNoQuotes() throws IOException {
    ReportingPeriod report =
        new ReportingPeriod.FromXtoY(Dates.date("2014-01-31"), Dates.date("2015-01-31"));
    List<Exception> warnings = new ArrayList<>();

    PerformanceIndex index = PerformanceIndex.forClient(client, report, warnings);

    Security sap =
        client.getSecurities().stream().filter(s -> "Sap AG".equals(s.getName())).findAny().get();
    PerformanceIndex sapIndex = PerformanceIndex.forSecurity(index, sap, warnings);

    assertThat(warnings, empty());
    // quotes only until December 31st
    assertThat(sapIndex.getDates()[sapIndex.getDates().length - 1], is(Dates.date("2014-12-31")));
    assertThat(
        sapIndex.getVolatility().getStandardDeviation(),
        closeTo(0.0126152529671108, 0.00001)); // excel
  }
示例#14
0
  @Test
  public void testThatAccountTransactionsWithoutSecurity() {
    Portfolio second = new Portfolio();
    client.addPortfolio(second);

    account.addTransaction(
        new AccountTransaction(
            Dates.today(),
            null, //
            AccountTransaction.Type.BUY,
            1));

    List<Issue> issues = new CrossEntryCheck().execute(client);

    assertThat(issues.size(), is(1));
    assertThat(issues.get(0).getAvailableFixes().get(0), is(DeleteTransactionFix.class));

    applyFixes(client, issues);

    ClientSnapshot.create(client, Dates.today());
  }
示例#15
0
  @Test
  public void testVolatilityIfSecurityIsSoldDuringReportingPeriod() throws IOException {
    ReportingPeriod report =
        new ReportingPeriod.FromXtoY(Dates.date("2014-01-31"), Dates.date("2015-01-31"));
    List<Exception> warnings = new ArrayList<>();

    Security basf =
        client.getSecurities().stream().filter(s -> "Basf SE".equals(s.getName())).findAny().get();
    PerformanceIndex index = PerformanceIndex.forInvestment(client, basf, report, warnings);

    assertThat(warnings, empty());
    assertThat(
        index.getVolatility().getStandardDeviation(), closeTo(0.01371839502, 0.00001)); // excel
    assertThat(index.getDates()[index.getDates().length - 1], is(Dates.date("2015-01-31")));

    // compare with client -> must be lower because cash has volatility of 0
    PerformanceIndex clientIndex = PerformanceIndex.forClient(client, report, warnings);
    assertThat(
        clientIndex.getVolatility().getStandardDeviation(),
        lessThan(index.getVolatility().getStandardDeviation()));
  }
示例#16
0
 private static void collectPortfolioTransactions(
     Client client, Date start, Date end, List<Transaction> transactions) {
   for (Portfolio portfolio : client.getPortfolios()) {
     for (PortfolioTransaction t : portfolio.getTransactions()) {
       if (t.getDate().getTime() > start.getTime() && t.getDate().getTime() <= end.getTime()) {
         switch (t.getType()) {
           case TRANSFER_IN:
           case TRANSFER_OUT:
           case DELIVERY_INBOUND:
           case DELIVERY_OUTBOUND:
             transactions.add(t);
             break;
           case BUY:
           case SELL:
             break;
           default:
             throw new UnsupportedOperationException();
         }
       }
     }
   }
 }
示例#17
0
  @Test
  public void testThatNotTheSameAccountIsMatched() {
    Account second = new Account();
    client.addAccount(second);

    account.addTransaction(
        new AccountTransaction(
            Dates.today(),
            security, //
            AccountTransaction.Type.TRANSFER_IN,
            2));

    AccountTransaction umatched =
        new AccountTransaction(
            Dates.today(),
            security, //
            AccountTransaction.Type.TRANSFER_OUT,
            2);
    account.addTransaction(umatched);

    second.addTransaction(
        new AccountTransaction(
            Dates.today(),
            security, //
            AccountTransaction.Type.TRANSFER_OUT,
            2));

    List<Issue> issues = new CrossEntryCheck().execute(client);

    assertThat(issues.size(), is(1));
    assertThat(issues.get(0), is(MissingAccountTransferIssue.class));

    assertThat(account.getTransactions(), hasItem(umatched));
    assertThat(second.getTransactions().get(0).getCrossEntry(), notNullValue());
    assertThat(second.getTransactions().get(0).getType(), is(AccountTransaction.Type.TRANSFER_OUT));

    applyFixes(client, issues);
  }
示例#18
0
 public UpdateQuotesJob(Client client, boolean includeHistoricQuotes, long repeatPeriod) {
   this(client, client.getSecurities(), includeHistoricQuotes, repeatPeriod);
 }
示例#19
0
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);

    Label lblAcc = new Label(container, SWT.NULL);
    lblAcc.setText(Messages.ColumnAccount);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(lblAcc);

    final Text accountName = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(accountName);

    Button button = new Button(container, SWT.PUSH);
    button.setText(Messages.NewFileWizardButtonAdd);
    GridDataFactory.fillDefaults().applyTo(button);

    Composite tableContainer = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().span(3, 1).grab(true, true).applyTo(tableContainer);
    TableColumnLayout layout = new TableColumnLayout();
    tableContainer.setLayout(layout);

    tViewer = new TableViewer(tableContainer);

    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            String acnName = accountName.getText();
            if (acnName.length() > 0) {
              Account currentAccount = new Account();
              currentAccount.setName(acnName);
              client.addAccount(currentAccount);
              tViewer.refresh();

              accountName.setText(""); // $NON-NLS-1$
              accountName.setFocus();
            }
          }
        });

    Table table = tViewer.getTable();
    table.setHeaderVisible(true);
    table.setEnabled(false);

    tViewer.setContentProvider(ArrayContentProvider.getInstance());
    tViewer.setInput(client.getAccounts());
    TableViewerColumn aCol = new TableViewerColumn(tViewer, SWT.NONE);
    layout.setColumnData(aCol.getColumn(), new ColumnWeightData(50));
    aCol.getColumn().setText(Messages.ColumnAccount);
    aCol.setLabelProvider(
        new ColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            return ((Account) element).getName();
          }

          @Override
          public Image getImage(Object element) {
            return PortfolioPlugin.image(PortfolioPlugin.IMG_ACCOUNT);
          }
        });
    container.pack();
    setPageComplete(true);
  }
示例#20
0
 @Override
 public Status process(Security security) {
   // might have been added via a transaction
   if (!client.getSecurities().contains(security)) client.addSecurity(security);
   return Status.OK_STATUS;
 }
示例#21
0
  @Test
  public void testWhenQuotesAreOnlyAvailableFromTheMiddleOfTheReportInterval() {
    DateMidnight startDate = new DateMidnight(2012, 12, 31);
    DateMidnight middleDate = new DateMidnight(2013, 2, 18);
    DateMidnight endDate = new DateMidnight(2013, 4, 1);

    // create model

    Client client = new Client();

    Account account = new Account();
    client.addAccount(account);
    addT(
        account,
        startDate.toCalendar(Locale.getDefault()),
        Type.DEPOSIT,
        100 * Values.Amount.factor());
    addT(
        account,
        startDate.plusDays(10).toCalendar(Locale.getDefault()),
        Type.INTEREST,
        10 * Values.Amount.factor());

    Security security = new Security();
    client.addSecurity(security);

    generatePrices(security, 50 * Values.Amount.factor(), middleDate, endDate);

    // calculate performance indices

    List<Exception> warnings = new ArrayList<Exception>();

    ReportingPeriod reportInterval =
        new ReportingPeriod.FromXtoY(startDate.toDate(), endDate.toDate());
    ClientIndex clientIndex = PerformanceIndex.forClient(client, reportInterval, warnings);
    PerformanceIndex securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);

    // asserts

    assertTrue(warnings.isEmpty());

    Date[] clientDates = clientIndex.getDates();
    Date[] securityDates = securityIndex.getDates();

    assertThat(securityDates[0], is(middleDate.toDate()));
    assertThat(securityDates[securityDates.length - 1], is(endDate.toDate()));
    assertThat(
        new DateMidnight(clientDates[clientDates.length - 1]),
        is(new DateMidnight(securityDates[securityDates.length - 1])));

    double[] clientAccumulated = clientIndex.getAccumulatedPercentage();
    double[] securityAccumulated = securityIndex.getAccumulatedPercentage();

    int index = Days.daysBetween(startDate, middleDate).getDays();
    assertThat(new DateMidnight(clientDates[index]), is(middleDate));
    assertThat(securityAccumulated[0], IsCloseTo.closeTo(clientAccumulated[index], 0.000001d));

    long middlePrice = security.getSecurityPrice(middleDate.toDate()).getValue();
    long lastPrice = security.getSecurityPrice(endDate.toDate()).getValue();

    // 10% is interest of the deposit
    double performance = (double) (lastPrice - middlePrice) / (double) middlePrice + 0.1d;
    assertThat(
        securityAccumulated[securityAccumulated.length - 1],
        IsCloseTo.closeTo(performance, 0.000001d));
  }
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    container.setLayout(new FormLayout());

    Composite targetContainer = new Composite(container, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(4).applyTo(targetContainer);

    lblPrimaryAccount = new Label(targetContainer, SWT.NONE);
    lblPrimaryAccount.setText(Messages.ColumnAccount);
    Combo cmbAccount = new Combo(targetContainer, SWT.READ_ONLY);
    primaryAccount = new ComboViewer(cmbAccount);
    primaryAccount.setContentProvider(ArrayContentProvider.getInstance());
    primaryAccount.setInput(client.getActiveAccounts());
    primaryAccount.addSelectionChangedListener(e -> checkEntriesAndRefresh(allEntries));

    lblSecondaryAccount = new Label(targetContainer, SWT.NONE);
    lblSecondaryAccount.setText(Messages.LabelTransferTo);
    lblSecondaryAccount.setVisible(false);
    Combo cmbAccountTarget = new Combo(targetContainer, SWT.READ_ONLY);
    secondaryAccount = new ComboViewer(cmbAccountTarget);
    secondaryAccount.setContentProvider(ArrayContentProvider.getInstance());
    secondaryAccount.setInput(client.getActiveAccounts());
    secondaryAccount.getControl().setVisible(false);

    lblPrimaryPortfolio = new Label(targetContainer, SWT.NONE);
    lblPrimaryPortfolio.setText(Messages.ColumnPortfolio);
    Combo cmbPortfolio = new Combo(targetContainer, SWT.READ_ONLY);
    primaryPortfolio = new ComboViewer(cmbPortfolio);
    primaryPortfolio.setContentProvider(ArrayContentProvider.getInstance());
    primaryPortfolio.setInput(client.getActivePortfolios());
    primaryPortfolio.addSelectionChangedListener(e -> checkEntriesAndRefresh(allEntries));

    lblSecondaryPortfolio = new Label(targetContainer, SWT.NONE);
    lblSecondaryPortfolio.setText(Messages.LabelTransferTo);
    lblSecondaryPortfolio.setVisible(false);
    Combo cmbPortfolioTarget = new Combo(targetContainer, SWT.READ_ONLY);
    secondaryPortfolio = new ComboViewer(cmbPortfolioTarget);
    secondaryPortfolio.setContentProvider(ArrayContentProvider.getInstance());
    secondaryPortfolio.setInput(client.getActivePortfolios());
    secondaryPortfolio.getControl().setVisible(false);

    preselectDropDowns();

    cbConvertToDelivery = new Button(container, SWT.CHECK);
    cbConvertToDelivery.setText(Messages.LabelConvertBuySellIntoDeliveryTransactions);

    Composite compositeTable = new Composite(container, SWT.NONE);
    Composite errorTable = new Composite(container, SWT.NONE);

    //
    // form layout
    //

    FormDataFactory.startingWith(targetContainer) //
        .top(new FormAttachment(0, 0))
        .left(new FormAttachment(0, 0))
        .right(new FormAttachment(100, 0))
        .thenBelow(cbConvertToDelivery) //
        .thenBelow(compositeTable)
        .right(targetContainer)
        .bottom(new FormAttachment(70, 0)) //
        .thenBelow(errorTable)
        .right(targetContainer)
        .bottom(new FormAttachment(100, 0));

    //
    // table & columns
    //

    TableColumnLayout layout = new TableColumnLayout();
    compositeTable.setLayout(layout);

    tableViewer = new TableViewer(compositeTable, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    tableViewer.setContentProvider(new SimpleListContentProvider());

    Table table = tableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    addColumns(tableViewer, layout);
    attachContextMenu(table);

    layout = new TableColumnLayout();
    errorTable.setLayout(layout);
    errorTableViewer = new TableViewer(errorTable, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    errorTableViewer.setContentProvider(new SimpleListContentProvider());

    table = errorTableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    addColumnsExceptionTable(errorTableViewer, layout);
  }