Resolving proxy for cross-reference to another file [message #733825] |
Wed, 05 October 2011 18:09 |
Andrew Gacek Messages: 32 Registered: October 2011 |
Member |
|
|
I have a language in Xtext with cross-references to variables declared in another file. When I am traversing the model returned by Xtext and I come across one of these variables it is a proxy object and any calls to its getXXX() methods returns null. How do I tell EMF to resolve this proxy? Can I force all proxies to be resolved when the model is loaded?
I'm loading the model using the following code which is part of an Eclipse plug-in. It is supposed to load the model for the file that the user is currently editing.
IEditorPart activeEditor = window.getActivePage().getActiveEditor();
IFile activeFile = (IFile) activeEditor.getEditorInput().getAdapter(IFile.class);
Injector injector = new MydslStandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
URI uri = URI.createURI(activeFile.getFullPath().toString());
Resource resource = resourceSet.getResource(uri, true);
return (Model) resource.getContents().get(0);
-Andrew
[Updated on: Wed, 05 October 2011 18:09] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02850 seconds