Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Importing EObjects from non-XText models
Importing EObjects from non-XText models [message #1717924] Thu, 17 December 2015 18:30 Go to next message
Jérôme Fouletier is currently offline Jérôme FouletierFriend
Messages: 39
Registered: September 2010
Location: France
Member
Using XText 2.4.3 in an Eclipse Kepler SR2 platform

In the same idea as this older post, I am trying to reference EObjects defined in a model not expressed in XText. Looking at the blog post, it seems the linking can be made to work with minimal effort. However, my case has an important difference with the UML one, namely, the other model does not have (or need) an editor. It just sits either in a jar on the classpath, or in a project on the workbench.
The EMF model being referenced already has implemented:
- OtherModelResource extends ResourceImpl
- OtherModelResourceDescription extends AbstractResourceDescription
- OtherModelResourceDescriptionManager extends DefaultResourceDescriptionManager
- OtherModelResourceFactory extends ResourceFactoryImpl
- OtherModelQualifiedNameProvider
- OtherModelResourceDescriptionStrategy
- OtherModelRuntimeModule which defines getFileExtensions() to return "othermdl"

However, since there is no editor for ".othermdl" URIs, I'm a bit confused about the way I could make the XText-generated editor aware of that source of references, without vainly trying to open an editor when double-clicking those references.
- what should getLanguageName() return? some arbitrary string?
- do I really need ResourceDescription and ResourceDescriptionManager?
- Is it enough to have the other model's URI listed in the language's XText file?

Jerome
Re: Importing EObjects from non-XText models [message #1717925 is a reply to message #1717924] Thu, 17 December 2015 18:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Why not opening with the sample reflective ecore model editor?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Importing EObjects from non-XText models [message #1717942 is a reply to message #1717925] Thu, 17 December 2015 23:27 Go to previous messageGo to next message
Jérôme Fouletier is currently offline Jérôme FouletierFriend
Messages: 39
Registered: September 2010
Location: France
Member
Because the model is translated from POJOs by the custom resource's load(). There really is nothing to open.
Is it possible to just keep the equivalent of org.eclipse.xtext.uml and leave the org.eclipse.xtext.uml.ui out?

[Updated on: Thu, 17 December 2015 23:30]

Report message to a moderator

Re: Importing EObjects from non-XText models [message #1717947 is a reply to message #1717942] Fri, 18 December 2015 04:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
nope, but you can hook in the hook that does the opening ....


binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(YourURIEditorOpener.class);


(in the ui module of the resourceserviceprovider)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Importing EObjects from non-XText models [message #1717957 is a reply to message #1717947] Fri, 18 December 2015 07:52 Go to previous messageGo to next message
Jérôme Fouletier is currently offline Jérôme FouletierFriend
Messages: 39
Registered: September 2010
Location: France
Member
So that getLanguageName() function actually returns the extension point ID of the corresponding editor? Will any editor work, like the plain text or regular XML ?

I suppose that binding you propose would replace the one that calls getLanguageName() ?

Also, the question about ResourceDescription and ResourceDescriptionManager still stands. Are they necessary or are the QualifiedNameProvider and ResourceDescriptionStrategy sufficient?

That's one thing missing in the XText documentation for language designers, i.e. what are the various interfaces available and what should bind should bind where.
Re: Importing EObjects from non-XText models [message #1717979 is a reply to message #1717957] Fri, 18 December 2015 11:44 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
in newer xtext Versions you have not that much to implement.
i dont know if your stonage xtext Version has that already.

so i dont think you Need ResourceDescription and ResourceDescriptionManager in recent Versions.

have a look at

org.eclipse.xtext.ecore (EcoreRuntimeModule/AbstractGenericResourceRuntimeModule) org.eclipse.xtext.ui.ecore (EcoreUiModule/EmfUiModule)

These are the resourceserviceproviders xtext ships for .ecore files


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Whitespace Languages for Beginners?
Next Topic:building my project from scratch doesn't work
Goto Forum:
  


Current Time: Thu Apr 25 23:53:59 GMT 2024

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

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

Back to the top