Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How to syntax color/highlight Javascript node inside XML node?
How to syntax color/highlight Javascript node inside XML node? [message #544300] Fri, 02 July 2010 09:35
xemox  is currently offline xemox Friend
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!
Previous Topic:How to get list of Java J2EE Module Dependency programmatically ?
Next Topic:Tomcat deployment not including Ivy artifacts?
Goto Forum:
  


Current Time: Sun Dec 21 14:24:48 GMT 2014

Powered by FUDForum. Page generated in 0.01809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software