Search in sources :

Example 1 with FileSearchPage

use of org.eclipse.search.internal.ui.text.FileSearchPage in project eclipse.platform.text by eclipse.

the class SearchResultPageTest method testTableNavigation.

@Test
public void testTableNavigation() {
    NewSearchUI.runQueryInForeground(null, fQuery1);
    ISearchResultViewPart view = NewSearchUI.getSearchResultView();
    FileSearchPage page = (FileSearchPage) view.getActivePage();
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_FLAT);
    Table table = ((TableViewer) page.getViewer()).getTable();
    consumeEvents();
    // select the first element.
    table.setSelection(0);
    table.showSelection();
    consumeEvents();
    // back from first match, goto last
    page.gotoPreviousMatch();
    consumeEvents();
    assertEquals(1, table.getSelectionCount());
    assertEquals(table.getItemCount() - 1, table.getSelectionIndex());
    // and forward again, to the first match.
    page.gotoNextMatch();
    consumeEvents();
    assertEquals(1, table.getSelectionCount());
    assertEquals(0, table.getSelectionIndex());
}
Also used : Table(org.eclipse.swt.widgets.Table) ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) FileSearchPage(org.eclipse.search.internal.ui.text.FileSearchPage) TableViewer(org.eclipse.jface.viewers.TableViewer) Test(org.junit.Test)

Example 2 with FileSearchPage

use of org.eclipse.search.internal.ui.text.FileSearchPage in project eclipse.platform.text by eclipse.

the class SearchResultPageTest method testRemoveTreeMatches.

@Test
// checkElementDisplay(..) misses cases where one line contains multiple matches
@Ignore
public void testRemoveTreeMatches() throws Exception {
    NewSearchUI.runQueryInForeground(null, fQuery1);
    ISearchResultViewPart view = NewSearchUI.getSearchResultView();
    FileSearchPage page = (FileSearchPage) view.getActivePage();
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_TREE);
    AbstractTreeViewer viewer = (AbstractTreeViewer) page.getViewer();
    AbstractTextSearchResult result = (AbstractTextSearchResult) fQuery1.getSearchResult();
    // make sure all elements have items.
    viewer.expandAll();
    Object[] elements = result.getElements();
    // page.setUpdateTracing(true);
    for (int i = 0; i < elements.length; i++) {
        Match[] matches = result.getMatches(elements[i]);
        viewer.reveal(elements[i]);
        for (int j = 0; j < matches.length; j++) {
            checkElementDisplay(viewer, result, elements[i]);
            result.removeMatch(matches[j]);
            consumeEvents(page);
        }
    }
// page.setUpdateTracing(false);
}
Also used : ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) FileSearchPage(org.eclipse.search.internal.ui.text.FileSearchPage) AbstractTreeViewer(org.eclipse.jface.viewers.AbstractTreeViewer) AbstractTextSearchResult(org.eclipse.search.ui.text.AbstractTextSearchResult) Match(org.eclipse.search.ui.text.Match) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with FileSearchPage

use of org.eclipse.search.internal.ui.text.FileSearchPage in project eclipse.platform.text by eclipse.

the class SearchResultPageTest method testBasicDisplay.

@Test
@Ignore
public void testBasicDisplay() throws Exception {
    NewSearchUI.runQueryInForeground(null, fQuery1);
    ISearchResultViewPart view = NewSearchUI.getSearchResultView();
    FileSearchPage page = (FileSearchPage) view.getActivePage();
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_TREE);
    checkViewerDisplay(page);
    page.setLayout(AbstractTextSearchViewPage.FLAG_LAYOUT_FLAT);
    checkViewerDisplay(page);
}
Also used : ISearchResultViewPart(org.eclipse.search.ui.ISearchResultViewPart) FileSearchPage(org.eclipse.search.internal.ui.text.FileSearchPage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

FileSearchPage (org.eclipse.search.internal.ui.text.FileSearchPage)3 ISearchResultViewPart (org.eclipse.search.ui.ISearchResultViewPart)3 Test (org.junit.Test)3 Ignore (org.junit.Ignore)2 AbstractTreeViewer (org.eclipse.jface.viewers.AbstractTreeViewer)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 AbstractTextSearchResult (org.eclipse.search.ui.text.AbstractTextSearchResult)1 Match (org.eclipse.search.ui.text.Match)1 Table (org.eclipse.swt.widgets.Table)1