직접적인 방법이 없습니다. 컨텍스트 메뉴를 여는 지름길이 있다고 가정합니다.
bot.activeShell().pressShortcut(<your shortcut>);
bot.waitUntil(new ContextMenuAppears(tree,
"New"));
tree.contextMenu("New").click();
여기서 ContextMenuAppears는 원하는 컨텍스트 메뉴가 표시되기를 기다리는 ICondition입니다.
public class ContextMenuAppears implements ICondition {
private SWTBotTree swtBotTree;
private String mMenuText;
public TekstContextMenuAppears(SWTBotTree pSwtBotTree, String menuText) {
swtBotTree = pSwtBotTree;
mMenuText = menuText;
}
@Override
public boolean test() throws Exception {
try {
return swtBotTree.contextMenu(mMenuText).isVisible();
} catch (WidgetNotFoundException e) {
return false;
}
}
@Override
public void init(SWTBot bot) {
// TODO Auto-generated method stub
}
@Override
public String getFailureMessage() {
// TODO Auto-generated method stub
return null;
}
}
상황 별 메뉴에서 수행해야합니다. – user2444677