What is the best way to create a new xbase project? Possibilities include:
- Use create 'new xtext' wizard and then convert that into xbase project.
- Start with one of 7 languages for the jvm and then adapt that.
I tried by starting with 'Script' (the simplest of the 7 languages). However I found it difficult to change it into the naming structure I wanted. The 'Script' name is built into the file and class naming structure everywhere and the Eclipse Refactor/Rename does not seem to work very well in xtext.
Converting xtext into xbase Project
I therefore decided to base my code on the xtend code. I did the following to give simple code which has basic object-oriented functionality and can be easily extended to add the special language features required for a given DSL.
I took the xtend grammar file and removed the 'rich string' stuff (The code is on this page). I then constructed a simple JvmModelInferrer.xtend' file to generate the code from the grammar (This code is also on this page).
This is all I did, all the rest is just as generated by the 'new xtext' wizard. Obviously this does not have the same functionality as the xtend code, but its not intended to, it is intended as a very simple working code which can then be extended in various ways to add project specific DSL features as required.
See this page for the code and step by step instructions.
- blue = generated by new xtext project wizard
- black = created after running mwe2
- red = generated by new xtext project wizard but not in xbase projects
- purple = in xbase projects only
For screen shots of each step that I took see this page.
For other information that I am gathering about xbase see this page.