use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class SetupChunkOptionsPopupPanel method initOptions.
@Override
protected void initOptions(final Command afterInit) {
String chunkText = getChunkText();
server_.extractChunkOptions(chunkText, new ServerRequestCallback<JsObject>() {
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
@Override
public void onResponseReceived(JsObject object) {
JsArrayString keys = object.keys();
for (String key : JsUtil.asIterable(keys)) chunkOptions_.put(key, object.getAsString(key));
afterInit.execute();
}
});
}
use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class BranchToolbarButton method onVcsRefresh.
@Override
public void onVcsRefresh(VcsRefreshEvent event) {
ToolbarPopupMenu rootMenu = getMenu();
rootMenu.setAutoHideRedundantSeparators(false);
rootMenu.clearItems();
JsArrayString branches = pVcsState_.get().getBranchInfo().getBranches();
// separate branches based on remote name
Map<String, List<String>> branchMap = new LinkedHashMap<String, List<String>>();
List<String> localBranches = new ArrayList<String>();
branchMap.put(LOCAL_BRANCHES, localBranches);
for (String branch : JsUtil.asIterable(branches)) {
if (branch.startsWith("remotes/")) {
JsArrayString parts = StringUtil.split(branch, "/");
if (parts.length() > 2) {
String remote = parts.get(1);
if (!branchMap.containsKey(remote))
branchMap.put(remote, new ArrayList<String>());
List<String> remoteBranches = branchMap.get(remote);
remoteBranches.add(branch);
}
} else {
localBranches.add(branch);
}
}
onBeforePopulateMenu(rootMenu);
populateMenu(rootMenu, branchMap);
}
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());
}
Aggregations