Exemplo n.º 1
0
            public Inspector(IGeneralConfigService configService, IEnumerable <IInspection> inspections)
            {
                _inspections = inspections;

                _configService = configService;
                configService.LanguageChanged += ConfigServiceLanguageChanged;
            }
Exemplo n.º 2
0
 public RubberduckHooks(IVBE vbe, IGeneralConfigService config, HotkeyFactory hotkeyFactory, AutoCompleteService autoComplete)
     : base((IntPtr)vbe.MainWindow.HWnd, (IntPtr)vbe.MainWindow.HWnd)
 {
     _config        = config;
     _hotkeyFactory = hotkeyFactory;
     AutoComplete   = autoComplete;
 }
Exemplo n.º 3
0
 public GeneralSettingsControl(DisplayLanguageSetting displayLanguage, IGeneralConfigService configService)
     : this()
 {
     _configService            = configService;
     _currentLanguage          = displayLanguage;
     LanguageList.SelectedItem = displayLanguage;
 }
Exemplo n.º 4
0
        public SettingsForm(IGeneralConfigService configService, SettingsViews activeView = SettingsViews.GeneralSettings) : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(configService,
                config,
                new SettingsView
                {
                    Control = new GeneralSettings(new GeneralSettingsViewModel(config)),
                    View = SettingsViews.GeneralSettings
                },
                new SettingsView
                {
                    Control = new TodoSettings(new TodoSettingsViewModel(config)),
                    View = SettingsViews.TodoSettings
                },
                new SettingsView
                {
                    Control = new InspectionSettings(new InspectionSettingsViewModel(config)),
                    View = SettingsViews.InspectionSettings
                },
                new SettingsView
                {
                    Control = new UnitTestSettings(new UnitTestSettingsViewModel(config)),
                    View = SettingsViews.UnitTestSettings
                },
                new SettingsView
                {
                    Control = new IndenterSettings(new IndenterSettingsViewModel(config)),
                    View = SettingsViews.IndenterSettings
                },
                activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }
Exemplo n.º 5
0
 public AddTestModuleCommand(IVBE vbe, RubberduckParserState state, IGeneralConfigService configLoader)
     : base(LogManager.GetCurrentClassLogger())
 {
     _vbe          = vbe;
     _state        = state;
     _configLoader = configLoader;
 }
