use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project egit by eclipse.
the class GitRepositoriesViewTest method testImportWizardGeneralProject.
@Test
public void testImportWizardGeneralProject() throws Exception {
removeSmartImportWizardToForceGitImportWizardUsage();
deleteAllProjects();
assertProjectExistence(PROJ2, false);
TestUtil.processUIEvents();
SWTBotTree tree = getOrOpenView().bot().tree();
String wizardTitle = NLS.bind(UIText.GitCreateProjectViaWizardWizard_WizardTitle, repositoryFile.getPath());
// start wizard from PROJ2
TestUtil.expandAndWait(myRepoViewUtil.getWorkdirItem(tree, repositoryFile)).getNode(PROJ2).select();
ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ImportProjectsCommand"));
TestUtil.processUIEvents();
SWTBotShell shell = bot.shell(wizardTitle);
shell = bot.shell(wizardTitle);
// try import existing project first
bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
TableCollection selected = shell.bot().tree().selection();
String wizardNode = selected.get(0, 0);
// wizard directory should be PROJ2
assertEquals(PROJ2, wizardNode);
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
shell.bot().text(" " + UIText.GitProjectsImportPage_NoProjectsMessage);
assertEquals(0, shell.bot().tree().getAllItems().length);
shell.bot().button(IDialogConstants.BACK_LABEL).click();
// import as general
shell.bot().radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
// switch to a sub directory and see if this is used
shell.bot().button(IDialogConstants.BACK_LABEL).click();
SWTBotTreeItem item = TestUtil.expandAndWait(shell.bot().tree().getAllItems()[0]);
TestUtil.expandAndWait(item.getNode(PROJ2)).getNode(FOLDER).select();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
String name = shell.bot().textWithLabel(UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText();
assertEquals(FOLDER, name);
shell.bot().button(IDialogConstants.BACK_LABEL).click();
// switch back to the root directory
TestUtil.expandAndWait(shell.bot().tree().getAllItems()[0]).getNode(PROJ2).select();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
bot.waitUntil(Conditions.shellCloses(shell));
assertProjectExistence(PROJ2, true);
assertProjectIsShared(PROJ2, true);
}
use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project egit by eclipse.
the class BranchAndResetActionTest method checkout.
private void checkout(String[] nodeTexts) throws Exception {
SWTBotShell dialog = openCheckoutBranchDialog();
TestUtil.navigateTo(dialog.bot().tree(), nodeTexts).select();
TableCollection tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 1, tc.rowCount());
assertTrue("Wrong item selected", tc.get(0, 0).startsWith(nodeTexts[1]));
dialog.bot().button(UIText.CheckoutDialog_OkCheckout).click();
TestUtil.joinJobs(JobFamilies.CHECKOUT);
}
use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project egit by eclipse.
the class BranchAndResetActionTest method checkoutAndVerify.
private void checkoutAndVerify(String[] nodeTexts) throws IOException, Exception {
SWTBotShell dialog = openCheckoutBranchDialog();
TableCollection tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 0, tc.rowCount());
TestUtil.navigateTo(dialog.bot().tree(), nodeTexts).select();
tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 1, tc.rowCount());
assertTrue("Wrong item selected", tc.get(0, 0).startsWith(nodeTexts[1]));
Repository repo = lookupRepository(repositoryFile);
dialog.bot().button(UIText.CheckoutDialog_OkCheckout).click();
TestUtil.joinJobs(JobFamilies.CHECKOUT);
if (ObjectId.isId(repo.getBranch())) {
String mapped = Activator.getDefault().getRepositoryUtil().mapCommitToRef(repo, repo.getBranch(), false);
assertEquals("Wrong branch", nodeTexts[1], mapped.substring(mapped.lastIndexOf('/') + 1));
} else
assertEquals("Wrong branch", nodeTexts[1], repo.getBranch());
}
use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project eclipse-integration-commons by spring-projects.
the class SWTBotUtils method getSelection.
public static String getSelection(SWTBotTree tree) {
TableCollection selections = tree.selection();
String selection = "";
for (int r = 0; r < selections.rowCount(); r++) {
if (r > 0)
selection += "\n";
TableRow row = selections.get(r);
for (int c = 0; c < row.columnCount(); c++) {
if (c > 0)
selection += " >> ";
selection += row.get(c);
}
}
return selection;
}
use of org.eclipse.swtbot.swt.finder.utils.TableCollection in project egit by eclipse.
the class GitRepositoriesViewRepoHandlingTest method testShowIn.
@Test
public void testShowIn() throws Exception {
clearView();
deleteAllProjects();
shareProjects(repositoryFile);
refreshAndWait();
assertProjectExistence(PROJ1, true);
assertEmpty();
getOrOpenView().show();
SWTBotView view = TestUtil.showExplorerView();
SWTBotTree explorerTree = view.bot().tree();
SWTBotTreeItem projectItem = getProjectItem(explorerTree, PROJ1).select();
ContextMenuHelper.clickContextMenuSync(explorerTree, "Show In", viewName);
refreshAndWait();
assertHasRepo(repositoryFile);
SWTBotTree viewerTree = getOrOpenView().bot().tree();
TableCollection selection = viewerTree.selection();
assertEquals("Selection should contain one element: " + selection, 1, selection.rowCount());
String nodeText = selection.get(0).get(0);
assertTrue("Node text should contain project name", projectItem.getText().startsWith(nodeText));
view.show();
SWTBotTreeItem item = TestUtil.expandAndWait(projectItem);
item = TestUtil.expandAndWait(item.getNode(FOLDER));
item.getNode(FILE1).select();
ContextMenuHelper.clickContextMenuSync(explorerTree, "Show In", viewName);
selection = viewerTree.selection();
assertTrue("Selection should contain one eelement", selection.rowCount() == 1);
nodeText = selection.get(0).get(0);
assertEquals("Node text should contain file name", FILE1, nodeText);
}
Aggregations