diff options
author | Greg Munn <gregm@microsoft.com> | 2020-01-15 21:58:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-15 21:58:14 +0300 |
commit | 3aa56f3ac55338ea18f82b5a0ea4a1fbaf2d6fec (patch) | |
tree | 1e3d744f9d354d21404f82c94a54a73a791de142 /main | |
parent | cc8ccdcb3eda20b18e003936320dfbbbba227d35 (diff) | |
parent | b62591f4d88304119a7e6212faad44d1a7d5167f (diff) |
Merge pull request #9357 from mono/backport-pr-9338-to-release-8.4
[release-8.4] [Debugger] Fixed CanRename() logic for Locals/Watch context menu & al…
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs index 7f4d0badc1..544f28acac 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs @@ -919,7 +919,7 @@ namespace MonoDevelop.Debugger [CommandHandler (EditCommands.Rename)] protected void OnRename () { - if (SelectedRow == -1) + if (SelectedRowCount != 1 || SelectedRow < 0) return; var nameView = (MacDebuggerObjectNameView) GetView (0, SelectedRow, false); @@ -934,7 +934,13 @@ namespace MonoDevelop.Debugger bool CanRename (out bool enabled) { - enabled = SelectedRowCount == 1 && SelectedRow != -1; + if (SelectedRowCount == 1 && SelectedRow >= 0) { + var item = (MacObjectValueNode) ItemAtRow (SelectedRow); + + enabled = item.Target.Parent is RootObjectValueNode || item.Target is AddNewExpressionObjectValueNode; + } else { + enabled = false; + } return AllowWatchExpressions; } @@ -957,7 +963,9 @@ namespace MonoDevelop.Debugger if (row < 0) return null; - var menu = new NSMenu (); + var menu = new NSMenu { + AutoEnablesItems = false + }; bool enabled; if (CanAddWatch (out enabled)) { |