protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("LESS");
            if (point == null)
                return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            var doc = CssEditorDocument.FromTextBuffer(buffer);
            ParseItem item = doc.StyleSheet.ItemBeforePosition(point.Value);
            ParseItem rule = FindParent(item);

            string text = item.Text;
            string name = Microsoft.VisualBasic.Interaction.InputBox("Name of the variable", "Web Essentials");

            if (string.IsNullOrEmpty(name))
                return false;

            using (EditorExtensionsPackage.UndoContext(("Extract to variable")))
            {
                buffer.Insert(rule.Start, "@" + name + ": " + text + ";" + Environment.NewLine + Environment.NewLine);

                Span span = TextView.Selection.SelectedSpans[0].Span;
                TextView.TextBuffer.Replace(span, "@" + name);
            }

            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("CSS");
            if (point == null)
                return false;
            ITextSnapshot snapshot = point.Value.Snapshot;
            var doc = CssEditorDocument.FromTextBuffer(snapshot.TextBuffer);

            StringBuilder sb = new StringBuilder(snapshot.GetText());
            int scrollPosition = TextView.TextViewLines.FirstVisibleLine.Extent.Start.Position;

            using (EditorExtensionsPackage.UndoContext("Remove Duplicate Properties"))
            {
                int count;
                string result = RemoveDuplicateProperties(sb, doc, out count);
                Span span = new Span(0, snapshot.Length);
                snapshot.TextBuffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
                TextView.ViewScroller.ScrollViewportVerticallyByLines(ScrollDirection.Down, TextView.TextSnapshot.GetLineNumberFromPosition(scrollPosition));
                EditorExtensionsPackage.DTE.StatusBar.Text = count + " duplicate properties removed";
            }

            return true;
        }
