Search in sources :

Example 6 with ChunkOutputWidget

use of org.rstudio.studio.client.workbench.views.source.editors.text.ChunkOutputWidget in project rstudio by rstudio.

the class TextEditingTargetNotebook method onLineWidgetRemoved.

@Override
public void onLineWidgetRemoved(LineWidget widget) {
    for (ChunkOutputUi output : outputs_.values()) {
        // to keep the output pinned to the end of the chunk
        if (output.moving())
            continue;
        if (output.getLineWidget() == widget && !output.moving()) {
            // save scope and widget
            int terminalLine = widget.getRow() - 1;
            Scope scope = docDisplay_.getCurrentChunk(Position.create(terminalLine, 1));
            ChunkOutputWidget outputWidget = output.getOutputWidget();
            // clean up old widget
            output.remove();
            outputs_.remove(output.getChunkId());
            // is identical)
            if (scope != null && scope.getEnd().getRow() == terminalLine) {
                ChunkDefinition def = (ChunkDefinition) widget.getData();
                def.setRow(terminalLine);
                widget.setRow(terminalLine);
                ChunkOutputUi newOutput = new ChunkOutputUi(docUpdateSentinel_.getId(), docDisplay_, def, this, outputWidget);
                outputs_.put(output.getChunkId(), newOutput);
                return;
            }
            break;
        }
    }
}
Also used : Scope(org.rstudio.studio.client.workbench.views.source.editors.text.Scope) ChunkOutputWidget(org.rstudio.studio.client.workbench.views.source.editors.text.ChunkOutputWidget)

Aggregations

ChunkOutputWidget (org.rstudio.studio.client.workbench.views.source.editors.text.ChunkOutputWidget)6 PinnedLineWidget (org.rstudio.studio.client.workbench.views.source.editors.text.PinnedLineWidget)3 LineWidget (org.rstudio.studio.client.workbench.views.source.editors.text.ace.LineWidget)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Map (java.util.Map)1 SafeMap (org.rstudio.core.client.container.SafeMap)1 Scope (org.rstudio.studio.client.workbench.views.source.editors.text.Scope)1 ChunkOutputHost (org.rstudio.studio.client.workbench.views.source.editors.text.rmd.ChunkOutputHost)1