org.eclipse.cdt.core
Interface IPositionConverter

All Known Implementing Classes:
PositionTracker, SimplePositionTracker

public interface IPositionConverter

Allows for converting character ranges of files previously stored on disk to the range where the characters are found in the current version of the file. The current version can be the content of a dirty editor, or if there is none, the latest verison of the file as stored on disk. As long as the underlying text of the character range has not been modified the converted range will have the same underlying text. Insertions at the beginning or the end of the text are not added to the converted range. An insertion inside the underlying text will increase the length of the converted range, a deletion of one of the characters will decrease it. An deletion followed by an insertion without saving the file inbetween, will cancel the deletion as far as possible.

This interface is not intended to be implemented by clients.

EXPERIMENTAL. This interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same. Please do not use this API without consulting with the CDT team.

Since:
4.0

Method Summary
 org.eclipse.jface.text.IRegion actualToHistoric(org.eclipse.jface.text.IRegion actualPosition)
          Converts an actual character range to the range where the underlying text was originally found.
 org.eclipse.jface.text.IRegion historicToActual(org.eclipse.jface.text.IRegion historicPosition)
          Converts a historic character range to the range where the underlying text currently can be found.
 

Method Detail

actualToHistoric

org.eclipse.jface.text.IRegion actualToHistoric(org.eclipse.jface.text.IRegion actualPosition)
Converts an actual character range to the range where the underlying text was originally found.

Parameters:
actualPosition - a range as found in the current text buffer for the file.
Returns:
a range suitable for the version of the file for which the converter was obtained.

historicToActual

org.eclipse.jface.text.IRegion historicToActual(org.eclipse.jface.text.IRegion historicPosition)
Converts a historic character range to the range where the underlying text currently can be found.

Parameters:
historicPosition - a range as found in the version of the file for which the converter was obtained.
Returns:
a range suitable for the current text buffer of the file.