Community
Participate
Working Groups
Created attachment 180380 [details] Hacked version of XtextContentOutlinePage When performing a save as - and the editor gets a new editor input, the outline page will continue to listen to a model that is no longer maintained. I first tried deriving a class that exposed the "refresh" method via an "externalRefresh", but this was not enough as the outline page held on to a registered modelListener, and this also needed to be reset (a new listener must be registred). The work around turned out to be a quite ugly hack because I did not know if it was possible to also replace the toolbar configurer (with other possible consequences). I attached the modified class with an externalRefresh method that simply nulls the modelListener. It seems like a change of editor input should lead to unregistration of the current listener, but I did not know how to do that without holding on to the xtextDocument (which may be a really bad idea). The externalRefresh simply does this: /** * THIS METHOD IS THE ONLY REAL ADDITION TO THE COPIED/HACKED CLASS * 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(); }
Has been fixed with the redesign of the outline API.
Closing all bugs that were set to RESOLVED before Neon.0