Browse Source

fixed SD-1150

pull/2/head
Expro 15 years ago committed by Daniel Grunwald
parent
commit
4e54652426
  1. 3
      src/Main/Base/Project/Src/Commands/FileMenuCommands.cs
  2. 8
      src/Main/Base/Project/Src/Gui/IWorkbench.cs
  3. 38
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs

3
src/Main/Base/Project/Src/Commands/FileMenuCommands.cs

@ -40,8 +40,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -40,8 +40,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
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

@ -163,6 +163,14 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -163,6 +163,14 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
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>

38
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs

@ -17,6 +17,7 @@ using System.Windows.Media; @@ -17,6 +17,7 @@ using System.Windows.Media;
using System.Windows.Navigation;
using ICSharpCode.Core;
using ICSharpCode.Core.Presentation;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -433,6 +434,43 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -433,6 +434,43 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
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;

Loading…
Cancel
Save