Replies: 10 comments
-
Hi @simongraband(simongraband) , from the eobject you can get the resource and if it is based on the XMLResource you can call: |
Beta Was this translation helpful? Give feedback.
-
[simongraband] I am having problems getting the eobject in the first place. If i get the data list it a BasicEList.UnmodifiableEList. Is there a way to get the first eObject from that list? Or is the type of the list unusual and something before that is going wrong? |
Beta Was this translation helpful? Give feedback.
-
so if you have a Diagnostic, you can call |
Beta Was this translation helpful? Give feedback.
-
[simongraband] So far i got this:
For the 'root diagnostic' i get a null id, because i think my XMLResource is wrong, however i am not sure what the problem is. Can you see what i missed here? On top of that the method seems to only find a EObject in the root diagnostic-data and not in the children-data, which seems strange, as i can see EObjects in the data field. |
Beta Was this translation helpful? Give feedback.
-
Your code looks good, I think there is a problem with the resource, @martin-fleck(martin-fleck) do you have an idea? |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Is there another way to achieve this? Or is this the only way? |
Beta Was this translation helpful? Give feedback.
-
[Martin Fleck] Hi @simongraband! Sorry for the late reply, I was on vacation and just got back. Did you manage to solve your problem in the meantime? I am a bit unsure from where you call this code and why it is necessary to create a new resource. Do you think it would be possible to re-use the resource from Regarding the fact that only top-level root diagnostic-data seems to be available I cannot say much. The code itself seems to look fine as you hand in the |
Beta Was this translation helpful? Give feedback.
-
[simongraband] Hi @martin-fleck(martin-fleck), |
Beta Was this translation helpful? Give feedback.
-
[Martin Fleck] Hi @simongraband(simongraband), So if I understand you correctly you need the element ID of the GModelElement to place the markers, is that right? As far as I know there is no way you can get the GModel id purely from the EObject by default. The default What should be possible is to provide your own index implementation that additionally creates a mapping from EObject (or URI fragment) to GModelElement id when the index is created. You can create your own index by binding a new Of course this assumes that you have access to the model state when you do the validation. |
Beta Was this translation helpful? Give feedback.
-
[simongraband] That worked. Thanks a lot for the help |
Beta Was this translation helpful? Give feedback.
-
I am currently working on implementing a model validation framework for editors similar to the coffee editor.
I already got the validation to run and it returns the right errors in a BasicDiagnostic. From the documentation i can see, that the BasicDiagnostic returns the 'data' field which contains the EObject that the Diagnostic is referring to, however i am unsure how i can get the ID from that EObject. Is there a simple way to get this?
Thanks in advance.
original thread by simongraband
Beta Was this translation helpful? Give feedback.
All reactions