Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-11-22 16:20:00 -0500
committerMatthias Sohn2018-11-25 06:36:56 -0500
commit132a185e62587c43df41a5bb2b05d8992eae2c94 (patch)
tree47b144623b5b53e9c0f6975d3132f24b305abe15
parenta6c390df5a301b6cd63e6e3a41884e45a0bddd61 (diff)
downloadegit-132a185e62587c43df41a5bb2b05d8992eae2c94.tar.gz
egit-132a185e62587c43df41a5bb2b05d8992eae2c94.tar.xz
egit-132a185e62587c43df41a5bb2b05d8992eae2c94.zip
Change LoginDialog default button label
The login dialog's default button always had the label "Save". This feels unnatural when the dialog is used for logging in; it may be fine when the dialog is used to change an existing password. Change the label to "Log in" in changeCredentials == false. To ensure this flag is always set properly when we create the buttons, remove the setter for that field and pass the value as a parameter in the constructor. Bug: 541312 Change-Id: I6df0b8f592ba3f91dbb89a83e8a0be30d5738501 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginDialog.java23
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginService.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties3
5 files changed, 21 insertions, 15 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java
index 70483c160..717f334d3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java
@@ -21,7 +21,7 @@ public class LoginDialogTester {
bot.textWithLabel(UIText.LoginDialog_user).setText(user);
bot.textWithLabel(UIText.LoginDialog_password).setText(password);
bot.checkBoxWithLabel(UIText.LoginDialog_storeInSecureStore).deselect();
- bot.button(UIText.LoginDialog_ButtonOK).click();
+ bot.button(UIText.LoginDialog_ButtonLogin).click();
}
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index a5682044b..4e03eeb8c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -4793,7 +4793,10 @@ public class UIText extends NLS {
public static String LoginDialog_user;
/** */
- public static String LoginDialog_ButtonOK;
+ public static String LoginDialog_ButtonLogin;
+
+ /** */
+ public static String LoginDialog_ButtonSave;
/** */
public static String NewRemoteDialog_ConfigurationMessage;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginDialog.java
index f7e44bb4d..26c22e550 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginDialog.java
@@ -34,6 +34,10 @@ import org.eclipse.swt.widgets.Text;
*/
class LoginDialog extends Dialog {
+ private final URIish uri;
+
+ private final boolean changeCredentials;
+
private Text user;
private Text password;
@@ -44,18 +48,19 @@ class LoginDialog extends Dialog {
private boolean storeInSecureStore;
- private final URIish uri;
-
private boolean isUserSet;
- private boolean changeCredentials = false;
-
private String oldUser;
LoginDialog(Shell shell, URIish uri) {
+ this(shell, uri, false);
+ }
+
+ LoginDialog(Shell shell, URIish uri, boolean changeCrendentials) {
super(shell);
this.uri = uri;
- isUserSet = uri.getUser() != null && uri.getUser().length() > 0;
+ this.changeCredentials = changeCrendentials;
+ isUserSet = uri.getUser() != null && !uri.getUser().isEmpty();
}
@Override
@@ -124,10 +129,6 @@ class LoginDialog extends Dialog {
super.okPressed();
}
- void setChangeCredentials(boolean changeCredentials) {
- this.changeCredentials = changeCredentials;
- }
-
public void setOldUser(String oldUser) {
this.oldUser = oldUser;
}
@@ -135,7 +136,9 @@ class LoginDialog extends Dialog {
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID,
- UIText.LoginDialog_ButtonOK, true);
+ changeCredentials ? UIText.LoginDialog_ButtonSave
+ : UIText.LoginDialog_ButtonLogin,
+ true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginService.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginService.java
index 0ba3947a8..10f39f831 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginService.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/LoginService.java
@@ -53,8 +53,7 @@ public class LoginService {
*/
public static UserPasswordCredentials changeCredentials(Shell parent,
URIish uri) {
- LoginDialog dialog = new LoginDialog(parent, uri);
- dialog.setChangeCredentials(true);
+ LoginDialog dialog = new LoginDialog(parent, uri, true);
UserPasswordCredentials oldCredentials = SecureStoreUtils
.getCredentials(uri);
if (oldCredentials != null)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index 76260ff82..c24f6238e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -1733,7 +1733,8 @@ LoginDialog_password=Password
LoginDialog_repository=Repository
LoginDialog_storeInSecureStore=Store in Secure Store
LoginDialog_user=User
-LoginDialog_ButtonOK=&Save
+LoginDialog_ButtonLogin=&Log in
+LoginDialog_ButtonSave=&Save
NewRemoteDialog_ConfigurationMessage=You need to configure the new remote for either fetch or push; you can add configuration for the other direction later
NewRemoteDialog_DialogTitle=Please enter a name for the new remote
NewRemoteDialog_FetchRadio=Configure &fetch

Back to the top