use of org.rstudio.studio.client.application.events.SuspendAndRestartEvent in project rstudio by rstudio.
the class Packages method restartForInstallWithConfirmation.
private void restartForInstallWithConfirmation(final String installCmd) {
String msg = "One or more of the packages that will be updated by this " + "installation are currently loaded. Restarting R prior " + "to updating these packages is strongly recommended.\n\n" + "RStudio can restart R and then automatically continue " + "the installation after restarting (all work and " + "data will be preserved during the restart).\n\n" + "Do you want to restart R prior to installing?";
final boolean haveInstallCmd = installCmd.startsWith("install.packages");
globalDisplay_.showYesNoMessage(MessageDialog.WARNING, "Updating Loaded Packages", msg, true, new Operation() {
public void execute() {
events_.fireEvent(new SuspendAndRestartEvent(SuspendOptions.createSaveAll(true), installCmd));
}
}, new Operation() {
public void execute() {
server_.ignoreNextLoadedPackageCheck(new VoidServerRequestCallback() {
@Override
public void onSuccess() {
if (haveInstallCmd)
executePkgCommand(installCmd);
}
});
}
}, true);
}
use of org.rstudio.studio.client.application.events.SuspendAndRestartEvent in project rstudio by rstudio.
the class ApplicationQuit method onRestartR.
@Handler
public void onRestartR() {
boolean saveChanges = saveAction_.getAction() != SaveAction.NOSAVE;
eventBus_.fireEvent(new SuspendAndRestartEvent(SuspendOptions.createSaveMinimal(saveChanges), null));
}
Aggregations