Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » QualifiedNameProvider simply using URI, bad / OK?
QualifiedNameProvider simply using URI, bad / OK? [message #1389097] Fri, 27 June 2014 10:33 Go to next message
Michael Vorburger is currently offline Michael VorburgerFriend
Messages: 103
Registered: July 2009
Senior Member
Hallo,

I have a quick "best practice / your experience" kind of Q:

In some (but not all) of our models, the only thing that is (currently) externally referenced is the name of their root element. In our tool, it so happens, by convention, that the file name of the respective DSL models exactly matches this name of their root element (which is repeated in the text) - like in a Java class/file name, really.

Now we had some issue which someone tracked to a QualifiedNameProvider that didn't work because that root element was an EMF Proxy (I do not have the full details about the problem), and so someone came up with a "creative" solution to instead of something like return qnc.toQualifiedName(model.getName()); just use name = model.eResource().getURI().lastSegment().substring(0, seg.lastIndexOf(".")) ...

I was wondering if others had any thoughts pro/con this - clearly this is not how a QNP would typically be written (and could not if the content of the resource was used to obtain referenceable names), but in this case "it works"... are there any disadvantages we are forgetting about which may make this approach a Very Bad Idea?

PS: And yes, one would want to have a Validation rule checking that the file name (URI) and root element getName() match.

Thanks.
Re: QualifiedNameProvider simply using URI, bad / OK? [message #1389114 is a reply to message #1389097] Fri, 27 June 2014 11:03 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
A proxy isn't usually contained in any resource. Is it in your case?
Previous Topic:"Pseudo" Langage C
Next Topic:Could not serialize EObject via backtracking
Goto Forum:
  


Current Time: Thu Dec 05 17:20:59 GMT 2019

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

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

Back to the top