blob: 3aef04f201f9cd27333f284ddaed6962072e4d10 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.core.extension.model.extension.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.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
import org.eclipse.osbp.ecview.core.extension.model.extension.YSlider;
/**
* This is the item provider adapter for a {@link org.eclipse.osbp.ecview.core.extension.model.extension.YSlider} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class YSliderItemProvider extends YInputItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public YSliderItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addValueBindingEndpointPropertyDescriptor(object);
addDatadescriptionPropertyDescriptor(object);
addValuePropertyDescriptor(object);
addMaxValuePropertyDescriptor(object);
addMinValuePropertyDescriptor(object);
addResolutionPropertyDescriptor(object);
addOrientationPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Value Binding Endpoint feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addValueBindingEndpointPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YValueBindable_valueBindingEndpoint_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YValueBindable_valueBindingEndpoint_feature", "_UI_YValueBindable_type"),
CoreModelPackage.Literals.YVALUE_BINDABLE__VALUE_BINDING_ENDPOINT,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Datadescription feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDatadescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_datadescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_datadescription_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__DATADESCRIPTION,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Value feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addValuePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_value_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_value_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__VALUE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Max Value feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addMaxValuePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_maxValue_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_maxValue_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__MAX_VALUE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Min Value feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addMinValuePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_minValue_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_minValue_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__MIN_VALUE,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Resolution feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addResolutionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_resolution_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_resolution_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__RESOLUTION,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Orientation feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addOrientationPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_YSlider_orientation_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_YSlider_orientation_feature", "_UI_YSlider_type"),
ExtensionModelPackage.Literals.YSLIDER__ORIENTATION,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This returns YSlider.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/YSlider"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((YSlider)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_YSlider_type") :
getString("_UI_YSlider_type") + " " + label;
}
/**
* 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(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(YSlider.class)) {
case ExtensionModelPackage.YSLIDER__VALUE:
case ExtensionModelPackage.YSLIDER__MAX_VALUE:
case ExtensionModelPackage.YSLIDER__MIN_VALUE:
case ExtensionModelPackage.YSLIDER__RESOLUTION:
case ExtensionModelPackage.YSLIDER__ORIENTATION:
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
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> 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
*/
@Override
public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
Object childFeature = feature;
Object childObject = child;
boolean qualify =
childFeature == CoreModelPackage.Literals.YFIELD__VALIDATORS ||
childFeature == CoreModelPackage.Literals.YFIELD__INTERNAL_VALIDATORS;
if (qualify) {
return getString
("_UI_CreateChild_text2",
new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
}
return super.getCreateChildText(owner, feature, child, selection);
}
}