Package org.eclipse.handly.ui.search
Class HandlySearchResultUpdater
java.lang.Object
org.eclipse.handly.ui.search.HandlySearchResultUpdater
- All Implemented Interfaces:
IElementChangeListener
An
IElementChangeListener that updates the content of the managed
AbstractHandlySearchResults on element change events. Note that
it is the client responsibility to subscribe and unsubscribe the updater
to change notifications in the appropriate Handly-based model(s).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AbstractHandlySearchResult searchResult) Adds a search result to this updater.voidNotifies this listener that some element changes have happened.protected final Iterable<AbstractHandlySearchResult> Returns the search results managed by this updater.protected booleanisPotentialRemoval(IElementDelta delta) Returns whether the given elementCHANGEDdelta describes a potential removal of the element.voidremove(AbstractHandlySearchResult searchResult) Removes a search result from this updater.
-
Constructor Details
-
HandlySearchResultUpdater
public HandlySearchResultUpdater()
-
-
Method Details
-
add
Adds a search result to this updater. Has no effect if an identical search result is already registered.- Parameters:
searchResult- the search result to add (notnull)
-
remove
Removes a search result from this updater. Has no effect if an identical search result is not registered.- Parameters:
searchResult- the search result to remove (notnull)
-
elementChanged
Notifies this listener that some element changes have happened. The supplied event gives details.Note: This method may be called in any thread. The event object (and the element delta within it) is valid only for the duration of the invocation of this method.
This implementation updates the managed search results by removing matches for elements that ceased to exist.
- Specified by:
elementChangedin interfaceIElementChangeListener- Parameters:
event- the change event (nevernull)
-
isPotentialRemoval
Returns whether the given elementCHANGEDdelta describes a potential removal of the element.The
HandlySearchResultUpdaterimplementation of this method returnstrueif the delta has one or more of the following flags set:F_MOVED_TO,F_OPEN,F_CONTENT.- Parameters:
delta- nevernull- Returns:
trueif the delta describes a potential removal, andfalseotherwise
-
getSearchResults
Returns the search results managed by this updater.- Returns:
- the managed search results (never
null)
-