use of org.eclipse.search.internal.ui.text.FileSearchResult in project eclipse.platform.text by eclipse.
the class AnnotationManagerTest method testBogusAnnotation.
@Test
public void testBogusAnnotation() throws Exception {
NewSearchUI.runQueryInForeground(null, fQuery1);
FileSearchResult result = (FileSearchResult) fQuery1.getSearchResult();
IFile file = (IFile) result.getElements()[0];
SearchTestPlugin.openTextEditor(SearchTestPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getPages()[0], file);
result.addMatch(new FileMatch(file));
}
use of org.eclipse.search.internal.ui.text.FileSearchResult in project eclipse.platform.text by eclipse.
the class FileSearchTests method testReplaceWithLookarounds.
@Test
public void testReplaceWithLookarounds() throws CoreException, IOException {
IFolder folder = ResourceHelper.createFolder(fProject.getFolder("folder1"));
IFile file1 = ResourceHelper.createFile(folder, "file1.txt", "1<2<3<4");
IFile file2 = ResourceHelper.createFile(folder, "file2.txt", "4<5<6<7");
FileSearchResult searchResult = performSearch(new String[] { "*.txt" }, "(?<=(\\d)\\<)\\d(?=\\<(\\d))");
performReplace(searchResult, "$0=($1+$2)/2");
assertFileContent(file1, "1<2=(1+3)/2<3=(2+4)/2<4");
assertFileContent(file2, "4<5=(4+6)/2<6=(5+7)/2<7");
}
use of org.eclipse.search.internal.ui.text.FileSearchResult in project eclipse.platform.text by eclipse.
the class FileSearchTests method performSearch.
private FileSearchResult performSearch(String[] fileNamePatterns, String pattern) {
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, fileNamePatterns, false);
FileSearchQuery query = new FileSearchQuery(pattern, true, true, scope);
query.run(null);
return (FileSearchResult) query.getSearchResult();
}
use of org.eclipse.search.internal.ui.text.FileSearchResult in project eclipse.platform.text by eclipse.
the class PositionTrackerTest method testInsertInsideMatch.
@Test
public void testInsertInsideMatch() throws Exception {
NewSearchUI.runQueryInForeground(null, fQuery1);
FileSearchResult result = (FileSearchResult) fQuery1.getSearchResult();
Object[] elements = result.getElements();
try {
for (int i = 0; i < elements.length; i++) {
checkInsertInsideMatch(result, (IFile) elements[i]);
}
} finally {
SearchPlugin.getActivePage().closeAllEditors(false);
}
}
use of org.eclipse.search.internal.ui.text.FileSearchResult in project eclipse.platform.text by eclipse.
the class FileSearchTests method testReplaceRetainCase.
@Test
public void testReplaceRetainCase() throws CoreException, IOException {
IFolder folder = ResourceHelper.createFolder(fProject.getFolder("folder1"));
IFile file1 = ResourceHelper.createFile(folder, "file1.txt", "FOO");
FileSearchResult searchResult = performSearch(new String[] { "*.txt" }, "FOO");
performReplace(searchResult, "xyz\\Cbar\\Cfar");
assertFileContent(file1, "xyzBARFAR");
}
Aggregations