本文整理汇总了Java中org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java SWTBotTreeItem.getNode方法的具体用法?Java SWTBotTreeItem.getNode怎么用?Java SWTBotTreeItem.getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem
的用法示例。
在下文中一共展示了SWTBotTreeItem.getNode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSetStageXValue
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void checkSetStageXValue() throws Exception {
SWTBotTreeItem item = bot.tree(0).getTreeItem("Translations");
assertEquals("Stage X", item.cell(0, 0));
SWTBotTreeItem node = item.getNode("Stage X");
node.click(1);
setEditorValue("10.0");
assertEquals("10.0 mm", item.cell(0, 1));
node.click(1);
setEditorValue("0.0");
assertEquals("0.0 mm", item.cell(0, 1));
}
示例2: checkSetTemperatureValue
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void checkSetTemperatureValue() throws Exception {
SWTBotTreeItem item = bot.tree(0).getTreeItem("Experimental Conditions");
assertEquals("Temperature", item.cell(0, 0));
SWTBotTreeItem node = item.getNode("Temperature");
node.click(1);
setEditorValue("290.0");
assertEquals("290.0 K", item.cell(0, 1));
node.click(1);
setEditorValue("295.0");
assertEquals("295.0 K", item.cell(0, 1));
}
示例3: getUniqueTreeItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Given a tree that contains an entry with <code>itemName</code> and a direct child with a name
* matching <code>subchildName</code>, return its tree item.
*
* This method is useful when there is the possibility of a tree having two similarly-named
* top-level nodes.
*
* @param mainTree the tree
* @param itemName the name of a top-level node in the tree
* @param subchildName the name of a direct child of the top-level node (used to uniquely select
* the appropriate tree item for the given top-level node name)
* @return the tree item corresponding to the top-level node with <code>itemName</code>that has a
* direct child with <code>subchildName</code>. If there are multiple tree items that
* satisfy this criteria, then the first one (in the UI) will be returned
*
* @throws WidgetNotFoundException if no such node can be found
*/
public static SWTBotTreeItem getUniqueTreeItem(final SWTBot bot, final SWTBotTree mainTree,
String itemName, String subchildName) {
for (SWTBotTreeItem item : mainTree.getAllItems()) {
if (itemName.equals(item.getText())) {
try {
item.expand();
waitUntilTreeHasText(bot, item);
if (item.getNode(subchildName) != null) {
return item;
}
} catch (WidgetNotFoundException ex) {
// Ignore
}
}
}
throw new WidgetNotFoundException(
"The " + itemName + " node with a child of " + subchildName + " must exist in the tree.");
}
示例4: getUniqueTreeItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Given a tree that contains an entry with <code>itemName</code> and a direct child with a name
* matching <code>subchildName</code>, return its tree item.
*
* This method is useful when there is the possibility of a tree having two similarly-named
* top-level nodes.
*
* @param mainTree the tree
* @param itemName the name of a top-level node in the tree
* @param subchildName the name of a direct child of the top-level node (used to uniquely select
* the appropriate tree item for the given top-level node name)
* @return the tree item corresponding to the top-level node with <code>itemName</code>that has a
* direct child with <code>subchildName</code>. If there are multiple tree items that
* satisfy this criteria, then the first one (in the UI) will be returned
*
* @throws IllegalStateException if no such node can be found
*/
public static SWTBotTreeItem getUniqueTreeItem(final SWTBot bot, final SWTBotTree mainTree,
String itemName, String subchildName) {
for (SWTBotTreeItem item : mainTree.getAllItems()) {
if (itemName.equals(item.getText())) {
try {
item.expand();
SwtBotTreeActions.waitUntilTreeHasText(bot, item);
if (item.getNode(subchildName) != null) {
return item;
}
} catch (WidgetNotFoundException e) {
// Ignore
}
}
}
throw new IllegalStateException("The '" + itemName + "' node with a child of '" + subchildName
+ "' must exist in the tree.");
}
示例5: selectProjectItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Select a file/folder by providing a parent tree, and a list of folders that leads to the
* file/folder.
*
* @param item root tree item
* @param folderPath list of folder names that lead to file
* @return the SWTBotTreeItem of the final selected item, or {@code null} if not found
*/
public static SWTBotTreeItem selectProjectItem(SWTBotTreeItem item, String... folderPath) {
for (String folder : folderPath) {
if (item == null) {
return null;
}
item.doubleClick();
item = item.getNode(folder);
}
return item;
}
示例6: expandNode
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Expands the node matching the given node texts.
* The method is copied from SWTBotTreeItem with an additional check if the node is already expanded.
*
* @param bot
* tree item bot, must not be {@code null}
* @param nodes
* the text on the node, must not be {@code null} or empty
* @return the last tree node that was expanded, never {@code null}
*/
public static SWTBotTreeItem expandNode(final SWTBotTreeItem bot, final String... nodes) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(nodes, ARGUMENT_NODES);
assertArgumentIsNotEmpty(nodes, ARGUMENT_NODES);
SWTBotTreeItem item = bot;
for (String node : nodes) {
item = item.getNode(node);
if (!item.isExpanded()) {
item.expand();
}
}
return item;
}
示例7: checkForModelExistenceUI
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
private SWTBotTreeItem checkForModelExistenceUI(final SWTBotTreeItem treeItem) {
try {
treeItem.expand();
SWTBotTreeItem models = treeItem.getNode("models");
models.expand();
return models.getNode(TEST_MODEL).select();
} catch(AssertionFailedException e) {
Assert.fail(e.getMessage());
}
return null;
}
示例8: selectProjectItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Select a file/folder by providing a parent tree, and a list folders that lead to the
* file/folder.
*
* @param item Root tree item.
* @param folderPath List of folder names that lead to file.
* @return Returns a SWTBotTreeItem of the last name in texts.
*/
public static SWTBotTreeItem selectProjectItem(SWTBotTreeItem item, String... folderPath) {
for (String folder : folderPath) {
if (item == null) {
return null;
}
item.doubleClick();
item = item.getNode(folder);
}
return item;
}
示例9: checkValuesTree4
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Ignore("Cannot get the click to work...")
@Test
public void checkValuesTree4() throws Exception {
ControlTree ct = getControlTree("control_tree4.xml");
bot.getDisplay().syncExec(()->viewer.setControlTree(ct));
assertEquals(2, bot.tree(0).columnCount());
assertEquals(1, bot.tree(0).rowCount());
assertEquals("Hutch", bot.tree(0).cell(0, 0));
SWTBotTreeItem item = bot.tree(0).getTreeItem("Hutch");
List<String> children = item.getNodes();
assertEquals(Arrays.asList("Port Shutter"), children);
assertEquals("Port Shutter", item.cell(0, 0));
assertEquals("Open", item.cell(0, 1));
SWTBotTreeItem node = item.getNode("Port Shutter");
node.click(1); // Cannot get the click to work...
SWTBotCCombo combo = bot.ccomboBox(0);
combo.setSelection(1); // Closed
bot.getDisplay().syncExec(()->viewer.applyEditorValue());
assertEquals("Closed", item.cell(0, 1));
node.click(1);
combo = bot.ccomboBox(0);
combo.setSelection(0); // Open
bot.getDisplay().syncExec(()->viewer.applyEditorValue());
assertEquals("Open", item.cell(0, 1));
}