Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Loading Xtext based model from Eclipse EASE
Loading Xtext based model from Eclipse EASE [message #1740054] Mon, 08 August 2016 14:54 Go to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 19
Registered: December 2011
Location: Germany
Junior Member
Hello,

i'm trying to load an model in an ease module. The module is created in the UI plugin using the ExecutableExtensionFactory.

The following code is used:
@Inject
IResourceSetProvider resourceSetProvider;

@WrapToScript
public EObject loadModel(IFile ModelFile) throws IOException {
    String ModelFilePath = ModelFile.getLocation().makeAbsolute().toOSString();
    URI ModelFileUri = URI.createFileURI(ModelFilePath);
    Resource resource = resourceSetProvider.get(ModelFile.getProject()).getResource(ModelFileUri, true);
    ModelRoot = resource.getContents().get(0); 
    EcoreUtil.resolveAll(resource); //This was the first try
    return ModelRoot;
}


The global scope depends on Eclipse Projects. The unresolved cross references are to an instance of another xtext language.

If the model is used after it is loaded, all cross references to another model instance are unresolved.
Is there anything else I have to do to resolve cross references before using a loaded model?

Regards,
Matthias

Re: Loading Xtext based model from Eclipse EASE [message #1740059 is a reply to message #1740054] Mon, 08 August 2016 15:03 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 12325
Registered: July 2009
Senior Member
why

String ModelFilePath = ModelFile.getLocation().makeAbsolute().toOSString();
URI ModelFileUri = URI.createFileURI(ModelFilePath);

why not

URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Loading Xtext based model from Eclipse EASE [message #1740061 is a reply to message #1740059] Mon, 08 August 2016 15:17 Go to previous message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 19
Registered: December 2011
Location: Germany
Junior Member
That is better, thank you.
Previous Topic:Limiting Proposed Java types to implementers of Interface does not work with Package
Next Topic:Customizing ecore model
Goto Forum:
  


Current Time: Tue Oct 23 21:09:55 GMT 2018

Powered by FUDForum. Page generated in 0.02208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top