| java.lang.Object snow.texteditor.DocumentUtils
DocumentUtils | final public class DocumentUtils (Code) | | |
Method Summary | |
public static void | commentOutLines(Document doc, int fromPos, int toPos) comment out the lines between the given document positions (NOT LINE NUMBERS !)
comment out means adding "//" at the beginning of the line. | public static void | deleteLineAtPos(StyledDocument doc, int pos) | public static int | getDocPositionFor(Document doc, int line, int column) | public static int[] | getLineColumnNumbers(Document doc, int pos) | public static int | getLineNumber(Document doc, int pos) | public static int | getLineStartOffsetForPos(StyledDocument doc, int pos) | public static int | getPositionOfCorrespondingClosingBrace(char open, char close, SimpleDocument doc, int pos) -1 if not found open = '{', close = '}'
TODO: ignore comments and string quotes ... | public static int | getPositionOfCorrespondingOpeningBrace(char open, char close, SimpleDocument doc, int pos) -1 if not found open = '{', close = '}'
TODO: ignore comments and string quotes ... | public static int | getPreviousOpeningPosition(SimpleDocument doc, char toSearch, char close, int from, int skipCount) | public static String | getSpacesAtBeginning(String text) | public static String | getTextOfLine(Document doc, int line) | public static String | getTextOfLineAtPosition(StyledDocument doc, int pos) the text at the line containing the given position. | public static String | getTextOfLineAtPosition_onlyUpToPos(StyledDocument doc, int pos) | public static int[] | getVisibleDocPosBounds(JTextPane textPane, JScrollPane editorScrollPane) | public static String | getWordAt(SimpleDocument doc, int pos) take a java single word yyy, NOT xxx.yyy.zzz like the standard editor kit
pos must be in the word or at the beginning. | public static int | getWordEndPosition(SimpleDocument doc, int posInWord) used to find the id on which the mouse is in the editor. | public static void | indentLines(Document doc, int fromPos, int toPos) | public static void | main(String[] a) | public static void | scrollPosToMiddle(int pos, JTextPane textPane, JScrollPane editorScrollPane, int h) | public static void | scrollToMiddle(JTextComponent tp, int pos) In fact, 1/4 below upper limit is nicer... | public static void | unCommentOutLines(Document doc, int fromPos, int toPos) uncomment out the lines between the given document positions (NOT LINE NUMBERS !)
reverse operation of commentOut. | public static void | unindentLines(Document doc, int fromPos, int toPos) |
commentOutLines | public static void commentOutLines(Document doc, int fromPos, int toPos)(Code) | | comment out the lines between the given document positions (NOT LINE NUMBERS !)
comment out means adding "//" at the beginning of the line.
the uncommentout is the reverse operation
|
getDocPositionFor | public static int getDocPositionFor(Document doc, int line, int column)(Code) | | Parameters: line - zero based. Parameters: column - zero based |
getLineColumnNumbers | public static int[] getLineColumnNumbers(Document doc, int pos)(Code) | | the {line,column}, first is 0 |
getLineNumber | public static int getLineNumber(Document doc, int pos)(Code) | | the line number corresponding to the document position.the first line has index 0. |
getLineStartOffsetForPos | public static int getLineStartOffsetForPos(StyledDocument doc, int pos)(Code) | | |
getPositionOfCorrespondingClosingBrace | public static int getPositionOfCorrespondingClosingBrace(char open, char close, SimpleDocument doc, int pos)(Code) | | -1 if not found open = '{', close = '}'
TODO: ignore comments and string quotes ...
|
getPositionOfCorrespondingOpeningBrace | public static int getPositionOfCorrespondingOpeningBrace(char open, char close, SimpleDocument doc, int pos)(Code) | | -1 if not found open = '{', close = '}'
TODO: ignore comments and string quotes ...
|
getPreviousOpeningPosition | public static int getPreviousOpeningPosition(SimpleDocument doc, char toSearch, char close, int from, int skipCount)(Code) | | normally search an {, with close }
|
getTextOfLine | public static String getTextOfLine(Document doc, int line)(Code) | | the text at the line containing the given position |
getTextOfLineAtPosition | public static String getTextOfLineAtPosition(StyledDocument doc, int pos)(Code) | | the text at the line containing the given position. With eventual carriage return and line feeds... |
getTextOfLineAtPosition_onlyUpToPos | public static String getTextOfLineAtPosition_onlyUpToPos(StyledDocument doc, int pos)(Code) | | the text at the line containing the given position |
getWordAt | public static String getWordAt(SimpleDocument doc, int pos)(Code) | | take a java single word yyy, NOT xxx.yyy.zzz like the standard editor kit
pos must be in the word or at the beginning.
give pos-1 if you want the word before the caret.
|
getWordEndPosition | public static int getWordEndPosition(SimpleDocument doc, int posInWord)(Code) | | used to find the id on which the mouse is in the editor.
|
indentLines | public static void indentLines(Document doc, int fromPos, int toPos)(Code) | | Indent the lines between the given document positions (NOT LINE NUMBERS !)
|
scrollToMiddle | public static void scrollToMiddle(JTextComponent tp, int pos)(Code) | | In fact, 1/4 below upper limit is nicer...
scrolls the start of the line to the middle of the screen
|
unCommentOutLines | public static void unCommentOutLines(Document doc, int fromPos, int toPos)(Code) | | uncomment out the lines between the given document positions (NOT LINE NUMBERS !)
reverse operation of commentOut. This only removes // at the beginning
|
unindentLines | public static void unindentLines(Document doc, int fromPos, int toPos)(Code) | | Indents the lines between the given document positions (positions, NOT LINE NUMBERS !)
|
|
|