Exemplo n.º 6
0
        public SettingsForm(IGeneralConfigService configService, IOperatingSystem operatingSystem, SettingsViews activeView = SettingsViews.GeneralSettings) : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(configService,
                                                     config,
                                                     new SettingsView
            {
                Control = new GeneralSettings(new GeneralSettingsViewModel(config, operatingSystem)),
                View    = SettingsViews.GeneralSettings
            },
                                                     new SettingsView
            {
                Control = new TodoSettings(new TodoSettingsViewModel(config)),
                View    = SettingsViews.TodoSettings
            },
                                                     new SettingsView
            {
                Control = new InspectionSettings(new InspectionSettingsViewModel(config)),
                View    = SettingsViews.InspectionSettings
            },
                                                     new SettingsView
            {
                Control = new UnitTestSettings(new UnitTestSettingsViewModel(config)),
                View    = SettingsViews.UnitTestSettings
            },
                                                     new SettingsView
            {
                Control = new IndenterSettings(new IndenterSettingsViewModel(config)),
                View    = SettingsViews.IndenterSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }
Exemplo n.º 7
0
        public RubberduckMenu(VBE vbe, AddIn addIn, IGeneralConfigService configService, IRubberduckParser parser, IActiveCodePaneEditor editor, IInspector inspector)
            : base(vbe, addIn)
        {
            _addIn = addIn;
            _parser = parser;
            _configService = configService;

            var testExplorer = new TestExplorerWindow();
            var testEngine = new TestEngine();
            var testGridViewSort = new GridViewSort<TestExplorerItem>(RubberduckUI.Result, false);
            var testPresenter = new TestExplorerDockablePresenter(vbe, addIn, testExplorer, testEngine, testGridViewSort);
            _testMenu = new TestMenu(vbe, addIn, testExplorer, testPresenter);

            var codeExplorer = new CodeExplorerWindow();
            var codePresenter = new CodeExplorerDockablePresenter(parser, vbe, addIn, codeExplorer);
            codePresenter.RunAllTests += CodePresenterRunAllAllTests;
            codePresenter.RunInspections += codePresenter_RunInspections;
            codePresenter.Rename += codePresenter_Rename;
            codePresenter.FindAllReferences += codePresenter_FindAllReferences;
            codePresenter.FindAllImplementations += codePresenter_FindAllImplementations;
            _codeExplorerMenu = new CodeExplorerMenu(vbe, addIn, codeExplorer, codePresenter);

            var todoSettings = configService.LoadConfiguration().UserSettings.ToDoListSettings;
            var todoExplorer = new ToDoExplorerWindow();
            var todoGridViewSort = new GridViewSort<ToDoItem>(RubberduckUI.Priority, false);
            var todoPresenter = new ToDoExplorerDockablePresenter(parser, todoSettings.ToDoMarkers, vbe, addIn, todoExplorer, todoGridViewSort);
            _todoItemsMenu = new ToDoItemsMenu(vbe, addIn, todoExplorer, todoPresenter);

            var inspectionExplorer = new CodeInspectionsWindow();
            var inspectionGridViewSort = new GridViewSort<CodeInspectionResultGridViewItem>(RubberduckUI.Component, false);
            var inspectionPresenter = new CodeInspectionsDockablePresenter(inspector, vbe, addIn, inspectionExplorer, inspectionGridViewSort);
            _codeInspectionsMenu = new CodeInspectionsMenu(vbe, addIn, inspectionExplorer, inspectionPresenter);

            _refactorMenu = new RefactorMenu(IDE, AddIn, parser, editor);
        }
        public SettingsControlViewModel(IMessageBox messageBox,
                                        IGeneralConfigService configService,
                                        Configuration config,
                                        SettingsView generalSettings,
                                        SettingsView todoSettings,
                                        SettingsView inspectionSettings,
                                        SettingsView unitTestSettings,
                                        SettingsView indenterSettings,
                                        SettingsView autoCompleteSettings,
                                        SettingsView windowSettings,
                                        SettingsView referenceSettings,
                                        SettingsViews activeView = UI.Settings.SettingsViews.GeneralSettings)
        {
            _messageBox    = messageBox;
            _configService = configService;
            _config        = config;

            SettingsViews = new ObservableCollection <SettingsView>
            {
                generalSettings, todoSettings, inspectionSettings, unitTestSettings, indenterSettings, autoCompleteSettings, windowSettings, referenceSettings
            };

            SelectedSettingsView = SettingsViews.First(v => v.View == activeView);

            OKButtonCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => SaveAndCloseWindow());
            CancelButtonCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => CloseWindow());
            ResetButtonCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ResetSettings());
        }
Exemplo n.º 9
0
            public Inspector(IGeneralConfigService configService, IEnumerable<IInspection> inspections)
            {
                _inspections = inspections;

                _configService = configService;
                configService.LanguageChanged += ConfigServiceLanguageChanged;
            }
Exemplo n.º 10
0
 public ToDoExplorerViewModel(RubberduckParserState state, IGeneralConfigService configService)
 {
     _dispatcher          = Dispatcher.CurrentDispatcher;
     _state               = state;
     _configService       = configService;
     _state.StateChanged += _state_StateChanged;
 }
Exemplo n.º 11
0
        public App(VBE vbe, IMessageBox messageBox,
                   UI.Settings.Settings settings,
                   IRubberduckParser parser,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   RubberduckCommandBar stateBar,
                   IRubberduckHooks hooks)
        {
            _vbe           = vbe;
            _messageBox    = messageBox;
            _settings      = settings;
            _parser        = parser;
            _configService = configService;
            _autoSave      = new AutoSave.AutoSave(_vbe, _configService);
            _appMenus      = appMenus;
            _stateBar      = stateBar;
            _hooks         = hooks;

            _hooks.MessageReceived            += _hooks_MessageReceived;
            _configService.SettingsChanged    += _configService_SettingsChanged;
            _parser.State.StateChanged        += Parser_StateChanged;
            _parser.State.StatusMessageUpdate += State_StatusMessageUpdate;
            _stateBar.Refresh += _stateBar_Refresh;
            UiDispatcher.Initialize();
        }
Exemplo n.º 12
0
            public Inspector(IGeneralConfigService configService, IInspectionProvider inspectionProvider)
            {
                _inspections = inspectionProvider.Inspections.ToList();

                _configService = configService;
                configService.SettingsChanged += ConfigServiceSettingsChanged;
            }
