Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed SD-1150

  • Loading branch information...
commit 4e54652426e610f6134fb82d6168c3a80cc80445 1 parent 84e6d2d
Expro authored dgrunwald committed
3  src/Main/Base/Project/Src/Commands/FileMenuCommands.cs
View
@@ -40,8 +40,7 @@ public class CloseSolution : AbstractMenuCommand
public override void Run()
{
ProjectService.SaveSolutionPreferences();
- WorkbenchSingleton.Workbench.CloseAllViews();
- if (WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count == 0) {
+ if (WorkbenchSingleton.Workbench.CloseAllSolutionViews()) {
ProjectService.CloseSolution();
}
}
8 src/Main/Base/Project/Src/Gui/IWorkbench.cs
View
@@ -164,6 +164,14 @@ public interface IWorkbench : IMementoCapable
void CloseAllViews();
/// <summary>
+ /// Closes all views related to current solution.
+ /// </summary>
+ /// <returns>
+ /// True if all views were closed properly, false if closing was aborted.
+ /// </returns>
+ bool CloseAllSolutionViews();
+
+ /// <summary>
/// Is called, when a workbench view was opened
/// </summary>
/// <example>
38 src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs
View
@@ -17,6 +17,7 @@
using System.Windows.Navigation;
using ICSharpCode.Core;
using ICSharpCode.Core.Presentation;
+using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
{
@@ -433,6 +434,43 @@ public void CloseAllViews()
}
}
+ public bool CloseAllSolutionViews()
+ {
+ bool isSolutionWindow;
+ bool result = true;
+
+ WorkbenchSingleton.AssertMainThread();
+ try
+ {
+ closeAll = true;
+ foreach (IWorkbenchWindow window in this.WorkbenchWindowCollection.ToArray())
+ {
+ isSolutionWindow = false;
+ foreach (IViewContent content in window.ViewContents)
+ {
+ foreach (OpenedFile file in content.Files)
+ {
+ if (ProjectService.OpenSolution.FindProjectContainingFile(file.FileName) != null)
+ {
+ isSolutionWindow = true;
+ break;
+ }
+ }
+ }
+
+ if (isSolutionWindow)
+ result = window.CloseWindow(false) && result;
+ }
+ }
+ finally
+ {
+ closeAll = false;
+ OnActiveWindowChanged(this, EventArgs.Empty);
+ }
+
+ return result;
+ }
+
#region ViewContent Memento Handling
string viewContentMementosFileName;
Please sign in to comment.
Something went wrong with that request. Please try again.