use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class FileSearchQuery method run.
@Override
public IStatus run(final IProgressMonitor monitor) {
AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
textResult.removeAll();
Pattern searchPattern = getSearchPattern();
TextSearchResultCollector collector = new TextSearchResultCollector(textResult, isFileNameSearch(), fSearchInBinaries);
return TextSearchEngine.create().search(fScope, collector, searchPattern, monitor);
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class EditorAnnotationManager method searchResultChanged.
@Override
public synchronized void searchResultChanged(SearchResultEvent e) {
ISearchResult searchResult = e.getSearchResult();
if (searchResult instanceof AbstractTextSearchResult) {
AbstractTextSearchResult result = (AbstractTextSearchResult) searchResult;
if (e instanceof MatchEvent) {
MatchEvent me = (MatchEvent) e;
Match[] matchesInEditor = getMatchesInEditor(me.getMatches(), result);
if (matchesInEditor != null) {
if (me.getKind() == MatchEvent.ADDED) {
addAnnotations(matchesInEditor);
} else {
removeAnnotations(matchesInEditor);
}
}
} else if (e instanceof RemoveAllEvent) {
removeAnnotations(result);
} else if (e instanceof FilterUpdateEvent) {
Match[] matchesInEditor = getMatchesInEditor(((FilterUpdateEvent) e).getUpdatedMatches(), result);
if (matchesInEditor != null) {
removeAnnotations(matchesInEditor);
addAnnotations(matchesInEditor);
}
}
}
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class EditorAnnotationManager method doEditorInputChanged.
public synchronized void doEditorInputChanged() {
removeAllAnnotations();
if (fHighlighter != null) {
fHighlighter.dispose();
fHighlighter = null;
}
for (int i = 0; i < fResults.size(); i++) {
AbstractTextSearchResult curr = fResults.get(i);
addAnnotations(curr);
}
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class PositionTracker method searchResultChanged.
// tracking matches ---------------------------------------------------------------------
@Override
public void searchResultChanged(SearchResultEvent e) {
if (e instanceof MatchEvent) {
MatchEvent evt = (MatchEvent) e;
Match[] matches = evt.getMatches();
int kind = evt.getKind();
AbstractTextSearchResult result = (AbstractTextSearchResult) e.getSearchResult();
for (Match match : matches) {
ITextFileBuffer fb = getTrackedFileBuffer(result, match.getElement());
if (fb != null) {
updateMatch(match, fb, kind, result);
}
}
} else if (e instanceof RemoveAllEvent) {
RemoveAllEvent evt = (RemoveAllEvent) e;
ISearchResult result = evt.getSearchResult();
untrackAll((AbstractTextSearchResult) result);
}
}
use of org.eclipse.search.ui.text.AbstractTextSearchResult in project eclipse.platform.text by eclipse.
the class LineBasedFileSearch method run.
@Override
public IStatus run(IProgressMonitor monitor) {
AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
textResult.removeAll();
LineBasedTextSearchResultCollector collector = new LineBasedTextSearchResultCollector(textResult);
Pattern searchPattern = getSearchPattern();
return TextSearchEngine.create().search(fScope, collector, searchPattern, monitor);
}
Aggregations