Skip to main content



      Home
Home » Modeling » TMF (Xtext) » QualifiedNameProvider simply using URI, bad / OK?
QualifiedNameProvider simply using URI, bad / OK? [message #1389097] Fri, 27 June 2014 06:33 Go to next message
Eclipse UserFriend
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 07:03 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 13:13:32 EDT 2025

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

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

Back to the top