by robert » Tue May 22, 2012 12:24 pm
I'm a little unclear - when you obfuscate, are you also removing/changing the package structure? That's the most obvious culprit, but it sounds like you have this problem even when not obfuscating the CustomXMLTokenMaker class?
The easiest way around this is to set the TokenMaker directly on the RSyntaxDocument (not sure why I added this method, but it's there):
- Code: Select all
RSyntaxTextArea textArea = new RSyntaxTextArea(...);
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
doc.setSyntaxStyle(new CustomXMLTokenMaker());
In other words, bypass the TokenMakerFactory altogether. If you want the highlighting for other languages of course, this is a little inflexible, though you could hack together something like this until we find a better solution:
- Code: Select all
public static void setSyntaxStyle(RSyntaxTextArea textArea, String style) {
if ("text/xmlNCC".equals(style)) {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
doc.setSyntaxStyle(new CustomXMLTokenMaker());
}
else {
textArea.setSyntaxEditingStyle(style);
}
}
I cringe at the idea of suggesting that though. Let me know whether I'm correct about the package obfuscation.
I'm a little unclear - when you obfuscate, are you also removing/changing the package structure? That's the most obvious culprit, but it sounds like you have this problem even when not obfuscating the CustomXMLTokenMaker class?
The easiest way around this is to set the TokenMaker directly on the RSyntaxDocument (not sure why I added this method, but it's there):
[code]
RSyntaxTextArea textArea = new RSyntaxTextArea(...);
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
doc.setSyntaxStyle(new CustomXMLTokenMaker());
[/code]
In other words, bypass the TokenMakerFactory altogether. If you want the highlighting for other languages of course, this is a little inflexible, though you could hack together something like this until we find a better solution:
[code]
public static void setSyntaxStyle(RSyntaxTextArea textArea, String style) {
if ("text/xmlNCC".equals(style)) {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
doc.setSyntaxStyle(new CustomXMLTokenMaker());
}
else {
textArea.setSyntaxEditingStyle(style);
}
}
[/code]
I cringe at the idea of suggesting that though. Let me know whether I'm correct about the package obfuscation.