Community
Participate
Working Groups
6/13/05 w/ eclipse RC2 1. Open an xml file using XML Source Page editor 2. dirty it 3. Window->New Editor 4. now you have 2 editors open on the same file, both dirty 5. close 1 editor 6. editor closes without informing you file was modified and ask you if you want to save If you perform the same type of operation on Text editor, you will get Save resource dialog.
This is because in StructuredTextEditor#isSaveOnCloseNeeded it checks to see if the current StructuredModel is shared for edit, if it is still shared by another, it will not ask to save. Besides source editor not following the same behaviour as Text editor, it seems safer to ask the user if they want to save before closing the main editor, regardless of whether or not more editors on the file are open. What if the second editor is hidden somewhere (like embedded in a hidden view)? Or what if the other editor never saves on close?
Changed Version field given new release numbering.
also found issues with if other parts of the editor, like xml design page, has modelforedit. when editor is closed, first thing it does is check if save on close is needed. then it proceeds to close editor. so if another client is using model for edit, it won't have a chance to release before save on close is checked.
fix is in isSaveOnCloseNeeded: Original: public boolean isSaveOnCloseNeeded() { if (getInternalModel() == null) return false; ==> getInternalModel().isSaveNeeded(); } Fix: public boolean isSaveOnCloseNeeded() { if (getInternalModel() == null) return false; ==> // BUG99793 - always prompt for save if dirty (even if others have ==> // model for edit) ==> return getInternalModel().isDirty(); }
adding dependency to bug 106620 because this bug fix is included in that bug's fix.
David, please mark this bug as fixed when you apply patches for bug 106620.
Amy, how about removing that method altogether?
Nitin, I thought about that too but I didnt dig deep enough to see if if (getInternalModel() == null) return false; return getInternalModel().isDirty(); Is equivalent to IDocumentProvider p= getDocumentProvider(); return p == null ? false : p.canSaveDocument(getEditorInput()); if you can vouch that it is, I can update the patch.
They should be the same at this point, and the error handling for bug 106620 implies that we have to make it the same. When we don't have a structured model, the document provider is the only one who knows if a save is needed.
Fixed, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=106620#c8
*** Bug 107033 has been marked as a duplicate of this bug. ***
verified in WTP 1.0
This is part of a mass update to close out all stale WTP defects already verified by the reporter but awaiting closure by the assignee. If you feel this defect was closed inappropriately, please reopen. Thanks, John Lanuti