From e3d5b49c34fea0ebac88f862f94f92a49edba592 Mon Sep 17 00:00:00 2001 From: slewis Date: Mon, 24 Mar 2008 05:45:59 +0000 Subject: Enhancements/contributions from bug 222866. Also updated versions to 2.0.0 for core and filetransfer plugins --- .../build.properties | 1 + .../icons/new_connection.gif | Bin 0 -> 947 bytes .../plugin.properties | 2 + .../org.eclipse.ecf.provider.irc.ui/plugin.xml | 19 ++++++++ .../org/eclipse/ecf/internal/irc/ui/Messages.java | 3 ++ .../ecf/internal/irc/ui/messages.properties | 16 ++++++- .../internal/irc/ui/wizards/IRCConnectWizard.java | 53 +++++++++++++-------- .../irc/ui/wizards/IRCConnectWizardPage.java | 4 ++ 8 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 providers/bundles/org.eclipse.ecf.provider.irc.ui/icons/new_connection.gif diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/build.properties b/providers/bundles/org.eclipse.ecf.provider.irc.ui/build.properties index 146cbd460..82e352855 100644 --- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/build.properties +++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/build.properties @@ -2,6 +2,7 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ + icons/,\ plugin.xml,\ about.html,\ plugin.properties diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/icons/new_connection.gif b/providers/bundles/org.eclipse.ecf.provider.irc.ui/icons/new_connection.gif new file mode 100644 index 000000000..4d4c6bb16 Binary files /dev/null and b/providers/bundles/org.eclipse.ecf.provider.irc.ui/icons/new_connection.gif differ diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.properties index 16b5a7e63..ae87968d0 100644 --- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.properties +++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.properties @@ -27,3 +27,5 @@ colorDefinition.ircMeColor = IRC /me color colorDefinition.ircMeColor.description = Color of messages sent by local user using /me command. fontDefinition.ircMeFont = IRC /me font fontDefinition.ircMeFont.description = Font of messages sent by local user using /me command. + +IRCConnectWizardPage.description=Create a IRC connection diff --git a/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.xml index 31125e500..5decad62f 100644 --- a/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.xml +++ b/providers/bundles/org.eclipse.ecf.provider.irc.ui/plugin.xml @@ -10,6 +10,25 @@ name="IRC"/> + + + %IRCConnectWizardPage.description + + + + + + + + - bug 190851 +################################################################################ + IRCHyperlink_EXCEPTION_IRC_HYPERLINK=Exception in IRC hyperlink open IRCConnectWizardPage_CONNECTID_LABEL=Connect ID: IRCConnectWizardPage_PASSWORD_LABEL=Password: @@ -15,4 +27,6 @@ IRCConnectWizardPage_STATUS_MESSAGE_MALFORMED=The connect ID is malformed. IRCConnectWizardPage_CONNECTID_EXAMPLE=@[:port][/,,...] IRCConnectWizardPage_PASSWORD_INFO=Password is for password-protected IRC servers. -IRCConnectWizardPage_CONNECTID_DEFAULT=ecfuser{0}@irc.freenode.net/#eclipse \ No newline at end of file +IRCConnectWizardPage_CONNECTID_DEFAULT=ecfuser{0}@irc.freenode.net/#eclipse + +IRCConnectWizard_WIZARD_TITLE=New IRC Connection 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 21c08f45f..3c19c9678 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,6 +11,8 @@ *****************************************************************************/ package org.eclipse.ecf.internal.irc.ui.wizards; +import org.eclipse.ecf.core.ContainerCreateException; +import org.eclipse.ecf.core.ContainerFactory; import org.eclipse.ecf.core.IContainer; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.identity.IDCreateException; @@ -18,18 +20,21 @@ import org.eclipse.ecf.core.identity.IDFactory; import org.eclipse.ecf.core.security.ConnectContextFactory; import org.eclipse.ecf.core.security.IConnectContext; import org.eclipse.ecf.internal.irc.ui.IRCUI; +import org.eclipse.ecf.internal.irc.ui.Messages; 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.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; -public final class IRCConnectWizard extends Wizard implements IConnectWizard { +public final class IRCConnectWizard extends Wizard implements IConnectWizard, INewWizard { public static final String DEFAULT_GUEST_USER = "guest"; - + private IRCConnectWizardPage page; private IContainer container; @@ -56,50 +61,60 @@ public final class IRCConnectWizard extends Wizard implements IConnectWizard { public void init(IWorkbench workbench, IContainer container) { this.container = container; + + setWindowTitle(Messages.IRCConnectWizard_WIZARD_TITLE); + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.container = null; + try { + this.container = ContainerFactory.getDefault().createContainer("ecf.irc.irclib"); + } catch (final ContainerCreateException e) { + // None + } + + setWindowTitle(Messages.IRCConnectWizard_WIZARD_TITLE); } public boolean performFinish() { - + final String connectID = page.getConnectID(); final String password = page.getPassword(); - - connectContext = ConnectContextFactory - .createPasswordConnectContext(password); + + connectContext = ConnectContextFactory.createPasswordConnectContext(password); page.saveComboText(); - + try { - targetID = IDFactory.getDefault().createID( - container.getConnectNamespace(), connectID); - } catch (IDCreateException e) { - new IDCreateErrorDialog(null,connectID,e).open(); + targetID = IDFactory.getDefault().createID(container.getConnectNamespace(), connectID); + } catch (final IDCreateException e) { + new IDCreateErrorDialog(null, connectID, e).open(); return false; } - IChatRoomManager manager = (IChatRoomManager) this.container - .getAdapter(IChatRoomManager.class); + final IChatRoomManager manager = (IChatRoomManager) this.container.getAdapter(IChatRoomManager.class); - IRCUI ui = new IRCUI(this.container, manager, null); + final IRCUI ui = new IRCUI(this.container, manager, null); ui.showForTarget(targetID); // If it's not already connected, then we connect this new container if (!ui.isContainerConnected()) { page.saveComboItems(); new AsynchContainerConnectAction(container, targetID, connectContext, null, new Runnable() { public void run() { - cachePassword(page.getPasswordKeyFromUserName(connectID),password); - }}).run(); + cachePassword(page.getPasswordKeyFromUserName(connectID), password); + } + }).run(); } - return true; } protected void cachePassword(final String connectID, String password) { if (password != null && !password.equals("")) { - PasswordCacheHelper pwStorage = new PasswordCacheHelper(connectID); + final 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 6711ec537..c8375a60c 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 @@ -85,6 +85,9 @@ final class IRCConnectWizardPage extends WizardPage { } public void createControl(Composite parent) { + + parent = new Composite(parent, SWT.NONE); + parent.setLayout(new GridLayout()); GridData fillData = new GridData(SWT.FILL, SWT.CENTER, true, false); GridData endData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); @@ -130,6 +133,7 @@ final class IRCConnectWizardPage extends WizardPage { passwordText.setFocus(); } + org.eclipse.jface.dialogs.Dialog.applyDialogFont(parent); setControl(parent); } -- cgit v1.2.3