Example #3
0
        private static bool TryConvertToCommandKeyBindings(string text, out List<CommandKeyBinding> bindingsList)
        {
            bindingsList = null;
            var list = new List<CommandKeyBinding>();
            var items = ConvertToList(text);
            if (items.Count % 4 != 0)
            {
                return false;
            }

            for (int i = 0; i < items.Count; i += 4)
            {
                Guid group;
                uint id;
                KeyBinding keyBinding;
                if (!Guid.TryParse(items[i], out group) ||
                    !UInt32.TryParse(items[i + 1], out id) ||
                    !KeyBinding.TryParse(items[i + 3], out keyBinding))
                {
                    return false;
                }

                var commandId = new CommandId(group, id);
                list.Add(new CommandKeyBinding(commandId, items[i + 2], keyBinding));
            }

            bindingsList = list;
            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            IDataObject data = Clipboard.GetDataObject();
            ProjectItem item = ProjectHelpers.GetActiveFile();

            if (!data.GetDataPresent(DataFormats.Bitmap) || string.IsNullOrEmpty(item.ContainingProject.FullName))
                return false;

            string fileName = null;

            using (var dialog = new SaveFileDialog())
            {
                dialog.FileName = "file.png";
                dialog.DefaultExt = ".png";
                dialog.Filter = "Images|*.png;*.gif;*.jpg;*.bmp;";
                dialog.InitialDirectory = ProjectHelpers.GetRootFolder();

                if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    return true;

                fileName = dialog.FileName;
            }

            SaveClipboardImageToFile(data, fileName);
            UpdateTextBuffer(fileName);

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                ProjectHelpers.AddFileToActiveProject(fileName);

            }), DispatcherPriority.ApplicationIdle, null);

            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            SnapshotPoint? point = TextView.Caret.Position.Point.GetPoint(TextView.TextBuffer, PositionAffinity.Predecessor);

            if (point.HasValue)
            {
                TextExtent wordExtent = _navigator.GetExtentOfWord(point.Value - 1);
                string wordText = TextView.TextSnapshot.GetText(wordExtent.Span);

                Find2 find = (Find2)EditorExtensionsPackage.DTE.Find;
                string types = find.FilesOfType;
                bool matchCase = find.MatchCase;
                bool matchWord = find.MatchWholeWord;

                find.WaitForFindToComplete = false;
                find.Action = EnvDTE.vsFindAction.vsFindActionFindAll;
                find.Backwards = false;
                find.MatchInHiddenText = true;
                find.MatchWholeWord = true;
                find.MatchCase = true;
                find.PatternSyntax = EnvDTE.vsFindPatternSyntax.vsFindPatternSyntaxLiteral;
                find.ResultsLocation = EnvDTE.vsFindResultsLocation.vsFindResults1;
                find.SearchSubfolders = true;
                find.FilesOfType = "*.js";
                find.Target = EnvDTE.vsFindTarget.vsFindTargetSolution;
                find.FindWhat = wordText;
                find.Execute();

                find.FilesOfType = types;
                find.MatchCase = matchCase;
                find.MatchWholeWord = matchWord;
            }

            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (TextView != null)
            {
                string content = TextView.Selection.SelectedSpans[0].GetText();
                string extension = Path.GetExtension(_dte.ActiveDocument.FullName).ToLowerInvariant();
                string result = MinifyFileMenu.MinifyString(extension, content);

                if (!string.IsNullOrEmpty(result))
                {
                    if (result != content)
                    {
                        using (EditorExtensionsPackage.UndoContext(("Minify")))
                            TextView.TextBuffer.Replace(TextView.Selection.SelectedSpans[0].Span, result);
                    }
                    else
                    {
                        _dte.StatusBar.Text = "The selection was already minified";
                    }
                }
                else
                {
                    _dte.StatusBar.Text = "Could not minify the selection. Unsupported file type.";
                }
            }

            return true;
        }
 public EventDescriptor(CommandId commandId, EntityId id, IEvent eventData, int entityVersion)
 {
     CommandId = commandId;
     EventData = eventData;
     Version = entityVersion;
     EntityId = id;
 }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (_broker.IsCompletionActive(TextView) || !IsValidTextBuffer() || !WESettings.GetBoolean(WESettings.Keys.EnableEnterFormat))
                return false;

            int position = TextView.Caret.Position.BufferPosition.Position;
            SnapshotPoint point = new SnapshotPoint(TextView.TextBuffer.CurrentSnapshot, position);
            IWpfTextViewLine line = TextView.GetTextViewLineContainingBufferPosition(point);

            ElementNode element = null;
            AttributeNode attr = null;

            _tree.GetPositionElement(position, out element, out attr);

            if (element == null ||
                _tree.IsDirty ||
                element.Parent == null ||
                element.StartTag.Contains(position) ||
                line.End.Position == position || // caret at end of line (TODO: add ignore whitespace logic)
                TextView.TextBuffer.CurrentSnapshot.GetText(element.InnerRange.Start, element.InnerRange.Length).Trim().Length == 0)
                return false;

            UpdateTextBuffer(element);

            return false;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            HtmlEditorDocument document = HtmlEditorDocument.FromTextView(_view);
            var tree = document.HtmlEditorTree;

            int start = _view.Selection.Start.Position.Position;
            int end = _view.Selection.End.Position.Position;

            ElementNode tag = null;
            AttributeNode attr = null;

            tree.GetPositionElement(start + 1, out tag, out attr);

            if (tag == null)
                return false;

            if (tag.EndTag != null && tag.StartTag.Start == start && tag.EndTag.End == end)
            {
                Select(tag.InnerRange.Start, tag.InnerRange.Length);
            }
            else if (tag.Parent != null && tag.Children.Count > 0 && (tag.Start != start || tag.Parent.Children.Last().End != end))
            {
                Select(tag.Children.First().Start, tag.Children.Last().End - tag.Children.First().Start);
            }
            else if (tag.Parent != null && tag.Parent.Children.First().Start == start && tag.Parent.Children.Last().End == end)
            {
                SelectCaretNode(tree, tag.Parent);
            }
            else if (tag.Children.Count > 0)
            {
                SelectCaretNode(tree, tag);
            }

            return true;
        }
 /// <summary>
 /// Adds the command with the specified id and callback.
 /// </summary>
 /// <param name="cmdId">The command unique identifier.</param>
 /// <param name="cmdCallback">The command callback.</param>
 private void AddCommand(CommandId cmdId, Action cmdCallback)
 {
     var cmd = new CommandID(Guids.PublishCmdSet, (int)cmdId);
     var menuCmd = new OleMenuCommand((s, e) => cmdCallback(), cmd);
     menuCmd.BeforeQueryStatus += BeforeQueryStatus;
     mcs.AddCommand(menuCmd);
 }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("LESS");
            if (point == null)
                return false;

            var buffer = point.Value.Snapshot.TextBuffer;
            var doc = CssEditorDocument.FromTextBuffer(buffer);
            ParseItem item = doc.StyleSheet.ItemBeforePosition(point.Value);

            ParseItem rule = LessExtractVariableCommandTarget.FindParent(item);
            int mixinStart = rule.Start;
            string name = Microsoft.VisualBasic.Interaction.InputBox("Name of the Mixin", "Web Essentials");

            if (!string.IsNullOrEmpty(name))
            {
                using (EditorExtensionsPackage.UndoContext(("Extract to mixin")))
                {
                    string text = TextView.Selection.SelectedSpans[0].GetText();
                    buffer.Insert(rule.Start, "." + name + "() {" + Environment.NewLine + text + Environment.NewLine + "}" + Environment.NewLine + Environment.NewLine);

                    var selection = TextView.Selection.SelectedSpans[0];
                    TextView.TextBuffer.Replace(selection.Span, "." + name + "();");

                    TextView.Selection.Select(new SnapshotSpan(TextView.TextBuffer.CurrentSnapshot, mixinStart, 1), false);
                    EditorExtensionsPackage.ExecuteCommand("Edit.FormatSelection");
                    TextView.Selection.Clear();
                }

                return true;
            }

            return false;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            BrowserSelector selector = new BrowserSelector();
            selector.ShowDialog();

            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("css");
            if (point == null) return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            CssEditorDocument doc = CssEditorDocument.FromTextBuffer(buffer);
            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);

            StringBuilder sb = new StringBuilder(buffer.CurrentSnapshot.GetText());

            using (EditorExtensionsPackage.UndoContext("Add Missing Standard Property"))
            {
                string result = AddMissingStandardDeclaration(sb, doc, rootSchema);
                Span span = new Span(0, buffer.CurrentSnapshot.Length);
                buffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
            }

            return true;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (_broker.IsCompletionActive(TextView))
                return false;

            int position = TextView.Caret.Position.BufferPosition.Position;

            if (position == 0 || position == TextView.TextBuffer.CurrentSnapshot.Length || TextView.Selection.SelectedSpans[0].Length > 0)
                return false;

            char before = TextView.TextBuffer.CurrentSnapshot.GetText(position - 1, 1)[0];
            char after = TextView.TextBuffer.CurrentSnapshot.GetText(position, 1)[0];

            if (before == '{' && after == '}')
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                {
                    using (EditorExtensionsPackage.UndoContext("Smart Indent"))
                    {
                        // HACK: A better way is needed. 
                        // We do this to get around the native TS formatter
                        SendKeys.Send("{TAB}{ENTER}{UP}");
                    }
                }), DispatcherPriority.Normal, null);
            }

            return false;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var point = TextView.GetSelection("css");
            if (point == null) return false;

            ITextBuffer buffer = point.Value.Snapshot.TextBuffer;
            CssEditorDocument doc = CssEditorDocument.FromTextBuffer(buffer);
            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);

            StringBuilder sb = new StringBuilder(buffer.CurrentSnapshot.GetText());
            int scrollPosition = TextView.TextViewLines.FirstVisibleLine.Extent.Start.Position;

            using (EditorExtensionsPackage.UndoContext("Add Missing Vendor Specifics"))
            {
                int count;
                string result = AddMissingVendorDeclarations(sb, doc, rootSchema, out count);
                Span span = new Span(0, buffer.CurrentSnapshot.Length);
                buffer.Replace(span, result);

                var selection = EditorExtensionsPackage.DTE.ActiveDocument.Selection as TextSelection;
                selection.GotoLine(1);

                EditorExtensionsPackage.ExecuteCommand("Edit.FormatDocument");
                TextView.ViewScroller.ScrollViewportVerticallyByLines(ScrollDirection.Down, TextView.TextSnapshot.GetLineNumberFromPosition(scrollPosition));
                EditorExtensionsPackage.DTE.StatusBar.Text = count + " missing vendor specific properties added";
            }

            return true;
        }
 private void ExpectRaise(CommandId commandId)
 {
     object p1 = null;
     object p2 = null;
     _commands
         .Setup(x => x.Raise(commandId.Group.ToString(), (int)commandId.Id, ref p1, ref p2))
         .Verifiable();
 }
 public int Add(CommandId commandIdentifier, bool separatorBefore, bool separatorAfter)
 {
     MenuDefinitionEntryCommand mde = new MenuDefinitionEntryCommand();
     mde.CommandIdentifier = commandIdentifier.ToString();
     mde.SeparatorBefore = separatorBefore;
     mde.SeparatorAfter = separatorAfter;
     return Add(mde);
 }
 private void ExpectNotRaise(CommandId commandId, Action isCalled)
 {
     object p1 = null;
     object p2 = null;
     _commands
         .Setup(x => x.Raise(commandId.Group.ToString(), (int)commandId.Id, ref p1, ref p2))
         .Callback(isCalled);
 }
 public GroupCommand(CommandId commandId, Command representativeCommand) : base(commandId)
 {
     Debug.Assert(representativeCommand != null, "Unexpected null command");
     _representativeCommand = representativeCommand;
     UpdateInvalidationState(PropertyKeys.SmallImage, InvalidationState.Pending);
     UpdateInvalidationState(PropertyKeys.SmallHighContrastImage, InvalidationState.Pending);
     UpdateInvalidationState(PropertyKeys.LargeImage, InvalidationState.Pending);
     UpdateInvalidationState(PropertyKeys.LargeHighContrastImage, InvalidationState.Pending);
 }
 public CommandDescriptor(CommandId commandId, AggregateRootId aggregateRootId, TimeSpan created, string aggregateRootType, string commandType, string commandData)
 {
     CommandId = commandId;
     AggregateRootId = aggregateRootId;
     Created = created;
     AggregateRootType = aggregateRootType;
     CommandType = commandType;
     CommandData = commandData;
 }
        public static Bitmap GetGalleryItemImageFromCommand(CommandManager commandManager, CommandId commandId)
        {
            // @RIBBON TODO: Deal with high constrast appropriately
            Command command = commandManager.Get(commandId);
            if (command != null)
                return command.LargeImage;

            return Images.Missing_LargeImage;
        }
 private CommandId AddRemovedBinding(string keyStroke, string name = "comment")
 {
     var keyBinding = KeyBinding.Parse(keyStroke);
     var commandId = new CommandId(Guid.NewGuid(), 0);
     _removedBindingList.Add(new CommandKeyBinding(commandId, name, keyBinding));
     _vimApplicationSettings
         .Raise(x => x.SettingsChanged += null, new ApplicationSettingsEventArgs());
     return commandId;
 }
        private static string SortLines(CommandId commandId, IEnumerable<string> lines)
        {
            if (commandId == CommandId.SortAsc)
                lines = lines.OrderBy(t => t);
            else
                lines = lines.OrderByDescending(t => t);

            return string.Join(Environment.NewLine, lines);
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (!string.IsNullOrEmpty(_className))
            {
                FileHelpers.SearchFiles("." + _className, "*.css;*.less;*.scss;*.sass");
            }

            return true;
        }
