public CommandBarActionDef()

in src/dotnet/JetBrains.PresentationAssistant/VisualStudio/VsCommandShortcutProvider.cs [132:169]


            public CommandBarActionDef(VsShortcutFinder vsShortcutFinder, IEnvDteWrapper dte, string actionId,
                                       CommandID commandId, CommandBarControl control,
                                       CommandBarPopup[] parentPopups)
            {
                ActionId = actionId;

                // Lazily initialise. Talking to the command bar objects is SLOOOOOOOWWWWWW.
                backingFields = Lazy.Of(() =>
                {
                    Assertion.AssertNotNull(control, "control != null");

                    var sb = new StringBuilder();
                    foreach (var popup in parentPopups)
                        sb.AppendFormat("{0} \u2192 ", popup.Caption);

                    var fields = new BackingFields
                    {
                        Text = MnemonicStore.RemoveMnemonicMark(control.Caption),
                        Path = MnemonicStore.RemoveMnemonicMark(sb.ToString())
                    };

                    var command = VsCommandHelpers.TryGetVsCommandAutomationObject(commandId, dte);
                    var vsShortcut = vsShortcutFinder.GetVsShortcut(command);
                    if (vsShortcut != null)
                    {
                        var details = new ShortcutDetails[vsShortcut.KeyboardShortcuts.Length];
                        for (int i = 0; i < vsShortcut.KeyboardShortcuts.Length; i++)
                        {
                            var keyboardShortcut = vsShortcut.KeyboardShortcuts[i];
                            details[i] = new ShortcutDetails(KeyConverter.Convert(keyboardShortcut.Key),
                                keyboardShortcut.Modifiers);
                        }
                        fields.VsShortcut = new ShortcutSequence(details);
                    }

                    return fields;
                }, true);
            }