| /*=============================================================================# |
| # Copyright (c) 2012, 2020 Stephan Wahlbrink 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, or the Apache License, Version 2.0 |
| # which is available at https://www.apache.org/licenses/LICENSE-2.0. |
| # |
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 |
| # |
| # Contributors: |
| # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation |
| #=============================================================================*/ |
| |
| package org.eclipse.statet.rtm.ggplot.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.ecore.EStructuralFeature; |
| 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.ViewerNotification; |
| |
| import org.eclipse.statet.rtm.ggplot.GGPlotFactory; |
| import org.eclipse.statet.rtm.ggplot.GGPlotPackage; |
| import org.eclipse.statet.rtm.ggplot.GeomBarLayer; |
| |
| |
| /** |
| * This is the item provider adapter for a {@link org.eclipse.statet.rtm.ggplot.GeomBarLayer} object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class GeomBarLayerItemProvider |
| extends LayerItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { |
| |
| /** |
| * This constructs an instance from a factory and a notifier. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| public GeomBarLayerItemProvider(final AdapterFactory adapterFactory) { |
| super(adapterFactory, GGPlotPackage.Literals.GEOM_BAR_LAYER); |
| } |
| |
| /** |
| * This returns the property descriptors for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public List<IItemPropertyDescriptor> getPropertyDescriptors(final Object object) { |
| if (this.itemPropertyDescriptors == null) { |
| super.getPropertyDescriptors(object); |
| |
| addXVarPropertyDescriptor(object); |
| addYVarPropertyDescriptor(object); |
| addGroupVarPropertyDescriptor(object); |
| addColorPropertyDescriptor(object); |
| addFillPropertyDescriptor(object); |
| addAlphaPropertyDescriptor(object); |
| } |
| return this.itemPropertyDescriptors; |
| } |
| |
| /** |
| * This adds a property descriptor for the Group Var feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addGroupVarPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropGroupVarProvider_groupVar_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropGroupVarProvider_groupVar_feature", "_UI_PropGroupVarProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_GROUP_VAR_PROVIDER__GROUP_VAR, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the XVar feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addXVarPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropXVarProvider_xVar_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropXVarProvider_xVar_feature", "_UI_PropXVarProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_XVAR_PROVIDER__XVAR, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the YVar feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addYVarPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropYVarProvider_yVar_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropYVarProvider_yVar_feature", "_UI_PropYVarProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_YVAR_PROVIDER__YVAR, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Color feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addColorPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropColorProvider_color_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropColorProvider_color_feature", "_UI_PropColorProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_COLOR_PROVIDER__COLOR, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Fill feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addFillPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropFillProvider_fill_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropFillProvider_fill_feature", "_UI_PropFillProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_FILL_PROVIDER__FILL, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This adds a property descriptor for the Alpha feature. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected void addAlphaPropertyDescriptor(final Object object) { |
| this.itemPropertyDescriptors.add |
| (createItemPropertyDescriptor |
| (((ComposeableAdapterFactory)this.adapterFactory).getRootAdapterFactory(), |
| getResourceLocator(), |
| getString("_UI_PropAlphaProvider_alpha_feature"), //$NON-NLS-1$ |
| getString("_UI_PropertyDescriptor_description", "_UI_PropAlphaProvider_alpha_feature", "_UI_PropAlphaProvider_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| GGPlotPackage.Literals.PROP_ALPHA_PROVIDER__ALPHA, |
| true, |
| false, |
| false, |
| ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| null, |
| null)); |
| } |
| |
| /** |
| * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Collection<? extends EStructuralFeature> getChildrenFeatures(final Object object) { |
| if (this.childrenFeatures == null) { |
| super.getChildrenFeatures(object); |
| this.childrenFeatures.add(GGPlotPackage.Literals.PROP_STAT_PROVIDER__STAT); |
| } |
| return this.childrenFeatures; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EStructuralFeature getChildFeature(final Object object, final Object child) { |
| // Check the type of the specified child object and return the proper feature to use for |
| // adding (see {@link AddCommand}) it as a child. |
| |
| return super.getChildFeature(object, child); |
| } |
| |
| /** |
| * This returns GeomBarLayer.gif. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object getImage(final Object object) { |
| return overlayImage(object, getResourceLocator().getImage("full/obj16/GeomBarLayer")); //$NON-NLS-1$ |
| } |
| |
| /** |
| * This returns the label text for the adapted class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String getText(final Object object) { |
| return super.getText(object); |
| } |
| |
| /** |
| * 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 |
| */ |
| @Override |
| public void notifyChanged(final Notification notification) { |
| updateChildren(notification); |
| |
| switch (notification.getFeatureID(GeomBarLayer.class)) { |
| case GGPlotPackage.GEOM_BAR_LAYER__XVAR: |
| case GGPlotPackage.GEOM_BAR_LAYER__YVAR: |
| case GGPlotPackage.GEOM_BAR_LAYER__GROUP_VAR: |
| case GGPlotPackage.GEOM_BAR_LAYER__COLOR: |
| case GGPlotPackage.GEOM_BAR_LAYER__FILL: |
| case GGPlotPackage.GEOM_BAR_LAYER__ALPHA: |
| fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| return; |
| case GGPlotPackage.GEOM_BAR_LAYER__STAT: |
| fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 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 |
| */ |
| @Override |
| protected void collectNewChildDescriptors(final Collection<Object> newChildDescriptors, final Object object) { |
| super.collectNewChildDescriptors(newChildDescriptors, object); |
| |
| newChildDescriptors.add |
| (createChildParameter |
| (GGPlotPackage.Literals.PROP_STAT_PROVIDER__STAT, |
| GGPlotFactory.eINSTANCE.createIdentityStat())); |
| |
| newChildDescriptors.add |
| (createChildParameter |
| (GGPlotPackage.Literals.PROP_STAT_PROVIDER__STAT, |
| GGPlotFactory.eINSTANCE.createSummaryStat())); |
| } |
| |
| } |