|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.editor.TextUtils
public class TextUtils
Class with several utility functions used by the CodeEditor
.
Constructor Summary | |
---|---|
TextUtils()
|
Method Summary | |
---|---|
static String |
createWhiteSpace(int len,
int tabSize,
boolean replaceTabWithSpaces)
Creates a string of white space with the specified length. |
static String |
createWhiteSpace(int len,
int tabSize,
boolean replaceTabWithSpaces,
int start)
Creates a string of white space with the specified length. |
static int |
findMatchingBracket(Document 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 |
findPreviousOpenBracket(Document doc,
int offset)
|
static int |
findWordEnd(String line,
int pos,
String noWordDelimiters)
Locates the end of the word at the specified position. |
static int |
findWordEnd(String line,
int pos,
String noWordDelimiters,
boolean joinNonWordChars)
Locates the end of the word at the specified position. |
static int |
findWordEnd(String line,
int pos,
String noWordDelimiters,
boolean joinNonWordChars,
boolean eatWhitespace)
Locates the end of the word at the specified position. |
static int |
findWordStart(String line,
int pos,
String noWordSep)
Locates the start of the word at the specified position. |
static int |
findWordStart(String line,
int pos,
String noWordSep,
boolean joinNonWordChars)
Locates the start of the word at the specified position. |
static int |
findWordStart(String line,
int pos,
String noWordDelimiters,
boolean joinNonWordChars,
boolean eatWhitespace)
Locates the start of the word at the specified position. |
static String |
getLeadingWhitespace(String line)
|
static String |
getLineBreak(int lineBreakType)
|
static boolean |
isBracket(char c)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextUtils()
Method Detail |
---|
public static int findPreviousOpenBracket(Document doc, int offset) throws BadLocationException
BadLocationException
public static int findMatchingBracket(Document doc, int offset) throws BadLocationException
doc
- The documentoffset
- The offset
BadLocationException
- If an out-of-bounds access
was attempted on the document textpublic static int findWordStart(String line, int pos, String noWordSep)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anyway
public static int findWordStart(String line, int pos, String noWordSep, boolean joinNonWordChars)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one word
public static int findWordStart(String line, int pos, String noWordDelimiters, boolean joinNonWordChars, boolean eatWhitespace)
line
- The textpos
- The positionnoWordDelimiters
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one wordeatWhitespace
- Include whitespace at start of word
public static int findWordEnd(String line, int pos, String noWordDelimiters)
line
- The textpos
- The positionnoWordDelimiters
- Characters that are non-alphanumeric, but
should be treated as word characters anyway
public static int findWordEnd(String line, int pos, String noWordDelimiters, boolean joinNonWordChars)
line
- The textpos
- The positionnoWordDelimiters
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one word
public static int findWordEnd(String line, int pos, String noWordDelimiters, boolean joinNonWordChars, boolean eatWhitespace)
line
- The textpos
- The positionnoWordDelimiters
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one wordeatWhitespace
- Include whitespace at end of word
public static String getLeadingWhitespace(String line)
public static String createWhiteSpace(int len, int tabSize, boolean replaceTabWithSpaces, int start)
To get a whitespace string tuned to the current buffer's settings, call this method as follows:
myWhitespace = MiscUtilities.createWhiteSpace(myLength, (buffer.getBooleanProperty("noTabs") ? 0 : buffer.getTabSize()));
len
- The lengthtabSize
- The tab size, or 0 if tabs are not to be usedreplaceTabWithSpaces
- the flag indicating if it will use space instead of tabstart
- The start offset, for tab alignment
public static String createWhiteSpace(int len, int tabSize, boolean replaceTabWithSpaces)
To get a whitespace string tuned to the current buffer's settings, call this method as follows:
myWhitespace = TextUtils.createWhiteSpace(myLength, (buffer.getBooleanProperty("noTabs") ? 0 : buffer.getTabSize()));
len
- The lengthtabSize
- The tab size, or 0 if tabs are not to be usedreplaceTabWithSpaces
- the flag indicating if it will use space instead of tab
public static String getLineBreak(int lineBreakType)
public static boolean isBracket(char c)
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |