Search in sources :

Example 1 with ShowPublicKeyDialog

use of org.rstudio.studio.client.common.vcs.ShowPublicKeyDialog 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)

Aggregations

Handler (org.rstudio.core.client.command.Handler)1 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)1 GlobalProgressDelayer (org.rstudio.studio.client.common.GlobalProgressDelayer)1 ShowPublicKeyDialog (org.rstudio.studio.client.common.vcs.ShowPublicKeyDialog)1 ServerError (org.rstudio.studio.client.server.ServerError)1 VcsRefreshHandler (org.rstudio.studio.client.workbench.views.vcs.common.events.VcsRefreshHandler)1