/** * Handles registration of a new configuration form. * * @param event the <tt>ServiceEvent</tt> that notified us */ public void serviceChanged(ServiceEvent event) { Object sService = AdvancedConfigActivator.bundleContext.getService(event.getServiceReference()); // we don't care if the source service is not a configuration form if (!(sService instanceof ConfigurationForm)) return; ConfigurationForm configForm = (ConfigurationForm) sService; /* * This AdvancedConfigurationPanel is an advanced ConfigurationForm so * don't try to add it to itself. */ if ((configForm == this) || !configForm.isAdvanced()) return; switch (event.getType()) { case ServiceEvent.REGISTERED: if (logger.isInfoEnabled()) logger.info("Handling registration of a new Configuration Form."); this.addConfigForm(configForm); break; case ServiceEvent.UNREGISTERING: this.removeConfigForm(configForm); break; } }
/** * When a service is registered or unregistered, we update the provider tables and add/remove * listeners (if it supports BasicInstantMessenging implementation) * * @param event ServiceEvent */ public void serviceChanged(ServiceEvent event) { // if the event is caused by a bundle being stopped, we don't want to // know if (event.getServiceReference().getBundle().getState() == Bundle.STOPPING) { return; } Object service = SystrayActivator.bundleContext.getService(event.getServiceReference()); if (!(service instanceof ProtocolProviderService)) return; ProtocolProviderService provider = (ProtocolProviderService) service; if (event.getType() == ServiceEvent.REGISTERED) addAccount(provider); if (event.getType() == ServiceEvent.UNREGISTERING) removeAccount(provider); }
/** * Gets a reference to the <tt>UIService</tt> when this one is registered. * * @param event the <tt>ServiceEvent</tt> that has notified us */ @Override public void serviceChanged(ServiceEvent event) { super.serviceChanged(event); Object sService = ResourceManagementActivator.bundleContext.getService(event.getServiceReference()); if (sService instanceof UIService && uiService == null && event.getType() == ServiceEvent.REGISTERED) { uiService = (UIService) sService; uiService.repaintUI(); } else if (sService instanceof UIService && event.getType() == ServiceEvent.UNREGISTERING) { if (uiService != null && uiService.equals(sService)) { uiService = null; } } }