Search in sources :

Example 1 with RepositoryMatch

use of org.eclipse.egit.ui.internal.search.RepositoryMatch in project egit by eclipse.

the class CommitSearchDialogTest method openCommitTabOnSearchDialog.

@Test
public void openCommitTabOnSearchDialog() throws Exception {
    bot.menu("Search").menu("Search...").click();
    SWTBotShell shell = bot.shell("Search");
    if (!shell.isActive()) {
        shell.activate();
    }
    TestUtil.processUIEvents();
    shell.bot().tabItem("Git Search").activate();
    shell.bot().comboBox().setText(commit.name());
    SWTBotButton search = shell.bot().button("Search");
    assertTrue(search.isEnabled());
    search.click();
    TestUtil.waitForJobs(500, 5000);
    TestUtil.joinJobs(InternalSearchUI.FAMILY_SEARCH);
    bot.viewById(NewSearchUI.SEARCH_VIEW_ID).show();
    TestUtil.processUIEvents();
    final SWTBotTreeItem[] repos = bot.activeView().bot().tree().getAllItems();
    assertEquals(1, repos.length);
    Object repoData = UIThreadRunnable.syncExec(new Result<Object>() {

        @Override
        public Object run() {
            return repos[0].widget.getData();
        }
    });
    assertTrue(repoData instanceof RepositoryMatch);
    assertEquals(repository.getDirectory(), ((RepositoryMatch) repoData).getRepository().getDirectory());
    final SWTBotTreeItem[] commits = TestUtil.expandAndWait(repos[0]).getItems();
    assertEquals(1, commits.length);
    Object commitData = UIThreadRunnable.syncExec(new Result<Object>() {

        @Override
        public Object run() {
            return commits[0].widget.getData();
        }
    });
    assertTrue(commitData instanceof RepositoryCommit);
    assertEquals(commit, ((RepositoryCommit) commitData).getRevCommit());
}
Also used : SWTBotButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotButton) RepositoryMatch(org.eclipse.egit.ui.internal.search.RepositoryMatch) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) Test(org.junit.Test)

Aggregations

RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)1 RepositoryMatch (org.eclipse.egit.ui.internal.search.RepositoryMatch)1 SWTBotButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotButton)1 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 Test (org.junit.Test)1