I am trying to use the example org.eclipse.xtext.example.arithmetics.Arithmetics with xtext. I can run the Eclipse Application as described in the 5-minute tutorial and 15-minute tutorial, so the editor will do syntax checking.
But how do I actually use the model in a Java app? (I'm not talking about code generation)
I found this FAQ entry. But which .jar files do I need to include in my build path? There are a lot of unresolved classes here.
new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");
Injector injector = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
Resource resource = resourceSet.getResource(
URI.createURI("platform:/resource/org.xtext.example.mydsl/src/example.mydsl"), true);
Model model = (Model) resource.getContents().get(0);