Search in sources :

Example 1 with RmdTemplateOptionsDialog

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();
}
Also used : RmdSelectedTemplate(org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTargetRMarkdownHelper.RmdSelectedTemplate) CppCompletionOperation(org.rstudio.studio.client.workbench.views.source.editors.text.cpp.CppCompletionOperation) RmdTemplateOptionsDialog(org.rstudio.studio.client.rmarkdown.ui.RmdTemplateOptionsDialog) CompileNotebookResult(org.rstudio.studio.client.notebook.CompileNotebookResult)

Aggregations

CompileNotebookResult (org.rstudio.studio.client.notebook.CompileNotebookResult)1 RmdTemplateOptionsDialog (org.rstudio.studio.client.rmarkdown.ui.RmdTemplateOptionsDialog)1 RmdSelectedTemplate (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTargetRMarkdownHelper.RmdSelectedTemplate)1 CppCompletionOperation (org.rstudio.studio.client.workbench.views.source.editors.text.cpp.CppCompletionOperation)1