Exemplo n.º 13
0
            public Inspector(IGeneralConfigService configService, IEnumerable <IInspection> inspections)
            {
                _inspections = inspections.ToList();

                _configService = configService;
                configService.SettingsChanged += ConfigServiceSettingsChanged;
            }
Exemplo n.º 14
0
 public ToDoExplorerViewModel(RubberduckParserState state, IGeneralConfigService configService)
 {
     _dispatcher = Dispatcher.CurrentDispatcher;
     _state = state;
     _configService = configService;
     _state.StateChanged += _state_StateChanged;
 }
 public GeneralSettingsControl(DisplayLanguageSetting displayLanguage, IGeneralConfigService configService)
     : this()
 {
     _configService = configService;
     _currentLanguage = displayLanguage;
     LanguageList.SelectedItem = displayLanguage;
 }
Exemplo n.º 16
0
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector, VBE vbe, INavigateCommand navigateCommand, IClipboardWriter clipboard,
                                          IGeneralConfigService configService, IOperatingSystem operatingSystem)
        {
            _state                    = state;
            _inspector                = inspector;
            _vbe                      = vbe;
            _navigateCommand          = navigateCommand;
            _clipboard                = clipboard;
            _configService            = configService;
            _operatingSystem          = operatingSystem;
            _refreshCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), async param => await Task.Run(() => ExecuteRefreshCommandAsync()), CanExecuteRefreshCommand);
            _disableInspectionCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            _quickFixCommand          = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => _state.Status == ParserState.Ready);
            _quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => _state.Status == ParserState.Ready);
            _copyResultsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            _openSettingsCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            _configService.SettingsChanged += _configService_SettingsChanged;

            _setInspectionTypeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByInspectionType = (bool)param;
                GroupByLocation       = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation       = (bool)param;
                GroupByInspectionType = !(bool)param;
            });

            _state.StateChanged += _state_StateChanged;
        }
        public TestExplorerViewModel(ISelectionService selectionService,
                                     TestExplorerModel model,
                                     IClipboardWriter clipboard,
                                     // ReSharper disable once UnusedParameter.Local - left in place because it will likely be needed for app wide font settings, etc.
                                     IGeneralConfigService configService,
                                     ISettingsFormFactory settingsFormFactory)
        {
            _clipboard           = clipboard;
            _settingsFormFactory = settingsFormFactory;

            NavigateCommand         = new NavigateCommand(selectionService);
            RunSingleTestCommand    = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSingleTestCommand, CanExecuteSingleTest);
            RunSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestsCommand, CanExecuteSelectedTestsCommand);
            RunSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunSelectedGroupCommand, CanExecuteSelectedGroupCommand);
            CancelTestRunCommand    = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCancelTestRunCommand, CanExecuteCancelTestRunCommand);
            ResetResultsCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteResetResultsCommand, CanExecuteResetResultsCommand);
            CopyResultsCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand);
            OpenTestSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);
            CollapseAllCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseAll);
            ExpandAllCommand        = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll);

            Model = model;
            Model.TestCompleted += HandleTestCompletion;

            if (CollectionViewSource.GetDefaultView(Model.Tests) is ListCollectionView tests)
            {
                tests.SortDescriptions.Add(new SortDescription("QualifiedName.QualifiedModuleName.Name", ListSortDirection.Ascending));
                tests.SortDescriptions.Add(new SortDescription("QualifiedName.MemberName", ListSortDirection.Ascending));
                Tests = tests;
            }

            OnPropertyChanged(nameof(Tests));
            TestGrouping = TestExplorerGrouping.Outcome;
        }
