From 4dab0a4d3133e05dc0cace395fcffdeaee0415a5 Mon Sep 17 00:00:00 2001 From: Danny van Heumen Date: Tue, 12 Nov 2013 21:50:43 +0100 Subject: Rewritten IrcAccRegWizz after the IcqAccRegWizz since the original implementation causes problems during loading. --- .../ircaccregwizz/IrcAccRegWizzActivator.java | 97 ++++++++-------------- 1 file changed, 33 insertions(+), 64 deletions(-) diff --git a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java index ee846a7..f97651f 100644 --- a/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java +++ b/src/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java @@ -20,67 +20,51 @@ import org.osgi.framework.*; * @author Lionel Ferreira & Michael Tarantino */ public class IrcAccRegWizzActivator - implements BundleActivator + extends AbstractServiceDependentActivator { private static Logger logger = Logger.getLogger( IrcAccRegWizzActivator.class.getName()); + + static BundleContext bundleContext; + + private static UIService uiService; + + private static WizardContainer wizardContainer; - /** - * A currently valid bundle context. - */ - public static BundleContext bundleContext; - - /** - * The UIService. - */ - public static UIService uiService; + private IrcAccountRegistrationWizard ircWizard; - /** - * Starts this bundle. - * @param bc the currently valid BundleContext. - */ - public void start(BundleContext bc) + public void start(Object dependentService) { if (logger.isInfoEnabled()) logger.info("Loading irc account wizard."); - bundleContext = bc; - - ServiceReference uiServiceRef = bundleContext - .getServiceReference(UIService.class.getName()); - - UIService uiService - = (UIService) bundleContext.getService(uiServiceRef); - - WizardContainer wizardContainer - = uiService.getAccountRegWizardContainer(); - - IrcAccountRegistrationWizard ircWizard - = new IrcAccountRegistrationWizard(wizardContainer); - - Hashtable containerFilter - = new Hashtable(); - - containerFilter.put( - ProtocolProviderFactory.PROTOCOL, - ProtocolNames.IRC); - - bundleContext.registerService( - AccountRegistrationWizard.class.getName(), - ircWizard, - containerFilter); + uiService = (UIService)dependentService; + + wizardContainer = uiService.getAccountRegWizardContainer(); + + ircWizard = new IrcAccountRegistrationWizard(wizardContainer); + + Hashtable containerFilter = new Hashtable(); + containerFilter.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + + bundleContext.registerService(AccountRegistrationWizard.class.getName(), ircWizard, containerFilter); if (logger.isInfoEnabled()) logger.info("IRC account registration wizard [STARTED]."); } - - /** - * Called when this bundle is stopped so the Framework can perform the - * bundle-specific activities necessary to stop the bundle. - * - * @param context The execution context of the bundle being stopped. - */ - public void stop(BundleContext context) + + public Class getDependentServiceClass() + { + return UIService.class; + } + + @Override + public void setBundleContext(BundleContext context) + { + bundleContext = context; + } + + public void stop(BundleContext bundleContext) { } @@ -108,22 +92,7 @@ public class IrcAccRegWizzActivator return (ProtocolProviderFactory) bundleContext.getService(serRefs[0]); } - - /** - * Returns the bundleContext that we received when we were started. - * - * @return a currently valid instance of a bundleContext. - */ - public BundleContext getBundleContext() - { - return bundleContext; - } - - /** - * Returns the UIService. - * - * @return the UIService - */ + public static UIService getUIService() { return uiService; -- cgit v1.1