Embedding the Groovy Editor in a Property Sheet

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

Embedding the Groovy Editor in a Property Sheet

Nick Collier
Hi,

We are working on a statechart type diagram editor in which the user can enter small sections of code to be executed. These bits of code are properties of elements in the diagram. For example, a State has an OnEnter property that consists of code that will be executed when the state is entered. The code that the user enters ultimately becomes the body of a method that gets created as part of a code generation step. As far as the GUI goes, the properties are edited in a tab in the properties view. I've managed to adapt eclipse's CompilationUnitEditor to work so that its StyledText widget shows up in the property sheet. Code completion, error markers, etc. also work correctly. This is done by creating a temporary "template" .java file that mirrors what the code generator creates minus the body of the method. The editor works with this file and the StyledText widget only shows the small part of the IDocument that contains the body of the generated method.

We have an option that allows the user's to specify the code sections in Groovy rather than Java and we'd like to provide the same level of editor support. So, my question then is where to start? Is there something analogous to the CompilationUnitEditor that I can adapt? Any suggestions appreciated.

thanks,

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Groovy Editor in a Property Sheet

Andrew Eisenberg
The GroovyEditor [1] is a subclass of CompilationUnitEditor.  You will probably want to look at that.  Also, take a look at the GroovyConfiguration class [2], which configures editing support for the source viewer used by the editor.  Let me know if you have any more specific questions.

If there are any changes that you need to make to get your editor working, feel free to send a pull request.  If it makes sense for the project, we will accept it.


On Mon, Sep 9, 2013 at 8:45 AM, Nick Collier <[hidden email]> wrote:
Hi,

We are working on a statechart type diagram editor in which the user can enter small sections of code to be executed. These bits of code are properties of elements in the diagram. For example, a State has an OnEnter property that consists of code that will be executed when the state is entered. The code that the user enters ultimately becomes the body of a method that gets created as part of a code generation step. As far as the GUI goes, the properties are edited in a tab in the properties view. I've managed to adapt eclipse's CompilationUnitEditor to work so that its StyledText widget shows up in the property sheet. Code completion, error markers, etc. also work correctly. This is done by creating a temporary "template" .java file that mirrors what the code generator creates minus the body of the method. The editor works with this file and the StyledText widget only shows the small part of the IDocument that contains the body of the generated method.

We have an option that allows the user's to specify the code sections in Groovy rather than Java and we'd like to provide the same level of editor support. So, my question then is where to start? Is there something analogous to the CompilationUnitEditor that I can adapt? Any suggestions appreciated.

thanks,

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

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Embedding the Groovy Editor in a Property Sheet

Nick Collier
Great. Thanks.

Nick

On Sep 9, 2013, at 1:04 PM, Andrew Eisenberg wrote:

The GroovyEditor [1] is a subclass of CompilationUnitEditor.  You will probably want to look at that.  Also, take a look at the GroovyConfiguration class [2], which configures editing support for the source viewer used by the editor.  Let me know if you have any more specific questions.

If there are any changes that you need to make to get your editor working, feel free to send a pull request.  If it makes sense for the project, we will accept it.


On Mon, Sep 9, 2013 at 8:45 AM, Nick Collier <[hidden email]> wrote:
Hi,

We are working on a statechart type diagram editor in which the user can enter small sections of code to be executed. These bits of code are properties of elements in the diagram. For example, a State has an OnEnter property that consists of code that will be executed when the state is entered. The code that the user enters ultimately becomes the body of a method that gets created as part of a code generation step. As far as the GUI goes, the properties are edited in a tab in the properties view. I've managed to adapt eclipse's CompilationUnitEditor to work so that its StyledText widget shows up in the property sheet. Code completion, error markers, etc. also work correctly. This is done by creating a temporary "template" .java file that mirrors what the code generator creates minus the body of the method. The editor works with this file and the StyledText widget only shows the small part of the IDocument that contains the body of the generated method.

We have an option that allows the user's to specify the code sections in Groovy rather than Java and we'd like to provide the same level of editor support. So, my question then is where to start? Is there something analogous to the CompilationUnitEditor that I can adapt? Any suggestions appreciated.

thanks,

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

    http://xircles.codehaus.org/manage_email