/** Rebuild column list according to selected fetchers */ public void handleUpdateOfSelectedFetchers(FetcherRegistry fetcherRegistry) { // remove all items (otherwise they will be shown incorrectly) removeAll(); // remove all columns TableColumn[] columns = getColumns(); for (int i = 0; i < columns.length; i++) { columns[i].dispose(); } // add the new selected columns back for (Fetcher fetcher : fetcherRegistry.getSelectedFetchers()) { TableColumn tableColumn = new TableColumn(this, SWT.NONE); tableColumn.setWidth(guiConfig.getColumnWidth(fetcher)); tableColumn.setData(fetcher); // this is used in some listeners in ColumnsActions tableColumn.addListener(SWT.Selection, columnClickListener); tableColumn.addListener(SWT.Resize, columnResizeListener); } updateColumnNames(); }
public void updateColumnNames() { int i = 0; for (Fetcher fetcher : fetcherRegistry.getSelectedFetchers()) { getColumn(i++).setText(fetcher.getFullName()); } }