Search in sources :

Example 1 with FileChangeEvent

use of org.rstudio.studio.client.workbench.views.files.events.FileChangeEvent in project rstudio by rstudio.

the class ClientEventDispatcher method dispatchEvent.

private void dispatchEvent(ClientEvent event) {
    String type = event.getType();
    try {
        if (type.equals(ClientEvent.Busy)) {
            boolean busy = event.<Bool>getData().getValue();
            eventBus_.fireEvent(new BusyEvent(busy));
        } else if (type.equals(ClientEvent.ConsoleOutput)) {
            ConsoleText output = event.getData();
            eventBus_.fireEvent(new ConsoleWriteOutputEvent(output));
        } else if (type.equals(ClientEvent.ConsoleError)) {
            ConsoleText error = event.getData();
            eventBus_.fireEvent(new ConsoleWriteErrorEvent(error));
        } else if (type.equals(ClientEvent.ConsoleWritePrompt)) {
            String prompt = event.getData();
            eventBus_.fireEvent(new ConsoleWritePromptEvent(prompt));
        } else if (type.equals(ClientEvent.ConsoleWriteInput)) {
            ConsoleText input = event.getData();
            eventBus_.fireEvent(new ConsoleWriteInputEvent(input));
        } else if (type.equals(ClientEvent.ConsolePrompt)) {
            ConsolePrompt prompt = event.getData();
            eventBus_.fireEvent(new ConsolePromptEvent(prompt));
        } else if (type.equals(ClientEvent.ShowEditor)) {
            ShowEditorData data = event.getData();
            eventBus_.fireEvent(new ShowEditorEvent(data));
        } else if (type.equals(ClientEvent.FileChanged)) {
            FileChange fileChange = event.getData();
            eventBus_.fireEvent(new FileChangeEvent(fileChange));
        } else if (type.equals(ClientEvent.WorkingDirChanged)) {
            String path = event.getData();
            eventBus_.fireEvent(new WorkingDirChangedEvent(path));
        } else if (type.equals(ClientEvent.ShowHelp)) {
            String helpUrl = event.getData();
            eventBus_.fireEvent(new ShowHelpEvent(helpUrl));
        } else if (type.equals(ClientEvent.ShowErrorMessage)) {
            ErrorMessage errorMessage = event.getData();
            eventBus_.fireEvent(new ShowErrorMessageEvent(errorMessage));
        } else if (type.equals(ClientEvent.ChooseFile)) {
            boolean newFile = event.<Bool>getData().getValue();
            eventBus_.fireEvent(new ChooseFileEvent(newFile));
        } else if (type.equals(ClientEvent.BrowseUrl)) {
            BrowseUrlInfo urlInfo = event.getData();
            eventBus_.fireEvent(new BrowseUrlEvent(urlInfo));
        } else if (type.equals(ClientEvent.PlotsStateChanged)) {
            PlotsState plotsState = event.getData();
            eventBus_.fireEvent(new PlotsChangedEvent(plotsState));
        } else if (type.equals(ClientEvent.ViewData)) {
            DataView dataView = event.getData();
            eventBus_.fireEvent(new ViewDataEvent(dataView));
        } else if (type.equals(ClientEvent.PackageStateChanged)) {
            PackageState newState = event.getData();
            eventBus_.fireEvent(new PackageStateChangedEvent(newState));
        } else if (type.equals(ClientEvent.PackageStatusChanged)) {
            PackageStatus status = event.getData();
            eventBus_.fireEvent(new PackageStatusChangedEvent(status));
        } else if (type.equals(ClientEvent.Locator)) {
            eventBus_.fireEvent(new LocatorEvent());
        } else if (type.equals(ClientEvent.ConsoleResetHistory)) {
            ConsoleResetHistory reset = event.getData();
            eventBus_.fireEvent(new ConsoleResetHistoryEvent(reset));
        } else if (type.equals(ClientEvent.SessionSerialization)) {
            SessionSerializationAction action = event.getData();
            eventBus_.fireEvent(new SessionSerializationEvent(action));
        } else if (type.equals(ClientEvent.HistoryEntriesAdded)) {
            RpcObjectList<HistoryEntry> entries = event.getData();
            eventBus_.fireEvent(new HistoryEntriesAddedEvent(entries));
        } else if (type.equals(ClientEvent.QuotaStatus)) {
            QuotaStatus quotaStatus = event.getData();
            eventBus_.fireEvent(new QuotaStatusEvent(quotaStatus));
        } else if (type.equals(ClientEvent.FileEdit)) {
            FileSystemItem file = event.getData();
            eventBus_.fireEvent(new FileEditEvent(file));
        } else if (type.equals(ClientEvent.ShowContent)) {
            ContentItem content = event.getData();
            eventBus_.fireEvent(new ShowContentEvent(content));
        } else if (type.equals(ClientEvent.ShowData)) {
            DataItem data = event.getData();
            eventBus_.fireEvent(new ShowDataEvent(data));
        } else if (type.equals(ClientEvent.AbendWarning)) {
            eventBus_.fireEvent(new SessionAbendWarningEvent());
        } else if (type.equals(ClientEvent.ShowWarningBar)) {
            WarningBarMessage message = event.getData();
            eventBus_.fireEvent(new ShowWarningBarEvent(message));
        } else if (type.equals(ClientEvent.OpenProjectError)) {
            OpenProjectError error = event.getData();
            eventBus_.fireEvent(new OpenProjectErrorEvent(error));
        } else if (type.equals(ClientEvent.VcsRefresh)) {
            JsObject data = event.getData();
            eventBus_.fireEvent(new VcsRefreshEvent(Reason.NA, data.getInteger("delay")));
        } else if (type.equals(ClientEvent.AskPass)) {
            AskPassEvent.Data data = event.getData();
            eventBus_.fireEvent(new AskPassEvent(data));
        } else if (type.equals(ClientEvent.ConsoleProcessOutput)) {
            ServerConsoleOutputEvent.Data data = event.getData();
            eventBus_.fireEvent(new ServerConsoleOutputEvent(data.getHandle(), data.getOutput(), data.isError()));
        } else if (type.equals(ClientEvent.ConsoleProcessPrompt)) {
            ServerConsolePromptEvent.Data data = event.getData();
            eventBus_.fireEvent(new ServerConsolePromptEvent(data.getHandle(), data.getPrompt()));
        } else if (type.equals(ClientEvent.ConsoleProcessCreated)) {
            ConsoleProcessCreatedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ConsoleProcessCreatedEvent(data));
        } else if (type.equals(ClientEvent.ConsoleProcessExit)) {
            ServerProcessExitEvent.Data data = event.getData();
            eventBus_.fireEvent(new ServerProcessExitEvent(data.getHandle(), data.getExitCode()));
        } else if (type.equals(ClientEvent.HTMLPreviewStartedEvent)) {
            HTMLPreviewStartedEvent.Data data = event.getData();
            eventBus_.fireEvent(new HTMLPreviewStartedEvent(data));
        } else if (type.equals(ClientEvent.HTMLPreviewOutputEvent)) {
            String output = event.getData();
            eventBus_.fireEvent(new HTMLPreviewOutputEvent(output));
        } else if (type.equals(ClientEvent.HTMLPreviewCompletedEvent)) {
            HTMLPreviewResult result = event.getData();
            eventBus_.fireEvent(new HTMLPreviewCompletedEvent(result));
        } else if (type.equals(ClientEvent.CompilePdfStartedEvent)) {
            CompilePdfStartedEvent.Data data = event.getData();
            eventBus_.fireEvent(new CompilePdfStartedEvent(data));
        } else if (type.equals(ClientEvent.CompilePdfOutputEvent)) {
            CompileOutput output = event.getData();
            eventBus_.fireEvent(new CompilePdfOutputEvent(output));
        } else if (type.equals(ClientEvent.CompilePdfErrorsEvent)) {
            JsArray<SourceMarker> data = event.getData();
            eventBus_.fireEvent(new CompilePdfErrorsEvent(data));
        } else if (type.equals(ClientEvent.CompilePdfCompletedEvent)) {
            CompilePdfResult result = event.getData();
            eventBus_.fireEvent(new CompilePdfCompletedEvent(result));
        } else if (type.equals(ClientEvent.SynctexEditFile)) {
            SourceLocation sourceLocation = event.getData();
            eventBus_.fireEvent(new SynctexEditFileEvent(sourceLocation));
        } else if (type.equals(ClientEvent.FindResult)) {
            FindResultEvent.Data data = event.getData();
            eventBus_.fireEvent(new FindResultEvent(data.getHandle(), data.getResults().toArrayList()));
        } else if (type.equals(ClientEvent.FindOperationEnded)) {
            String data = event.getData();
            eventBus_.fireEvent(new FindOperationEndedEvent(data));
        } else if (type.equals(ClientEvent.RPubsUploadStatus)) {
            RPubsUploadStatusEvent.Status status = event.getData();
            eventBus_.fireEvent(new RPubsUploadStatusEvent(status));
        } else if (type.equals(ClientEvent.BuildStarted)) {
            eventBus_.fireEvent(new BuildStartedEvent());
        } else if (type.equals(ClientEvent.BuildOutput)) {
            CompileOutput data = event.getData();
            eventBus_.fireEvent(new BuildOutputEvent(data));
        } else if (type.equals(ClientEvent.BuildCompleted)) {
            BuildCompletedEvent.Data data = event.getData();
            eventBus_.fireEvent(new BuildCompletedEvent(data));
        } else if (type.equals(ClientEvent.BuildErrors)) {
            BuildErrorsEvent.Data data = event.getData();
            eventBus_.fireEvent(new BuildErrorsEvent(data));
        } else if (type.equals(ClientEvent.DirectoryNavigate)) {
            DirectoryNavigateEvent.Data data = event.getData();
            eventBus_.fireEvent(new DirectoryNavigateEvent(data));
        } else if (type.equals(ClientEvent.DeferredInitCompleted)) {
            eventBus_.fireEvent(new DeferredInitCompletedEvent());
        } else if (type.equals(ClientEvent.PlotsZoomSizeChanged)) {
            PlotsZoomSizeChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new PlotsZoomSizeChangedEvent(data));
        } else if (type.equals(ClientEvent.SourceCppStarted)) {
            eventBus_.fireEvent(new SourceCppStartedEvent());
        } else if (type.equals(ClientEvent.SourceCppCompleted)) {
            SourceCppState state = event.getData();
            eventBus_.fireEvent(new SourceCppCompletedEvent(state));
        } else if (type.equals(ClientEvent.LoadedPackageUpdates)) {
            String installCmd = event.getData();
            eventBus_.fireEvent(new LoadedPackageUpdatesEvent(installCmd));
        } else if (type.equals(ClientEvent.ActivatePane)) {
            String pane = event.getData();
            eventBus_.fireEvent(new ActivatePaneEvent(pane));
        } else if (type.equals(ClientEvent.ShowPresentationPane)) {
            PresentationState state = event.getData();
            eventBus_.fireEvent(new ShowPresentationPaneEvent(state));
        } else if (type.equals(ClientEvent.EnvironmentRefresh)) {
            eventBus_.fireEvent(new EnvironmentRefreshEvent());
        } else if (type.equals(ClientEvent.ListChanged)) {
            eventBus_.fireEvent(new ListChangedEvent(event.<JsObject>getData()));
        } else if (type.equals(ClientEvent.UiPrefsChanged)) {
            UiPrefsChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new UiPrefsChangedEvent(data));
        } else if (type.equals(ClientEvent.ContextDepthChanged)) {
            EnvironmentContextData data = event.getData();
            eventBus_.fireEvent(new ContextDepthChangedEvent(data, true));
        } else if (type.equals(ClientEvent.HandleUnsavedChanges)) {
            eventBus_.fireEvent(new HandleUnsavedChangesEvent());
        } else if (type.equals(ClientEvent.Quit)) {
            QuitEvent.Data data = event.getData();
            eventBus_.fireEvent(new QuitEvent(data));
        } else if (type.equals(ClientEvent.Suicide)) {
            // NOTE: we don't explicitly stop listening for events here
            // for the reasons cited above in ClientEvent.Quit
            // fire event
            String message = event.getData();
            eventBus_.fireEvent(new SuicideEvent(message));
        } else if (type.equals(ClientEvent.SaveActionChanged)) {
            SaveAction action = event.getData();
            eventBus_.fireEvent(new SaveActionChangedEvent(action));
        } else if (type.equals(ClientEvent.EnvironmentAssigned)) {
            RObject objectInfo = event.getData();
            eventBus_.fireEvent(new EnvironmentObjectAssignedEvent(objectInfo));
        } else if (type.equals(ClientEvent.EnvironmentRemoved)) {
            String objectName = event.getData();
            eventBus_.fireEvent(new EnvironmentObjectRemovedEvent(objectName));
        } else if (type.equals(ClientEvent.BrowserLineChanged)) {
            LineData lineData = event.getData();
            eventBus_.fireEvent(new BrowserLineChangedEvent(lineData));
        } else if (type.equals(ClientEvent.PackageLoaded)) {
            eventBus_.fireEvent(new PackageLoadedEvent((String) event.getData()));
        } else if (type.equals(ClientEvent.PackageUnloaded)) {
            eventBus_.fireEvent(new PackageUnloadedEvent((String) event.getData()));
        } else if (type.equals(ClientEvent.PresentationPaneRequestCompleted)) {
            eventBus_.fireEvent(new PresentationPaneRequestCompletedEvent());
        } else if (type.equals(ClientEvent.UnhandledError)) {
            UnhandledError err = event.getData();
            eventBus_.fireEvent(new UnhandledErrorEvent(err));
        } else if (type.equals(ClientEvent.ErrorHandlerChanged)) {
            ErrorHandlerType handlerType = event.getData();
            eventBus_.fireEvent(new ErrorHandlerChangedEvent(handlerType));
        } else if (type.equals(ClientEvent.ViewerNavigate)) {
            ViewerNavigateEvent.Data data = event.getData();
            eventBus_.fireEvent(new ViewerNavigateEvent(data));
        } else if (type.equals(ClientEvent.SourceExtendedTypeDetected)) {
            SourceExtendedTypeDetectedEvent.Data data = event.getData();
            eventBus_.fireEvent(new SourceExtendedTypeDetectedEvent(data));
        } else if (type.equals(ClientEvent.ShinyViewer)) {
            ShinyApplicationParams data = event.getData();
            eventBus_.fireEvent(new ShinyApplicationStatusEvent(data, true));
        } else if (type.equals(ClientEvent.DebugSourceCompleted)) {
            DebugSourceResult result = (DebugSourceResult) event.getData();
            eventBus_.fireEvent(new DebugSourceCompletedEvent(result));
        } else if (type.equals(ClientEvent.RmdRenderStarted)) {
            RmdRenderStartedEvent.Data data = event.getData();
            eventBus_.fireEvent(new RmdRenderStartedEvent(data));
        } else if (type.equals(ClientEvent.RmdRenderOutput)) {
            CompileOutput data = event.getData();
            eventBus_.fireEvent(new RmdRenderOutputEvent(data));
        } else if (type.equals(ClientEvent.RmdRenderCompleted)) {
            RmdRenderResult result = event.getData();
            eventBus_.fireEvent(new RmdRenderCompletedEvent(result));
        } else if (type.equals(ClientEvent.RmdShinyDocStarted)) {
            RmdShinyDocInfo docInfo = event.getData();
            eventBus_.fireEvent(new RmdShinyDocStartedEvent(docInfo));
        } else if (type.equals(ClientEvent.RSConnectDeploymentOutput)) {
            CompileOutput output = event.getData();
            eventBus_.fireEvent(new RSConnectDeploymentOutputEvent(output));
        } else if (type.equals(ClientEvent.RSConnectDeploymentCompleted)) {
            String url = event.getData();
            eventBus_.fireEvent(new RSConnectDeploymentCompletedEvent(url));
        } else if (type.equals(ClientEvent.RSConnectDeploymentFailed)) {
            RSConnectDeploymentFailedEvent.Data data = event.getData();
            eventBus_.fireEvent(new RSConnectDeploymentFailedEvent(data));
        } else if (type.equals(ClientEvent.UserPrompt)) {
            UserPrompt prompt = event.getData();
            eventBus_.fireEvent(new UserPromptEvent(prompt));
        } else if (type.equals(ClientEvent.InstallRtools)) {
            InstallRtoolsEvent.Data data = event.getData();
            eventBus_.fireEvent(new InstallRtoolsEvent(data));
        } else if (type.equals(ClientEvent.InstallShiny)) {
            String userAction = event.getData();
            eventBus_.fireEvent(new InstallShinyEvent(userAction));
        } else if (type.equals(ClientEvent.SuspendAndRestart)) {
            SuspendAndRestartEvent.Data data = event.getData();
            eventBus_.fireEvent(new SuspendAndRestartEvent(data));
        } else if (type.equals(ClientEvent.DataViewChanged)) {
            DataViewChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new DataViewChangedEvent(data));
        } else if (type.equals(ClientEvent.ViewFunction)) {
            SearchPathFunctionDefinition data = event.getData();
            eventBus_.fireEvent(new CodeBrowserNavigationEvent(data, null, false, true));
        } else if (type.equals(ClientEvent.MarkersChanged)) {
            MarkersChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new MarkersChangedEvent(data));
        } else if (type.equals(ClientEvent.EnableRStudioConnect)) {
            EnableRStudioConnectUIEvent.Data data = event.getData();
            eventBus_.fireEvent(new EnableRStudioConnectUIEvent(data));
        } else if (type.equals(ClientEvent.UpdateGutterMarkers)) {
            LintEvent.Data data = event.getData();
            eventBus_.fireEvent(new LintEvent(data));
        } else if (type.equals(ClientEvent.SnippetsChanged)) {
            SnippetsChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new SnippetsChangedEvent(data));
        } else if (type.equals(ClientEvent.JumpToFunction)) {
            JumpToFunctionEvent.Data data = event.getData();
            eventBus_.fireEvent(new JumpToFunctionEvent(data));
        } else if (type.equals(ClientEvent.CollabEditStarted)) {
            CollabEditStartParams params = event.getData();
            eventBus_.fireEvent(new CollabEditStartedEvent(params));
        } else if (type.equals(ClientEvent.SessionCountChanged)) {
            SessionCountChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new SessionCountChangedEvent(data));
        } else if (type.equals(ClientEvent.CollabEditEnded)) {
            CollabEditEndedEvent.Data data = event.getData();
            eventBus_.fireEvent(new CollabEditEndedEvent(data));
        } else if (type.equals(ClientEvent.ProjectUsersChanged)) {
            ProjectUserChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ProjectUserChangedEvent(data));
        } else if (type.equals(ClientEvent.RVersionsChanged)) {
            RVersionsInfo versions = event.getData();
            eventBus_.fireEvent(new RVersionsChangedEvent(versions));
        } else if (type.equals(ClientEvent.ShinyGadgetDialog)) {
            ShinyGadgetDialogEvent.Data data = event.getData();
            eventBus_.fireEvent(new ShinyGadgetDialogEvent(data));
        } else if (type.equals(ClientEvent.RmdParamsReady)) {
            String paramsFile = event.getData();
            eventBus_.fireEvent(new RmdParamsReadyEvent(paramsFile));
        } else if (type.equals(ClientEvent.RegisterUserCommand)) {
            RegisterUserCommandEvent.Data data = event.getData();
            eventBus_.fireEvent(new RegisterUserCommandEvent(data));
        } else if (type.equals(ClientEvent.SendToConsole)) {
            SendToConsoleEvent.Data data = event.getData();
            eventBus_.fireEvent(new SendToConsoleEvent(data));
        } else if (type.equals(ClientEvent.UserFollowStarted)) {
            ProjectUser user = event.getData();
            eventBus_.fireEvent(new FollowUserEvent(user, true));
        } else if (type.equals(ClientEvent.UserFollowEnded)) {
            ProjectUser user = event.getData();
            eventBus_.fireEvent(new FollowUserEvent(user, false));
        } else if (type.equals(ClientEvent.ProjectAccessRevoked)) {
            eventBus_.fireEvent(new ProjectAccessRevokedEvent());
        } else if (type.equals(ClientEvent.CollabEditSaved)) {
            CollabEditSavedEvent.Data data = event.getData();
            eventBus_.fireEvent(new CollabEditSavedEvent(data));
        } else if (type.equals(ClientEvent.AddinRegistryUpdated)) {
            RAddins data = event.getData();
            eventBus_.fireEvent(new AddinRegistryUpdatedEvent(data));
        } else if (type.equals(ClientEvent.ChunkOutput)) {
            RmdChunkOutput data = event.getData();
            eventBus_.fireEvent(new RmdChunkOutputEvent(data));
        } else if (type.equals(ClientEvent.ChunkOutputFinished)) {
            RmdChunkOutputFinishedEvent.Data data = event.getData();
            eventBus_.fireEvent(new RmdChunkOutputFinishedEvent(data));
        } else if (type.equals(ClientEvent.RprofStarted)) {
            eventBus_.fireEvent(new RprofEvent(RprofEvent.RprofEventType.START, null));
        } else if (type.equals(ClientEvent.RprofStopped)) {
            eventBus_.fireEvent(new RprofEvent(RprofEvent.RprofEventType.STOP, null));
        } else if (type.equals(ClientEvent.RprofCreated)) {
            RprofEvent.Data data = event.getData();
            eventBus_.fireEvent(new RprofEvent(RprofEvent.RprofEventType.CREATE, data));
        } else if (type.equals(ClientEvent.EditorCommand)) {
            EditorCommandEvent.Data data = event.getData();
            EditorCommandEvent payload = new EditorCommandEvent(data);
            eventBus_.fireEvent(new EditorCommandDispatchEvent(payload));
        } else if (type.equals(ClientEvent.PreviewRmd)) {
            PreviewRmdEvent.Data data = event.getData();
            eventBus_.fireEvent(new PreviewRmdEvent(data));
        } else if (type.equals(ClientEvent.WebsiteFileSaved)) {
            FileSystemItem fsi = event.getData();
            eventBus_.fireEvent(new WebsiteFileSavedEvent(fsi));
        } else if (type.equals(ClientEvent.ChunkPlotRefreshed)) {
            ChunkPlotRefreshedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ChunkPlotRefreshedEvent(data));
        } else if (type.equals(ClientEvent.ChunkPlotRefreshFinished)) {
            ChunkPlotRefreshFinishedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ChunkPlotRefreshFinishedEvent(data));
        } else if (type.equals(ClientEvent.ReloadWithLastChanceSave)) {
            eventBus_.fireEvent(new ReloadWithLastChanceSaveEvent());
        } else if (type.equals(ClientEvent.ConnectionUpdated)) {
            ConnectionUpdatedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ConnectionUpdatedEvent(data));
        } else if (type.equals(ClientEvent.EnableConnections)) {
            eventBus_.fireEvent(new EnableConnectionsEvent());
        } else if (type.equals(ClientEvent.ConnectionListChanged)) {
            JsArray<Connection> connections = event.getData();
            eventBus_.fireEvent(new ConnectionListChangedEvent(connections));
        } else if (type.equals(ClientEvent.ActiveConnectionsChanged)) {
            JsArray<ConnectionId> connections = event.getData();
            eventBus_.fireEvent(new ActiveConnectionsChangedEvent(connections));
        } else if (type.equals(ClientEvent.ConnectionOpened)) {
            Connection connection = event.getData();
            eventBus_.fireEvent(new ConnectionOpenedEvent(connection));
        } else if (type.equals(ClientEvent.NotebookRangeExecuted)) {
            NotebookRangeExecutedEvent.Data data = event.getData();
            eventBus_.fireEvent(new NotebookRangeExecutedEvent(data));
        } else if (type.equals(ClientEvent.ChunkExecStateChanged)) {
            ChunkExecStateChangedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ChunkExecStateChangedEvent(data));
        } else if (type.equals(ClientEvent.NavigateShinyFrame)) {
            ShinyFrameNavigatedEvent.Data data = event.getData();
            eventBus_.fireEvent(new ShinyFrameNavigatedEvent(data));
        } else if (type.equals(ClientEvent.UpdateNewConnectionDialog)) {
            NewConnectionDialogUpdatedEvent.Data data = event.getData();
            eventBus_.fireEvent(new NewConnectionDialogUpdatedEvent(data));
        } else if (type.equals(ClientEvent.ProjectTemplateRegistryUpdated)) {
            ProjectTemplateRegistry data = event.getData();
            eventBus_.fireEvent(new ProjectTemplateRegistryUpdatedEvent(data));
        } else if (type.equals(ClientEvent.TerminalSubProcs)) {
            TerminalSubprocEvent.Data data = event.getData();
            eventBus_.fireEvent(new TerminalSubprocEvent(data));
        } else if (type.equals(ClientEvent.PackageExtensionIndexingCompleted)) {
            PackageProvidedExtensions.Data data = event.getData();
            eventBus_.fireEvent(new PackageExtensionIndexingCompletedEvent(data));
        } else if (type.equals(ClientEvent.RStudioAPIShowDialog)) {
            RStudioAPIShowDialogEvent.Data data = event.getData();
            eventBus_.fireEvent(new RStudioAPIShowDialogEvent(data));
        } else {
            GWT.log("WARNING: Server event not dispatched: " + type, null);
        }
    } catch (Throwable e) {
        GWT.log("WARNING: Exception occured dispatching event: " + type, e);
    }
}
Also used : EnableRStudioConnectUIEvent(org.rstudio.studio.client.rsconnect.events.EnableRStudioConnectUIEvent) AddinRegistryUpdatedEvent(org.rstudio.studio.client.workbench.addins.events.AddinRegistryUpdatedEvent) ConsoleText(org.rstudio.studio.client.workbench.views.console.model.ConsoleText) RmdShinyDocInfo(org.rstudio.studio.client.rmarkdown.model.RmdShinyDocInfo) RObject(org.rstudio.studio.client.workbench.views.environment.model.RObject) VcsRefreshEvent(org.rstudio.studio.client.workbench.views.vcs.common.events.VcsRefreshEvent) PreviewRmdEvent(org.rstudio.studio.client.rmarkdown.events.PreviewRmdEvent) HTMLPreviewStartedEvent(org.rstudio.studio.client.htmlpreview.events.HTMLPreviewStartedEvent) FindOperationEndedEvent(org.rstudio.studio.client.workbench.views.output.find.events.FindOperationEndedEvent) ServerProcessExitEvent(org.rstudio.studio.client.common.console.ServerProcessExitEvent) RSConnectDeploymentCompletedEvent(org.rstudio.studio.client.rsconnect.events.RSConnectDeploymentCompletedEvent) NewConnectionDialogUpdatedEvent(org.rstudio.studio.client.workbench.views.connections.events.NewConnectionDialogUpdatedEvent) ShowContentEvent(org.rstudio.studio.client.workbench.views.source.events.ShowContentEvent) PlotsChangedEvent(org.rstudio.studio.client.workbench.views.plots.events.PlotsChangedEvent) RStudioAPIShowDialogEvent(org.rstudio.studio.client.common.rstudioapi.events.RStudioAPIShowDialogEvent) FileSystemItem(org.rstudio.core.client.files.FileSystemItem) UiPrefsChangedEvent(org.rstudio.studio.client.workbench.prefs.events.UiPrefsChangedEvent) SnippetsChangedEvent(org.rstudio.studio.client.workbench.snippets.model.SnippetsChangedEvent) SourceExtendedTypeDetectedEvent(org.rstudio.studio.client.workbench.views.source.events.SourceExtendedTypeDetectedEvent) FileChangeEvent(org.rstudio.studio.client.workbench.views.files.events.FileChangeEvent) ShowDataEvent(org.rstudio.studio.client.workbench.views.source.events.ShowDataEvent) ProjectUserChangedEvent(org.rstudio.studio.client.projects.events.ProjectUserChangedEvent) ServerConsoleOutputEvent(org.rstudio.studio.client.common.console.ServerConsoleOutputEvent) CompilePdfErrorsEvent(org.rstudio.studio.client.common.compilepdf.events.CompilePdfErrorsEvent) ShowPresentationPaneEvent(org.rstudio.studio.client.workbench.views.presentation.events.ShowPresentationPaneEvent) FollowUserEvent(org.rstudio.studio.client.projects.events.FollowUserEvent) DataViewChangedEvent(org.rstudio.studio.client.workbench.views.source.events.DataViewChangedEvent) DirectoryNavigateEvent(org.rstudio.studio.client.workbench.views.files.events.DirectoryNavigateEvent) SourceCppCompletedEvent(org.rstudio.studio.client.workbench.views.output.sourcecpp.events.SourceCppCompletedEvent) FileChange(org.rstudio.studio.client.workbench.views.files.model.FileChange) AskPassEvent(org.rstudio.studio.client.workbench.views.vcs.common.events.AskPassEvent) EditorCommandEvent(org.rstudio.studio.client.events.EditorCommandEvent) EditorCommandDispatchEvent(org.rstudio.studio.client.events.EditorCommandDispatchEvent) ErrorHandlerChangedEvent(org.rstudio.studio.client.common.debugging.events.ErrorHandlerChangedEvent) Connection(org.rstudio.studio.client.workbench.views.connections.model.Connection) ShowHelpEvent(org.rstudio.studio.client.workbench.views.help.events.ShowHelpEvent) ConsoleResetHistory(org.rstudio.studio.client.workbench.views.console.model.ConsoleResetHistory) NotebookRangeExecutedEvent(org.rstudio.studio.client.rmarkdown.events.NotebookRangeExecutedEvent) InstallShinyEvent(org.rstudio.studio.client.common.dependencies.events.InstallShinyEvent) ChooseFileEvent(org.rstudio.studio.client.workbench.views.choosefile.events.ChooseFileEvent) ShinyApplicationStatusEvent(org.rstudio.studio.client.shiny.events.ShinyApplicationStatusEvent) RmdRenderCompletedEvent(org.rstudio.studio.client.rmarkdown.events.RmdRenderCompletedEvent) ConnectionUpdatedEvent(org.rstudio.studio.client.workbench.views.connections.events.ConnectionUpdatedEvent) BuildOutputEvent(org.rstudio.studio.client.workbench.views.buildtools.events.BuildOutputEvent) LintEvent(org.rstudio.studio.client.workbench.views.output.lint.events.LintEvent) ProjectAccessRevokedEvent(org.rstudio.studio.client.projects.events.ProjectAccessRevokedEvent) ErrorHandlerType(org.rstudio.studio.client.common.debugging.model.ErrorHandlerType) ShowEditorEvent(org.rstudio.studio.client.workbench.views.edit.events.ShowEditorEvent) SaveAction(org.rstudio.studio.client.application.model.SaveAction) RAddins(org.rstudio.studio.client.workbench.addins.Addins.RAddins) PresentationPaneRequestCompletedEvent(org.rstudio.studio.client.workbench.views.presentation.events.PresentationPaneRequestCompletedEvent) DebugSourceResult(org.rstudio.studio.client.workbench.views.environment.model.DebugSourceResult) ConsoleProcessCreatedEvent(org.rstudio.studio.client.common.console.ConsoleProcessCreatedEvent) OpenProjectError(org.rstudio.studio.client.projects.model.OpenProjectError) ServerConsolePromptEvent(org.rstudio.studio.client.common.console.ServerConsolePromptEvent) PlotsZoomSizeChangedEvent(org.rstudio.studio.client.workbench.views.plots.events.PlotsZoomSizeChangedEvent) JsObject(org.rstudio.core.client.js.JsObject) JsArray(com.google.gwt.core.client.JsArray) RmdRenderStartedEvent(org.rstudio.studio.client.rmarkdown.events.RmdRenderStartedEvent) ChunkPlotRefreshFinishedEvent(org.rstudio.studio.client.rmarkdown.events.ChunkPlotRefreshFinishedEvent) PackageStatusChangedEvent(org.rstudio.studio.client.workbench.views.packages.events.PackageStatusChangedEvent) RmdChunkOutputEvent(org.rstudio.studio.client.rmarkdown.events.RmdChunkOutputEvent) CompilePdfCompletedEvent(org.rstudio.studio.client.common.compilepdf.events.CompilePdfCompletedEvent) CompilePdfResult(org.rstudio.studio.client.common.compilepdf.model.CompilePdfResult) CollabEditEndedEvent(org.rstudio.studio.client.workbench.views.source.events.CollabEditEndedEvent) OpenProjectErrorEvent(org.rstudio.studio.client.projects.events.OpenProjectErrorEvent) BuildErrorsEvent(org.rstudio.studio.client.workbench.views.buildtools.events.BuildErrorsEvent) ProjectUser(org.rstudio.studio.client.projects.model.ProjectUser) RmdChunkOutput(org.rstudio.studio.client.rmarkdown.model.RmdChunkOutput) RSConnectDeploymentFailedEvent(org.rstudio.studio.client.rsconnect.events.RSConnectDeploymentFailedEvent) RprofEvent(org.rstudio.studio.client.workbench.views.source.editors.profiler.RprofEvent) ShinyFrameNavigatedEvent(org.rstudio.studio.client.shiny.events.ShinyFrameNavigatedEvent) ConnectionListChangedEvent(org.rstudio.studio.client.workbench.views.connections.events.ConnectionListChangedEvent) PresentationState(org.rstudio.studio.client.workbench.views.presentation.model.PresentationState) Bool(org.rstudio.studio.client.server.Bool) ViewerNavigateEvent(org.rstudio.studio.client.workbench.views.viewer.events.ViewerNavigateEvent) ConnectionListChangedEvent(org.rstudio.studio.client.workbench.views.connections.events.ConnectionListChangedEvent) CollabEditStartedEvent(org.rstudio.studio.client.workbench.views.source.events.CollabEditStartedEvent) TerminalSubprocEvent(org.rstudio.studio.client.workbench.views.terminal.events.TerminalSubprocEvent) HistoryEntriesAddedEvent(org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedEvent) UnhandledErrorEvent(org.rstudio.studio.client.common.debugging.events.UnhandledErrorEvent) HTMLPreviewResult(org.rstudio.studio.client.htmlpreview.model.HTMLPreviewResult) HTMLPreviewOutputEvent(org.rstudio.studio.client.htmlpreview.events.HTMLPreviewOutputEvent) SynctexEditFileEvent(org.rstudio.studio.client.common.synctex.events.SynctexEditFileEvent) MarkersChangedEvent(org.rstudio.studio.client.workbench.views.output.markers.events.MarkersChangedEvent) ProjectTemplateRegistry(org.rstudio.studio.client.projects.model.ProjectTemplateRegistry) HistoryEntry(org.rstudio.studio.client.workbench.views.history.model.HistoryEntry) RmdRenderResult(org.rstudio.studio.client.rmarkdown.model.RmdRenderResult) ContentItem(org.rstudio.studio.client.workbench.views.source.model.ContentItem) SourceLocation(org.rstudio.studio.client.common.synctex.model.SourceLocation) FindResultEvent(org.rstudio.studio.client.workbench.views.output.find.events.FindResultEvent) BuildStartedEvent(org.rstudio.studio.client.workbench.views.buildtools.events.BuildStartedEvent) RmdShinyDocStartedEvent(org.rstudio.studio.client.rmarkdown.events.RmdShinyDocStartedEvent) SessionSerializationAction(org.rstudio.studio.client.application.model.SessionSerializationAction) PackageState(org.rstudio.studio.client.workbench.views.packages.model.PackageState) PackageStatus(org.rstudio.studio.client.workbench.views.packages.model.PackageStatus) ViewDataEvent(org.rstudio.studio.client.workbench.views.data.events.ViewDataEvent) LoadedPackageUpdatesEvent(org.rstudio.studio.client.workbench.views.packages.events.LoadedPackageUpdatesEvent) ShinyGadgetDialogEvent(org.rstudio.studio.client.rmarkdown.events.ShinyGadgetDialogEvent) PackageExtensionIndexingCompletedEvent(org.rstudio.studio.client.packages.events.PackageExtensionIndexingCompletedEvent) CodeBrowserNavigationEvent(org.rstudio.studio.client.workbench.views.source.events.CodeBrowserNavigationEvent) HTMLPreviewCompletedEvent(org.rstudio.studio.client.htmlpreview.events.HTMLPreviewCompletedEvent) CompilePdfStartedEvent(org.rstudio.studio.client.common.compilepdf.events.CompilePdfStartedEvent) ServerConsolePromptEvent(org.rstudio.studio.client.common.console.ServerConsolePromptEvent) PackageStateChangedEvent(org.rstudio.studio.client.workbench.views.packages.events.PackageStateChangedEvent) LocatorEvent(org.rstudio.studio.client.workbench.views.plots.events.LocatorEvent) ConsolePrompt(org.rstudio.studio.client.workbench.views.console.model.ConsolePrompt) RPubsUploadStatusEvent(org.rstudio.studio.client.common.rpubs.events.RPubsUploadStatusEvent) BuildCompletedEvent(org.rstudio.studio.client.workbench.views.buildtools.events.BuildCompletedEvent) EnableConnectionsEvent(org.rstudio.studio.client.workbench.views.connections.events.EnableConnectionsEvent) RSConnectDeploymentOutputEvent(org.rstudio.studio.client.rsconnect.events.RSConnectDeploymentOutputEvent) ChunkPlotRefreshedEvent(org.rstudio.studio.client.rmarkdown.events.ChunkPlotRefreshedEvent) EnvironmentContextData(org.rstudio.studio.client.workbench.views.environment.model.EnvironmentContextData) FileEditEvent(org.rstudio.studio.client.workbench.views.source.events.FileEditEvent) DataItem(org.rstudio.studio.client.workbench.views.source.model.DataItem) PackageLoadedEvent(org.rstudio.studio.client.common.debugging.events.PackageLoadedEvent) SourceCppStartedEvent(org.rstudio.studio.client.workbench.views.output.sourcecpp.events.SourceCppStartedEvent) SearchPathFunctionDefinition(org.rstudio.studio.client.workbench.codesearch.model.SearchPathFunctionDefinition) CollabEditSavedEvent(org.rstudio.studio.client.workbench.views.source.events.CollabEditSavedEvent) RmdChunkOutputFinishedEvent(org.rstudio.studio.client.rmarkdown.events.RmdChunkOutputFinishedEvent) RmdParamsReadyEvent(org.rstudio.studio.client.rmarkdown.events.RmdParamsReadyEvent) ProjectTemplateRegistryUpdatedEvent(org.rstudio.studio.client.projects.events.ProjectTemplateRegistryUpdatedEvent) ActiveConnectionsChangedEvent(org.rstudio.studio.client.workbench.views.connections.events.ActiveConnectionsChangedEvent) SourceCppState(org.rstudio.studio.client.workbench.views.output.sourcecpp.model.SourceCppState) ChunkExecStateChangedEvent(org.rstudio.studio.client.rmarkdown.events.ChunkExecStateChangedEvent) ShowEditorData(org.rstudio.studio.client.workbench.views.edit.model.ShowEditorData) ShinyApplicationParams(org.rstudio.studio.client.shiny.model.ShinyApplicationParams) WebsiteFileSavedEvent(org.rstudio.studio.client.rmarkdown.events.WebsiteFileSavedEvent) CompilePdfOutputEvent(org.rstudio.studio.client.common.compilepdf.events.CompilePdfOutputEvent) ConnectionOpenedEvent(org.rstudio.studio.client.workbench.views.connections.events.ConnectionOpenedEvent) PlotsState(org.rstudio.studio.client.workbench.views.plots.model.PlotsState) CompileOutput(org.rstudio.studio.client.common.compile.CompileOutput) RmdRenderOutputEvent(org.rstudio.studio.client.rmarkdown.events.RmdRenderOutputEvent) EnvironmentContextData(org.rstudio.studio.client.workbench.views.environment.model.EnvironmentContextData) ShowEditorData(org.rstudio.studio.client.workbench.views.edit.model.ShowEditorData) CollabEditStartParams(org.rstudio.studio.client.workbench.views.source.events.CollabEditStartParams) UnhandledError(org.rstudio.studio.client.common.debugging.model.UnhandledError) DataView(org.rstudio.studio.client.workbench.views.data.model.DataView) PackageUnloadedEvent(org.rstudio.studio.client.common.debugging.events.PackageUnloadedEvent) RVersionsInfo(org.rstudio.studio.client.application.model.RVersionsInfo)

