/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

  1. /**
  2. * <copyright>
  3. * </copyright>
  4. *
  5. * $Id: AssociationEndItemProvider.java,v 1.1 2012/04/23 09:32:56 uqjsuss Exp $
  6. */
  7. package net.jgsuess.uml14.foundation.core.provider;
  8. import java.util.Collection;
  9. import java.util.List;
  10. import net.jgsuess.uml14.foundation.core.AssociationEnd;
  11. import net.jgsuess.uml14.foundation.core.CoreFactory;
  12. import net.jgsuess.uml14.foundation.core.CorePackage;
  13. import net.jgsuess.uml14.foundation.data_types.Data_typesFactory;
  14. import org.eclipse.emf.common.notify.AdapterFactory;
  15. import org.eclipse.emf.common.notify.Notification;
  16. import org.eclipse.emf.ecore.EStructuralFeature;
  17. import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
  18. import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
  19. import org.eclipse.emf.edit.provider.IItemLabelProvider;
  20. import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
  21. import org.eclipse.emf.edit.provider.IItemPropertySource;
  22. import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
  23. import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
  24. import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
  25. import org.eclipse.emf.edit.provider.ViewerNotification;
  26. /**
  27. * This is the item provider adapter for a {@link net.jgsuess.uml14.foundation.core.AssociationEnd} object.
  28. * <!-- begin-user-doc -->
  29. * <!-- end-user-doc -->
  30. * @generated
  31. */
  32. public class AssociationEndItemProvider
  33. extends ModelElementItemProvider
  34. implements
  35. IEditingDomainItemProvider,
  36. IStructuredItemContentProvider,
  37. ITreeItemContentProvider,
  38. IItemLabelProvider,
  39. IItemPropertySource {
  40. /**
  41. * This constructs an instance from a factory and a notifier.
  42. * <!-- begin-user-doc -->
  43. * <!-- end-user-doc -->
  44. * @generated
  45. */
  46. public AssociationEndItemProvider(AdapterFactory adapterFactory) {
  47. super(adapterFactory);
  48. }
  49. /**
  50. * This returns the property descriptors for the adapted class.
  51. * <!-- begin-user-doc -->
  52. * <!-- end-user-doc -->
  53. * @generated
  54. */
  55. @Override
  56. public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
  57. if (itemPropertyDescriptors == null) {
  58. super.getPropertyDescriptors(object);
  59. addIsNavigablePropertyDescriptor(object);
  60. addOrderingPropertyDescriptor(object);
  61. addAggregationPropertyDescriptor(object);
  62. addTargetScopePropertyDescriptor(object);
  63. addChangeabilityPropertyDescriptor(object);
  64. addParticipantPropertyDescriptor(object);
  65. addSpecificationPropertyDescriptor(object);
  66. addLinkEndPropertyDescriptor(object);
  67. addAssociationEndRolePropertyDescriptor(object);
  68. }
  69. return itemPropertyDescriptors;
  70. }
  71. /**
  72. * This adds a property descriptor for the Is Navigable feature.
  73. * <!-- begin-user-doc -->
  74. * <!-- end-user-doc -->
  75. * @generated
  76. */
  77. protected void addIsNavigablePropertyDescriptor(Object object) {
  78. itemPropertyDescriptors.add
  79. (createItemPropertyDescriptor
  80. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  81. getResourceLocator(),
  82. getString("_UI_AssociationEnd_isNavigable_feature"),
  83. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_isNavigable_feature", "_UI_AssociationEnd_type"),
  84. CorePackage.Literals.ASSOCIATION_END__IS_NAVIGABLE,
  85. true,
  86. false,
  87. false,
  88. ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
  89. null,
  90. null));
  91. }
  92. /**
  93. * This adds a property descriptor for the Ordering feature.
  94. * <!-- begin-user-doc -->
  95. * <!-- end-user-doc -->
  96. * @generated
  97. */
  98. protected void addOrderingPropertyDescriptor(Object object) {
  99. itemPropertyDescriptors.add
  100. (createItemPropertyDescriptor
  101. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  102. getResourceLocator(),
  103. getString("_UI_AssociationEnd_ordering_feature"),
  104. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_ordering_feature", "_UI_AssociationEnd_type"),
  105. CorePackage.Literals.ASSOCIATION_END__ORDERING,
  106. true,
  107. false,
  108. false,
  109. ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
  110. null,
  111. null));
  112. }
  113. /**
  114. * This adds a property descriptor for the Aggregation feature.
  115. * <!-- begin-user-doc -->
  116. * <!-- end-user-doc -->
  117. * @generated
  118. */
  119. protected void addAggregationPropertyDescriptor(Object object) {
  120. itemPropertyDescriptors.add
  121. (createItemPropertyDescriptor
  122. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  123. getResourceLocator(),
  124. getString("_UI_AssociationEnd_aggregation_feature"),
  125. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_aggregation_feature", "_UI_AssociationEnd_type"),
  126. CorePackage.Literals.ASSOCIATION_END__AGGREGATION,
  127. true,
  128. false,
  129. false,
  130. ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
  131. null,
  132. null));
  133. }
  134. /**
  135. * This adds a property descriptor for the Target Scope feature.
  136. * <!-- begin-user-doc -->
  137. * <!-- end-user-doc -->
  138. * @generated
  139. */
  140. protected void addTargetScopePropertyDescriptor(Object object) {
  141. itemPropertyDescriptors.add
  142. (createItemPropertyDescriptor
  143. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  144. getResourceLocator(),
  145. getString("_UI_AssociationEnd_targetScope_feature"),
  146. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_targetScope_feature", "_UI_AssociationEnd_type"),
  147. CorePackage.Literals.ASSOCIATION_END__TARGET_SCOPE,
  148. true,
  149. false,
  150. false,
  151. ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
  152. null,
  153. null));
  154. }
  155. /**
  156. * This adds a property descriptor for the Changeability feature.
  157. * <!-- begin-user-doc -->
  158. * <!-- end-user-doc -->
  159. * @generated
  160. */
  161. protected void addChangeabilityPropertyDescriptor(Object object) {
  162. itemPropertyDescriptors.add
  163. (createItemPropertyDescriptor
  164. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  165. getResourceLocator(),
  166. getString("_UI_AssociationEnd_changeability_feature"),
  167. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_changeability_feature", "_UI_AssociationEnd_type"),
  168. CorePackage.Literals.ASSOCIATION_END__CHANGEABILITY,
  169. true,
  170. false,
  171. false,
  172. ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
  173. null,
  174. null));
  175. }
  176. /**
  177. * This adds a property descriptor for the Participant feature.
  178. * <!-- begin-user-doc -->
  179. * <!-- end-user-doc -->
  180. * @generated
  181. */
  182. protected void addParticipantPropertyDescriptor(Object object) {
  183. itemPropertyDescriptors.add
  184. (createItemPropertyDescriptor
  185. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  186. getResourceLocator(),
  187. getString("_UI_AssociationEnd_participant_feature"),
  188. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_participant_feature", "_UI_AssociationEnd_type"),
  189. CorePackage.Literals.ASSOCIATION_END__PARTICIPANT,
  190. true,
  191. false,
  192. true,
  193. null,
  194. null,
  195. null));
  196. }
  197. /**
  198. * This adds a property descriptor for the Specification feature.
  199. * <!-- begin-user-doc -->
  200. * <!-- end-user-doc -->
  201. * @generated
  202. */
  203. protected void addSpecificationPropertyDescriptor(Object object) {
  204. itemPropertyDescriptors.add
  205. (createItemPropertyDescriptor
  206. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  207. getResourceLocator(),
  208. getString("_UI_AssociationEnd_specification_feature"),
  209. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_specification_feature", "_UI_AssociationEnd_type"),
  210. CorePackage.Literals.ASSOCIATION_END__SPECIFICATION,
  211. true,
  212. false,
  213. true,
  214. null,
  215. null,
  216. null));
  217. }
  218. /**
  219. * This adds a property descriptor for the Link End feature.
  220. * <!-- begin-user-doc -->
  221. * <!-- end-user-doc -->
  222. * @generated
  223. */
  224. protected void addLinkEndPropertyDescriptor(Object object) {
  225. itemPropertyDescriptors.add
  226. (createItemPropertyDescriptor
  227. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  228. getResourceLocator(),
  229. getString("_UI_AssociationEnd_linkEnd_feature"),
  230. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_linkEnd_feature", "_UI_AssociationEnd_type"),
  231. CorePackage.Literals.ASSOCIATION_END__LINK_END,
  232. true,
  233. false,
  234. true,
  235. null,
  236. null,
  237. null));
  238. }
  239. /**
  240. * This adds a property descriptor for the Association End Role feature.
  241. * <!-- begin-user-doc -->
  242. * <!-- end-user-doc -->
  243. * @generated
  244. */
  245. protected void addAssociationEndRolePropertyDescriptor(Object object) {
  246. itemPropertyDescriptors.add
  247. (createItemPropertyDescriptor
  248. (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
  249. getResourceLocator(),
  250. getString("_UI_AssociationEnd_associationEndRole_feature"),
  251. getString("_UI_PropertyDescriptor_description", "_UI_AssociationEnd_associationEndRole_feature", "_UI_AssociationEnd_type"),
  252. CorePackage.Literals.ASSOCIATION_END__ASSOCIATION_END_ROLE,
  253. true,
  254. false,
  255. true,
  256. null,
  257. null,
  258. null));
  259. }
  260. /**
  261. * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
  262. * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
  263. * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
  264. * <!-- begin-user-doc -->
  265. * <!-- end-user-doc -->
  266. * @generated
  267. */
  268. @Override
  269. public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
  270. if (childrenFeatures == null) {
  271. super.getChildrenFeatures(object);
  272. childrenFeatures.add(CorePackage.Literals.ASSOCIATION_END__MULTIPLICITY);
  273. childrenFeatures.add(CorePackage.Literals.ASSOCIATION_END__QUALIFIER);
  274. }
  275. return childrenFeatures;
  276. }
  277. /**
  278. * <!-- begin-user-doc -->
  279. * <!-- end-user-doc -->
  280. * @generated
  281. */
  282. @Override
  283. protected EStructuralFeature getChildFeature(Object object, Object child) {
  284. // Check the type of the specified child object and return the proper feature to use for
  285. // adding (see {@link AddCommand}) it as a child.
  286. return super.getChildFeature(object, child);
  287. }
  288. /**
  289. * This returns AssociationEnd.gif.
  290. * <!-- begin-user-doc -->
  291. * <!-- end-user-doc -->
  292. * @generated
  293. */
  294. @Override
  295. public Object getImage(Object object) {
  296. return overlayImage(object, getResourceLocator().getImage("full/obj16/AssociationEnd"));
  297. }
  298. /**
  299. * This returns the label text for the adapted class.
  300. * <!-- begin-user-doc -->
  301. * <!-- end-user-doc -->
  302. * @generated
  303. */
  304. @Override
  305. public String getText(Object object) {
  306. String label = ((AssociationEnd)object).getName();
  307. return label == null || label.length() == 0 ?
  308. getString("_UI_AssociationEnd_type") :
  309. getString("_UI_AssociationEnd_type") + " " + label;
  310. }
  311. /**
  312. * This handles model notifications by calling {@link #updateChildren} to update any cached
  313. * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
  314. * <!-- begin-user-doc -->
  315. * <!-- end-user-doc -->
  316. * @generated
  317. */
  318. @Override
  319. public void notifyChanged(Notification notification) {
  320. updateChildren(notification);
  321. switch (notification.getFeatureID(AssociationEnd.class)) {
  322. case CorePackage.ASSOCIATION_END__IS_NAVIGABLE:
  323. case CorePackage.ASSOCIATION_END__ORDERING:
  324. case CorePackage.ASSOCIATION_END__AGGREGATION:
  325. case CorePackage.ASSOCIATION_END__TARGET_SCOPE:
  326. case CorePackage.ASSOCIATION_END__CHANGEABILITY:
  327. fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
  328. return;
  329. case CorePackage.ASSOCIATION_END__MULTIPLICITY:
  330. case CorePackage.ASSOCIATION_END__QUALIFIER:
  331. fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
  332. return;
  333. }
  334. super.notifyChanged(notification);
  335. }
  336. /**
  337. * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
  338. * that can be created under this object.
  339. * <!-- begin-user-doc -->
  340. * <!-- end-user-doc -->
  341. * @generated
  342. */
  343. @Override
  344. protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
  345. super.collectNewChildDescriptors(newChildDescriptors, object);
  346. newChildDescriptors.add
  347. (createChildParameter
  348. (CorePackage.Literals.ASSOCIATION_END__MULTIPLICITY,
  349. Data_typesFactory.eINSTANCE.createMultiplicity()));
  350. newChildDescriptors.add
  351. (createChildParameter
  352. (CorePackage.Literals.ASSOCIATION_END__QUALIFIER,
  353. CoreFactory.eINSTANCE.createAttribute()));
  354. }
  355. }