aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-09-20 21:39:08 +0200
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-10-21 22:40:56 +0200
commit978dda49d49f8b20903b9002ccb28f217530861d (patch)
tree3a6a1c3403b74596184e617516eb459e942ff142 /src/net/java/sip/communicator/plugin
parent057d7117e5a0e93ef37ac588f9fd7429cb51b61b (diff)
downloadjitsi-978dda49d49f8b20903b9002ccb28f217530861d.zip
jitsi-978dda49d49f8b20903b9002ccb28f217530861d.tar.gz
jitsi-978dda49d49f8b20903b9002ccb28f217530861d.tar.bz2
Implemented modifyAccount method in ProtocolProviderFactory such that we
do not have to uninstall and (re)install the account that has been edited.
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java3
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java52
-rw-r--r--src/net/java/sip/communicator/plugin/ircaccregwizz/package-info.java4
3 files changed, 38 insertions, 21 deletions
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
index d9f1c41..a597f04 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java
@@ -18,6 +18,7 @@ import org.osgi.framework.*;
* Registers the <tt>IrcAccountRegistrationWizard</tt> in the UI Service.
*
* @author Lionel Ferreira & Michael Tarantino
+ * @author Danny van Heumen
*/
public class IrcAccRegWizzActivator
extends AbstractServiceDependentActivator
@@ -106,7 +107,7 @@ public class IrcAccRegWizzActivator
*/
public static ProtocolProviderFactory getIrcProtocolProviderFactory()
{
- ServiceReference[] serRefs = null;
+ ServiceReference<?>[] serRefs = null;
String osgiFilter = "("
+ ProtocolProviderFactory.PROTOCOL
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
index 203e059..22fb2de 100644
--- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccountRegistrationWizard.java
@@ -21,10 +21,15 @@ import org.osgi.framework.*;
* the user to create and configure a new IRC account.
*
* @author Lionel Ferreira & Michael Tarantino
+ * @author Danny van Heumen
*/
public class IrcAccountRegistrationWizard
extends DesktopAccountRegistrationWizard
{
+ private static final int WIZARD_DIALOG_HEIGHT = 500;
+
+ private static final int WIZARD_DIALOG_WIDTH = 600;
+
private final Logger logger
= Logger.getLogger(IrcAccountRegistrationWizard.class);
@@ -47,7 +52,7 @@ public class IrcAccountRegistrationWizard
* @param wizardContainer the wizard container, where this wizard
* is added
*/
- public IrcAccountRegistrationWizard(WizardContainer wizardContainer)
+ public IrcAccountRegistrationWizard(final WizardContainer wizardContainer)
{
setWizardContainer(wizardContainer);
@@ -67,8 +72,8 @@ public class IrcAccountRegistrationWizard
}
/**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code> method.
- * Returns the image used to decorate the wizard page
+ * Implements the <code>AccountRegistrationWizard.getPageImage</code>
+ * method. Returns the image used to decorate the wizard page
*
* @return byte[] the image used to decorate the wizard page
*/
@@ -127,19 +132,27 @@ public class IrcAccountRegistrationWizard
* @return Iterator
*/
@Override
- public Iterator<Map.Entry<String,String>> getSummary()
+ public Iterator<Map.Entry<String, String>> getSummary()
{
- Hashtable<String,String> summaryTable = new Hashtable<String,String>();
+ Hashtable<String, String> summaryTable =
+ new Hashtable<String, String>();
String pass = new String();
String port = new String();
if (registration.isRequiredPassword())
+ {
pass = "required";
+ }
else
+ {
pass = "not required";
+ }
- if (!(port = registration.getPort()).equals(""))
+ port = registration.getPort();
+ if (!port.equals(""))
+ {
port = ":" + port;
+ }
summaryTable.put("Password", pass);
summaryTable.put("Nickname", registration.getUserID());
@@ -184,8 +197,8 @@ public class IrcAccountRegistrationWizard
* @throws OperationFailedException if the operation didn't succeed
*/
@Override
- public ProtocolProviderService signin(String userName, String password)
- throws OperationFailedException
+ public ProtocolProviderService signin(final String userName,
+ final String password) throws OperationFailedException
{
ProtocolProviderFactory factory
= IrcAccRegWizzActivator.getIrcProtocolProviderFactory();
@@ -202,11 +215,9 @@ public class IrcAccountRegistrationWizard
* @param user the user identifier
* @return the <tt>ProtocolProviderService</tt> for the new account.
*/
- public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory,
- String user,
- String password)
- throws OperationFailedException
+ private ProtocolProviderService installAccount(
+ final ProtocolProviderFactory providerFactory, final String user,
+ final String password) throws OperationFailedException
{
Hashtable<String, String> accountProperties
= new Hashtable<String, String>();
@@ -236,15 +247,16 @@ public class IrcAccountRegistrationWizard
accountProperties.put(
ProtocolProviderFactory.NO_PASSWORD_REQUIRED,
new Boolean(!registration.isRequiredPassword()).toString());
-
+
accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION,
new Boolean(registration.isSecureConnection()).toString());
if (isModification())
{
- providerFactory.uninstallAccount(protocolProvider.getAccountID());
- this.protocolProvider = null;
+ providerFactory.modifyAccount(this.protocolProvider,
+ accountProperties);
setModification(false);
+ return this.protocolProvider;
}
try
@@ -252,7 +264,7 @@ public class IrcAccountRegistrationWizard
AccountID accountID = providerFactory.installAccount(
user, accountProperties);
- ServiceReference serRef = providerFactory
+ ServiceReference<ProtocolProviderService> serRef = providerFactory
.getProviderForAccount(accountID);
protocolProvider = (ProtocolProviderService)
@@ -286,7 +298,7 @@ public class IrcAccountRegistrationWizard
* data from.
*/
@Override
- public void loadAccount(ProtocolProviderService protocolProvider)
+ public void loadAccount(final ProtocolProviderService protocolProvider)
{
setModification(true);
@@ -316,7 +328,7 @@ public class IrcAccountRegistrationWizard
@Override
public Dimension getSize()
{
- return new Dimension(600, 500);
+ return new Dimension(WIZARD_DIALOG_WIDTH, WIZARD_DIALOG_HEIGHT);
}
/**
@@ -376,7 +388,7 @@ public class IrcAccountRegistrationWizard
* @return a simple account registration form
*/
@Override
- public Object getSimpleForm(boolean isCreateAccount)
+ public Object getSimpleForm(final boolean isCreateAccount)
{
firstWizardPage = new FirstWizardPage(this, "", "");
diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/package-info.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/package-info.java
new file mode 100644
index 0000000..9e3dc42
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * IRC account registration wizard.
+ */
+package net.java.sip.communicator.plugin.ircaccregwizz;