use of org.rstudio.studio.client.rmarkdown.model.NotebookExecRange 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);
}
}
Aggregations