use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class PositionTrackerTest method testInsertAt0.
@Test
public void testInsertAt0() throws Exception {
NewSearchUI.runQueryInForeground(null, fQuery1);
AbstractTextSearchResult result = (AbstractTextSearchResult) fQuery1.getSearchResult();
Object[] elements = result.getElements();
try {
for (int i = 0; i < elements.length; i++) {
checkInsertAtZero(result, (IFile) elements[i]);
}
} finally {
SearchPlugin.getActivePage().closeAllEditors(false);
}
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class ResultUpdaterTest method testRemoveProject.
@Test
public void testRemoveProject() throws Exception {
NewSearchUI.runQueryInForeground(null, fQuery1);
AbstractTextSearchResult result = (AbstractTextSearchResult) fQuery1.getSearchResult();
ResourceHelper.delete(fProject);
assertEquals(0, result.getMatchCount());
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult 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);
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class MatchFilterAction method run.
@Override
public void run() {
AbstractTextSearchResult input = fPage.getInput();
if (input == null) {
return;
}
ArrayList<MatchFilter> newFilters = new ArrayList<>();
MatchFilter[] activeMatchFilters = input.getActiveMatchFilters();
if (activeMatchFilters == null) {
return;
}
for (int i = 0; i < activeMatchFilters.length; i++) {
if (!activeMatchFilters[i].equals(fFilter)) {
newFilters.add(activeMatchFilters[i]);
}
}
boolean newState = isChecked();
if (newState) {
newFilters.add(fFilter);
}
input.setActiveMatchFilters(newFilters.toArray(new MatchFilter[newFilters.size()]));
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class MatchFilterSelectionAction method run.
@Override
public void run() {
Shell shell = fPage.getSite().getShell();
AbstractTextSearchResult input = fPage.getInput();
if (input == null) {
return;
}
MatchFilter[] allFilters = input.getAllMatchFilters();
MatchFilter[] checkedFilters = input.getActiveMatchFilters();
Integer limit = fPage.getElementLimit();
boolean enableMatchFilterConfiguration = checkedFilters != null;
boolean enableLimitConfiguration = limit != null;
int elementLimit = limit != null ? limit.intValue() : -1;
MatchFilterSelectionDialog dialog = new MatchFilterSelectionDialog(shell, enableMatchFilterConfiguration, allFilters, checkedFilters, enableLimitConfiguration, elementLimit);
if (dialog.open() == Window.OK) {
if (enableMatchFilterConfiguration) {
input.setActiveMatchFilters(dialog.getMatchFilters());
}
if (enableLimitConfiguration) {
fPage.setElementLimit(Integer.valueOf(dialog.getLimit()));
}
}
}
Aggregations