|
| 1 | +/** |
| 2 | + */ |
| 3 | +package com.burlette.emf.countries.model.countries.provider; |
| 4 | + |
| 5 | +import com.burlette.emf.countries.model.countries.City; |
| 6 | +import com.burlette.emf.countries.model.countries.CountriesPackage; |
| 7 | + |
| 8 | +import java.util.Collection; |
| 9 | +import java.util.List; |
| 10 | + |
| 11 | +import org.eclipse.emf.common.notify.AdapterFactory; |
| 12 | +import org.eclipse.emf.common.notify.Notification; |
| 13 | + |
| 14 | +import org.eclipse.emf.common.util.ResourceLocator; |
| 15 | + |
| 16 | +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 17 | +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 18 | +import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 19 | +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 20 | +import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 21 | +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 22 | +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 23 | +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 24 | +import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
| 25 | +import org.eclipse.emf.edit.provider.ViewerNotification; |
| 26 | + |
| 27 | +/** |
| 28 | + * This is the item provider adapter for a {@link com.burlette.emf.countries.model.countries.City} object. |
| 29 | + * <!-- begin-user-doc --> |
| 30 | + * <!-- end-user-doc --> |
| 31 | + * @generated |
| 32 | + */ |
| 33 | +public class CityItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, |
| 34 | + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { |
| 35 | + /** |
| 36 | + * This constructs an instance from a factory and a notifier. |
| 37 | + * <!-- begin-user-doc --> |
| 38 | + * <!-- end-user-doc --> |
| 39 | + * @generated |
| 40 | + */ |
| 41 | + public CityItemProvider(AdapterFactory adapterFactory) { |
| 42 | + super(adapterFactory); |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * This returns the property descriptors for the adapted class. |
| 47 | + * <!-- begin-user-doc --> |
| 48 | + * <!-- end-user-doc --> |
| 49 | + * @generated |
| 50 | + */ |
| 51 | + @Override |
| 52 | + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 53 | + if (itemPropertyDescriptors == null) { |
| 54 | + super.getPropertyDescriptors(object); |
| 55 | + |
| 56 | + addNamePropertyDescriptor(object); |
| 57 | + addPopulationPropertyDescriptor(object); |
| 58 | + addIsStateCapitalPropertyDescriptor(object); |
| 59 | + addMayorPropertyDescriptor(object); |
| 60 | + } |
| 61 | + return itemPropertyDescriptors; |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * This adds a property descriptor for the Name feature. |
| 66 | + * <!-- begin-user-doc --> |
| 67 | + * <!-- end-user-doc --> |
| 68 | + * @generated |
| 69 | + */ |
| 70 | + protected void addNamePropertyDescriptor(Object object) { |
| 71 | + itemPropertyDescriptors |
| 72 | + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), |
| 73 | + getResourceLocator(), getString("_UI_City_name_feature"), |
| 74 | + getString("_UI_PropertyDescriptor_description", "_UI_City_name_feature", "_UI_City_type"), |
| 75 | + CountriesPackage.Literals.CITY__NAME, true, false, false, |
| 76 | + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * This adds a property descriptor for the Population feature. |
| 81 | + * <!-- begin-user-doc --> |
| 82 | + * <!-- end-user-doc --> |
| 83 | + * @generated |
| 84 | + */ |
| 85 | + protected void addPopulationPropertyDescriptor(Object object) { |
| 86 | + itemPropertyDescriptors |
| 87 | + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), |
| 88 | + getResourceLocator(), getString("_UI_City_population_feature"), |
| 89 | + getString("_UI_PropertyDescriptor_description", "_UI_City_population_feature", "_UI_City_type"), |
| 90 | + CountriesPackage.Literals.CITY__POPULATION, true, false, false, |
| 91 | + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * This adds a property descriptor for the Is State Capital feature. |
| 96 | + * <!-- begin-user-doc --> |
| 97 | + * <!-- end-user-doc --> |
| 98 | + * @generated |
| 99 | + */ |
| 100 | + protected void addIsStateCapitalPropertyDescriptor(Object object) { |
| 101 | + itemPropertyDescriptors |
| 102 | + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), |
| 103 | + getResourceLocator(), getString("_UI_City_isStateCapital_feature"), |
| 104 | + getString("_UI_PropertyDescriptor_description", "_UI_City_isStateCapital_feature", |
| 105 | + "_UI_City_type"), |
| 106 | + CountriesPackage.Literals.CITY__IS_STATE_CAPITAL, true, false, false, |
| 107 | + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * This adds a property descriptor for the Mayor feature. |
| 112 | + * <!-- begin-user-doc --> |
| 113 | + * <!-- end-user-doc --> |
| 114 | + * @generated |
| 115 | + */ |
| 116 | + protected void addMayorPropertyDescriptor(Object object) { |
| 117 | + itemPropertyDescriptors |
| 118 | + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), |
| 119 | + getResourceLocator(), getString("_UI_City_mayor_feature"), |
| 120 | + getString("_UI_PropertyDescriptor_description", "_UI_City_mayor_feature", "_UI_City_type"), |
| 121 | + CountriesPackage.Literals.CITY__MAYOR, true, false, true, null, null, null)); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * This returns City.gif. |
| 126 | + * <!-- begin-user-doc --> |
| 127 | + * <!-- end-user-doc --> |
| 128 | + * @generated |
| 129 | + */ |
| 130 | + @Override |
| 131 | + public Object getImage(Object object) { |
| 132 | + return overlayImage(object, getResourceLocator().getImage("full/obj16/City")); |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * <!-- begin-user-doc --> |
| 137 | + * <!-- end-user-doc --> |
| 138 | + * @generated |
| 139 | + */ |
| 140 | + @Override |
| 141 | + protected boolean shouldComposeCreationImage() { |
| 142 | + return true; |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * This returns the label text for the adapted class. |
| 147 | + * <!-- begin-user-doc --> |
| 148 | + * <!-- end-user-doc --> |
| 149 | + * @generated |
| 150 | + */ |
| 151 | + @Override |
| 152 | + public String getText(Object object) { |
| 153 | + String label = ((City) object).getName(); |
| 154 | + return label == null || label.length() == 0 ? getString("_UI_City_type") |
| 155 | + : getString("_UI_City_type") + " " + label; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 160 | + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 161 | + * <!-- begin-user-doc --> |
| 162 | + * <!-- end-user-doc --> |
| 163 | + * @generated |
| 164 | + */ |
| 165 | + @Override |
| 166 | + public void notifyChanged(Notification notification) { |
| 167 | + updateChildren(notification); |
| 168 | + |
| 169 | + switch (notification.getFeatureID(City.class)) { |
| 170 | + case CountriesPackage.CITY__NAME: |
| 171 | + case CountriesPackage.CITY__POPULATION: |
| 172 | + case CountriesPackage.CITY__IS_STATE_CAPITAL: |
| 173 | + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 174 | + return; |
| 175 | + } |
| 176 | + super.notifyChanged(notification); |
| 177 | + } |
| 178 | + |
| 179 | + /** |
| 180 | + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 181 | + * that can be created under this object. |
| 182 | + * <!-- begin-user-doc --> |
| 183 | + * <!-- end-user-doc --> |
| 184 | + * @generated |
| 185 | + */ |
| 186 | + @Override |
| 187 | + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 188 | + super.collectNewChildDescriptors(newChildDescriptors, object); |
| 189 | + } |
| 190 | + |
| 191 | + /** |
| 192 | + * Return the resource locator for this item provider's resources. |
| 193 | + * <!-- begin-user-doc --> |
| 194 | + * <!-- end-user-doc --> |
| 195 | + * @generated |
| 196 | + */ |
| 197 | + @Override |
| 198 | + public ResourceLocator getResourceLocator() { |
| 199 | + return CountriesEditPlugin.INSTANCE; |
| 200 | + } |
| 201 | + |
| 202 | +} |
0 commit comments