$search
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.RosIDLReference; 00015 import org.eclipse.emf.common.notify.AdapterFactory; 00016 import org.eclipse.emf.common.notify.Notification; 00017 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 00018 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 00019 import org.eclipse.emf.edit.provider.IItemLabelProvider; 00020 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; 00021 import org.eclipse.emf.edit.provider.IItemPropertySource; 00022 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 00023 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 00024 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; 00025 import org.eclipse.emf.edit.provider.ViewerNotification; 00026 00033 public class RosIDLReferenceItemProvider 00034 extends IDLReferenceItemProvider 00035 implements 00036 IEditingDomainItemProvider, 00037 IStructuredItemContentProvider, 00038 ITreeItemContentProvider, 00039 IItemLabelProvider, 00040 IItemPropertySource { 00047 public RosIDLReferenceItemProvider(AdapterFactory adapterFactory) { 00048 super(adapterFactory); 00049 } 00050 00057 @Override 00058 public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { 00059 if (itemPropertyDescriptors == null) { 00060 super.getPropertyDescriptors(object); 00061 00062 addNamespacePropertyDescriptor(object); 00063 addRosPackagePropertyDescriptor(object); 00064 } 00065 return itemPropertyDescriptors; 00066 } 00067 00074 protected void addNamespacePropertyDescriptor(Object object) { 00075 itemPropertyDescriptors.add 00076 (createItemPropertyDescriptor 00077 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 00078 getResourceLocator(), 00079 getString("_UI_RosIDLReference_namespace_feature"), 00080 getString("_UI_PropertyDescriptor_description", "_UI_RosIDLReference_namespace_feature", "_UI_RosIDLReference_type"), 00081 DatatypesPackage.Literals.ROS_IDL_REFERENCE__NAMESPACE, 00082 true, 00083 false, 00084 false, 00085 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, 00086 null, 00087 null)); 00088 } 00089 00096 protected void addRosPackagePropertyDescriptor(Object object) { 00097 itemPropertyDescriptors.add 00098 (createItemPropertyDescriptor 00099 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 00100 getResourceLocator(), 00101 getString("_UI_RosIDLReference_rosPackage_feature"), 00102 getString("_UI_PropertyDescriptor_description", "_UI_RosIDLReference_rosPackage_feature", "_UI_RosIDLReference_type"), 00103 DatatypesPackage.Literals.ROS_IDL_REFERENCE__ROS_PACKAGE, 00104 true, 00105 false, 00106 false, 00107 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, 00108 null, 00109 null)); 00110 } 00111 00118 @Override 00119 public Object getImage(Object object) { 00120 return overlayImage(object, getResourceLocator().getImage("full/obj16/RosIDLReference")); 00121 } 00122 00130 @Override 00131 public String getText(Object object) { 00132 String label = ((RosIDLReference)object).getLabel(); 00133 return label == null || label.length() == 0 ? 00134 getString("_UI_RosIDLReference_type") : 00135 label + " - " + getString("_UI_RosIDLReference_type"); 00136 } 00137 00145 @Override 00146 public void notifyChanged(Notification notification) { 00147 updateChildren(notification); 00148 00149 switch (notification.getFeatureID(RosIDLReference.class)) { 00150 case DatatypesPackage.ROS_IDL_REFERENCE__NAMESPACE: 00151 case DatatypesPackage.ROS_IDL_REFERENCE__ROS_PACKAGE: 00152 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 00153 return; 00154 } 00155 super.notifyChanged(notification); 00156 } 00157 00165 @Override 00166 protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { 00167 super.collectNewChildDescriptors(newChildDescriptors, object); 00168 } 00169 00170 }