Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java')
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java51
1 files changed, 43 insertions, 8 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java
index 5ca332b2f7..fbf94de77e 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/security/CredentialsDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2008, 2009, 2011-2013 Eike Stepper (Berlin, Germany), CEA LIST, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Christian W. Damus (CEA LIST) - 399306
*/
package org.eclipse.net4j.util.ui.security;
@@ -67,8 +68,16 @@ public class CredentialsDialog extends BaseDialog<Viewer>
*/
public CredentialsDialog(Shell shell, String realm)
{
- super(shell, DEFAULT_SHELL_STYLE | SWT.APPLICATION_MODAL, TITLE, MESSAGE, OM.Activator.INSTANCE.getDialogSettings(), OM
- .getImageDescriptor("icons/credentials_wiz.gif"));
+ this(shell, realm, TITLE, MESSAGE);
+ }
+
+ /**
+ * @since 3.4
+ */
+ public CredentialsDialog(Shell shell, String realm, String title, String message)
+ {
+ super(shell, DEFAULT_SHELL_STYLE | SWT.APPLICATION_MODAL, title, message,
+ OM.Activator.INSTANCE.getDialogSettings(), OM.getImageDescriptor("icons/credentials_wiz.gif")); //$NON-NLS-1$
this.realm = realm;
users = loadUsers();
}
@@ -91,25 +100,41 @@ public class CredentialsDialog extends BaseDialog<Viewer>
{
super.configureShell(newShell);
+ configureShell(newShell, WIDTH, HEIGHT);
+ }
+
+ /**
+ * @since 3.4
+ */
+ protected void configureShell(Shell newShell, int width, int height)
+ {
Composite parent = newShell.getParent();
if (parent != null)
{
Rectangle bounds = parent.getBounds();
- int x = bounds.x + (bounds.width >> 1) - (WIDTH >> 1);
- int y = bounds.y + (bounds.height >> 1) - (HEIGHT >> 1);
+ int x = bounds.x + (bounds.width >> 1) - (width >> 1);
+ int y = bounds.y + (bounds.height >> 1) - (height >> 1);
- newShell.setBounds(x, y, WIDTH, HEIGHT);
+ newShell.setBounds(x, y, width, height);
}
else
{
- newShell.setSize(WIDTH, HEIGHT);
+ newShell.setSize(width, height);
}
}
@Override
protected void createUI(Composite parent)
{
+ createCredentialsArea(parent);
+ }
+
+ /**
+ * @since 3.4
+ */
+ protected Composite createCredentialsArea(Composite parent)
+ {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(2, false));
@@ -138,6 +163,8 @@ public class CredentialsDialog extends BaseDialog<Viewer>
{
passwordControl.setFocus();
}
+
+ return composite;
}
@Override
@@ -154,7 +181,7 @@ public class CredentialsDialog extends BaseDialog<Viewer>
}
String password = passwordControl.getText();
- credentials = new PasswordCredentials(userID, password.toCharArray());
+ credentials = createCredentials(userID, password.toCharArray());
users.remove(userID);
users.add(0, userID);
@@ -166,6 +193,14 @@ public class CredentialsDialog extends BaseDialog<Viewer>
/**
* @since 3.4
*/
+ protected IPasswordCredentials createCredentials(String userID, char[] password)
+ {
+ return new PasswordCredentials(userID, password);
+ }
+
+ /**
+ * @since 3.4
+ */
protected List<String> loadUsers()
{
List<String> result = new ArrayList<String>();

Back to the top