You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Guide for setting up xtext in your project.

It is important to get the setup right, so that everyone get the same structure on their projects.

 

1. Creating a new xtext Project:

Create a new Xtext project by right clicking your project and select "new" -> "other" (or just Ctrl+N), then select "Xtext Project" as show in the image below.

 

 

2. Correct name and location:

Name the project as show below (change the gr1600 with your groups nr).
The location is were your project is located, and the "xtext" in the end makes sure that everything ends up in a cute folder named xtext.
After naming everything correctly you press next.

 

In the next window you only need to do one thing, you need to set the "Preferred Build System" to Maven.
You do not need to change anything else than the "Preferred Build System" drop down.
After changing Preferred Build System you can press Finish. 

 

3. End result

Your project structure should now look like the image below.

 

4. Using Xtext

Adding osm:

If you want to use osm with Xtext your starting point should be the "GenerateXGr16xx.mwe2" file where you need to add the line "referencedResource = "platform:/resource/no.hal.pgo.osm/model/osm.genmodel" as shown in the image below.

You also need to add two dependencies in the MANIFEST.MF inside your xtext folder (see image below).  

To use osm in your xtext editor you need to import it as shown below.

Now you have to right-click on the GenerateXGr16xx.mwe2 class and Run as –> MWE2 Workflow. After this, you have to add this into the XGr16xxStandaloneSetup.xtend file(see picture): 

override Injector createInjectorAndDoEMFRegistration() {
OsmSupportStandaloneSetup.setup();
return super.createInjectorAndDoEMFRegistration;
}

The last thing you now have to do is to import the org.eclipse.emf.mwe.utils.StandaloneSetup inside the GenerateXGr16xx.mwe2 file.

Now you are ready to make your own DSL!

 

  • No labels