How to syntax color/highlight Javascript node inside XML node? [message #544300] |
Fri, 02 July 2010 09:35 |
xemox Messages: 9 Registered: May 2010 |
Junior Member |
|
|
We have a lot of custom made application XML files that includes Javascript code. We would like to syntax highlight JS code inside these XML nodes in Eclipse.
How can we do this?
I have looked at jsdt.web.core and jsdt.web.ui to understand embedded JS in HTML, but so far no use
1. Tried to apply JSDT FormattingStrategy to JS node. :
if (IStructuredPartitions.UNKNOWN_PARTITION.equals(contentTypes[i]) || IHTMLPartitions.SCRIPT.equals(contentTypes[i]) || IHTMLPartitions.SCRIPT_EVENTHANDLER.equals(contentTypes[i])) {
((MultiPassContentFormatter) formatter).setSlaveStrategy(new FormattingStrategyJSDT(), contentTypes[i]);
}
Tried to find the StructurePartition related with JS node andtried the following partition in the IF condition(above):
IStructuredPartitions.UNKNOWN_PARTITION
IHTMLPartitions.HTML_DEFAULT
IXMLPartitions.XML_DEFAULT
2. Played with translate() and translateJSNode() methods - NO USE
3. Replaced <scriptcode> (custom XML element with JS code inside) and with <script> tag before translation, so that the translator will accept the node as script node(BLOCK_TEXT) and translate it as JS node. TRIED, not successful
Any tips where to look, to start and couple of examples would be perfect ?
looking forward to get some feedback from you
Thanks!
|
|
|
Powered by
FUDForum. Page generated in 0.02949 seconds