| Summary: | XtextContentOutlinePage listens to wrong model after 'saveAs' | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Henrik Lindberg <henrik.lindberg> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jan | ||||
| Version: | 1.0.1 | Flags: | jan:
juno+
|
||||
| Target Milestone: | M4 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Has been fixed with the redesign of the outline API. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
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(); }