blob: f2e173c11500a6747c47255f40045b09bbabf1e7 [file] [log] [blame]
/**
* Copyright (c) 2019 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
*/
package org.eclipse.papyrus.sysml16.requirements.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.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;
import org.eclipse.papyrus.sysml16.provider.SysMLEditPlugin;
import org.eclipse.papyrus.sysml16.requirements.AbstractRequirement;
import org.eclipse.papyrus.sysml16.requirements.RequirementsPackage;
/**
* This is the item provider adapter for a {@link org.eclipse.papyrus.sysml16.requirements.AbstractRequirement} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AbstractRequirementItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AbstractRequirementItemProvider(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);
addBase_NamedElementPropertyDescriptor(object);
addDerivedPropertyDescriptor(object);
addDerivedFromPropertyDescriptor(object);
addIdPropertyDescriptor(object);
addMasterPropertyDescriptor(object);
addRefinedByPropertyDescriptor(object);
addSatisfiedByPropertyDescriptor(object);
addTextPropertyDescriptor(object);
addTracedToPropertyDescriptor(object);
addVerifiedByPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Base Named Element feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addBase_NamedElementPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_base_NamedElement_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_base_NamedElement_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__BASE_NAMED_ELEMENT,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Derived feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDerivedPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_derived_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_derived_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__DERIVED,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Derived From feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDerivedFromPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_derivedFrom_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_derivedFrom_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__DERIVED_FROM,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Id feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addIdPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_id_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_id_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__ID,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Master feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addMasterPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_master_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_master_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__MASTER,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Refined By feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addRefinedByPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_refinedBy_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_refinedBy_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__REFINED_BY,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Satisfied By feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addSatisfiedByPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_satisfiedBy_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_satisfiedBy_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__SATISFIED_BY,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Text feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTextPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_text_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_text_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__TEXT,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Traced To feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTracedToPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_tracedTo_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_tracedTo_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__TRACED_TO,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Verified By feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addVerifiedByPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AbstractRequirement_verifiedBy_feature"), //$NON-NLS-1$
getString("_UI_PropertyDescriptor_description", "_UI_AbstractRequirement_verifiedBy_feature", "_UI_AbstractRequirement_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
RequirementsPackage.Literals.ABSTRACT_REQUIREMENT__VERIFIED_BY,
false,
false,
false,
null,
null,
null));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((AbstractRequirement)object).getId();
return label == null || label.length() == 0 ?
getString("_UI_AbstractRequirement_type") : //$NON-NLS-1$
getString("_UI_AbstractRequirement_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 -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(AbstractRequirement.class)) {
case RequirementsPackage.ABSTRACT_REQUIREMENT__ID:
case RequirementsPackage.ABSTRACT_REQUIREMENT__TEXT:
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);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return SysMLEditPlugin.INSTANCE;
}
}