Example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL.

Prototype

String FINISH_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL.

Click Source Link

Document

The label for finish buttons.

Usage

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewRepoHandlingTest.java

License:Open Source License

@Test
public void testCreateRepository() throws Exception {
    clearView();/*from  w  ww  .j  a v a 2 s.co  m*/
    refreshAndWait();
    assertEmpty();
    // create a non-bare repository
    getOrOpenView().toolbarButton(myUtil.getPluginLocalizedValue("RepoViewCreateRepository.tooltip")).click();
    SWTBotShell shell = bot.shell(UIText.NewRepositoryWizard_WizardTitle).activate();
    IPath newPath = new Path(getTestDirectory().getPath()).append("NewRepository");
    shell.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel).setText(newPath.toOSString());
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();
    File repoFile = new File(newPath.toFile(), Constants.DOT_GIT);
    myRepoViewUtil.getRootItem(getOrOpenView().bot().tree(), repoFile);
    assertFalse(myRepoViewUtil.lookupRepository(repoFile).isBare());

    // create a bare repository
    getOrOpenView().toolbarButton(myUtil.getPluginLocalizedValue("RepoViewCreateRepository.tooltip")).click();
    shell = bot.shell(UIText.NewRepositoryWizard_WizardTitle).activate();
    newPath = new Path(getTestDirectory().getPath()).append("bare").append("NewBareRepository");
    shell.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel).setText(newPath.toOSString());
    shell.bot().checkBox(UIText.CreateRepositoryPage_BareCheckbox).select();
    shell.bot().button(IDialogConstants.FINISH_LABEL).click();
    refreshAndWait();
    repoFile = newPath.toFile();
    myRepoViewUtil.getRootItem(getOrOpenView().bot().tree(), repoFile);
    assertTrue(myRepoViewUtil.lookupRepository(repoFile).isBare());
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTagHandlingTest.java

License:Open Source License

