public class OptionStore extends DefaultHandler
Constructor and Description |
---|
OptionStore() |
Modifier and Type | Method and Description |
---|---|
static void |
addRecentFile(String path)
Add file path to recent file list.
|
static Object |
getOption(String name)
get the saved value of an option
|
static <T> T |
getOption(String name,
T defValue)
get the saved value of an option with a fallback value.
|
static List<String> |
getRecentFiles()
Get the list of recent files.
|
static void |
init(String name)
Initialise the option store: this should be called by the launcher once and only once.
|
static void |
removeOption(String name)
remove a saved option.
|
static void |
saveOptions()
save all options in a file, to restore them at next run.
|
static void |
setOption(String name,
Object value)
save the value of an option.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
Handler to parse the saved file.
|
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public static void init(String name) throws Exception
name
- Exception
public static void addRecentFile(String path)
path
- the path to add to the listpublic static List<String> getRecentFiles()
public static void setOption(String name, Object value)
name
- unique name (key) of the optionvalue
- an object giving the value of this optionpublic static Object getOption(String name)
name
- uniq name (key) of the optionpublic static <T> T getOption(String name, T defValue)
name
- unique name (key) of the optiondefValue
- value to return if this option is not definedpublic static void removeOption(String name)
name
- unique name (key) of the optionpublic static void saveOptions()
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
Copyright © 2005–2020. All rights reserved.