Example 2 with FileChangeEvent

use of org.rstudio.studio.client.workbench.views.files.events.FileChangeEvent in project rstudio by rstudio.

the class TextEditingTarget method initialize.

public void initialize(final SourceDocument document, FileSystemContext fileContext, FileType type, Provider<String> defaultNameProvider) {
    id_ = document.getId();
    fileContext_ = fileContext;
    fileType_ = (TextFileType) type;
    codeExecution_ = new EditingTargetCodeExecution(this, docDisplay_, getId(), this);
    extendedType_ = document.getExtendedType();
    extendedType_ = rmarkdownHelper_.detectExtendedType(document.getContents(), extendedType_, fileType_);
    themeHelper_ = new TextEditingTargetThemeHelper(this, events_);
    docUpdateSentinel_ = new DocUpdateSentinel(server_, docDisplay_, document, globalDisplay_.getProgressIndicator("Save File"), dirtyState_, events_);
    view_ = new TextEditingTargetWidget(this, docUpdateSentinel_, commands_, prefs_, fileTypeRegistry_, docDisplay_, fileType_, extendedType_, events_, session_);
    roxygenHelper_ = new RoxygenHelper(docDisplay_, view_);
    // create notebook and forward resize events
    chunks_ = new TextEditingTargetChunks(this);
    notebook_ = new TextEditingTargetNotebook(this, chunks_, view_, docDisplay_, dirtyState_, docUpdateSentinel_, document, releaseOnDismiss_, dependencyManager_);
    view_.addResizeHandler(notebook_);
    // ensure that Makefile and Makevars always use tabs
    name_.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if ("Makefile".equals(event.getValue()) || "Makefile.in".equals(event.getValue()) || "Makefile.win".equals(event.getValue()) || "Makevars".equals(event.getValue()) || "Makevars.in".equals(event.getValue()) || "Makevars.win".equals(event.getValue())) {
                docDisplay_.setUseSoftTabs(false);
            }
        }
    });
    name_.setValue(getNameFromDocument(document, defaultNameProvider), true);
    String contents = document.getContents();
    docDisplay_.setCode(contents, false);
    // Load and apply folds.
    final ArrayList<Fold> folds = Fold.decode(document.getFoldSpec());
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            for (Fold fold : folds) docDisplay_.addFold(fold.getRange());
        }
    });
    // Load and apply Vim marks (if they exist).
    if (document.getProperties().hasKey("marks")) {
        final String marksSpec = document.getProperties().getString("marks");
        final JsMap<Position> marks = VimMarks.decode(marksSpec);
        // Time out the marks setting just to avoid conflict with other
        // mutations of the editor.
        new Timer() {

            @Override
            public void run() {
                docDisplay_.setMarks(marks);
            }
        }.schedule(100);
    }
    registerPrefs(releaseOnDismiss_, prefs_, docDisplay_, document);
    // Initialize sourceOnSave, and keep it in sync
    view_.getSourceOnSave().setValue(document.sourceOnSave(), false);
    view_.getSourceOnSave().addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> event) {
            docUpdateSentinel_.setSourceOnSave(event.getValue(), globalDisplay_.getProgressIndicator("Error Saving Setting"));
        }
    });
    if (document.isDirty())
        dirtyState_.markDirty(false);
    else
        dirtyState_.markClean();
    docDisplay_.addValueChangeHandler(new ValueChangeHandler<Void>() {

        public void onValueChange(ValueChangeEvent<Void> event) {
            dirtyState_.markDirty(true);
            docDisplay_.clearSelectionHistory();
        }
    });
    docDisplay_.addFocusHandler(new FocusHandler() {

        public void onFocus(FocusEvent event) {
            // let anyone listening know this doc just got focus
            events_.fireEvent(new DocFocusedEvent(getPath(), getId()));
            if (queuedCollabParams_ != null) {
                // of one
                if (docDisplay_ != null && !docDisplay_.hasActiveCollabSession()) {
                    beginQueuedCollabSession();
                }
            }
            // check to see if the file's been saved externally--we do this even
            // in a collaborative editing session so we can get delete
            // notifications
            Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

                public boolean execute() {
                    if (view_.isAttached())
                        checkForExternalEdit();
                    return false;
                }
            }, 500);
        }
    });
    if (fileType_.isR()) {
        docDisplay_.addBreakpointSetHandler(new BreakpointSetEvent.Handler() {

            @Override
            public void onBreakpointSet(BreakpointSetEvent event) {
                if (event.isSet()) {
                    Breakpoint breakpoint = null;
                    // don't try to set breakpoints in unsaved code
                    if (isNewDoc()) {
                        view_.showWarningBar("Breakpoints cannot be set until " + "the file is saved.");
                        return;
                    }
                    // don't try to set breakpoints if the R version is too old
                    if (!session_.getSessionInfo().getHaveSrcrefAttribute()) {
                        view_.showWarningBar("Editor breakpoints require R 2.14 " + "or newer.");
                        return;
                    }
                    Position breakpointPosition = Position.create(event.getLineNumber() - 1, 1);
                    // if we're not in function scope, or this is a Shiny file,
                    // set a top-level (aka. Shiny-deferred) breakpoint
                    ScopeFunction innerFunction = null;
                    if (extendedType_ == null || !extendedType_.startsWith(SourceDocument.XT_SHINY_PREFIX))
                        innerFunction = docDisplay_.getFunctionAtPosition(breakpointPosition, false);
                    if (innerFunction == null || !innerFunction.isFunction() || StringUtil.isNullOrEmpty(innerFunction.getFunctionName())) {
                        breakpoint = breakpointManager_.setTopLevelBreakpoint(getPath(), event.getLineNumber());
                    } else // the scope tree will find nested functions, but in R these
                    // are addressable only as substeps of the parent function.
                    // keep walking up the scope tree until we've reached the top
                    // level function.
                    {
                        while (innerFunction.getParentScope() != null && innerFunction.getParentScope().isFunction()) {
                            innerFunction = (ScopeFunction) innerFunction.getParentScope();
                        }
                        String functionName = innerFunction.getFunctionName();
                        breakpoint = breakpointManager_.setBreakpoint(getPath(), functionName, event.getLineNumber(), dirtyState().getValue() == false);
                    }
                    docDisplay_.addOrUpdateBreakpoint(breakpoint);
                } else {
                    breakpointManager_.removeBreakpoint(event.getBreakpointId());
                }
                updateBreakpointWarningBar();
            }
        });
        docDisplay_.addBreakpointMoveHandler(new BreakpointMoveEvent.Handler() {

            @Override
            public void onBreakpointMove(BreakpointMoveEvent event) {
                breakpointManager_.moveBreakpoint(event.getBreakpointId());
            }
        });
    }
    // validate required components (e.g. Tex, knitr, C++ etc.)
    checkCompilePdfDependencies();
    rmarkdownHelper_.verifyPrerequisites(view_, fileType_);
    syncFontSize(releaseOnDismiss_, events_, view_, fontSizeManager_);
    final String rTypeId = FileTypeRegistry.R.getTypeId();
    releaseOnDismiss_.add(prefs_.softWrapRFiles().addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> evt) {
            if (fileType_.getTypeId().equals(rTypeId))
                view_.adaptToFileType(fileType_);
        }
    }));
    releaseOnDismiss_.add(events_.addHandler(FileChangeEvent.TYPE, new FileChangeHandler() {

        @Override
        public void onFileChange(FileChangeEvent event) {
            // screen out adds and events that aren't for our path
            FileChange fileChange = event.getFileChange();
            if (fileChange.getType() == FileChange.ADD)
                return;
            else if (!fileChange.getFile().getPath().equals(getPath()))
                return;
            // always check for changes if this is the active editor
            if (commandHandlerReg_ != null) {
                checkForExternalEdit();
            } else // this will show a confirmation dialog
            if (event.getFileChange().getType() == FileChange.MODIFIED && dirtyState().getValue() == false) {
                checkForExternalEdit();
            }
        }
    }));
    spelling_ = new TextEditingTargetSpelling(docDisplay_, docUpdateSentinel_);
    // show/hide the debug toolbar when the dirty state changes. (note:
    // this doesn't yet handle the case where the user saves the document,
    // in which case we should still show some sort of warning.)
    dirtyState().addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> evt) {
            updateDebugWarningBar();
        }
    });
    // find all of the debug breakpoints set in this document and replay them
    // onto the edit surface
    ArrayList<Breakpoint> breakpoints = breakpointManager_.getBreakpointsInFile(getPath());
    for (Breakpoint breakpoint : breakpoints) {
        docDisplay_.addOrUpdateBreakpoint(breakpoint);
    }
    if (extendedType_.equals(SourceDocument.XT_RMARKDOWN)) {
        // populate the popup menu with a list of available formats
        updateRmdFormatList();
        setRMarkdownBehaviorEnabled(true);
    }
    view_.addRmdFormatChangedHandler(new RmdOutputFormatChangedEvent.Handler() {

        @Override
        public void onRmdOutputFormatChanged(RmdOutputFormatChangedEvent event) {
            setRmdFormat(event.getFormat());
        }
    });
    syncPublishPath(document.getPath());
    initStatusBar();
}
Also used : AceFold(org.rstudio.studio.client.workbench.views.source.editors.text.ace.AceFold) RmdOutputFormatChangedEvent(org.rstudio.studio.client.rmarkdown.events.RmdOutputFormatChangedEvent) JsArrayString(com.google.gwt.core.client.JsArrayString) RoxygenHelper(org.rstudio.studio.client.common.r.roxygen.RoxygenHelper) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) FileChangeHandler(org.rstudio.studio.client.workbench.views.files.events.FileChangeHandler) FileChange(org.rstudio.studio.client.workbench.views.files.model.FileChange) Void(org.rstudio.studio.client.server.Void) EditingTargetCodeExecution(org.rstudio.studio.client.workbench.views.source.editors.EditingTargetCodeExecution) Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint) InputEditorPosition(org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorPosition) Position(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position) TextEditingTargetNotebook(org.rstudio.studio.client.workbench.views.source.editors.text.rmd.TextEditingTargetNotebook) Timer(com.google.gwt.user.client.Timer) DocFocusedEvent(org.rstudio.studio.client.workbench.views.source.events.DocFocusedEvent) RepeatingCommand(com.google.gwt.core.client.Scheduler.RepeatingCommand) FileChangeEvent(org.rstudio.studio.client.workbench.views.files.events.FileChangeEvent)