Example #25
0
        public void AddWithDuplicateName()
        {
            var factory = new CommandFactory();

            var name = new CommandId("name");
            Func<ICommand> activator = () => new Mock<ICommand>().Object;

            factory.Add(name, activator);
            Assert.Throws<DuplicateCommandException>(() => factory.Add(name, activator));
        }
Example #26
0
        public void Add()
        {
            var factory = new CommandFactory();

            var name = new CommandId("name");
            Func<ICommand> activator = () => new Mock<ICommand>().Object;

            factory.Add(name, activator);
            Assert.IsTrue(factory.Contains(name));
        }
Example #27
0
 private void AddCommand(CommandId id, IContentType contentType)
 {
     var cid = new CommandID(CommandGuids.guidBuildCmdSet, (int)id);
     var command = new OleMenuCommand(async (s, e) =>
     {
         EditorExtensionsPackage.DTE.StatusBar.Text = "Compiling " + contentType + "...";
         await Task.Run(() => Compiler.CompileSolutionAsync(contentType));
         EditorExtensionsPackage.DTE.StatusBar.Clear();
     }, cid);
     _mcs.AddCommand(command);
 }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if ((VSConstants.VSStd2KCmdID)commandId == VSConstants.VSStd2KCmdID.TAB && !_broker.IsCompletionActive(TextView))
            {
                if (InvokeZenCoding())
                {
                    return true;
                }
            }

            return false;
        }
        protected override bool Execute(CommandId commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.JavaScriptCommentCompletion))
                return false;

            char typedChar = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn);

            if (typedChar != '*')
                return false;

            return CompleteComment();
        }
