/** */ package de.hftstuttgart.buildingphysics.provider; import de.hftstuttgart.buildingphysics.BuildingPhysicsPackage; import de.hftstuttgart.buildingphysics.LifeCycle; import de.hftstuttgart.cityunits.model.NullableQuantity; 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.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.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link de.hftstuttgart.buildingphysics.LifeCycle} object. * * * @generated */ public class LifeCycleItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * * * @generated */ public LifeCycleItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * * * @generated */ @Override public List getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addEmbodiedEnergyPropertyDescriptor(object); addEmbodiedCarbonPropertyDescriptor(object); addConstructionDescriptionPropertyDescriptor(object); addDisposalEnergyPropertyDescriptor(object); addDisposalCarbonPropertyDescriptor(object); addDisposalDescriptionPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Embodied Energy feature. * * * @generated */ protected void addEmbodiedEnergyPropertyDescriptor(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_embodiedEnergy_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_embodiedEnergy_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__EMBODIED_ENERGY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Embodied Carbon feature. * * * @generated */ protected void addEmbodiedCarbonPropertyDescriptor(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_embodiedCarbon_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_embodiedCarbon_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__EMBODIED_CARBON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Construction Description feature. * * * @generated */ protected void addConstructionDescriptionPropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor( ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_constructionDescription_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_constructionDescription_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__CONSTRUCTION_DESCRIPTION, true, true, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Disposal Energy feature. * * * @generated */ protected void addDisposalEnergyPropertyDescriptor(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_disposalEnergy_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalEnergy_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_ENERGY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Disposal Carbon feature. * * * @generated */ protected void addDisposalCarbonPropertyDescriptor(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_disposalCarbon_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalCarbon_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_CARBON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Disposal Description feature. * * * @generated */ protected void addDisposalDescriptionPropertyDescriptor(Object object) { itemPropertyDescriptors .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LifeCycle_disposalDescription_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalDescription_feature", "_UI_LifeCycle_type"), BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_DESCRIPTION, true, true, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns LifeCycle.gif. * * * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/LifeCycle")); } /** * * * @generated */ @Override protected boolean shouldComposeCreationImage() { return true; } /** * This returns the label text for the adapted class. * * * @generated */ @Override public String getText(Object object) { NullableQuantity labelValue = ((LifeCycle) object).getEmbodiedEnergy(); String label = labelValue == null ? null : labelValue.toString(); return label == null || label.length() == 0 ? getString("_UI_LifeCycle_type") : getString("_UI_LifeCycle_type") + " " + label; } /** * 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}. * * * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(LifeCycle.class)) { case BuildingPhysicsPackage.LIFE_CYCLE__EMBODIED_ENERGY: case BuildingPhysicsPackage.LIFE_CYCLE__EMBODIED_CARBON: case BuildingPhysicsPackage.LIFE_CYCLE__CONSTRUCTION_DESCRIPTION: case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_ENERGY: case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_CARBON: case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_DESCRIPTION: 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. * * * @generated */ @Override protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } /** * Return the resource locator for this item provider's resources. * * * @generated */ @Override public ResourceLocator getResourceLocator() { return BuildingPhysicsEditPlugin.INSTANCE; } }