in src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java [328:359]
public void updatePanel(@Nullable final String replacementContent, @Nullable final IpnbOutputCell outputContent) {
final Application application = ApplicationManager.getApplication();
application.invokeAndWait(() -> {
if (replacementContent == null && outputContent == null) {
myCell.removeCellOutputs();
myViewPanel.removeAll();
application.runReadAction(() -> {
final JComponent panel = createViewPanel();
myViewPanel.add(panel);
String prompt = IpnbEditorUtil.prompt(-1, IpnbEditorUtil.PromptType.In);
myPromptLabel.setText(prompt);
});
}
if (replacementContent != null) {
if (replacementContent.isEmpty() || myCell.getSource().isEmpty()) {
myCell.setSource(Arrays.asList(StringUtil.splitByLinesKeepSeparators(replacementContent)));
}
String prompt = IpnbEditorUtil.prompt(null, IpnbEditorUtil.PromptType.In);
myCell.setPromptNumber(null);
myPromptLabel.setText(prompt);
application.runWriteAction(() -> myCodeSourcePanel.getEditor().getDocument().setText(replacementContent));
}
if (outputContent != null && myHideableOutputPanel != null) {
myCell.addCellOutput(outputContent);
final JComponent component = myHideableOutputPanel.getSecondComponent();
if (component != null) {
addOutputPanel(component, outputContent, outputContent instanceof IpnbOutOutputCell);
}
}
}, ModalityState.stateForComponent(this));
}