X

Geertjan's Blog

  • March 25, 2012

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

Geertjan Wielenga
Product Manager

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!

Join the discussion

Comments ( 2 )
  • Thierry Monday, March 26, 2012

    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


  • Jesse Glick Monday, March 26, 2012

    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.)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.