Go to the documentation of this file.00001
00007 package org.best_of_robotics.model.datatypes.provider;
00008
00009
00010 import java.util.Collection;
00011 import java.util.List;
00012
00013 import org.best_of_robotics.model.datatypes.DatatypesPackage;
00014 import org.best_of_robotics.model.datatypes.IDLReference;
00015
00016 import org.eclipse.emf.common.notify.AdapterFactory;
00017 import org.eclipse.emf.common.notify.Notification;
00018
00019 import org.eclipse.emf.common.util.ResourceLocator;
00020
00021 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
00022 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
00023 import org.eclipse.emf.edit.provider.IItemLabelProvider;
00024 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
00025 import org.eclipse.emf.edit.provider.IItemPropertySource;
00026 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
00027 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
00028 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
00029 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
00030 import org.eclipse.emf.edit.provider.ViewerNotification;
00031
00038 public class IDLReferenceItemProvider
00039 extends ItemProviderAdapter
00040 implements
00041 IEditingDomainItemProvider,
00042 IStructuredItemContentProvider,
00043 ITreeItemContentProvider,
00044 IItemLabelProvider,
00045 IItemPropertySource {
00052 public IDLReferenceItemProvider(AdapterFactory adapterFactory) {
00053 super(adapterFactory);
00054 }
00055
00062 @Override
00063 public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
00064 if (itemPropertyDescriptors == null) {
00065 super.getPropertyDescriptors(object);
00066
00067 addNamePropertyDescriptor(object);
00068 }
00069 return itemPropertyDescriptors;
00070 }
00071
00078 protected void addNamePropertyDescriptor(Object object) {
00079 itemPropertyDescriptors.add
00080 (createItemPropertyDescriptor
00081 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
00082 getResourceLocator(),
00083 getString("_UI_DataType_name_feature"),
00084 getString("_UI_PropertyDescriptor_description", "_UI_DataType_name_feature", "_UI_DataType_type"),
00085 DatatypesPackage.Literals.DATA_TYPE__NAME,
00086 true,
00087 false,
00088 false,
00089 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
00090 null,
00091 null));
00092 }
00093
00100 @Override
00101 public String getText(Object object) {
00102 String label = ((IDLReference)object).getName();
00103 return label == null || label.length() == 0 ?
00104 getString("_UI_IDLReference_type") :
00105 getString("_UI_IDLReference_type") + " " + label;
00106 }
00107
00115 @Override
00116 public void notifyChanged(Notification notification) {
00117 updateChildren(notification);
00118
00119 switch (notification.getFeatureID(IDLReference.class)) {
00120 case DatatypesPackage.IDL_REFERENCE__NAME:
00121 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
00122 return;
00123 }
00124 super.notifyChanged(notification);
00125 }
00126
00134 @Override
00135 protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
00136 super.collectNewChildDescriptors(newChildDescriptors, object);
00137 }
00138
00145 @Override
00146 public ResourceLocator getResourceLocator() {
00147 return DataTypesEditPlugin.INSTANCE;
00148 }
00149
00150 }