use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class PaneLayoutPreferencesPane method onApply.
@Override
public boolean onApply(RPrefs rPrefs) {
boolean restartRequired = super.onApply(rPrefs);
if (dirty_) {
JsArrayString panes = JsArrayString.createArray().cast();
panes.push(leftTop_.getValue(leftTop_.getSelectedIndex()));
panes.push(leftBottom_.getValue(leftBottom_.getSelectedIndex()));
panes.push(rightTop_.getValue(rightTop_.getSelectedIndex()));
panes.push(rightBottom_.getValue(rightBottom_.getSelectedIndex()));
JsArrayString tabSet1 = JsArrayString.createArray().cast();
for (String tab : tabSet1ModuleList_.getValue()) tabSet1.push(tab);
JsArrayString tabSet2 = JsArrayString.createArray().cast();
for (String tab : tabSet2ModuleList_.getValue()) tabSet2.push(tab);
// Determine implicit preference for console top/bottom location
// This needs to be saved so that when the user executes the
// Console on Left/Right commands we know whether to position
// the Console on the Top or Bottom
PaneConfig prevConfig = uiPrefs_.paneConfig().getGlobalValue();
boolean consoleLeftOnTop = prevConfig.getConsoleLeftOnTop();
boolean consoleRightOnTop = prevConfig.getConsoleRightOnTop();
final String kConsole = "Console";
if (panes.get(0).equals(kConsole))
consoleLeftOnTop = true;
else if (panes.get(1).equals(kConsole))
consoleLeftOnTop = false;
else if (panes.get(2).equals(kConsole))
consoleRightOnTop = true;
else if (panes.get(3).equals(kConsole))
consoleRightOnTop = false;
uiPrefs_.paneConfig().setGlobalValue(PaneConfig.create(panes, tabSet1, tabSet2, consoleLeftOnTop, consoleRightOnTop));
dirty_ = false;
}
return restartRequired;
}
use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class ClientState method putStrings.
public void putStrings(String group, String name, String[] value, int persist) {
JsArrayString array = JsArrayString.createArray().cast();
for (String v : value) array.push(v);
this.putObject(group, name, array, persist);
}
use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class AceCommandManager method getRelevantCommands.
public final JsArray<AceCommand> getRelevantCommands() {
JsObject allCommands = getCommands();
JsArray<AceCommand> filtered = JavaScriptObject.createArray().cast();
JsArrayString keys = allCommands.keys();
for (String key : JsUtil.asIterable(keys)) {
AceCommand command = allCommands.getObject(key);
String name = command.getInternalName();
if (!EXCLUDED_COMMANDS_MAP.hasKey(name)) {
filtered.push(command);
}
}
return sorted(filtered);
}
use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class ChunkContextUi method switchChunk.
@Override
public void switchChunk(String chunkType) {
if (chunk_ != null) {
DocDisplay docDisplay = target_.getDocDisplay();
Position start = chunk_.getPreamble();
Position end = chunk_.getEnd();
String chunkText = docDisplay.getTextForRange(Range.fromPoints(start, end));
JsArrayString chunkLines = StringUtil.split(chunkText, "\n");
if (chunkLines.length() > 0) {
String firstLine = chunkLines.get(0);
Position linedEnd = Position.create(start.getRow(), firstLine.length());
String newFirstLine = firstLine.replaceFirst("[, ]*engine='[a-zA-Z]+'", "");
newFirstLine = newFirstLine.replaceFirst("{[a-zA-Z]+", "{" + chunkType);
docDisplay.replaceRange(Range.fromPoints(start, linedEnd), newFirstLine);
target_.getNotebook().clearChunkOutput(chunk_);
}
}
}
use of com.google.gwt.core.client.JsArrayString in project rstudio by rstudio.
the class TextEditingTargetRenameHelper method pushProtectedNames.
private void pushProtectedNames(Position position, Scope parentScope) {
protectedNamesList_.add(new HashSet<String>());
Scope scope = editor_.getScopeAtPosition(position);
if (scope.isFunction() && scope != parentScope) {
JsArrayString argNames = ((ScopeFunction) scope).getFunctionArgs();
for (int i = 0; i < argNames.length(); i++) addProtectedName(argNames.get(i));
}
}
Aggregations