Specify predefined bindings for scripts

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

Specify predefined bindings for scripts

Volker Börchers
Hi,

I'm using the Groovy Eclipse plugin to edit scripts that are executed in
a GroovyShell with some variables predefined via a Binding. These
variables are the entry points into a Java framework in which the
scripts are embedded. Since the variables are not known to the plugin no
code completion and syntax checks are available in the editor.

Sometimes I simulate the bindings with dummy variable declarations in
the script. But this is quite awkward since these variables are not
"global" as those from the binding and I have to remove the declarations
finally to make the script work.

Is it possible to declare script bindings or to simulate them in some way?

Regards,
Volker

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Specify predefined bindings for scripts

Andrew Eisenberg
I'm not exactly sure of the best way to do this.  I've been looking
around at how to set bindings when running the 'groovy' command, but I
can't find anything.  If it is possible to do this, then it is quite
easy to take advantage of this behavior when launching a groovy script
in Eclipse.

Simply open up the corresponding launch configuration and go to the
'arguments' tab.  Specify all command line arguments there.  Does this
help at all?



On Sun, Aug 21, 2011 at 5:00 PM, Volker Börchers <[hidden email]> wrote:

> Hi,
>
> I'm using the Groovy Eclipse plugin to edit scripts that are executed in a
> GroovyShell with some variables predefined via a Binding. These variables
> are the entry points into a Java framework in which the scripts are
> embedded. Since the variables are not known to the plugin no code completion
> and syntax checks are available in the editor.
>
> Sometimes I simulate the bindings with dummy variable declarations in the
> script. But this is quite awkward since these variables are not "global" as
> those from the binding and I have to remove the declarations finally to make
> the script work.
>
> Is it possible to declare script bindings or to simulate them in some way?
>
> Regards,
> Volker
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Specify predefined bindings for scripts

Volker Börchers
My problem was more related to getting code completion to work for those
implicitly defined variables.

Vladimir Orany, in a private response, proposed to write my own DSLD
file. With the help of his blog post
http://en.appsatori.eu/2011/05/writing-groovy-dsl-descriptors-dsld-for.html 
this was an easy task.

Now I not only have support for the predefined variables but also for
methods defined in the script base class as well as for my custom
Categories.

This DSLD stuff is really great!

Regards,
Volker

Am 24.08.2011 05:06, schrieb Andrew Eisenberg:

> I'm not exactly sure of the best way to do this.  I've been looking
> around at how to set bindings when running the 'groovy' command, but I
> can't find anything.  If it is possible to do this, then it is quite
> easy to take advantage of this behavior when launching a groovy script
> in Eclipse.
>
> Simply open up the corresponding launch configuration and go to the
> 'arguments' tab.  Specify all command line arguments there.  Does this
> help at all?
>
>
>
> On Sun, Aug 21, 2011 at 5:00 PM, Volker Börchers<[hidden email]>  wrote:
>> Hi,
>>
>> I'm using the Groovy Eclipse plugin to edit scripts that are executed in a
>> GroovyShell with some variables predefined via a Binding. These variables
>> are the entry points into a Java framework in which the scripts are
>> embedded. Since the variables are not known to the plugin no code completion
>> and syntax checks are available in the editor.
>>
>> Sometimes I simulate the bindings with dummy variable declarations in the
>> script. But this is quite awkward since these variables are not "global" as
>> those from the binding and I have to remove the declarations finally to make
>> the script work.
>>
>> Is it possible to declare script bindings or to simulate them in some way?
>>
>> Regards,
>> Volker
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Specify predefined bindings for scripts

Andrew Eisenberg
Excellent.  Glad to hear it worked for you.

On Wed, Aug 24, 2011 at 12:52 PM, Volker Börchers <[hidden email]> wrote:

> My problem was more related to getting code completion to work for those
> implicitly defined variables.
>
> Vladimir Orany, in a private response, proposed to write my own DSLD file.
> With the help of his blog post
> http://en.appsatori.eu/2011/05/writing-groovy-dsl-descriptors-dsld-for.html
> this was an easy task.
>
> Now I not only have support for the predefined variables but also for
> methods defined in the script base class as well as for my custom
> Categories.
>
> This DSLD stuff is really great!
>
> Regards,
> Volker
>
> Am 24.08.2011 05:06, schrieb Andrew Eisenberg:
>>
>> I'm not exactly sure of the best way to do this.  I've been looking
>> around at how to set bindings when running the 'groovy' command, but I
>> can't find anything.  If it is possible to do this, then it is quite
>> easy to take advantage of this behavior when launching a groovy script
>> in Eclipse.
>>
>> Simply open up the corresponding launch configuration and go to the
>> 'arguments' tab.  Specify all command line arguments there.  Does this
>> help at all?
>>
>>
>>
>> On Sun, Aug 21, 2011 at 5:00 PM, Volker Börchers<[hidden email]>  wrote:
>>>
>>> Hi,
>>>
>>> I'm using the Groovy Eclipse plugin to edit scripts that are executed in
>>> a
>>> GroovyShell with some variables predefined via a Binding. These variables
>>> are the entry points into a Java framework in which the scripts are
>>> embedded. Since the variables are not known to the plugin no code
>>> completion
>>> and syntax checks are available in the editor.
>>>
>>> Sometimes I simulate the bindings with dummy variable declarations in the
>>> script. But this is quite awkward since these variables are not "global"
>>> as
>>> those from the binding and I have to remove the declarations finally to
>>> make
>>> the script work.
>>>
>>> Is it possible to declare script bindings or to simulate them in some
>>> way?
>>>
>>> Regards,
>>> Volker
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>   http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

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

    http://xircles.codehaus.org/manage_email