Search in sources :

Example 1 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class Workbench method onVersionControlShowRsaKey.

@Handler
public void onVersionControlShowRsaKey() {
    final ProgressIndicator indicator = new GlobalProgressDelayer(globalDisplay_, 500, "Reading RSA public key...").getIndicator();
    // compute path to public key
    String sshDir = session_.getSessionInfo().getDefaultSSHKeyDir();
    final String keyPath = FileSystemItem.createDir(sshDir).completePath("id_rsa.pub");
    // read it
    server_.gitSshPublicKey(keyPath, new ServerRequestCallback<String>() {

        @Override
        public void onResponseReceived(String publicKeyContents) {
            indicator.onCompleted();
            new ShowPublicKeyDialog("RSA Public Key", publicKeyContents).showModal();
        }

        @Override
        public void onError(ServerError error) {
            String msg = "Error attempting to read key '" + keyPath + "' (" + error.getUserMessage() + ")";
            indicator.onError(msg);
        }
    });
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ShowPublicKeyDialog(org.rstudio.studio.client.common.vcs.ShowPublicKeyDialog) ServerError(org.rstudio.studio.client.server.ServerError) GlobalProgressDelayer(org.rstudio.studio.client.common.GlobalProgressDelayer) Handler(org.rstudio.core.client.command.Handler) VcsRefreshHandler(org.rstudio.studio.client.workbench.views.vcs.common.events.VcsRefreshHandler)

Example 2 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class TextEditingTarget method onExecuteToCurrentLine.

@Handler
void onExecuteToCurrentLine() {
    docDisplay_.focus();
    int row = docDisplay_.getSelectionEnd().getRow();
    int col = docDisplay_.getLength(row);
    codeExecution_.executeRange(Range.fromPoints(Position.create(0, 0), Position.create(row, col)));
}
Also used : Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint) 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 3 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class ViewerPresenter method onViewerSaveAsWebPage.

@Handler
public void onViewerSaveAsWebPage() {
    display_.bringToFront();
    if (saveAsWebPageDefaultPath_ == null)
        saveAsWebPageDefaultPath_ = workbenchContext_.getCurrentWorkingDir();
    dependencyManager_.withRMarkdown("Saving standalone web pages", new Command() {

        @Override
        public void execute() {
            fileDialogs_.saveFile("Save As Web Page", fileSystemContext_, saveAsWebPageDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {

                @Override
                public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
                    if (targetFile == null) {
                        indicator.onCompleted();
                        return;
                    }
                    indicator.onProgress("Saving as web page...");
                    server_.viewerSaveAsWebPage(targetFile.getPath(), new VoidServerRequestCallback(indicator) {

                        @Override
                        public void onSuccess() {
                            saveAsWebPageDefaultPath_ = targetFile.getParentPath();
                        }
                    });
                }
            });
        }
    });
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) AppCommand(org.rstudio.core.client.command.AppCommand) Command(com.google.gwt.user.client.Command) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ProgressOperationWithInput(org.rstudio.core.client.widget.ProgressOperationWithInput) EnabledChangedHandler(org.rstudio.core.client.command.EnabledChangedHandler) Handler(org.rstudio.core.client.command.Handler)

Example 4 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class Projects method onShowDiagnosticsProject.

@Handler
public void onShowDiagnosticsProject() {
    final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Lint");
    indicator.onProgress("Analyzing project sources...");
    projServer_.analyzeProject(new ServerRequestCallback<Void>() {

        @Override
        public void onResponseReceived(Void response) {
            indicator.onCompleted();
        }

        @Override
        public void onError(ServerError error) {
            Debug.logError(error);
            indicator.onCompleted();
        }
    });
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) Void(org.rstudio.studio.client.server.Void) OpenProjectErrorHandler(org.rstudio.studio.client.projects.events.OpenProjectErrorHandler) SessionInitHandler(org.rstudio.studio.client.workbench.events.SessionInitHandler) Handler(org.rstudio.core.client.command.Handler) SwitchToProjectHandler(org.rstudio.studio.client.projects.events.SwitchToProjectHandler) OpenProjectFileHandler(org.rstudio.studio.client.projects.events.OpenProjectFileHandler) OpenProjectNewWindowHandler(org.rstudio.studio.client.projects.events.OpenProjectNewWindowHandler)

Example 5 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class HTMLPreviewPresenter method onSaveHtmlPreviewAsLocalFile.

@Handler
public void onSaveHtmlPreviewAsLocalFile() {
    if (lastSuccessfulPreview_ != null) {
        final FileSystemItem htmlFile = FileSystemItem.createFile(lastSuccessfulPreview_.getHtmlFile());
        pFileExport_.get().export("Download to Local File", "web page", htmlFile);
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) CloseHandler(com.google.gwt.event.logical.shared.CloseHandler) 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