Exemplo n.º 18
0
        public InspectionResultsViewModel(
            RubberduckParserState state,
            IInspector inspector,
            IQuickFixProvider quickFixProvider,
            INavigateCommand navigateCommand,
            ReparseCommand reparseCommand,
            IClipboardWriter clipboard,
            IGeneralConfigService configService,
            ISettingsFormFactory settingsFormFactory,
            IUiDispatcher uiDispatcher)
        {
            _state               = state;
            _inspector           = inspector;
            _quickFixProvider    = quickFixProvider;
            NavigateCommand      = navigateCommand;
            _clipboard           = clipboard;
            _configService       = configService;
            _settingsFormFactory = settingsFormFactory;
            _uiDispatcher        = uiDispatcher;

            RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                 o =>
            {
                IsRefreshing = true;
                IsBusy       = true;
                reparseCommand.Execute(o);
            },
                                                 o => !IsBusy && reparseCommand.CanExecute(o));

            DisableInspectionCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            QuickFixCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            QuickFixInProcedureCommand   = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProcedureCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInModuleCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInProjectCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInAllProjectsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInAllProjectsCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            CopyResultsCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            OpenInspectionSettings       = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            _configService.SettingsChanged += _configService_SettingsChanged;

            // todo: remove I/O work in constructor
            _runInspectionsOnReparse = _configService.LoadConfiguration().UserSettings.CodeInspectionSettings.RunInspectionsOnSuccessfulParse;

            SetInspectionTypeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByInspectionType = (bool)param;
                GroupByLocation       = !(bool)param;
            });

            SetLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation       = (bool)param;
                GroupByInspectionType = !(bool)param;
            });

            _state.StateChanged += HandleStateChanged;

            BindingOperations.CollectionRegistering += BindingOperations_CollectionRegistering;
        }
Exemplo n.º 19
0
        public AutoCompleteService(IGeneralConfigService configService, IEnumerable <AutoCompleteHandlerBase> handlers)
        {
            _configService = configService;
            _configService.SettingsChanged += ConfigServiceSettingsChanged;

            _handlers = handlers;
            InitializeConfig();
        }
Exemplo n.º 20
0
 public RubberduckHooks(IVBE vbe, IGeneralConfigService config, HotkeyFactory hotkeyFactory,
                        AutoCompleteService autoComplete)
     : this(GetVbeMainWindowPtr(vbe))
 {
     _config        = config;
     _hotkeyFactory = hotkeyFactory;
     AutoComplete   = autoComplete;
 }
Exemplo n.º 21
0
        public AutoSave(VBE vbe, IGeneralConfigService configService)
        {
            _vbe           = vbe;
            _configService = configService;

            _configService.SettingsChanged += ConfigServiceSettingsChanged;
            _timer.Elapsed += _timer_Elapsed;
            _timer.Enabled  = false;
        }
Exemplo n.º 22
0
 public AddTestModuleCommand(IVBE vbe, RubberduckParserState state, IGeneralConfigService configLoader, IMessageBox messageBox, IVBEInteraction interaction)
     : base(LogManager.GetCurrentClassLogger())
 {
     Vbe           = vbe;
     _state        = state;
     _configLoader = configLoader;
     _messageBox   = messageBox;
     _interaction  = interaction;
 }
Exemplo n.º 23
0
        public AutoSave(VBE vbe, IGeneralConfigService configService)
        {
            _vbe           = vbe;
            _configService = configService;

            _configService.SettingsChanged += ConfigServiceSettingsChanged;
            _timer.Elapsed += _timer_Elapsed;

            ConfigServiceSettingsChanged(null, EventArgs.Empty);
        }
