문제

I have been looking for a possible answer but nothing yet. I found this piece of code but for Xtext

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);

I need to do exactly the same but using EMFText instead of Xtext. Is that possible?

I would really appreciate any help or answer.

Best regards.

도움이 되었습니까?

해결책

Try this:

new MydslMetaInformation().registerResourceFactory();
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = resourceSet.getResource(URI.createFileURI("example.mydsl"), true);
Model model = (Model) resource.getContents().get(0);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top