Search in sources :

Example 61 with JsArrayString

use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.

the class ProjectPreferencesDialog method packratVectorArg.

private String packratVectorArg(String name, JsArrayString valueJson) {
    String[] value = JsUtil.toStringArray(valueJson);
    String result = name + " = ";
    if (value.length < 1)
        return result + "\"\"";
    result += "c(";
    for (int i = 0; i < value.length - 1; ++i) {
        result += StringUtil.ensureSurroundedWith(value[i].replaceAll("\"", "\\\\\""), '"');
        result += ", ";
    }
    result += StringUtil.ensureSurroundedWith(value[value.length - 1].replaceAll("\"", "\\\\\""), '"');
    result += ")";
    return result;
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 62 with JsArrayString

use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.

the class RSConnect method deployToRSConnect.

private void deployToRSConnect(String sourceFile, String deployDir, String deployFile, String websiteDir, String description, JsArrayString deployFiles, JsArrayString additionalFiles, JsArrayString ignoredFiles, boolean isSelfContained, boolean isShiny, boolean asMultiple, boolean asStatic, boolean launch, JavaScriptObject jsoRecord) {
    // front if we can
    if (Desktop.isDesktop())
        Desktop.getFrame().bringMainFrameToFront();
    else
        WindowEx.get().focus();
    ArrayList<String> deployFilesList = JsArrayUtil.fromJsArrayString(deployFiles);
    ArrayList<String> additionalFilesList = JsArrayUtil.fromJsArrayString(additionalFiles);
    ArrayList<String> ignoredFilesList = JsArrayUtil.fromJsArrayString(ignoredFiles);
    RSConnectDeploymentRecord record = jsoRecord.cast();
    events_.fireEvent(new RSConnectDeployInitiatedEvent(new RSConnectPublishSource(sourceFile, deployDir, deployFile, websiteDir, isSelfContained, asStatic, isShiny, description), new RSConnectPublishSettings(deployFilesList, additionalFilesList, ignoredFilesList, asMultiple, asStatic), launch, record));
}
Also used : RSConnectPublishSettings(org.rstudio.studio.client.rsconnect.model.RSConnectPublishSettings) RSConnectDeployInitiatedEvent(org.rstudio.studio.client.rsconnect.events.RSConnectDeployInitiatedEvent) JsArrayString(com.google.gwt.core.client.JsArrayString) RSConnectDeploymentRecord(org.rstudio.studio.client.rsconnect.model.RSConnectDeploymentRecord) RSConnectPublishSource(org.rstudio.studio.client.rsconnect.model.RSConnectPublishSource)

Example 63 with JsArrayString

use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.

the class RmdTemplateOptionsWidget method addFormatOptions.

private void addFormatOptions(RmdTemplateFormat format) {
    if (format.getNotes().length() > 0 && allowFormatChange_) {
        labelFormatNotes_.setText(format.getNotes());
        labelFormatNotes_.setVisible(true);
    } else {
        labelFormatNotes_.setVisible(false);
    }
    optionWidgets_ = new ArrayList<RmdFormatOption>();
    JsArrayString options = format.getOptions();
    for (int i = 0; i < options.length(); i++) {
        RmdFormatOption optionWidget;
        RmdTemplateFormatOption option = findOption(format.getName(), options.get(i));
        if (option == null)
            continue;
        String initialValue = option.getDefaultValue();
        // check to see whether a value for this format and option were
        // specified in the front matter
        String frontMatterValue = getFrontMatterDefault(format.getName(), option.getName());
        if (frontMatterValue != null)
            initialValue = frontMatterValue;
        optionWidget = createWidgetForOption(option, initialValue);
        if (optionWidget == null)
            continue;
        optionWidget.asWidget().addStyleName(style.optionWidget());
        FlowPanel panel = null;
        String category = option.getCategory();
        if (tabs_.containsKey(category)) {
            panel = tabs_.get(category);
        } else {
            ScrollPanel scrollPanel = new ScrollPanel();
            panel = new FlowPanel();
            scrollPanel.add(panel);
            optionsTabs_.add(scrollPanel, new Label(category));
            tabs_.put(category, panel);
        }
        panel.add(optionWidget);
        optionWidgets_.add(optionWidget);
    }
    // we need to center the tabs and overlay them on the top edge of the
    // content; to do this, it is necessary to nuke a couple of the inline
    // styles used by the default GWT tab panel. 
    Element tabOuter = (Element) optionsTabs_.getElement().getChild(1);
    tabOuter.getStyle().setOverflow(Overflow.VISIBLE);
    Element tabInner = (Element) tabOuter.getFirstChild();
    tabInner.getStyle().clearWidth();
}
Also used : RmdTemplateFormatOption(org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption) Element(com.google.gwt.dom.client.Element) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 64 with JsArrayString

use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.

the class RmdTemplateOptionsWidget method applyFrontMatter.

private void applyFrontMatter(RmdFrontMatter frontMatter) {
    frontMatter_ = frontMatter;
    frontMatterCache_ = new HashMap<String, String>();
    ensureOptionsCache();
    JsArrayString formats = frontMatter.getFormatList();
    for (int i = 0; i < formats.length(); i++) {
        String format = formats.get(i);
        RmdFrontMatterOutputOptions options = frontMatter.getOutputOption(format);
        JsArrayString optionList = options.getOptionList();
        for (int j = 0; j < optionList.length(); j++) {
            String option = optionList.get(j);
            String value = options.getOptionValue(option);
            frontMatterCache_.put(format + ":" + option, value);
            if (optionCache_.containsKey(option)) {
                // If the option is specifically labeled as transferable
                // between formats, add a generic key to be applied to other
                // formats
                RmdTemplateFormatOption formatOption = optionCache_.get(option);
                if (formatOption.isTransferable()) {
                    frontMatterCache_.put(option, value);
                }
            }
        }
    }
}
Also used : RmdTemplateFormatOption(org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) RmdFrontMatterOutputOptions(org.rstudio.studio.client.rmarkdown.model.RmdFrontMatterOutputOptions)

Example 65 with JsArrayString

use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.

the class CompletionRequester method fillCompletionResult.

private void fillCompletionResult(Completions response, boolean implicit, ServerRequestCallback<CompletionResult> callback) {
    JsArrayString comp = response.getCompletions();
    JsArrayString pkgs = response.getPackages();
    JsArrayBoolean quote = response.getQuote();
    JsArrayInteger type = response.getType();
    ArrayList<QualifiedName> newComp = new ArrayList<QualifiedName>();
    for (int i = 0; i < comp.length(); i++) {
        newComp.add(new QualifiedName(comp.get(i), pkgs.get(i), quote.get(i), type.get(i), response.getHelpHandler()));
    }
    CompletionResult result = new CompletionResult(response.getToken(), newComp, response.getGuessedFunctionName(), response.getSuggestOnAccept(), response.getOverrideInsertParens());
    if (response.isCacheable()) {
        cachedCompletions_.put("", result);
    }
    if (!implicit || result.completions.size() != 0)
        callback.onResponseReceived(result);
}
Also used : RnwOptionCompletionResult(org.rstudio.studio.client.workbench.views.source.model.RnwChunkOptions.RnwOptionCompletionResult) JsArrayBoolean(com.google.gwt.core.client.JsArrayBoolean) JsArrayInteger(com.google.gwt.core.client.JsArrayInteger) ArrayList(java.util.ArrayList) JsArrayString(com.google.gwt.core.client.JsArrayString)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)86 ArrayList (java.util.ArrayList)15 JSONString (com.google.gwt.json.client.JSONString)5 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)5 ServerError (org.rstudio.studio.client.server.ServerError)4 JsArrayInteger (com.google.gwt.core.client.JsArrayInteger)3 Command (com.google.gwt.user.client.Command)3 List (java.util.List)3 KeySequence (org.rstudio.core.client.command.KeyboardShortcut.KeySequence)3 JsObject (org.rstudio.core.client.js.JsObject)3 RmdTemplateFormatOption (org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption)3 JsArrayBoolean (com.google.gwt.core.client.JsArrayBoolean)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 Label (com.google.gwt.user.client.ui.Label)2 OperationException (org.eclipse.che.api.promises.client.OperationException)2 Handler (org.rstudio.core.client.command.Handler)2 EnsureHeightHandler (org.rstudio.core.client.events.EnsureHeightHandler)2 EnsureVisibleHandler (org.rstudio.core.client.events.EnsureVisibleHandler)2 ChangeFontSizeHandler (org.rstudio.studio.client.application.events.ChangeFontSizeHandler)2 RmdFrontMatterOutputOptions (org.rstudio.studio.client.rmarkdown.model.RmdFrontMatterOutputOptions)2