/plugins/net.jgsuess.uml14.edit/src/net/jgsuess/uml14/foundation/core/provider/AssociationEndItemProvider.java
https://gitlab.com/jgsuess/uml-1.4.2 · Java · 385 lines · 236 code · 30 blank · 119 comment · 8 complexity · 65b9d8ed6063e606142e9311cf92e813 MD5 · raw file
- /**
- * <copyright>
- * </copyright>
- *
- * $Id: AssociationEndItemProvider.java,v 1.1 2012/04/23 09:32:56 uqjsuss Exp $
- */
- package net.jgsuess.uml14.foundation.core.provider;
- import java.util.Collection;
- import java.util.List;
- import net.jgsuess.uml14.foundation.core.AssociationEnd;
- import net.jgsuess.uml14.foundation.core.CoreFactory;
- import net.jgsuess.uml14.foundation.core.CorePackage;
- import net.jgsuess.uml14.foundation.data_types.Data_typesFactory;
- 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.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.ViewerNotification;
- /**
- * This is the item provider adapter for a {@link net.jgsuess.uml14.foundation.core.AssociationEnd} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public class AssociationEndItemProvider
- extends ModelElementItemProvider
- implements
- IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider,
- IItemPropertySource {
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public AssociationEndItemProvider(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);
- addIsNavigablePropertyDescriptor(object);
- addOrderingPropertyDescriptor(object);
- addAggregationPropertyDescriptor(object);
- addTargetScopePropertyDescriptor(object);
- addChangeabilityPropertyDescriptor(object);
- addParticipantPropertyDescriptor(object);
- addSpecificationPropertyDescriptor(object);
- addLinkEndPropertyDescriptor(object);
- addAssociationEndRolePropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
- /**
- * This adds a property descriptor for the Is Navigable feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addIsNavigablePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_isNavigable_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_isNavigable_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__IS_NAVIGABLE,
- true,
- false,
- false,
- ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Ordering feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addOrderingPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_ordering_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_ordering_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__ORDERING,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Aggregation feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addAggregationPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_aggregation_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_aggregation_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__AGGREGATION,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Target Scope feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addTargetScopePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_targetScope_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_targetScope_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__TARGET_SCOPE,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Changeability feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addChangeabilityPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_changeability_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_changeability_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__CHANGEABILITY,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Participant feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addParticipantPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_participant_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_participant_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__PARTICIPANT,
- true,
- false,
- true,
- null,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Specification feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addSpecificationPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_specification_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_specification_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__SPECIFICATION,
- true,
- false,
- true,
- null,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Link End feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addLinkEndPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_linkEnd_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_linkEnd_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__LINK_END,
- true,
- false,
- true,
- null,
- null,
- null));
- }
- /**
- * This adds a property descriptor for the Association End Role feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addAssociationEndRolePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_AssociationEnd_associationEndRole_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_associationEndRole_feature", "_UI_AssociationEnd_type"),
- CorePackage.Literals.ASSOCIATION_END__ASSOCIATION_END_ROLE,
- 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(CorePackage.Literals.ASSOCIATION_END__MULTIPLICITY);
- childrenFeatures.add(CorePackage.Literals.ASSOCIATION_END__QUALIFIER);
- }
- 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 AssociationEnd.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/AssociationEnd"));
- }
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- String label = ((AssociationEnd)object).getName();
- return label == null || label.length() == 0 ?
- getString("_UI_AssociationEnd_type") :
- getString("_UI_AssociationEnd_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}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
- switch (notification.getFeatureID(AssociationEnd.class)) {
- case CorePackage.ASSOCIATION_END__IS_NAVIGABLE:
- case CorePackage.ASSOCIATION_END__ORDERING:
- case CorePackage.ASSOCIATION_END__AGGREGATION:
- case CorePackage.ASSOCIATION_END__TARGET_SCOPE:
- case CorePackage.ASSOCIATION_END__CHANGEABILITY:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
- case CorePackage.ASSOCIATION_END__MULTIPLICITY:
- case CorePackage.ASSOCIATION_END__QUALIFIER:
- 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
- (CorePackage.Literals.ASSOCIATION_END__MULTIPLICITY,
- Data_typesFactory.eINSTANCE.createMultiplicity()));
- newChildDescriptors.add
- (createChildParameter
- (CorePackage.Literals.ASSOCIATION_END__QUALIFIER,
- CoreFactory.eINSTANCE.createAttribute()));
- }
- }