Search in sources :

Example 66 with JsArrayString

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

the class PaneConfig method createDefault.

public static PaneConfig createDefault() {
    JsArrayString panes = createArray().cast();
    panes.push(SOURCE);
    panes.push(CONSOLE);
    panes.push("TabSet1");
    panes.push("TabSet2");
    JsArrayString tabSet1 = createArray().cast();
    tabSet1.push("Environment");
    tabSet1.push("History");
    tabSet1.push("Connections");
    tabSet1.push("Build");
    tabSet1.push("VCS");
    tabSet1.push("Presentation");
    JsArrayString tabSet2 = createArray().cast();
    tabSet2.push("Files");
    tabSet2.push("Plots");
    tabSet2.push("Packages");
    tabSet2.push("Help");
    tabSet2.push("Viewer");
    return create(panes, tabSet1, tabSet2, false, true);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 67 with JsArrayString

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

the class HelpSearchOracle method requestSuggestions.

@Override
public void requestSuggestions(final Request request, final Callback callback) {
    String query = request.getQuery();
    server_.suggestTopics(query, new ServerRequestCallback<JsArrayString>() {

        @Override
        public void onError(ServerError error) {
        }

        @Override
        public void onResponseReceived(JsArrayString suggestions) {
            int maxCount = Math.min(suggestions.length(), request.getLimit());
            ArrayList<SearchSuggestion> results = new ArrayList<SearchSuggestion>();
            for (int i = 0; i < maxCount; i++) results.add(new SearchSuggestion(suggestions.get(i)));
            callback.onSuggestionsReady(request, new Response(results));
        }
    });
    ;
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) ArrayList(java.util.ArrayList) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 68 with JsArrayString

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

the class Source method openEditPublishedDocs.

private void openEditPublishedDocs() {
    // will be done after the switch)
    if (ApplicationAction.isSwitchProject())
        return;
    // check for edit_published url parameter
    final String kEditPublished = "edit_published";
    String editPublished = StringUtil.notNull(Window.Location.getParameter(kEditPublished));
    // to determine source files to edit 
    if (editPublished.length() > 0) {
        // remove it from the url
        ApplicationUtils.removeQueryParam(kEditPublished);
        server_.getEditPublishedDocs(editPublished, new SimpleRequestCallback<JsArrayString>() {

            @Override
            public void onResponseReceived(JsArrayString docs) {
                new SourceFilesOpener(docs).run();
            }
        });
    }
}
Also used : JSONString(com.google.gwt.json.client.JSONString) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 69 with JsArrayString

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

the class ChunkOutputWidget method cacheEditorStyle.

public static void cacheEditorStyle(String foregroundColor, String backgroundColor, String aceEditorColor) {
    // use a muted version of the text color for the outline
    ColorUtil.RGBColor text = ColorUtil.RGBColor.fromCss(aceEditorColor);
    // dark themes require a slightly more pronounced color
    ColorUtil.RGBColor outline = new ColorUtil.RGBColor(text.red(), text.green(), text.blue(), text.isDark() ? 0.12 : 0.18);
    String border = outline.asRgb();
    // highlight color used in data chunks
    ColorUtil.RGBColor highlight = new ColorUtil.RGBColor(text.red(), text.green(), text.blue(), 0.02);
    // synthesize a surface color by blending the keyword color with the 
    // background
    JsArrayString classes = JsArrayString.createArray().cast();
    classes.push("ace_editor");
    classes.push("ace_keyword");
    ColorUtil.RGBColor surface = ColorUtil.RGBColor.fromCss(DomUtils.extractCssValue(classes, "color"));
    surface = surface.mixedWith(ColorUtil.RGBColor.fromCss(backgroundColor), 0.02, 1);
    s_colors = new EditorThemeListener.Colors(foregroundColor, backgroundColor, border, highlight.asRgb(), surface.asRgb());
}
Also used : ColorUtil(org.rstudio.core.client.ColorUtil) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 70 with JsArrayString

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

the class TextEditingTargetRMarkdownHelper method transferOptions.

private RmdFrontMatterOutputOptions transferOptions(RmdFrontMatter frontMatter, RmdTemplate template, String format) {
    RmdFrontMatterOutputOptions result = RmdFrontMatterOutputOptions.create();
    // loop over each option applicable to the new format; if it's
    // transferable, try to find it in one of the other formats 
    JsArrayString options = template.getFormat(format).getOptions();
    for (int i = 0; i < options.length(); i++) {
        String optionName = options.get(i);
        RmdTemplateFormatOption option = template.getOption(optionName);
        if (!option.isTransferable())
            continue;
        // option is transferable, is it present in another front matter entry?
        JsArrayString formats = frontMatter.getFormatList();
        for (int j = 0; j < formats.length(); j++) {
            RmdFrontMatterOutputOptions outOptions = frontMatter.getOutputOption(formats.get(j));
            if (outOptions == null)
                continue;
            String val = outOptions.getOptionValue(optionName);
            if (val != null)
                result.setOptionValue(option, val);
        }
    }
    return result;
}
Also used : RmdTemplateFormatOption(org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption) RmdFrontMatterOutputOptions(org.rstudio.studio.client.rmarkdown.model.RmdFrontMatterOutputOptions) JsArrayString(com.google.gwt.core.client.JsArrayString) 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