コード例 #1
0
 public EditorCommandFilter(IIdeTracer tracer, GoToStepDefinitionCommand goToStepDefinitionCommand, DebugScenariosCommand debugScenariosCommand, RunScenariosCommand runScenariosCommand, FormatTableCommand formatTableCommand, CommentUncommentCommand commentUncommentCommand)
 {
     this.goToStepDefinitionCommand = goToStepDefinitionCommand;
     this.debugScenariosCommand     = debugScenariosCommand;
     this.runScenariosCommand       = runScenariosCommand;
     this.formatTableCommand        = formatTableCommand;
     this.commentUncommentCommand   = commentUncommentCommand;
     this.tracer = tracer;
 }
コード例 #2
0
        private void PerformCommand(string commandName, string parameter = null, DeveroomEditorCommandTargetKey?commandTargetKey = null)
        {
            ActionsMock.ResetMock();
            switch (commandName)
            {
            case "Go To Definition":
            {
                var command = new GoToStepDefinitionCommand(_ideScope,
                                                            new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Find Step Definition Usages":
            {
                var command = new FindStepDefinitionCommand(_ideScope,
                                                            new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                Wait.For(() => ActionsMock.IsComplete.Should().BeTrue());
                break;
            }

            case "Comment":
            {
                var command = new CommentCommand(_ideScope,
                                                 new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Uncomment":
            {
                var command = new UncommentCommand(_ideScope,
                                                   new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Auto Format Table":
            {
                var command = new AutoFormatTableCommand(_ideScope,
                                                         new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                _wpfTextView.SimulateType(command, parameter?[0] ?? '|');
                break;
            }

            case "Define Steps":
            {
                var command = new DefineStepsCommand(_ideScope,
                                                     new StubBufferTagAggregatorFactoryService(_ideScope), _ideScope.MonitoringService);
                command.PreExec(_wpfTextView, command.Targets.First());
                break;
            }

            case "Complete":
            case "Filter Completion":
            {
                EnsureStubCompletionBroker();
                var command = new CompleteCommand(_ideScope,
                                                  new StubBufferTagAggregatorFactoryService(_ideScope),
                                                  _completionBroker, _ideScope.MonitoringService);
                if (parameter == null)
                {
                    command.PreExec(_wpfTextView, commandTargetKey ?? command.Targets.First());
                }
                else
                {
                    _wpfTextView.SimulateTypeText(command, parameter);
                }
                break;
            }

            default:
                throw new NotImplementedException(commandName);
            }
        }