/**
* <copyright>
* </copyright>
*
* $Id$
*/
package OntoUML.provider;
import OntoUML.OntoUMLPackage;
import OntoUML.Property;
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;
/**
* This is the item provider adapter for a {@link OntoUML.Property} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PropertyItemProvider
extends StructuralFeatureItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PropertyItemProvider(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);
addIsDerivedPropertyDescriptor(object);
addIsNavigablePropertyDescriptor(object);
addEndTypePropertyDescriptor(object);
addAssociationEndPropertyDescriptor(object);
addSourcePropertyDescriptor(object);
addTargetPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Is Derived feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addIsDerivedPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_isDerived_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_isDerived_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__IS_DERIVED,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Is Navigable feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addIsNavigablePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_isNavigable_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_isNavigable_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__IS_NAVIGABLE,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the End Type feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addEndTypePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_endType_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_endType_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__END_TYPE,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Association End feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addAssociationEndPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_associationEnd_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_associationEnd_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__ASSOCIATION_END,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Source feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addSourcePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_source_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_source_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__SOURCE,
false,
false,
false,
null,
null,
null));
}
/**
* This adds a property descriptor for the Target feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTargetPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Property_target_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Property_target_feature", "_UI_Property_type"),
OntoUMLPackage.Literals.PROPERTY__TARGET,
false,
false,
false,
null,
null,
null));
}
/**
* This returns Property.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Property"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Property)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Property_type") :
getString("_UI_Property_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 -->
* Properly changed in order to make a relationship be the container of a Property when it ceases to be an attribute.
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Property.class)) {
case OntoUMLPackage.PROPERTY__IS_DERIVED:
case OntoUMLPackage.PROPERTY__IS_READ_ONLY:
case OntoUMLPackage.PROPERTY__IS_NAVIGABLE:
case OntoUMLPackage.PROPERTY__END_TYPE:
case OntoUMLPackage.PROPERTY__ASSOCIATION_END:
case OntoUMLPackage.PROPERTY__SOURCE:
case OntoUMLPackage.PROPERTY__TARGET:
case OntoUMLPackage.PROPERTY__ASSOCIATION_END_POSITION_AUX:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
// case OntoUMLPackage.PROPERTY__OWNER:
// Property property = (Property) notification.getNotifier();
// if ((notification.getNewValue() == null) && (property != null)) {
// if (property.getSource() != null) {
// property.getSource().getSourceAux2().add(property);
// }
// else {
// if (property.getTarget() != null) {
// property.getTarget().getTargetAux2().add(property);
// }
// else {
// if (property.getAssociationEnd() != null) {
// property.getAssociationEnd().getAssociationEnd3Aux().add(property);
// }
// }
// }
// }
// 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);
}
}