|
|
|
|
@ -335,6 +335,7 @@ namespace ICSharpCode.SharpDevelop.Gui
@@ -335,6 +335,7 @@ namespace ICSharpCode.SharpDevelop.Gui
|
|
|
|
|
|
|
|
|
|
public bool CloseWindow(bool force) |
|
|
|
|
{ |
|
|
|
|
bool fileDiscarded = false; |
|
|
|
|
if (!force && this.IsDirty) { |
|
|
|
|
DialogResult dr = MessageBox.Show(ResourceService.GetString("MainWindow.SaveChangesMessage"), |
|
|
|
|
ResourceService.GetString("MainWindow.SaveChangesMessageHeader") + " " + Title + " ?", |
|
|
|
|
@ -350,6 +351,7 @@ namespace ICSharpCode.SharpDevelop.Gui
@@ -350,6 +351,7 @@ namespace ICSharpCode.SharpDevelop.Gui
|
|
|
|
|
vc.Files.Foreach(ICSharpCode.SharpDevelop.Commands.SaveFile.Save); |
|
|
|
|
if (vc.IsDirty) { |
|
|
|
|
if (MessageService.AskQuestion("${res:MainWindow.DiscardChangesMessage}")) { |
|
|
|
|
fileDiscarded = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
@ -360,14 +362,39 @@ namespace ICSharpCode.SharpDevelop.Gui
@@ -360,14 +362,39 @@ namespace ICSharpCode.SharpDevelop.Gui
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case DialogResult.No: |
|
|
|
|
fileDiscarded = true; |
|
|
|
|
break; |
|
|
|
|
case DialogResult.Cancel: |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Create list of files to reparse after the window is closed.
|
|
|
|
|
// This is necessary because when changes were discarded,
|
|
|
|
|
// the ParserService still has the information with the changes
|
|
|
|
|
// that are now invalid.
|
|
|
|
|
string[] filesToReparse; |
|
|
|
|
if (fileDiscarded) { |
|
|
|
|
filesToReparse = this.ViewContents |
|
|
|
|
.SelectMany(vc => vc.Files) |
|
|
|
|
.Select(f => f.FileName) |
|
|
|
|
.Distinct(StringComparer.OrdinalIgnoreCase) |
|
|
|
|
.ToArray(); |
|
|
|
|
} else { |
|
|
|
|
filesToReparse = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
OnCloseEvent(null); |
|
|
|
|
Dispose(); |
|
|
|
|
|
|
|
|
|
if (filesToReparse != null) { |
|
|
|
|
// This must happen after Dispose so that the ViewContents
|
|
|
|
|
// are closed and their content is no longer found by
|
|
|
|
|
// the ParserService.
|
|
|
|
|
LoggingService.Debug("SdiWorkspaceWindow closed with discarding changes, enqueueing files for parsing: " + String.Join(", ", filesToReparse)); |
|
|
|
|
filesToReparse.Foreach(ParserService.EnqueueForParsing); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|