use of org.rstudio.studio.client.workbench.views.viewer.events.ViewerClearedEvent in project rstudio by rstudio.
the class ViewerPresenter method stop.
private void stop(boolean interruptR, boolean clearAll, ProgressIndicator indicator) {
// check whether this was a static widget (determine what we do
// visa-vi widget history clearing/restoration)
boolean wasStaticWidget = commands_.viewerZoom().isEnabled();
manageCommands(false);
navigate(ViewerPane.ABOUT_BLANK);
if (interruptR)
commands_.interruptR().execute();
server_.viewerStopped(new VoidServerRequestCallback());
// that the application has been stopped
if (runningShinyAppParams_ != null) {
runningShinyAppParams_.setState(ShinyApplicationParams.STATE_STOPPED);
events_.fireEvent(new ShinyApplicationStatusEvent(runningShinyAppParams_));
}
runningShinyAppParams_ = null;
events_.fireEvent(new ViewerClearedEvent(true));
// if this was a static widget then clear the current widget
if (clearAll)
server_.viewerClearAll(new VoidServerRequestCallback(indicator));
else if (wasStaticWidget)
server_.viewerClearCurrent(new VoidServerRequestCallback(indicator));
else
// otherwise restore the last static widget
server_.viewerCurrent(new VoidServerRequestCallback());
}
use of org.rstudio.studio.client.workbench.views.viewer.events.ViewerClearedEvent in project rstudio by rstudio.
the class ShinyApplication method setShinyViewerType.
private void setShinyViewerType(int viewerType) {
UIPrefs prefs = pPrefs_.get();
prefs.shinyViewerType().setGlobalValue(viewerType);
prefs.writeUIPrefs();
// snap the app into the new location
if (currentViewType_ != viewerType && params_ != null) {
// the old instance
if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_PANE || currentViewType_ == ShinyViewerType.SHINY_VIEWER_WINDOW) {
if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_WINDOW) {
stopOnNextClose_ = false;
satelliteManager_.closeSatelliteWindow(ShinyApplicationSatellite.NAME);
} else {
eventBus_.fireEvent(new ViewerClearedEvent(false));
}
}
// assign new viewer type
currentViewType_ = viewerType;
params_.setViewerType(viewerType);
if (currentViewType_ == ShinyViewerType.SHINY_VIEWER_PANE || currentViewType_ == ShinyViewerType.SHINY_VIEWER_WINDOW || currentViewType_ == ShinyViewerType.SHINY_VIEWER_BROWSER) {
eventBus_.fireEvent(new ShinyApplicationStatusEvent(params_));
}
}
}
Aggregations