Getting XText to Work

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

The lecturer showed us the steps and everything worked for him ... He said: "It's that simple, it will be 10 minutes work for you." And I believed it. At home, however, almost nothing works as expected. And, of course, no more lectures to go only to the exam, I ask where I should show what I did to pass. Moreover, the email I sent to him bounced off the mail user ...

I got the Xtext along with the 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. A tutorial can be found here: http://wiki.eclipse.org/Xtext/GettingStarted

I am now on the Model step. It says "MyModel.mydsl" I do, but the editor won't open. He said:

"Failed to open editor: Failed to instantiate the editor class. This usually indicates a missing no-arg constructor or that the name of the editor class was incorrect in the plugin.xml file."

Since everything is generated, the error message didn't work for me ... There was an option to look at the stack trace (it was a mile long) and there was an exception at the top:

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

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

I googled for a solution but to no avail. This pushed me 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 need it ...

Anyone have any experience with XText?

Any help was appreciated.

ps: I'll be on it too and I can fix the problem in a few hours. But now I'm at a loss.

+2


a source to share


4 answers


I was finally able to solve the problem. I realized that I could skip the entire deployment step. I don't need to create a syntax checker plugin for my DSL. I found out that everything works, I need to assign all my tokens.

So,

SomeDeclaration:
   'declare' STRING

      

the xtext is well formed, but it won't work when I compile my language. This will cause many cryptic errors ...



SomeDeclaration
    'declare' declaredStuff=STRING

      

will be.

It was a long run ... I did a 10 minute job in 8 hours ...

Hope this helps others get started with XText.

+1


a source


The problem seems to be related to the eclipse / XText installation. How did you install it? If you got Eclipse and added a plugin after that, you need to make sure the versions are compatible.



There is a distributed distribution here

+1


a source


One of the possibilities. In the deployment step, check if you actually created the three plugins by looking at the Xtext installation directory inside the plugins folder? If they are located elsewhere, you can move them to the plugins folder. And did you restart Xtext eclipse after installing these plugins? The platform will not recognize these plugins (and the MyDsl editor) unless you restart it.

+1


a source


I was getting the same problems (getting the error "Failed to open editor: Failed to instantiate editor class.") When I tried to view my DSL in eclipse.

Then I went through and tried everything for modifying config files in both eclipse and xtext, but with no success.

My only solution was to reinstall everything. I am running Windows 64bit (Vista 64bit) but only 32bit JVMs and JDKs. So the ones eclipse and xtext were updated to the latest 64-bit versions and only then it worked fine.

I suspect this is a problem with eclipse, not xtext, and an update for Helios (64-bit eclipse) probably influenced this.

+1


a source







All Articles