Aggregations

FileChangeEvent (org.rstudio.studio.client.workbench.views.files.events.FileChangeEvent)2 FileChange (org.rstudio.studio.client.workbench.views.files.model.FileChange)2 JsArray (com.google.gwt.core.client.JsArray)1 JsArrayString (com.google.gwt.core.client.JsArrayString)1 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 Timer (com.google.gwt.user.client.Timer)1 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)1 JsObject (org.rstudio.core.client.js.JsObject)1 RVersionsInfo (org.rstudio.studio.client.application.model.RVersionsInfo)1 SaveAction (org.rstudio.studio.client.application.model.SaveAction)1 SessionSerializationAction (org.rstudio.studio.client.application.model.SessionSerializationAction)1 CompileOutput (org.rstudio.studio.client.common.compile.CompileOutput)1 CompilePdfCompletedEvent (org.rstudio.studio.client.common.compilepdf.events.CompilePdfCompletedEvent)1 CompilePdfErrorsEvent (org.rstudio.studio.client.common.compilepdf.events.CompilePdfErrorsEvent)1 CompilePdfOutputEvent (org.rstudio.studio.client.common.compilepdf.events.CompilePdfOutputEvent)1 CompilePdfStartedEvent (org.rstudio.studio.client.common.compilepdf.events.CompilePdfStartedEvent)1 CompilePdfResult (org.rstudio.studio.client.common.compilepdf.model.CompilePdfResult)1 ConsoleProcessCreatedEvent (org.rstudio.studio.client.common.console.ConsoleProcessCreatedEvent)1 ServerConsoleOutputEvent (org.rstudio.studio.client.common.console.ServerConsoleOutputEvent)1