diff --git a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt index 27d55c4e8ff0..94603d24c42f 100644 --- a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt +++ b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt @@ -54,7 +54,8 @@ class Credentials(user: String?, val password: OneTimeString? = null) { fun CredentialAttributes(requestor: Class<*>, userName: String?) = CredentialAttributes(requestor.name, userName, requestor) -fun Credentials?.isFulfilled() = this != null && userName != null && password != null +fun Credentials?.isFulfilled() = this != null && userName != null && !password.isNullOrEmpty() +fun Credentials?.hasOnlyUserName() = this != null && userName != null && password.isNullOrEmpty() fun Credentials?.isEmpty() = this == null || (userName == null && password == null) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt b/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt index 3c771baaeb96..9790d75fa561 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt +++ b/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt @@ -21,21 +21,29 @@ import javax.swing.JComponent fun dialog(title: String, centerPanel: JComponent, - resizable: Boolean = true, + resizable: Boolean = false, preferedFocusComponent: JComponent? = null, okActionEnabled: Boolean = true, project: Project? = null, - parent: Component? = null): DialogBuilder { + parent: Component? = null, + ok: (() -> Unit)? = null): DialogBuilder { val builder = if (parent == null) DialogBuilder(project) else DialogBuilder(parent) builder .title(title) .centerPanel(centerPanel) .setPreferredFocusComponent(preferedFocusComponent) - if (!resizable) { - builder.resizable(false) - } + builder.resizable(resizable) if (!okActionEnabled) { builder.okActionEnabled(false) } + + if (ok != null) { + builder.setOkOperation { + if (builder.dialogWrapper.okAction.isEnabled) { + ok() + builder.dialogWrapper.close(DialogWrapper.OK_EXIT_CODE) + } + } + } return builder } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/util/net/AuthenticationForm.form b/platform/platform-api/src/com/intellij/util/net/AuthenticationForm.form index 9efc82b5b5de..a83ab08ef5f0 100644 --- a/platform/platform-api/src/com/intellij/util/net/AuthenticationForm.form +++ b/platform/platform-api/src/com/intellij/util/net/AuthenticationForm.form @@ -1,18 +1,16 @@