Eclipse Platform
Release 3.2

org.eclipse.search.ui.text
Class AbstractSearchMatchInformationProvider

java.lang.Object
  extended byorg.eclipse.search.ui.text.SearchMatchInformationProvider
      extended byorg.eclipse.search.ui.text.AbstractSearchMatchInformationProvider

public abstract class AbstractSearchMatchInformationProvider
extends SearchMatchInformationProvider

Abstract base class implementing a SearchMatchInformationProvider. Implementors only have to implement scanFile(TextSearchMatchAccess) that calls addLocation(int, int, int) for locations and addLineOffset(int) for the starting offsets of lines.

Since:
3.2

Nested Class Summary
 
Nested classes inherited from class org.eclipse.search.ui.text.SearchMatchInformationProvider
SearchMatchInformationProvider.LineInformation
 
Field Summary
 
Fields inherited from class org.eclipse.search.ui.text.SearchMatchInformationProvider
LOCATION_COMMENT, LOCATION_FUNCTION, LOCATION_IMPORT_OR_INCLUDE_STATEMENT, LOCATION_OTHER, LOCATION_PREPROCESSOR_DIRECTIVE, LOCATION_STRING_LITERAL
 
Constructor Summary
AbstractSearchMatchInformationProvider()
           
 
Method Summary
protected  void addLineOffset(int offset)
          Adds the offset of another line to the list of offsets.
protected  void addLocation(int offset, int length, int kind)
          Adds the location to the list of offsets.
 SearchMatchInformationProvider.LineInformation getLineInformation(TextSearchMatchAccess match)
          Returns information about the lines containing the given match.
 int getLocationKind(TextSearchMatchAccess match)
          Returns the kind of location the given match starts in.
 void reset()
          Notification sent to tell a information provider to clear all cached information.
protected abstract  void scanFile(TextSearchMatchAccess matchAccess)
          Called whenever information about a new file is requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSearchMatchInformationProvider

public AbstractSearchMatchInformationProvider()
Method Detail

reset

public void reset()
Description copied from class: SearchMatchInformationProvider
Notification sent to tell a information provider to clear all cached information.

Overrides:
reset in class SearchMatchInformationProvider

scanFile

protected abstract void scanFile(TextSearchMatchAccess matchAccess)
Called whenever information about a new file is requested. Implementors must scan the file and report lines and locations with addLineOffset() and addLocation().

Parameters:
matchAccess - provides access to the file to be scanned.

addLineOffset

protected final void addLineOffset(int offset)
Adds the offset of another line to the list of offsets. Call this method for every line when scanning a file. The first offset that has to be reported is always 0.

Parameters:
offset - the offset of the next line

addLocation

protected final void addLocation(int offset,
                                 int length,
                                 int kind)
Adds the location to the list of offsets. Call this method for every location when scanning a file.


getLineInformation

public SearchMatchInformationProvider.LineInformation getLineInformation(TextSearchMatchAccess match)
Description copied from class: SearchMatchInformationProvider
Returns information about the lines containing the given match.

Specified by:
getLineInformation in class SearchMatchInformationProvider
Parameters:
match - the match to get the line information for.
Returns:
the information about the provided match.

getLocationKind

public int getLocationKind(TextSearchMatchAccess match)
Description copied from class: SearchMatchInformationProvider
Returns the kind of location the given match starts in.

Overrides:
getLocationKind in class SearchMatchInformationProvider
Parameters:
match - the match to get the location for
Returns:
one of the location constants defined in SearchMatchInformationProvider.

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

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