use of org.rstudio.studio.client.workbench.views.source.editors.text.ScopeList in project rstudio by rstudio.
the class NotebookQueueState method getChunkDefAtRow.
private ChunkDefinition getChunkDefAtRow(int row, String newId) {
ChunkDefinition chunkDef;
// if there is an existing widget just modify it in place
LineWidget widget = docDisplay_.getLineWidgetForRow(row);
if (widget != null && widget.getType().equals(ChunkDefinition.LINE_WIDGET_TYPE)) {
chunkDef = widget.getData();
} else // otherwise create a new one
{
if (StringUtil.isNullOrEmpty(newId))
newId = "c" + StringUtil.makeRandomId(12);
chunkDef = ChunkDefinition.create(row, 1, true, ChunkOutputWidget.EXPANDED, RmdChunkOptions.create(), sentinel_.getId(), newId, TextEditingTargetNotebook.getKnitrChunkLabel(row, docDisplay_, new ScopeList(docDisplay_)));
if (newId == TextEditingTargetNotebook.SETUP_CHUNK_ID)
chunkDef.getOptions().setInclude(false);
RStudioGinjector.INSTANCE.getEventBus().fireEvent(new ChunkChangeEvent(sentinel_.getId(), chunkDef.getChunkId(), "", row, ChunkChangeEvent.CHANGE_CREATE));
}
return chunkDef;
}
Aggregations