diff options
Diffstat (limited to 'org.eclipse.jface.text/src/org')
3 files changed, 34 insertions, 21 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java index c329c61f04f..64bd558085b 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultCharacterPairMatcher.java @@ -108,18 +108,17 @@ public class DefaultCharacterPairMatcher implements ICharacterPairMatcher, IChar } /** - * @see org.eclipse.jface.text.source.ICharacterPairMatcherExtension#findEnclosingPeerCharacters(org.eclipse.jface.text.IDocument, - * int) + * @see org.eclipse.jface.text.source.ICharacterPairMatcherExtension#findEnclosingPeerCharacters(org.eclipse.jface.text.IDocument, int) * @since 3.8 */ - public IRegion findEnclosingPeerCharacters(IDocument doc, int offset) { - if (doc == null || offset < 0 || offset > doc.getLength()) + public IRegion findEnclosingPeerCharacters(IDocument document, int offset) { + if (document == null || offset < 0 || offset > document.getLength()) return null; try { for (int offset1= offset; offset1 >= 0; offset1--) { - char prevChar= doc.getChar(Math.max(offset1 - 1, 0)); + char prevChar= document.getChar(Math.max(offset1 - 1, 0)); if (fPairs.contains(prevChar) && fPairs.isStartCharacter(prevChar)) { - IRegion match= performMatch(doc, offset1); + IRegion match= performMatch(document, offset1); if (match != null) { int matchOffset= match.getOffset(); int matchLength= match.getLength(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java index b969b8fa4c4..6a7e8d9202a 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcher.java @@ -22,6 +22,20 @@ import org.eclipse.jface.text.IRegion; * character and if it finds one, delivers the minimal region of the document that contains both * characters. * + * <p> + * In order to provide backward compatibility for clients of <code>ICharacterPairMatcher</code>, + * extension interfaces are used to provide a means of evolution. The following extension interface + * exists: + * <ul> + * <li>{@link org.eclipse.jface.text.source.ICharacterPairMatcherExtension} since version 3.8 + * introducing the concept of enclosing peer characters at a caret offset.</li> + * </ul> + * </p> + * <p> + * Clients may implement this interface and its extension interface or use the default + * implementation provided by <code>DefaultCharacterPairMatcher</code>. + * </p> + * * @see org.eclipse.jface.text.source.ICharacterPairMatcherExtension * @since 2.1 */ @@ -50,16 +64,17 @@ public interface ICharacterPairMatcher { void clear(); /** - * Starting at the given offset, the matcher chooses a character close to this offset. - * The matcher then searches for the matching peer character of the chosen character - * and if it finds one, returns the minimal region of the document that contains both characters. - * It returns <code>null</code> if there is no peer character. - * - * @param iDocument the document to work on - * @param i the start offset - * @return the minimal region containing the peer characters + * Starting at the given offset, the matcher chooses a character close to this offset. The + * matcher then searches for the matching peer character of the chosen character and if it finds + * one, returns the minimal region of the document that contains both characters. It returns + * <code>null</code> if there is no peer character. + * + * @param document the document to work on + * @param offset the start offset + * @return the minimal region containing the peer characters and <code>null</code> if there is + * no peer character. */ - IRegion match(IDocument iDocument, int i); + IRegion match(IDocument document, int offset); /** * Returns the anchor for the region of the matching peer characters. The anchor diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcherExtension.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcherExtension.java index f5c114b0bfa..1c03e232317 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcherExtension.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/ICharacterPairMatcherExtension.java @@ -28,11 +28,10 @@ public interface ICharacterPairMatcherExtension { * Starting at the given offset, the matcher searches for a pair of enclosing peer characters * and if it finds one, returns the minimal region of the document that contains the pair. * - * It returns <code>null</code> if there is no enclosing pair. - * - * @param iDocument the document to work on - * @param i the start offset - * @return the minimal region containing the peer characters + * @param document the document to work on + * @param offset the start offset + * @return the minimal region containing the peer characters or <code>null</code> if there is no + * enclosing pair */ - IRegion findEnclosingPeerCharacters(IDocument iDocument, int i); + IRegion findEnclosingPeerCharacters(IDocument document, int offset); } |