Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2019-07-22 12:54:02 +0300
committerGitHub <noreply@github.com>2019-07-22 12:54:02 +0300
commit4a02eec6874fb171ce542127924c131bedd58d7d (patch)
tree73adb7ed7a08c54f4477ba75ed4c120b4eed35b8
parent2b17a7bed2d20eddc29d02a1a6b29db7abd5fd93 (diff)
parent7bcaaa2d41a91ec2186de9e01518f83e35959954 (diff)
Merge pull request #8243 from mono/root-workspace-cleanups
[Ide] Small cleanup and optimization in RootWorkspace
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs9
2 files changed, 6 insertions, 11 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
index 80a607ed29..9fa9964212 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
@@ -694,14 +694,6 @@ namespace MonoDevelop.Ide.Gui.Documents
navigator.JumpToLine (fileInfo.Line, fileInfo.Column);*/
}
- Document FindDocument (IWorkbenchWindow window)
- {
- foreach (Document doc in Documents)
- if (doc.Window == window)
- return doc;
- return null;
- }
-
void WatchDocument (Document doc)
{
if (doc.IsFile) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
index 4f8628cf0f..9ea10d064e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
@@ -530,7 +530,7 @@ namespace MonoDevelop.Ide
await SavePreferencesAsync ();
if (closeProjectFiles && documentManager != null) {
- foreach (Document doc in documentManager.Documents.ToArray ()) {
+ foreach (Document doc in documentManager.Documents) {
if (!await doc.Close (force))
return false;
}
@@ -565,8 +565,11 @@ namespace MonoDevelop.Ide
if (RequestItemUnload (item)) {
if (closeItemFiles && documentManager != null) {
- var projects = item.GetAllItems<Project> ();
- foreach (Document doc in documentManager.Documents.Where (d => d.Owner != null && projects.Contains (d.Owner)).ToArray ()) {
+ var projects = new Lazy<List<Project>> (() => item.GetAllItems<Project> ().ToList ());
+ foreach (Document doc in documentManager.Documents) {
+ if (doc.Owner is null || !projects.Value.Contains (doc.Owner))
+ continue;
+
if (!await doc.Close ())
return;
}