public class DocumentUtils extends Object
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Constructor and Description |
---|
DocumentUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
analyzeEditorDocument(JTextPane ed,
boolean showFullStructure) |
static String |
createIndent(int level,
String indentElement) |
static List |
findElements(Document doc,
String pattern) |
static Element |
getCommandElementPriorTo(Document doc,
int offset) |
static String |
getCommandForMap(String command,
LinkedHashMap<String,Object> t) |
static String |
getCommandForValueMap(List v,
Map t) |
static Element |
getElementAfter(Element el) |
static Element |
getElementForLine(Document doc,
int lineNumber,
Element e) |
static Element |
getElementForOffset(Document doc,
int offset) |
static Element |
getElementPriorTo(Document doc,
int offset) |
static String |
getElementText(Element e)
Get element text in a thread safe mode.
|
static String |
getElementText(Element e,
boolean stripNewLines)
Get element text in a thread safe mode.
|
static int |
getLineForOffset(Document doc,
int offset) |
static int |
getOffsetForLine(Document doc,
int line) |
static int |
getOffsetForLine(Document doc,
int line,
int column) |
static int |
getTextStart(Element e)
Get the text offset, i.e.
|
static Map |
getTokens(Element e,
List v) |
static String |
indentToRight(StyledDocument doc,
String indentElement,
int[] offsets) |
static boolean |
isComment(Element e) |
static boolean |
isComment(String text) |
static void |
printWithOffset(Document doc,
int offset) |
static void |
updateCommand(Element e,
Map valueMap) |
public static boolean isComment(Element e)
public static boolean isComment(String text)
public static String getElementText(Element e)
e
- a document element.public static String getElementText(Element e, boolean stripNewLines) throws BadLocationException
e
- a document element.stripNewLines
- true will remove all new line characters from the
resulting text.BadLocationException
- on an error to read text
from the specified element.public static void analyzeEditorDocument(JTextPane ed, boolean showFullStructure)
public static String getCommandForMap(String command, LinkedHashMap<String,Object> t)
public static void updateCommand(Element e, Map valueMap) throws BadLocationException
BadLocationException
public static int getLineForOffset(Document doc, int offset)
public static int getOffsetForLine(Document doc, int line)
public static int getOffsetForLine(Document doc, int line, int column)
public static String indentToRight(StyledDocument doc, String indentElement, int[] offsets)
public static void printWithOffset(Document doc, int offset) throws BadLocationException
BadLocationException
public static int getTextStart(Element e)
e
- a document element.