public class TextComponentUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TextComponentUtil.Direction |
| Constructor and Description |
|---|
TextComponentUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
adjustForLineComment(JTextComponent editor,
int iStart) |
static void |
deleteWordAtCaret(JTextComponent editor) |
static void |
expandSelectionIfNeeded(JTextComponent editor) |
static int |
findCharacterPositionOnLine(int startPosition,
String string,
char charToFind,
TextComponentUtil.Direction d) |
static int |
findNonWhitespacePositionAfter(String script,
int position) |
static int |
findNonWhitespacePositionBefore(String script,
int position) |
protected static String |
findPreviousTextChunk(int startPosition,
String text) |
static void |
fixTextComponentKeyMap(JTextComponent editor) |
static int |
getColumnAtPosition(JTextComponent editor,
int caretPosition) |
static int |
getDeepestWhiteSpaceLineStartAfter(String script,
int offset)
Eats whitespace lines after the given offset until it finds a non-whitespace line and
returns the start of the last whitespace line found, or the initial value if none was.
|
static String |
getIdentifierAtCaret(GosuEditorPane editor) |
static int |
getLineAtPosition(JTextComponent editor,
int position)
Gets the line at a given position in the editor
|
static int |
getLineEnd(String text,
int initialCaretPosition) |
static int |
getLineStart(String text,
int initialCaretPosition) |
static int[] |
getLineStartAndEndPositions(String text,
int initialCaretPosition)
This will return a two element array, start line pos and end line pos.
|
static String |
getMemberAtCaret(JTextComponent editor) |
static Dimension |
getMemberDimensionAtCaret(JTextComponent editor) |
static int |
getNextWordPostition(int pos,
String source,
boolean consumeWhitespaceFirst) |
static int |
getWhiteSpaceLineStartAfter(String script,
int end)
Returns the start of the next line if that line is only whitespace.
|
static int |
getWhiteSpaceLineStartBefore(String script,
int start)
Returns the start of the previous line if that line is only whitespace.
|
static int |
getWhiteSpaceOrCommentLineStartAfter(String script,
int end)
Returns the start of the next line if that line is only whitespace.
|
static int |
getWhiteSpaceOrCommentLineStartBefore(String script,
int start)
Returns the start of the previous line if that line is only whitespace.
|
static String |
getWordAtCaret(JTextComponent editor) |
static String |
getWordBeforeCaret(JTextComponent editor) |
static String |
getWordBeforePos(JTextComponent editor,
int iPos) |
static Dimension |
getWordDimensionAtCaret(JTextComponent editor) |
static Dimension |
getWordDimensionBeforeCaret(JTextComponent editor) |
static int |
getWordEnd(JTextComponent editor,
int iCaretPos) |
static int |
getWordStart(JTextComponent editor,
int iOffset) |
static void |
handleHomeKey(JTextComponent editor) |
static boolean |
isNonWhitespaceBetween(JTextComponent editor,
int iStart,
int iEnd) |
static boolean |
isValidIdentifier(CharSequence seqId,
boolean acceptDot) |
static void |
jumpLeft(JTextComponent editor) |
static void |
jumpRight(JTextComponent editor) |
static String |
makeValidIdentifier(String str,
boolean acceptDot,
boolean bAcceptUnderscore) |
static int |
replaceWordAtCaret(JTextComponent editor,
String strText) |
static void |
replaceWordAtCaretDynamic(JTextComponent editor,
String strText,
IReplaceWordCallback replaceWordCallback,
boolean selectFirstArg) |
static void |
replaceWordAtCaretDynamicAndRemoveEmptyParens(JTextComponent editor,
String strText,
IReplaceWordCallback replaceWordCallback,
boolean selectFirstArg) |
static void |
replaceWordAtCaretNice(JTextComponent editor,
String strText) |
static void |
replaceWordAtClosestDot(JTextComponent editor,
String strText) |
static int |
replaceWordBeforeCaret(JTextComponent editor,
String strText) |
static void |
selectLeft(JTextComponent editor) |
static void |
selectLineAtCaret(JTextComponent editor) |
static void |
selectRight(JTextComponent editor) |
static void |
selectWordAtCaret(JTextComponent editor) |
static void |
showPasteBufferDialogForComponent(JTextComponent component) |
static void |
unindentLineAtCaret(JTextComponent editor) |
public static int findCharacterPositionOnLine(int startPosition,
String string,
char charToFind,
TextComponentUtil.Direction d)
public static String getWordAtCaret(JTextComponent editor)
public static String getWordBeforeCaret(JTextComponent editor)
public static String getWordBeforePos(JTextComponent editor, int iPos)
public static Dimension getWordDimensionAtCaret(JTextComponent editor)
public static Dimension getWordDimensionBeforeCaret(JTextComponent editor)
public static Dimension getMemberDimensionAtCaret(JTextComponent editor)
public static String getMemberAtCaret(JTextComponent editor)
public static void selectWordAtCaret(JTextComponent editor)
public static void replaceWordAtClosestDot(JTextComponent editor, String strText)
public static int replaceWordAtCaret(JTextComponent editor, String strText)
public static int replaceWordBeforeCaret(JTextComponent editor, String strText)
public static void replaceWordAtCaretNice(JTextComponent editor, String strText)
public static void replaceWordAtCaretDynamic(JTextComponent editor, String strText, IReplaceWordCallback replaceWordCallback, boolean selectFirstArg)
public static void replaceWordAtCaretDynamicAndRemoveEmptyParens(JTextComponent editor, String strText, IReplaceWordCallback replaceWordCallback, boolean selectFirstArg)
public static int getWordStart(JTextComponent editor, int iOffset) throws BadLocationException
BadLocationExceptionpublic static int getWordEnd(JTextComponent editor, int iCaretPos) throws BadLocationException
BadLocationExceptionpublic static int adjustForLineComment(JTextComponent editor, int iStart) throws BadLocationException
BadLocationExceptionpublic static boolean isNonWhitespaceBetween(JTextComponent editor, int iStart, int iEnd)
public static int[] getLineStartAndEndPositions(String text, int initialCaretPosition)
public static int getLineStart(String text, int initialCaretPosition)
public static int getLineEnd(String text, int initialCaretPosition)
public static void deleteWordAtCaret(JTextComponent editor) throws BadLocationException
BadLocationExceptionpublic static int getLineAtPosition(JTextComponent editor, int position)
public static int getColumnAtPosition(JTextComponent editor, int caretPosition)
public static int getWhiteSpaceLineStartBefore(String script, int start)
public static int getWhiteSpaceLineStartAfter(String script, int end)
public static int getWhiteSpaceOrCommentLineStartBefore(String script, int start)
public static int getWhiteSpaceOrCommentLineStartAfter(String script, int end)
public static int getDeepestWhiteSpaceLineStartAfter(String script, int offset)
public static int findNonWhitespacePositionAfter(String script, int position)
public static int findNonWhitespacePositionBefore(String script, int position)
public static int getNextWordPostition(int pos,
String source,
boolean consumeWhitespaceFirst)
public static void fixTextComponentKeyMap(JTextComponent editor)
public static void expandSelectionIfNeeded(JTextComponent editor)
public static void selectLineAtCaret(JTextComponent editor)
public static void selectRight(JTextComponent editor)
public static void jumpRight(JTextComponent editor)
public static void jumpLeft(JTextComponent editor)
public static void selectLeft(JTextComponent editor)
public static void handleHomeKey(JTextComponent editor)
public static void showPasteBufferDialogForComponent(JTextComponent component)
public static void unindentLineAtCaret(JTextComponent editor) throws BadLocationException
BadLocationExceptionpublic static String getIdentifierAtCaret(GosuEditorPane editor)
public static boolean isValidIdentifier(CharSequence seqId, boolean acceptDot)
Copyright © 2018. All rights reserved.