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