Exemple #1
0
        public RInteractiveWorkflow(IConnectionManagerProvider connectionsProvider
                                    , IRHistoryProvider historyProvider
                                    , IRPackageManagerProvider packagesProvider
                                    , IRPlotManagerProvider plotsProvider
                                    , IActiveWpfTextViewTracker activeTextViewTracker
                                    , IDebuggerModeTracker debuggerModeTracker
                                    , ICoreShell coreShell
                                    , IRSettings settings)
        {
            _activeTextViewTracker = activeTextViewTracker;
            _debuggerModeTracker   = debuggerModeTracker;
            _settings = settings;

            Shell     = coreShell;
            Console   = new InteractiveWindowConsole(this);
            RSessions = new RSessionProvider(coreShell.Services, Console);

            RSession    = RSessions.GetOrCreate(SessionNames.InteractiveWindow);
            Connections = connectionsProvider.CreateConnectionManager(this);

            History     = historyProvider.CreateRHistory(this);
            Packages    = packagesProvider.CreateRPackageManager(settings, this);
            Plots       = plotsProvider.CreatePlotManager(settings, this, new FileSystem());
            _operations = new RInteractiveWorkflowOperations(this, _debuggerModeTracker, Shell);

            _activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged;
            RSession.Disconnected += RSessionDisconnected;

            _debuggerModeTracker.EnterBreakMode += DebuggerEnteredBreakMode;
            _debuggerModeTracker.LeaveBreakMode += DebuggerLeftBreakMode;

            _settings.PropertyChanged += OnSettingsChanged;

            _disposableBag = DisposableBag.Create <RInteractiveWorkflow>()
                             .Add(() => _settings.PropertyChanged           -= OnSettingsChanged)
                             .Add(() => _debuggerModeTracker.EnterBreakMode -= DebuggerEnteredBreakMode)
                             .Add(() => _debuggerModeTracker.LeaveBreakMode -= DebuggerLeftBreakMode)
                             .Add(() => _activeTextViewTracker.LastActiveTextViewChanged -= LastActiveTextViewChanged)
                             .Add(() => RSession.Disconnected -= RSessionDisconnected)
                             .Add(RSessions)
                             .Add(Operations)
                             .Add(Connections);
        }
Exemple #2
0
        public RInteractiveWorkflow(IConnectionManagerProvider connectionsProvider
                                    , IRHistoryProvider historyProvider
                                    , IRPackageManagerProvider packagesProvider
                                    , IRPlotManagerProvider plotsProvider
                                    , IActiveWpfTextViewTracker activeTextViewTracker
                                    , IDebuggerModeTracker debuggerModeTracker
                                    , ICoreShell coreShell)
        {
            _settings   = coreShell.GetService <IRSettings>();
            _mainThread = coreShell.MainThread();

            Shell = coreShell;
            var console = new InteractiveWindowConsole(this);

            Console   = console;
            RSessions = new RSessionProvider(coreShell.Services, Console);

            RSession    = RSessions.GetOrCreate(SessionNames.InteractiveWindow);
            Connections = connectionsProvider.CreateConnectionManager(this);

            History     = historyProvider.CreateRHistory(this);
            Packages    = packagesProvider.CreateRPackageManager(_settings, this);
            Plots       = plotsProvider.CreatePlotManager(_settings, this, coreShell.FileSystem());
            _operations = new RInteractiveWorkflowOperations(this, debuggerModeTracker, Shell);

            activeTextViewTracker.LastActiveTextViewChanged += LastActiveTextViewChanged;
            RSession.Disconnected += RSessionDisconnected;

            _settings.PropertyChanged += OnSettingsChanged;

            _disposableBag = DisposableBag.Create <RInteractiveWorkflow>()
                             .Add(() => _settings.PropertyChanged -= OnSettingsChanged)
                             .Add(() => activeTextViewTracker.LastActiveTextViewChanged -= LastActiveTextViewChanged)
                             .Add(() => RSession.Disconnected -= RSessionDisconnected)
                             .Add(RSessions)
                             .Add(Operations)
                             .Add(Connections)
                             .Add(console);
        }