Example #30
0
 private OleCommandData(
     Guid commandGroup,
     uint commandId,
     uint commandExecOpt,
     IntPtr variantIn,
     IntPtr variantOut)
 {
     _commandId = new CommandId(commandGroup, commandId);
     _commandExecOpt = commandExecOpt;
     _variantIn = variantIn;
     _variantOut = variantOut;
 }
Example #31
0
 protected override void Context()
 {
     base.Context();
     _oneRandomCommandId = new CommandId();
 }
 public void RemoveAt(CommandId commandId, int index)
 {
     _commandStore.Get(commandId).Parameters.RemoveAt(index);
 }
Example #33
0
 internal FallbackCommand(ScopeKind scopeKind, KeyBinding keyBinding, CommandId command)
 {
     _scopeKind  = scopeKind;
     _keyBinding = keyBinding.KeyStrokes.Select(KeyCharModifier.Create).ToList();
     _command    = command;
 }
 public ParameterId GetParameterByIndex(CommandId commandId, int index)
 {
     return(_parameterStore.GetIdFor((IDbDataParameter)_commandStore.Get(commandId).Parameters[index]));
 }
Example #35
0
 public Command(CommandId CommandId)
 {
     Magic          = GLUC;
     this.CommandId = CommandId;
 }
Example #36
0
 public void Queue(CommandId commandId, object[] args)
 {
     EventQueued?.Invoke(this, new QueuedEvent(commandId, args));
 }
