Source:
public void testReorder() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); SWTBotEditor editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); SWTBotTable tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertArrayEquals("Before reorder", BEFORE_COLS, tableBot.columns().toArray()); SWTBotTableItem row = tableBot.getTableItem(3); String[] cells = new String[7]; for( int i = 0; i < BEFORE_COLS.length; i++){ cells[i] = row.getText(i); } final Table table = tableBot.widget; final int[] newColOrder = { 0, 1, 3, 2, 4, 5, 6 }; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { table.setColumnOrder(newColOrder); } }); editorBot.close(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertArrayEquals("After reorder", AFTER_COLS, tableBot.columns().toArray()); editorBot.close(); TmfTraceColumnManager.clearColumnOrder(COLUMN_TRACE_TYPE); assertNull("After clear", TmfTraceColumnManager.loadColumnOrder(COLUMN_TRACE_TYPE)); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertNull("After reset", TmfTraceColumnManager.loadColumnOrder(COLUMN_TRACE_TYPE)); assertArrayEquals("After reset", BEFORE_COLS, tableBot.columns().toArray()); fBot.closeAllEditors(); SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot); }

Target:
public void testReorder() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); SWTBotEditor editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); SWTBotTable tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertArrayEquals("Before reorder", BEFORE_COLS, tableBot.columns().toArray()); final Table table = tableBot.widget; final int[] newColOrder = { 0, 1, 3, 2, 4, 5, 6 }; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { table.setColumnOrder(newColOrder); } }); editorBot.close(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertArrayEquals("After reorder", AFTER_COLS, tableBot.columns().toArray()); editorBot.close(); TmfTraceColumnManager.clearColumnOrder(COLUMN_TRACE_TYPE); assertNull("After clear", TmfTraceColumnManager.loadColumnOrder(COLUMN_TRACE_TYPE)); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), COLUMN_TRACE_TYPE); editorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); tableBot = editorBot.bot().table(); maximizeTable(tableBot); assertNull("After reset", TmfTraceColumnManager.loadColumnOrder(COLUMN_TRACE_TYPE)); assertArrayEquals("After reset", BEFORE_COLS, tableBot.columns().toArray()); fBot.closeAllEditors(); SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, fBot); }