use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class TextEditingTarget method previewRpresentation.
void previewRpresentation() {
SessionInfo sessionInfo = session_.getSessionInfo();
if (!fileTypeCommands_.getHTMLCapabiliites().isRMarkdownSupported()) {
globalDisplay_.showMessage(MessageDisplay.MSG_WARNING, "Unable to Preview", "R Presentations require the knitr package " + "(version 1.2 or higher)");
return;
}
PresentationState state = sessionInfo.getPresentationState();
// if we are showing a tutorial then don't allow preview
if (state.isTutorial()) {
globalDisplay_.showMessage(MessageDisplay.MSG_WARNING, "Unable to Preview", "R Presentations cannot be previewed when a Tutorial " + "is active");
return;
}
// if this presentation is already showing then just activate
if (state.isActive() && state.getFilePath().equals(docUpdateSentinel_.getPath())) {
commands_.activatePresentation().execute();
save();
} else // otherwise reload
{
saveThenExecute(null, new Command() {
@Override
public void execute() {
server_.showPresentationPane(docUpdateSentinel_.getPath(), new VoidServerRequestCallback());
}
});
}
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class FindOutputPresenter method onDismiss.
public void onDismiss() {
stopAndClear();
server_.clearFindResults(new VoidServerRequestCallback());
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Plots method onClearPlots.
void onClearPlots() {
// clear plots gesture indicates we are done with locator
safeClearLocator();
// confirm
globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Clear Plots", "Are you sure you want to clear all of the plots in the history?", new ProgressOperation() {
public void execute(final ProgressIndicator indicator) {
indicator.onProgress("Clearing plots...");
server_.clearPlots(new VoidServerRequestCallback(indicator));
}
}, true);
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class History method onHistoryRemoveEntries.
@Handler
void onHistoryRemoveEntries() {
// get selected indexes (bail if there is no selection)
final ArrayList<Integer> selectedRowIndexes = view_.getRecentCommandsSelectedRowIndexes();
if (selectedRowIndexes.size() < 1) {
globalDisplay_.showErrorMessage("Error", "No history entries currently selected.");
return;
}
// bring view to front
view_.bringToFront();
globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Remove Entries", "Are you sure you want to remove the selected entries from " + "the history?", new ProgressOperation() {
public void execute(final ProgressIndicator indicator) {
indicator.onProgress("Removing items...");
// for each selected row index we need to calculate
// the offset from the bottom
int rowCount = view_.getRecentCommandsRowsDisplayed();
JsArrayNumber bottomIndexes = (JsArrayNumber) JsArrayNumber.createArray();
for (int i = 0; i < selectedRowIndexes.size(); i++) bottomIndexes.push(rowCount - selectedRowIndexes.get(i) - 1);
server_.removeHistoryItems(bottomIndexes, new VoidServerRequestCallback(indicator));
}
}, true);
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback 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);
}
Aggregations