if (Desktop.isDesktop())
{
if (Desktop.getFrame().canChooseRVersion())
{
rVersion_ = new TextBoxWithButton(
"R version:",
"Change...",
new ClickHandler()
{
public void onClick(ClickEvent event)
{
String ver = Desktop.getFrame().chooseRVersion();
if (!StringUtil.isNullOrEmpty(ver))
{
rVersion_.setText(ver);
globalDisplay.showMessage(MessageDialog.INFO,
"Change R Version",
"You need to quit and re-open RStudio " +
"in order for this change to take effect.");
}
}
});
rVersion_.setWidth("100%");
rVersion_.setText(Desktop.getFrame().getRVersion());
spaced(rVersion_);
add(rVersion_);
}
}
Label defaultLabel = new Label("Default working directory (when not in a project):");
nudgeRight(defaultLabel);
add(tight(defaultLabel));
add(dirChooser_ = new DirectoryChooserTextBox(null,
null,
fileDialogs_,
fsContext_));
spaced(dirChooser_);
nudgeRight(dirChooser_);
textBoxWithChooser(dirChooser_);
restoreLastProject_ = new CheckBox("Restore most recently opened project at startup");
lessSpaced(restoreLastProject_);
add(restoreLastProject_);
add(checkboxPref("Restore previously open source documents at startup", prefs_.restoreSourceDocuments()));
add(loadRData_ = new CheckBox("Restore .RData into workspace at startup"));
lessSpaced(loadRData_);
saveWorkspace_ = new SelectWidget(
"Save workspace to .RData on exit:",
new String[] {
"Always",
"Never",
"Ask"
});
spaced(saveWorkspace_);
add(saveWorkspace_);
alwaysSaveHistory_ = new CheckBox(
"Always save history (even when not saving .RData)");
lessSpaced(alwaysSaveHistory_);
add(alwaysSaveHistory_);
removeHistoryDuplicates_ = new CheckBox(
"Remove duplicate entries in history");
spaced(removeHistoryDuplicates_);
add(removeHistoryDuplicates_);
rProfileOnResume_ = new CheckBox("Run Rprofile when resuming suspended session");
spaced(rProfileOnResume_);
if (!Desktop.isDesktop())
add(rProfileOnResume_);
// The error handler features require source references; if this R
// version doesn't support them, don't show these options.
if (session_.getSessionInfo().getHaveSrcrefAttribute())
{
add(checkboxPref(
"Use debug error handler only when my code contains errors",
prefs_.handleErrorsInUserCodeOnly()));
CheckBox chkTracebacks = checkboxPref(
"Automatically expand tracebacks in error inspector",
prefs_.autoExpandErrorTracebacks());
chkTracebacks.getElement().getStyle().setMarginBottom(15, Unit.PX);
add(chkTracebacks);
}
encodingValue_ = prefs_.defaultEncoding().getGlobalValue();
add(encoding_ = new TextBoxWithButton(
"Default text encoding:",
"Change...",
new ClickHandler()
{
public void onClick(ClickEvent event)