-
Hello, I've been able to modify the java-emf-theia project template to render graphically an EMF model of my own, which is serialized as XMI. The structure of my modified
In my real use-case though, the model is associated to an Xtext grammar, so I need to change the part of the project template that reads XMI models with one that builds the Xtext AST from a file. To do this, I have:
However, it seems that this is not enough, as the system still tries to read mydsl files using the EMF XMI parser1. Can you provide some guidance on how to change the project template to read Xtext model descriptions from files? Thanks in advance!
Footnotes |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Hi Matteo, I think this is because in the java-emf-theia example the GLSP server is executed as a plain Java application and not as an Eclipse application. If you look at the launch config or at what is produced by maven, it is just invoking Thus, you'll need to set up the resource set manually ("StandaloneSetup") and can't rely on the Xtext Eclipse extension points and resource factory registry setup stuff. So I think, you'll need to invoke something like this to create the resource set with which you load your DSL file: Injector injector = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
Provider<XtextResourceSet> xtextResourceSetProvider = injector.getInstance(new Key<Provider<XtextResourceSet>>() {});
XtextResourceSet resourceSet = xtextResourceSetProvider.get(); A good place in the EMF GLSP Server is to overwrite I haven't tested this, but that's what I would try. |
Beta Was this translation helpful? Give feedback.
Hi Matteo,
I think this is because in the java-emf-theia example the GLSP server is executed as a plain Java application and not as an Eclipse application. If you look at the launch config or at what is produced by maven, it is just invoking
TaskListServerLauncher.main
.Thus, you'll need to set up the resource set manually ("StandaloneSetup") and can't rely on the Xtext Eclipse extension points and resource factory registry setup stuff. So I think, you'll need to invoke something like this to create the resource set with which you load your DSL file: