blob: 62880eecf326f1923e696e0d71da5e0d770c0739 [file] [log] [blame]
package org.eclipse.stem.diseasemodels.standard.provider;
/*******************************************************************************
* Copyright (c) 2006, 2008 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 java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
//import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.stem.diseasemodels.standard.SI;
import org.eclipse.stem.diseasemodels.standard.StandardPackage;
/**
* This is the item provider adapter for a
* {@link org.eclipse.stem.diseasemodels.standard.SI} object. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public class SIItemProvider extends StandardDiseaseModelItemProvider implements
IEditingDomainItemProvider, IStructuredItemContentProvider,
ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier. <!--
* begin-user-doc -->
*
* @param adapterFactory
*
* <!-- end-user-doc -->
* @generated
*/
public SIItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class. <!--
* begin-user-doc -->
*
* @param object
* @return
*
* <!-- end-user-doc -->
* @generated NOT
*/
public List getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addTransmissionRatePropertyDescriptor(object);
addNonLinearityCoefficientPropertyDescriptor(object);
addRecoveryRatePropertyDescriptor(object);
addInfectiousMortalityRatePropertyDescriptor(object);
addPhysicallyAdjacentInfectiousProportionPropertyDescriptor(object);
addRoadNetworkInfectiousProportionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This returns the property descriptors for the adapted class. <!--
* begin-user-doc -->
*
* @param object
* @return
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptorsGen(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addTransmissionRatePropertyDescriptor(object);
addNonLinearityCoefficientPropertyDescriptor(object);
addRecoveryRatePropertyDescriptor(object);
addInfectiousMortalityRatePropertyDescriptor(object);
addPhysicallyAdjacentInfectiousProportionPropertyDescriptor(object);
addRoadNetworkInfectiousProportionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Transmission Rate feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTransmissionRatePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_transmissionRate_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_transmissionRate_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__TRANSMISSION_RATE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Recovery Rate feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addRecoveryRatePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_recoveryRate_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_recoveryRate_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__RECOVERY_RATE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Infectious Mortality Rate feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addInfectiousMortalityRatePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_infectiousMortalityRate_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_infectiousMortalityRate_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__INFECTIOUS_MORTALITY_RATE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Physically Adjacent Infectious Proportion feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addPhysicallyAdjacentInfectiousProportionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_physicallyAdjacentInfectiousProportion_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_physicallyAdjacentInfectiousProportion_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__PHYSICALLY_ADJACENT_INFECTIOUS_PROPORTION,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Road Network Infectious Proportion feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addRoadNetworkInfectiousProportionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_roadNetworkInfectiousProportion_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_roadNetworkInfectiousProportion_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__ROAD_NETWORK_INFECTIOUS_PROPORTION,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Non Linearity Coefficient feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addNonLinearityCoefficientPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_SI_nonLinearityCoefficient_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_SI_nonLinearityCoefficient_feature", "_UI_SI_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
StandardPackage.Literals.SI__NON_LINEARITY_COEFFICIENT,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc
* -->
*
* @param object
* @return
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((SI)object).getDiseaseName();
return label == null || label.length() == 0 ?
getString("_UI_SI_type") : //$NON-NLS-1$
getString("_UI_SI_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
*
* @param notification
*
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(SI.class)) {
case StandardPackage.SI__TRANSMISSION_RATE:
case StandardPackage.SI__NON_LINEARITY_COEFFICIENT:
case StandardPackage.SI__RECOVERY_RATE:
case StandardPackage.SI__INFECTIOUS_MORTALITY_RATE:
case StandardPackage.SI__PHYSICALLY_ADJACENT_INFECTIOUS_PROPORTION:
case StandardPackage.SI__ROAD_NETWORK_INFECTIOUS_PROPORTION:
case StandardPackage.SI__INFECTIOUS_MORTALITY:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}