diff options
author | slewis | 2007-04-30 03:50:02 +0000 |
---|---|---|
committer | slewis | 2007-04-30 03:50:02 +0000 |
commit | c9940334ca8b8d5ab022e5171dca4f998c403dc6 (patch) | |
tree | 4f15a8d8b74759c818e0fc1da4465f7684108207 /providers/bundles/org.eclipse.ecf.provider.irc.ui | |
parent | d8d21ab6305fe74475fcead9ae7f4f356880b9f7 (diff) | |
download | org.eclipse.ecf-c9940334ca8b8d5ab022e5171dca4f998c403dc6.tar.gz org.eclipse.ecf-c9940334ca8b8d5ab022e5171dca4f998c403dc6.tar.xz org.eclipse.ecf-c9940334ca8b8d5ab022e5171dca4f998c403dc6.zip |
Simplified irc connect wizard
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.irc.ui')
3 files changed, 29 insertions, 28 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlink.java b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlink.java index 727cd601c..7a326d6e8 100644 --- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlink.java +++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/src/org/eclipse/ecf/internal/irc/ui/hyperlink/IRCHyperlink.java @@ -42,7 +42,11 @@ public class IRCHyperlink extends AbstractURLHyperlink { * @see org.eclipse.ecf.ui.hyperlink.AbstractURLHyperlink#createConnectWizard() */ protected IConnectWizard createConnectWizard() { - return new IRCConnectWizard(getURI().toString()); + URI uri = getURI(); + String authAndPath = uri.getSchemeSpecificPart(); + while (authAndPath.startsWith("/")) authAndPath = authAndPath.substring(1); + + return new IRCConnectWizard(authAndPath); } /* (non-Javadoc) 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 bd7fb2679..232f18977 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 @@ -11,12 +11,11 @@ *****************************************************************************/ package org.eclipse.ecf.internal.irc.ui.wizards; -import java.net.URI; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ecf.core.IContainer; import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.identity.IDCreateException; import org.eclipse.ecf.core.identity.IDFactory; import org.eclipse.ecf.core.security.ConnectContextFactory; import org.eclipse.ecf.core.security.IConnectContext; @@ -48,10 +47,8 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard { private IConnectContext connectContext; - private String uriString = null; + private String authorityAndPath = null; - private String guestUser = DEFAULT_GUEST_USER; - private IExceptionHandler exceptionHandler = new IExceptionHandler() { public IStatus handleException(final Throwable exception) { if (exception != null) { @@ -72,13 +69,13 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard { super(); } - public IRCConnectWizard(String uri) { + public IRCConnectWizard(String authorityAndPart) { super(); - uriString = uri; + this.authorityAndPath = authorityAndPart; } public void addPages() { - page = new IRCConnectWizardPage(uriString); + page = new IRCConnectWizardPage(authorityAndPath); addPage(page); } @@ -91,13 +88,13 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard { connectContext = ConnectContextFactory .createPasswordConnectContext(page.getPassword()); + String connectID = "irc://"+page.getConnectID(); try { - URI uri = new URI(page.getConnectID()); targetID = IDFactory.getDefault().createID( - container.getConnectNamespace(), page.getConnectID()); - } catch (Exception e) { + container.getConnectNamespace(), connectID); + } catch (IDCreateException e) { MessageDialog.openError(shell, "Connect Error", NLS.bind( - "Invalid connect ID: {0}", page.getConnectID())); + "Invalid connect ID: {0}", connectID)); return false; } 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 835abde7f..125f18729 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 @@ -26,18 +26,18 @@ final class IRCConnectWizardPage extends WizardPage { private Text passwordText; - private String uriString; + private String authorityAndPath; IRCConnectWizardPage() { super(""); setTitle("IRC Connection Wizard"); - setDescription("Specify a nickname and IRC server to connect to."); + setDescription("Specify a user and IRC server to connect to."); setPageComplete(false); } - IRCConnectWizardPage(String uri) { + IRCConnectWizardPage(String authorityAndPath) { this(); - uriString = uri; + this.authorityAndPath = authorityAndPath; } public void createControl(Composite parent) { @@ -52,15 +52,18 @@ final class IRCConnectWizardPage extends WizardPage { connectText.setLayoutData(fillData); connectText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { - if (!connectText.getText().equals("")) { //$NON-NLS-1$ - updateStatus(null); + String text = connectText.getText(); + if (text.equals("")) { //$NON-NLS-1$ + updateStatus("A valid connect ID must be specified."); + } else if (text.indexOf('@') == -1) { + updateStatus("The connect ID is malformed."); } else { - updateStatus("A connect ID must be specified."); + updateStatus(null); } } }); label = new Label(parent, SWT.RIGHT); - label.setText("irc://[<user>@]<ircserver[:port]>[/<channel>,<channel2>,...]"); + label.setText("<user>@<ircserver>[:port][/<channel>,<channel2>,...]"); label.setLayoutData(endData); label = new Label(parent, SWT.LEFT); @@ -71,14 +74,11 @@ final class IRCConnectWizardPage extends WizardPage { label.setText("This password is for password-protected IRC servers."); label.setLayoutData(endData); - if (uriString != null) { - connectText.setText(uriString); + if (authorityAndPath != null) { + connectText.setText(authorityAndPath); passwordText.setFocus(); - } else { - connectText.setText("irc://"); - connectText.setSelection(6); - } - + } + setControl(parent); } |