@Test
public void testResetToTag() throws Exception {
    SWTBotTree tree = getOrOpenView().bot().tree();
    IJobChangeListener listener = null;/*w  ww .j  a v a 2  s  .c om*/
    try {
        String initialContent = getTestFileContent();
        createTag("ResetToFirst", "The first tag");
        touchAndSubmit(null);
        String newContent = getTestFileContent();
        assertFalse("Wrong content", initialContent.equals(newContent));
        createTag("ResetToSecond", "The second tag");
        refreshAndWait();
        myRepoViewUtil.getTagsItem(tree, repositoryFile).expand().getNode("ResetToFirst").select();

        final boolean[] done = new boolean[] { false };

        final String jobName = NLS.bind(UIText.ResetAction_reset, "refs/tags/ResetToFirst");

        listener = new JobChangeAdapter() {

            @Override
            public void done(IJobChangeEvent event) {
                if (jobName.equals(event.getJob().getName()))
                    done[0] = true;
            }

        };

        Job.getJobManager().addJobChangeListener(listener);

        ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ResetCommand"));

        SWTBotShell resetDialog = bot.shell(UIText.ResetCommand_WizardTitle);
        resetDialog.bot().radio(UIText.ResetTargetSelectionDialog_ResetTypeHardButton).click();
        waitInUI();
        resetDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
        waitInUI();

        bot.shell(UIText.ResetTargetSelectionDialog_ResetQuestion).bot().button(IDialogConstants.YES_LABEL)
                .click();

        for (int i = 0; i < 1000; i++) {
            if (done[0])
                break;
            Thread.sleep(10);
        }

        assertTrue("Job should be completed", done[0]);

        ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
        assertEquals("Wrong content", initialContent, getTestFileContent());
    } finally {
        if (listener != null)
            Job.getJobManager().removeJobChangeListener(listener);
    }
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 /**
 * Import wizard golden path test//from   ww w .j a v a  2s.  c  om
 * 
 * @throws Exception
 */
@Test
public void testImportWizard() throws Exception {
   deleteAllProjects();
   assertProjectExistence(PROJ1, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   SWTBotTreeItem item = myRepoViewUtil.getRootItem(tree, repositoryFile);
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from root item
   item.select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
   // auto share
   bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
   TableCollection selected = shell.bot().tree().selection();
   String wizardNode = selected.get(0, 0);
   // wizard directory should be working dir
   assertEquals(myRepoViewUtil.getWorkdirItem(tree, repositoryFile)
         .getText(), wizardNode);
   waitInUI();
   shell.close();
   // start wizard from .git
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         Constants.DOT_GIT).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   shell = bot.shell(wizardTitle);
   selected = shell.bot().tree().selection();
   wizardNode = selected.get(0, 0);
   // wizard directory should be .git
   assertEquals(Constants.DOT_GIT, wizardNode);
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 0);
   shell.bot().button(IDialogConstants.BACK_LABEL).click();
   // go to project with .project
   shell.bot().tree().getAllItems()[0].getNode(PROJ1).select();
   // next is 1
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 1);
   assertTrue(!shell.bot().button(IDialogConstants.FINISH_LABEL)
         .isEnabled());
   shell.bot().button(UIText.WizardProjectsImportPage_selectAll).click();
   assertTrue(shell.bot().button(IDialogConstants.FINISH_LABEL)
         .isEnabled());
   shell.bot().button(IDialogConstants.FINISH_LABEL).click();
   waitInUI();
   assertProjectExistence(PROJ1, true);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testImportWizardGeneralProject() throws Exception {
   deleteAllProjects();//from  w  ww. java  2 s  .  c o  m
   assertProjectExistence(PROJ2, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from PROJ2
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         PROJ2).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   shell = bot.shell(wizardTitle);
   // try import existing project first
   bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
   // auto share
   bot.radio(UIText.GitSelectWizardPage_AutoShareButton).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();
   waitInUI();
   assertTrue(shell.bot().tree().getAllItems().length == 0);
   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();
   shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).expand()
         .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
   shell.bot().tree().getAllItems()[0].expand().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();
   waitInUI();
   assertProjectExistence(PROJ2, true);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testImportWizardGeneralProjectWithWorkingSet() throws Exception {
   deleteAllProjects();//  ww  w . ja  va 2  s.c  o  m
   assertProjectExistence(PROJ1, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from PROJ1
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         PROJ1).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   shell = bot.shell(wizardTitle);
   // try import existing project first
   bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click();
   // auto share
   bot.radio(UIText.GitSelectWizardPage_AutoShareButton).click();
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   waitInUI();
   shell.bot().tree().getAllItems()[0].check();
   // add to working set
   shell.bot().checkBox().select();
   // create new working set
   shell.bot().button("Select...").click();
   SWTBotShell workingSetDialog = bot.shell("Select Working Sets");
   workingSetDialog.bot().button("New...").click();
   SWTBotShell newDialog = bot.shell("New Working Set");
   newDialog.bot().table().select("Java");
   newDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
   String workingSetName = "myWorkingSet";
   newDialog.bot().text(0).setText(workingSetName);
   newDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
   workingSetDialog.bot().table().getTableItem(workingSetName).check();
   workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click();
   shell.bot().button(IDialogConstants.FINISH_LABEL).click();
   waitInUI();
   assertProjectExistence(PROJ1, true);
   assertProjectInWorkingSet(workingSetName, PROJ1);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testImportWizardGeneralProjectManualShareOk() throws Exception {
   deleteAllProjects();//from  www  .j  a va2s .c o  m
   assertProjectExistence(PROJ2, false);
   SWTBotTree tree = getOrOpenView().bot().tree();
   String wizardTitle = NLS.bind(
         UIText.GitCreateProjectViaWizardWizard_WizardTitle,
         repositoryFile.getPath());
   // start wizard from PROJ2
   myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
         PROJ2).select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("ImportProjectsCommand"));
   SWTBotShell shell = bot.shell(wizardTitle);
   shell = bot.shell(wizardTitle);
   // import as general
   bot.radio(UIText.GitSelectWizardPage_ImportAsGeneralButton).click();
   // share manual
   bot.radio(UIText.GitSelectWizardPage_InteractiveShareButton).click();
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   assertEquals(PROJ2, shell.bot().textWithLabel(
         UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
   shell.bot().button(IDialogConstants.NEXT_LABEL).click();
   assertEquals(PROJ2, shell.bot().table().getTableItem(0).getText(0));
   // finish -> share
   shell.bot().button(IDialogConstants.FINISH_LABEL).click();
   waitInUI();
   assertProjectExistence(PROJ2, true);
   RepositoryMapping mapping = RepositoryMapping
         .getMapping(ResourcesPlugin.getWorkspace().getRoot()
               .getProject(PROJ2));
   assertNotNull(mapping);
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testDeleteSingleBranch() throws Exception {
   // expand first level
   SWTBotTree tree = getOrOpenView().bot().tree();
   refreshAndWait();//from w  w w  .  jav a 2  s. c  om
   // create a branch (no checkout)
   SWTBotTreeItem localBranchesItem = myRepoViewUtil.getLocalBranchesItem(
         tree, repositoryFile).expand();
   SWTBotTreeItem masterNode = localBranchesItem.getNode("master");
   masterNode.select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("RepoViewCheckout.label"));
   TestUtil.joinJobs(JobFamilies.CHECKOUT);
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("RepoViewCreateBranch.label"));
   SWTBotShell createBranchShell = bot
         .shell(UIText.CreateBranchWizard_NewBranchTitle);
   createBranchShell.bot().textWithId("BranchName").setText("abc");
   createBranchShell.bot().checkBox().deselect();
   createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
   refreshAndWait();
   // delete branch
   localBranchesItem.getNode("abc").select();
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("RepoViewDeleteBranch.label"));

   refreshAndWait();
   SWTBotTreeItem[] items = myRepoViewUtil.getLocalBranchesItem(tree,
         repositoryFile).getItems();
   assertEquals("Wrong number of branches", 2, items.length);
   assertEquals("master", items[0].getText());
   assertEquals("stable", items[1].getText());
}

From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTest.java

License:Open Source License

 @Test
