content: /**
   * <copyright>
   * </copyright>
   *
   * $Id$
   */
  package oscfg.provider;
  
  import java.util.ArrayList;
  import java.util.Collection;
  
  import org.eclipse.emf.common.notify.Adapter;
  import org.eclipse.emf.common.notify.Notification;
  import org.eclipse.emf.common.notify.Notifier;
  
  import org.eclipse.emf.edit.provider.ChangeNotifier;
  import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
  import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
  import org.eclipse.emf.edit.provider.IChangeNotifier;
  import org.eclipse.emf.edit.provider.IDisposable;
  import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
  import org.eclipse.emf.edit.provider.IItemLabelProvider;
  import org.eclipse.emf.edit.provider.IItemPropertySource;
  import org.eclipse.emf.edit.provider.INotifyChangedListener;
  import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
  import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
  
  import oscfg.util.OscfgAdapterFactory;
  
  /**
   * This is the factory that is used to provide the interfaces needed to support Viewers.
   * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
   * The adapters also support Eclipse property sheets.
   * Note that most of the adapters are shared among multiple instances.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public class OscfgItemProviderAdapterFactory extends OscfgAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
  	/**
  	 * This keeps track of the root adapter factory that delegates to this adapter factory.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected ComposedAdapterFactory parentAdapterFactory;
  
  	/**
  	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected IChangeNotifier changeNotifier = new ChangeNotifier();
  
  	/**
  	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected Collection<Object> supportedTypes = new ArrayList<Object>();
  
  	/**
  	 * This constructs an instance.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public OscfgItemProviderAdapterFactory() {
  		supportedTypes.add(IEditingDomainItemProvider.class);
  		supportedTypes.add(IStructuredItemContentProvider.class);
  		supportedTypes.add(ITreeItemContentProvider.class);
  		supportedTypes.add(IItemLabelProvider.class);
  		supportedTypes.add(IItemPropertySource.class);
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.CallbackFunction} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected CallbackFunctionItemProvider callbackFunctionItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.CallbackFunction}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createCallbackFunctionAdapter() {
  		if (callbackFunctionItemProvider == null) {
  			callbackFunctionItemProvider = new CallbackFunctionItemProvider(this);
  		}
  
  		return callbackFunctionItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.Configuration} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected ConfigurationItemProvider configurationItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.Configuration}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createConfigurationAdapter() {
  		if (configurationItemProvider == null) {
  			configurationItemProvider = new ConfigurationItemProvider(this);
  		}
  
  		return configurationItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.DocumentRoot} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected DocumentRootItemProvider documentRootItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.DocumentRoot}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createDocumentRootAdapter() {
  		if (documentRootItemProvider == null) {
  			documentRootItemProvider = new DocumentRootItemProvider(this);
  		}
  
  		return documentRootItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.HWCounter} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected HWCounterItemProvider hwCounterItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.HWCounter}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createHWCounterAdapter() {
  		if (hwCounterItemProvider == null) {
  			hwCounterItemProvider = new HWCounterItemProvider(this);
  		}
  
  		return hwCounterItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.ISR} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected ISRItemProvider isrItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.ISR}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createISRAdapter() {
  		if (isrItemProvider == null) {
  			isrItemProvider = new ISRItemProvider(this);
  		}
  
  		return isrItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.Message} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected MessageItemProvider messageItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.Message}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createMessageAdapter() {
  		if (messageItemProvider == null) {
  			messageItemProvider = new MessageItemProvider(this);
  		}
  
  		return messageItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.Mutex} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected MutexItemProvider mutexItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.Mutex}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createMutexAdapter() {
  		if (mutexItemProvider == null) {
  			mutexItemProvider = new MutexItemProvider(this);
  		}
  
  		return mutexItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.Module} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected ModuleItemProvider moduleItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.Module}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createModuleAdapter() {
  		if (moduleItemProvider == null) {
  			moduleItemProvider = new ModuleItemProvider(this);
  		}
  
  		return moduleItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.SWTimer} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected SWTimerItemProvider swTimerItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.SWTimer}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createSWTimerAdapter() {
  		if (swTimerItemProvider == null) {
  			swTimerItemProvider = new SWTimerItemProvider(this);
  		}
  
  		return swTimerItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.Task} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected TaskItemProvider taskItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.Task}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createTaskAdapter() {
  		if (taskItemProvider == null) {
  			taskItemProvider = new TaskItemProvider(this);
  		}
  
  		return taskItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.InterruptSource} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected InterruptSourceItemProvider interruptSourceItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.InterruptSource}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createInterruptSourceAdapter() {
  		if (interruptSourceItemProvider == null) {
  			interruptSourceItemProvider = new InterruptSourceItemProvider(this);
  		}
  
  		return interruptSourceItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.OS} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected OSItemProvider osItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.OS}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createOSAdapter() {
  		if (osItemProvider == null) {
  			osItemProvider = new OSItemProvider(this);
  		}
  
  		return osItemProvider;
  	}
  
  	/**
  	 * This keeps track of the one adapter used for all {@link oscfg.CooperativeGroup} instances.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected CooperativeGroupItemProvider cooperativeGroupItemProvider;
  
  	/**
  	 * This creates an adapter for a {@link oscfg.CooperativeGroup}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter createCooperativeGroupAdapter() {
  		if (cooperativeGroupItemProvider == null) {
  			cooperativeGroupItemProvider = new CooperativeGroupItemProvider(this);
  		}
  
  		return cooperativeGroupItemProvider;
  	}
  
  	/**
  	 * This returns the root adapter factory that contains this factory.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public ComposeableAdapterFactory getRootAdapterFactory() {
  		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
  	}
  
  	/**
  	 * This sets the composed adapter factory that contains this factory.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
  		this.parentAdapterFactory = parentAdapterFactory;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public boolean isFactoryForType(Object type) {
  		return supportedTypes.contains(type) || super.isFactoryForType(type);
  	}
  
  	/**
  	 * This implementation substitutes the factory itself as the key for the adapter.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Adapter adapt(Notifier notifier, Object type) {
  		return super.adapt(notifier, this);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Object adapt(Object object, Object type) {
  		if (isFactoryForType(type)) {
  			Object adapter = super.adapt(object, type);
  			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
  				return adapter;
  			}
  		}
  
  		return null;
  	}
  
  	/**
  	 * This adds a listener.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public void addListener(INotifyChangedListener notifyChangedListener) {
  		changeNotifier.addListener(notifyChangedListener);
  	}
  
  	/**
  	 * This removes a listener.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public void removeListener(INotifyChangedListener notifyChangedListener) {
  		changeNotifier.removeListener(notifyChangedListener);
  	}
  
  	/**
  	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public void fireNotifyChanged(Notification notification) {
  		changeNotifier.fireNotifyChanged(notification);
  
  		if (parentAdapterFactory != null) {
  			parentAdapterFactory.fireNotifyChanged(notification);
  		}
  	}
  
  	/**
  	 * This disposes all of the item providers created by this factory. 
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public void dispose() {
  		if (callbackFunctionItemProvider != null) callbackFunctionItemProvider.dispose();
  		if (configurationItemProvider != null) configurationItemProvider.dispose();
  		if (documentRootItemProvider != null) documentRootItemProvider.dispose();
  		if (hwCounterItemProvider != null) hwCounterItemProvider.dispose();
  		if (isrItemProvider != null) isrItemProvider.dispose();
  		if (messageItemProvider != null) messageItemProvider.dispose();
  		if (mutexItemProvider != null) mutexItemProvider.dispose();
  		if (moduleItemProvider != null) moduleItemProvider.dispose();
  		if (swTimerItemProvider != null) swTimerItemProvider.dispose();
  		if (taskItemProvider != null) taskItemProvider.dispose();
  		if (interruptSourceItemProvider != null) interruptSourceItemProvider.dispose();
  		if (osItemProvider != null) osItemProvider.dispose();
  		if (cooperativeGroupItemProvider != null) cooperativeGroupItemProvider.dispose();
  	}
  
  }
  