Search in sources :

Example 1 with InterruptHandler

use of org.rstudio.studio.client.application.ApplicationInterrupt.InterruptHandler in project rstudio by rstudio.

the class ShinyApplication method launchShinyApplication.

// Public methods ----------------------------------------------------------
// Private methods ---------------------------------------------------------
private void launchShinyApplication(final String filePath, final String extendedType) {
    String fileDir = filePath.substring(0, filePath.lastIndexOf("/"));
    if (fileDir.equals(currentAppPath())) {
        // reload the app.
        if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_WINDOW) {
            satelliteManager_.dispatchCommand(commands_.reloadShinyApp(), ShinyApplicationSatellite.NAME);
            activateWindow();
        } else if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_PANE && commands_.viewerRefresh().isEnabled()) {
            commands_.viewerRefresh().execute();
        } else if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_BROWSER) {
            eventBus_.fireEvent(new ShinyApplicationStatusEvent(params_));
        }
        return;
    } else if (params_ != null && isBusy_) {
        // There's another app running. Interrupt it and then start this one.
        interrupt_.interruptR(new InterruptHandler() {

            @Override
            public void onInterruptFinished() {
                launchShinyFile(filePath, extendedType);
            }
        });
    } else {
        // Nothing else running, start this app.
        dependencyManager_.withShiny("Running Shiny applications", new Command() {

            @Override
            public void execute() {
                launchShinyFile(filePath, extendedType);
            }
        });
    }
}
Also used : Command(com.google.gwt.user.client.Command) InterruptHandler(org.rstudio.studio.client.application.ApplicationInterrupt.InterruptHandler) ShinyApplicationStatusEvent(org.rstudio.studio.client.shiny.events.ShinyApplicationStatusEvent)

Aggregations

Command (com.google.gwt.user.client.Command)1 InterruptHandler (org.rstudio.studio.client.application.ApplicationInterrupt.InterruptHandler)1 ShinyApplicationStatusEvent (org.rstudio.studio.client.shiny.events.ShinyApplicationStatusEvent)1