diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2019-06-17 14:41:32 +0300 |
---|---|---|
committer | Mike Krüger <mikkrg@microsoft.com> | 2019-06-17 14:41:32 +0300 |
commit | d1f0edff2d4ba6818f824a840175174b06508a6e (patch) | |
tree | 51d887b38c2883a05a6078c38c783f75f81984f0 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs | |
parent | 89601f4ad6284274e55172bb103fa32267c02997 (diff) |
Fixes issue #6270 Allow disabling the `solution already opened`
message
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs index 7b54b17dc8..c2b43f1433 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs @@ -97,13 +97,25 @@ namespace MonoDevelop.Ide.Commands } if (Services.ProjectService.IsWorkspaceItemFile (file) || Services.ProjectService.IsSolutionItemFile (file)) { + WarnIfWorkspaceItemIsAlreadyOpen (file); IdeApp.Workspace.OpenWorkspaceItem (file, dlg.CloseCurrentWorkspace); } else IdeApp.Workbench.OpenDocument (file, null, dlg.Encoding, OpenDocumentOptions.DefaultInternal); } - + + internal static bool WarnIfWorkspaceItemIsAlreadyOpen (FilePath file) + { + var item = IdeApp.Workspace.GetAllItems<WorkspaceItem> ().FirstOrDefault (w => w.FileName == file.FullPath); + if (item != null) { + if (IdeApp.IsInitialized) + IdeApp.Workbench.StatusBar.ShowWarning (GettextCatalog.GetString ("{0} is already opened", item.FileName.FileName)); + return true; + } + return false; + } } + // MonoDevelop.Ide.Commands.FileCommands.NewFile public class NewFileHandler : CommandHandler { @@ -388,6 +400,7 @@ namespace MonoDevelop.Ide.Commands string filename = (string)dataItem; Gdk.ModifierType mtype = GtkWorkarounds.GetCurrentKeyModifiers (); bool inWorkspace = (mtype & Gdk.ModifierType.ControlMask) != 0; + OpenFileHandler.WarnIfWorkspaceItemIsAlreadyOpen (filename); IdeApp.Workspace.OpenWorkspaceItem (filename, !inWorkspace); } } |