public void testDeleteMultipleBranches() throws Exception {
   // expand first level
   SWTBotTree tree = getOrOpenView().bot().tree();
   refreshAndWait();//from w  ww .  jav  a  2  s .co m
   // open a branch (checkout)
   SWTBotTreeItem localBranchesItem = myRepoViewUtil.getLocalBranchesItem(
         tree, repositoryFile).expand();
   SWTBotTreeItem masterNode = localBranchesItem.getNode("master");
   // create first branch (abc)
   masterNode.select();
   ContextMenuHelper.clickContextMenu(tree, "Create Branch...");
   SWTBotShell createBranchShell = bot
         .shell(UIText.CreateBranchWizard_NewBranchTitle);
   createBranchShell.bot().textWithId("BranchName").setText("abc");
   createBranchShell.bot().checkBox().deselect();
   createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
   // create second branch (123)
   ContextMenuHelper.clickContextMenu(tree, "Create Branch...");
   createBranchShell = bot.shell(UIText.CreateBranchWizard_NewBranchTitle);
   createBranchShell.bot().textWithId("BranchName").setText("123");
   createBranchShell.bot().checkBox().deselect();
   createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
   refreshAndWait();
   localBranchesItem = myRepoViewUtil.getLocalBranchesItem(tree,
         repositoryFile).expand();
   // delete both
   localBranchesItem.select("abc", "123");
   ContextMenuHelper.clickContextMenu(tree, myUtil
         .getPluginLocalizedValue("RepoViewDeleteBranch.label"));
   refreshAndWait();

   SWTBotTreeItem[] items = myRepoViewUtil.getLocalBranchesItem(tree,
         repositoryFile).getItems();
   assertEquals("Wrong number of branches", 2, items.length);
   assertEquals("master", items[0].getText());
   assertEquals("stable", items[1].getText());
}

From source file:org.eclipse.egit.ui.wizards.pull.PullWizardTest.java

License:Open Source License

@Test
public void pullFromProjectRepo() throws Exception {
    SWTBotTree repositoriesTree = getOrOpenView().bot().tree();
    repositoriesTree.select(0);//from   w  w  w .ja  va 2 s.co m
    repositoriesTree.contextMenu("Pull...").click();
    bot.shell("Pull").setFocus();
    assertTrue("Remote combo misses items", bot.comboBox().items().length > 1);
    bot.textWithLabel(UIText.PullWizardPage_referenceLabel).setText("master");
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ShellWithTextPrefixMatcher shellWithTextPrefixMatcher = new ShellWithTextPrefixMatcher("Pull Result");
    bot.waitUntil(waitForShell(shellWithTextPrefixMatcher));
    shellWithTextPrefixMatcher.getFoundShell().setFocus();
    bot.button(IDialogConstants.OK_LABEL).click();
}

From source file:org.eclipse.egit.ui.wizards.share.SharingWizardTest.java

License:Open Source License

@Test
public void shareProjectWithExternalRepo() throws Exception {
    String repoName = "ExternalRepositoryForShare";
    createProject(projectName0);//from w  w w  . jav  a2s  .c o m
    String location1 = createProject(projectName1);
    String location2 = createProject(projectName2);
    createProject(projectName3);

    ExistingOrNewPage existingOrNewPage = sharingWizard.openWizard(projectName1, projectName2);
    SWTBotShell createRepoDialog = existingOrNewPage.clickCreateRepository();
    String repoDir = Activator.getDefault().getPreferenceStore().getString(UIPreferences.DEFAULT_REPO_DIR);
    File repoFolder = new File(repoDir, repoName);
    createRepoDialog.bot().textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel).setText(repoDir);
    createRepoDialog.bot().textWithLabel(UIText.CreateRepositoryPage_RepositoryNameLabel).setText(repoName);
    createRepoDialog.bot().button(IDialogConstants.FINISH_LABEL).click();

    SWTBotCombo combo = bot.comboBoxWithLabel(UIText.ExistingOrNewPage_ExistingRepositoryLabel);
    assertTrue(combo.getText().startsWith(repoName));
    Repository targetRepo = lookupRepository(new File(repoFolder, Constants.DOT_GIT));

    assertTrue(combo.getText().endsWith(targetRepo.getDirectory().getPath()));
    assertEquals(targetRepo.getWorkTree().getPath(),
            bot.textWithLabel(UIText.ExistingOrNewPage_WorkingDirectoryLabel).getText());
    String[][] contents = new String[2][3];
    contents[0][0] = projectName1;
    contents[0][1] = new Path(location1).toString();
    contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName1).toString();

    contents[1][0] = projectName2;
    contents[1][1] = new Path(location2).toString();
    contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName2).toString();
    existingOrNewPage.assertTableContents(contents);

    existingOrNewPage.setRelativePath("a/b");

    contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName1).toString();
    contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName2).toString();
    existingOrNewPage.assertTableContents(contents);

    bot.button(IDialogConstants.FINISH_LABEL).click();
    Thread.sleep(1000);
    String location1Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName1).getLocation()
            .toString();
    assertEquals(contents[0][2], location1Path);
    String location2Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName2).getLocation()
            .toString();
    assertEquals(contents[1][2], location2Path);
}