Search in sources :

Example 1 with FilterUpdateEvent

use of org.eclipse.search.ui.text.FilterUpdateEvent 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);
            }
        }
    }
}
Also used : ISearchResult(org.eclipse.search.ui.ISearchResult) RemoveAllEvent(org.eclipse.search.ui.text.RemoveAllEvent) MatchEvent(org.eclipse.search.ui.text.MatchEvent) FilterUpdateEvent(org.eclipse.search.ui.text.FilterUpdateEvent) AbstractTextSearchResult(org.eclipse.search.ui.text.AbstractTextSearchResult) Match(org.eclipse.search.ui.text.Match)

Aggregations

ISearchResult (org.eclipse.search.ui.ISearchResult)1 AbstractTextSearchResult (org.eclipse.search.ui.text.AbstractTextSearchResult)1 FilterUpdateEvent (org.eclipse.search.ui.text.FilterUpdateEvent)1 Match (org.eclipse.search.ui.text.Match)1 MatchEvent (org.eclipse.search.ui.text.MatchEvent)1 RemoveAllEvent (org.eclipse.search.ui.text.RemoveAllEvent)1