diff options
author | slewis | 2008-09-11 20:59:25 +0000 |
---|---|---|
committer | slewis | 2008-09-11 20:59:25 +0000 |
commit | 5e66bfb64a04a4717133f25f63d13bb60e5e1e90 (patch) | |
tree | 42e728c5a4a24d907c32ec044891855380efa1a3 | |
parent | daa6e995e0daa68c47b38a8a5f6e465500851176 (diff) | |
download | org.eclipse.ecf-5e66bfb64a04a4717133f25f63d13bb60e5e1e90.tar.gz org.eclipse.ecf-5e66bfb64a04a4717133f25f63d13bb60e5e1e90.tar.xz org.eclipse.ecf-5e66bfb64a04a4717133f25f63d13bb60e5e1e90.zip |
Added Eclipse IM connection wizard. Allows people to specify bugzilla username/password directly in dialog and then connection is made to <account>@xmpp.eclipse.org directly.v20080911-1818
5 files changed, 189 insertions, 1 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/META-INF/MANIFEST.MF index 55028b2dd..f87a73a8d 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/META-INF/MANIFEST.MF +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.ecf.provider.xmpp.ui;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.1.0.qualifier Bundle-Activator: org.eclipse.ecf.internal.provider.xmpp.ui.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.properties index 337c35cf1..8f5b4e412 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.properties +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.properties @@ -14,3 +14,4 @@ XMPPHyperlinkDetector= XMPP/XMPPS XMPPConnectWizardPage.description=Create a XMPP connection XMPPSConnectWizardPage.description=Create a XMPPS connection +EclipseXMPPSConnectWizardPage.description=Create an Eclipse IM connection
\ No newline at end of file diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.xml index 310326df3..f6f185ae7 100644 --- a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.xml +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/plugin.xml @@ -13,6 +13,11 @@ containerFactoryName="ecf.xmpps.smack" id="org.eclipse.ecf.provider.ui.xmpp.xmppsConnect" name="XMPPS"/> + <wizard + class="org.eclipse.ecf.internal.provider.xmpp.ui.wizards.EclipseXMPPSConnectWizard" + containerFactoryName="ecf.xmpps.smack" + id="org.eclipse.ecf.provider.ui.xmpp.eclipseXmppsConnect" + name="Eclipse IM"/> </extension> <extension @@ -35,6 +40,15 @@ finalPerspective="org.eclipse.ecf.ui.perspective.communications"> <description>%XMPPSConnectWizardPage.description</description> </wizard> + <wizard + class="org.eclipse.ecf.internal.provider.xmpp.ui.wizards.EclipseXMPPSConnectWizard" + id="org.eclipse.ecf.provider.ui.xmpp.eclipseXmppsConnect" + name="Eclipse IM" + icon="icons/new_connection.gif" + category="org.eclipse.ecf.ui.newConnection.category" + finalPerspective="org.eclipse.ecf.ui.perspective.communications"> + <description>%XMPPSConnectWizardPage.description</description> + </wizard> </extension> <extension point="org.eclipse.ui.perspectiveExtensions"> diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizard.java b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizard.java new file mode 100644 index 000000000..895939977 --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizard.java @@ -0,0 +1,50 @@ +/**************************************************************************** + * Copyright (c) 2008 Composent Inc., 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Suen <remy.suen@gmail.com> - initial API and implementation + *****************************************************************************/ +package org.eclipse.ecf.internal.provider.xmpp.ui.wizards; + +import org.eclipse.ecf.core.ContainerCreateException; +import org.eclipse.ecf.core.ContainerFactory; +import org.eclipse.ecf.core.IContainer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkbench; + +public final class EclipseXMPPSConnectWizard extends XMPPConnectWizard { + + public EclipseXMPPSConnectWizard() { + super(); + } + + public EclipseXMPPSConnectWizard(String uri) { + super(uri); + } + + public void addPages() { + page = new EclipseXMPPSConnectWizardPage(usernameAtHost); + addPage(page); + } + + public void init(IWorkbench workbench, IContainer container) { + super.init(workbench, container); + + setWindowTitle("Connect to Eclipse IM"); + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + super.init(workbench, selection); + try { + this.container = ContainerFactory.getDefault().createContainer("ecf.xmpps.smack"); + } catch (final ContainerCreateException e) { + // None + } + + setWindowTitle("Connect to Eclipse IM"); + } +} diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizardPage.java b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizardPage.java new file mode 100644 index 000000000..627a2bf7b --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.ui/src/org/eclipse/ecf/internal/provider/xmpp/ui/wizards/EclipseXMPPSConnectWizardPage.java @@ -0,0 +1,123 @@ +/**************************************************************************** + * Copyright (c) 2008 Composent Inc., 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + *****************************************************************************/ +package org.eclipse.ecf.internal.provider.xmpp.ui.wizards; + +import java.util.regex.Matcher; + +import org.eclipse.ecf.internal.provider.xmpp.ui.Messages; +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; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +final class EclipseXMPPSConnectWizardPage extends XMPPConnectWizardPage { + + private static final String ECLIPSE_XMPP_HOST = "xmpp.eclipse.org"; + + EclipseXMPPSConnectWizardPage() { + super(); + setTitle("Eclipse IM Connection Wizard"); + setDescription("Specify Eclipse Bugzilla Account Information"); + setPageComplete(false); + } + + EclipseXMPPSConnectWizardPage(String usernameAtHost) { + this(); + this.usernameAtHost = usernameAtHost; + } + + private void verify() { + final String text = connectText.getText(); + if (text.equals("")) { //$NON-NLS-1$ + updateStatus("A valid Bugzilla account must be specified"); + } else { + final Matcher matcher = emailPattern.matcher(text); + if (!matcher.matches()) { + updateStatus("Invalid Bugzilla account information"); + } else { + restorePassword(text); + updateStatus(null); + } + } + } + + public void createControl(Composite parent) { + + parent = new Composite(parent, SWT.NONE); + + parent.setLayout(new GridLayout()); + final GridData fillData = new GridData(SWT.FILL, SWT.CENTER, true, false); + final GridData endData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); + + Label label = new Label(parent, SWT.LEFT); + label.setText("Bugzilla Username:"); + + connectText = new Combo(parent, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN); + connectText.setLayoutData(fillData); + connectText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + verify(); + } + }); + connectText.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + verify(); + } + + public void widgetSelected(SelectionEvent e) { + verify(); + } + }); + + label = new Label(parent, SWT.RIGHT); + label.setText("<email address>"); + label.setLayoutData(endData); + + label = new Label(parent, SWT.LEFT); + label.setText(Messages.XMPPSConnectWizardPage_WIZARD_PAGE_PASSWORD); + passwordText = new Text(parent, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER); + passwordText.setLayoutData(fillData); + + restoreCombo(); + + if (usernameAtHost != null) { + connectText.setText(usernameAtHost); + restorePassword(usernameAtHost); + passwordText.setFocus(); + } + + verify(); + + if (connectText.getText().equals("")) { + updateStatus(null); + setPageComplete(false); + } else if (isPageComplete()) + passwordText.setFocus(); + + org.eclipse.jface.dialogs.Dialog.applyDialogFont(parent); + setControl(parent); + } + + String getConnectID() { + final String bugzillaAccount = connectText.getText(); + if (!bugzillaAccount.endsWith(ECLIPSE_XMPP_HOST)) { + return bugzillaAccount + "@" + ECLIPSE_XMPP_HOST; + } + return bugzillaAccount; + } + +} |