本文整理汇总了Java中org.eclipse.swtbot.swt.finder.widgets.SWTBotTree.getAllItems方法的典型用法代码示例。如果您正苦于以下问题:Java SWTBotTree.getAllItems方法的具体用法?Java SWTBotTree.getAllItems怎么用?Java SWTBotTree.getAllItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.swt.finder.widgets.SWTBotTree
的用法示例。
在下文中一共展示了SWTBotTree.getAllItems方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasErrorsInProblemsView
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public static boolean hasErrorsInProblemsView(SWTWorkbenchBot bot) {
// Open Problems View by Window -> show view -> Problems
bot.menu("Window").menu("Show View").menu("Problems").click();
SWTBotView view = bot.viewByTitle("Problems");
view.show();
SWTBotTree tree = view.bot().tree();
for (SWTBotTreeItem item : tree.getAllItems()) {
String text = item.getText();
if (text != null && text.startsWith("Errors")) {
return true;
}
}
return false;
}
示例2: getUniqueTreeItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的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.");
}
示例3: openView
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
/**
* Open view.
*
* @param bot
* to work with, must not be {@code null}
* @param category
* the category, must not be {@code null}
* @param view
* the name of the view, must not be {@code null}
*/
public static void openView(final SWTWorkbenchBot bot, final String category, final String view) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(category, "category");
Assert.isNotNull(view, ARGUMENT_VIEW);
bot.menu("Window").menu("Show View").menu("Other...").click();
bot.shell("Show View").activate();
final SWTBotTree tree = bot.tree();
for (SWTBotTreeItem item : tree.getAllItems()) {
if (category.equals(item.getText())) {
CoreSwtbotTools.waitForItem(bot, item);
final SWTBotTreeItem[] node = item.getItems();
for (SWTBotTreeItem swtBotTreeItem : node) {
if (view.equals(swtBotTreeItem.getText())) {
swtBotTreeItem.select();
}
}
}
}
assertTrue("View or Category found", bot.button().isEnabled());
bot.button("OK").click();
}
示例4: getUniqueTreeItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的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: hasErrorsInProblemsView
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
/**
* Returns true if there are errors in the Problem view. Returns false otherwise.
*/
public static boolean hasErrorsInProblemsView(SWTWorkbenchBot bot) {
// Open Problems View by Window -> show view -> Problems
bot.menu("Window").menu("Show View").menu("Problems").click();
SWTBotView view = bot.viewByTitle("Problems");
view.show();
SWTBotTree tree = view.bot().tree();
for (SWTBotTreeItem item : tree.getAllItems()) {
String text = item.getText();
if (text != null && text.startsWith("Errors")) {
return true;
}
}
return false;
}
示例6: geVisibleTreeItems
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public Map<String,SWTBotTreeItem> geVisibleTreeItems () {
Map<String,SWTBotTreeItem> temp = new HashMap<String,SWTBotTreeItem>();
SWTBotTree tree = botView.bot().treeWithId(GW4EOutlinePage.GW_WIDGET_ID,GW4EOutlinePage.GW_OUTLINE_ELEMENTS_TREE);
SWTBotTreeItem[] items = tree.getAllItems();
for (SWTBotTreeItem swtBotTreeItem : items) {
if (swtBotTreeItem.isVisible()) temp.put(swtBotTreeItem.getText(),swtBotTreeItem);
}
return temp;
}
示例7: getMessage
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public String getMessage(int rowNumber, String type) {
final int MESSAGE_COLUMN = 0;
SWTBotTree tree = botView.bot().tree();
SWTBotTreeItem[] items = tree.getAllItems();
for (SWTBotTreeItem item : items) {
if (item.getText().contains(type)) {
return item.expand().getItems()[rowNumber].row().get(MESSAGE_COLUMN);
}
}
return "";
}
示例8: getCountofType
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public int getCountofType(String type) {
SWTBotTree tree = botView.bot().tree();
SWTBotTreeItem[] items = tree.getAllItems();
for (SWTBotTreeItem item : items) {
if (item.getText().contains(type)) {
return item.expand().getItems().length;
}
}
return 0;
}
示例9: showConsolePreference
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
private void showConsolePreference(SWTBotShell shell) {
SWTBotTree tree = bot.tree().select("Run/Debug");
tree.expandNode("Run/Debug", true);
SWTBotTreeItem[] items = tree.getAllItems();
for (SWTBotTreeItem swtBotTreeItem : items) {
if (swtBotTreeItem.getText().equalsIgnoreCase("Run/Debug")) {
swtBotTreeItem.getNode("Console").select();
}
}
try {
int max = 10;
for (int i = 0; i < max; i++) {
SWTBotCheckBox button = bot.checkBox(i);
if (button.getText().equalsIgnoreCase("&Limit console output")) {
if (button.isChecked()) {
button.click();
break;
}
}
}
} catch (Exception e) {
}
String name = "OK";
if (GW4EPlatform.isEclipse47()) name = "Apply and Close";
bot.button(name).click();
}
示例10: waitUntilTreeHasItems
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
/**
* Wait until the given tree has items, and return the first item.
*
* @throws TimeoutException if no items appear within the default timeout
*/
public static SWTBotTreeItem waitUntilTreeHasItems(SWTWorkbenchBot bot, final SWTBotTree tree) {
bot.waitUntil(new DefaultCondition() {
@Override
public String getFailureMessage() {
return "Tree items never appeared";
}
@Override
public boolean test() throws Exception {
return tree.hasItems();
}
});
return tree.getAllItems()[0];
}
示例11: selectItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
/**
* Select a TreeItem with the given name in a tree.
*
* @param tree
* the tree in which the item is searched
* @param name
* the name of the required item
* @return true, if the item was selected
*/
public static boolean selectItem(final SWTBotTree tree, final String name) {
SWTBotTreeItem[] items = tree.getAllItems();
for (SWTBotTreeItem item : items) {
if (selectTreeItem(item, name)) {
return true;
}
}
return false;
}
示例12: findTreeItem
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
/**
* Find tree item.
* <p>
* <em>Note</em>: Throws an AssertionError if the item could not be found.
* </p>
*
* @param bot
* to work with, must not be {@code null}
* @param tree
* to search in, must not be {@code null}
* @param item
* to search, must not be {@code null}
* @return the {@link SWTBotTreeItem}, never {@code null}
*/
public static SWTBotTreeItem findTreeItem(final SWTWorkbenchBot bot, final SWTBotTree tree, final String item) {
Assert.isNotNull(bot, ARGUMENT_BOT);
Assert.isNotNull(tree, "tree");
Assert.isNotNull(item, ARGUMENT_ITEM);
int itemCount = 0;
boolean itemFound = false;
SWTBotTreeItem botTreeItem = null;
CoreSwtbotTools.waitForTreeItem(bot, tree);
do {
for (SWTBotTreeItem treeItem : tree.getAllItems()) {
itemCount = treeItem.rowCount();
if (item.equals(treeItem.getText())) {
itemFound = true;
botTreeItem = treeItem;
break;
} else {
for (SWTBotTreeItem treeNode : tree.getAllItems()) {
CoreSwtbotTools.waitForItem(bot, treeNode);
itemCount = treeNode.rowCount();
}
}
}
} while (itemCount > 0);
assertTrue("Searching TreeItem", itemFound);
return botTreeItem;
}
示例13: openNewMavenProject
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public static void openNewMavenProject(SWTWorkbenchBot bot) {
openNewOtherProjectDialog(bot);
// filter maven options
bot.text().setText("maven");
bot.sleep(500);
// click on Maven Project
SWTBotTree tree = bot.tree();
SWTBotTreeItem[] items = tree.getAllItems();
SwtBotTreeActions.selectTreeItem(bot, items[0], "Maven Project");
// move to next step
bot.button("Next >").click();
}
示例14: geRowCount
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; //导入方法依赖的package包/类
public int geRowCount () {
SWTBotTree tree = botView.bot().treeWithId(GW4EOutlinePage.GW_WIDGET_ID,GW4EOutlinePage.GW_OUTLINE_ELEMENTS_TREE);
return tree.getAllItems().length;
}