|Re: How to access Sirius edition table's cell editor from SWTBot? [message #1836902 is a reply to message #1836896]
||Mon, 18 January 2021 10:56
|| Steve Monnier
Registered: May 2011
Indeed, you can look at the method org.eclipse.sirius.tests.swtbot.ManualAirdModificationTest.directEditLabel(SWTBotEditor, String, char) or org.eclipse.sirius.tests.swtbot.table.CellEditionTest.testEditBooleanCellWithOtherColumnOnSameFeatureName() for examples on how we proceed to edit a table cell.
For SWTBot, a table is handled as a tree where a treeItem is a line of cells. Therefore, if you want to modify a cell, you will first navigate to its line. You can access it by its index or by the current value of one of its cell.
SWTBotTreeItem items = table.getTable().getAllItems();
SWTBotTreeItem tableItem = editor.bot().tree().getTreeItem(oldValue);
Now that you have the line, you can click on the cell you want to edit by its index, for instance: tableItem.click(2);
This will set focus on the cell you want to edit. After that, as a user you would only need to "press the keyboard keys", that's why we added this helper: SWTBotUtils.directEditWithKeyboard(tableTree.widget, newValue);
Steve Monnier - Obeo
Need training or professional services for Sirius?
Powered by FUDForum
. Page generated in 0.01687 seconds