use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class NotebookQueueState method executeChunk.
public void executeChunk(ChunkExecUnit chunk) {
if (isExecuting()) {
String chunkId = notebook_.getRowChunkId(chunk.getScope().getPreamble().getRow());
if (chunkId == null)
return;
NotebookQueueUnit unit = getUnit(chunkId);
if (unit == null) {
// unit is not in the queue; add it
queueChunkRange(chunk);
} else if (chunk.getRange() != null) {
// only part of the chunk needs to be executed
NotebookExecRange execRange = getNotebookExecRange(chunk.getScope(), chunk.getRange());
// (note: doesn't handle overlapping)
if (unit.hasPendingRange(execRange))
return;
// unit is in the queue, modify it
unit.addPendingRange(execRange);
// redraw the pending lines
renderQueueLineState(chunk.getScope(), unit);
server_.updateNotebookExecQueue(unit, NotebookDocQueue.QUEUE_OP_UPDATE, "", new VoidServerRequestCallback());
}
} else {
List<ChunkExecUnit> chunks = new ArrayList<ChunkExecUnit>();
chunks.add(chunk);
executeChunks("Run Chunk", chunks);
}
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class ViewerPresenter method onViewerSaveAsWebPage.
@Handler
public void onViewerSaveAsWebPage() {
display_.bringToFront();
if (saveAsWebPageDefaultPath_ == null)
saveAsWebPageDefaultPath_ = workbenchContext_.getCurrentWorkingDir();
dependencyManager_.withRMarkdown("Saving standalone web pages", new Command() {
@Override
public void execute() {
fileDialogs_.saveFile("Save As Web Page", fileSystemContext_, saveAsWebPageDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving as web page...");
server_.viewerSaveAsWebPage(targetFile.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
saveAsWebPageDefaultPath_ = targetFile.getParentPath();
}
});
}
});
}
});
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback 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.server.VoidServerRequestCallback in project rstudio by rstudio.
the class ConsoleProgressDialog method onProcessExit.
@Override
public void onProcessExit(ProcessExitEvent event) {
setExitCode(event.getExitCode());
if (isShowing()) {
display_.setReadOnly(true);
stopButton().setFocus(true);
// when a shell exits we close the dialog
if (getInteractionMode() == ConsoleProcessInfo.INTERACTION_ALWAYS)
stopButton().click();
else // we also auto-close
if (showOnOutput_ && (event.getExitCode() == 0))
stopButton().click();
} else // down registrations and reap the process
if (showOnOutput_) {
unregisterHandlers();
if (consoleProcess_ != null)
consoleProcess_.reap(new VoidServerRequestCallback());
}
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class TerminalSession method onProcessExit.
@Override
public void onProcessExit(ProcessExitEvent event) {
unregisterHandlers();
if (consoleProcess_ != null) {
consoleProcess_.reap(new VoidServerRequestCallback());
}
eventBus_.fireEvent(new TerminalSessionStoppedEvent(this));
}
Aggregations