use of org.eclipse.che.plugin.ssh.key.client.SshKeyUploader in project che by eclipse.
the class SshKeyManagerPresenter method onGenerateGithubKeyClicked.
/** {@inheritDoc} */
@Override
public void onGenerateGithubKeyClicked() {
CurrentUser user = appContext.getCurrentUser();
final SshKeyUploader githubUploader = registry.getUploaders().get(GITHUB_HOST);
if (user != null && githubUploader != null) {
githubUploader.uploadKey(user.getProfile().getUserId(), new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
refreshKeys();
}
@Override
public void onFailure(Throwable exception) {
removeFailedKey(GITHUB_HOST);
}
});
} else {
notificationManager.notify(constant.failedToGenerateSshKey(), constant.sshKeysProviderNotFound(GITHUB_HOST), FAIL, FLOAT_MODE);
}
}
Aggregations