This commit is contained in:
Gregory.Shrago
2014-04-16 22:43:02 +04:00
parent f774ed3e60
commit 610d8f147a
2 changed files with 6 additions and 14 deletions
@@ -105,7 +105,11 @@ public class PasswordPromptComponent {
myPasswordField.setText(text);
}
public boolean isRememberChecked() {
public boolean isRememberSelected() {
return myRememberCheckBox.isSelected();
}
public void setRememberSelected(boolean selected) {
myRememberCheckBox.setSelected(selected);
}
}
@@ -25,9 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -72,16 +70,6 @@ public class PasswordSafePromptDialog extends DialogWrapper {
return myComponent.getPreferredFocusedComponent();
}
@Nullable
public static Pair<String, String> showUserPasswordDialog(Project project, String title, String message, String defUser) {
PasswordPromptComponent component = new PasswordPromptComponent(PasswordSafeSettings.ProviderType.DO_NOT_STORE, message, true, null, null);
component.setUserName(StringUtil.notNullize(defUser));
if (new PasswordSafePromptDialog(project, title, component).showAndGet()) {
return Pair.create(component.getUserName(), new String(component.getPassword()));
}
return 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)}
@@ -211,7 +199,7 @@ public class PasswordSafePromptDialog extends DialogWrapper {
if (d.showAndGet()) {
ref.set(new String(component.getPassword()));
try {
if (component.isRememberChecked()) {
if (component.isRememberSelected()) {
ps.storePassword(project, requestor, key, ref.get());
}
else if (!type.equals(PasswordSafeSettings.ProviderType.DO_NOT_STORE)) {