From a3ed4c4c7056ebcca9347b4ef3c3b35d40d4fc71 Mon Sep 17 00:00:00 2001 From: Arthur Daussy Date: Wed, 25 Jun 2014 16:01:54 +0200 Subject: Adds custom stereotypes icons. Adds one icon using Image uml element (see model). Adds one icon using ItemProvider (requires the first generation of the EMF.edit code). Change-Id: I829b5ddf2d5ecfef81f401ee51776d9172bdf507 Signed-off-by: Arthur Daussy --- .../META-INF/MANIFEST.MF | 8 +- .../build.properties | 3 +- .../icons/full/obj16/ACliche.gif | Bin 0 -> 129 bytes .../icons/full/obj16/ACliche2.gif | Bin 0 -> 129 bytes .../icons/full/obj16/ACliche3.gif | Bin 0 -> 129 bytes .../icons/full/obj16/eclipse_kepler.gif | Bin 0 -> 1034 bytes .../model/UML2CompareTestProfile.genmodel | 7 +- .../model/icons/eclipse_luna.gif | Bin 0 -> 558 bytes .../model/uml2.compare.testprofile.profile.uml | 117 +++++++--- .../plugin.properties | 24 ++ .../org.eclipse.emf.compare.uml2.tests/plugin.xml | 13 ++ .../provider/ACliche2ItemProvider.java | 231 ++++++++++++++++++ .../provider/ACliche3ItemProvider.java | 141 +++++++++++ .../provider/AClicheItemProvider.java | 230 ++++++++++++++++++ .../provider/UML2CompareTestProfileEditPlugin.java | 99 ++++++++ ...mpareTestProfileItemProviderAdapterFactory.java | 258 +++++++++++++++++++++ 16 files changed, 1096 insertions(+), 35 deletions(-) create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche.gif create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche2.gif create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche3.gif create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/eclipse_kepler.gif create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/model/icons/eclipse_luna.gif create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/ACliche2ItemProvider.java create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/ACliche3ItemProvider.java create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/AClicheItemProvider.java create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileEditPlugin.java create mode 100644 plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileItemProviderAdapterFactory.java (limited to 'plugins/org.eclipse.emf.compare.uml2.tests') diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF index 017ca9f3d..5e97dc8c1 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2.tests/META-INF/MANIFEST.MF @@ -9,19 +9,23 @@ Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile, org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.impl, + org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.provider, org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.util, org.eclipse.emf.compare.uml2.tests Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.uml2.uml;bundle-version="5.0.0";visibility:=reexport, org.eclipse.uml2.types;visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport, + org.eclipse.emf.ecore.edit;visibility:=reexport, org.eclipse.uml2.uml.resources;bundle-version="5.0.0", org.junit, org.eclipse.emf.compare, org.eclipse.emf.compare.uml2, org.eclipse.emf.compare.tests;bundle-version="2.0.1", - org.eclipse.uml2.uml.edit;bundle-version="5.0.0" + org.eclipse.uml2.uml.edit;bundle-version="5.0.0";visibility:=reexport, + org.eclipse.uml2.common.edit;visibility:=reexport Bundle-ActivationPolicy: lazy Import-Package: com.google.common.base;version="[11.0.0,16.0.0)", com.google.common.collect;version="[11.0.0,16.0.0)" -Bundle-Activator: org.eclipse.emf.compare.uml2.tests.EMFCompareUML2TestsPlugin +Bundle-Activator: org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.provider.UML2CompareTestProfileEditPlugin$Implementation diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/build.properties b/plugins/org.eclipse.emf.compare.uml2.tests/build.properties index cdb57b8e8..234779947 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/build.properties +++ b/plugins/org.eclipse.emf.compare.uml2.tests/build.properties @@ -13,7 +13,8 @@ bin.includes = .,\ META-INF/,\ plugin.xml,\ plugin.properties,\ - about.html + about.html,\ + icons/ jars.compile.order = . source.. = profile/,\ src/ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche.gif b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche.gif new file mode 100644 index 000000000..30f0c48da Binary files /dev/null and b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche.gif differ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche2.gif b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche2.gif new file mode 100644 index 000000000..98b351f1c Binary files /dev/null and b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche2.gif differ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche3.gif b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche3.gif new file mode 100644 index 000000000..33854e98c Binary files /dev/null and b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/ACliche3.gif differ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/eclipse_kepler.gif b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/eclipse_kepler.gif new file mode 100644 index 000000000..abefafcb6 Binary files /dev/null and b/plugins/org.eclipse.emf.compare.uml2.tests/icons/full/obj16/eclipse_kepler.gif differ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel b/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel index bbaa1cb54..a2aab5c61 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel +++ b/plugins/org.eclipse.emf.compare.uml2.tests/model/UML2CompareTestProfile.genmodel @@ -1,9 +1,10 @@ + modelDirectory="/org.eclipse.emf.compare.uml2.tests/profile" editDirectory="/org.eclipse.emf.compare.uml2.tests/profile" + modelPluginID="org.eclipse.emf.compare.uml2.tests" modelName="UML2CompareTestProfile" + nonNLSMarkers="true" importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="5.0" + copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel#//types">
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/model/icons/eclipse_luna.gif b/plugins/org.eclipse.emf.compare.uml2.tests/model/icons/eclipse_luna.gif new file mode 100644 index 000000000..97847d2b7 Binary files /dev/null and b/plugins/org.eclipse.emf.compare.uml2.tests/model/icons/eclipse_luna.gif differ diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml b/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml index e3594d930..e74826331 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml +++ b/plugins/org.eclipse.emf.compare.uml2.tests/model/uml2.compare.testprofile.profile.uml @@ -1,13 +1,66 @@ - + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
+ +
- + @@ -25,10 +78,10 @@ - - + + - + @@ -49,7 +102,7 @@ - + @@ -57,7 +110,7 @@ - + @@ -75,10 +128,10 @@ - - + + - + @@ -101,7 +154,7 @@ - + @@ -120,58 +173,64 @@ - + - + - + - + - + - + + + +
+
+ + - + - + - + - + - + - + @@ -179,18 +238,18 @@ - + - - + + - + diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/plugin.properties b/plugins/org.eclipse.emf.compare.uml2.tests/plugin.properties index 7e46dce3e..08a21bc3a 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/plugin.properties +++ b/plugins/org.eclipse.emf.compare.uml2.tests/plugin.properties @@ -10,3 +10,27 @@ ################################################################################ pluginName = UML2CompareTestProfile Model providerName = Eclipse Modeling Project +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. +_UI_PropertyDescriptor_description = The {0} of the {1} +_UI_ACliche_type = ACliche +_UI_ACliche2_type = ACliche2 +_UI_ACliche3_type = ACliche3 +_UI_Unknown_type = Object +_UI_Unknown_datatype= Value +_UI_ACliche_singleValuedAttribute_feature = Single Valued Attribute +_UI_ACliche_manyValuedAttribute_feature = Many Valued Attribute +_UI_ACliche_singleValuedReference_feature = Single Valued Reference +_UI_ACliche_manyValuedReference_feature = Many Valued Reference +_UI_ACliche_base_Class_feature = Base Class +_UI_ACliche2_singleValuedAttribute_feature = Single Valued Attribute +_UI_ACliche2_manyValuedAttribute_feature = Many Valued Attribute +_UI_ACliche2_singleValuedReference_feature = Single Valued Reference +_UI_ACliche2_manyValuedReference_feature = Many Valued Reference +_UI_ACliche2_base_Class_feature = Base Class +_UI_ACliche3_base_Class_feature = Base Class +_UI_Unknown_feature = Unspecified diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/plugin.xml b/plugins/org.eclipse.emf.compare.uml2.tests/plugin.xml index b4ea258e0..bd87640eb 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/plugin.xml +++ b/plugins/org.eclipse.emf.compare.uml2.tests/plugin.xml @@ -20,6 +20,19 @@ Contributors: class="org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage" genModel="model/UML2CompareTestProfile.genmodel"/> + + + + + + * + * @generated + */ +public class ACliche2ItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ACliche2ItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addSingleValuedAttributePropertyDescriptor(object); + addManyValuedAttributePropertyDescriptor(object); + addSingleValuedReferencePropertyDescriptor(object); + addManyValuedReferencePropertyDescriptor(object); + addBase_ClassPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Single Valued Attribute feature. + * + * + * @generated + */ + protected void addSingleValuedAttributePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche2_singleValuedAttribute_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche2_singleValuedAttribute_feature", "_UI_ACliche2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE2__SINGLE_VALUED_ATTRIBUTE, true, + false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Many Valued Attribute feature. + * + * + * @generated + */ + protected void addManyValuedAttributePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche2_manyValuedAttribute_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche2_manyValuedAttribute_feature", "_UI_ACliche2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE2__MANY_VALUED_ATTRIBUTE, true, false, + false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Single Valued Reference feature. + * + * + * @generated + */ + protected void addSingleValuedReferencePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche2_singleValuedReference_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche2_singleValuedReference_feature", "_UI_ACliche2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE2__SINGLE_VALUED_REFERENCE, true, + false, true, null, null, null)); + } + + /** + * This adds a property descriptor for the Many Valued Reference feature. + * + * + * @generated + */ + protected void addManyValuedReferencePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche2_manyValuedReference_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche2_manyValuedReference_feature", "_UI_ACliche2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE2__MANY_VALUED_REFERENCE, true, false, + true, null, null, null)); + } + + /** + * This adds a property descriptor for the Base Class feature. + * + * + * @generated + */ + protected void addBase_ClassPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche2_base_Class_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche2_base_Class_feature", "_UI_ACliche2_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE2__BASE_CLASS, true, false, true, null, + null, null)); + } + + /** + * This returns ACliche2.gif. + * + * + * @generated not + */ + @Override + public Object getImage(Object object) { + //Custom icon for test on item providers + return overlayImage(object, getResourceLocator().getImage("full/obj16/eclipse_kepler")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ACliche2)object).getSingleValuedAttribute(); + return label == null || label.length() == 0 ? getString("_UI_ACliche2_type") : //$NON-NLS-1$ + getString("_UI_ACliche2_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ACliche2.class)) { + case UML2CompareTestProfilePackage.ACLICHE2__SINGLE_VALUED_ATTRIBUTE: + case UML2CompareTestProfilePackage.ACLICHE2__MANY_VALUED_ATTRIBUTE: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return UML2CompareTestProfileEditPlugin.INSTANCE; + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/ACliche3ItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/ACliche3ItemProvider.java new file mode 100644 index 000000000..8319cf3cc --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/ACliche3ItemProvider.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2014 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.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.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage; + +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.ItemProviderAdapter; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche3} object. + * + * + * @generated + */ +public class ACliche3ItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ACliche3ItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addBase_ClassPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Base Class feature. + * + * + * @generated + */ + protected void addBase_ClassPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche3_base_Class_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche3_base_Class_feature", "_UI_ACliche3_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE3__BASE_CLASS, true, false, true, null, + null, null)); + } + + /** + * This returns ACliche3.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ACliche3")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_ACliche3_type"); //$NON-NLS-1$ + } + + /** + * 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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return UML2CompareTestProfileEditPlugin.INSTANCE; + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/AClicheItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/AClicheItemProvider.java new file mode 100644 index 000000000..2732d6ec3 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/AClicheItemProvider.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * Copyright (c) 2014 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.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.compare.uml2.profile.test.uml2comparetestprofile.ACliche; +import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.UML2CompareTestProfilePackage; + +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; + +/** + * This is the item provider adapter for a {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche} object. + * + * + * @generated + */ +public class AClicheItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public AClicheItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addSingleValuedAttributePropertyDescriptor(object); + addManyValuedAttributePropertyDescriptor(object); + addSingleValuedReferencePropertyDescriptor(object); + addManyValuedReferencePropertyDescriptor(object); + addBase_ClassPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Single Valued Attribute feature. + * + * + * @generated + */ + protected void addSingleValuedAttributePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche_singleValuedAttribute_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche_singleValuedAttribute_feature", "_UI_ACliche_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE__SINGLE_VALUED_ATTRIBUTE, true, false, + false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Many Valued Attribute feature. + * + * + * @generated + */ + protected void addManyValuedAttributePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche_manyValuedAttribute_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche_manyValuedAttribute_feature", "_UI_ACliche_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE__MANY_VALUED_ATTRIBUTE, true, false, + false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Single Valued Reference feature. + * + * + * @generated + */ + protected void addSingleValuedReferencePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche_singleValuedReference_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche_singleValuedReference_feature", "_UI_ACliche_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE__SINGLE_VALUED_REFERENCE, true, false, + true, null, null, null)); + } + + /** + * This adds a property descriptor for the Many Valued Reference feature. + * + * + * @generated + */ + protected void addManyValuedReferencePropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche_manyValuedReference_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche_manyValuedReference_feature", "_UI_ACliche_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE__MANY_VALUED_REFERENCE, true, false, + true, null, null, null)); + } + + /** + * This adds a property descriptor for the Base Class feature. + * + * + * @generated + */ + protected void addBase_ClassPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ACliche_base_Class_feature"), //$NON-NLS-1$ + getString( + "_UI_PropertyDescriptor_description", "_UI_ACliche_base_Class_feature", "_UI_ACliche_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + UML2CompareTestProfilePackage.Literals.ACLICHE__BASE_CLASS, true, false, true, null, + null, null)); + } + + /** + * This returns ACliche.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ACliche")); //$NON-NLS-1$ + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ACliche)object).getSingleValuedAttribute(); + return label == null || label.length() == 0 ? getString("_UI_ACliche_type") : //$NON-NLS-1$ + getString("_UI_ACliche_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ACliche.class)) { + case UML2CompareTestProfilePackage.ACLICHE__SINGLE_VALUED_ATTRIBUTE: + case UML2CompareTestProfilePackage.ACLICHE__MANY_VALUED_ATTRIBUTE: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return UML2CompareTestProfileEditPlugin.INSTANCE; + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileEditPlugin.java b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileEditPlugin.java new file mode 100644 index 000000000..edb6fa21e --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileEditPlugin.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2014 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.ecore.provider.EcoreEditPlugin; + +import org.eclipse.uml2.uml.edit.UMLEditPlugin; + +/** + * This is the central singleton for the UML2CompareTestProfile edit plugin. + * + * + * @generated + */ +public final class UML2CompareTestProfileEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final UML2CompareTestProfileEditPlugin INSTANCE = new UML2CompareTestProfileEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public UML2CompareTestProfileEditPlugin() { + super(new ResourceLocator[] {EcoreEditPlugin.INSTANCE, UMLEditPlugin.INSTANCE, }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileItemProviderAdapterFactory.java new file mode 100644 index 000000000..dcba48186 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/profile/org/eclipse/emf/compare/uml2/profile/test/uml2comparetestprofile/provider/UML2CompareTestProfileItemProviderAdapterFactory.java @@ -0,0 +1,258 @@ +/******************************************************************************* + * Copyright (c) 2014 Obeo. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.provider; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.util.UML2CompareTestProfileAdapterFactory; + +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * + * + * @generated + */ +public class UML2CompareTestProfileItemProviderAdapterFactory extends UML2CompareTestProfileAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * + * @generated + */ + public UML2CompareTestProfileItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche} instances. + * + * + * @generated + */ + protected AClicheItemProvider aClicheItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche}. + * + * + * @generated + */ + @Override + public Adapter createAClicheAdapter() { + if (aClicheItemProvider == null) { + aClicheItemProvider = new AClicheItemProvider(this); + } + + return aClicheItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche2} instances. + * + * + * @generated + */ + protected ACliche2ItemProvider aCliche2ItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche2}. + * + * + * @generated + */ + @Override + public Adapter createACliche2Adapter() { + if (aCliche2ItemProvider == null) { + aCliche2ItemProvider = new ACliche2ItemProvider(this); + } + + return aCliche2ItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche3} instances. + * + * + * @generated + */ + protected ACliche3ItemProvider aCliche3ItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.profile.test.uml2comparetestprofile.ACliche3}. + * + * + * @generated + */ + @Override + public Adapter createACliche3Adapter() { + if (aCliche3ItemProvider == null) { + aCliche3ItemProvider = new ACliche3ItemProvider(this); + } + + return aCliche3ItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class) || (((Class)type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * This adds a listener. + * + * + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * + * @generated + */ + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * + * + * @generated + */ + public void dispose() { + if (aClicheItemProvider != null) + aClicheItemProvider.dispose(); + if (aCliche2ItemProvider != null) + aCliche2ItemProvider.dispose(); + if (aCliche3ItemProvider != null) + aCliche3ItemProvider.dispose(); + } + +} -- cgit v1.2.3