Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Code generation error messages
Code generation error messages [message #1123724] Wed, 02 October 2013 21:35 Go to next message
Tom Mealey is currently offline Tom MealeyFriend
Messages: 7
Registered: October 2013
Junior Member
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] Thu, 03 October 2013 02:47 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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
>
>
>
Previous Topic:Xbase + Inferrer in Eclipse Editor
Next Topic:[Solved] Xtext fails to parse my text file
Goto Forum:
  


Current Time: Fri Apr 26 03:10:56 GMT 2024

Powered by FUDForum. Page generated in 0.03688 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top