|
|
|
|
|
|
|
|
|
Re: Outline refresh question [message #631243 is a reply to message #631220] |
Wed, 06 October 2010 16:16 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Henrik,
yes that would be very helpful (with you hack attached). Please log
other issues that you had with the Save As impl as well.
Thanks,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 06.10.10 17:07, schrieb Henrik Lindberg:
> Any input ?
> Should I just go ahead and log an issue?
>
> - henrik
> On 10/6/10 3:04 AM, Henrik Lindberg wrote:
>> On 8/28/10 11:05 PM, Sebastian Zarnekow wrote:
>>> Hi Henrik,
>>>
>>> you could try to make
>>> org.eclipse.xtext.ui.editor.outline.XtextContentOutlinePage. refresh()
>>> public and obtain the outline-page from the editor via
>>> editor#getAdapter(IContentOutlinePage.class).
>>
>> I got that working fine for the root node change. I later discovered
>> that the outline page stops refreshing after a "save as" because the
>> outline page continues to listen to "the old model".
>>
>> Hacking around this was not easy because it was not possible to just
>> create an alternative implementation and bind with guice as the toolbar
>> configurer used expects an instance of XtextContentOutlinePage - I was
>> not sure if I should just replace that as well, but it seemed quicker to
>> just hack up a solution (as I by that time understood what was going on
>> in the outline page).
>>
>> I ended up with a class derived from XtextContentOutlinePage that
>> overrides everything (just to make it work as an equivalent
>> replacement), and then adding:
>>
>> /**
>> * Special method that should be called from performSavedAs
>> */
>> public void externalRefresh() {
>> // Must drop old listener (should ideally get rid of the listener, but
>> since the document changed already (??)
>> // it will probably not unregister for the correct document.
>> modelListener = null;
>> // Install a model listener for the current document
>> installModelListener();
>> refresh();
>> }
>>
>> This was the only way I could figure out to reset the (private)
>> modelListener.
>>
>> At first I thought I would need to hang on to the xtextDocument (so I
>> could unregister using the correct instance, but that is probably bad as
>> it then holds on to that object. My hack seems to work - but may have
>> some other surprises in store...
>>
>> Since the outline management things are changing, I don't know how to go
>> from here - log an issue? Attatch my hacked class? or just describe the
>> issue.
>>
>> Regards
>> - henrik
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04603 seconds