private void createColumns(CTable customTable) {
/* Score Column */
TableViewerColumn col = new TableViewerColumn(fResultViewer, SWT.CENTER);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FIXED, 24), null, null, true, false);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.SCORE);
col.getColumn().setToolTipText("Relevance");
if (fInitialSortColumn == NewsTableControl.Columns.SCORE) {
customTable.getControl().setSortColumn(col.getColumn());
}
/* Headline Column */
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FILL, 60), "Title", null, true, true);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.TITLE);
if (fInitialSortColumn == NewsTableControl.Columns.TITLE) {
customTable.getControl().setSortColumn(col.getColumn());
customTable.getControl().setSortDirection(fInitialAscending ? SWT.UP : SWT.DOWN);
}
/* Feed Column */
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FIXED, Application.IS_LINUX ? 20 : 18), null, null, true, false);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.FEED);
col.getColumn().setToolTipText("Feed");
if (fInitialSortColumn == NewsTableControl.Columns.FEED) {
customTable.getControl().setSortColumn(col.getColumn());
customTable.getControl().setSortDirection(fInitialAscending ? SWT.UP : SWT.DOWN);
}
/* Date Column */
int width = getInitialDateColumnWidth();
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FIXED, width), "Date", null, true, true);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.DATE);
if (fInitialSortColumn == NewsTableControl.Columns.DATE) {
customTable.getControl().setSortColumn(col.getColumn());
customTable.getControl().setSortDirection(fInitialAscending ? SWT.UP : SWT.DOWN);
}
/* Author Column */
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FILL, 20), "Author", null, true, true);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.AUTHOR);
if (fInitialSortColumn == NewsTableControl.Columns.AUTHOR) {
customTable.getControl().setSortColumn(col.getColumn());
customTable.getControl().setSortDirection(fInitialAscending ? SWT.UP : SWT.DOWN);
}
/* Category Column */
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FILL, 20), "Category", null, true, true);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.CATEGORY);
if (fInitialSortColumn == NewsTableControl.Columns.CATEGORY) {
customTable.getControl().setSortColumn(col.getColumn());
customTable.getControl().setSortDirection(fInitialAscending ? SWT.UP : SWT.DOWN);
}
/* Sticky Column */
col = new TableViewerColumn(fResultViewer, SWT.LEFT);
customTable.manageColumn(col.getColumn(), new CColumnLayoutData(CColumnLayoutData.Size.FIXED, 18), null, null, true, false);
col.getColumn().setData(COL_ID, NewsTableControl.Columns.STICKY);
col.getColumn().setToolTipText("Sticky State");
/* Register Listener to remember Column Order */
TableColumn[] columns = fResultViewer.getTable().getColumns();