Gridarta Editor
net.sf.gridarta.textedit.textarea.TextUtilities Class Reference

Class with several utility functions used by the text area component. More...

+ Collaboration diagram for net.sf.gridarta.textedit.textarea.TextUtilities:

Static Public Member Functions

static int findMatchingBracket (final Document doc, final int offset) throws 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). More...
 
static int findWordEnd (final CharSequence line, final int pos, final String noWordSep)
 Locates the end of the word at the specified position. More...
 
static int findWordStart (final CharSequence line, final int pos, final String noWordSep)
 Locates the start of the word at the specified position. More...
 

Private Member Functions

 TextUtilities ()
 Prevent instantiation. More...
 

Static Private Member Functions

static boolean selectNoLetter (final char ch, final String noWordSep)
 Returns whether a character is not part of a word. More...
 

Detailed Description

Class with several utility functions used by the text area component.

Author
Slava Pestov

Definition at line 20 of file TextUtilities.java.

Constructor & Destructor Documentation

◆ TextUtilities()

net.sf.gridarta.textedit.textarea.TextUtilities.TextUtilities ( )
private

Prevent instantiation.

Definition at line 25 of file TextUtilities.java.

Member Function Documentation

◆ findMatchingBracket()

static int net.sf.gridarta.textedit.textarea.TextUtilities.findMatchingBracket ( final Document  doc,
final int  offset 
) throws BadLocationException
static

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
docthe document
offsetthe offset
Returns
the offset or
-1
Exceptions
BadLocationExceptionif an out-of-bounds access was attempted on the document text

Definition at line 38 of file TextUtilities.java.

Referenced by net.sf.gridarta.textedit.textarea.JEditTextArea.MouseHandler.doDoubleClick(), and net.sf.gridarta.textedit.textarea.JEditTextArea.updateBracketHighlight().

+ Here is the caller graph for this function:

◆ findWordEnd()

static int net.sf.gridarta.textedit.textarea.TextUtilities.findWordEnd ( final CharSequence  line,
final int  pos,
final String  noWordSep 
)
static

Locates the end of the word at the specified position.

Parameters
linethe text
posthe position
noWordSepcharacters that are not part of a word; may be
null
Returns
the end position of the word

Definition at line 174 of file TextUtilities.java.

References net.sf.gridarta.textedit.textarea.TextUtilities.selectNoLetter().

Referenced by net.sf.gridarta.textedit.textarea.actions.DeleteWord.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.NextWord.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findWordStart()

static int net.sf.gridarta.textedit.textarea.TextUtilities.findWordStart ( final CharSequence  line,
final int  pos,
final String  noWordSep 
)
static

Locates the start of the word at the specified position.

Parameters
linethe text
posthe position
noWordSepcharacters that are not part of a word; may be
null
Returns
the start position of the word

Definition at line 149 of file TextUtilities.java.

References net.sf.gridarta.textedit.textarea.TextUtilities.selectNoLetter().

Referenced by net.sf.gridarta.textedit.textarea.actions.BackspaceWord.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.PrevWord.actionPerformed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectNoLetter()

static boolean net.sf.gridarta.textedit.textarea.TextUtilities.selectNoLetter ( final char  ch,
final String  noWordSep 
)
staticprivate

Returns whether a character is not part of a word.

Parameters
chthe character
noWordSepcharacters that are not part of a word; may be
null
Returns
whether the character is not part of a word

Definition at line 197 of file TextUtilities.java.

Referenced by net.sf.gridarta.textedit.textarea.TextUtilities.findWordEnd(), and net.sf.gridarta.textedit.textarea.TextUtilities.findWordStart().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: