mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
Duplicate key. Use "Delete" instead of "Delete VM" to match menus for other objects.
Made Debug Assertion more detailed to aid us pick unique hotkeys. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
655b8eedf7
commit
dd94ebaf3f
@ -31,16 +31,15 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using XenAPI;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Model;
|
||||
using XenAdmin.Core;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using XenAdmin.Dialogs;
|
||||
using XenAdmin.Plugins;
|
||||
|
||||
@ -163,7 +162,7 @@ namespace XenAdmin.Commands
|
||||
[Conditional("DEBUG")]
|
||||
private void CheckAccessKeys(ContextMenuItemCollection items)
|
||||
{
|
||||
List<string> usedKeys = new List<string>();
|
||||
var usedKeys = new Dictionary<string, List<string>>();
|
||||
|
||||
foreach (ToolStripItem item in items)
|
||||
{
|
||||
@ -174,16 +173,16 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
string c = text[index + 1].ToString().ToLower();
|
||||
|
||||
if (usedKeys.Contains(c))
|
||||
{
|
||||
Debug.Fail("Duplicated access key: " + c);
|
||||
}
|
||||
if (usedKeys.ContainsKey(c))
|
||||
usedKeys[c].Add(text);
|
||||
else
|
||||
{
|
||||
usedKeys.Add(c);
|
||||
}
|
||||
usedKeys[c] = new List<string> { text };
|
||||
}
|
||||
}
|
||||
|
||||
if (usedKeys.Any(kvp => kvp.Value.Count > 1))
|
||||
Debug.Fail("Found duplicate access key. Here are the used ones:\n" +
|
||||
string.Join("\n", usedKeys.Select(kvp => $"{kvp.Key} => {string.Join(", ", kvp.Value)}")));
|
||||
}
|
||||
|
||||
private abstract class Builder
|
||||
|
@ -113,18 +113,7 @@ namespace XenAdmin.Commands
|
||||
return selection.AllItemsAre<VM>() && selection.AtLeastOneXenObjectCan<VM>(CanExecute);
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GetSelection().Count > 1)
|
||||
{
|
||||
return Messages.MAINWINDOW_DELETE_OBJECTS;
|
||||
}
|
||||
|
||||
return Messages.MAINWINDOW_DELETE_VM;
|
||||
}
|
||||
}
|
||||
public override string MenuText => Messages.MAINWINDOW_DELETE_OBJECTS;
|
||||
|
||||
protected virtual string ErrorDialogText
|
||||
{
|
||||
|
11
XenModel/Messages.Designer.cs
generated
11
XenModel/Messages.Designer.cs
generated
@ -21594,7 +21594,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to De&lete....
|
||||
/// Looks up a localized string similar to &Delete....
|
||||
/// </summary>
|
||||
public static string MAINWINDOW_DELETE_OBJECTS {
|
||||
get {
|
||||
@ -21638,15 +21638,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to &Delete VM....
|
||||
/// </summary>
|
||||
public static string MAINWINDOW_DELETE_VM {
|
||||
get {
|
||||
return ResourceManager.GetString("MAINWINDOW_DELETE_VM", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Destr&oy....
|
||||
/// </summary>
|
||||
|
@ -7519,7 +7519,7 @@ This will permanently delete and reinitialize all local storage on the servers.
|
||||
<value>Ctrl+Y</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_DELETE_OBJECTS" xml:space="preserve">
|
||||
<value>De&lete...</value>
|
||||
<value>&Delete...</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_DELETE_POOL" xml:space="preserve">
|
||||
<value>Mak&e into standalone server</value>
|
||||
@ -7533,9 +7533,6 @@ This will permanently delete and reinitialize all local storage on the servers.
|
||||
<data name="MAINWINDOW_DELETE_TEMPLATE" xml:space="preserve">
|
||||
<value>&Delete Template...</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_DELETE_VM" xml:space="preserve">
|
||||
<value>&Delete VM...</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_DESTROY_SR" xml:space="preserve">
|
||||
<value>Destr&oy...</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user