public void serviceChanged(ServiceEvent event) {
		synchronized (m_refList) {
			// Add the new dictionary service to the service list.
			if (event.getType() == ServiceEvent.REGISTERED) {
				// Get the service object.
				Object service = m_context.getService(event.getServiceReference());

				// Make that the service is not being duplicated.
				if ((service != null) && (m_refToObjMap.get(event.getServiceReference()) == null)) {
					// Add to the reference list.
					m_refList.add(event.getServiceReference());
					// Map reference to service object for easy look up.
					m_refToObjMap.put(event.getServiceReference(), service);

					// Register spell checker service if necessary.
					if (m_reg == null) {
						m_reg = m_context.registerService(SpellChecker.class.getName(), new SpellCheckerImpl(), null);
					}
				} else if (service != null) {
					m_context.ungetService(event.getServiceReference());
				}
			}
			// Remove the departing service from the service list.
			else if (event.getType() == ServiceEvent.UNREGISTERING) {
				// Make sure the service is in the list.
				if (m_refToObjMap.get(event.getServiceReference()) != null) {
					// Unget the service object.
					m_context.ungetService(event.getServiceReference());
					// Remove service reference.
					m_refList.remove(event.getServiceReference());
					// Remove service reference from map.
					m_refToObjMap.remove(event.getServiceReference());

					// If there are no more dictionary services,
					// then unregister spell checker service.
					if (m_refList.size() == 0) {
						m_reg.unregister();
						m_reg = null;
					}
				}
			}
		}
	}