Browse Source

fixed SD2-1526 - Save As shows a Save As dialog box for each view attached to the file

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4881 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
44564f9f2f
  1. 37
      src/Main/Base/Project/Src/Commands/FileCommands.cs

37
src/Main/Base/Project/Src/Commands/FileCommands.cs

@ -6,10 +6,11 @@
// </file> // </file>
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -141,25 +142,23 @@ namespace ICSharpCode.SharpDevelop.Commands
internal static void Save(IWorkbenchWindow window) internal static void Save(IWorkbenchWindow window)
{ {
window.ViewContents.ForEach(Save); List<IViewContent> remainingViewContents = new List<IViewContent>();
}
foreach (IViewContent content in window.ViewContents) {
internal static void Save(IViewContent content) // try to run customized Save As Command, exclude ViewContent if successful
{ if (content is ICustomizedCommands && (content as ICustomizedCommands).SaveAsCommand())
if (content != null) { continue;
if (content is ICustomizedCommands) { // exclude view only ViewContents
if (((ICustomizedCommands)content).SaveAsCommand()) { if (content.IsViewOnly)
return; continue;
}
} remainingViewContents.Add(content);
if (content.IsViewOnly) {
return;
}
// save the primary file only
if (content.PrimaryFile != null) {
Save(content.PrimaryFile);
}
} }
// save remaining files once (display Save As dialog)
var files = remainingViewContents.SelectMany(content => content.Files).Distinct();
files.ForEach(Save);
} }
internal static void Save(OpenedFile file) internal static void Save(OpenedFile file)

Loading…
Cancel
Save