Once again, thank you :) so it's finaly working after some debug ! the probleme was that i was passing a bad URI to associate the resource (that have to be like "platfrom:/resource/pathrelativetoworkspace") so I changed : URI.createURI(myIFile.getFullPath().toString()) to URI.createPlatformResourceURI(myIFile.getFullPath().toString(), true)
and "Tahdah" it's working ! -amazing!- Cheers, Pierrick On Wed, Aug 4, 2010 at 2:06 PM, Sebastian Zarnekow < [email protected]> wrote: > Hi Pierrick, > > please use to obtain a resource set that is configured with the appropriate > context object: > > XtextResourceSetProvider provider = injector.getInstance( > XtextResourceSetProvider.class); > ResourceSet rs = provider.get(contextProject); > ... > > Hope that works, > Sebastian > > > On 04.08.2010, at 06:06, Pierrick Koch wrote: > > Thanks a lot ! > It's working most of the time, I still have some unresolved reference with > some model (that have cross references). > > I'd like to now how to get the injector, for now I do > > GamlActivator.getInstance().getInjector("msi.gama.lang.gaml.Gaml").getInstance(XtextResourceSet.class) > > and then I get my model with the > resource-set<http://code.google.com/p/gama-platform/source/browse/branches/msi.gama.lang.io/src/msi/gama/lang/utils/internal/GamlUtils.java?r=1096#117>. > [ > http://code.google.com/p/gama-platform/source/browse/branches/msi.gama.lang.io/src/msi/gama/lang/utils/internal/GamlUtils.java?r=1096#117 > ] > > but if I use the XtextDocument (with opened file), then all references are > resolved. > any idea why some reference are still not resolved with the resource-set ? > > Cheers, > Pierrick > > On Tue, Aug 3, 2010 at 7:34 PM, Sebastian Zarnekow < > [email protected]> wrote: > >> Hi Pierrick, >> >> please have a look at the FAQ: >> >> >> http://wiki.eclipse.org/Xtext/FAQ#How_do_I_load_my_model_in_a_standalone_Java_application_.3F >> >> Please note that you should use the injector from your activator instead >> and skip the standalone setup part. >> >> Regards, >> Sebastian >> >> >> On 03.08.2010, at 14:22, Pierrick Koch wrote: >> >> Hi, eclipse forum is down, so I'm posting here :) >> >> I'm working with Xtext and I'd like to read (or parse) a Model from a file >> without having to open it in an editor. >> >> for now I use >> EditorUtils.getActiveXtextEditor().getDocument() >> or XtextDocumentUtil.get(IEditorPart) >> >> both of those methods open or need an opened file. >> >> I tried with >> ResourceSet rs = new ResourceSetImpl(); >> Resource resource = >> rs.getResource(URI.createURI(myIFile.getFullPath().toString()), true); >> EObject model = resource.getContents().get(0); >> >> but the problem is that the references are not resolved. >> >> Is there a way to get a model with resolved references without opening it >> in an editor ? >> >> Cheers, >> Pierrick >> _______________________________________________ >> xtext-dev mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/xtext-dev >> >> >> > >
_______________________________________________ xtext-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/xtext-dev