Example #37
0
 public PreviewCommand(CommandId commandId)
     : base(commandId)
 {
 }
Example #38
0
 private static bool ShowErrors_Checked(CommandId id)
 {
     return(ProbeToolsPackage.Instance.EditorOptions.RunBackgroundFecOnSave);
 }
Example #39
0
 private static bool DisableDeadCode_Checked(CommandId id)
 {
     return(ProbeToolsPackage.Instance.EditorOptions.DisableDeadCode);
 }
Example #40
0
 /// <summary>
 /// Shows the context menu with the specified command ID at the specified location
 /// </summary>
 public static void ShowContextMenu(this ICoreShell shell, CommandId commandId, int x, int y, object commandTarget = null)
 => shell.UI().ShowContextMenu(commandId, x, y, commandTarget);
Example #41
0
 public ViewCommand(ITextView textView, CommandId id, bool needCheckout)
     : base(id, needCheckout)
 {
     TextView = textView;
 }
 public void Clear(CommandId commandId)
 {
     _commandStore.Get(commandId).Parameters.Clear();
     _parametersToTidy.RemoveAnyParametersFor(commandId);
 }
Example #43
0
 protected override void Because()
 {
     _result = sut.CreateInverseId().CreateInverseId();
 }
 public TestSuccessExecutionResultCommand(
     TestAggregateId aggregateId,
     CommandId sourceId)
     : base(aggregateId, sourceId)
 {
 }
Example #45
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------
        #region Private Methods
        private static string GetPropertyName(CommandId commandId)
        {
            string propertyName = String.Empty;

            switch (commandId)
            {
            case CommandId.ScrollPageUp: propertyName = "ScrollPageUp"; break;

            case CommandId.ScrollPageDown: propertyName = "ScrollPageDown"; break;

            case CommandId.ScrollPageLeft: propertyName = "ScrollPageLeft"; break;

            case CommandId.ScrollPageRight: propertyName = "ScrollPageRight"; break;

            case CommandId.ScrollByLine: propertyName = "ScrollByLine"; break;

            case CommandId.MoveLeft: propertyName = "MoveLeft"; break;

            case CommandId.MoveRight: propertyName = "MoveRight"; break;

            case CommandId.MoveUp: propertyName = "MoveUp"; break;

            case CommandId.MoveDown: propertyName = "MoveDown"; break;

            case CommandId.ExtendSelectionUp: propertyName = "ExtendSelectionUp"; break;

            case CommandId.ExtendSelectionDown: propertyName = "ExtendSelectionDown"; break;

            case CommandId.ExtendSelectionLeft: propertyName = "ExtendSelectionLeft"; break;

            case CommandId.ExtendSelectionRight: propertyName = "ExtendSelectionRight"; break;

            case CommandId.MoveToHome: propertyName = "MoveToHome"; break;

            case CommandId.MoveToEnd: propertyName = "MoveToEnd"; break;

            case CommandId.MoveToPageUp: propertyName = "MoveToPageUp"; break;

            case CommandId.MoveToPageDown: propertyName = "MoveToPageDown"; break;

            case CommandId.SelectToHome: propertyName = "SelectToHome"; break;

            case CommandId.SelectToEnd: propertyName = "SelectToEnd"; break;

            case CommandId.SelectToPageDown: propertyName = "SelectToPageDown"; break;

            case CommandId.SelectToPageUp: propertyName = "SelectToPageUp"; break;

            case CommandId.MoveFocusUp: propertyName = "MoveFocusUp"; break;

            case CommandId.MoveFocusDown: propertyName = "MoveFocusDown"; break;

            case CommandId.MoveFocusBack: propertyName = "MoveFocusBack"; break;

            case CommandId.MoveFocusForward: propertyName = "MoveFocusForward"; break;

            case CommandId.MoveFocusPageUp: propertyName = "MoveFocusPageUp"; break;

            case CommandId.MoveFocusPageDown: propertyName = "MoveFocusPageDown"; break;
            }
            return(propertyName);
        }
 public int GetCount(CommandId commandId)
 {
     return(_commandStore.Get(commandId).Parameters.Count);
 }
