true if and only if visible
* @see Component#isVisible
@@ -1860,7 +1864,7 @@ public abstract class DialogWrapper {
if (info.component != null && info.component.isVisible()) {
IdeFocusManager.getInstance(null).requestFocus(info.component, true);
}
- DialogEarthquakeShaker.shake((JDialog)getPeer().getWindow());
+ DialogEarthquakeShaker.shake(getPeer().getWindow());
startTrackingValidation();
return;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt b/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt
deleted file mode 100644
index 9790d75fa561..000000000000
--- a/platform/platform-api/src/com/intellij/openapi/ui/dialogBuilder.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2000-2016 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.ui
-
-import com.intellij.openapi.project.Project
-import java.awt.Component
-import javax.swing.JComponent
-
-fun dialog(title: String,
- centerPanel: JComponent,
- resizable: Boolean = false,
- preferedFocusComponent: JComponent? = null,
- okActionEnabled: Boolean = true,
- project: Project? = null,
- parent: Component? = null,
- ok: (() -> Unit)? = null): DialogBuilder {
- val builder = if (parent == null) DialogBuilder(project) else DialogBuilder(parent)
- builder
- .title(title)
- .centerPanel(centerPanel)
- .setPreferredFocusComponent(preferedFocusComponent)
- 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/text/string.kt b/platform/platform-api/src/com/intellij/util/text/string.kt
index 75a4c4b94249..5f4939937120 100644
--- a/platform/platform-api/src/com/intellij/util/text/string.kt
+++ b/platform/platform-api/src/com/intellij/util/text/string.kt
@@ -19,4 +19,6 @@ import com.intellij.openapi.util.text.StringUtil
fun String?.nullize(nullizeSpaces: Boolean = false): String? = StringUtil.nullize(this, nullizeSpaces)
-fun String.trimMiddle(maxLength: Int): String? = StringUtil.trimMiddle(this, maxLength)
\ No newline at end of file
+fun String.trimMiddle(maxLength: Int): String? = StringUtil.trimMiddle(this, maxLength)
+
+fun CharArray.nullize() = if (isEmpty()) null else this
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/JetBrainsAccountDialog.kt b/platform/platform-impl/src/com/intellij/diagnostic/JetBrainsAccountDialog.kt
index 50f0c65319fd..a54a237752f2 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/JetBrainsAccountDialog.kt
+++ b/platform/platform-impl/src/com/intellij/diagnostic/JetBrainsAccountDialog.kt
@@ -21,45 +21,41 @@ import com.intellij.credentialStore.Credentials
import com.intellij.ide.BrowserUtil
import com.intellij.ide.passwordSafe.PasswordSafe
import com.intellij.openapi.project.Project
-import com.intellij.openapi.ui.DialogBuilder
-import com.intellij.openapi.ui.dialog
-import com.intellij.ui.components.JBCheckBox
+import com.intellij.openapi.ui.DialogWrapper
+import com.intellij.ui.components.CheckBox
+import com.intellij.ui.components.dialog
import com.intellij.ui.layout.*
-import com.intellij.ui.layout.CCFlags.*
-import com.intellij.ui.layout.LCFlags.*
import com.intellij.util.io.encodeUrlQueryParameter
import java.awt.Component
import javax.swing.JPasswordField
import javax.swing.JTextField
@JvmOverloads
-fun showJetBrainsAccountDialog(parent: Component, project: Project? = null): DialogBuilder {
+fun showJetBrainsAccountDialog(parent: Component, project: Project? = null): DialogWrapper {
val credentials = ErrorReportConfigurable.getCredentials()
val userField = JTextField(credentials?.userName)
val passwordField = JPasswordField(credentials?.password?.toString())
// if no user name - never stored and so, defaults to remember. if user name set, but no password, so, previously was stored without password
- val rememberCheckBox = JBCheckBox(CommonBundle.message("checkbox.remember.password"), credentials?.userName == null || !credentials?.password.isNullOrEmpty())
+ val rememberCheckBox = CheckBox(CommonBundle.message("checkbox.remember.password"), selected = credentials?.userName == null || !credentials?.password.isNullOrEmpty())
- val panel = panel(fillX) {
- label("Login to JetBrains Account to get notified when the submitted\nexceptions are fixed.", span, wrap)
- label("Username:")
- userField(grow, wrap)
-
- label("Password:")
- passwordField(grow, wrap)
- rememberCheckBox(skip, split, grow)
- link("Forgot password?", wrap, right) {
- BrowserUtil.browse("https://account.jetbrains.com/forgot-password?username=${userField.text.trim().encodeUrlQueryParameter()}")
+ val panel = panel() {
+ noteRow("Login to JetBrains Account to get notified when the submitted\nexceptions are fixed.")
+ row("Username:") { userField() }
+ row("Password:") { passwordField() }
+ row {
+ rememberCheckBox()
+ right {
+ link("Forgot password?") { BrowserUtil.browse("https://account.jetbrains.com/forgot-password?username=${userField.text.trim().encodeUrlQueryParameter()}") }
+ }
}
-
- note("""Do not have an account? Sign Up""", span, wrap)
+ noteRow("""Do not have an account? Sign Up""")
}
return dialog(
title = DiagnosticBundle.message("error.report.title"),
- centerPanel = panel,
- preferedFocusComponent = if (credentials?.userName == null) userField else passwordField,
+ panel = panel,
+ focusedComponent = if (credentials?.userName == null) userField else passwordField,
project = project,
parent = if (parent.isShowing) parent else null) {
val userName = userField.text
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
index 74f338d089d5..4415a54c9205 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/ui/PasswordSafePromptDialog.java
@@ -15,144 +15,65 @@
*/
package com.intellij.ide.passwordSafe.ui;
-import com.intellij.credentialStore.Credentials;
-import com.intellij.ide.passwordSafe.PasswordSafe;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
+import com.intellij.credentialStore.CredentialAttributes;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.util.Ref;
-import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import javax.swing.*;
-
import static com.intellij.credentialStore.CredentialAttributesKt.CredentialAttributes;
/**
* The generic password dialog. Use it to ask a password from user with option to remember it.
*/
-public class PasswordSafePromptDialog extends DialogWrapper {
- private final PasswordPromptComponent myComponent;
-
- private PasswordSafePromptDialog(@Nullable Project project, @NotNull String title, @NotNull PasswordPromptComponent component) {
- super(project, true);
-
- setTitle(title);
- myComponent = component;
- setResizable(false);
- init();
- }
-
- @Override
- protected JComponent createCenterPanel() {
- return myComponent.getComponent();
- }
-
- @Override
- public JComponent getPreferredFocusedComponent() {
- return myComponent.getPreferredFocusedComponent();
- }
-
+public class PasswordSafePromptDialog {
/**
- * Ask password possibly asking password database first. The method could be invoked from any thread. If UI needs to be shown,
- * the method invokes {@link UIUtil#invokeAndWaitIfNeeded(Runnable)}
* @param project the context project
* @param title the dialog title
* @param message the message describing a resource for which password is asked
* @param requestor the password requestor
* @param key the password key
* @param resetPassword if true, the old password is removed from database and new password will be asked.
- * @param error the error to show in the dialog @return null if dialog was cancelled or password (stored in database or a entered by user)
- */
- @Nullable
- public static String askPassword(final Project project,
- final String title,
- final String message,
- @NotNull final Class> requestor,
- final String key,
- boolean resetPassword, String error) {
- return askPassword(project, title, message, requestor, key, resetPassword, error, null);
- }
-
- /**
- * Ask password possibly asking password database first. The method could be invoked from any thread. If UI needs to be shown,
- * the method invokes {@link UIUtil#invokeAndWaitIfNeeded(Runnable)}
- *
- * @param title the dialog title
- * @param message the message describing a resource for which password is asked
- * @param requestor the password requestor
- * @param key the password key
- * @param resetPassword if true, the old password is removed from database and new password will be asked.
+ * @param error the error to show in the dialog
* @return null if dialog was cancelled or password (stored in database or a entered by user)
*/
@Nullable
- public static String askPassword(final String title,
- final String message,
- @NotNull final Class> requestor,
- final String key,
- boolean resetPassword) {
- return askPassword(null, title, message, requestor, key, resetPassword, null);
+ public static String askPassword(@Nullable Project project,
+ String title,
+ String message,
+ @NotNull Class> requestor,
+ String key,
+ boolean resetPassword,
+ String error) {
+ return CredentialPromtKt.askPassword(project, title, message, CredentialAttributes(requestor, key), resetPassword, error);
+ }
+
+ /**
+ * @param dialogTitle The dialog title
+ * @param passwordFieldLabel The password field label, describing a resource, for which password is asked
+ * @return null if dialog was cancelled or password (stored in database or a entered by user)
+ */
+ @Nullable
+ public static String askPassword(@NotNull String dialogTitle, @NotNull String passwordFieldLabel, @NotNull CredentialAttributes credentialAttributes) {
+ return CredentialPromtKt.askPassword(null, dialogTitle, passwordFieldLabel, credentialAttributes);
}
/**
- * Ask passphrase possibly asking password database first. The method could be invoked from any thread. If UI needs to be shown,
- * the method invokes {@link UIUtil#invokeAndWaitIfNeeded(Runnable)}
- * @param project the context project (might be null)
- * @param title the dialog title
- * @param message the message describing a resource for which password is asked
- * @param requestor the password requestor
- * @param key the password key
+ * @param project The context project (might be null)
+ * @param dialogTitle The dialog title
+ * @param passwordFieldLabel the message describing a resource for which password is asked
* @param resetPassword if true, the old password is removed from database and new password will be asked.
- * @param error the error to show in the dialog @return null if dialog was cancelled or password (stored in database or a entered by user)
+ * @param error the error to show in the dialog
+ * @return null if dialog was cancelled or password (stored in database or a entered by user)
*/
@Nullable
- public static String askPassphrase(final Project project,
- final String title,
- final String message,
- @NotNull final Class> requestor,
- final String key,
+ public static String askPassword(@Nullable Project project,
+ String dialogTitle,
+ @NotNull String passwordFieldLabel,
+ @NotNull CredentialAttributes credentialAttributes,
boolean resetPassword,
String error) {
- return askPassword(project, title, message, requestor, key, resetPassword, error, "Passphrase:");
- }
-
- @Nullable
- private static String askPassword(Project project,
- String title,
- String message,
- @NotNull Class> requestor,
- String accountName,
- boolean resetPassword,
- String error,
- String promptLabel) {
- PasswordSafe ps = PasswordSafe.getInstance();
- if (resetPassword) {
- ps.set(CredentialAttributes(requestor, accountName), null);
- }
- else {
- String pw = ps.getPassword(requestor, accountName);
- if (pw != null) {
- return pw;
- }
- }
-
- RefSome configured Git VCS roots are not under Git or have Git repositories in subdirectories without a configured VCS root. Configure.
select.branch.to.checkout=Select branch to checkout show.all.paths.affected.action.name=Show All Affected Paths -ssh.ask.passphrase.title=SSH Key Passphrase -ssh.askPassphrase.message=Please enter passphrase for the private key {0} (the user name is {1}) ssh.changed.host.key=The server host key for the host {0}:{1} has changed to {2} (type {3}).\nDo you want to accept the changed key? ssh.confirm.key.titile=Confirm SSH Server Key ssh.error.title=Authentication error diff --git a/plugins/settings-repository/resources/messages/IcsBundle.properties b/plugins/settings-repository/resources/messages/IcsBundle.properties index 10c2767d7351..0147c44bf099 100644 --- a/plugins/settings-repository/resources/messages/IcsBundle.properties +++ b/plugins/settings-repository/resources/messages/IcsBundle.properties @@ -38,5 +38,4 @@ login.other.git.provider.note=Consider to configure ("ics", icsMessage("ics.settings"), "reference.settings.ics") { @@ -56,7 +55,7 @@ internal class IcsConfigurableUi : ConfigurableUi