/*******************************************************************************
 * Copyright (c) 2015, 2016 CNRS, IRIT, IRT AESE (IRT Saint Exupéry).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the LGPL 3.0
 * which accompanies this distribution, and is available at
 * https://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *
 * Contributors:
 *      Faiez Zalila - initial API and implementation and/or initial documentation
 *******************************************************************************/
/**
 * generated by Xtext 2.10.0
 */
package fr.irit.fiacre.xtext.fiacre.provider;


import fr.irit.fiacre.xtext.fiacre.FiacreFactory;
import fr.irit.fiacre.xtext.fiacre.FiacrePackage;
import fr.irit.fiacre.xtext.fiacre.PrecedesPattern;

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.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

/**
 * This is the item provider adapter for a {@link fr.irit.fiacre.xtext.fiacre.PrecedesPattern} object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class PrecedesPatternItemProvider extends SequencePatternItemProvider {
	/**
	 * This constructs an instance from a factory and a notifier.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrecedesPatternItemProvider(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);

		}
		return itemPropertyDescriptors;
	}

	/**
	 * 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(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_Before());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_After());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_Until());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_Min());
			childrenFeatures.add(FiacrePackage.eINSTANCE.getPrecedesPattern_Max());
		}
		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);
	}

	/**
	 * This returns PrecedesPattern.gif.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object getImage(Object object) {
		return overlayImage(object, getResourceLocator().getImage("full/obj16/PrecedesPattern"));
	}

	/**
	 * This returns the label text for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String getText(Object object) {
		return getString("_UI_PrecedesPattern_type");
	}
	

	/**
	 * 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
	 */
	@Override
	public void notifyChanged(Notification notification) {
		updateChildren(notification);

		switch (notification.getFeatureID(PrecedesPattern.class)) {
			case FiacrePackage.PRECEDES_PATTERN__SUBJECT:
			case FiacrePackage.PRECEDES_PATTERN__FOLLOWER:
			case FiacrePackage.PRECEDES_PATTERN__BEFORE:
			case FiacrePackage.PRECEDES_PATTERN__AFTER:
			case FiacrePackage.PRECEDES_PATTERN__UNTIL:
			case FiacrePackage.PRECEDES_PATTERN__MIN:
			case FiacrePackage.PRECEDES_PATTERN__MAX:
				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
				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);

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Subject(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Follower(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Before(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_After(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Until(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Min(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservableEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createEnterStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createLeaveStateEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservable()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createPathEvent()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservableDisjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservableImplication()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservableConjunction()));

		newChildDescriptors.add
			(createChildParameter
				(FiacrePackage.eINSTANCE.getPrecedesPattern_Max(),
				 FiacreFactory.eINSTANCE.createObservableNegation()));
	}

	/**
	 * 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 == FiacrePackage.eINSTANCE.getPrecedesPattern_Subject() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_Follower() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_Before() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_After() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_Until() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_Min() ||
			childFeature == FiacrePackage.eINSTANCE.getPrecedesPattern_Max();

		if (qualify) {
			return getString
				("_UI_CreateChild_text2",
				 new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
		}
		return super.getCreateChildText(owner, feature, child, selection);
	}

}
