| Infinite loop when refreshing the outline [message #1000847] |
Tue, 15 January 2013 09:38  |
Charles Bonneau Messages: 30 Registered: February 2010 Location: Belgium |
Member |
|
|
Hello,
I have a problem caused by a very dumb behavior, but it still needs to be addressed.
My grammar is based on a Ecore model that I can't modify:
Container returns widgets::Container:
{widgets::Container}
'Container' (id=EString)? '{'
(children+=AbstractComponent (children+=AbstractComponent)*)?
'}';
AbstractComponent returns widgets::AbstractComponent:
Container |
Text |
Label;
The "id" attribute of a "Container" is its identifier (in the ecore definition).
So when a user write (I know this is really dumb)
Container "ID"
{
Container "ID"
{
Container "ID"
{
}
}
}
The outline refresh job falls into an infinite loop and finally end up with a StackOverflowError.
I've investigated this error, and found that the problem come from this method :
org.eclipse.xtext.ui.editor.outline.impl.AbstractOutlineNode.readOnly(final IUnitOfWork<T, EObject> work)
To build an Outline node, it retrieves the EObject from the resource based on its URI, which is : <path of the model>#<Identifier of the Object>, which, in my use case, is always the ID of root element of the model.
I've tried to apply some validation before the refresh Job. But of course the faulty value were not yet committed to the resource and the validation passed.
I'm out of ideas here.
Could please give me some hints or ideas to help me solve this ?
Best regards,
Charles Bonneau
|
|
|
|
| Re: Infinite loop when refreshing the outline [message #1007096 is a reply to message #1007093] |
Mon, 04 February 2013 07:45   |
Alexander Nittka Messages: 1081 Registered: July 2009 |
Senior Member |
|
|
Hi,
if I understand correctly, you must have adapted the URI fragment calculation such that two different objects within a resource can have the same fragment and consequently the same URI. This in itself is quite a big problem as it will break any linking functionality.
Regarding the outline, you may be able to resolve that by building the outline nodes yourself, but the synchronize-with-editor functionality will not work.
Alex
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
|
|
|
|
| Re: Infinite loop when refreshing the outline [message #1007111 is a reply to message #1007100] |
Mon, 04 February 2013 08:55   |
Alexander Nittka Messages: 1081 Registered: July 2009 |
Senior Member |
|
|
Hi,
I still quite don't understand that the same ID attribute should immediately lead to the same URI fragment... You might want to have a look into this.
Another possible workaround is the following. You hook into the root node creation of the outline tree and check whether there are two equal IDs in the model. In this case you create a custom node saying that the outline is not available. That way, you don't have to modify the rest of the outline tree calculation.
Alex
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01723 seconds