From 75a403ec13c5226762c64ff5635a4c12bf1b6f6e Mon Sep 17 00:00:00 2001 From: Aleksandr Krasilnikov Date: Thu, 4 Jul 2019 13:22:16 +0300 Subject: [PATCH] github: GithubCredentialsUI: cleanup formatting GitOrigin-RevId: 66645a67a901d1e038b43076d4ed9759fe218844 --- .../authentication/ui/GithubCredentialsUI.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubCredentialsUI.kt b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubCredentialsUI.kt index 3bcd150819db..b302cef94843 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubCredentialsUI.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubCredentialsUI.kt @@ -98,13 +98,10 @@ sealed class GithubCredentialsUI { override fun handleAcquireError(error: Throwable): ValidationInfo { return when (error) { - is LoginNotUniqueException -> ValidationInfo( - "Account already added", loginTextField).withOKEnabled() + is LoginNotUniqueException -> ValidationInfo("Account already added", loginTextField).withOKEnabled() is UnknownHostException -> ValidationInfo("Server is unreachable").withOKEnabled() - is GithubAuthenticationException -> ValidationInfo( - "Incorrect credentials. ${error.message.orEmpty()}").withOKEnabled() - is GithubParseException -> ValidationInfo( - error.message ?: "Invalid server path", serverTextField) + is GithubAuthenticationException -> ValidationInfo("Incorrect credentials. ${error.message.orEmpty()}").withOKEnabled() + is GithubParseException -> ValidationInfo(error.message ?: "Invalid server path", serverTextField) else -> ValidationInfo("Invalid authentication data.\n ${error.message}").withOKEnabled() } } @@ -151,9 +148,7 @@ sealed class GithubCredentialsUI { DialogValidationUtils.notBlank(tokenTextField, "Token cannot be empty") } - override fun createExecutor(): GithubApiRequestExecutor { - return factory.create(tokenTextField.text) - } + override fun createExecutor() = factory.create(tokenTextField.text) override fun acquireLoginAndToken(server: GithubServerPath, executor: GithubApiRequestExecutor, @@ -185,13 +180,10 @@ sealed class GithubCredentialsUI { override fun handleAcquireError(error: Throwable): ValidationInfo { return when (error) { - is LoginNotUniqueException -> ValidationInfo( - "Account ${error.login} already added").withOKEnabled() + is LoginNotUniqueException -> ValidationInfo("Account ${error.login} already added").withOKEnabled() is UnknownHostException -> ValidationInfo("Server is unreachable").withOKEnabled() - is GithubAuthenticationException -> ValidationInfo( - "Incorrect credentials. ${error.message.orEmpty()}").withOKEnabled() - is GithubParseException -> ValidationInfo( - error.message ?: "Invalid server path", serverTextField) + is GithubAuthenticationException -> ValidationInfo("Incorrect credentials. ${error.message.orEmpty()}").withOKEnabled() + is GithubParseException -> ValidationInfo(error.message ?: "Invalid server path", serverTextField) else -> ValidationInfo("Invalid authentication data.\n ${error.message}").withOKEnabled() } }