Changes

Jump to: navigation, search

Teams Winter 2011/team1/RCP/Create RPC Application

1,143 bytes added, 13:28, 4 March 2011
no edit summary
}
</pre><br/>
4.2Add new private variable to <code>StudentsView</code> class:<br/><code>private StudentViewerComparator comparator;</code><br/>4.3 Add the following lines to the end of <code>createPartControl()</code> method:<br/> <pre> comparator = new StudentViewerComparator(); viewer.setComparator(comparator); </pre><br/>4.4 Add <code>SelectionListener</code> the to the <code>createTableViewerColumn()</code> method: <code>column.addSelectionListener(getSelectionAdapter(column, colNumber));</code><br/>4.5 Add new method:<br/> <pre> private SelectionAdapter getSelectionAdapter(final TableColumn column,  final int index) {  SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { comparator.setColumn(index); int dir = viewer.getTable().getSortDirection(); if (viewer.getTable().getSortColumn() == column) { dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; } else {  dir = SWT.DOWN; } viewer.getTable().setSortDirection(dir); viewer.getTable().setSortColumn(column); viewer.refresh(); } }; return selectionAdapter; }</pre>
1
edit

Navigation menu