Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.search.ui.text
Class AbstractTextSearchResult

    java.lang.Object
      org.eclipse.search.ui.text.AbstractTextSearchResult

All Implemented Interfaces:
  ISearchResult

public abstract class AbstractTextSearchResult
extends Object
implements ISearchResult

An abstract base implementation for text-match based search results. This search result implementation consists of a list of `matches`. No assumptions are made about the kind of elements these matches are reported against.

Since:
  3.0

Constructor Summary
`protected` | `AbstractTextSearchResult()` Constructs a new `AbstractTextSearchResult`

Method Summary
`void` | `addListener(ISearchResultListener l)` Adds a `ISearchResultListener`. Has no effect when the listener has already been added.
`void` | `addMatch(Match match)` Adds a `Match` to this search result.
`void` | `addMatches(Match[] matches)` Adds a number of Matches to this search result.
`protected void` | `fireChange(SearchResultEvent e)` Send the given `SearchResultEvent` to all registered search result listeners.
`abstract IEditorMatchAdapter` | `getEditorMatchAdapter()` Returns an implementation of `IEditorMatchAdapter` appropriate for this search result.
`Object[]` | `getElements()` Returns an array containing the set of all elements that matches are reported against in this search result.
`abstract IFileMatchAdapter` | `getFileMatchAdapter()` Returns an implementation of `IFileMatchAdapter` appropriate for this search result.
`int` | `getMatchCount()` Returns the total number of matches contained in this search result.
`int` | `getMatchCount(Object element)` Returns the number of matches reported against a given element.
`Match[]` | `getMatches(Object element)` Returns an array with all matches reported against the given element.
`void` | `removeAll()` Removes all matches from this search result.
`void` | `removeListener(ISearchResultListener l)` Removes a `ISearchResultChangedListener`. Has no effect when the listener hasn't previously been added.
`void` | `removeMatch(Match match)` Removes the given match from this search result.
`void` | `removeMatches(Match[] matches)` Removes the given matches from this search result.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.search.ui.ISearchResult
`getImageDescriptor, getLabel, getQuery, getTooltip`

Constructor Detail

### AbstractTextSearchResult

    protected AbstractTextSearchResult()

  Constructs a new `AbstractTextSearchResult`

Method Detail

### getMatches

    public Match[] getMatches(Object element)

  Returns an array with all matches reported against the given element.

  Parameters:
    `element` - the element to report matches for
  Returns:
    all matches reported for this element
  See Also:
    `Match.getElement()`

### addMatch

    public void addMatch(Match match)

  Adds a `Match` to this search result. This method does nothing if the match is already present.

  Subclasses may extend this method.

  Parameters:
    `match` - the match to add

### addMatches

    public void addMatches(Match[] matches)

  Adds a number of Matches to this search result. This method does nothing for matches that are already present.

  Subclasses may extend this method.

  Parameters:
    `matches` - the matches to add

### removeAll

    public void removeAll()

  Removes all matches from this search result.

  Subclasses may extend this method.

### removeMatch

    public void removeMatch(Match match)

  Removes the given match from this search result. This method has no effect if the match is not found.

  Subclasses may extend this method.

  Parameters:
    `match` - the match to remove

### removeMatches

    public void removeMatches(Match[] matches)

  Removes the given matches from this search result. This method has no effect for matches that are not found

  Subclasses may extend this method.

  Parameters:
    `matches` - the matches to remove

### addListener

    public void addListener(ISearchResultListener l)

  Adds a `ISearchResultListener`. Has no effect when the listener has already been added.

  Specified by:
    `addListener` in interface `ISearchResult`
  Parameters:
    `l` - the listener to be added

### removeListener

    public void removeListener(ISearchResultListener l)

  Removes a `ISearchResultChangedListener`. Has no effect when the listener hasn't previously been added.

  Specified by:
    `removeListener` in interface `ISearchResult`
  Parameters:
    `l` - the listener to be removed

### fireChange

    protected void fireChange(SearchResultEvent e)

  Send the given `SearchResultEvent` to all registered search result listeners.

  Parameters:
    `e` - the event to be sent
  See Also:
    `ISearchResultListener`

### getMatchCount

    public int getMatchCount()

  Returns the total number of matches contained in this search result.

  Returns:
    total number of matches

### getMatchCount

    public int getMatchCount(Object element)

  Returns the number of matches reported against a given element. This is equivalent to calling `getMatches(element).length`

  Parameters:
    `element` - the element to get the match count for
  Returns:
    the number of matches reported against the element

### getElements

    public Object[] getElements()

  Returns an array containing the set of all elements that matches are reported against in this search result.

  Returns:
    the set of elements in this search result

### getEditorMatchAdapter

    public abstract IEditorMatchAdapter getEditorMatchAdapter()

  Returns an implementation of `IEditorMatchAdapter` appropriate for this search result.

  Returns:
    an appropriate adapter or `null` if none has been implemented
  See Also:
    `IEditorMatchAdapter`

### getFileMatchAdapter

    public abstract IFileMatchAdapter getFileMatchAdapter()

  Returns an implementation of `IFileMatchAdapter` appropriate for this search result.

  Returns:
    an appropriate adapter or `null` if none has been implemented
  See Also:
    `IFileMatchAdapter`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.