public final class TextTagParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TextTagParser.TextAnalyzer |
Modifier and Type | Field and Description |
---|---|
private static String |
KEY_PATTERN |
private static int |
MAX_KEY_COUNT |
private static int |
MAX_KEY_LENGTH |
private static int |
MAX_VALUE_LENGTH |
Modifier | Constructor and Description |
---|---|
private |
TextTagParser() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
getValidatedTagsFromText(String buf) |
static Map<String,String> |
readTagsByRegexp(String text,
String splitRegex,
String tagRegex,
boolean unescapeTextInQuotes)
Try to find tag-value pairs in given text
|
static Map<String,String> |
readTagsFromText(String buf)
Apply different methods to extract tag-value pairs from arbitrary text
|
static void |
showBadBufferMessage(String helpTopic)
Shows message that the buffer can not be pasted, allowing user to clean the buffer
|
protected static String |
unescape(String k) |
static boolean |
validateTags(Map<String,String> tags)
Check tags for correctness and display warnings if needed
|
private static int |
warning(String text,
String data,
String code) |
private static final int MAX_KEY_LENGTH
private static final int MAX_KEY_COUNT
private static final String KEY_PATTERN
private static final int MAX_VALUE_LENGTH
private TextTagParser()
public static Map<String,String> readTagsByRegexp(String text, String splitRegex, String tagRegex, boolean unescapeTextInQuotes)
text
- - text in which tags are looked forsplitRegex
- - text is splitted into parts with this delimitertagRegex
- - each part is matched against this regexunescapeTextInQuotes
- - if true, matched tag and value will be analyzed more thoroughlypublic static Map<String,String> getValidatedTagsFromText(String buf)
public static Map<String,String> readTagsFromText(String buf)
buf
- bufferpublic static boolean validateTags(Map<String,String> tags)
tags
- - map key->value to checkpublic static void showBadBufferMessage(String helpTopic)
helpTopic
- the help topic of the parent action
TODO: Replace by proper HelpAwareOptionPane instead of self-made help link