| /** |
| * ******************************************************************************* |
| * Copyright (c) 2015-2021 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Generated using Eclipse EMF |
| * |
| * ******************************************************************************* |
| */ |
| package org.eclipse.app4mc.amalthea.model.provider; |
| |
| |
| import java.util.Collection; |
| import java.util.List; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Channel; |
| import org.eclipse.app4mc.amalthea.model.ChannelFillCondition; |
| import org.eclipse.app4mc.amalthea.model.RelationalOperator; |
| |
| import org.eclipse.emf.common.notify.AdapterFactory; |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| import org.eclipse.emf.edit.provider.ViewerNotification; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.app4mc.amalthea.model.ChannelFillCondition} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class ChannelFillConditionItemProvider extends BaseObjectItemProvider { |
| /** |
| * This constructs an instance from a factory and a notifier. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ChannelFillConditionItemProvider(AdapterFactory adapterFactory) { |
| super(adapterFactory); |
| } |
| |
| /** |
| * This returns the property descriptors for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| if (itemPropertyDescriptors == null) { |
| super.getPropertyDescriptors(object); |
| |
| addRelationPropertyDescriptor(object); |
| addChannelPropertyDescriptor(object); |
| addFillLevelPropertyDescriptor(object); |
| } |
| return itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Relation feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addRelationPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_ModeCondition_relation_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_ModeCondition_relation_feature", "_UI_ModeCondition_type"), |
| AmaltheaPackage.eINSTANCE.getModeCondition_Relation(), |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Channel feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addChannelPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_ChannelFillCondition_channel_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_ChannelFillCondition_channel_feature", "_UI_ChannelFillCondition_type"), |
| AmaltheaPackage.eINSTANCE.getChannelFillCondition_Channel(), |
| true, |
| false, |
| true, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Fill Level feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addFillLevelPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_ChannelFillCondition_fillLevel_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_ChannelFillCondition_fillLevel_feature", "_UI_ChannelFillCondition_type"), |
| AmaltheaPackage.eINSTANCE.getChannelFillCondition_FillLevel(), |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns ChannelFillCondition.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object getImage(Object object) { |
| return overlayImage(object, getResourceLocator().getImage("full/obj16/ChannelFillCondition")); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected boolean shouldComposeCreationImage() { |
| return true; |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getTextGen(Object object) { |
| RelationalOperator labelValue = ((ChannelFillCondition)object).getRelation(); |
| String label = labelValue == null ? null : labelValue.toString(); |
| return label == null || label.length() == 0 ? |
| getString("_UI_ChannelFillCondition_type") : |
| getString("_UI_ChannelFillCondition_type") + " " + label; |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String getText(Object object) { |
| ChannelFillCondition cond = (ChannelFillCondition) object; |
| Channel channel = cond.getChannel(); |
| RelationalOperator relation = cond.getRelation(); |
| |
| String s1 = (channel == null || channel.getName() == null || channel.getName().isEmpty()) ? "???" : channel.getName(); |
| String s2 = (relation == null) ? "<relation>" : relation.toString(); |
| return s1 + ": Fill level " + s2 + " " + cond.getFillLevel(); |
| } |
| |
| |
| /** |
| * 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 --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void notifyChangedGen(Notification notification) { |
| updateChildren(notification); |
| |
| switch (notification.getFeatureID(ChannelFillCondition.class)) { |
| case AmaltheaPackage.CHANNEL_FILL_CONDITION__RELATION: |
| case AmaltheaPackage.CHANNEL_FILL_CONDITION__FILL_LEVEL: |
| fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| return; |
| } |
| super.notifyChanged(notification); |
| } |
| |
| /** |
| * 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 --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public void notifyChanged(Notification notification) { |
| updateChildren(notification); |
| |
| switch (notification.getFeatureID(ChannelFillCondition.class)) { |
| case AmaltheaPackage.CHANNEL_FILL_CONDITION__CHANNEL: |
| case AmaltheaPackage.CHANNEL_FILL_CONDITION__RELATION: |
| case AmaltheaPackage.CHANNEL_FILL_CONDITION__FILL_LEVEL: |
| 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); |
| } |
| |
| } |