/**
* <copyright>
* </copyright>
*
* $Id$
*/
package es.tid.cim.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.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 es.tid.cim.BGPService;
import es.tid.cim.CimPackage;
/**
* This is the item provider adapter for a {@link es.tid.cim.BGPService} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class BGPServiceItemProvider
extends RouteCalculationServiceItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BGPServiceItemProvider(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);
addBGPPeerGroupServicesPropertyDescriptor(object);
addBGPVersionPropertyDescriptor(object);
addLastErrorCodePropertyDescriptor(object);
addLastMessageErrorSubCodePropertyDescriptor(object);
addLastOpenErrorSubCodePropertyDescriptor(object);
addLastUpdatedErrorSubCodePropertyDescriptor(object);
addBGPRoutingPolicyPropertyDescriptor(object);
addBGPAdminDistancePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the BGP Peer Group Services feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addBGPPeerGroupServicesPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_BGPPeerGroupServices_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_BGPPeerGroupServices_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_BGPPeerGroupServices(),
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the BGP Version feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addBGPVersionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_BGPVersion_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_BGPVersion_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_BGPVersion(),
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Last Error Code feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addLastErrorCodePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_lastErrorCode_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_lastErrorCode_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_LastErrorCode(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Last Message Error Sub Code feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addLastMessageErrorSubCodePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_lastMessageErrorSubCode_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_lastMessageErrorSubCode_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_LastMessageErrorSubCode(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Last Open Error Sub Code feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addLastOpenErrorSubCodePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_lastOpenErrorSubCode_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_lastOpenErrorSubCode_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_LastOpenErrorSubCode(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Last Updated Error Sub Code feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addLastUpdatedErrorSubCodePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_lastUpdatedErrorSubCode_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_lastUpdatedErrorSubCode_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_LastUpdatedErrorSubCode(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the BGP Routing Policy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addBGPRoutingPolicyPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_BGPRoutingPolicy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_BGPRoutingPolicy_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_BGPRoutingPolicy(),
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the BGP Admin Distance feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addBGPAdminDistancePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_BGPService_BGPAdminDistance_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BGPService_BGPAdminDistance_feature", "_UI_BGPService_type"),
CimPackage.eINSTANCE.getBGPService_BGPAdminDistance(),
true,
false,
true,
null,
null,
null));
}
/**
* This returns BGPService.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/BGPService"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((BGPService)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_BGPService_type") :
getString("_UI_BGPService_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(BGPService.class)) {
case CimPackage.BGP_SERVICE__BGP_VERSION:
case CimPackage.BGP_SERVICE__LAST_ERROR_CODE:
case CimPackage.BGP_SERVICE__LAST_MESSAGE_ERROR_SUB_CODE:
case CimPackage.BGP_SERVICE__LAST_OPEN_ERROR_SUB_CODE:
case CimPackage.BGP_SERVICE__LAST_UPDATED_ERROR_SUB_CODE:
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 == CimPackage.eINSTANCE.getManagedElement_Components() ||
childFeature == CimPackage.eINSTANCE.getService_ServiceComponents();
if (qualify) {
return getString
("_UI_CreateChild_text2",
new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
}
return super.getCreateChildText(owner, feature, child, selection);
}
}