/******************************************************************************* * Copyright (c) 2011, 2012 Formal Mind GmbH and University of Dusseldorf. * 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: * Michael Jastram - initial API and implementation ******************************************************************************/ package org.eclipse.rmf.reqif10.pror.provider; 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.ecore.EStructuralFeature; 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; import org.eclipse.rmf.reqif10.AttributeValueXHTML; import org.eclipse.rmf.reqif10.ReqIF10Factory; import org.eclipse.rmf.reqif10.ReqIF10Package; /** * This is the item provider adapter for a {@link org.eclipse.rmf.reqif10.AttributeValueXHTML} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class AttributeValueXHTMLItemProvider extends AttributeValueItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AttributeValueXHTMLItemProvider(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); addSimplifiedPropertyDescriptor(object); addDefinitionPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Simplified feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addSimplifiedPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_AttributeValueXHTML_simplified_feature"), getString("_UI_PropertyDescriptor_description", "_UI_AttributeValueXHTML_simplified_feature", "_UI_AttributeValueXHTML_type"), ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__SIMPLIFIED, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Definition feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addDefinitionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_AttributeValueXHTML_definition_feature"), getString("_UI_PropertyDescriptor_description", "_UI_AttributeValueXHTML_definition_feature", "_UI_AttributeValueXHTML_type"), ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__DEFINITION, true, false, true, null, null, null)); } /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_ORIGINAL_VALUE); childrenFeatures.add(ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_VALUE); } return childrenFeatures; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { // Check the type of the specified child object and return the proper feature to use for // adding (see {@link AddCommand}) it as a child. return super.getChildFeature(object, child); } /** * <!-- 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 */ @Override public String getText(Object object) { AttributeValueXHTML attributeValueXHTML = (AttributeValueXHTML)object; return getString("_UI_AttributeValueXHTML_type") + " " + attributeValueXHTML.isSimplified(); } /** * 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 --> * We always notify super.notifyChanged as well * <!-- end-user-doc --> * @generated NOT */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(AttributeValueXHTML.class)) { case ReqIF10Package.ATTRIBUTE_VALUE_XHTML__SIMPLIFIED: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); case ReqIF10Package.ATTRIBUTE_VALUE_XHTML__THE_ORIGINAL_VALUE: case ReqIF10Package.ATTRIBUTE_VALUE_XHTML__THE_VALUE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); } 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); newChildDescriptors.add (createChildParameter (ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_ORIGINAL_VALUE, ReqIF10Factory.eINSTANCE.createXhtmlContent())); newChildDescriptors.add (createChildParameter (ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_VALUE, ReqIF10Factory.eINSTANCE.createXhtmlContent())); } /** * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_ORIGINAL_VALUE || childFeature == ReqIF10Package.Literals.ATTRIBUTE_VALUE_XHTML__THE_VALUE; if (qualify) { return getString ("_UI_CreateChild_text2", new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); } }