Exemple #3
0
        public static IEnumerable<MenuCommand> GetCommands(ExportProvider exportProvider) {
            var appShell = VsAppShell.Current;
            var interactiveWorkflowProvider = exportProvider.GetExportedValue<IRInteractiveWorkflowProvider>();
            var interactiveWorkflow = interactiveWorkflowProvider.GetOrCreate();
            var projectServiceAccessor = exportProvider.GetExportedValue<IProjectServiceAccessor>();
            var textViewTracker = exportProvider.GetExportedValue<IActiveWpfTextViewTracker>();
            var replTracker = exportProvider.GetExportedValue<IActiveRInteractiveWindowTracker>();
            var debuggerModeTracker = exportProvider.GetExportedValue<IDebuggerModeTracker>();
            var contentTypeRegistryService = exportProvider.GetExportedValue<IContentTypeRegistryService>();
            var pss = exportProvider.GetExportedValue<IProjectSystemServices>();
            var wbs = exportProvider.GetExportedValue<IWebBrowserServices>();
            var pcsp = exportProvider.GetExportedValue<IProjectConfigurationSettingsProvider>();
            var dbcs = exportProvider.GetExportedValue<IDbConnectionService>();
            var settings = exportProvider.GetExportedValue<IRToolsSettings>();
            var logPerms = appShell.Services.LoggingServices.Permissions;
            var console = new InteractiveWindowConsole(interactiveWorkflow);

            return new List<MenuCommand> {
                new GoToOptionsCommand(),
                new GoToEditorOptionsCommand(),
                new ImportRSettingsCommand(),
                new InstallRClientCommand(appShell),
                new SwitchToRClientCommand(interactiveWorkflow.Connections, appShell, settings),
                new SurveyNewsCommand(appShell),
                new SetupRemoteCommand(),

                new ReportIssueCommand(appShell.Services),
                new SendSmileCommand(appShell.Services),
                new SendFrownCommand(appShell.Services),

                CreateRCmdSetCommand(RPackageCommandId.icmdRDocsIntroToR, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.CranIntro, LocalDocumentationPaths.CranIntro)),
                CreateRCmdSetCommand(RPackageCommandId.icmdRDocsDataImportExport, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.CranData, LocalDocumentationPaths.CranData)),
                CreateRCmdSetCommand(RPackageCommandId.icmdRDocsWritingRExtensions, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.CranExtensions, LocalDocumentationPaths.CranExtensions)),
                CreateRCmdSetCommand(RPackageCommandId.icmdRDocsTaskViews, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.CranViews)),
                CreateRCmdSetCommand(RPackageCommandId.icmdRtvsDocumentation, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.RtvsDocumentation)),
                CreateRCmdSetCommand(RPackageCommandId.icmdRtvsSamples, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.RtvsSamples)),
                CreateRCmdSetCommand(RPackageCommandId.icmdCheckForUpdates, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.CheckForRtvsUpdates)),
                CreateRCmdSetCommand(RPackageCommandId.icmdMicrosoftRProducts, new OpenDocumentationCommand(interactiveWorkflow, OnlineDocumentationUrls.MicrosoftRProducts)),

                new LoadWorkspaceCommand(appShell, interactiveWorkflow, projectServiceAccessor),
                new SaveWorkspaceCommand(appShell, interactiveWorkflow, projectServiceAccessor),

                new AttachDebuggerCommand(interactiveWorkflow),
                new AttachToRInteractiveCommand(interactiveWorkflow),
                new StopDebuggingCommand(interactiveWorkflow),
                new ContinueDebuggingCommand(interactiveWorkflow),
                new StepOverCommand(interactiveWorkflow),
                new StepOutCommand(interactiveWorkflow),
                new StepIntoCommand(interactiveWorkflow),

                CreateRCmdSetCommand(RPackageCommandId.icmdSourceRScript, new SourceRScriptCommand(interactiveWorkflow, textViewTracker, false)),
                CreateRCmdSetCommand(RPackageCommandId.icmdSourceRScriptWithEcho, new SourceRScriptCommand(interactiveWorkflow, textViewTracker, true)),

                new RunShinyAppCommand(interactiveWorkflow),
                new StopShinyAppCommand(interactiveWorkflow),

                CreateRCmdSetCommand(RPackageCommandId.icmdInterruptR, new InterruptRCommand(interactiveWorkflow, debuggerModeTracker)),
                CreateRCmdSetCommand(RPackageCommandId.icmdTerminateR, new TerminateRCommand(interactiveWorkflow, appShell)),
                CreateRCmdSetCommand(RPackageCommandId.icmdSessionInformation, new SessionInformationCommand(interactiveWorkflow, console)),
                CreateRCmdSetCommand(RPackageCommandId.icmdDeleteProfile, new DeleteProfileCommand(interactiveWorkflow)),

                new ResetReplCommand(interactiveWorkflow),
                
                // Directory management
                new SetDirectoryToSourceCommand(interactiveWorkflow, textViewTracker),
                new SetDirectoryToProjectCommand(interactiveWorkflow, pss),
                new SelectWorkingDirectoryCommand(interactiveWorkflow),

                new ImportDataSetTextFileCommand(appShell, interactiveWorkflow.RSession),
                new ImportDataSetUrlCommand(interactiveWorkflow.RSession),
                new DeleteAllVariablesCommand(interactiveWorkflow.RSession),
                new AddDbConnectionCommand(dbcs, pss, pcsp, interactiveWorkflow),
                new AddDsnCommand(appShell, interactiveWorkflow),
                new ManageDsnCommand(appShell, interactiveWorkflow),

                // Window commands
                new ShowRInteractiveWindowsCommand(interactiveWorkflowProvider),
                new ShowVariableWindowCommand(),

                new ShowToolWindowCommand<HelpWindowPane>(RPackageCommandId.icmdShowHelpWindow),
                new ShowToolWindowCommand<HistoryWindowPane>(RPackageCommandId.icmdShowHistoryWindow),
                new ShowToolWindowCommand<ConnectionManagerWindowPane>(RPackageCommandId.icmdShowConnectionsWindow),
                new ShowToolWindowCommand<PackageManagerWindowPane>(RPackageCommandId.icmdShowPackagesWindow),
                new ShowToolWindowCommand<PlotHistoryWindowPane>(RPackageCommandId.icmdPlotHistoryWindow),

                new ShowHelpOnCurrentCommand(interactiveWorkflow, textViewTracker, replTracker),
                new SearchWebForCurrentCommand(interactiveWorkflow, textViewTracker, replTracker, wbs),
                new GotoEditorWindowCommand(textViewTracker, contentTypeRegistryService),
                new GotoSolutionExplorerCommand(),

                // Plot commands
                CreateRCmdSetCommand(RPackageCommandId.icmdNewPlotWindow, new PlotDeviceNewCommand(interactiveWorkflow)),
                CreateRCmdSetCommand(RPackageCommandId.icmdShowPlotWindow, new ShowMainPlotWindowCommand(interactiveWorkflow)),
                CreateRCmdSetCommand(RPackageCommandId.icmdPlotWindowsDynamicStart, new ShowPlotWindowCommand(appShell, interactiveWorkflow)),
                new HideAllPlotWindowsCommand(appShell),

                // Connection manager commands
                CreateRCmdSetCommand(RPackageCommandId.icmdReconnect, new ReconnectCommand(interactiveWorkflow)),
                CreateRCmdSetCommand(RPackageCommandId.icmdMruConnectionsDynamicStart, new SwitchToConnectionCommand(interactiveWorkflow))
            };
        }