|
|
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 |
|
Hello,
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.
By index:
SWTBotTreeItem[] items = table.getTable().getAllItems();
items[1].select();
By value:
SWTBotTreeItem tableItem = editor.bot().tree().getTreeItem(oldValue);
tableItem.select();
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);
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03574 seconds