Table ruleTable = availableRulesTableViewer.getTable(); TableColumn ruleNameColumn = new TableColumn(ruleTable, SWT.LEFT); ruleNameColumn.setResizable(true); ruleNameColumn.setText(getMessage("Factory name")); ruleNameColumn.setWidth(200); ruleNameColumn.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) {  sorter.setSortColumnIndex(0); availableRulesTableViewer.refresh(); } });
int currentColumnIdx = -1; Table factoriesTable = availableFactoriesTableViewer.getTable();
	private Table buildAvailableRulesTableViewer(		Composite parent,		IProject project) {		final BugPatternTableSorter sorter = new BugPatternTableSorter();		int tableStyle =			SWT.BORDER				| SWT.H_SCROLL				| SWT.V_SCROLL				| SWT.SINGLE				| SWT.FULL_SELECTION				| SWT.CHECK;		availableRulesTableViewer =			CheckboxTableViewer.newCheckList(parent, tableStyle);		Table ruleTable = availableRulesTableViewer.getTable();		TableColumn ruleNameColumn = new TableColumn(ruleTable, SWT.LEFT);		ruleNameColumn.setResizable(true);		ruleNameColumn.setText(getMessage("Factory name"));		ruleNameColumn.setWidth(200);		ruleNameColumn.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(SelectionEvent e) {				// TODO hardcoded column idx				sorter.setSortColumnIndex(0);				availableRulesTableViewer.refresh();			}		});		TableColumn rulePriorityColumn = new TableColumn(ruleTable, SWT.LEFT);		rulePriorityColumn.setResizable(true);		rulePriorityColumn.setText(getMessage("Bug detector speed"));		rulePriorityColumn.setWidth(110);		rulePriorityColumn.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(SelectionEvent e) {				// TODO hardcoded column idx				sorter.setSortColumnIndex(1);				availableRulesTableViewer.refresh();			}		});		TableColumn ruleDescriptionColumn = new TableColumn(ruleTable, SWT.LEFT);		ruleDescriptionColumn.setResizable(true);		ruleDescriptionColumn.setText(getMessage("Detector description"));		ruleDescriptionColumn.setWidth(200);		ruleTable.setLinesVisible(true);		ruleTable.setHeaderVisible(true);		availableRulesTableViewer.setContentProvider(			new DetectorFactoriesContentProvider());		availableRulesTableViewer.setLabelProvider(			new DetectorFactoryLabelProvider());		availableRulesTableViewer.setColumnProperties(			new String[] {				COLUMN_PROPS_NAME,				COLUMN_PROPS_PRIORITY,				COLUMN_PROPS_DESCRIPTION });		availableRulesTableViewer.setSorter(sorter);		populateAvailableRulesTable(project);		ruleTable.setEnabled(true);		return ruleTable;	}