Example #47
0
 public bool IsCommandId(CommandId Id)
 {
     return(CommandId == Id);
 }
 public void RemoveAt(CommandId commandId, string parameterName)
 {
     _commandStore.Get(commandId).Parameters.RemoveAt(parameterName);
 }
Example #49
0
 public GalleryCommand(CommandId commandId, bool allowPreview)
     : base(commandId)
 {
     _allowPreview = allowPreview;
     Initialize();
 }
 public bool Contains(CommandId commandId, ParameterId parameterId)
 {
     return(_parametersToTidy.IsRecordedForCommand(parameterId, commandId));
 }
Example #51
0
 /// <summary>
 /// Executes the default (built-in) command (without looking for user-defined commands), associated with the specified Id.
 /// </summary>
 /// <param name="id">The <see cref="CommandId"/> value to look for.</param>
 /// <param name="parameter">The parameter that is passed to the CanExecute and Execute methods of the command.</param>
 /// <returns>True if the command is successfully executed, false otherwise.</returns>
 public bool ExecuteDefaultCommand(CommandId id, object parameter)
 {
     return(this.ExecuteCommandCore((int)id, parameter, false));
 }
 public ParameterId GetParameterByName(CommandId commandId, string parameterName)
 {
     return(_parameterStore.GetIdFor((IDbDataParameter)_commandStore.Get(commandId).Parameters[parameterName]));
 }
Example #53
0
 public EditingCommand(ITextView textView, ICoreShell shell, CommandId id)
     : base(textView, id, true)
 {
     Shell = shell;
 }
Example #54
0
 public GalleryCommand(CommandId commandId)
     : base(commandId)
 {
     Initialize();
 }
Example #55
0
 private static bool ShowCodeAnalysis_Checked(CommandId id)
 {
     return(ProbeToolsPackage.Instance.EditorOptions.RunCodeAnalysisOnSave);
 }
Example #56
0
 /// <summary>
 /// Attempts to find the command, associated with the specified Id and to perform its Execute routine, using the provided parameter.
 /// </summary>
 /// <param name="id">The <see cref="CommandId"/> value to look for.</param>
 /// <param name="parameter">The parameter that is passed to the CanExecute and Execute methods of the command.</param>
 /// <returns>True if the command is successfully executed, false otherwise.</returns>
 public bool ExecuteCommand(CommandId id, object parameter)
 {
     return(this.ExecuteCommandCore((int)id, parameter, true));
 }
 public int IndexOf(CommandId commandId, string parameterName)
 {
     return(_commandStore.Get(commandId).Parameters.IndexOf(parameterName));
 }
Example #58
0
 public GalleryCommand(CommandId commandId, T defaultItem)
     : base(commandId)
 {
     _defaultItem = defaultItem;
     Initialize();
 }
Example #59
0
 internal FallbackCommand(KeyInput keyInput, CommandId command)
 {
     _keyInput = keyInput;
     _command  = command;
 }
Example #60
0
 public ATMSimCommand(CommandId commandId, object param)
 {
     CommandId = commandId;
     Param     = param;
 }