return new SelectionAdapter() { /** * Handles the case of user selecting the * header area. * <p>If the column has not been selected previously, * it will set the sorter of that column to be * the current tasklist sorter. Repeated * presses on the same column header will * toggle sorting order (ascending/descending).
return new SelectionAdapter() { /** * Handles the case of user selecting the header area. * <p> * If the column has not been selected previously, it will set the * sorter of that column to be the current tasklist sorter. * Repeated presses on the same column header will toggle sorting * order (ascending/descending).
	private SelectionListener getColumnListener(final TableViewer tableViewer) {		/**	 	 * This class handles selections of the column headers.		 * Selection of the column header will cause resorting		 * of the shown tasks using that column's sorter.		 * Repeated selection of the header will toggle		 * sorting order (ascending versus descending).		 */		return new SelectionAdapter() {			/**			 * Handles the case of user selecting the			 * header area.			 * <p>If the column has not been selected previously,			 * it will set the sorter of that column to be			 * the current tasklist sorter. Repeated			 * presses on the same column header will			 * toggle sorting order (ascending/descending).			 */			public void widgetSelected(SelectionEvent e) {				// column selected - need to sort				int column = tableViewer.getTable().indexOf((TableColumn) e.widget);				HistorySorter oldSorter = (HistorySorter)tableViewer.getSorter();				if (oldSorter != null && column == oldSorter.getColumnNumber()) {					oldSorter.setReversed(!oldSorter.isReversed());					tableViewer.refresh();				} else {					tableViewer.setSorter(new HistorySorter(column));				}			}		};	}