Search in sources :

Example 21 with Handler

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);
    }
}
Also used : InputEditorPosition(org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorPosition) Position(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position) Handler(org.rstudio.core.client.command.Handler) ChangeFontSizeHandler(org.rstudio.studio.client.application.events.ChangeFontSizeHandler) RecordNavigationPositionHandler(org.rstudio.studio.client.workbench.views.source.events.RecordNavigationPositionHandler) EnsureHeightHandler(org.rstudio.core.client.events.EnsureHeightHandler) EnsureVisibleHandler(org.rstudio.core.client.events.EnsureVisibleHandler) HideMessageHandler(org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBar.HideMessageHandler) FileChangeHandler(org.rstudio.studio.client.workbench.views.files.events.FileChangeHandler)

Example 22 with Handler

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));
}
Also used : InputEditorPosition(org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorPosition) Position(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position) Handler(org.rstudio.core.client.command.Handler) ChangeFontSizeHandler(org.rstudio.studio.client.application.events.ChangeFontSizeHandler) RecordNavigationPositionHandler(org.rstudio.studio.client.workbench.views.source.events.RecordNavigationPositionHandler) EnsureHeightHandler(org.rstudio.core.client.events.EnsureHeightHandler) EnsureVisibleHandler(org.rstudio.core.client.events.EnsureVisibleHandler) HideMessageHandler(org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBar.HideMessageHandler) FileChangeHandler(org.rstudio.studio.client.workbench.views.files.events.FileChangeHandler)

Example 23 with Handler

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);
        }
    });
}
Also used : RpcObjectList(org.rstudio.core.client.jsonrpc.RpcObjectList) ArrayList(java.util.ArrayList) HistoryEntry(org.rstudio.studio.client.workbench.views.history.model.HistoryEntry) JsArrayString(com.google.gwt.core.client.JsArrayString) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ConsoleResetHistoryHandler(org.rstudio.studio.client.workbench.views.console.events.ConsoleResetHistoryHandler) SelectionCommitHandler(org.rstudio.core.client.events.SelectionCommitHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) HistoryEntriesAddedHandler(org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedHandler) FetchCommandsHandler(org.rstudio.studio.client.workbench.views.history.events.FetchCommandsHandler) Handler(org.rstudio.core.client.command.Handler)

Example 24 with Handler

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);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) JsArrayNumber(com.google.gwt.core.client.JsArrayNumber) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ConsoleResetHistoryHandler(org.rstudio.studio.client.workbench.views.console.events.ConsoleResetHistoryHandler) SelectionCommitHandler(org.rstudio.core.client.events.SelectionCommitHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) HistoryEntriesAddedHandler(org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedHandler) FetchCommandsHandler(org.rstudio.studio.client.workbench.views.history.events.FetchCommandsHandler) Handler(org.rstudio.core.client.command.Handler)

Example 25 with Handler

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();
        }
    });
}
Also used : Command(com.google.gwt.user.client.Command) Handler(org.rstudio.core.client.command.Handler)

Aggregations

Handler (org.rstudio.core.client.command.Handler)55 ChangeFontSizeHandler (org.rstudio.studio.client.application.events.ChangeFontSizeHandler)20 EnsureHeightHandler (org.rstudio.core.client.events.EnsureHeightHandler)19 EnsureVisibleHandler (org.rstudio.core.client.events.EnsureVisibleHandler)19 FileChangeHandler (org.rstudio.studio.client.workbench.views.files.events.FileChangeHandler)18 HideMessageHandler (org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBar.HideMessageHandler)18 RecordNavigationPositionHandler (org.rstudio.studio.client.workbench.views.source.events.RecordNavigationPositionHandler)18 JsArrayString (com.google.gwt.core.client.JsArrayString)12 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)12 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)11 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)10 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)9 CloseHandler (com.google.gwt.event.logical.shared.CloseHandler)8 SelectionHandler (com.google.gwt.event.logical.shared.SelectionHandler)8 Command (com.google.gwt.user.client.Command)8 ServerError (org.rstudio.studio.client.server.ServerError)7 InputEditorPosition (org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorPosition)7 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)6 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)6 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)6