本文整理汇总了Java中org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot.widget方法的典型用法代码示例。如果您正苦于以下问题:Java SWTWorkbenchBot.widget方法的具体用法?Java SWTWorkbenchBot.widget怎么用?Java SWTWorkbenchBot.widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
的用法示例。
在下文中一共展示了SWTWorkbenchBot.widget方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doesProjectExist
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns true if the specified project can be found in the 'Package Explorer' or 'Project View',
* otherwise returns false. Throws a WidgetNotFoundException exception if the 'Package Explorer'
* or 'Project Explorer' view cannot be found.
*
* @param bot The SWTWorkbenchBot.
* @param projectName The name of the project to be found.
* @return if the project exists
*/
public static boolean doesProjectExist(final SWTWorkbenchBot bot, String projectName) {
SWTBotView explorer = getPackageExplorer(bot);
if (explorer == null) {
throw new WidgetNotFoundException(
"Could not find the 'Package Explorer' or 'Project Explorer' view.");
}
// Select the root of the project tree in the explorer view
Widget explorerWidget = explorer.getWidget();
Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
SWTBotTreeItem[] allItems = new SWTBotTree(explorerTree).getAllItems();
for (int i = 0; i < allItems.length; i++) {
if (allItems[i].getText().equals(projectName)) {
return true;
}
}
return false;
}
示例2: selectProject
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns the specified project. Throws a WidgetNotFoundException if the 'Package Explorer' or
* 'Project Explorer' view cannot be found or if the specified project cannot be found.
*
* @param bot The SWTWorkbenchBot.
* @param projectName The name of the project to select.
* @return the tree
*/
public static SWTBotTreeItem selectProject(final SWTWorkbenchBot bot, String projectName) {
/*
* Choose either the Package Explorer View or the Project Explorer view. Eclipse 3.3 and 3.4
* start with the Java Perspective, which has the Package Explorer View open by default, whereas
* Eclipse 3.5 starts with the Resource Perspective, which has the Project Explorer View open.
*/
SWTBotView explorer = getPackageExplorer(bot);
for (SWTBotView view : bot.views()) {
if (view.getTitle().equals("Package Explorer")
|| view.getTitle().equals("Project Explorer")) {
explorer = view;
break;
}
}
if (explorer == null) {
throw new WidgetNotFoundException(
"Could not find the 'Package Explorer' or 'Project Explorer' view.");
}
// Select the root of the project tree in the explorer view
Widget explorerWidget = explorer.getWidget();
Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
return new SWTBotTree(explorerTree).getTreeItem(projectName).select();
}
示例3: openWizard
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* @param matcherImageHyperLink
* @param bot
* @return
*/
public static boolean openWizard(Matcher matcherImageHyperLink,
SWTWorkbenchBot bot) {
@SuppressWarnings("unchecked")
ImageHyperlink link = (ImageHyperlink) bot
.widget(matcherImageHyperLink);
link.getClass();
SWTBotImageHyperlink swtbotImageHyperLink = new SWTBotImageHyperlink(
link);
swtbotImageHyperLink.click();
if (swtbotImageHyperLink.isEnabled()) {
return true;
}
return false;
}
示例4: projectFound
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns true if the specified project is found in the 'Package Explorer' or 'Project View',
* otherwise returns false. Throws a WidgetNotFoundException exception if the 'Package Explorer'
* or 'Project Explorer' view cannot be found.
*
* @param projectName the name of the project to be found
* @return true if the project is found, and false if not found
*/
public static boolean projectFound(final SWTWorkbenchBot bot, String projectName) {
SWTBotView explorer = getExplorer(bot);
// Select the root of the project tree in the explorer view
Widget explorerWidget = explorer.getWidget();
Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
for (SWTBotTreeItem item : new SWTBotTree(explorerTree).getAllItems()) {
if (item.getText().equals(projectName)) {
return true;
}
}
return false;
}
示例5: selectProject
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns the specified project.
*
* @param projectName the name of the project to select
* @return the selected tree item
* @throws WidgetNotFoundException if the 'Package Explorer' or 'Project Explorer' view cannot be
* found or if the specified project cannot be found.
*/
public static SWTBotTreeItem selectProject(final SWTWorkbenchBot bot, String projectName) {
SWTBotView explorer = getExplorer(bot);
// Select the root of the project tree in the explorer view
Widget explorerWidget = explorer.getWidget();
Tree explorerTree = bot.widget(widgetOfType(Tree.class), explorerWidget);
return new SWTBotTree(explorerTree).getTreeItem(projectName).select();
}
示例6: getProjectRootTree
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns the project root tree in Package Explorer.
*/
public static SWTBotTree getProjectRootTree(SWTWorkbenchBot bot) {
SWTBotView explorer = getPackageExplorer(bot);
if (explorer == null) {
throw new WidgetNotFoundException("Cannot find Package Explorer or Project Explorer");
}
Tree tree = bot.widget(widgetOfType(Tree.class), explorer.getWidget());
return new SWTBotTree(tree);
}
示例7: getProjectRootTree
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; //导入方法依赖的package包/类
/**
* Returns the project root tree in Package Explorer.
*/
public static SWTBotTree getProjectRootTree(SWTWorkbenchBot bot) {
SWTBotView explorer = getExplorer(bot);
Tree tree = bot.widget(widgetOfType(Tree.class), explorer.getWidget());
return new SWTBotTree(tree);
}