use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class TextEditingTarget method onGoToStartOfCurrentScope.
@Handler
void onGoToStartOfCurrentScope() {
docDisplay_.focus();
Scope scope = docDisplay_.getCurrentScope();
if (scope != null) {
Position position = Position.create(scope.getBodyStart().getRow(), scope.getBodyStart().getColumn() + 1);
docDisplay_.setCursorPosition(position);
}
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class TextEditingTarget method onExecuteCurrentSection.
@Handler
void onExecuteCurrentSection() {
docDisplay_.focus();
// Determine the current section.
docDisplay_.getScopeTree();
Scope currentSection = docDisplay_.getCurrentSection();
if (currentSection == null)
return;
// Determine the start and end of the section
Position start = currentSection.getBodyStart();
if (start == null)
start = Position.create(0, 0);
Position end = currentSection.getEnd();
if (end == null)
end = endPosition();
codeExecution_.executeRange(Range.fromPoints(start, end));
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class History method onHistoryShowContext.
@Handler
void onHistoryShowContext() {
ArrayList<Long> indexes = view_.getSelectedCommandIndexes();
if (indexes.size() != 1)
return;
final String command = view_.getSelectedCommands().get(0);
final Long min = indexes.get(0);
final long max = indexes.get(indexes.size() - 1) + 1;
final long start = Math.max(0, min - CONTEXT_LINES);
final long end = max + CONTEXT_LINES;
server_.getHistoryArchiveItems(start, end, new SimpleRequestCallback<RpcObjectList<HistoryEntry>>() {
@Override
public void onResponseReceived(RpcObjectList<HistoryEntry> response) {
ArrayList<HistoryEntry> entries = toList(response);
view_.showContext(command, entries, min - start, max - min);
}
});
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class History method onHistoryRemoveEntries.
@Handler
void onHistoryRemoveEntries() {
// get selected indexes (bail if there is no selection)
final ArrayList<Integer> selectedRowIndexes = view_.getRecentCommandsSelectedRowIndexes();
if (selectedRowIndexes.size() < 1) {
globalDisplay_.showErrorMessage("Error", "No history entries currently selected.");
return;
}
// bring view to front
view_.bringToFront();
globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Remove Entries", "Are you sure you want to remove the selected entries from " + "the history?", new ProgressOperation() {
public void execute(final ProgressIndicator indicator) {
indicator.onProgress("Removing items...");
// for each selected row index we need to calculate
// the offset from the bottom
int rowCount = view_.getRecentCommandsRowsDisplayed();
JsArrayNumber bottomIndexes = (JsArrayNumber) JsArrayNumber.createArray();
for (int i = 0; i < selectedRowIndexes.size(); i++) bottomIndexes.push(rowCount - selectedRowIndexes.get(i) - 1);
server_.removeHistoryItems(bottomIndexes, new VoidServerRequestCallback(indicator));
}
}, true);
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class SVNCommandHandler method onVcsRevert.
@Handler
void onVcsRevert() {
final ArrayList<String> paths = getPathArray();
if (paths.size() == 0)
return;
doRevert(paths, new Command() {
@Override
public void execute() {
display_.getChangelistTable().selectNextUnselectedItem();
display_.getChangelistTable().focus();
}
});
}
Aggregations