DecompositionUnitAdaptationItemProvider.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /**
  2. */
  3. package ua.ansymo.hintco.provider;
  4. import java.util.Collection;
  5. import java.util.List;
  6. import org.eclipse.emf.common.notify.AdapterFactory;
  7. import org.eclipse.emf.common.notify.Notification;
  8. import org.eclipse.emf.ecore.EStructuralFeature;
  9. import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
  10. import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
  11. import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
  12. import org.eclipse.emf.edit.provider.ViewerNotification;
  13. import ua.ansymo.hintco.DecompositionUnitAdaptation;
  14. import ua.ansymo.hintco.HintcoFactory;
  15. import ua.ansymo.hintco.HintcoPackage;
  16. /**
  17. * This is the item provider adapter for a {@link ua.ansymo.hintco.DecompositionUnitAdaptation} object.
  18. * <!-- begin-user-doc -->
  19. * <!-- end-user-doc -->
  20. * @generated
  21. */
  22. public class DecompositionUnitAdaptationItemProvider extends UnitAdaptationItemProvider {
  23. /**
  24. * This constructs an instance from a factory and a notifier.
  25. * <!-- begin-user-doc -->
  26. * <!-- end-user-doc -->
  27. * @generated
  28. */
  29. public DecompositionUnitAdaptationItemProvider(AdapterFactory adapterFactory) {
  30. super(adapterFactory);
  31. }
  32. /**
  33. * This returns the property descriptors for the adapted class.
  34. * <!-- begin-user-doc -->
  35. * <!-- end-user-doc -->
  36. * @generated
  37. */
  38. @Override
  39. public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
  40. if (itemPropertyDescriptors == null) {
  41. super.getPropertyDescriptors(object);
  42. addNamePropertyDescriptor(object);
  43. }
  44. return itemPropertyDescriptors;
  45. }
  46. /**
  47. * This adds a property descriptor for the Name feature.
  48. * <!-- begin-user-doc -->
  49. * <!-- end-user-doc -->
  50. * @generated
  51. */
  52. protected void addNamePropertyDescriptor(Object object) {
  53. itemPropertyDescriptors.add
  54. (createItemPropertyDescriptor
  55. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  56. getResourceLocator(),
  57. getString("_UI_DecompositionUnitAdaptation_name_feature"),
  58. getString("_UI_PropertyDescriptor_description", "_UI_DecompositionUnitAdaptation_name_feature", "_UI_DecompositionUnitAdaptation_type"),
  59. HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__NAME,
  60. false,
  61. false,
  62. false,
  63. ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
  64. null,
  65. null));
  66. }
  67. /**
  68. * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
  69. * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
  70. * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
  71. * <!-- begin-user-doc -->
  72. * <!-- end-user-doc -->
  73. * @generated
  74. */
  75. @Override
  76. public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
  77. if (childrenFeatures == null) {
  78. super.getChildrenFeatures(object);
  79. childrenFeatures.add(HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN);
  80. }
  81. return childrenFeatures;
  82. }
  83. /**
  84. * <!-- begin-user-doc -->
  85. * <!-- end-user-doc -->
  86. * @generated
  87. */
  88. @Override
  89. protected EStructuralFeature getChildFeature(Object object, Object child) {
  90. // Check the type of the specified child object and return the proper feature to use for
  91. // adding (see {@link AddCommand}) it as a child.
  92. return super.getChildFeature(object, child);
  93. }
  94. /**
  95. * This returns the label text for the adapted class.
  96. * <!-- begin-user-doc -->
  97. * <!-- end-user-doc -->
  98. * @generated
  99. */
  100. @Override
  101. public String getText(Object object) {
  102. String label = ((DecompositionUnitAdaptation)object).getName();
  103. return label == null || label.length() == 0 ?
  104. getString("_UI_DecompositionUnitAdaptation_type") :
  105. getString("_UI_DecompositionUnitAdaptation_type") + " " + label;
  106. }
  107. /**
  108. * This handles model notifications by calling {@link #updateChildren} to update any cached
  109. * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
  110. * <!-- begin-user-doc -->
  111. * <!-- end-user-doc -->
  112. * @generated
  113. */
  114. @Override
  115. public void notifyChanged(Notification notification) {
  116. updateChildren(notification);
  117. switch (notification.getFeatureID(DecompositionUnitAdaptation.class)) {
  118. case HintcoPackage.DECOMPOSITION_UNIT_ADAPTATION__NAME:
  119. fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
  120. return;
  121. case HintcoPackage.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN:
  122. fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
  123. return;
  124. }
  125. super.notifyChanged(notification);
  126. }
  127. /**
  128. * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
  129. * that can be created under this object.
  130. * <!-- begin-user-doc -->
  131. * <!-- end-user-doc -->
  132. * @generated
  133. */
  134. @Override
  135. protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
  136. super.collectNewChildDescriptors(newChildDescriptors, object);
  137. newChildDescriptors.add
  138. (createChildParameter
  139. (HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN,
  140. HintcoFactory.eINSTANCE.createXorUnitAdaptation()));
  141. newChildDescriptors.add
  142. (createChildParameter
  143. (HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN,
  144. HintcoFactory.eINSTANCE.createCombineAdaptation()));
  145. newChildDescriptors.add
  146. (createChildParameter
  147. (HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN,
  148. HintcoFactory.eINSTANCE.createMultiRateAdaptation()));
  149. newChildDescriptors.add
  150. (createChildParameter
  151. (HintcoPackage.Literals.DECOMPOSITION_UNIT_ADAPTATION__CHILDREN,
  152. HintcoFactory.eINSTANCE.createPowerBondAdaptation()));
  153. }
  154. }