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. 35
      src/Main/Base/Project/Src/Commands/FileCommands.cs

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

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

Loading…
Cancel
Save