| // StandardRelativeValueProviderAdapterFactory.java |
| package org.eclipse.stem.diseasemodels.multipopulation.provider; |
| |
| /******************************************************************************* |
| * Copyright (c) 2010 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| |
| |
| import org.eclipse.emf.common.notify.Adapter; |
| import org.eclipse.emf.common.notify.Notification; |
| 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.INotifyChangedListener; |
| import org.eclipse.stem.definitions.adapters.population.PopulationEnumerator; |
| import org.eclipse.stem.definitions.adapters.population.PopulationEnumeratorAdapterFactory; |
| import org.eclipse.stem.diseasemodels.multipopulation.util.MultipopulationAdapterFactory; |
| |
| /* |
| */ |
| public class MultipopulationPopulationEnumeratorAdapterFactory extends |
| MultipopulationAdapterFactory implements PopulationEnumeratorAdapterFactory { |
| |
| /** |
| * This keeps track of the root adapter factory that delegates to this |
| * adapter factory. |
| */ |
| protected ComposedAdapterFactory parentAdapterFactory; |
| |
| /** |
| * This is used to implement |
| * {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
| */ |
| protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
| |
| |
| /** |
| * Constructor |
| */ |
| public MultipopulationPopulationEnumeratorAdapterFactory() { |
| super(); |
| PopulationEnumeratorAdapterFactory.INSTANCE.addAdapterFactory(this); |
| } // MultipopulationPopulationEnumeratorAdapterFactory |
| |
| /** |
| * |
| */ |
| @Override |
| public Adapter createMultiPopulationSIDiseaseModelAdapter() { |
| return new MultipopulationPopulationEnumeratorAdapter(); |
| } |
| |
| |
| /** |
| * @see org.eclipse.emf.edit.provider.IChangeNotifier#addListener(org.eclipse.emf.edit.provider.INotifyChangedListener) |
| */ |
| public void addListener(INotifyChangedListener notifyChangedListener) { |
| changeNotifier.addListener(notifyChangedListener); |
| } // addListener |
| |
| /** |
| * @see org.eclipse.emf.edit.provider.IChangeNotifier#fireNotifyChanged(org.eclipse.emf.common.notify.Notification) |
| */ |
| public void fireNotifyChanged(Notification notification) { |
| changeNotifier.fireNotifyChanged(notification); |
| if (parentAdapterFactory != null) { |
| parentAdapterFactory.fireNotifyChanged(notification); |
| } |
| } // fireNotifyChanged |
| |
| /** |
| * @see org.eclipse.emf.edit.provider.IChangeNotifier#removeListener(org.eclipse.emf.edit.provider.INotifyChangedListener) |
| */ |
| public void removeListener(INotifyChangedListener notifyChangedListener) { |
| changeNotifier.removeListener(notifyChangedListener); |
| } // removeListener |
| |
| /** |
| * @see org.eclipse.emf.edit.provider.ComposeableAdapterFactory#getRootAdapterFactory() |
| */ |
| public ComposeableAdapterFactory getRootAdapterFactory() { |
| return parentAdapterFactory == null ? this : parentAdapterFactory |
| .getRootAdapterFactory(); |
| } // getRootAdapterFactory |
| |
| /** |
| * @see org.eclipse.emf.edit.provider.ComposeableAdapterFactory#setParentAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) |
| */ |
| public void setParentAdapterFactory( |
| ComposedAdapterFactory parentAdapterFactory) { |
| this.parentAdapterFactory = parentAdapterFactory; |
| } // setParentAdapterFactory |
| |
| /** |
| * @see org.eclipse.stem.diseasemodels.standard.util.StandardAdapterFactory#isFactoryForType(java.lang.Object) |
| */ |
| @Override |
| public boolean isFactoryForType(Object type) { |
| return type == PopulationEnumerator.class |
| || super.isFactoryForType(type); |
| } // isFactoryForType |
| |
| /** |
| * This disposes all of the item providers created by this factory. |
| * |
| * @see org.eclipse.emf.edit.provider.IDisposable#dispose() |
| */ |
| public void dispose() { |
| // Nothing |
| } // dispose |
| |
| /** |
| * @return the instance of the Relative Value Provider Adapter Factory |
| */ |
| private static PopulationEnumeratorAdapterFactory getPopulationEnumeratorAdapterFactory() { |
| return PopulationEnumeratorAdapterFactory.INSTANCE; |
| } // getRelativeValueProviderAdapterFactory |
| |
| |
| } // StandardRelativeValueProviderAdapterFactory |