org.gjt.sp.jedit.textarea
Class TextUtilities

java.lang.Object
  extended by org.gjt.sp.jedit.textarea.TextUtilities

public class TextUtilities
extends java.lang.Object

Class with several utility functions used by the text area component. This is a special version based on v 1.8 adapted by Matt Benson for Jext.

Version:
$Id: TextUtilities.java,v 1.1.1.1 2001/08/20 22:32:16 gfx Exp $
Author:
Slava Pestov, Matt Benson

Field Summary
static int BACKWARD
           
static java.lang.String BRACKETS
           
static int FORWARD
           
 
Constructor Summary
TextUtilities()
           
 
Method Summary
static int findMatchingBracket(SyntaxDocument doc, int offset)
          Returns the offset of the bracket matching the one at the specified offset of the document, or -1 if the bracket is unmatched (or if the character is not a bracket).
static int findTypeChange(java.lang.String line, int pos, int direction)
          Locates the next character type change searching in the specified direction.
static int findWordEnd(java.lang.String line, int pos, java.lang.String noWordSep)
          Locates the end of the word at the specified position.
static int findWordStart(java.lang.String line, int pos, java.lang.String noWordSep)
          Locates the start of the word at the specified position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRACKETS

public static final java.lang.String BRACKETS
See Also:
Constant Field Values

FORWARD

public static final int FORWARD
See Also:
Constant Field Values

BACKWARD

public static final int BACKWARD
See Also:
Constant Field Values
Constructor Detail

TextUtilities

public TextUtilities()
Method Detail

findMatchingBracket

public static int findMatchingBracket(SyntaxDocument doc,
                                      int offset)
                               throws javax.swing.text.BadLocationException
Returns the offset of the bracket matching the one at the specified offset of the document, or -1 if the bracket is unmatched (or if the character is not a bracket).

Parameters:
doc - The document
offset - The offset
Throws:
javax.swing.text.BadLocationException - If an out-of-bounds access was attempted on the document text
Since:
jEdit 3.0pre1

findWordStart

public static int findWordStart(java.lang.String line,
                                int pos,
                                java.lang.String noWordSep)
Locates the start of the word at the specified position.

Parameters:
line - The text
pos - The position
noWordSep - Characters that are non-alphanumeric, but should be treated as word characters anyway

findWordEnd

public static int findWordEnd(java.lang.String line,
                              int pos,
                              java.lang.String noWordSep)
Locates the end of the word at the specified position.

Parameters:
line - The text
pos - The position
noWordSep - Characters that are non-alphanumeric, but should be treated as word characters anyway

findTypeChange

public static int findTypeChange(java.lang.String line,
                                 int pos,
                                 int direction)
Locates the next character type change searching in the specified direction. Included for use with Jext's CsWord Action.

Parameters:
line - The text.
pos - The position.
direction - The direction in which the search should be made.


Copyright ? 2002 Romain Guy.