Following up on the rest of the question...
BTW: why not making SyntaxScheme serializable? Or do you already have some serializing mechanism for syntax schemes?
There's no reason it can't be serializable. Feel free to add a
Feature Request on the SourceForge site if you would like to see this in the future.
You can currently do something similar to serialization by using these methods:
- Code: Select all
public static SyntaxScheme loadFromString(String string);
public String toCommaSeparatedString();
The latter gives you a concise String representation of the scheme (suitable for using as a value in a properties file, for example, to save the scheme), whereas the former is a static utility method to construct a SyntaxScheme from a String saved previously.
There's also a completely undocumented feature for loading a SyntaxScheme from XML. I wanted to develop this further, but quite frankly I've been too lazy to actually follow through with it when there's no real benefit to it (for me at least) when compared with the first method I mentioned above. If you're inclined to use this method, see the method:
- Code: Select all
public static SyntaxScheme load(Font baseFont, InputStream in) throws IOException;
in
SyntaxScheme.java. Using "null" for the baseFont will result in a system-appropriate monospaced font being used (e.g. Monaco or Menlo on OS X). As for the XML structure, well, there
should be a schema for it, but for now you'll have to reverse-engineer it from the XmlParser class at the bottom of SyntaxScheme.java.
Following up on the rest of the question...
[quote]
BTW: why not making SyntaxScheme serializable? Or do you already have some serializing mechanism for syntax schemes?
[/quote]
There's no reason it can't be serializable. Feel free to add a [url=http://sourceforge.net/tracker/?group_id=236909&atid=1101469]Feature Request[/url] on the SourceForge site if you would like to see this in the future.
You can currently do something similar to serialization by using these methods:
[code]
public static SyntaxScheme loadFromString(String string);
public String toCommaSeparatedString();
[/code]
The latter gives you a concise String representation of the scheme (suitable for using as a value in a properties file, for example, to save the scheme), whereas the former is a static utility method to construct a SyntaxScheme from a String saved previously.
There's also a completely undocumented feature for loading a SyntaxScheme from XML. I wanted to develop this further, but quite frankly I've been too lazy to actually follow through with it when there's no real benefit to it (for me at least) when compared with the first method I mentioned above. If you're inclined to use this method, see the method:
[code]
public static SyntaxScheme load(Font baseFont, InputStream in) throws IOException;
[/code]
in [url=http://svn.fifesoft.com/viewvc-1.0.5/bin/cgi/viewvc.cgi/RSyntaxTextArea/trunk/src/org/fife/ui/rsyntaxtextarea/SyntaxScheme.java?view=markup&root=RSyntaxTextArea]SyntaxScheme.java[/url]. Using "null" for the baseFont will result in a system-appropriate monospaced font being used (e.g. Monaco or Menlo on OS X). As for the XML structure, well, there [i]should[/i] be a schema for it, but for now you'll have to reverse-engineer it from the XmlParser class at the bottom of SyntaxScheme.java.