Search in sources :

Example 51 with JsArrayString

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

the class RequireJsLoader method requireScripts.

private void requireScripts(final RequirejsCallback callback, final RequirejsErrorHandler errorHandler, final RequirejsConfig config, final String[] requiredScripts, final String[] moduleKeys) {
    final JsArrayString jsReqScripts = (JsArrayString) JavaScriptObject.createArray();
    for (final String script : requiredScripts) {
        jsReqScripts.push(script);
    }
    Requirejs.config(config).require(jsReqScripts, new RequirejsCallback() {

        @Override
        public void onReady(final JsArray<RequirejsModule> result) {
            for (int i = 0; i < Math.min(result.length(), moduleKeys.length); i++) {
                String itemtoString = "null";
                if (result.get(i) != null) {
                    itemtoString = result.get(i).toString();
                }
                if (itemtoString.length() > 30) {
                    itemtoString = itemtoString.substring(0, 27) + "...";
                }
                Log.debug(RequireJsLoader.class, "Add module reference - name=" + moduleKeys[i] + " object=" + itemtoString);
                moduleHolder.setModule(moduleKeys[i], result.get(i));
            }
            callback.onReady(result);
        }
    }, errorHandler);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 52 with JsArrayString

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

the class OrionContentTypeOverlay method setExtension.

public final void setExtension(String... fileExtensions) {
    JsArrayString arr = JavaScriptObject.createArray().cast();
    for (String value : fileExtensions) {
        arr.push(value);
    }
    setExtension(arr);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 53 with JsArrayString

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

the class OrionLinkedModelDataOverlay method setValues.

@Override
public final void setValues(List<String> values) {
    JsArrayString arr = JavaScriptObject.createArray().cast();
    for (String value : values) {
        arr.push(value);
    }
    setValues(arr);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 54 with JsArrayString

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

the class WorkerGlobalScope method importScripts.

public final void importScripts(String[] urls) {
    JsArrayString jsUrls = JsArrayString.createArray().cast();
    for (int i = 0, l = urls.length; i < l; ++i) {
        jsUrls.set(i, urls[i]);
    }
    importScripts(jsUrls);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 55 with JsArrayString

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

the class UserCommandManager method onRegisterUserCommand.

private void onRegisterUserCommand(RegisterUserCommandEvent event) {
    final String name = event.getData().getName();
    JsArrayString shortcutStrings = event.getData().getShortcuts();
    for (int i = 0; i < shortcutStrings.length(); i++) {
        String shortcutString = shortcutStrings.get(i);
        KeySequence sequence = KeySequence.fromShortcutString(shortcutString);
        assert sequence != null : "Failed to parse string '" + shortcutString + "'";
        KeyboardShortcut shortcut = new KeyboardShortcut(sequence);
        UserCommand command = new UserCommand(name, new Command() {

            @Override
            public void execute() {
                events_.fireEvent(new ExecuteUserCommandEvent(name));
            }
        });
        commandMap_.put(shortcut, command);
    }
}
Also used : Command(com.google.gwt.user.client.Command) ExecuteUserCommandEvent(org.rstudio.studio.client.server.remote.ExecuteUserCommandEvent) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) KeySequence(org.rstudio.core.client.command.KeyboardShortcut.KeySequence)

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