| /****************************************************************************** |
| * Copyright (c) 2008 IBM Corporation and others. |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| ****************************************************************************/ |
| package org.eclipse.gmf.runtime.notation.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.edit.provider.ComposeableAdapterFactory; |
| import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| import org.eclipse.emf.edit.provider.ViewerNotification; |
| |
| import org.eclipse.gmf.runtime.notation.ListCompartment; |
| import org.eclipse.gmf.runtime.notation.NotationPackage; |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.gmf.runtime.notation.ListCompartment} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class ListCompartmentItemProvider |
| extends BasicCompartmentItemProvider { |
| /** |
| * This constructs an instance from a factory and a notifier. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ListCompartmentItemProvider(AdapterFactory adapterFactory) { |
| super(adapterFactory); |
| } |
| |
| /** |
| * This returns the property descriptors for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public List getPropertyDescriptors(Object object) { |
| if (itemPropertyDescriptors == null) { |
| super.getPropertyDescriptors(object); |
| |
| addSortingPropertyDescriptor(object); |
| addSortingKeysPropertyDescriptor(object); |
| addSortedObjectsPropertyDescriptor(object); |
| addFilteringPropertyDescriptor(object); |
| addFilteringKeysPropertyDescriptor(object); |
| addFilteredObjectsPropertyDescriptor(object); |
| addShowTitlePropertyDescriptor(object); |
| } |
| return itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Sorting feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addSortingPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SortingStyle_sorting_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_SortingStyle_sorting_feature", "_UI_SortingStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.SORTING_STYLE__SORTING, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Sorting Keys feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addSortingKeysPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SortingStyle_sortingKeys_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_SortingStyle_sortingKeys_feature", "_UI_SortingStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.SORTING_STYLE__SORTING_KEYS, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Sorted Objects feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addSortedObjectsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_SortingStyle_sortedObjects_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_SortingStyle_sortedObjects_feature", "_UI_SortingStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.SORTING_STYLE__SORTED_OBJECTS, |
| true, |
| false, |
| true, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Filtering feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addFilteringPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_FilteringStyle_filtering_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_FilteringStyle_filtering_feature", "_UI_FilteringStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.FILTERING_STYLE__FILTERING, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Filtering Keys feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addFilteringKeysPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_FilteringStyle_filteringKeys_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_FilteringStyle_filteringKeys_feature", "_UI_FilteringStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.FILTERING_STYLE__FILTERING_KEYS, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Filtered Objects feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addFilteredObjectsPropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_FilteringStyle_filteredObjects_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_FilteringStyle_filteredObjects_feature", "_UI_FilteringStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.FILTERING_STYLE__FILTERED_OBJECTS, |
| true, |
| false, |
| true, |
| null, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Show Title feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addShowTitlePropertyDescriptor(Object object) { |
| itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_TitleStyle_showTitle_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_TitleStyle_showTitle_feature", "_UI_TitleStyle_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| NotationPackage.Literals.TITLE_STYLE__SHOW_TITLE, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This returns ListCompartment.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object getImage(Object object) { |
| return overlayImage(object, getResourceLocator().getImage("full/obj16/ListCompartment")); //$NON-NLS-1$ |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getText(Object object) { |
| ListCompartment listCompartment = (ListCompartment)object; |
| return getString("_UI_ListCompartment_type") + " " + listCompartment.isVisible(); //$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}. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void notifyChanged(Notification notification) { |
| updateChildren(notification); |
| |
| switch (notification.getFeatureID(ListCompartment.class)) { |
| case NotationPackage.LIST_COMPARTMENT__SORTING: |
| case NotationPackage.LIST_COMPARTMENT__SORTING_KEYS: |
| case NotationPackage.LIST_COMPARTMENT__FILTERING: |
| case NotationPackage.LIST_COMPARTMENT__FILTERING_KEYS: |
| case NotationPackage.LIST_COMPARTMENT__SHOW_TITLE: |
| 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. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { |
| super.collectNewChildDescriptors(newChildDescriptors, object); |
| } |
| |
| /** |
| * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) { |
| Object childFeature = feature; |
| Object childObject = child; |
| |
| boolean qualify = |
| childFeature == NotationPackage.Literals.VIEW__PERSISTED_CHILDREN || |
| childFeature == NotationPackage.Literals.VIEW__TRANSIENT_CHILDREN || |
| childFeature == NotationPackage.Literals.VIEW__STYLES; |
| |
| if (qualify) { |
| return getString |
| ("_UI_CreateChild_text2", //$NON-NLS-1$ |
| new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
| } |
| return super.getCreateChildText(owner, feature, child, selection); |
| } |
| |
| } |