Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » JS editor adaptions(What is the best strategy to adapt existing javascript editor functionality?)
JS editor adaptions [message #661367] Thu, 24 March 2011 12:06 Go to next message
Dwight Johnson is currently offline Dwight JohnsonFriend
Messages: 19
Registered: March 2011
Junior Member
Hello,

I have to implement an Eclipse plugin that will offer all functionality of the regular javascript editor (highlighting, code completion, hover, etc, etc), but it needs to support an adapted version of the javascript language (CSS TV Profile 1.0), with some old functionality stripped and new functionality added. What is the best way to do this:

1) build an editor from scratch?
2) reuse existing js editor code?

Can you give me some pointers please? Example code?

Thanks in advance!
Re: JS editor adaptions [message #661422 is a reply to message #661367] Thu, 24 March 2011 15:28 Go to previous messageGo to next message
Dwight Johnson is currently offline Dwight JohnsonFriend
Messages: 19
Registered: March 2011
Junior Member
In my first post I mixed up javascript and CSS.
In reality I need to create 2 editors, for javascript and css, both with modified language syntax.

I have been reading about the subject...
I get the impression that a possible way forward is to use the StructuredTextEditor and work with org.eclipse.wst.sse.ui.editorConfiguration.

Is that true?
Re: JS editor adaptions [message #661634 is a reply to message #661422] Fri, 25 March 2011 15:57 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Dwight,

It looks like the syntax for CSS TV is the same as CSS2, so that makes things a lot easier.

You can use the extension point "org.eclipse.wst.sse.core.cssprofile" in order to add this new profile. The profile is what specifies your selectors, pseudo-classes/elements, and properties. You can follow the example of the other existing profiles and you'll likely be able to use cssprofile-css2.xml as a basis for your implementation. The existing css profiles can be found in the org.eclipse.wst.css.core plug-in. Hopefully that'll get you started on the CSS portion.

[Updated on: Fri, 25 March 2011 15:58]

Report message to a moderator

Re: JS editor adaptions [message #662315 is a reply to message #661634] Wed, 30 March 2011 08:55 Go to previous message
Dwight Johnson is currently offline Dwight JohnsonFriend
Messages: 19
Registered: March 2011
Junior Member
Hi Nick!

thanks, in the mean time I discovered this link:

http://www.eclipse.org/forums/index.php?t=msg&th=166649& amp;start=0&

And indeed it is possible to define a new profile and add it to your plugin.xml in the <extension> tag:

<profile
name="%cssprofile_csstv1_0.name"
uri="cssprofile/cssprofile- csstv1_0.xml"
id="org.eclipse.wst.css.core.cssprofile. csstv1_0">
</profile>

The link also gives a way to change profiles programmatically.

Problem solved.
thanks.
Previous Topic:Unable to start JBOSS 5 from eclise IDE [Galileo]
Next Topic:How to capture perspective changes?
Goto Forum:
  


Current Time: Fri Nov 28 00:36:57 GMT 2014

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

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