Source:
void createColumns() { SelectionListener headerListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int column = table.indexOf((TableColumn) e.widget); if (column == comparator.getTopPriority()) { comparator.reverseTopPriority(); } else { comparator.setTopPriority(column); } updateSortingState(); viewer.refresh(); IDialogSettings workbenchSettings = getPlugin().getDialogSettings(); IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION); if (settings == null) { settings = workbenchSettings.addNewSection(TAG_SORT_SECTION); } comparator.saveState(settings); } }; if (memento != null) { IMemento children[] = memento.getChildren(TAG_COLUMN); if (children != null) { for (IMemento memento : children) { Integer val = memento.getInteger(TAG_NUMBER); if (val != null) { int index = val.intValue(); val = memento.getInteger(TAG_WIDTH); if (val != null) { columnLayouts[index] = new ColumnPixelData(val.intValue(), true); } } } } } boolean text = Util.isMac(); TableLayout layout = new TableLayout(); table.setLayout(layout); table.setHeaderVisible(true); for (int i = 0; i < columnHeaders.length; i++) { TableColumn tc = new TableColumn(table, SWT.NONE, i); if (!text && i == 1) { tc.setImage(MarkerUtil.getImage("header_complete")); } else if (!text && i == 2) { tc.setImage(MarkerUtil.getImage("header_priority")); } else { tc.setText(columnHeaders[i]); } if (text && (i == 1 || i == 2)) { tc.pack(); columnLayouts[i] = new ColumnPixelData(Math.max(16, tc .getWidth()), false, true); } tc.setResizable(columnLayouts[i].resizable); layout.addColumnData(columnLayouts[i]); tc.addSelectionListener(headerListener); } }

Target:
void createColumns() { SelectionListener headerListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int column = table.indexOf((TableColumn) e.widget); if (column == comparator.getTopPriority()) { comparator.reverseTopPriority(); } else { comparator.setTopPriority(column); } updateSortingState(); viewer.refresh(); IDialogSettings workbenchSettings = getPlugin().getDialogSettings(); IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION); if (settings == null) { settings = workbenchSettings.addNewSection(TAG_SORT_SECTION); } comparator.saveState(settings); } }; if (memento != null) { IMemento children[] = memento.getChildren(TAG_COLUMN); if (children != null) { for (IMemento child : children) { Integer val = child.getInteger(TAG_NUMBER); if (val != null) { int index = val.intValue(); val = child.getInteger(TAG_WIDTH); if (val != null) { columnLayouts[index] = new ColumnPixelData(val.intValue(), true); } } } } } boolean text = Util.isMac(); TableLayout layout = new TableLayout(); table.setLayout(layout); table.setHeaderVisible(true); for (int i = 0; i < columnHeaders.length; i++) { TableColumn tc = new TableColumn(table, SWT.NONE, i); if (!text && i == 1) { tc.setImage(MarkerUtil.getImage("header_complete")); } else if (!text && i == 2) { tc.setImage(MarkerUtil.getImage("header_priority")); } else { tc.setText(columnHeaders[i]); } if (text && (i == 1 || i == 2)) { tc.pack(); columnLayouts[i] = new ColumnPixelData(Math.max(16, tc .getWidth()), false, true); } tc.setResizable(columnLayouts[i].resizable); layout.addColumnData(columnLayouts[i]); tc.addSelectionListener(headerListener); } }