A Simple Solution For NetBeans RCP Apps That Need A Groovy Editor

Take a look at Nils Hoffmann's metabolomic analyzer, especially at the Groovy editor contained within it:

Obviously, it would be cool if the Groovy editor in the app above were to have syntax coloring and other editor features helpful in coding Groovy.

However, as I showed in If You Include the Groovy Editor, there are multiple dependencies that the NetBeans Groovy support has on other modules that would be completely superfluous in the above application, while they'd make the app much heavier than it is, simply because of all the Groovy dependencies.

But today I thought of a simple solution. Why not take the Groovy.g file (i.e., the ANTLR definition), such as this one [though that's probably not the most up to date one, wondering how to find the most up to date one] and then apply the content of this screencast (made by me) to the Groovy.g file:

Within a few minutes, you should end up with Groovy syntax coloring. OK, so that's not a full blown Groovy editor, but syntax coloring is surely a cool thing to have in the app with which this blog entry started? Sure, this means creating a new Groovy editor from scratch. But the point is that doing so can be very simple, i.e., the syntax coloring can simply be generated via the simple instructions above. I'm going to try it myself in the next few days, but would be cool if others out there would try this too!

Comments:

I completely agree with you on the difficulties to include editors in platform applications.

More and more Nb RCP need embedded editor (mainly for dynamic language : groovy,scala,python,...

I think it's in this direction that the platform can be largely improve for the next versions.

For now when you want to include some language support you have to select the needed nb plugins. But from a user point of view (ie a platform client developer) it not easy to jump in the api/modules for the editor functionalities. What is interesting him it's the functionalities : for a given language i'll need : synthax coloring, code completion, code folding,navigator panel, ...

My use case will to include some sort of wizard to provide embedded editor functionalities as user needs. He can select for example :
+ synthax coloring
+ code completion
+ code folding
+ navigator panel
+ ...
I dont know if is it possible but it will be a big plus for the user.

Thierry

Posted by Thierry on March 25, 2012 at 07:26 PM PDT #

Better to just investigate the cause of the overly broad dependency tree for the Groovy editor, and fix it. Likely a matter of splitting groovy.editor or groovy.support into smaller pieces, some more IDE-specific and some less. (The easiest way to see the dependency graph is to open the Maven artifact viewer.)

Posted by Jesse Glick on March 26, 2012 at 03:07 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today