Code generation error messages [message #1123724] |
Wed, 02 October 2013 17:35  |
Eclipse User |
|
|
|
I'm wondering if it is possible to output an error message to the Eclipse console if there is an error in the code generation process. Here is what I have set up:
- A custom Xtend generator class that extends IGenerator
- The doGenerate method calls a custom Assembler class method
- The custom assembler method runs an external Python assembler script on the input file and returns the assembled byte-code string (or an error string)
- The doGenerate method checks the string returned from the assembler, and if does not contain an error message, it will generate the output file
I have a MessageConsole factory set up in the UI package, but the Generator exists in the main core package, so it can't access the console. However, I'd like to be able to show an error message on the Eclipse console if the assembler method returns a string indicating an error. Is there a way I can pass a failure message from the core to the UI so that I can accomplish this? Or should I abandon the Xtext generator altogether and create a separate build package?
Also note that I followed Christian's tutorial invoking code generation from the context menu, so that code generation is not automatic.
Any comments or suggestions would be greatly appreciated. Thanks!
Tom
|
|
|
Re: Code generation error messages [message #1123923 is a reply to message #1123724] |
Wed, 02 October 2013 22:47  |
Eclipse User |
|
|
|
Hi
Use org.apache.log4j.Logger which Xtext configures so it's all easy.
Regards
Ed Willink
On 02/10/2013 22:41, Tom Mealey wrote:
> I'm wondering if it is possible to output an error message to the
> Eclipse console if there is an error in the code generation process.
> Here is what I have set up:
>
> - A custom Xtend generator class that extends IGenerator
> - The doGenerate method calls a custom Assembler class method
> - The custom assembler method runs an external Python assembler script
> on the input file and returns the assembled byte-code string (or an
> error string)
> - The doGenerate method checks the string returned from the assembler,
> and if does not contain an error message, it will generate the output
> file
>
> I have a MessageConsole factory set up in the UI package, but the
> Generator exists in the main core package, so it can't access the
> console. However, I'd like to be able to show an error message on the
> Eclipse console if the assembler method returns a string indicating an
> error. Is there a way I can pass a failure message from the core to
> the UI so that I can accomplish this? Or should I abandon the Xtext
> generator altogether and create a separate build package?
>
> Also note that I followed Christian's tutorial invoking code
> generation from the context menu, so that code generation is not
> automatic.
>
> Any comments or suggestions would be greatly appreciated. Thanks!
>
> Tom
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06386 seconds