fileExtension() pointcut in DSLD

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fileExtension() pointcut in DSLD

alzadude
Hi,

I tried to use the fileExtension() pointcut in a DSLD e.g.

def myScripts = fileExtension("myscript")

I realized that I would also need to setup a content type mapping in Eclipse for the file extension:

Preferences -> General -> Content Types -> Text -> Java Source File -> Groovy Source File -> Add...

However, even after this extra step for the file extension "*.myscript", I could not see a way to make use of the fileExtension() pointcut, because Eclipse doesn't seem to recognize these files correctly as Groovy files.

Is there a way to do this without having to create an Eclipse plugin etc?

My Groovy-Eclipse version is 2.8.0.xx-20130304-1200-e42

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: fileExtension() pointcut in DSLD

Andrew Eisenberg
I just tried adding a new file extension (*.other) as a groovy content type.  I had to reboot before I got it working.  Now, when I open *.other files, they are correctly handled as a groovy file and dslds are correctly apploed.

A couple of things:

1. make sure to reboot after adding the content type (groovy-eclipse caches the content types and we don't refresh until a reboot...this is a bug).
2. make sure that you are not opening your *.myscript files in Java editors. DSLDs will not be applied to files in Java editors.  This may have been set as the default the first time you opened it up.

On Mon, Apr 8, 2013 at 4:06 PM, alzadude <[hidden email]> wrote:
Hi,

I tried to use the fileExtension() pointcut in a DSLD e.g.

def myScripts = fileExtension("myscript")

I realized that I would also need to setup a content type mapping in Eclipse
for the file extension:

Preferences -> General -> Content Types -> Text -> Java Source File ->
Groovy Source File -> Add...

However, even after this extra step for the file extension "*.myscript", I
could not see a way to make use of the fileExtension() pointcut, because
Eclipse doesn't seem to recognize these files correctly as Groovy files.

Is there a way to do this without having to create an Eclipse plugin etc?

My Groovy-Eclipse version is 2.8.0.xx-20130304-1200-e42

Thanks



--
View this message in context: http://groovy.329449.n5.nabble.com/fileExtension-pointcut-in-DSLD-tp5714809.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: fileExtension() pointcut in DSLD

alzadude
Aha thanks!

After I re-started Eclipse, the file type was handled correctly, and the DSLD completions worked :)

However on a related note I am now wondering whether it is possible to automatically add a content type mapping in Eclipse, without having to resort to writing a plugin, to make it easier for end users of my DSL... any ideas for how this could be done?

Thanks again