diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2019-05-29 14:07:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 14:07:11 +0300 |
commit | d5a5456fae586b552aca4c1b1afb3bdd21309fc3 (patch) | |
tree | 5a2a872b7bc50d9e5a97b052cdc902dc22eb993d /main | |
parent | 216523e6990d82cb074c5fac312e9cfa09947bb0 (diff) | |
parent | 4b7f080cc72afef317909f1e479923dac105860d (diff) |
Merge pull request #7679 from mono/master-vsts895926
Fixes VSTS Bug 895926: Version Control > Log jumps to wrong tag
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs index 979d97cb97..f738a4c9f9 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Commands.cs @@ -1,4 +1,4 @@ - + using MonoDevelop.Components.Commands; using MonoDevelop.Projects; using MonoDevelop.Ide; @@ -243,27 +243,47 @@ namespace MonoDevelop.VersionControl } } - class CurrentFileViewHandler<T> : FileVersionControlCommandHandler + abstract class CurrentFileViewHandler<T> : FileVersionControlCommandHandler { + protected bool CanRunCommand { get => IdeApp.Workbench.ActiveDocument?.GetContent<VersionControlDocumentController> () != null; } + protected override bool RunCommand (VersionControlItemList items, bool test) { - if (test) - return true; - - IdeApp.Workbench.ActiveDocument?.GetContent<VersionControlDocumentController> ()?.ShowDiffView (); - return true; + return CanRunCommand; } } class CurrentFileDiffHandler : CurrentFileViewHandler<IDiffView> { + protected override bool RunCommand (VersionControlItemList items, bool test) + { + if (test) + return CanRunCommand; + IdeApp.Workbench.ActiveDocument?.GetContent<VersionControlDocumentController> ()?.ShowDiffView (); + return true; + } } - + class CurrentFileBlameHandler : CurrentFileViewHandler<IBlameView> { + protected override bool RunCommand (VersionControlItemList items, bool test) + { + if (test) + return CanRunCommand; + IdeApp.Workbench.ActiveDocument?.GetContent<VersionControlDocumentController> ()?.ShowBlameView (); + return true; + } + } - + class CurrentFileLogHandler : CurrentFileViewHandler<ILogView> { + protected override bool RunCommand (VersionControlItemList items, bool test) + { + if (test) + return CanRunCommand; + IdeApp.Workbench.ActiveDocument?.GetContent<VersionControlDocumentController> ()?.ShowLogView (); + return true; + } } } |