Package org.eclipse.swtbot.swt.finder.widgets

Examples of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem


  }

  @Test
  public void testCreateDeleteLocalBranchWithUnmerged() throws Exception {
    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);
    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(1).select();
    assertCheckoutNotAvailable(view);
    localItem.getNode(0).select();
    ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil
        .getPluginLocalizedValue("CheckoutCommand"));
    TestUtil.joinJobs(JobFamilies.CHECKOUT);
    localItem.getNode(1).select();
    refreshAndWait();
    ContextMenuHelper.clickContextMenu(view.bot().tree(), myUtil
        .getPluginLocalizedValue("RepoViewDeleteBranch.label"));
    SWTBotShell confirmPopup = bot
        .shell(UIText.UnmergedBranchDialog_Title);
    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());
  }
View Full Code Here


  @Test
  public void testClonedRepository() throws Exception {
    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());
  }
View Full Code Here

    bop.execute(null);

    assertEquals("master", repo.getBranch());
    SWTBotTree tree = getOrOpenView().bot().tree();

    SWTBotTreeItem item = myRepoViewUtil.getLocalBranchesItem(tree,
        clonedRepositoryFile).expand();

    touchAndSubmit(null);
    refreshAndWait();

    item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile)
        .expand();
    List<String> children = item.getNodes();
    assertEquals("Wrong number of remote children", 2, children.size());

    item.getNode("origin/stable").select();
    ContextMenuHelper.clickContextMenuSync(tree,
        myUtil.getPluginLocalizedValue("CheckoutCommand"));
    TestUtil.joinJobs(JobFamilies.CHECKOUT);
    refreshAndWait();

    GitLightweightDecorator.refresh();

    assertTrue("Branch should not be symbolic",
        ObjectId.isId(lookupRepository(clonedRepositoryFile)
            .getBranch()));

    // now let's try to create a local branch from the remote one
    item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile)
        .expand();
    item.getNode("origin/stable").select();
    ContextMenuHelper.clickContextMenu(tree,
        myUtil.getPluginLocalizedValue("CreateBranchCommand"));

    SWTBotShell createPage = bot
        .shell(UIText.CreateBranchWizard_NewBranchTitle);
View Full Code Here

  @Test
  public void testRenameBranch() throws Exception {
    SWTBotTree tree = getOrOpenView().bot().tree();

    SWTBotTreeItem item = myRepoViewUtil.getLocalBranchesItem(tree,
        clonedRepositoryFile).expand();

    item.getNode("master").select();
    ContextMenuHelper.clickContextMenu(tree, myUtil
        .getPluginLocalizedValue("RepoViewRenameBranch.label"));
    refreshAndWait();

    SWTBotShell renameDialog = bot
        .shell(UIText.BranchRenameDialog_WindowTitle);
    SWTBotText newBranchNameText = renameDialog.bot().textWithLabel(UIText.BranchRenameDialog_NewNameLabel);
    newBranchNameText.setText("invalid~name");

    renameDialog.bot().text(" " + // the text is now in the error message, and the MessageAreaDialog seems to add a space
        NLS.bind(UIText.ValidationUtils_InvalidRefNameMessage,
            "refs/heads/invalid~name"));
    assertFalse(renameDialog.bot().button(IDialogConstants.OK_LABEL)
        .isEnabled());
    newBranchNameText.setText("newmaster");
    renameDialog.bot().button(IDialogConstants.OK_LABEL).click();

    refreshAndWait();

    item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
        .expand();
    assertEquals("newmaster", item.getNode(0).select().getText());

    ContextMenuHelper.clickContextMenu(tree, myUtil
        .getPluginLocalizedValue("RepoViewRenameBranch.label"));
    refreshAndWait();

    renameDialog = bot.shell(UIText.BranchRenameDialog_WindowTitle);
    newBranchNameText = renameDialog.bot().text(0);

    newBranchNameText.setText("master");
    renameDialog.bot().button(IDialogConstants.OK_LABEL).click();

    refreshAndWait();

    item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
        .expand();
    assertEquals("master", item.getNode(0).select().getText());
  }
View Full Code Here

        ConfigConstants.CONFIG_KEY_REBASE, false);
    assertFalse(rebase);

    SWTBotView view = getOrOpenView();

    SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view
        .bot().tree(), clonedRepositoryFile);
    localItem.expand().getNode("configTest").select();

    ContextMenuHelper.clickContextMenuSync(view.bot().tree(),
        myUtil.getPluginLocalizedValue("ShowIn"),
        "Properties");

    SWTBotView propsView = bot.viewByTitle("Properties");
    SWTBotTreeItem rootItem = propsView
        .bot()
        .tree()
        .getTreeItem(
            UIText.BranchPropertySource_UpstreamConfigurationCategory);
    SWTBotTreeItem rebaseItem = rootItem.expand().getNode(
        UIText.BranchPropertySource_RebaseDescriptor);
    assertEquals(UIText.BranchPropertySource_ValueNotSet,
        rebaseItem.cell(1));

    SWTBotTreeItem remoteItem = rootItem.expand().getNode(
        UIText.BranchPropertySource_RemoteDescriptor);
    assertEquals("origin", remoteItem.cell(1));

    SWTBotTreeItem upstreamItem = rootItem.expand().getNode(
        UIText.BranchPropertySource_UpstreamBranchDescriptor);
    assertEquals("refs/heads/master", upstreamItem.cell(1));

    view = getOrOpenView();

    localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
        clonedRepositoryFile);
View Full Code Here

    BranchesNode branches = new BranchesNode(root, repository);
    LocalNode localBranches = new LocalNode(branches,
        repository);

    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem branchesItem = rootItem.expand().getNode(
        labelProvider.getStyledText(branches).getString());
    SWTBotTreeItem localItem = branchesItem.expand().getNode(
        labelProvider.getStyledText(localBranches).getString());
    return localItem;
  }
View Full Code Here

    Repository repository = lookupRepository(repo);
    RepositoryNode root = new RepositoryNode(null, repository);
    TagsNode tags = new TagsNode(root, repository);

    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem tagsItem = rootItem.expand().getNode(
        labelProvider.getStyledText(tags).getString());
    return tagsItem;
  }
View Full Code Here

    BranchesNode branches = new BranchesNode(root, repository);
    RemoteTrackingNode remoteBranches = new RemoteTrackingNode(branches,
        repository);

    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem branchesItem = rootItem.expand().getNode(
        labelProvider.getStyledText(branches).getString());
    SWTBotTreeItem remoteItem = branchesItem.expand().getNode(
        labelProvider.getStyledText(remoteBranches).getString());
    return remoteItem;
  }
View Full Code Here

    RepositoryNode root = new RepositoryNode(null, repository);

    WorkingDirNode workdir = new WorkingDirNode(root, repository);

    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    SWTBotTreeItem workdirItem = rootItem.expand().getNode(
        labelProvider.getStyledText(workdir).getString());
    return workdirItem;
  }
View Full Code Here

  public SWTBotTreeItem getRootItem(SWTBotTree tree, File repositoryFile)
      throws Exception {
    Repository repository = lookupRepository(repositoryFile);
    RepositoryNode root = new RepositoryNode(null, repository);
    String rootText = labelProvider.getStyledText(root).getString();
    SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
    return rootItem;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.