Search in sources :

Example 21 with JsArrayString

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

the class ProjectTemplateWidget method readSelectBoxFields.

private String[] readSelectBoxFields(ProjectTemplateWidgetDescription description) {
    JsArrayString jsFields = description.getFields();
    int n = jsFields.length();
    String[] fields = new String[n];
    for (int i = 0; i < n; i++) fields[i] = jsFields.get(i);
    return fields;
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 22 with JsArrayString

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

the class BuildToolsWebsitePanel method load.

@Override
void load(RProjectOptions options) {
    RProjectConfig config = options.getConfig();
    pathSelector_.setText(config.getWebsitePath());
    RProjectBuildOptions buildOptions = options.getBuildOptions();
    chkPreviewAfterBuilding_.setValue(buildOptions.getPreviewWebsite());
    chkLivePreviewSite_.setValue(buildOptions.getLivePreviewWebsite());
    RProjectBuildContext buildContext = options.getBuildContext();
    if (buildContext.isBookdownSite()) {
        // change caption
        chkPreviewAfterBuilding_.setText("Preview book after building");
        // get all available output formats
        JsArrayString formatsJson = buildContext.getWebsiteOutputFormats();
        ArrayList<String> formatNames = new ArrayList<String>();
        ArrayList<String> formats = new ArrayList<String>();
        // always include "All Formats"
        formatNames.add("(All Formats)");
        formats.add("all");
        for (int i = 0; i < formatsJson.length(); i++) {
            formatNames.add(formatsJson.get(i));
            formats.add(formatsJson.get(i));
        }
        websiteOutputFormat_.setChoices(formatNames.toArray(new String[] {}), formats.toArray(new String[] {}));
        websiteOutputFormat_.setValue(buildOptions.getWebsiteOutputFormat());
        websiteOutputFormat_.setVisible(true);
    }
}
Also used : RProjectBuildOptions(org.rstudio.studio.client.projects.model.RProjectBuildOptions) ArrayList(java.util.ArrayList) RProjectBuildContext(org.rstudio.studio.client.projects.model.RProjectBuildContext) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) RProjectConfig(org.rstudio.studio.client.projects.model.RProjectConfig)

Example 23 with JsArrayString

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

the class ProjectSourceControlPreferencesPane method initialize.

@Override
protected void initialize(RProjectOptions options) {
    // save the context
    vcsContext_ = options.getVcsContext();
    // populate the vcs selections list
    String[] vcsSelections = new String[] { NONE };
    JsArrayString applicableVcs = vcsContext_.getApplicableVcs();
    if (applicableVcs.length() > 0) {
        vcsSelections = new String[applicableVcs.length() + 1];
        vcsSelections[0] = NONE;
        for (int i = 0; i < applicableVcs.length(); i++) vcsSelections[i + 1] = applicableVcs.get(i);
    }
    vcsSelect_.setChoices(vcsSelections);
    // set override or default
    RProjectVcsOptions vcsOptions = options.getVcsOptions();
    if (vcsOptions.getActiveVcsOverride().length() > 0)
        setVcsSelection(vcsOptions.getActiveVcsOverride());
    else
        setVcsSelection(vcsContext_.getDetectedVcs());
}
Also used : RProjectVcsOptions(org.rstudio.studio.client.projects.model.RProjectVcsOptions) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 24 with JsArrayString

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

the class ManipulatorPopupPanel method update.

public void update(Manipulator manipulator) {
    mainPanel_.clear();
    if (manipulator != null && manipulator.getVariables() != null) {
        // iterate over the variables
        JsArrayString variables = manipulator.getVariables();
        for (int i = 0; i < variables.length(); i++) {
            String variable = variables.get(i);
            try {
                ManipulatorControl addedControl = null;
                Manipulator.Control control = manipulator.getControl(variable);
                switch(control.getType()) {
                    case Manipulator.Control.SLIDER:
                        Manipulator.Slider slider = control.cast();
                        addedControl = addSliderControl(variable, manipulator.getDoubleValue(variable), slider);
                        break;
                    case Manipulator.Control.PICKER:
                        Manipulator.Picker picker = control.cast();
                        addedControl = addPickerControl(variable, manipulator.getStringValue(variable), picker);
                        break;
                    case Manipulator.Control.CHECKBOX:
                        Manipulator.CheckBox checkBox = control.cast();
                        addedControl = addCheckBoxControl(variable, manipulator.getBooleanValue(variable), checkBox);
                        break;
                    case Manipulator.Control.BUTTON:
                        Manipulator.Button button = control.cast();
                        addedControl = addButtonControl(variable, button);
                        break;
                }
                // save reference to first control (for setting focus)
                if (i == 0)
                    firstControl_ = addedControl;
            } catch (Throwable e) {
                Debug.log("WARNING: exception occurred during addition of " + "variable " + variable + ", " + e.getMessage());
            }
        }
    }
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) Manipulator(org.rstudio.studio.client.workbench.views.plots.model.Manipulator)

Example 25 with JsArrayString

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

the class Source method openProjectDocs.

private void openProjectDocs(final Session session) {
    JsArrayString openDocs = session.getSessionInfo().getProjectOpenDocs();
    if (openDocs.length() > 0) {
        // set new tab pending for the duration of the continuation
        newTabPending_++;
        // create a continuation for opening the source docs
        SerializedCommandQueue openCommands = new SerializedCommandQueue();
        for (int i = 0; i < openDocs.length(); i++) {
            String doc = openDocs.get(i);
            final FileSystemItem fsi = FileSystemItem.createFile(doc);
            openCommands.addCommand(new SerializedCommand() {

                @Override
                public void onExecute(final Command continuation) {
                    openFile(fsi, fileTypeRegistry_.getTextTypeForFile(fsi), new CommandWithArg<EditingTarget>() {

                        @Override
                        public void execute(EditingTarget arg) {
                            continuation.execute();
                        }
                    });
                }
            });
        }
        // decrement newTabPending and select first tab when done
        openCommands.addCommand(new SerializedCommand() {

            @Override
            public void onExecute(Command continuation) {
                newTabPending_--;
                onFirstTab();
                continuation.execute();
            }
        });
        // execute the continuation
        openCommands.run();
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) Command(com.google.gwt.user.client.Command) AppCommand(org.rstudio.core.client.command.AppCommand) TextEditingTarget(org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget) EditingTarget(org.rstudio.studio.client.workbench.views.source.editors.EditingTarget) DataEditingTarget(org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget) CodeBrowserEditingTarget(org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserEditingTarget) JsArrayString(com.google.gwt.core.client.JsArrayString) JSONString(com.google.gwt.json.client.JSONString) 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