use of org.rstudio.studio.client.rmarkdown.ui.RmdTemplateOptionsDialog in project rstudio by rstudio.
the class TextEditingTarget method showFrontMatterEditorDialog.
private void showFrontMatterEditorDialog(String yaml, RmdYamlData data) {
RmdSelectedTemplate selTemplate = rmarkdownHelper_.getTemplateFormat(yaml);
if (selTemplate == null) {
// we don't expect this to happen since we disable the dialog
// entry point when we can't find an associated template
globalDisplay_.showErrorMessage("Edit Format Failed", "Couldn't determine the format options from the YAML front " + "matter. Make sure the YAML defines a supported output " + "format in its 'output' field.");
return;
}
RmdTemplateOptionsDialog dialog = new RmdTemplateOptionsDialog(selTemplate.template, selTemplate.format, data.getFrontMatter(), getPath() == null ? null : FileSystemItem.createFile(getPath()), selTemplate.isShiny, new OperationWithInput<RmdTemplateOptionsDialog.Result>() {
@Override
public void execute(RmdTemplateOptionsDialog.Result in) {
// when the dialog is completed successfully, apply the new
// front matter
applyRmdFormatOptions(in.format, in.outputOptions);
}
}, new Operation() {
@Override
public void execute() {
// when the dialog is cancelled, update the view's format list
// (to cancel in-place changes)
updateRmdFormatList();
}
});
dialog.showModal();
}
Aggregations