aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2009-01-21 12:51:15 +0000
committerYana Stamcheva <yana@jitsi.org>2009-01-21 12:51:15 +0000
commit333a823b1417bfe834e7090a19d95a510b1b51e0 (patch)
tree26a56dbd25ba307a037a589a34e910449fe91fd6
parenta832239300e3479bffad2a955b00bb555e55c44a (diff)
downloadjitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.zip
jitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.tar.gz
jitsi-333a823b1417bfe834e7090a19d95a510b1b51e0.tar.bz2
- Fixes Issue #: 434 Wrong ID when try to install an already installed account.
- Removes the "Override server" option from account wizards. - Adds a property to the ProtocolProviderFactory which indicates if the server has been modified
-rw-r--r--resources/languages/resources.properties5
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java52
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java54
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java91
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java111
-rw-r--r--src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java53
-rw-r--r--src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java113
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java66
-rw-r--r--src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java35
-rw-r--r--src/net/java/sip/communicator/plugin/googletalkaccregwizz/FirstWizardPage.java189
-rw-r--r--src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java45
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java121
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java22
-rw-r--r--src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java116
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java27
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java35
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java140
-rw-r--r--src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java46
-rw-r--r--src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java44
-rw-r--r--src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java32
-rw-r--r--src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java33
-rw-r--r--src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java37
-rw-r--r--src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java32
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java258
-rw-r--r--src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java40
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java54
-rw-r--r--src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java46
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java39
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java32
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java57
-rw-r--r--src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java40
-rw-r--r--src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java7
-rw-r--r--src/net/java/sip/communicator/service/gui/WizardPage.java6
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java5
34 files changed, 816 insertions, 1267 deletions
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index 00166e4..ab96020 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -212,7 +212,7 @@ service.gui.NO_MESSAGE=No message
service.gui.NO_GROUP_CHAT_ACCOUNT_AVAILABLE=No accounts, supporting multi user chat found. Check sip-communicator.org for more information on which protocols support multi user chat.
service.gui.NON_EMPTY_CHAT_WINDOW_CLOSE=You're trying to close a chat with a non-sent message. Are you sure you want to close this chat?
service.gui.NON_EXISTING_USER_ID=The {0} server does not recognize specified user id.
-service.gui.NOTIFICATIONS=Notifications
+service.gui.NOTIFICATIONS=Notifications
service.gui.OK=&OK
service.gui.OFFLINE=Offline
service.gui.OLDER_CALLS=Older calls
@@ -292,6 +292,8 @@ service.gui.TRANSFER_CALL_TITLE=Transfer Call
service.gui.TRANSPARENCY_NOT_ENABLED=Transparency is not supported by your current configuration.
service.gui.TYPE_YOUR_REQUEST=Type your request here
service.gui.USER_IDENTIFIER=User identifier:
+service.gui.USER_EXISTS_ERROR=This user already exists on the selected network. Please choose another user or network.
+service.gui.USERNAME_NULL=Please fill the name of your account.
service.gui.UNKNOWN=Unknown user
service.gui.MSG_DELIVERY_UNKNOWN_ERROR=Unknown error has occured while delivering your message.
service.gui.UNREGISTERED_MESSAGE=Unable to connect the following account: User name: {0}, Server name: {1}. You are currently offline.
@@ -491,7 +493,6 @@ plugin.jabberaccregwizz.COMMENT_COLUMN=Comment
plugin.jabberaccregwizz.RESOURCE=Resource
plugin.jabberaccregwizz.PRIORITY=Priority
plugin.jabberaccregwizz.XMPP_ERROR=XMPP Error
-plugin.jabberaccregwizz.USER_EXISTS_ERROR=This user already exist on this server. Choose another user or server.
plugin.jabberaccregwizz.UNKNOWN_XMPP_ERROR=Unknown XMPP error. Verify that the server name is correct.
plugin.jabberaccregwizz.NOT_SAME_PASSWORD=The two entered password aren't the same.
plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS=Override server default options
diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
index c9ff6ac..2a43bbb 100644
--- a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
+++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegSummaryPage.java
@@ -15,6 +15,7 @@ import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
@@ -27,13 +28,18 @@ public class AccountRegSummaryPage
extends SCScrollPane
implements WizardPage
{
- private JPanel keysPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ private final Logger logger = Logger.getLogger(AccountRegSummaryPage.class);
- private JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ private final JPanel keysPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10));
+ private final JPanel valuesPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JPanel wrapPanel = new TransparentPanel(new BorderLayout());
+ private final JPanel mainPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
+
+ private final JPanel wrapPanel = new TransparentPanel(new BorderLayout());
private AccountRegWizardContainerImpl wizardContainer;
@@ -150,13 +156,41 @@ public class AccountRegSummaryPage
AccountRegistrationWizard wizard =
this.wizardContainer.getCurrentWizard();
- ProtocolProviderService protocolProvider = wizard.signin();
+ try
+ {
+ ProtocolProviderService protocolProvider = wizard.signin();
- if (protocolProvider != null)
- this.wizardContainer.saveAccountWizard(protocolProvider, wizard);
+ if (protocolProvider != null)
+ this.wizardContainer.saveAccountWizard(protocolProvider, wizard);
- this.wizardContainer.unregisterWizardPages();
- this.wizardContainer.removeWizzardIcon();
+ this.wizardContainer.unregisterWizardPages();
+ this.wizardContainer.removeWizzardIcon();
+ }
+ catch (OperationFailedException e)
+ {
+ logger.debug("The sign in operation has failed.");
+
+ if (e.getErrorCode()
+ == OperationFailedException.ILLEGAL_ARGUMENT)
+ {
+ new ErrorDialog(
+ GuiActivator.getUIService().getMainFrame(),
+ GuiActivator.getResources()
+ .getI18NString("service.gui.ERROR"),
+ GuiActivator.getResources()
+ .getI18NString("service.gui.USERNAME_NULL"));
+ }
+ else if (e.getErrorCode()
+ == OperationFailedException.IDENTIFICATION_CONFLICT)
+ {
+ new ErrorDialog(
+ GuiActivator.getUIService().getMainFrame(),
+ GuiActivator.getResources()
+ .getI18NString("service.gui.ERROR"),
+ GuiActivator.getResources()
+ .getI18NString("service.gui.USER_EXISTS_ERROR"));
+ }
+ }
}
public void pageBack()
diff --git a/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java b/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java
index 92fcafe..ac7cad3 100644
--- a/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/main/account/NewAccountDialog.java
@@ -234,9 +234,29 @@ public class NewAccountDialog
JComponent simpleWizardForm = (JComponent) wizard.getSimpleForm();
simpleWizardForm.setOpaque(false);
- accountPanel.add(simpleWizardForm, BorderLayout.NORTH);
+ accountPanel.add(simpleWizardForm);
accountPanel.revalidate();
accountPanel.repaint();
+
+ this.pack();
+ }
+
+ /**
+ * Loads the given error message in the current dialog, by re-validating the
+ * content.
+ *
+ * @param errorMessage The error message to load.
+ */
+ private void loadErrorMessage(String errorMessage)
+ {
+ JLabel errorMessageLabel = new JLabel(errorMessage);
+
+ errorMessageLabel.setForeground(Color.RED);
+
+ accountPanel.add(errorMessageLabel, BorderLayout.NORTH);
+ accountPanel.revalidate();
+ accountPanel.repaint();
+
this.pack();
}
@@ -275,12 +295,36 @@ public class NewAccountDialog
}
else if (sourceButton.equals(addAccountButton))
{
- ProtocolProviderService protocolProvider = wizard.signin();
+ ProtocolProviderService protocolProvider;
+ try
+ {
+ protocolProvider = wizard.signin();
- if (protocolProvider != null)
- wizardContainer.saveAccountWizard(protocolProvider, wizard);
+ if (protocolProvider != null)
+ wizardContainer.saveAccountWizard(protocolProvider, wizard);
- this.dispose();
+ this.dispose();
+ }
+ catch (OperationFailedException e)
+ {
+ // If the sign in operation has failed we don't want to close
+ // the dialog in order to give the user the possibility to
+ // retry.
+ logger.debug("The sign in operation has failed.");
+
+ if (e.getErrorCode()
+ == OperationFailedException.ILLEGAL_ARGUMENT)
+ {
+ loadErrorMessage(GuiActivator.getResources().getI18NString(
+ "service.gui.USERNAME_NULL"));
+ }
+ else if (e.getErrorCode()
+ == OperationFailedException.IDENTIFICATION_CONFLICT)
+ {
+ loadErrorMessage(GuiActivator.getResources().getI18NString(
+ "service.gui.USER_EXISTS_ERROR"));
+ }
+ }
}
else if (sourceButton.equals(cancelButton))
{
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
index d37b95e..efdeae4 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/AimAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -23,6 +24,9 @@ import org.osgi.framework.*;
public class AimAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(AimAccountRegistrationWizard.class);
+
private FirstWizardPage firstWizardPage;
private AimAccountRegistration registration = new AimAccountRegistration();
@@ -42,7 +46,8 @@ public class AimAccountRegistrationWizard
{
this.wizardContainer = wizardContainer;
- this.wizardContainer.setFinishButtonText(Resources.getString("service.gui.SIGN_IN"));
+ this.wizardContainer.setFinishButtonText(
+ Resources.getString("service.gui.SIGN_IN"));
}
/**
@@ -104,7 +109,8 @@ public class AimAccountRegistrationWizard
{
Hashtable summaryTable = new Hashtable();
- summaryTable.put(Resources.getString("plugin.aimaccregwizz.USERNAME"), registration.getUin());
+ summaryTable.put(Resources.getString("plugin.aimaccregwizz.USERNAME"),
+ registration.getUin());
summaryTable.put(Resources.getString("service.gui.REMEMBER_PASSWORD"),
new Boolean(registration.isRememberPassword()));
@@ -117,15 +123,18 @@ public class AimAccountRegistrationWizard
registration.getProxyPort());
if (registration.getProxyType() != null)
- summaryTable.put(Resources.getString("plugin.aimaccregwizz.PROXY_TYPE"),
+ summaryTable.put(
+ Resources.getString("plugin.aimaccregwizz.PROXY_TYPE"),
registration.getProxyType());
if (registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("plugin.aimaccregwizz.PROXY_USERNAME"),
+ summaryTable.put(
+ Resources.getString("plugin.aimaccregwizz.PROXY_USERNAME"),
registration.getProxyPort());
if (registration.getProxyType() != null)
- summaryTable.put(Resources.getString("plugin.aimaccregwizz.PROXY_PASSWORD"),
+ summaryTable.put(
+ Resources.getString("plugin.aimaccregwizz.PROXY_PASSWORD"),
registration.getProxyType());
return summaryTable.entrySet().iterator();
@@ -135,11 +144,10 @@ public class AimAccountRegistrationWizard
* Installs the account created through this wizard.
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
-
firstWizardPage.commitPage();
+
return this.signin(registration.getUin(), registration.getPassword());
}
@@ -151,8 +159,8 @@ public class AimAccountRegistrationWizard
* @param password the password to sign in with
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory =
AimAccRegWizzActivator.getAimProtocolProviderFactory();
@@ -170,36 +178,40 @@ public class AimAccountRegistrationWizard
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory, String user, String passwd)
+ throws OperationFailedException
{
- Hashtable accountProperties = new Hashtable();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
if (registration.isRememberPassword())
{
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if (registration.getProxyType() != null)
- {
- if (registration.getProxy() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
- registration.getProxy());
+ if (registration.getProxy() != null
+ && registration.getProxy() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
+ registration.getProxy());
- if (registration.getProxyPort() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
- registration.getProxyPort());
+ if (registration.getProxyPort() != null
+ && registration.getProxyPort() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
+ registration.getProxyPort());
- if (registration.getProxyType() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
- registration.getProxyType());
+ if (registration.getProxyType() != null
+ && registration.getProxyType() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
+ registration.getProxyType());
- if (registration.getProxyUsername() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
- registration.getProxyUsername());
+ if (registration.getProxyUsername() != null
+ && registration.getProxyUsername() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
+ registration.getProxyUsername());
- if (registration.getProxyPassword() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
- registration.getProxyPassword());
- }
+ if (registration.getProxyPassword() != null
+ && registration.getProxyPassword() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
+ registration.getProxyPassword());
if (isModification)
{
@@ -223,21 +235,24 @@ public class AimAccountRegistrationWizard
(ProtocolProviderService) AimAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- AimAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- AimAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
+
return protocolProvider;
}
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
index 0e6a239..05b9f4b 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/FirstWizardPage.java
@@ -7,7 +7,6 @@ package net.java.sip.communicator.plugin.aimaccregwizz;
import java.awt.*;
import java.awt.event.*;
-import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
@@ -48,10 +47,6 @@ public class FirstWizardPage
private JPanel valuesAdvOpPanel =
new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JCheckBox enableAdvOpButton =
- new SIPCommCheckBox(Resources.getString(
- "plugin.aimaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"), false);
-
private JLabel uinLabel = new JLabel(
Resources.getString("plugin.aimaccregwizz.USERNAME"));
@@ -62,9 +57,6 @@ public class FirstWizardPage
private JLabel passLabel = new JLabel(
Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
@@ -79,12 +71,15 @@ public class FirstWizardPage
new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
private JTextArea registerArea =
- new JTextArea(Resources.getString("plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT_TEXT"));
+ new JTextArea(Resources.getString(
+ "plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT_TEXT"));
private JButton registerButton =
- new JButton(Resources.getString("plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT"));
+ new JButton(Resources.getString(
+ "plugin.aimaccregwizz.REGISTER_NEW_ACCOUNT"));
- private JLabel proxyLabel = new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY"));
+ private JLabel proxyLabel = new JLabel(
+ Resources.getString("plugin.aimaccregwizz.PROXY"));
private JLabel proxyPortLabel =
new JLabel(Resources.getString("plugin.aimaccregwizz.PROXY"));
@@ -159,8 +154,6 @@ public class FirstWizardPage
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -184,23 +177,6 @@ public class FirstWizardPage
mainPanel.add(uinPassPanel);
- proxyField.setEditable(false);
- proxyPortField.setEditable(false);
- proxyTypeCombo.setEnabled(false);
-
- enableAdvOpButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- proxyField.setEditable(cb.isSelected());
- proxyPortField.setEditable(cb.isSelected());
- proxyTypeCombo.setEnabled(cb.isSelected());
- }
- });
-
proxyTypeCombo.setSelectedItem(wizard.getRegistration().getProxyType());
labelsAdvOpPanel.add(proxyLabel);
@@ -215,7 +191,6 @@ public class FirstWizardPage
valuesAdvOpPanel.add(proxyUsernameField);
valuesAdvOpPanel.add(proxyPassField);
- advancedOpPanel.add(enableAdvOpButton, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
@@ -293,38 +268,25 @@ public class FirstWizardPage
{
String uin = uinField.getText();
- if (!wizard.isModification() && isExistingAccount(uin))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
+ AimAccountRegistration registration = wizard.getRegistration();
- AimAccountRegistration registration = wizard.getRegistration();
+ registration.setUin(uin);
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- registration.setUin(uin);
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
+ registration.setProxy(proxyField.getText());
+ registration.setProxyPort(proxyPortField.getText());
+ registration.setProxyUsername(proxyUsernameField.getText());
- if (enableAdvOpButton.isSelected())
- {
- registration.setProxy(proxyField.getText());
- registration.setProxyPort(proxyPortField.getText());
- registration.setProxyUsername(proxyUsernameField.getText());
+ if (proxyTypeCombo.getSelectedItem() != null)
+ registration.setProxyType(proxyTypeCombo.getSelectedItem()
+ .toString());
- if (proxyTypeCombo.getSelectedItem() != null)
- registration.setProxyType(proxyTypeCombo.getSelectedItem()
- .toString());
+ if (proxyPassField.getPassword() != null)
+ registration.setProxyPassword(new String(proxyPassField
+ .getPassword()));
- if (proxyPassField.getPassword() != null)
- registration.setProxyPassword(new String(proxyPassField
- .getPassword()));
- }
- }
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
isCommitted = true;
}
@@ -425,13 +387,6 @@ public class FirstWizardPage
accountID
.getAccountPropertyString(ProtocolProviderFactory.PROXY_PASSWORD);
- if (proxyAddress != null || proxyPort != null
- || proxyType != null || proxyUsername != null
- || proxyPassword != null)
- {
- enableAdvOpButton.setSelected(true);
- }
-
proxyField.setText(proxyAddress);
proxyPortField.setText(proxyPort);
proxyTypeCombo.setSelectedItem(proxyType);
@@ -444,35 +399,11 @@ public class FirstWizardPage
wizard.webSignup();
}
- /**
- * Checks if an acount with the given account already exists.
- *
- * @param accountName the name of the account to check
- * @return TRUE, if an account with the given name already exists, FALSE -
- * otherwise
- */
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory =
- AimAccRegWizzActivator.getAimProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return uinPassPanel;
}
-
+
public boolean isCommitted()
{
return isCommitted;
diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java
index 701e6ce..9506b47 100644
--- a/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/DictAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -24,6 +25,9 @@ import org.osgi.framework.*;
public class DictAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(DictAccountRegistrationWizard.class);
+
/**
* The reference to the first page of the wizard.
*/
@@ -129,28 +133,12 @@ public class DictAccountRegistrationWizard
/**
* Installs the account created through this wizard.
- *
- * @return The ProtocoleProviderService installed for the account.
- */
- public ProtocolProviderService finish()
- {
- firstWizardPage = null;
- ProtocolProviderFactory factory =
- DictAccRegWizzActivator.getDictProtocolProviderFactory();
-
- return this.installAccount(factory, registration.getHost(),
- registration.getPort(),
- registration.getStrategy().getCode());
- }
-
- /**
- * Installs the account created through this wizard.
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin(registration.getUserID(), null);
}
@@ -160,8 +148,8 @@ public class DictAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= DictAccRegWizzActivator.getDictProtocolProviderFactory();
@@ -186,6 +174,7 @@ public class DictAccountRegistrationWizard
String host,
int port,
String strategy)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -198,7 +187,8 @@ public class DictAccountRegistrationWizard
// Save host
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS, host);
// Save port
- accountProperties.put(ProtocolProviderFactory.SERVER_PORT, String.valueOf(port));
+ accountProperties.put( ProtocolProviderFactory.SERVER_PORT,
+ String.valueOf(port));
// Save strategy
accountProperties.put(ProtocolProviderFactory.STRATEGY, strategy);
@@ -222,21 +212,24 @@ public class DictAccountRegistrationWizard
(ProtocolProviderService) DictAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- DictAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- DictAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
+
return protocolProvider;
}
diff --git a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
index 02a5489..68052a9 100644
--- a/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/dictaccregwizz/FirstWizardPage.java
@@ -37,22 +37,20 @@ public class FirstWizardPage
private JPanel valuesPanel = new TransparentPanel();
- private JLabel hostLabel = new JLabel(Resources.getString("plugin.dictaccregwizz.HOST"));
+ private JLabel hostLabel
+ = new JLabel(Resources.getString("plugin.dictaccregwizz.HOST"));
private JPanel emptyPanel = new TransparentPanel();
private JLabel hostExampleLabel = new JLabel("Ex: dict.org");
- private JLabel portLabel = new JLabel(Resources.getString("plugin.dictaccregwizz.PORT"));
-
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString(
- "service.gui.EXISTING_ACCOUNT_ERROR"));
+ private JLabel portLabel
+ = new JLabel(Resources.getString("plugin.dictaccregwizz.PORT"));
private JTextField hostField = new JTextField();
private JTextField portField = new JTextField("2628");
-
+
private JPanel strategyPanel = new TransparentPanel(new BorderLayout(10, 10));
private JPanel strategyTitleBloc = new TransparentPanel(new BorderLayout());
@@ -132,12 +130,9 @@ public class FirstWizardPage
// Host and port Field
this.hostField = new JTextField();
this.portField = new JTextField("2628");
-
+
this.hostField.getDocument().addDocumentListener(this);
this.portField.getDocument().addDocumentListener(this);
-
- // Server informations
- this.existingAccountLabel.setForeground(Color.RED);
this.hostExampleLabel.setForeground(Color.GRAY);
this.hostExampleLabel.setFont(hostExampleLabel.getFont().deriveFont(8));
@@ -232,9 +227,14 @@ public class FirstWizardPage
this.mainPanel = new TransparentPanel(new BorderLayout());
- JPanel infoTitlePanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
- JTextArea firstDescription = new JTextArea(Resources.getString("plugin.dictaccregwizz.FIRST_ACCOUNT"));
- JLabel title = new JLabel(Resources.getString("plugin.dictaccregwizz.ACCOUNT_INFO_TITLE"));
+ JPanel infoTitlePanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+ JTextArea firstDescription
+ = new JTextArea(Resources.getString(
+ "plugin.dictaccregwizz.FIRST_ACCOUNT"));
+ JLabel title
+ = new JLabel(Resources.getString(
+ "plugin.dictaccregwizz.ACCOUNT_INFO_TITLE"));
// Title
title.setFont(title.getFont().deriveFont(Font.BOLD, 14.0f));
@@ -255,7 +255,8 @@ public class FirstWizardPage
* Implements the <code>WizardPage.getIdentifier</code> to return this
* page identifier.
*
- * @return Returns the identifier of the current (the first) page of the wizard.
+ * @return Returns the identifier of the current (the first) page of the
+ * wizard.
*/
public Object getIdentifier()
{
@@ -311,23 +312,22 @@ public class FirstWizardPage
String host = hostField.getText();
int port = Integer.parseInt(portField.getText());
boolean isModified = false;
-
+
if (this.initAccountID instanceof AccountID)
- { // We check if there is modifications to the server
+ { // We check if there are modifications to the server
String accHost =
- this.initAccountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
+ this.initAccountID.getAccountPropertyString(
+ ProtocolProviderFactory.SERVER_ADDRESS);
int accPort =
- Integer
- .parseInt(this.initAccountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT));
-
+ Integer.parseInt(this.initAccountID
+ .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT));
+
if (accHost != host || accPort != port)
{
isModified = true;
}
}
-
+
// We check if a strategy has been selected
if (this.strategiesList.getModel().getSize() == 0)
{ // No Strategy, we get them
@@ -347,24 +347,18 @@ public class FirstWizardPage
nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
this.revalidate();
}
- else if ((!wizard.isModification() && isExistingAccount(host, port))
- || (isModified && isExistingAccount(host, port)))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- hostPortPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
else
{
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- hostPortPanel.remove(existingAccountLabel);
DictAccountRegistration registration = wizard.getRegistration();
registration.setHost(host);
registration.setPort(port);
- registration.setStrategy((Strategy) this.strategiesList.getSelectedValue());
+ registration.setStrategy(
+ (Strategy) this.strategiesList.getSelectedValue());
}
+
isPageCommitted = true;
}
@@ -509,7 +503,7 @@ public class FirstWizardPage
this.populateStrategies();
}
}
-
+
/**
* Checks if an account is stored for this protocol
* @return TRUE, if an account is stored - FALSE otherwise
@@ -522,47 +516,7 @@ public class FirstWizardPage
ArrayList registeredAccounts = factory.getRegisteredAccounts();
return !registeredAccounts.isEmpty();
}
-
- /**
- * Checks if an acount with the given account already exists.
- *
- * @param host the host of the account to check
- * @param port the port of the account to check
- * @return TRUE, if an account with the given name already exists, FALSE -
- * otherwise
- */
- private boolean isExistingAccount(String host, int port)
- {
- ProtocolProviderFactory factory =
- DictAccRegWizzActivator.getDictProtocolProviderFactory();
- String accHost;
- int accPort;
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- accHost =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
-
- if (host.equalsIgnoreCase(accHost))
- {
- // We check the port, only if there is an account with the same
- // host
- accPort =
- Integer
- .parseInt(accountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT));
-
- if (port == accPort)
- {
- return true;
- }
- }
- }
- return false;
- }
-
/**
* Start the thread which will populate the Strategies List
*/
@@ -596,7 +550,7 @@ public class FirstWizardPage
{
this.strategiesList.setStrategies(strategies);
}
-
+
/**
* Informs the user of the current status of the search
* Should only be called by the thread
@@ -607,7 +561,6 @@ public class FirstWizardPage
this.searchProgressPanel.nextStep(message);
}
-
/**
* Informs the wizard that the search of the strategies is complete.
* Should only be called by the thread
@@ -617,7 +570,7 @@ public class FirstWizardPage
setStrategyButtonEnable(true);
this.searchProgressPanel.finish();
}
-
+
/**
* Informs the wizard that the search of the strategies is a failure
* Should only be called by the thread
@@ -644,12 +597,12 @@ public class FirstWizardPage
this.strategyLoader.setEnabled(e);
wizard.getWizardContainer().setNextFinishButtonEnabled(e);
}
-
+
public Object getSimpleForm()
{
return mainPanel;
}
-
+
/**
* Indicates if this is the first dict account
*
@@ -659,7 +612,7 @@ public class FirstWizardPage
{
return this.firstAccount;
}
-
+
public boolean isCommitted()
{
return isPageCommitted;
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
index 6fdecd4..987493c 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/FirstWizardPage.java
@@ -43,9 +43,6 @@ public class FirstWizardPage
private JLabel passLabel = new JLabel(
Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel userIDExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -102,8 +99,6 @@ public class FirstWizardPage
this.userIDField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.userIDExampleLabel.setForeground(Color.GRAY);
this.userIDExampleLabel.setFont(
userIDExampleLabel.getFont().deriveFont(8));
@@ -123,9 +118,9 @@ public class FirstWizardPage
userPassPanel.add(valuesPanel, BorderLayout.CENTER);
userPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
- userPassPanel.setBorder(BorderFactory
- .createTitledBorder(Resources.getString(
- "plugin.gibberishaccregwizz.USERNAME_AND_PASSWORD")));
+ userPassPanel.setBorder(
+ BorderFactory.createTitledBorder(Resources.getString(
+ "plugin.gibberishaccregwizz.USERNAME_AND_PASSWORD")));
this.add(userPassPanel, BorderLayout.NORTH);
}
@@ -188,29 +183,17 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = userIDField.getText();
-
- if (!wizard.isModification() && isExistingAccount(userID))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- userPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userPassPanel.remove(existingAccountLabel);
+ GibberishAccountRegistration registration
+ = wizard.getRegistration();
- GibberishAccountRegistration registration
- = wizard.getRegistration();
+ registration.setUserID(userIDField.getText());
- registration.setUserID(userIDField.getText());
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
- if (passField.getPassword() != null)
- registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- registration.setRememberPassword(rememberPassBox.isSelected());
- }
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
isCommitted = true;
}
@@ -294,38 +277,11 @@ public class FirstWizardPage
}
}
- /**
- * Verifies whether there is already an account installed with the same
- * details as the one that the user has just entered.
- *
- * @param userID the name of the user that the account is registered for
- * @return true if there is already an account for this userID and false
- * otherwise.
- */
- private boolean isExistingAccount(String userID)
- {
- ProtocolProviderFactory factory
- = GibberishAccRegWizzActivator.getGibberishProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (userID.equalsIgnoreCase(accountID.getUserID()))
- {
- return true;
- }
- }
- return false;
- }
-
public Object getSimpleForm()
{
return userPassPanel;
}
-
+
public boolean isCommitted()
{
return isCommitted;
diff --git a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
index d737d7b..36b087b 100644
--- a/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/gibberishaccregwizz/GibberishAccountRegistrationWizard.java
@@ -11,6 +11,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -24,6 +25,8 @@ import org.osgi.framework.*;
public class GibberishAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(GibberishAccountRegistrationWizard.class);
/**
* The first page of the gibberish account registration wizard.
@@ -131,9 +134,9 @@ public class GibberishAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin(registration.getUserID(), null);
}
@@ -143,13 +146,12 @@ public class GibberishAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= GibberishAccRegWizzActivator.getGibberishProtocolProviderFactory();
- return this.installAccount(factory,
- userName);
+ return this.installAccount(factory, userName);
}
/**
@@ -162,6 +164,7 @@ public class GibberishAccountRegistrationWizard
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String user)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -191,19 +194,21 @@ public class GibberishAccountRegistrationWizard
GibberishAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- GibberishAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- GibberishAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/FirstWizardPage.java
index 58b8a5b..b069e12 100644
--- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/FirstWizardPage.java
@@ -26,8 +26,7 @@ import net.java.sip.communicator.util.swing.*;
*/
public class FirstWizardPage
extends TransparentPanel
- implements WizardPage,
- DocumentListener
+ implements WizardPage
{
private static final Logger logger = Logger
.getLogger(FirstWizardPage.class);
@@ -36,7 +35,8 @@ public class FirstWizardPage
public static final String USER_NAME_EXAMPLE = "Ex: johnsmith@gmail.com";
- private JPanel userIDPassPanel = new TransparentPanel(new BorderLayout(10, 10));
+ private JPanel userIDPassPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new TransparentPanel();
@@ -48,9 +48,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel = new JLabel(Resources
- .getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel userIDExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -76,11 +73,6 @@ public class FirstWizardPage
= new SIPCommCheckBox(Resources
.getString("plugin.jabberaccregwizz.ENABLE_KEEP_ALIVE"));
- private JCheckBox enableAdvOpButton = new SIPCommCheckBox(
- Resources.getString(
- "plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"),
- false);
-
private JLabel resourceLabel
= new JLabel(Resources.getString("plugin.jabberaccregwizz.RESOURCE"));
@@ -122,6 +114,8 @@ public class FirstWizardPage
private boolean isCommitted = false;
+ private boolean isServerOverridden = false;
+
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
@@ -158,10 +152,26 @@ public class FirstWizardPage
this.userIDPassPanel.setOpaque(false);
this.emptyPanel.setOpaque(false);
- this.userIDField.getDocument().addDocumentListener(this);
- this.rememberPassBox.setSelected(true);
+ this.userIDField.getDocument().addDocumentListener(new DocumentListener()
+ {
+ public void insertUpdate(DocumentEvent evt)
+ {
+ setNextButtonAccordingToUserIDAndResource();
- this.existingAccountLabel.setForeground(Color.RED);
+ setServerFieldAccordingToUserID();
+ }
+
+ public void removeUpdate(DocumentEvent evt)
+ {
+ setNextButtonAccordingToUserIDAndResource();
+
+ setServerFieldAccordingToUserID();
+ }
+
+ public void changedUpdate(DocumentEvent evt) {}
+ });
+
+ this.rememberPassBox.setSelected(true);
this.userIDExampleLabel.setForeground(Color.GRAY);
this.userIDExampleLabel.setFont(userIDExampleLabel.getFont()
@@ -187,39 +197,6 @@ public class FirstWizardPage
mainPanel.add(userIDPassPanel);
- serverField.setEnabled(false);
- portField.setEnabled(false);
- resourceField.setEnabled(false);
- priorityField.setEnabled(false);
-
- enableAdvOpButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- if (!wizard.isModification())
- serverField.setEnabled(cb.isSelected());
-
- portField.setEnabled(cb.isSelected());
- resourceField.setEnabled(cb.isSelected());
- priorityField.setEnabled(cb.isSelected());
-
- if(!cb.isSelected())
- {
- setServerFieldAccordingToUserID();
-
- portField.setText(
- GoogleTalkAccountRegistration.DEFAULT_PORT);
- resourceField.setText(
- GoogleTalkAccountRegistration.DEFAULT_RESOURCE);
- priorityField.setText(
- GoogleTalkAccountRegistration.DEFAULT_PRIORITY);
- }
- }
- });
-
portField.getDocument().addDocumentListener(new DocumentListener()
{
public void changedUpdate(DocumentEvent evt)
@@ -264,9 +241,9 @@ public class FirstWizardPage
valuesAdvOpPanel.add(resourceField);
valuesAdvOpPanel.add(priorityField);
- JPanel checkBoxesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ JPanel checkBoxesPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
checkBoxesPanel.add(sendKeepAliveBox);
- checkBoxesPanel.add(enableAdvOpButton);
advancedOpPanel.add(checkBoxesPanel, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
@@ -369,36 +346,24 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = userIDField.getText();
+ GoogleTalkAccountRegistration registration = wizard.getRegistration();
- if (!wizard.isModification() && isExistingAccount(userID))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- userIDPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userIDPassPanel.remove(existingAccountLabel);
+ registration.setUserID(userIDField.getText());
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- GoogleTalkAccountRegistration registration = wizard.getRegistration();
+ registration.setServerAddress(serverField.getText());
+ registration.setSendKeepAlive(sendKeepAliveBox.isSelected());
+ registration.setResource(resourceField.getText());
- registration.setUserID(userIDField.getText());
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
+ if (portField.getText() != null)
+ registration.setPort(Integer.parseInt(portField.getText()));
- registration.setServerAddress(serverField.getText());
- registration.setSendKeepAlive(sendKeepAliveBox.isSelected());
- registration.setResource(resourceField.getText());
+ if (priorityField.getText() != null)
+ registration.setPriority(
+ Integer.parseInt(priorityField.getText()));
- if (portField.getText() != null)
- registration.setPort(Integer.parseInt(portField.getText()));
-
- if (priorityField.getText() != null)
- registration.setPriority(
- Integer.parseInt(priorityField.getText()));
- }
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
isCommitted = true;
}
@@ -422,38 +387,6 @@ public class FirstWizardPage
}
}
- /**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the
- * UserID field. Enables or disables the "Next" wizard button according to
- * whether the UserID field is empty.
- *
- * @param evt the document event that has triggered this method call.
- */
- public void insertUpdate(DocumentEvent evt)
- {
- this.setNextButtonAccordingToUserIDAndResource();
-
- this.setServerFieldAccordingToUserID();
- }
-
- /**
- * Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
- * from the User ID field. Enables or disables the "Next" wizard button
- * according to whether the User ID field is empty.
- *
- * @param evt the document event that has triggered this method call.
- */
- public void removeUpdate(DocumentEvent evt)
- {
- this.setNextButtonAccordingToUserIDAndResource();
-
- this.setServerFieldAccordingToUserID();
- }
-
- public void changedUpdate(DocumentEvent evt)
- {
- }
-
public void pageHiding()
{
}
@@ -516,21 +449,9 @@ public class FirstWizardPage
priorityField.setText(priority);
- if (!serverPort.equals(GoogleTalkAccountRegistration.DEFAULT_PORT)
- || !resource.equals(GoogleTalkAccountRegistration.DEFAULT_RESOURCE)
- || !priority.equals(GoogleTalkAccountRegistration.DEFAULT_PRIORITY))
- {
- enableAdvOpButton.setSelected(true);
-
- // The server field should stay disabled in modification mode,
- // because the user should not be able to change anything concerning
- // the account identifier and server name is part of it.
- serverField.setEnabled(false);
+ this.isServerOverridden = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
- portField.setEnabled(true);
- resourceField.setEnabled(true);
- priorityField.setEnabled(true);
- }
}
/**
@@ -539,7 +460,7 @@ public class FirstWizardPage
*/
private void setServerFieldAccordingToUserID()
{
- if (!enableAdvOpButton.isSelected())
+ if (!wizard.isModification() || !isServerOverridden)
{
String userId = userIDField.getText();
@@ -564,32 +485,6 @@ public class FirstWizardPage
}
}
- /**
- * Checks if the accountName corresponds to an already existing account.
- *
- * @param accountName the name of the account to check
- * @return TRUE if an account with the specified name already exists, FALSE -
- * otherwise.
- */
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory = GoogleTalkAccRegWizzActivator
- .getGoogleTalkProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- {
- return true;
- }
- }
- return false;
- }
-
public Object getSimpleForm()
{
return userIDPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
index ef656a7..7249d3e 100644
--- a/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/googletalkaccregwizz/GoogleTalkAccountRegistrationWizard.java
@@ -11,6 +11,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -24,6 +25,9 @@ import org.osgi.framework.*;
public class GoogleTalkAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(GoogleTalkAccountRegistrationWizard.class);
+
private static final String GOOGLE_USER_SUFFIX = "gmail.com";
private static final String GOOGLE_CONNECT_SRV = "talk.google.com";
@@ -156,19 +160,20 @@ public class GoogleTalkAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin( registration.getUserID(),
registration.getPassword());
}
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
- = GoogleTalkAccRegWizzActivator.getGoogleTalkProtocolProviderFactory();
+ = GoogleTalkAccRegWizzActivator
+ .getGoogleTalkProtocolProviderFactory();
return this.installAccount(factory,
userName,
@@ -188,8 +193,10 @@ public class GoogleTalkAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String userName,
String passwd)
+ throws OperationFailedException
{
- Hashtable accountProperties = new Hashtable();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
/* Make the account use the resources specific to Google Talk. */
accountProperties.put(ProtocolProviderFactory.PROTOCOL, PROTOCOL);
@@ -209,11 +216,17 @@ public class GoogleTalkAccountRegistrationWizard
if (registration.getServerAddress() != null)
{
serverName = registration.getServerAddress();
+
+ if (userName.indexOf(serverName) < 0)
+ accountProperties.put(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
+ Boolean.toString(true));
}
else
{
serverName = getServerFromUserName(userName);
}
+
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
serverName);
@@ -248,19 +261,21 @@ public class GoogleTalkAccountRegistrationWizard
GoogleTalkAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- GoogleTalkAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- GoogleTalkAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
index 8492540..d3571eb 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/FirstWizardPage.java
@@ -7,7 +7,6 @@ package net.java.sip.communicator.plugin.icqaccregwizz;
import java.awt.*;
import java.awt.event.*;
-import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
@@ -37,16 +36,14 @@ public class FirstWizardPage
private JPanel valuesPanel = new TransparentPanel();
- private JPanel advancedOpPanel = new TransparentPanel(new BorderLayout(10, 10));
+ private JPanel advancedOpPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
- private JPanel labelsAdvOpPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ private JPanel labelsAdvOpPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JPanel valuesAdvOpPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
-
- private JCheckBox enableAdvOpButton =
- new SIPCommCheckBox(Resources.getString(
- "plugin.aimaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"),
- false);
+ private JPanel valuesAdvOpPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JLabel uinLabel
= new JLabel(Resources.getString("plugin.icqaccregwizz.USERNAME"));
@@ -58,10 +55,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString(
- "service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
@@ -71,7 +64,8 @@ public class FirstWizardPage
private JPanel registerPanel = new TransparentPanel(new GridLayout(0, 1));
- private JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+ private JPanel buttonPanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
private JTextArea registerArea = new JTextArea(
Resources.getString("plugin.icqaccregwizz.REGISTER_NEW_ACCOUNT_TEXT"));
@@ -154,8 +148,6 @@ public class FirstWizardPage
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -179,27 +171,6 @@ public class FirstWizardPage
mainPanel.add(uinPassPanel);
- proxyField.setEditable(false);
- proxyPortField.setEditable(false);
- proxyTypeCombo.setEnabled(false);
- proxyUsernameField.setEditable(false);
- proxyPassField.setEditable(false);
-
- enableAdvOpButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- proxyField.setEditable(cb.isSelected());
- proxyPortField.setEditable(cb.isSelected());
- proxyTypeCombo.setEnabled(cb.isSelected());
- proxyUsernameField.setEditable(cb.isSelected());
- proxyPassField.setEditable(cb.isSelected());
- }
- });
-
proxyTypeCombo.setSelectedItem(wizard.getRegistration().getProxyType());
labelsAdvOpPanel.add(proxyLabel);
@@ -214,7 +185,6 @@ public class FirstWizardPage
valuesAdvOpPanel.add(proxyUsernameField);
valuesAdvOpPanel.add(proxyPassField);
- advancedOpPanel.add(enableAdvOpButton, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
@@ -292,41 +262,27 @@ public class FirstWizardPage
{
String uin = uinField.getText();
- if (!wizard.isModification() && isExistingAccount(uin))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
+ IcqAccountRegistration registration = wizard.getRegistration();
- IcqAccountRegistration registration = wizard.getRegistration();
+ registration.setUin(uin);
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- registration.setUin(uin);
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
+ registration.setProxy(proxyField.getText());
+ registration.setProxyPort(proxyPortField.getText());
- if (enableAdvOpButton.isSelected())
- {
- registration.setAdvancedSettingsEnabled(true);
- registration.setProxy(proxyField.getText());
- registration.setProxyPort(proxyPortField.getText());
+ if (proxyTypeCombo.getSelectedItem() != null)
+ registration.setProxyType(
+ proxyTypeCombo.getSelectedItem().toString());
- if (proxyTypeCombo.getSelectedItem() != null)
- registration.setProxyType(
- proxyTypeCombo.getSelectedItem().toString());
+ registration.setProxyUsername(proxyUsernameField.getText());
- registration.setProxyUsername(proxyUsernameField.getText());
+ if (proxyPassField.getPassword() != null)
+ registration.setProxyPassword(
+ new String(proxyPassField.getPassword()));
+
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- if (proxyPassField.getPassword() != null)
- registration.setProxyPassword(
- new String(proxyPassField.getPassword()));
- }
- }
-
isCommitted = true;
}
@@ -427,13 +383,6 @@ public class FirstWizardPage
accountID
.getAccountPropertyString(ProtocolProviderFactory.PROXY_PASSWORD);
- if (proxyAddress != null || proxyPort != null
- || proxyType != null || proxyUsername != null
- || proxyPassword != null)
- {
- enableAdvOpButton.setSelected(true);
- }
-
proxyField.setText(proxyAddress);
proxyPortField.setText(proxyPort);
proxyTypeCombo.setSelectedItem(proxyType);
@@ -449,30 +398,6 @@ public class FirstWizardPage
wizard.webSignup();
}
- /**
- * Checks if an acount with the given account already exists.
- *
- * @param accountName the name of the account to check
- * @return TRUE, if an account with the given name already exists, FALSE -
- * otherwise
- */
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory =
- IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return uinPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
index d1a43ca..0540a1a 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
@@ -160,26 +160,4 @@ public class IcqAccountRegistration
public void setProxyUsername(String username) {
this.proxyUsername = username;
}
-
- /**
- * Indicates if the advanced server settings are enabled.
- *
- * @return <code>true</code> to indicate that the advanced server settings
- * are enabled, <code>false</code> - otherwise.
- */
- public boolean isAdvancedSettingsEnabled()
- {
- return isAdvancedSettingsEnabled;
- }
-
- /**
- * Enables or disables the advanced server settings.
- *
- * @param isAdvancedSettingsEnabled <code>true</code> to indicate that the
- * advanced server settings are enabled, <code>false</code> - otherwise
- */
- public void setAdvancedSettingsEnabled(boolean isAdvancedSettingsEnabled)
- {
- this.isAdvancedSettingsEnabled = isAdvancedSettingsEnabled;
- }
}
diff --git a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
index 134aed0..44bd0bb 100644
--- a/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -23,6 +24,9 @@ import org.osgi.framework.*;
public class IcqAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(IcqAccountRegistrationWizard.class);
+
private FirstWizardPage firstWizardPage;
private IcqAccountRegistration registration = new IcqAccountRegistration();
@@ -42,7 +46,8 @@ public class IcqAccountRegistrationWizard
{
this.wizardContainer = wizardContainer;
- this.wizardContainer.setFinishButtonText(Resources.getString("service.gui.SIGN_IN"));
+ this.wizardContainer
+ .setFinishButtonText(Resources.getString("service.gui.SIGN_IN"));
}
/**
@@ -102,34 +107,33 @@ public class IcqAccountRegistrationWizard
*/
public Iterator getSummary()
{
- LinkedHashMap summaryTable = new LinkedHashMap();
+ LinkedHashMap<String, Object> summaryTable
+ = new LinkedHashMap<String, Object>();
- summaryTable.put(Resources.getString("service.gui.USER_IDENTIFIER"), registration.getUin());
+ summaryTable.put(Resources.getString("service.gui.USER_IDENTIFIER"),
+ registration.getUin());
summaryTable.put(Resources.getString("service.gui.REMEMBER_PASSWORD"),
new Boolean(registration.isRememberPassword()));
- if(registration.isAdvancedSettingsEnabled())
- {
- if (registration.getProxy() != null)
- summaryTable.put(Resources.getString("plugin.icqaccregwizz.PROXY"),
- registration.getProxy());
+ if (registration.getProxy() != null)
+ summaryTable.put(Resources.getString("plugin.icqaccregwizz.PROXY"),
+ registration.getProxy());
- if (registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyPort"),
- registration.getProxyPort());
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyPort"),
+ registration.getProxyPort());
- if (registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyType"),
- registration.getProxyType());
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyType"),
+ registration.getProxyType());
- if (registration.getProxyPort() != null)
- summaryTable.put(Resources.getString("proxyUsername"),
- registration.getProxyUsername());
+ if (registration.getProxyPort() != null)
+ summaryTable.put(Resources.getString("proxyUsername"),
+ registration.getProxyUsername());
- if (registration.getProxyType() != null)
- summaryTable.put(Resources.getString("proxyPassword"),
- registration.getProxyPassword());
- }
+ if (registration.getProxyType() != null)
+ summaryTable.put(Resources.getString("proxyPassword"),
+ registration.getProxyPassword());
return summaryTable.entrySet().iterator();
}
@@ -141,17 +145,17 @@ public class IcqAccountRegistrationWizard
* account.
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return this.signin(registration.getUin(), registration
.getPassword());
}
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory =
IcqAccRegWizzActivator.getIcqProtocolProviderFactory();
@@ -171,36 +175,40 @@ public class IcqAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String user,
String passwd)
+ throws OperationFailedException
{
- Hashtable accountProperties = new Hashtable();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
if (registration.isRememberPassword())
{
accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
}
- if (registration.isAdvancedSettingsEnabled())
- {
- if (registration.getProxy() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
- registration.getProxy());
+ if (registration.getProxy() != null
+ && registration.getProxy() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
+ registration.getProxy());
- if (registration.getProxyPort() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
- registration.getProxyPort());
+ if (registration.getProxyPort() != null
+ && registration.getProxyPort() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_PORT,
+ registration.getProxyPort());
- if (registration.getProxyType() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
- registration.getProxyType());
+ if (registration.getProxyType() != null
+ && registration.getProxyType() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_TYPE,
+ registration.getProxyType());
- if (registration.getProxyUsername() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
- registration.getProxyUsername());
+ if (registration.getProxyUsername() != null
+ && registration.getProxyUsername() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_USERNAME,
+ registration.getProxyUsername());
- if (registration.getProxyPassword() != null)
- accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
- registration.getProxyPassword());
- }
+ if (registration.getProxyPassword() != null
+ && registration.getProxyPassword() != "")
+ accountProperties.put(ProtocolProviderFactory.PROXY_PASSWORD,
+ registration.getProxyPassword());
if (isModification)
{
@@ -224,19 +232,21 @@ public class IcqAccountRegistrationWizard
(ProtocolProviderService) IcqAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- IcqAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- IcqAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
index 65bcabe..fa2b824 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/FirstWizardPage.java
@@ -71,9 +71,6 @@ public class FirstWizardPage
private JLabel port
= new JLabel(Resources.getString("plugin.ircaccregwizz.PORT"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JPanel emptyPanel2 = new TransparentPanel();
@@ -170,8 +167,6 @@ public class FirstWizardPage
this.defaultPort.setSelected(true);
this.passwordNotRequired.setSelected(false);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.nickExampleLabel.setForeground(Color.GRAY);
this.nickExampleLabel.setFont(
nickExampleLabel.getFont().deriveFont(8));
@@ -295,7 +290,6 @@ public class FirstWizardPage
public void commitPage()
{
nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userPassPanel.remove(existingAccountLabel);
IrcAccountRegistration registration = wizard.getRegistration();
@@ -424,27 +418,6 @@ public class FirstWizardPage
}
/**
- * Verifies whether there is already an account installed with the same
- * details as the one that the user has just entered.
- *
- * @param userID the name of the user that the account is registered for
- * @return true if there is already an account for this userID and false
- * otherwise.
- */
- private boolean isExistingAccount(String userID)
- {
- ProtocolProviderFactory factory
- = IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- if (userID.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
- /**
* Indicates when the default port check box and the passwordNotRequired
* check box are selected.
*/
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
index 0c4f364..fae412f 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
@@ -13,6 +13,7 @@ import org.osgi.framework.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
/**
* The <tt>IrcAccountRegistrationWizard</tt> is an implementation of the
@@ -24,6 +25,8 @@ import net.java.sip.communicator.service.protocol.*;
public class IrcAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(IrcAccountRegistrationWizard.class);
/**
* The first page of the IRC account registration wizard.
@@ -140,9 +143,9 @@ public class IrcAccountRegistrationWizard
* @return ProtocolProviderService for the newly created account.
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
String password = null;
if (registration.isRememberPassword()
@@ -159,8 +162,8 @@ public class IrcAccountRegistrationWizard
* @return ProtocolProviderService for the newly created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
@@ -180,8 +183,10 @@ public class IrcAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String user,
String password)
+ throws OperationFailedException
{
- Hashtable accountProperties = new Hashtable();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
registration.getServer());
@@ -225,19 +230,21 @@ public class IrcAccountRegistrationWizard
IrcAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- IrcAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- IrcAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
index 6980853..7ab96d7 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java
@@ -39,7 +39,8 @@ public class FirstWizardPage
private JabberNewAccountDialog jabberNewAccountDialog;
- private JPanel userIDPassPanel = new TransparentPanel(new BorderLayout(10, 10));
+ private JPanel userIDPassPanel
+ = new TransparentPanel(new BorderLayout(10, 10));
private JPanel labelsPanel = new TransparentPanel();
@@ -51,9 +52,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel = new JLabel(Resources
- .getString("plugin.jabberaccregwizz.USER_EXISTS_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel userIDExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -77,11 +75,6 @@ public class FirstWizardPage
private JCheckBox sendKeepAliveBox = new SIPCommCheckBox(Resources
.getString("plugin.jabberaccregwizz.ENABLE_KEEP_ALIVE"));
- private JCheckBox enableAdvOpButton = new SIPCommCheckBox(
- Resources.getString(
- "plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"),
- false);
-
private JLabel resourceLabel
= new JLabel(Resources.getString("plugin.jabberaccregwizz.RESOURCE"));
@@ -107,7 +100,8 @@ public class FirstWizardPage
private JPanel registerPanel = new TransparentPanel(new GridLayout(0, 1));
- private JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
+ private JPanel buttonPanel
+ = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
private JTextArea registerArea = new JTextArea(Resources
.getString("plugin.jabberaccregwizz.REGISTER_NEW_ACCOUNT_TEXT"));
@@ -123,6 +117,8 @@ public class FirstWizardPage
private boolean isCommitted = false;
+ private boolean isServerOverridden = false;
+
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
@@ -161,8 +157,6 @@ public class FirstWizardPage
this.userIDField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.userIDExampleLabel.setForeground(Color.GRAY);
this.userIDExampleLabel.setFont(userIDExampleLabel.getFont()
.deriveFont(8));
@@ -187,39 +181,6 @@ public class FirstWizardPage
mainPanel.add(userIDPassPanel);
- serverField.setEnabled(false);
- portField.setEnabled(false);
- resourceField.setEnabled(false);
- priorityField.setEnabled(false);
-
- enableAdvOpButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- if (!wizard.isModification())
- serverField.setEnabled(cb.isSelected());
-
- portField.setEnabled(cb.isSelected());
- resourceField.setEnabled(cb.isSelected());
- priorityField.setEnabled(cb.isSelected());
-
- if(!cb.isSelected())
- {
- setServerFieldAccordingToUserID();
-
- portField.setText(
- JabberAccountRegistration.DEFAULT_PORT);
- resourceField.setText(
- JabberAccountRegistration.DEFAULT_RESOURCE);
- priorityField.setText(
- JabberAccountRegistration.DEFAULT_PRIORITY);
- }
- }
- });
-
portField.getDocument().addDocumentListener(new DocumentListener()
{
public void changedUpdate(DocumentEvent evt)
@@ -264,9 +225,9 @@ public class FirstWizardPage
valuesAdvOpPanel.add(resourceField);
valuesAdvOpPanel.add(priorityField);
- JPanel checkBoxesPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ JPanel checkBoxesPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
checkBoxesPanel.add(sendKeepAliveBox);
- checkBoxesPanel.add(enableAdvOpButton);
advancedOpPanel.add(checkBoxesPanel, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
@@ -378,38 +339,26 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = userIDField.getText();
-
- if (!wizard.isModification() && isExistingAccount(userID))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- userIDPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userIDPassPanel.remove(existingAccountLabel);
+ JabberAccountRegistration registration = wizard.getRegistration();
- JabberAccountRegistration registration = wizard.getRegistration();
+ registration.setUserID(userIDField.getText());
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- registration.setUserID(userIDField.getText());
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
+ registration.setServerAddress(serverField.getText());
+ registration.setSendKeepAlive(sendKeepAliveBox.isSelected());
+ registration.setResource(resourceField.getText());
- registration.setServerAddress(serverField.getText());
- registration.setSendKeepAlive(sendKeepAliveBox.isSelected());
- registration.setResource(resourceField.getText());
+ if (portField.getText() != null)
+ registration.setPort(Integer.parseInt(portField.getText()));
- if (portField.getText() != null)
- registration.setPort(Integer.parseInt(portField.getText()));
+ if (priorityField.getText() != null)
+ registration.setPriority(
+ Integer.parseInt(priorityField.getText()));
- if (priorityField.getText() != null)
- registration.setPriority(
- Integer.parseInt(priorityField.getText()));
- }
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- isCommitted = true;
+ this.isCommitted = true;
}
/**
@@ -525,21 +474,8 @@ public class FirstWizardPage
priorityField.setText(priority);
- if (!serverPort.equals(JabberAccountRegistration.DEFAULT_PORT)
- || !resource.equals(JabberAccountRegistration.DEFAULT_RESOURCE)
- || !priority.equals(JabberAccountRegistration.DEFAULT_PRIORITY))
- {
- enableAdvOpButton.setSelected(true);
-
- // The server field should stay disabled in modification mode,
- // because the user should not be able to change anything concerning
- // the account identifier and server name is part of it.
- serverField.setEnabled(false);
-
- portField.setEnabled(true);
- resourceField.setEnabled(true);
- priorityField.setEnabled(true);
- }
+ this.isServerOverridden = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
}
/**
@@ -548,7 +484,7 @@ public class FirstWizardPage
*/
private void setServerFieldAccordingToUserID()
{
- if (!enableAdvOpButton.isSelected())
+ if (!wizard.isModification() || !isServerOverridden)
{
String userId = userIDField.getText();
@@ -573,32 +509,6 @@ public class FirstWizardPage
}
}
- /**
- * Checks if the accountName corresponds to an already existing account.
- *
- * @param accountName the name of the account to check
- * @return TRUE if an account with the specified name already exists, FALSE -
- * otherwise.
- */
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory = JabberAccRegWizzActivator
- .getJabberProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- {
- return true;
- }
- }
- return false;
- }
-
public Object getSimpleForm()
{
return userIDPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index fbcf0c4..68b6177 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -160,17 +160,17 @@ public class JabberAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin( registration.getUserID(),
registration.getPassword());
}
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= JabberAccRegWizzActivator.getJabberProtocolProviderFactory();
@@ -192,12 +192,14 @@ public class JabberAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String userName,
String passwd)
+ throws OperationFailedException
{
if(logger.isTraceEnabled())
{
logger.trace("Preparing to install account for user " + userName);
}
- Hashtable accountProperties = new Hashtable();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
if (registration.isRememberPassword())
{
@@ -211,6 +213,11 @@ public class JabberAccountRegistrationWizard
if (registration.getServerAddress() != null)
{
serverName = registration.getServerAddress();
+
+ if (userName.indexOf(serverName) < 0)
+ accountProperties.put(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
+ Boolean.toString(true));
}
else
{
@@ -248,7 +255,8 @@ public class JabberAccountRegistrationWizard
}
AccountID accountID = providerFactory.installAccount(
- userName, accountProperties);
+ userName,
+ accountProperties);
ServiceReference serRef = providerFactory
.getProviderForAccount(accountID);
@@ -259,19 +267,27 @@ public class JabberAccountRegistrationWizard
}
catch (IllegalArgumentException exc)
{
- logger.warn("Failed to create a jabber account.", exc);
- JabberAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Username or password is null.",
+ OperationFailedException.ILLEGAL_ARGUMENT);
}
catch (IllegalStateException exc)
{
- logger.warn("Failed to create a jabber account.", exc);
- JabberAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
+ }
+ catch (Exception exc)
+ {
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
index e81805d..160198e 100644
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/FirstWizardPage.java
@@ -42,9 +42,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -104,8 +101,6 @@ public class FirstWizardPage
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -181,29 +176,17 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String uin = uinField.getText();
-
- if (!wizard.isModification() && isExistingAccount(uin))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
+ MsnAccountRegistration registration
+ = wizard.getRegistration();
- MsnAccountRegistration registration
- = wizard.getRegistration();
+ registration.setId(uinField.getText());
- registration.setId(uinField.getText());
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
- if (passField.getPassword() != null)
- registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- registration.setRememberPassword(rememberPassBox.isSelected());
- }
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
isCommitted = true;
}
@@ -283,19 +266,6 @@ public class FirstWizardPage
}
}
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory =
- MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return mainPanel;
diff --git a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
index 8009f14..a94c72c 100644
--- a/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/msnaccregwizz/MsnAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -23,6 +24,8 @@ import org.osgi.framework.*;
public class MsnAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(MsnAccountRegistrationWizard.class);
private FirstWizardPage firstWizardPage;
@@ -134,9 +137,9 @@ public class MsnAccountRegistrationWizard
* account.
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin( registration.getId(),
registration.getPassword());
@@ -149,8 +152,8 @@ public class MsnAccountRegistrationWizard
* account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory =
MsnAccRegWizzActivator.getMsnProtocolProviderFactory();
@@ -170,6 +173,7 @@ public class MsnAccountRegistrationWizard
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory, String user, String passwd)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -201,19 +205,21 @@ public class MsnAccountRegistrationWizard
(ProtocolProviderService) MsnAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- MsnAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- MsnAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
index 7861842..de3853d 100644
--- a/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/RssAccountRegistrationWizard.java
@@ -13,6 +13,7 @@ import org.osgi.framework.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
/**
* The <tt>RssAccountRegistrationWizard</tt> is an implementation of the
@@ -24,6 +25,9 @@ import net.java.sip.communicator.service.protocol.*;
public class RssAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(RssAccountRegistrationWizard.class);
+
/**
* The first page of the rss account registration wizard.
*/
@@ -131,9 +135,9 @@ public class RssAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin(registration.getUserID(), null);
}
@@ -143,8 +147,8 @@ public class RssAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= RssAccRegWizzActivator.getRssProtocolProviderFactory();
@@ -162,6 +166,7 @@ public class RssAccountRegistrationWizard
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String user)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -182,19 +187,21 @@ public class RssAccountRegistrationWizard
RssAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- RssAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- RssAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java b/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java
index 41df698..f457df3 100644
--- a/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java
+++ b/src/net/java/sip/communicator/plugin/simpleaccreg/InitialAccountRegistrationFrame.java
@@ -360,7 +360,7 @@ public class InitialAccountRegistrationFrame
return (username != null) && (username.length() > 0);
}
- public void signin()
+ public void signin() throws OperationFailedException
{
ProtocolProviderService protocolProvider =
wizard.signin(usernameField.getText(), new String(passwordField
@@ -452,9 +452,40 @@ public class InitialAccountRegistrationFrame
{
AccountRegistrationPanel regForm = regIterator.next();
- if (regForm.isFilled())
+ try
{
- regForm.signin();
+ if (regForm.isFilled())
+ regForm.signin();
+ }
+ catch (OperationFailedException e)
+ {
+ logger.debug("The sign in operation has failed.");
+
+ PopupDialog popupDialog
+ = SimpleAccountRegistrationActivator.getUIService()
+ .getPopupDialog();
+
+ if (e.getErrorCode()
+ == OperationFailedException.ILLEGAL_ARGUMENT)
+ {
+ popupDialog.showMessagePopupDialog(
+ Resources.getString(
+ "service.gui.USERNAME_NULL"),
+ Resources.getString(
+ "service.gui.ERROR"),
+ PopupDialog.ERROR_MESSAGE);
+ }
+ else if (e.getErrorCode()
+ == OperationFailedException
+ .IDENTIFICATION_CONFLICT)
+ {
+ popupDialog.showMessagePopupDialog(
+ Resources.getString(
+ "service.gui.USER_EXISTS_ERROR"),
+ Resources.getString(
+ "service.gui.ERROR"),
+ PopupDialog.ERROR_MESSAGE);
+ }
}
}
}
diff --git a/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java b/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java
index a5ace3b..1d5db47 100644
--- a/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java
+++ b/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java
@@ -10,6 +10,7 @@ import java.awt.*;
import java.util.*;
import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@@ -84,13 +85,12 @@ public class SimpleAccountRegistrationActivator
.getService(serRefs[serRefIndex]);
for (Iterator<AccountID> registeredAccountIter =
- providerFactory.getRegisteredAccounts().iterator(); registeredAccountIter
- .hasNext();)
+ providerFactory.getRegisteredAccounts().iterator();
+ registeredAccountIter.hasNext();)
{
AccountID accountID = registeredAccountIter.next();
- boolean isHidden =
- accountID
- .getAccountProperty(ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
+ boolean isHidden = accountID.getAccountProperty(
+ ProtocolProviderFactory.IS_PROTOCOL_HIDDEN) != null;
if (!isHidden)
{
@@ -149,4 +149,26 @@ public class SimpleAccountRegistrationActivator
return (MetaContactListService) bundleContext
.getService(serviceReference);
}
+
+ /**
+ * Returns the <tt>UIService</tt> obtained from the bundle
+ * context.
+ * <p>
+ * <b>Note</b>: Because this plug-in is meant to be initially displayed (if
+ * necessary) and not get used afterwards, the method doesn't cache the
+ * return value. Make sure you call it as little as possible if execution
+ * speed is under consideration.
+ * </p>
+ *
+ * @return the <tt>MetaContactListService</tt> obtained from the bundle
+ * context
+ */
+ public static UIService getUIService()
+ {
+ ServiceReference serviceReference
+ = bundleContext.getServiceReference(UIService.class.getName());
+
+ return (UIService) bundleContext
+ .getService(serviceReference);
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
index 9f7491e..2a69e6c 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/FirstWizardPage.java
@@ -49,9 +49,6 @@ public class FirstWizardPage
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JTextField uinField = new JTextField();
private JPasswordField passField = new JPasswordField();
@@ -69,10 +66,6 @@ public class FirstWizardPage
private JPanel valuesAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JCheckBox overrideServerCheckBox =
- new SIPCommCheckBox(Resources.getString(
- "plugin.sipaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"), false);
-
private JLabel serverLabel
= new JLabel(Resources.getString("plugin.sipaccregwizz.REGISTRAR"));
@@ -111,9 +104,11 @@ public class FirstWizardPage
private JPanel buttonsPresOpPanel =
new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JPanel labelsPresOpPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ private JPanel labelsPresOpPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
- private JPanel valuesPresOpPanel = new TransparentPanel(new GridLayout(0, 1, 10, 10));
+ private JPanel valuesPresOpPanel
+ = new TransparentPanel(new GridLayout(0, 1, 10, 10));
private JCheckBox enablePresOpButton =
new SIPCommCheckBox(Resources
@@ -124,7 +119,8 @@ public class FirstWizardPage
.getString("plugin.sipaccregwizz.FORCE_P2P_PRESENCE"), true);
private JLabel pollPeriodLabel = new JLabel(
- Resources.getString("plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
+ Resources.getString(
+ "plugin.sipaccregwizz.OFFLINE_CONTACT_POLLING_PERIOD"));
private JLabel subscribeExpiresLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.SUBSCRIPTION_EXPIRATION"));
@@ -135,11 +131,14 @@ public class FirstWizardPage
private JTextField subscribeExpiresField =
new JTextField(SIPAccountRegistration.DEFAULT_SUBSCRIBE_EXPIRES);
- private JPanel keepAlivePanel = new TransparentPanel(new BorderLayout(10, 10));
+ private JPanel keepAlivePanel
+ = new TransparentPanel(new BorderLayout(10, 10));
- private JPanel keepAliveLabels = new TransparentPanel(new GridLayout(0, 1, 5, 5));
+ private JPanel keepAliveLabels
+ = new TransparentPanel(new GridLayout(0, 1, 5, 5));
- private JPanel keepAliveValues = new TransparentPanel(new GridLayout(0, 1, 5, 5));
+ private JPanel keepAliveValues
+ = new TransparentPanel(new GridLayout(0, 1, 5, 5));
private JLabel keepAliveMethodLabel = new JLabel(
Resources.getString("plugin.sipaccregwizz.KEEP_ALIVE_METHOD"));
@@ -169,6 +168,8 @@ public class FirstWizardPage
private boolean isCommitted = false;
+ private boolean isServerOverridden = false;
+
/**
* Creates an instance of <tt>FirstWizardPage</tt>.
*
@@ -207,8 +208,6 @@ public class FirstWizardPage
this.transportCombo.addItemListener(this);
this.rememberPassBox.setSelected(true);
- existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -235,41 +234,6 @@ public class FirstWizardPage
tabbedPane.addTab( Resources.getString("service.gui.SUMMARY"),
firstTabPanel);
- serverField.setEnabled(false);
- serverPortField.setEnabled(false);
- proxyField.setEnabled(false);
- proxyPortField.setEnabled(false);
- transportCombo.setEnabled(false);
-
- overrideServerCheckBox.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- // Perform action
- JCheckBox cb = (JCheckBox) evt.getSource();
-
- if (!wizard.isModification())
- serverField.setEnabled(cb.isSelected());
-
- serverPortField.setEnabled(cb.isSelected());
- proxyField.setEnabled(cb.isSelected());
- proxyPortField.setEnabled(cb.isSelected());
- transportCombo.setEnabled(cb.isSelected());
-
- if(!cb.isSelected())
- {
- setServerFieldAccordingToUIN();
-
- serverPortField
- .setText(SIPAccountRegistration.DEFAULT_PORT);
- proxyPortField
- .setText(SIPAccountRegistration.DEFAULT_PORT);
- transportCombo
- .setSelectedItem(SIPAccountRegistration.DEFAULT_TRANSPORT);
- }
- }
- });
-
transportCombo
.setSelectedItem(SIPAccountRegistration.DEFAULT_TRANSPORT);
@@ -285,11 +249,10 @@ public class FirstWizardPage
valuesAdvOpPanel.add(proxyPortField);
valuesAdvOpPanel.add(transportCombo);
- advancedOpPanel.add(overrideServerCheckBox, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
advancedOpPanel.add(enableDefaultEncryption, BorderLayout.SOUTH);
-
+
advancedOpPanel.setBorder(BorderFactory.createTitledBorder(Resources
.getString("plugin.aimaccregwizz.ADVANCED_OPTIONS")));
@@ -302,9 +265,7 @@ public class FirstWizardPage
// Perform action
JCheckBox cb = (JCheckBox) evt.getSource();
- forceP2PPresOpButton.setEnabled(cb.isSelected());
- pollPeriodField.setEnabled(cb.isSelected());
- subscribeExpiresField.setEnabled(cb.isSelected());
+ setPresenceOptionsEnabled(cb.isSelected());
}
});
@@ -423,47 +384,36 @@ public class FirstWizardPage
uin = uin.substring(0, indexOfSeparator);
}
- String server = serverField.getText();
+ SIPAccountRegistration registration = wizard.getRegistration();
+
+ registration.setId(uinField.getText());
+
+ if (passField.getPassword() != null)
+ registration.setPassword(new String(passField.getPassword()));
+
+ registration.setRememberPassword(rememberPassBox.isSelected());
+
+ registration.setServerAddress(serverField.getText());
+ registration.setServerPort(serverPortField.getText());
+ registration.setProxy(proxyField.getText());
+ registration.setProxyPort(proxyPortField.getText());
+ registration.setPreferredTransport(transportCombo.getSelectedItem()
+ .toString());
+
+ registration.setEnablePresence(enablePresOpButton.isSelected());
+ registration.setForceP2PMode(forceP2PPresOpButton.isSelected());
+ registration.setDefaultEncryption(enableDefaultEncryption.isSelected());
+ registration.setPollingPeriod(pollPeriodField.getText());
+ registration.setSubscriptionExpiration(subscribeExpiresField
+ .getText());
+ registration.setKeepAliveMethod(
+ keepAliveMethodBox.getSelectedItem().toString());
+ registration.setKeepAliveInterval(keepAliveIntervalValue.getText());
- if (!wizard.isModification() && isExistingAccount(uin, server))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
-
- SIPAccountRegistration registration = wizard.getRegistration();
-
- registration.setId(uinField.getText());
-
- if (passField.getPassword() != null)
- registration.setPassword(new String(passField.getPassword()));
-
- registration.setRememberPassword(rememberPassBox.isSelected());
-
- registration.setServerAddress(serverField.getText());
- registration.setServerPort(serverPortField.getText());
- registration.setProxy(proxyField.getText());
- registration.setProxyPort(proxyPortField.getText());
- registration.setPreferredTransport(transportCombo.getSelectedItem()
- .toString());
-
- registration.setEnablePresence(enablePresOpButton.isSelected());
- registration.setForceP2PMode(forceP2PPresOpButton.isSelected());
- registration.setDefaultEncryption(enableDefaultEncryption.isSelected());
- registration.setPollingPeriod(pollPeriodField.getText());
- registration.setSubscriptionExpiration(subscribeExpiresField
- .getText());
- registration.setKeepAliveMethod(
- keepAliveMethodBox.getSelectedItem().toString());
- registration.setKeepAliveInterval(keepAliveIntervalValue.getText());
- }
wizard.getWizardContainer().setBackButtonEnabled(true);
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
+
this.isCommitted = true;
}
@@ -531,49 +481,38 @@ public class FirstWizardPage
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
- String password =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PASSWORD);
+ String password = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PASSWORD);
- String serverAddress =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
+ String serverAddress = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.SERVER_ADDRESS);
- String serverPort =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT);
+ String serverPort = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.SERVER_PORT);
- String proxyAddress =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS);
+ String proxyAddress = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PROXY_ADDRESS);
- String proxyPort =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PROXY_PORT);
+ String proxyPort = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PROXY_PORT);
- String preferredTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ String preferredTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
- boolean enablePresence =
- accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.IS_PRESENCE_ENABLED, false);
+ boolean enablePresence = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_PRESENCE_ENABLED, false);
- boolean forceP2P =
- accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.FORCE_P2P_MODE, false);
+ boolean forceP2P = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.FORCE_P2P_MODE, false);
- boolean enabledDefaultEncryption =
- accountID.getAccountPropertyBoolean(
- ProtocolProviderFactory.DEFAULT_ENCRYPTION, false);
+ boolean enabledDefaultEncryption = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.DEFAULT_ENCRYPTION, false);
- String pollingPeriod =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.POLLING_PERIOD);
+ String pollingPeriod = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.POLLING_PERIOD);
- String subscriptionPeriod =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
+ String subscriptionPeriod = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.SUBSCRIPTION_EXPIRATION);
String keepAliveMethod =
accountID.getAccountPropertyString("KEEP_ALIVE_METHOD");
@@ -581,6 +520,9 @@ public class FirstWizardPage
String keepAliveInterval =
accountID.getAccountPropertyString("KEEP_ALIVE_INTERVAL");
+ this.isServerOverridden = accountID.getAccountPropertyBoolean(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN, false);
+
uinField.setEnabled(false);
this.uinField.setText((serverAddress == null) ? accountID.getUserID()
: (accountID.getUserID() + "@" + serverAddress));
@@ -596,31 +538,11 @@ public class FirstWizardPage
serverPortField.setText(serverPort);
proxyField.setText(proxyAddress);
- // The order of the next two fields is important, as a changelister of
- // the transportCombo sets the proxyPortField to its default
+ // The order of the next two fields is important, as a change listener
+ // of the transportCombo sets the proxyPortField to its default
transportCombo.setSelectedItem(preferredTransport);
proxyPortField.setText(proxyPort);
- if (!(SIPAccountRegistration.DEFAULT_PORT.equals(serverPort)
- || SIPAccountRegistration.DEFAULT_TLS_PORT.equals(serverPort))
- || !(SIPAccountRegistration.DEFAULT_PORT.equals(proxyPort)
- || SIPAccountRegistration.DEFAULT_TLS_PORT.equals(proxyPort))
- || !transportCombo.getSelectedItem()
- .equals(SIPAccountRegistration.DEFAULT_TRANSPORT))
- {
- overrideServerCheckBox.setSelected(true);
-
- // The server field should stay disabled in modification mode,
- // because the user should not be able to change anything concerning
- // the account identifier and server name is part of it.
- serverField.setEnabled(false);
-
- serverPortField.setEnabled(true);
- proxyField.setEnabled(true);
- proxyPortField.setEnabled(true);
- transportCombo.setEnabled(true);
- }
-
enablePresOpButton.setSelected(enablePresence);
forceP2PPresOpButton.setSelected(forceP2P);
enableDefaultEncryption.setSelected(enabledDefaultEncryption);
@@ -629,8 +551,7 @@ public class FirstWizardPage
if (!enablePresence)
{
- pollPeriodField.setEnabled(false);
- subscribeExpiresField.setEnabled(false);
+ setPresenceOptionsEnabled(enablePresence);
}
keepAliveMethodBox.setSelectedItem(keepAliveMethod);
@@ -643,16 +564,29 @@ public class FirstWizardPage
*/
private void setServerFieldAccordingToUIN()
{
- if (!overrideServerCheckBox.isSelected())
- {
- String serverAddress
- = wizard.getServerFromUserName(uinField.getText());
+ String serverAddress
+ = wizard.getServerFromUserName(uinField.getText());
+ if (!wizard.isModification() || !isServerOverridden)
+ {
serverField.setText(serverAddress);
proxyField.setText(serverAddress);
}
}
+ /**
+ * Enables or disable all presence related options.
+ *
+ * @param isEnabled <code>true</code> to enable the presence related
+ * options, <code>false</code> - to disable them.
+ */
+ private void setPresenceOptionsEnabled(boolean isEnabled)
+ {
+ forceP2PPresOpButton.setEnabled(isEnabled);
+ pollPeriodField.setEnabled(isEnabled);
+ subscribeExpiresField.setEnabled(isEnabled);
+ }
+
public void itemStateChanged(ItemEvent e)
{
if (e.getStateChange() == ItemEvent.SELECTED
@@ -668,22 +602,6 @@ public class FirstWizardPage
}
}
- private boolean isExistingAccount(String accountName, String serverName)
- {
- ProtocolProviderFactory factory =
- SIPAccRegWizzActivator.getSIPProtocolProviderFactory();
- java.util.List<AccountID> registeredAccounts =
- factory.getRegisteredAccounts();
-
- for (AccountID accountID : registeredAccounts)
- {
- if (accountName.equalsIgnoreCase(accountID.getUserID())
- && serverName.equalsIgnoreCase(accountID.getService()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return uinPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
index cc21701..dddd142 100644
--- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java
@@ -206,9 +206,9 @@ public class SIPAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin(registration.getId(), registration.getPassword());
}
@@ -219,6 +219,7 @@ public class SIPAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
ProtocolProviderFactory factory
= SIPAccRegWizzActivator.getSIPProtocolProviderFactory();
@@ -245,8 +246,10 @@ public class SIPAccountRegistrationWizard
ProtocolProviderFactory providerFactory,
String userName,
String passwd)
+ throws OperationFailedException
{
- Hashtable<String, String> accountProperties = new Hashtable<String, String>();
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
if(registration.isRememberPassword())
{
@@ -258,10 +261,18 @@ public class SIPAccountRegistrationWizard
serverAddress = registration.getServerAddress();
else
serverAddress = getServerFromUserName(userName);
+
if (serverAddress != null)
+ {
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
serverAddress);
+ if (userName.indexOf(serverAddress) < 0)
+ accountProperties.put(
+ ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
+ Boolean.toString(true));
+ }
+
accountProperties.put(ProtocolProviderFactory.SERVER_PORT,
registration.getServerPort());
@@ -270,6 +281,7 @@ public class SIPAccountRegistrationWizard
proxyAddress = registration.getProxy();
else
proxyAddress = getServerFromUserName(userName);
+
if (proxyAddress != null)
accountProperties.put(ProtocolProviderFactory.PROXY_ADDRESS,
proxyAddress);
@@ -324,19 +336,21 @@ public class SIPAccountRegistrationWizard
= (ProtocolProviderService) SIPAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- SIPAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- SIPAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
index 5b3dbc9..6185285 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/FirstWizardPage.java
@@ -51,9 +51,6 @@ public class FirstWizardPage
private JLabel knownHostsFile
= new JLabel(Resources.getString("plugin.sshaccregwizz.KNOWN_HOSTS"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel1 = new TransparentPanel();
private JPanel emptyPanel2 = new TransparentPanel();
@@ -172,7 +169,6 @@ public class FirstWizardPage
this.emptyPanel9.setOpaque(false);
this.accountIDField.getDocument().addDocumentListener(this);
- this.existingAccountLabel.setForeground(Color.RED);
/*
* Following empty panels cover the space needed between key labels
@@ -334,23 +330,12 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = accountIDField.getText();
-
- if (isExistingAccount(userID))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- accountPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- accountPanel.remove(existingAccountLabel);
-
- registration.setAccountID(accountIDField.getText());
- registration.setIdentityFile(identityFileField.getText());
- registration.setKnownHostsFile(knownHostsFileField.getText());
- }
+ registration.setAccountID(accountIDField.getText());
+ registration.setIdentityFile(identityFileField.getText());
+ registration.setKnownHostsFile(knownHostsFileField.getText());
+
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
+
isCommitted = true;
}
@@ -411,33 +396,6 @@ public class FirstWizardPage
{
}
- /**
- * Verifies whether there is already an account installed with the same
- * details as the one that the user has just entered.
- *
- * @param accountID the name of the user that the account is registered for
- * @return true if there is already an account for this accountID and false
- * otherwise.
- */
- private boolean isExistingAccount(String userID)
- {
- ProtocolProviderFactory factory
- = SSHAccRegWizzActivator.getSSHProtocolProviderFactory();
-
- ArrayList registeredAccounts = factory.getRegisteredAccounts();
-
- for (int i = 0; i < registeredAccounts.size(); i++)
- {
- AccountID accountID = (AccountID) registeredAccounts.get(i);
-
- if (userID.equalsIgnoreCase(accountID.getUserID()))
- {
- return true;
- }
- }
- return false;
- }
-
public Object getSimpleForm()
{
return accountPanel;
diff --git a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
index b2519bd..b662703 100644
--- a/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/sshaccregwizz/SSHAccountRegistrationWizard.java
@@ -22,6 +22,7 @@ import org.osgi.framework.*;
import net.java.sip.communicator.impl.protocol.ssh.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
/**
* The <tt>SSHAccountRegistrationWizard</tt> is an implementation of the
@@ -31,8 +32,11 @@ import net.java.sip.communicator.service.protocol.*;
* @author Shobhit Jindal
*/
public class SSHAccountRegistrationWizard
- implements AccountRegistrationWizard {
-
+ implements AccountRegistrationWizard
+{
+ private final Logger logger
+ = Logger.getLogger(SSHAccountRegistrationWizard.class);
+
/**
* The first page of the ssh account registration wizard.
*/
@@ -146,9 +150,9 @@ public class SSHAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin(registration.getAccountID(), null);
}
@@ -160,8 +164,8 @@ public class SSHAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= SSHAccRegWizzActivator.getSSHProtocolProviderFactory();
@@ -180,9 +184,11 @@ public class SSHAccountRegistrationWizard
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
- String user) {
-
- Hashtable accountProperties = new Hashtable();
+ String user)
+ throws OperationFailedException
+ {
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
accountProperties.put(
ProtocolProviderFactory.NO_PASSWORD_REQUIRED,
@@ -205,21 +211,23 @@ public class SSHAccountRegistrationWizard
SSHAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- SSHAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- SSHAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
-
+
return protocolProvider;
}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
index 80d76f7..c81f661 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
@@ -44,9 +44,6 @@ public class FirstWizardPage
private JLabel passLabel
= new JLabel(Resources.getString("service.gui.PASSWORD"));
- private JLabel existingAccountLabel =
- new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
@@ -106,8 +103,6 @@ public class FirstWizardPage
this.uinField.getDocument().addDocumentListener(this);
this.rememberPassBox.setSelected(true);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.uinExampleLabel.setForeground(Color.GRAY);
this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
this.emptyPanel.setMaximumSize(new Dimension(40, 35));
@@ -183,25 +178,14 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String uin = uinField.getText();
+ YahooAccountRegistration registration = wizard.getRegistration();
- if (!wizard.isModification() && isExistingAccount(uin))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- uinPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- uinPassPanel.remove(existingAccountLabel);
+ registration.setUin(uinField.getText());
+ registration.setPassword(new String(passField.getPassword()));
+ registration.setRememberPassword(rememberPassBox.isSelected());
- YahooAccountRegistration registration = wizard.getRegistration();
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- registration.setUin(uinField.getText());
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
- }
isCommitted = true;
}
@@ -281,19 +265,6 @@ public class FirstWizardPage
}
}
- private boolean isExistingAccount(String accountName)
- {
- ProtocolProviderFactory factory =
- YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- if (accountName.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
return uinPassPanel;
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
index 8873294..00c6995 100644
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
@@ -10,6 +10,7 @@ import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
@@ -23,6 +24,8 @@ import org.osgi.framework.*;
public class YahooAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private final Logger logger
+ = Logger.getLogger(YahooAccountRegistrationWizard.class);
private FirstWizardPage firstWizardPage;
@@ -136,9 +139,9 @@ public class YahooAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
+ firstWizardPage.commitPage();
return signin( registration.getUin(),
registration.getPassword());
@@ -151,8 +154,8 @@ public class YahooAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory =
YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
@@ -172,6 +175,7 @@ public class YahooAccountRegistrationWizard
*/
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory, String user, String passwd)
+ throws OperationFailedException
{
Hashtable accountProperties = new Hashtable();
@@ -202,19 +206,21 @@ public class YahooAccountRegistrationWizard
(ProtocolProviderService) YahooAccRegWizzActivator
.bundleContext.getService(serRef);
}
- catch (IllegalArgumentException e)
+ catch (IllegalStateException exc)
{
- YahooAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException e)
+ catch (Exception exc)
{
- YahooAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(e.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
return protocolProvider;
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
index 78dfcd0..d21e865 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java
@@ -46,9 +46,6 @@ public class FirstWizardPage
private JLabel mailLabel
= new JLabel(Resources.getString("plugin.zeroaccregwizz.EMAIL"));
- private JLabel existingAccountLabel
- = new JLabel(Resources.getString("service.gui.EXISTING_ACCOUNT_ERROR"));
-
private JPanel emptyPanel = new TransparentPanel();
private JPanel emptyPanel2 = new TransparentPanel();
private JPanel emptyPanel3 = new TransparentPanel();
@@ -113,8 +110,6 @@ public class FirstWizardPage
// not used so disable it for the moment
this.rememberContacts.setEnabled(false);
- this.existingAccountLabel.setForeground(Color.RED);
-
this.userIDExampleLabel.setForeground(Color.GRAY);
this.userIDExampleLabel.setFont(
userIDExampleLabel.getFont().deriveFont(8));
@@ -228,32 +223,19 @@ public class FirstWizardPage
*/
public void commitPage()
{
- String userID = userIDField.getText();
+ ZeroconfAccountRegistration registration
+ = wizard.getRegistration();
- // TODO: isExistingAccount blocks (probably badly/not implemented) !!!!
- if (!wizard.isModification() && isExistingAccount(userID))
- {
- nextPageIdentifier = FIRST_PAGE_IDENTIFIER;
- userPassPanel.add(existingAccountLabel, BorderLayout.NORTH);
- this.revalidate();
- }
- else
- {
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- userPassPanel.remove(existingAccountLabel);
+ registration.setUserID(userIDField.getText());
+ registration.setFirst(firstField.getText());
+ registration.setLast(lastField.getText());
+ registration.setMail(mailField.getText());
- ZeroconfAccountRegistration registration
- = wizard.getRegistration();
+ registration.setRememberContacts(rememberContacts.isSelected());
- registration.setUserID(userIDField.getText());
- registration.setFirst(firstField.getText());
- registration.setLast(lastField.getText());
- registration.setMail(mailField.getText());
+ nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
- registration.setRememberContacts(rememberContacts.isSelected());
- }
-
- isCommitted = true;
+ isCommitted = true;
}
/**
@@ -348,27 +330,6 @@ public class FirstWizardPage
this.rememberContacts.setSelected(true);
}
- /**
- * Verifies whether there is already an account installed with the same
- * details as the one that the user has just entered.
- *
- * @param userID the name of the user that the account is registered for
- * @return true if there is already an account for this userID and false
- * otherwise.
- */
- private boolean isExistingAccount(String userID)
- {
- ProtocolProviderFactory factory
- = ZeroconfAccRegWizzActivator.getZeroconfProtocolProviderFactory();
-
- for (AccountID accountID : factory.getRegisteredAccounts())
- {
- if (userID.equalsIgnoreCase(accountID.getUserID()))
- return true;
- }
- return false;
- }
-
public Object getSimpleForm()
{
JPanel simplePanel = new TransparentPanel(new BorderLayout());
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
index c81afa7..ca0cdfa 100644
--- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java
@@ -13,6 +13,7 @@ import org.osgi.framework.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
+import net.java.sip.communicator.util.*;
/**
* The <tt>ZeroconfAccountRegistrationWizard</tt> is an implementation of the
@@ -25,6 +26,8 @@ import net.java.sip.communicator.service.protocol.*;
public class ZeroconfAccountRegistrationWizard
implements AccountRegistrationWizard
{
+ private Logger logger
+ = Logger.getLogger(ZeroconfAccountRegistrationWizard.class);
/**
* The first page of the zeroconf account registration wizard.
@@ -138,10 +141,10 @@ public class ZeroconfAccountRegistrationWizard
* @return ProtocolProviderService
*/
public ProtocolProviderService signin()
+ throws OperationFailedException
{
- if (!firstWizardPage.isCommitted())
- firstWizardPage.commitPage();
-
+ firstWizardPage.commitPage();
+
return signin(registration.getUserID(), null);
}
@@ -152,8 +155,8 @@ public class ZeroconfAccountRegistrationWizard
* created account.
*/
public ProtocolProviderService signin(String userName, String password)
+ throws OperationFailedException
{
- firstWizardPage = null;
ProtocolProviderFactory factory
= ZeroconfAccRegWizzActivator.getZeroconfProtocolProviderFactory();
@@ -172,9 +175,11 @@ public class ZeroconfAccountRegistrationWizard
public ProtocolProviderService installAccount(
ProtocolProviderFactory providerFactory,
String user)
+ throws OperationFailedException
{
- Hashtable accountProperties = new Hashtable();
-
+ Hashtable<String, String> accountProperties
+ = new Hashtable<String, String>();
+
accountProperties.put("first", registration.getFirst());
accountProperties.put("last", registration.getLast());
accountProperties.put("mail", registration.getMail());
@@ -205,21 +210,24 @@ public class ZeroconfAccountRegistrationWizard
ZeroconfAccRegWizzActivator.bundleContext
.getService(serRef);
}
- catch (IllegalArgumentException exc)
+ catch (IllegalStateException exc)
{
- ZeroconfAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Account already exists.",
+ OperationFailedException.IDENTIFICATION_CONFLICT);
}
- catch (IllegalStateException exc)
+ catch (Exception exc)
{
- ZeroconfAccRegWizzActivator.getUIService().getPopupDialog()
- .showMessagePopupDialog(exc.getMessage(),
- Resources.getString("service.gui.ERROR"),
- PopupDialog.ERROR_MESSAGE);
+ logger.warn(exc.getMessage());
+
+ throw new OperationFailedException(
+ "Failed to add account",
+ OperationFailedException.GENERAL_ERROR);
}
+
return protocolProvider;
}
diff --git a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
index e5d8dc2..7a9b949 100644
--- a/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/service/gui/AccountRegistrationWizard.java
@@ -118,9 +118,9 @@ public interface AccountRegistrationWizard
/**
* Defines the operations that will be executed when the user clicks on
* the wizard "Signin" button.
- *
*/
- public ProtocolProviderService signin();
+ public ProtocolProviderService signin()
+ throws OperationFailedException;
/**
* Defines the operations that will be executed when the user clicks on
@@ -130,7 +130,8 @@ public interface AccountRegistrationWizard
* @param password the password to sign in with
*/
public ProtocolProviderService signin( String userName,
- String password);
+ String password)
+ throws OperationFailedException;
/**
* Returns <code>true</code> if the web sign up is supported by the current
diff --git a/src/net/java/sip/communicator/service/gui/WizardPage.java b/src/net/java/sip/communicator/service/gui/WizardPage.java
index e81626e..84d9285 100644
--- a/src/net/java/sip/communicator/service/gui/WizardPage.java
+++ b/src/net/java/sip/communicator/service/gui/WizardPage.java
@@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.service.gui;
+import net.java.sip.communicator.service.protocol.*;
+
/**
* The <tt>WizardPage</tt> represents a page in a <tt>WizardContainer</tt>.
* A page has a unique identifier. Each page should specify the identifier
@@ -26,8 +28,8 @@ package net.java.sip.communicator.service.gui;
*
* @author Yana Stamcheva
*/
-public interface WizardPage {
-
+public interface WizardPage
+{
/**
* The identifier of the last wizard page.
*/
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
index ca6c8ba..ae1994f 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java
@@ -189,6 +189,11 @@ public abstract class ProtocolProviderFactory
= "SERVER_ADDRESS_VALIDATED";
/**
+ * Indicates if the server settings are over
+ */
+ public static final String IS_SERVER_OVERRIDDEN
+ = "IS_SERVER_OVERRIDDEN";
+ /**
* Indicates if the proxy address has been validated.
*/
public static final String PROXY_ADDRESS_VALIDATED