Search in sources :

Example 1 with SimpleCredentialsDialog

use of org.jetbrains.idea.svn.dialogs.SimpleCredentialsDialog in project intellij-community by JetBrains.

the class AuthenticationService method requestSshCredentials.

@Nullable
public String requestSshCredentials(@NotNull final String realm, @NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) {
    return requestCredentials(realm, StringUtil.toLowerCase(mode.toString()), () -> {
        final Ref<String> answer = new Ref<>();
        Runnable command = () -> {
            SimpleCredentialsDialog dialog = new SimpleCredentialsDialog(myVcs.getProject());
            dialog.setup(mode, realm, key, true);
            dialog.setTitle(SvnBundle.message("dialog.title.authentication.required"));
            dialog.setSaveEnabled(false);
            if (dialog.showAndGet()) {
                answer.set(dialog.getPassword());
            }
        };
        // Use ModalityState.any() as currently ssh credentials in terminal mode are requested in the thread that reads output and not in
        // the thread that started progress
        WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command, ModalityState.any());
        return answer.get();
    });
}
Also used : Ref(com.intellij.openapi.util.Ref) SimpleCredentialsDialog(org.jetbrains.idea.svn.dialogs.SimpleCredentialsDialog) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Ref (com.intellij.openapi.util.Ref)1 Nullable (org.jetbrains.annotations.Nullable)1 SimpleCredentialsDialog (org.jetbrains.idea.svn.dialogs.SimpleCredentialsDialog)1