Exemplo n.º 24
0
        public SettingsForm(IGeneralConfigService configService, IOperatingSystem operatingSystem, IMessageBox messageBox, IVbeSettings vbeSettings, SettingsViews activeView = SettingsViews.GeneralSettings) : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(messageBox, configService,
                                                     config,
                                                     new SettingsView
            {
                // FIXME inject types marked as ExperimentalFeatures

                /*
                 * These ExperimentalFeatureTypes were originally obtained by directly calling into the IoC container
                 * (since only it knows, which Assemblies have been loaded as Plugins). The code is preserved here for easy access.
                 * RubberduckIoCInstaller.AssembliesToRegister()
                 *     .SelectMany(s => s.DefinedTypes)
                 *     .Where(w => Attribute.IsDefined(w, typeof(ExperimentalAttribute)))
                 */
                Control = new GeneralSettings(new GeneralSettingsViewModel(config, operatingSystem, messageBox, vbeSettings, new List <Type>())),
                View    = SettingsViews.GeneralSettings
            },
                                                     new SettingsView
            {
                Control = new TodoSettings(new TodoSettingsViewModel(config)),
                View    = SettingsViews.TodoSettings
            },
                                                     new SettingsView
            {
                Control = new InspectionSettings(new InspectionSettingsViewModel(config)),
                View    = SettingsViews.InspectionSettings
            },
                                                     new SettingsView
            {
                Control = new UnitTestSettings(new UnitTestSettingsViewModel(config)),
                View    = SettingsViews.UnitTestSettings
            },
                                                     new SettingsView
            {
                Control = new IndenterSettings(new IndenterSettingsViewModel(config)),
                View    = SettingsViews.IndenterSettings
            },
                                                     new SettingsView
            {
                Control = new AutoCompleteSettings(new AutoCompleteSettingsViewModel(config)),
                View    = SettingsViews.AutoCompleteSettings
            },
                                                     new SettingsView
            {
                Control = new WindowSettings(new WindowSettingsViewModel(config)),
                View    = SettingsViews.WindowSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }
Exemplo n.º 25
0
        public Inspector(IRubberduckParser parser, IGeneralConfigService configService)
        {
            _parser = parser;
            _parser.ParseStarted   += _parser_ParseStarted;
            _parser.ParseCompleted += _parser_ParseCompleted;

            _configService = configService;
            _inspections   = configService.GetImplementedCodeInspections();
            configService.SettingsChanged += ConfigServiceSettingsChanged;
            UpdateInspectionSeverity();
        }
Exemplo n.º 26
0
        public SettingsForm(IGeneralConfigService configService,
                            IMessageBox messageBox,
                            ISettingsViewModelFactory viewModelFactory,
                            SettingsViews activeView = SettingsViews.GeneralSettings)
            : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(messageBox, configService,
                                                     config,
                                                     new SettingsView
            {
                Control = new GeneralSettings(viewModelFactory.Create <Rubberduck.Settings.GeneralSettings>(config)),
                View    = SettingsViews.GeneralSettings
            },
                                                     new SettingsView
            {
                Control = new TodoSettings(viewModelFactory.Create <ToDoListSettings>(config)),
                View    = SettingsViews.TodoSettings
            },
                                                     new SettingsView
            {
                Control = new InspectionSettings(viewModelFactory.Create <CodeInspectionSettings>(config)),
                View    = SettingsViews.InspectionSettings
            },
                                                     new SettingsView
            {
                Control = new UnitTestSettings(viewModelFactory.Create <Rubberduck.UnitTesting.Settings.UnitTestSettings>(config)),
                View    = SettingsViews.UnitTestSettings
            },
                                                     new SettingsView
            {
                Control = new IndenterSettings(viewModelFactory.Create <SmartIndenter.IndenterSettings>(config)),
                View    = SettingsViews.IndenterSettings
            },
                                                     new SettingsView
            {
                Control = new AutoCompleteSettings(viewModelFactory.Create <Rubberduck.Settings.AutoCompleteSettings>(config)),
                View    = SettingsViews.AutoCompleteSettings
            },
                                                     new SettingsView
            {
                Control = new WindowSettings(viewModelFactory.Create <Rubberduck.Settings.WindowSettings>(config)),
                View    = SettingsViews.WindowSettings
            },
                                                     new SettingsView
            {
                Control = new AddRemoveReferencesUserSettings(viewModelFactory.Create <ReferenceSettings>()),
                View    = SettingsViews.ReferenceSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }
Exemplo n.º 27
0
        public _SettingsDialog(IGeneralConfigService configService)
            : this()
        {
            _configService          = configService;
            _config                 = _configService.LoadConfiguration();
            _codeInspectionSettings = _config.UserSettings.CodeInspectionSettings.CodeInspections;

            LoadWindow();

            RegisterEvents();
        }
Exemplo n.º 28
0
        public RubberduckHooks(VBE vbe, IGeneralConfigService config, IEnumerable <CommandBase> commands)
        {
            _mainWindowHandle = (IntPtr)vbe.MainWindow.HWnd;
            _oldWndProc       = WindowProc;
            _newWndProc       = WindowProc;
            _oldWndPointer    = User32.SetWindowLong(_mainWindowHandle, (int)WindowLongFlags.GWL_WNDPROC, _newWndProc);
            _oldWndProc       = (User32.WndProc)Marshal.GetDelegateForFunctionPointer(_oldWndPointer, typeof(User32.WndProc));

            _commands = commands;
            _config   = config;
        }
Exemplo n.º 29
0
        public Inspector(IRubberduckParser parser, IGeneralConfigService configService)
        {
            _parser = parser;
            _parser.ParseStarted += _parser_ParseStarted;
            _parser.ParseCompleted += _parser_ParseCompleted;

            _configService = configService;
            _inspections = configService.GetImplementedCodeInspections();
            configService.SettingsChanged += ConfigServiceSettingsChanged;
            UpdateInspectionSeverity();
        }
Exemplo n.º 30
0
        public RubberduckHooks(VBE vbe, IGeneralConfigService config)
        {
            _vbe = vbe;
            _mainWindowHandle = (IntPtr)vbe.MainWindow.HWnd;
            _oldWndProc = WindowProc;
            _newWndProc = WindowProc;
            _oldWndPointer = User32.SetWindowLong(_mainWindowHandle, (int)WindowLongFlags.GWL_WNDPROC, _newWndProc);
            _oldWndProc = (User32.WndProc)Marshal.GetDelegateForFunctionPointer(_oldWndPointer, typeof(User32.WndProc));

            _config = config;

        }
Exemplo n.º 31
0
        public TestExplorerViewModel(IVBE vbe,
                                     RubberduckParserState state,
                                     ITestEngine testEngine,
                                     TestExplorerModel model,
                                     IClipboardWriter clipboard,
                                     IGeneralConfigService configService,
                                     ISettingsFormFactory settingsFormFactory,
                                     IMessageBox messageBox)
        {
            _vbe        = vbe;
            _state      = state;
            _testEngine = testEngine;
            _testEngine.TestCompleted += TestEngineTestCompleted;
            Model                = model;
            _clipboard           = clipboard;
            _settingsFormFactory = settingsFormFactory;
            _messageBox          = messageBox;

            _navigateCommand = new NavigateCommand(_state.ProjectsProvider);

            RunAllTestsCommand = new RunAllTestsCommand(vbe, state, testEngine, model, null);
            RunAllTestsCommand.RunCompleted += RunCompleted;

            AddTestModuleCommand      = new AddTestModuleCommand(vbe, state, configService, _messageBox);
            AddTestMethodCommand      = new AddTestMethodCommand(vbe, state);
            AddErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, state);

            RefreshCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRefreshCommand, CanExecuteRefreshCommand);
            RepeatLastRunCommand        = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
            RunNotExecutedTestsCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
            RunInconclusiveTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunInconclusiveTestsCommand, CanExecuteRunInconclusiveTestsCommand);
            RunFailedTestsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunFailedTestsCommand, CanExecuteRunFailedTestsCommand);
            RunPassedTestsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunPassedTestsCommand, CanExecuteRunPassedTestsCommand);
            RunSelectedTestCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestCommand, CanExecuteSelectedTestCommand);

            CopyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand);

            OpenTestSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            SetOutcomeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByOutcome  = (bool)param;
                GroupByLocation = !(bool)param;
            });

            SetLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation = (bool)param;
                GroupByOutcome  = !(bool)param;
            });
        }
