本文整理汇总了Java中org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem.setFocus方法的典型用法代码示例。如果您正苦于以下问题:Java SWTBotTreeItem.setFocus方法的具体用法?Java SWTBotTreeItem.setFocus怎么用?Java SWTBotTreeItem.setFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem
的用法示例。
在下文中一共展示了SWTBotTreeItem.setFocus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertExistingProject
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void convertExistingProject() throws CoreException {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(this.projectName);
item.setFocus();
item.select();
SWTBotMenu menu = item.contextMenu("Configure").contextMenu("Convert to GW4E");
menu.click();
bot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
boolean b = GW4ENature
.hasGW4ENature(ResourceManager.getProject(projectName));
return b;
}
@Override
public String getFailureMessage() {
return "GraphWalker has not GraphWalker Nature ";
}
});
cleanBuild();
}
示例2: prepareConvertTo
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
private ConvertDialog prepareConvertTo(String project, String packageRootFragment, String pkg,
String targetFilename, String targetFormat, String... nodes) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.select();
item.setFocus();
SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Convert to...");
menu.click();
bot.waitUntil(Conditions.shellIsActive("GW4E Conversion File"));
SWTBotShell shell = bot.shell("GW4E Conversion File");
ConvertDialog cd = new ConvertDialog(shell);
return cd;
}
示例3: getGraphmlProperties
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public GraphModelProperties getGraphmlProperties(String folder, String pkg, String filename) {
SWTBotTreeItem pti = getProjectTreeItem(this.projectName);
pti.expand();
SWTBotTreeItem fileItem = null;
if (pkg == null) {
fileItem = pti.expandNode(folder, filename);
} else {
fileItem = pti.expandNode(folder, pkg, filename);
}
bot.waitUntil(new isItemExpandedInTree(pti.getNode(folder)));
fileItem.setFocus();
fileItem.select();
bot.waitUntil(new isItemSelectedInTree(fileItem));
fileItem.click();
bot.waitUntil(new isItemSelected(fileItem));
SWTBotMenu fileMenu = bot.menu("File");
fileMenu.menu("Properties").click();
bot.waitUntil(Conditions.shellIsActive("Properties for " + filename));
SWTBotShell shell = bot.shell("Properties for " + filename);
GraphModelProperties gp = new GraphModelProperties(shell.bot(), this.projectName, folder, pkg, filename);
return gp;
}
示例4: setupTreeForMenu
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
private SWTBotTree setupTreeForMenu(String... nodes) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.setFocus();
item.select();
return tree;
}
示例5: canGenerateSource
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public SWTBotMenu canGenerateSource(boolean enabled, String... nodes) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.setFocus();
item.select();
SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Generate Test and Interface");
assertEquals("Invalid state ", enabled, menu.isEnabled());
return menu;
}
示例6: generateSource
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void generateSource(String... nodes) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.setFocus();
item.select();
SWTBotMenu menu = item.contextMenu("GW4E").contextMenu("Generate Test and Interface");
assertEquals("Invalid state ", true, menu.isEnabled());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
menu.click();
}
});
}
示例7: openPropertiesPage
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public GW4EProjectProperties openPropertiesPage ( ) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(this.projectName);
item.setFocus();
item.select();
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
return treeItem.isSelected();
}
@Override
public String getFailureMessage() {
return "Project " + projectName + " not selected ";
}
};
bot.waitUntil(condition);
bot.menu( "File").menu("Properties").click();
bot.waitUntil(Conditions.shellIsActive("Properties for " + projectName));
SWTBotShell shell = bot.shell("Properties for " + projectName).activate();
shell.bot().tree().select("GW4E");
bot.waitUntil(Conditions.waitForWidget(WidgetMatcherFactory.withId( ProjectPropertyPage.PROJECT_PROPERTY_PAGE_WIDGET_ID, ProjectPropertyPage.PROJECT_PROPERTY_PAGE_WIDGET_SECURITY_LEVEL_FOR_ABSTRACT_CONTEXT)));
return new GW4EProjectProperties(bot,shell);
}
示例8: refactorModelName
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void refactorModelName (String newName,String [] nodes) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.select();
item.setFocus();
SWTBotMenu menu = item.contextMenu("Refactor").contextMenu("Rename...");
menu.click();
bot.waitUntil(Conditions.shellIsActive("Rename Resource"));
SWTBotShell shell = bot.shell("Rename Resource");
SWTBotText text = shell.bot().textWithLabel("New name:");
text.setText(newName);
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
return shell.bot().button("OK").isEnabled();
}
@Override
public String getFailureMessage() {
return "OK button not enabled";
}
};
bot.waitUntil(condition);
shell.bot().button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
}
示例9: refactorRenameFolder
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void refactorRenameFolder (String [] nodes, String name) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.select();
item.setFocus();
SWTBotMenu menu = item.contextMenu("Refactor").contextMenu("Rename...");
menu.click();
bot.waitUntil(Conditions.shellIsActive("Rename Package"));
SWTBotShell shell = bot.shell("Rename Package");
SWTBotText text = shell.bot().textWithLabel("New name:");
text.setText(name);
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
return shell.bot().button("OK").isEnabled();
}
@Override
public String getFailureMessage() {
return "OK button not enabled";
}
};
bot.waitUntil(condition);
shell.bot().button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell), 30 * 1000);
}
示例10: refactorMoveModel
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void refactorMoveModel (String [] nodes,String [] destination, String name) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.select();
item.setFocus();
SWTBotMenu menu = item.contextMenu("Refactor").contextMenu("Move...");
menu.click();
bot.waitUntil(Conditions.shellIsActive("Move"));
SWTBotShell shell = bot.shell("Move");
SWTBotTree packageTree = shell.bot().treeWithLabel("Choose destination for '"+ name + "':");
SWTBotTreeItem target = packageTree.expandNode(destination);
target.select();
target.setFocus();
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
return shell.bot().button("OK").isEnabled();
}
@Override
public String getFailureMessage() {
return "OK button not enabled";
}
};
bot.waitUntil(condition);
shell.bot().button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
}
示例11: launchDevModeWithJettyAndWaitForReady
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
/**
* Goto Debug As > "# MENU_GWT_SUPERDEVMODE"
*/
public static void launchDevModeWithJettyAndWaitForReady(SWTWorkbenchBot bot,
String projectName) {
SwtBotUtils.print("Launch DevMode with Jetty");
// show it has focus
SWTBotTreeItem project = SwtBotProjectActions.selectProject(bot, projectName);
project.setFocus();
project.select();
project.doubleClick();
// Since the menus have dynamic numbers in them
// and with out a built in iteration, this is what I came up with
for (int i = 1; i < 15; i++) {
bot.sleep(500);
if (i < 10) {
number = i + " ";
} else {
number = "";
}
final String menuLabel = number + MENU_GWT_SUPERDEVMODE;
SwtBotUtils.print("Trying to select: Run > Debug As > menuLabel=" + menuLabel);
try {
bot.menu("Run").menu("Debug As").menu(menuLabel).click();
break;
} catch (Exception e) {
SwtBotUtils.print("Skipping menu item " + menuLabel);
}
}
// Wait for a successful launch - 60s build server wait time, just in case
ConsoleViewContains.waitForConsoleOutput(bot, "The code server is ready", 60000);
SwtBotUtils.print("Launched DevMode with Jetty");
}
示例12: testUpdatePathGeneratorInSourceFileFromMenu
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
@Test
public void testUpdatePathGeneratorInSourceFileFromMenu () throws CoreException, IOException, InterruptedException {
System.out.println("XXXXXXXXXXXXXXXXXXXX testUpdatePathGeneratorInSourceFileFromMenu");
GW4EProject project = new GW4EProject(bot, gwproject);
project.createProjectWithoutError( TEST_RESOURCE_FOLDER, PACKAGE_NAME, graphMLFilename);
String targetFormat="test";
String checkTestBox = "Java Test Based";
FileParameters fp = FileParameters.create("java");
String [] contexts = new String [0];
ICondition convertPageCompletedCondition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
boolean b = project.prepareconvertTo(
fp.getProject(),
fp.getPackageFragmentRoot(),
fp.getPackage(),
fp.getTargetFilename(),
targetFormat,
checkTestBox,
"e_StartBrowser",
"v_ShoppingCart",
"e_ShoppingCart",
contexts,
fp.getGraphmlFilePath());
return b;
}
@Override
public String getFailureMessage() {
return "Unable to complete the wizard page.";
}
};
bot.waitUntil(convertPageCompletedCondition);
IProject pj = ResourceManager.getProject(fp.getProject());
bot.waitUntil(new PathFoundCondition(pj,fp.getPath()),15000);
bot.waitUntil(new EditorOpenedCondition(bot, fp.getElementName()),15000);
String policiesFileName = PreferenceManager.getBuildPoliciesFileName(gwproject);
IPath path = new Path (gwproject).append(TEST_RESOURCE_FOLDER).append(PACKAGE_NAME).append(policiesFileName);
IFile buildPolicyFile = (IFile) ResourceManager.getResource(path.toString());
project.setPathGenerator (buildPolicyFile , graphMLFilename, NoBuildRequiredException.SYNCH);
SWTBotTree tree = project.getProjectTree();
String[] nodes = new String[3];
nodes[0] = gwproject;
nodes[1] = "src/main/java";
nodes[2] = "pkgname";
SWTBotTreeItem item = tree.expandNode(nodes);
item.setFocus();
item.select();
Display.getDefault().syncExec(new Runnable () {
@Override
public void run() {
SWTBotMenu menu =item.contextMenu("GW4E").contextMenu("Synchronize Build Policies Files");
menu.click();
}
});
String expectedValue = "AStarPath(ReachedVertex(v_ShoppingCart));I;RandomPath(EdgeCoverage(100));I;RandomPath(TimeDuration(30));I;random(edge_coverage(100));I;";
PropertyValueCondition condition = new PropertyValueCondition(buildPolicyFile,graphMLFilename,expectedValue);
bot.waitUntil(condition);
}
示例13: executeQuickFixForErrorMessage
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void executeQuickFixForErrorMessage(String expectedErrorMessageInProblemView, String quickfixmessage,
ICondition[] conditions) throws CoreException {
print ();
bot.waitUntil(new ErrorIsInProblemView(this, expectedErrorMessageInProblemView));
SWTBotTreeItem item = findErrorItemWithText(expectedErrorMessageInProblemView);
item.setFocus();
item.click();
bot.waitUntil(new IsItemSelectedInErrors(this, item));
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
item.contextMenu().menu("Quick Fix").click();
try {
bot.waitUntil(Conditions.shellIsActive("Quick Fix"), 2 * 1000 );
} catch (Exception e) {
return false;
}
return true;
}
@Override
public String getFailureMessage() {
return "Unable to open the Quick fix";
}
};
bot.waitUntil(condition, 15 * 1000);
SWTBotShell shell = bot.shell("Quick Fix");
SWTBotTable table = shell.bot().tableWithLabel("Select a fix:");
SWTBotTableItem thequickFixItem = table.getTableItem(quickfixmessage);
thequickFixItem.click();
thequickFixItem.select();
SWTBotButton button = shell.bot().button("Finish");
button.click();
bot.waitUntil(Conditions.shellCloses(shell),TIMEOUT);
bot.saveAllEditors();
GW4EProject.fullBuild();
if (conditions != null) {
for (int i = 0; i < conditions.length; i++) {
bot.waitUntil(conditions[i], TIMEOUT);
}
}
}
示例14: enterDestination
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void enterDestination (String targetFilename, String targetFilenamefullpath, String ... nodeToExpand) {
ICondition nodeSelectedCondition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
try {
SWTBotTree tree = bot.treeWithId(FolderSelectionGroup.GW4E_CONVERSION_TREE,FolderSelectionGroup.GW4E_CONVERSION_TREE);
if (tree.isEnabled()) {
tree.setFocus();
SWTBotTreeItem item = tree.expandNode(nodeToExpand);
item.setFocus();
item.select();
}
return true;
} catch (Throwable e) {
return false;
}
}
@Override
public String getFailureMessage() {
String nodeMsg = "";
for (int i = 0; i < nodeToExpand.length; i++) {
nodeMsg = nodeMsg + "/" + nodeToExpand[i] ;
}
String msg = "Unable to expand nodes " + nodeMsg ;
return msg;
}
};
bot.waitUntil(nodeSelectedCondition);
SWTBotText textFile = bot.textWithLabel("Convert to file");
if(textFile.isEnabled()) {
textFile.setText(targetFilename);
}
textFile = bot.textWithLabel("Output file");
String text = textFile.getText();
org.junit.Assert.assertEquals (targetFilenamefullpath, text);
}
示例15: createPackage
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; //导入方法依赖的package包/类
public void createPackage (String [] nodes,String [] parent, String name , String pkg) {
SWTBotTree tree = getProjectTree();
SWTBotTreeItem item = tree.expandNode(nodes);
item.select();
item.setFocus();
SWTBotMenu menu = item.contextMenu("Refactor").contextMenu("Move...");
menu.click();
bot.waitUntil(Conditions.shellIsActive("Move"));
SWTBotShell shell = bot.shell("Move");
SWTBotTree packageTree = shell.bot().treeWithLabel("Choose destination for '"+ name + "':");
SWTBotTreeItem target = packageTree.expandNode(parent);
target.select();
target.setFocus();
shell.bot().button("Create Package...").click();
bot.waitUntil(Conditions.shellIsActive("New Java Package"));
SWTBotShell shellNewPackage = bot.shell("New Java Package");
SWTBotText text = shellNewPackage.bot().textWithLabel("Name:");
text.setText(pkg);
ICondition condition = new DefaultCondition () {
@Override
public boolean test() throws Exception {
return shellNewPackage.bot().button("Finish").isEnabled();
}
@Override
public String getFailureMessage() {
return "Finish button not enabled";
}
};
bot.waitUntil(condition);
shellNewPackage.bot().button("Finish").click();
bot.waitUntil(Conditions.shellCloses(shellNewPackage));
shell.bot().button("Cancel").click();
}