public class DocumentParser
extends Object
| Constructor and Description |
|---|
DocumentParser() |
| Modifier and Type | Method and Description |
|---|---|
static int |
find(Document doc,
String searchFor,
int pos,
boolean forward)
Find string in the document and get the offset of the starting element.
|
static Point |
findPosition(Document doc,
String searchFor,
int pos,
boolean forward)
Find string in the document and get the column/line location.
|
static Document |
getDocument(String text,
String style)
Creates the document.
|
static String |
getText(Document doc,
int pos)
Gets the part of the document.
|
static String |
getText(Document doc,
int pos,
int length)
Gets the part of the document.
|
static void |
insert(Document doc,
String text,
int pos)
Insert text into document.
|
static int |
location2Offset(Document doc,
Point location)
Get the position in the document from line/column coordinates.
|
static void |
remove(Document doc,
int pos,
int length)
Removes the part of the document.
|
static void |
replace(Document doc,
String text,
int pos,
int length)
Replace text at the position.
|
static void |
replace(Document doc,
String text,
Point location,
int length)
Replace.
|
public static int find(Document doc,
String searchFor,
int pos,
boolean forward)
throws BadLocationException
doc - the documentsearchFor - the string to search forpos - the position to start searching fromforward - if true search forward, otherwise backwardBadLocationException - in case of errorpublic static Point findPosition(Document doc,
String searchFor,
int pos,
boolean forward)
throws BadLocationException
doc - the documentsearchFor - the string to search forpos - the position to start searching fromforward - if true search forward, otherwise backwardBadLocationException - in case of errorpublic static Document getDocument(String text,
String style)
throws BadLocationException
text - the textstyle - the styleBadLocationException - in case of errorpublic static String getText(Document doc,
int pos)
throws BadLocationException
doc - the documentpos - the starting positionBadLocationException - in case of errorpublic static String getText(Document doc,
int pos,
int length)
throws BadLocationException
doc - the documentpos - the starting positionlength - the length of the text to removeBadLocationException - in case of errorpublic static void insert(Document doc,
String text,
int pos)
throws BadLocationException
doc - the documenttext - the textpos - the position to insert text intoBadLocationException - in case of errorpublic static int location2Offset(Document doc,
Point location)
doc - the documentlocation - the line/column coordinatespublic static void remove(Document doc,
int pos,
int length)
throws BadLocationException
doc - the documentpos - the starting positionlength - the length of the text to removeBadLocationException - in case of errorpublic static void replace(Document doc,
String text,
int pos,
int length)
throws BadLocationException
doc - the documenttext - the textpos - the positionlength - the length of the text to replaceBadLocationException - the bad location exceptionpublic static void replace(Document doc,
String text,
Point location,
int length)
throws BadLocationException
doc - the doctext - the textlocation - the locationlength - the lengthBadLocationException - the bad location exceptionCopyright © 2010-2020 Toolsverse. All Rights Reserved.