Exemplo n.º 32
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            if (_parser != null && _parser.State != null)
            {
                _parser.State.StateChanged        -= Parser_StateChanged;
                _parser.State.StatusMessageUpdate -= State_StatusMessageUpdate;
                _parser.State.Dispose();
                _parser.Dispose();
                // I won't set this to null because other components may try to release things
            }

            if (_hooks != null)
            {
                _hooks.MessageReceived -= _hooks_MessageReceived;
                _hooks.Dispose();
                _hooks = null;
            }

            if (_settings != null)
            {
                _settings.Dispose();
            }

            if (_configService != null)
            {
                _configService.SettingsChanged -= _configService_SettingsChanged;
                _configService = null;
            }

            if (_stateBar != null)
            {
                _stateBar.Refresh -= _stateBar_Refresh;
                _stateBar.Dispose();
                _stateBar = null;
            }

            if (_autoSave != null)
            {
                _autoSave.Dispose();
                _autoSave = null;
            }

            UiDispatcher.Shutdown();

            _disposed = true;
        }
Exemplo n.º 33
0
        public TestExplorerViewModel(VBE vbe,
                                     RubberduckParserState state,
                                     ITestEngine testEngine,
                                     TestExplorerModel model,
                                     IClipboardWriter clipboard,
                                     NewUnitTestModuleCommand newTestModuleCommand,
                                     NewTestMethodCommand newTestMethodCommand,
                                     IGeneralConfigService configService,
                                     IOperatingSystem operatingSystem)
        {
            _state      = state;
            _testEngine = testEngine;
            _testEngine.TestCompleted += TestEngineTestCompleted;
            _model           = model;
            _clipboard       = clipboard;
            _configService   = configService;
            _operatingSystem = operatingSystem;

            _navigateCommand = new NavigateCommand();

            _runAllTestsCommand = new RunAllTestsCommand(state, testEngine, model);
            _runAllTestsCommand.RunCompleted += RunCompleted;

            _addTestModuleCommand      = new AddTestModuleCommand(vbe, state, newTestModuleCommand);
            _addTestMethodCommand      = new AddTestMethodCommand(vbe, state, newTestMethodCommand);
            _addErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, state, newTestMethodCommand);

            _refreshCommand             = new DelegateCommand(ExecuteRefreshCommand, CanExecuteRefreshCommand);
            _repeatLastRunCommand       = new DelegateCommand(ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
            _runNotExecutedTestsCommand = new DelegateCommand(ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
            _runFailedTestsCommand      = new DelegateCommand(ExecuteRunFailedTestsCommand, CanExecuteRunFailedTestsCommand);
            _runPassedTestsCommand      = new DelegateCommand(ExecuteRunPassedTestsCommand, CanExecuteRunPassedTestsCommand);
            _runSelectedTestCommand     = new DelegateCommand(ExecuteSelectedTestCommand, CanExecuteSelectedTestCommand);

            _copyResultsCommand = new DelegateCommand(ExecuteCopyResultsCommand);

            _openTestSettingsCommand = new DelegateCommand(OpenSettings);

            _setOutcomeGroupingCommand = new DelegateCommand(param =>
            {
                GroupByOutcome  = (bool)param;
                GroupByLocation = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(param =>
            {
                GroupByLocation = (bool)param;
                GroupByOutcome  = !(bool)param;
            });
        }
Exemplo n.º 34
0
        public App(VBE vbe, IMessageBox messageBox,
                   IRubberduckParser parser,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   RubberduckCommandBar stateBar,
                   IRubberduckHooks hooks,
                   SourceControlDockablePresenter sourceControlPresenter)
        {
            _vbe           = vbe;
            _messageBox    = messageBox;
            _parser        = parser;
            _configService = configService;
            _autoSave      = new AutoSave.AutoSave(_vbe, _configService);
            _appMenus      = appMenus;
            _stateBar      = stateBar;
            _hooks         = hooks;
            _logger        = LogManager.GetCurrentClassLogger();

            var sourceControlPanel = (SourceControlPanel)sourceControlPresenter.Window();

            _sourceControlPanelVM = (SourceControlViewViewModel)sourceControlPanel.ViewModel;
            _branchesVM           = (BranchesViewViewModel)_sourceControlPanelVM.TabItems.Single(t => t.ViewModel.Tab == SourceControlTab.Branches).ViewModel;

            _sourceControlPanelVM.OpenRepoStarted   += DisableSinkEventHandlers;
            _sourceControlPanelVM.OpenRepoCompleted += EnableSinkEventHandlersAndUpdateCache;

            _branchesVM.LoadingComponentsStarted   += DisableSinkEventHandlers;
            _branchesVM.LoadingComponentsCompleted += EnableSinkEventHandlersAndUpdateCache;

            _hooks.MessageReceived            += _hooks_MessageReceived;
            _configService.SettingsChanged    += _configService_SettingsChanged;
            _configService.LanguageChanged    += ConfigServiceLanguageChanged;
            _parser.State.StateChanged        += Parser_StateChanged;
            _parser.State.StatusMessageUpdate += State_StatusMessageUpdate;
            _stateBar.Refresh += _stateBar_Refresh;

            _sink = new VBProjectsEventsSink();
            var connectionPointContainer = (IConnectionPointContainer)_vbe.VBProjects;
            var interfaceId = typeof(_dispVBProjectsEvents).GUID;

            connectionPointContainer.FindConnectionPoint(ref interfaceId, out _projectsEventsConnectionPoint);

            _sink.ProjectAdded     += sink_ProjectAdded;
            _sink.ProjectRemoved   += sink_ProjectRemoved;
            _sink.ProjectActivated += sink_ProjectActivated;
            _sink.ProjectRenamed   += sink_ProjectRenamed;

            _projectsEventsConnectionPoint.Advise(_sink, out _projectsEventsCookie);
            UiDispatcher.Initialize();
        }
Exemplo n.º 35
0
        public AutoSave(VBE vbe, IGeneralConfigService configService)
        {
            _vbe = vbe;
            _configService = configService;

            _configService.SettingsChanged += ConfigServiceSettingsChanged;

            // todo: move this out of ctor
            //_timer.Enabled = _config.UserSettings.GeneralSettings.AutoSaveEnabled 
            //    && _config.UserSettings.GeneralSettings.AutoSavePeriod != 0;

            //if (_config.UserSettings.GeneralSettings.AutoSavePeriod != 0)
            //{
            //    _timer.Interval = _config.UserSettings.GeneralSettings.AutoSavePeriod * 1000;
            //    _timer.Elapsed += _timer_Elapsed;
            //}
        }
Exemplo n.º 36
0
        public AutoSave(VBE vbe, IGeneralConfigService configService)
        {
            _vbe           = vbe;
            _configService = configService;

            _configService.SettingsChanged += ConfigServiceSettingsChanged;

            // todo: move this out of ctor
            //_timer.Enabled = _config.UserSettings.GeneralSettings.AutoSaveEnabled
            //    && _config.UserSettings.GeneralSettings.AutoSavePeriod != 0;

            //if (_config.UserSettings.GeneralSettings.AutoSavePeriod != 0)
            //{
            //    _timer.Interval = _config.UserSettings.GeneralSettings.AutoSavePeriod * 1000;
            //    _timer.Elapsed += _timer_Elapsed;
            //}
        }
Exemplo n.º 37
0
        public App(IMessageBox messageBox,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   IRubberduckHooks hooks,
                   IVersionCheck version,
                   CommandBase checkVersionCommand)
        {
            _messageBox          = messageBox;
            _configService       = configService;
            _appMenus            = appMenus;
            _hooks               = hooks;
            _version             = version;
            _checkVersionCommand = checkVersionCommand;

            _configService.SettingsChanged += _configService_SettingsChanged;

            UiContextProvider.Initialize();
        }
Exemplo n.º 38
0
        public ToDoExplorerViewModel(RubberduckParserState state, IGeneralConfigService configService, IOperatingSystem operatingSystem)
        {
            _state               = state;
            _configService       = configService;
            _operatingSystem     = operatingSystem;
            _state.StateChanged += HandleStateChanged;

            _setMarkerGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByMarker   = (bool)param;
                GroupByLocation = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation = (bool)param;
                GroupByMarker   = !(bool)param;
            });
        }
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector, VBE vbe, INavigateCommand navigateCommand, IClipboardWriter clipboard, IGeneralConfigService configService)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;

            _state = state;
            _inspector = inspector;
            _vbe = vbe;
            _navigateCommand = navigateCommand;
            _clipboard = clipboard;
            _configService = configService;
            _refreshCommand = new DelegateCommand(async param => await Task.Run(() => ExecuteRefreshCommandAsync(param)), CanExecuteRefreshCommand);
            _disableInspectionCommand = new DelegateCommand(ExecuteDisableInspectionCommand);
            _quickFixCommand = new DelegateCommand(ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand = new DelegateCommand(ExecuteQuickFixInModuleCommand);
            _quickFixInProjectCommand = new DelegateCommand(ExecuteQuickFixInProjectCommand);
            _copyResultsCommand = new DelegateCommand(ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);

            _state.StateChanged += _state_StateChanged;
        }
        public SettingsControlViewModel(IGeneralConfigService configService,
            Configuration config,
            SettingsView generalSettings,
            SettingsView todoSettings,
            SettingsView inspectionSettings,
            SettingsView unitTestSettings,
            SettingsView indenterSettings,
            SettingsViews activeView = Settings.SettingsViews.GeneralSettings)
        {
            _configService = configService;
            _config = config;

            SettingsViews = new ObservableCollection<SettingsView>
            {
                generalSettings, todoSettings, inspectionSettings, unitTestSettings, indenterSettings
            };

            SelectedSettingsView = SettingsViews.First(v => v.View == activeView);

            _okButtonCommand = new DelegateCommand(_ => SaveAndCloseWindow());
            _cancelButtonCommand = new DelegateCommand(_ => CloseWindow());
            _resetButtonCommand = new DelegateCommand(_ => ResetSettings());
        }
Exemplo n.º 41
0
 public SettingsCommand(IGeneralConfigService service)
 {
     _service = service;
 }
Exemplo n.º 42
0
        public _SettingsDialog(IGeneralConfigService configService)
            : this()
        {
            _configService = configService;
            _config = _configService.LoadConfiguration();
            _codeInspectionSettings = _config.UserSettings.CodeInspectionSettings.CodeInspections;

            LoadWindow();

            RegisterEvents();
        }