Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-05-27 18:16:45 +0000
committerslewis2007-05-27 18:16:45 +0000
commitb2a351008aeac444d5047bdaac8953091e1593b2 (patch)
tree4d2c40497363636128cd971eb3617e6e797ba701 /providers/bundles/org.eclipse.ecf.provider.irc.ui
parenta3d9348311a0b5bf2a2e6b8fc75edcccf627426b (diff)
downloadorg.eclipse.ecf-b2a351008aeac444d5047bdaac8953091e1593b2.tar.gz
org.eclipse.ecf-b2a351008aeac444d5047bdaac8953091e1593b2.tar.xz
org.eclipse.ecf-b2a351008aeac444d5047bdaac8953091e1593b2.zip
Added support for storing password after successful login.
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.irc.ui')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/META-INF/MANIFEST.MF3
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizard.java22
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizardPage.java47
3 files changed, 55 insertions, 17 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.irc.ui/META-INF/MANIFEST.MF
index 12a3a7323..92a3085df 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ecf.presence,
org.eclipse.ecf.presence.ui,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.eclipse.ecf.provider.irc
Eclipse-LazyStart: true
Export-Package: org.eclipse.ecf.internal.irc.ui;x-internal:=true,
org.eclipse.ecf.internal.irc.ui.wizards;x-internal:=true
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizard.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizard.java
index d146cc3af..6917da072 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizard.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizard.java
@@ -22,6 +22,7 @@ import org.eclipse.ecf.presence.chatroom.IChatRoomManager;
import org.eclipse.ecf.ui.IConnectWizard;
import org.eclipse.ecf.ui.actions.AsynchContainerConnectAction;
import org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog;
+import org.eclipse.ecf.ui.util.PasswordCacheHelper;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IWorkbench;
@@ -59,11 +60,12 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard {
public boolean performFinish() {
+ final String connectID = page.getConnectID();
+ final String password = page.getPassword();
+
connectContext = ConnectContextFactory
- .createPasswordConnectContext(page.getPassword());
+ .createPasswordConnectContext(password);
- String connectID = "irc://"+page.getConnectID();
-
page.saveComboText();
try {
@@ -82,12 +84,22 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard {
// If it's not already connected, then we connect this new container
if (!ui.isContainerConnected()) {
page.saveComboItems();
- new AsynchContainerConnectAction(this.container, this.targetID,
- this.connectContext).run();
+ new AsynchContainerConnectAction(container, targetID, connectContext, null, new Runnable() {
+ public void run() {
+ cachePassword(connectID,password);
+ }}).run();
+
}
return true;
}
+ protected void cachePassword(final String connectID, String password) {
+ if (password != null && !password.equals("")) {
+ PasswordCacheHelper pwStorage = new PasswordCacheHelper(connectID);
+ pwStorage.savePassword(password);
+ }
+ }
+
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizardPage.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizardPage.java
index 7d4b7379b..0c06d2bff 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizardPage.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/wizards/IRCConnectWizardPage.java
@@ -17,11 +17,14 @@ import java.util.List;
import org.eclipse.ecf.internal.irc.ui.Activator;
import org.eclipse.ecf.internal.irc.ui.Messages;
import org.eclipse.ecf.ui.SharedImages;
+import org.eclipse.ecf.ui.util.PasswordCacheHelper;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
@@ -50,6 +53,27 @@ final class IRCConnectWizardPage extends WizardPage {
this.authorityAndPath = authorityAndPath;
}
+ private void verify() {
+ String text = connectText.getText();
+ passwordText.setText("");
+ if (text.equals("")) { //$NON-NLS-1$
+ updateStatus(Messages.IRCConnectWizardPage_STATUS_MESSAGE_EMPTY);
+ } else if (text.indexOf('@') == -1) {
+ updateStatus(Messages.IRCConnectWizardPage_STATUS_MESSAGE_MALFORMED);
+ } else {
+ updateStatus(null);
+ restorePassword(text);
+ }
+ }
+
+ protected void restorePassword(String username) {
+ PasswordCacheHelper pwStorage = new PasswordCacheHelper(username);
+ String pw = pwStorage.retrievePassword();
+ if (pw != null) {
+ passwordText.setText(pw);
+ }
+ }
+
public void createControl(Composite parent) {
parent.setLayout(new GridLayout());
GridData fillData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -62,19 +86,17 @@ final class IRCConnectWizardPage extends WizardPage {
connectText.setLayoutData(fillData);
connectText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- String text = connectText.getText();
- if (text.equals("")) { //$NON-NLS-1$
- updateStatus(Messages.IRCConnectWizardPage_STATUS_MESSAGE_EMPTY);
- } else if (text.indexOf('@') == -1) {
- updateStatus(Messages.IRCConnectWizardPage_STATUS_MESSAGE_MALFORMED);
- } else {
- updateStatus(null);
- }
+ verify();
}
});
-
- restoreCombo();
-
+ connectText.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ verify();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ verify();
+ }});
+
label = new Label(parent, SWT.RIGHT);
label.setText(Messages.IRCConnectWizardPage_CONNECTID_EXAMPLE);
label.setLayoutData(endData);
@@ -87,8 +109,11 @@ final class IRCConnectWizardPage extends WizardPage {
label.setText(Messages.IRCConnectWizardPage_PASSWORD_INFO);
label.setLayoutData(endData);
+ restoreCombo();
+
if (authorityAndPath != null) {
connectText.setText(authorityAndPath);
+ restorePassword(authorityAndPath);
passwordText.setFocus();
}

Back to the top