List of usage examples for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL
String FINISH_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL.
Click Source Link
From source file:org.eclipse.egit.ui.submodule.SubmoduleAddTest.java
License:Open Source License
@Test public void addAtRoot() throws Exception { deleteAllProjects();/*from www . j a va 2 s . c o m*/ assertProjectExistence(PROJ1, false); clearView(); Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repositoryFile); shareProjects(repositoryFile); assertProjectExistence(PROJ1, true); refreshAndWait(); assertHasRepo(repositoryFile); FileRepository repo = lookupRepository(repositoryFile); SWTBotTree tree = getOrOpenView().bot().tree(); tree.getAllItems()[0].select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue(ADD_SUBMODULE_CONTEXT_MENU_LABEL)); SWTBotShell shell = bot.shell(UIText.AddSubmoduleWizard_WindowTitle); shell.activate(); shell.bot().textWithLabel(UIText.SubmodulePathWizardPage_PathLabel).setText("sub"); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); shell.bot().textWithLabel(UIText.RepositorySelectionPage_promptURI + ":") .setText(repo.getDirectory().toURI().toString()); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); waitInUI(); TestUtil.joinJobs(JobFamilies.SUBMODULE_ADD); refreshAndWait(); tree = getOrOpenView().bot().tree(); SWTBotTreeItem submodules = tree.getAllItems()[0].select().expand() .getNode(UIText.RepositoriesViewLabelProvider_SubmodulesNodeText); assertNotNull(submodules); submodules.expand(); assertEquals(1, submodules.rowCount()); }
From source file:org.eclipse.egit.ui.test.history.HistoryViewTest.java
License:Open Source License
@Test public void testAddBranch() throws Exception { Repository repo = lookupRepository(repoFile); assertNull(repo.resolve(Constants.R_HEADS + "NewBranch")); SWTBotTable table = getHistoryViewTable(PROJ1); SWTBotTableItem item = table.getTableItem(0); item.select();/* w ww. ja va2s . co m*/ ContextMenuHelper.clickContextMenu(table, UIText.GitHistoryPage_CreateBranchMenuLabel); SWTBotShell dialog = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); dialog.bot().textWithId("BranchName").setText("NewBranch"); // for some reason, checkboxwithlabel doesn't seem to work dialog.bot().checkBox().deselect(); dialog.bot().button(IDialogConstants.FINISH_LABEL).click(); assertNotNull(repo.resolve(Constants.R_HEADS + "NewBranch")); }
From source file:org.eclipse.egit.ui.test.team.actions.DisconnectConnectTest.java
License:Open Source License
@Test public void testDisconnectAndReconnect() throws Exception { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1); RepositoryMapping mapping = RepositoryMapping.getMapping(project); assertNotNull(mapping);/*w w w . j a v a 2s .c om*/ clickOnDisconnect(); ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); waitInUI(); mapping = RepositoryMapping.getMapping(project); assertNull(mapping); SWTBotShell connectDialog = openConnectDialog(); connectDialog.bot().tree().getAllItems()[0].select(); connectDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); waitInUI(); mapping = RepositoryMapping.getMapping(project); assertNotNull(mapping); }
From source file:org.eclipse.egit.ui.test.team.actions.FetchAndMergeActionTest.java
License:Open Source License
@Test public void testFetchFromOriginThenMerge() throws Exception { String previousCommit = prepare(); String oldContent = getTestFileContent(); SWTBotShell fetchDialog = openFetchDialog(); fetchDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); fetchDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); SWTBotShell confirm = bot.shell(NLS.bind(UIText.FetchResultDialog_title, "origin")); SWTBotTable table = confirm.bot().table(); String branch = table.getTableItem(0).getText(2); assertTrue("Wrong result", previousCommit.startsWith(branch.substring(0, 7))); confirm.close();//ww w. ja va2 s . c o m String newContent = getTestFileContent(); assertEquals(oldContent, newContent); fetchDialog = openFetchDialog(); fetchDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); fetchDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); confirm = bot.shell(NLS.bind(UIText.FetchResultDialog_title, "origin")); int count = confirm.bot().table().rowCount(); confirm.close(); assertEquals("Wrong result count", 0, count); newContent = getTestFileContent(); assertEquals(oldContent, newContent); SWTBotShell mergeDialog = openMergeDialog(); mergeDialog.bot().tree().getTreeItem(REMOTE_BRANCHES).expand().getNode("origin/master").select(); mergeDialog.bot().button(UIText.MergeTargetSelectionDialog_ButtonMerge).click(); bot.shell(UIText.MergeAction_MergeResultTitle).close(); newContent = getTestFileContent(); assertFalse(oldContent.equals(newContent)); }
From source file:org.eclipse.egit.ui.test.team.actions.PushActionTest.java
License:Open Source License
private void pushTo(String destination, boolean withConfirmPage) throws Exception, MissingObjectException, IncorrectObjectTypeException, IOException { Repository repo = lookupRepository(remoteRepositoryFile); RevWalk rw = new RevWalk(repo); String previous = rw.parseCommit(repo.resolve("HEAD")).name(); touchAndSubmit(null);//from www .j av a2 s .c o m SWTBotShell pushDialog = openPushDialog(); SWTBotCombo destinationCombo = pushDialog.bot().comboBox(); String[] items = destinationCombo.items(); for (int i = 0; i < items.length; i++) { if (items[i].startsWith(destination)) destinationCombo.setSelection(i); } pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); if (withConfirmPage) pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); SWTBotShell confirm = bot.shell(NLS.bind(UIText.ResultDialog_title, destination)); String result = confirm.bot().table().getTableItem(0).getText(3); assertTrue("Wrong result", previous.startsWith(result.substring(0, 7))); confirm.close(); pushDialog = openPushDialog(); destinationCombo = pushDialog.bot().comboBox(); for (int i = 0; i < items.length; i++) { if (items[i].startsWith(destination)) destinationCombo.setSelection(i); } pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); if (withConfirmPage) pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); confirm = bot.shell(NLS.bind(UIText.ResultDialog_title, destination)); result = confirm.bot().table().getTableItem(0).getText(3); confirm.close(); assertEquals("Wrong result", UIText.PushResultTable_statusUpToDate, result); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewBranchHandlingTest.java
License:Open Source License
@Test public void testCreateCheckoutDeleteLocalBranch() throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repositoryFile); refreshAndWait();//w ww . j a v a 2s .com final SWTBotView view = getOrOpenView(); SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 1, localItem.getNodes().size()); assertEquals("master", localItem.getNodes().get(0)); localItem.getNode(0).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CreateBranchCommand")); SWTBotShell createPage = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); createPage.activate(); // getting text with label doesn't work createPage.bot().textWithId("BranchName").setText("newLocal"); createPage.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).deselect(); createPage.bot().button(IDialogConstants.FINISH_LABEL).click(); getOrOpenView().toolbarButton("Refresh").click(); refreshAndWait(); localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 2, localItem.getNodes().size()); localItem.getNode(0).select(); try { ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); } catch (WidgetNotFoundException e1) { // expected } localItem.getNode(1).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); TestUtil.joinJobs(JobFamilies.CHECKOUT); try { ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); } catch (WidgetNotFoundException e) { // expected } localItem.getNode(0).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); TestUtil.joinJobs(JobFamilies.CHECKOUT); localItem.getNode(1).select(); refreshAndWait(); ContextMenuHelper.clickContextMenu(bot.tree(), myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label")); refreshAndWait(); localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 1, localItem.getNodes().size()); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewBranchHandlingTest.java
License:Open Source License
@Test public void testCreateDeleteLocalBranchWithUnmerged() throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository(repositoryFile); shareProjects(repositoryFile);/*from w w w . j av a2 s .c o m*/ refreshAndWait(); final SWTBotView view = getOrOpenView(); SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 1, localItem.getNodes().size()); assertEquals("master", localItem.getNodes().get(0)); localItem.getNode(0).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CreateBranchCommand")); SWTBotShell createPage = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); createPage.activate(); // getting text with label doesn't work createPage.bot().textWithId("BranchName").setText("newLocal"); createPage.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).select(); createPage.bot().button(IDialogConstants.FINISH_LABEL).click(); TestUtil.joinJobs(JobFamilies.CHECKOUT); getOrOpenView().toolbarButton("Refresh").click(); refreshAndWait(); localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 2, localItem.getNodes().size()); touchAndSubmit("Some more changes"); localItem.getNode(0).select(); try { ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); } catch (WidgetNotFoundException e1) { // expected } localItem.getNode(1).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); TestUtil.joinJobs(JobFamilies.CHECKOUT); try { ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); } catch (WidgetNotFoundException e) { // expected } localItem.getNode(0).select(); ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil.getPluginLocalizedValue("CheckoutCommand")); TestUtil.joinJobs(JobFamilies.CHECKOUT); localItem.getNode(1).select(); refreshAndWait(); ContextMenuHelper.clickContextMenu(bot.tree(), myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label")); SWTBotShell confirmPopup = bot.shell(UIText.RepositoriesView_ConfirmDeleteTitle); confirmPopup.activate(); confirmPopup.bot().button(IDialogConstants.OK_LABEL).click(); refreshAndWait(); localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(), repositoryFile); localItem.expand(); assertEquals("Wrong number of children", 1, localItem.getNodes().size()); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewBranchHandlingTest.java
License:Open Source License
@Test public void testClonedRepository() throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile); refreshAndWait();/* w ww. ja v a 2s. co m*/ SWTBotTree tree = getOrOpenView().bot().tree(); SWTBotTreeItem item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile).expand(); List<String> children = item.getNodes(); assertEquals("Wrong number of local children", 1, children.size()); item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile).expand(); children = item.getNodes(); assertEquals("Wrong number of children", 2, children.size()); assertTrue("Missing remote branch", children.contains("origin/master")); assertTrue("Missing remote branch", children.contains("origin/stable")); item.getNode("origin/stable").select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("CreateBranchCommand")); SWTBotShell shell = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); shell.activate(); assertEquals("stable", shell.bot().textWithId("BranchName").getText()); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); refreshAndWait(); item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile).expand(); children = item.getNodes(); assertEquals("Wrong number of local children", 2, children.size()); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewRemoteHandlingTest.java
License:Open Source License
/** * Remote configuration scenarios/*from w ww .ja v a2 s.c om*/ * * @throws Exception */ @Test public void testConfigureRemote() throws Exception { removeRemotesConfig(repositoryFile); refreshAndWait(); SWTBotTree tree = getOrOpenView().bot().tree(); SWTBotTreeItem remotesItem = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand(); remotesItem = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand(); remotesItem.select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("NewRemoteCommand")); SWTBotShell shell = bot.shell(UIText.ConfigureRemoteWizard_WizardTitle_New); shell.bot().textWithLabel(UIText.SelectRemoteNamePage_RemoteNameLabel).setText("testRemote"); // select configure fetch shell.bot().checkBox(UIText.SelectRemoteNamePage_ConfigureFetch_button).select(); // select configure push shell.bot().checkBox(UIText.SelectRemoteNamePage_ConfigurePush_button).select(); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // Click change shell.bot().button(UIText.ConfigureUriPage_Change_button).click(); shell = bot.shell(UIText.SelectUriWiazrd_Title); shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath()); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); // now we have the fetch URI shell = bot.shell(UIText.ConfigureRemoteWizard_WizardTitle_New); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // add all branches shell.bot().button(UIText.RefSpecPanel_predefinedAll).click(); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // the URIish-like path String testString = new org.eclipse.jgit.transport.URIish("file:///" + remoteRepositoryFile.getPath()) .toPrivateString(); assertEquals(testString, shell.bot().text().getText()); // let's try to add the same URI as push shell.bot().button(UIText.ConfigureUriPage_Add_button).click(); shell = bot.shell(UIText.SelectUriWiazrd_Title); shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath()); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); // we get a "duplicate URI" popup shell = bot.shell(UIText.ConfigureUriPage_DuplicateUriTitle); shell.close(); shell = bot.shell(UIText.ConfigureRemoteWizard_WizardTitle_New); // we continue without adding a special push URI shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // add all branches shell.bot().button(UIText.RefSpecPanel_predefinedAll).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); refreshAndWait(); // assert 2 children SWTBotTreeItem item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote") .expand(); List<String> children = item.getNodes(); assertTrue(children.size() == 2); item.getNode(0).select(); // we remove the fetch, the URI is copied into push ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RemoveFetchCommand")); refreshAndWait(); // assert 1 children item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 1); item.getNode(0).select(); // now we also remove the push ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RemovePushCommand")); refreshAndWait(); // assert 0 children item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 0); myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").select(); String shellText = NLS.bind(UIText.ConfigureRemoteWizard_WizardTitle_Change, "testRemote"); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ConfigureFetchCommand")); shell = bot.shell(shellText); // change is 0 shell.bot().button(UIText.ConfigureUriPage_Change_button).click(); shell = bot.shell(UIText.SelectUriWiazrd_Title); shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath()); // finish is 1 shell.bot().button(IDialogConstants.FINISH_LABEL).click(); shell = bot.shell(shellText); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // all branches shell.bot().button(UIText.RefSpecPanel_predefinedAll).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); refreshAndWait(); // assert 1 children item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 1); // we remove the fetch again item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 1); item.getNode(0).select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RemoveFetchCommand")); refreshAndWait(); myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ConfigurePushCommand")); shell = bot.shell(shellText); shell.bot().button(UIText.ConfigureUriPage_Add_button).click(); shell = bot.shell(UIText.SelectUriWiazrd_Title); shell.bot().text().setText("file:///" + remoteRepositoryFile.getPath()); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); shell = bot.shell(shellText); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); // all branches shell.bot().button(UIText.RefSpecPanel_predefinedAll).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); refreshAndWait(); // assert 2 children item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 1); item.select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RepoViewRemoveRemote.label")); shell = bot.shell(UIText.RepositoriesView_ConfirmDeleteRemoteHeader); // Cancel shell.bot().button(IDialogConstants.CANCEL_LABEL).click(); refreshAndWait(); // assert 2 children item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode("testRemote").expand(); children = item.getNodes(); assertTrue(children.size() == 1); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("RepoViewRemoveRemote.label")); // OK bot.shell(UIText.RepositoriesView_ConfirmDeleteRemoteHeader).bot().button(IDialogConstants.OK_LABEL) .click(); refreshAndWait(); assertTrue(myRepoViewUtil.getRemotesItem(tree, repositoryFile).getNodes().isEmpty()); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewRepoHandlingTest.java
License:Open Source License
@Test public void testCloneRepoButton() throws Exception { clearView();/*from w w w . j av a 2 s .c o m*/ refreshAndWait(); assertEmpty(); getOrOpenView().toolbarButton(myUtil.getPluginLocalizedValue("RepoViewCloneRepository.tooltip")).click(); SWTBotShell shell = bot.shell(UIText.GitCloneWizard_title).activate(); // for some reason, textWithLabel doesn't seem to work shell.bot().textInGroup(UIText.RepositorySelectionPage_groupLocation, 0).setText(repositoryFile.getPath()); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); waitInUI(); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); waitInUI(); // for some reason textWithLabel doesn't work; 0 is path text SWTBotText pathText = shell.bot().text(0); pathText.setText(pathText.getText() + "Cloned"); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); waitInUI(); refreshAndWait(); assertHasClonedRepo(); }