views:

295

answers:

3

I know you don't like helping others in their homework but I have to make an XText grammar, write a sample code that matches this grammar and compile it to a html file.

The lecturer showed us the steps and everything worked for him... He said "It's so simple it will be a 10 minute work for you". And I believed that. However at home almost nothing works as expected. And of course no more lectures to go only the exam avaits me where I have to show what I done to pass. Moreover the e-mail I sent him bounced back by the mailer-demon...

I got Xtext along with Eclipse IDE from the xtext website and I unpacked it and I followed the steps in the official tuturial to get the default project template to work. The tutorial is found here: http://wiki.eclipse.org/Xtext/GettingStarted

Now I'm at the step "Model". It says open the "MyModel.mydsl" I do that but the editor does not opened. It said:

"Could not open the editor: The editor class could not be instantiated. This usually indicates a missing no-arg constructor or that the editor's class name was mistyped in plugin.xml."

Since everything is generated, the error message does not helped me... There was an option to look at the stack trace (it was mile long) and on the top of it there was an exception:

java.lang.IllegalStateException: The bundle has not yet been activated. Make sure the Manifest.MF contains 'Bundle-ActivationPolicy: lazy'.

I opened Manifast.MF and Bundle-ActivationPolicy: lazy was set...

I googled for the solution but no avail. It drove me nuts and I gave up.

I have no experience with Eclipse and Java and XText, I just want to do my homework and forget everything until I will need it again...

Anyone have experience with XText?

Any help appreciated.

ps: I will be on it too and I might resolve the problem in several hours. But now I am at a loss.

A: 

There seem to be an issue with your eclipse/XText installation. How did you install it? If you got Eclipse and added the plugin afterwards you need to make sure the versions are compatible.

There's a bundled distribution here

Guillaume
I downloaded exactly that.
Calmarius
A: 

One possibility: In the Deployment step, please check if you have actually created three plugins by looking at the Xtext's installation directory, inside of plugins folder? If they are placed in different place, you can move them into the plugins folder. And, have you restarted Xtext eclipse after installing those plugins? The platform will not recognize those plugins (and MyDsl editor) unless you restart it.

Akira
I did that and restarted Eclipse after.
Calmarius
A: 

I finally was able to solve the problem. I realized I can skip the entire Deployment step I don't need to make syntax check plugin for my DSL. I found out to make things work I need to assign all my tokens.

So

SomeDeclaration:
   'declare' STRING

is well formed xtext but it won't work when I compile my language. It will cause lots of mysterious errors...

SomeDeclaration
    'declare' declaredStuff=STRING

will.

It was a long run... I did a 10 minute work for 8 hours...

I hope this will help others getting started with XText.

Calmarius
So you didn't follow the steps in the tutorial **exactly**, did you? That is usually a good idea. First when everything works, do your modifications in **small** increments so that when things stop working, you know why.
JesperE