Custom IResourceDescriptionStrategy not working as expected [message #1872644] |
Tue, 12 November 2024 07:10  |
Eclipse User |
|
|
|
Hi,
In my project I've implemented my own IResourceDescriptionStrategy, based on DefaultResourceDescriptionStrategy, overriding createEObjectDescriptions() to add an AliasedEObjectDescription for some of the EObjectDescriptions created by the default implementation. The unexpected behaviour is that I can use an AliasedEObjectDescription's QualifiedName to refer to the associated EObject only in a different file than the one that contains the text that, when parsed, creates that EObject.
For example, I have used my IResourceDescriptionStrategy implementation to add an unquoted alias for every EObject that has got a name wrapped in single quotation marks. In my DSL's editor the following does not work:
package a {
item 'z';
}
package b {
reference a::z;
}
and I get the "Couldn't resolve reference to Item a::z" error. If I copy paste the whole "package b {...}" into a different file, the model suddenly becomes valid.
Within the same file, I am forced to write a::'z'.
What am I missing? Is this intended behaviour, and if so, how can I get the aliases to work even within the same file?
Thanks!
|
|
|
|
|
|
|
|
|
|
Re: Custom IResourceDescriptionStrategy not working as expected [message #1872707 is a reply to message #1872692] |
Fri, 15 November 2024 07:45  |
Eclipse User |
|
|
|
Christian Dietrich wrote on Thu, 14 November 2024 20:14Well
If you have "x" or x in the file the value converter will make x out of it.
This is what the scope provider be asked
Oh, I think I've only now understood your point!
The value converter will map both 'x' and x to x when it processes the name of an entity (which is parsed using a custom rule and assigned as "name=Name" in my entities' rules), but it will also do the same whenever a cross-reference making use of the Name rule is parsed, so both variants of the name are effectively mapped to the unquoted variant in both contexts and thus it will be possible to resolve the cross-references both with and without quotes.
(sorry if I've worded this post slightly imprecisely, I've written it in a hurry)
Next week I'll try to implement this approach.
|
|
|
Powered by
FUDForum. Page generated in 0.04027 seconds