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;
}
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);
}
}
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());
}
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());
}
}
}
}
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();
}
}
Aggregations