KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > edit > provider > ReflectiveItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: ReflectiveItemProvider.java,v 1.15 2005/06/12 13:32:37 emerks Exp $
16  */

17 package org.eclipse.emf.edit.provider;
18
19
20 import java.util.ArrayList JavaDoc;
21 import java.util.Collection JavaDoc;
22 import java.util.Collections JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.Iterator JavaDoc;
25 import java.util.List JavaDoc;
26 import java.util.Map JavaDoc;
27 import java.util.Set JavaDoc;
28
29 import org.eclipse.emf.common.notify.AdapterFactory;
30 import org.eclipse.emf.common.notify.Notification;
31 import org.eclipse.emf.common.util.URI;
32 import org.eclipse.emf.ecore.EAttribute;
33 import org.eclipse.emf.ecore.EClass;
34 import org.eclipse.emf.ecore.EClassifier;
35 import org.eclipse.emf.ecore.EDataType;
36 import org.eclipse.emf.ecore.EModelElement;
37 import org.eclipse.emf.ecore.EObject;
38 import org.eclipse.emf.ecore.EPackage;
39 import org.eclipse.emf.ecore.EReference;
40 import org.eclipse.emf.ecore.EStructuralFeature;
41 import org.eclipse.emf.ecore.EcorePackage;
42 import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
43 import org.eclipse.emf.ecore.util.EcoreUtil;
44 import org.eclipse.emf.ecore.util.ExtendedMetaData;
45 import org.eclipse.emf.ecore.util.FeatureMap;
46 import org.eclipse.emf.ecore.util.FeatureMapUtil;
47 import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
48
49
50 /**
51  * This adapter implementation provides reflective support
52  * that emulates the behaviour of a default generated item provider.
53  */

54 public class ReflectiveItemProvider
55   extends ItemProviderAdapter
56   implements
57     IEditingDomainItemProvider,
58     IStructuredItemContentProvider,
59     ITreeItemContentProvider,
60     IItemLabelProvider,
61     IItemPropertySource
62 {
63   /**
64    */

65   public ReflectiveItemProvider(AdapterFactory adapterFactory)
66   {
67     super(adapterFactory);
68   }
69
70   /**
71    */

72   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
73   {
74     // if (itemPropertyDescriptors == null)
75
{
76       itemPropertyDescriptors = new ArrayList JavaDoc();
77
78       for (Iterator JavaDoc i = ((EObject)object).eClass().getEAllStructuralFeatures().iterator(); i.hasNext(); )
79       {
80         EStructuralFeature eFeature = (EStructuralFeature)i.next();
81         if (!(eFeature instanceof EReference) || !((EReference)eFeature).isContainment())
82         {
83           itemPropertyDescriptors.add
84             (new ItemPropertyDescriptor
85               (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
86                getFeatureText(eFeature),
87                getResourceLocator().getString
88                  ("_UI_Property_description", new Object JavaDoc [] { getFeatureText(eFeature), eFeature.getEType().getName() }),
89                eFeature,
90                eFeature.isChangeable(),
91                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
92         }
93       }
94     }
95     return itemPropertyDescriptors;
96   }
97
98   protected List JavaDoc allRoots;
99   protected List JavaDoc allEPackages;
100   protected List JavaDoc allEClasses;
101
102   protected void gatherAllMetaData(EObject eObject)
103   {
104     EObject root = EcoreUtil.getRootContainer(eObject);
105     ExtendedMetaData extendedMetaData =
106         root.eResource() == null || root.eResource().getResourceSet() == null ?
107           ExtendedMetaData.INSTANCE :
108           new BasicExtendedMetaData(root.eResource().getResourceSet().getPackageRegistry());
109     EStructuralFeature xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(root.eClass());
110     if (xmlnsPrefixMapFeature != null)
111     {
112       for (Iterator JavaDoc i = ((List JavaDoc)root.eGet(xmlnsPrefixMapFeature)).iterator(); i.hasNext(); )
113       {
114         Map.Entry JavaDoc entry = (Map.Entry JavaDoc)i.next();
115         EPackage ePackage = extendedMetaData.getPackage((String JavaDoc)entry.getValue());
116         if (ePackage != null)
117         {
118           gatherMetaData((EModelElement)EcoreUtil.getRootContainer(ePackage));
119         }
120       }
121     }
122     
123     gatherMetaData(eObject.eClass());
124   }
125   
126   protected List JavaDoc getAllEClasses(EClass eClass)
127   {
128     gatherMetaData(eClass);
129     return allEClasses;
130   }
131   
132   protected List JavaDoc getAllEPackages(EClass eClass)
133   {
134     gatherMetaData(eClass);
135     return allEPackages;
136   }
137     
138   protected void gatherMetaData(EModelElement eModelElement)
139   {
140     if (allRoots == null)
141     {
142       allRoots = new ArrayList JavaDoc();
143       allEClasses = new ArrayList JavaDoc();
144       allEPackages = new ArrayList JavaDoc();
145     }
146     
147     Set JavaDoc roots = new HashSet JavaDoc();
148     EObject root = EcoreUtil.getRootContainer(eModelElement);
149     for (;;)
150     {
151       if (!allRoots.contains(root))
152       {
153         allRoots.add(root);
154         ExtendedMetaData extendedMetaData =
155             root.eResource() == null || root.eResource().getResourceSet() == null ?
156               ExtendedMetaData.INSTANCE :
157               new BasicExtendedMetaData(root.eResource().getResourceSet().getPackageRegistry());
158         if (root instanceof EPackage)
159         {
160           allEPackages.add(root);
161         }
162         for (Iterator JavaDoc i = root.eAllContents(); i.hasNext(); )
163         {
164           EObject eObject = (EObject)i.next();
165           
166           if (eObject instanceof EClassifier)
167           {
168             extendedMetaData.getName((EClassifier)eObject);
169             if (eObject instanceof EClass)
170             {
171               allEClasses.add(eObject);
172             }
173           }
174           else if (eObject instanceof EStructuralFeature)
175           {
176             extendedMetaData.getName((EStructuralFeature)eObject);
177           }
178           else if (eObject instanceof EPackage)
179           {
180             allEPackages.add(eObject);
181           }
182           
183           for (Iterator JavaDoc j = eObject.eClass().getEAllReferences().iterator(); j.hasNext(); )
184           {
185             EReference eReference = (EReference)j.next();
186             if (!eReference.isDerived() && !eReference.isContainer() && !eReference.isContainment())
187             {
188               if (eReference.isMany())
189               {
190                 for (Iterator JavaDoc k = ((List JavaDoc)eObject.eGet(eReference)).iterator(); k.hasNext(); )
191                 {
192                   EObject crossReference = (EObject)k.next();
193                   if (crossReference != null)
194                   {
195                     EObject otherRoot = EcoreUtil.getRootContainer(crossReference);
196                     if (!allRoots.contains(otherRoot))
197                     {
198                       roots.add(otherRoot);
199                     }
200                   }
201                 }
202               }
203               else
204               {
205                 EObject crossReference = (EObject)eObject.eGet(eReference);
206                 if (crossReference != null)
207                 {
208                   EObject otherRoot = EcoreUtil.getRootContainer(crossReference);
209                   if (!allRoots.contains(otherRoot))
210                   {
211                     roots.add(otherRoot);
212                   }
213                 }
214               }
215             }
216           }
217         }
218       }
219
220       if (roots.isEmpty())
221       {
222         break;
223       }
224       else
225       {
226         Iterator JavaDoc i = roots.iterator();
227         root = (EObject)i.next();
228         i.remove();
229       }
230     }
231   }
232
233   protected List JavaDoc getAllConcreteSubclasses(EClass eClass)
234   {
235     List JavaDoc result = new ArrayList JavaDoc();
236     if (eClass == EcorePackage.eINSTANCE.getEObject())
237     {
238       for (Iterator JavaDoc i = getAllEClasses(eClass).iterator(); i.hasNext(); )
239       {
240         EClass otherEClass = (EClass)i.next();
241         if (!otherEClass.isAbstract() && !ExtendedMetaData.INSTANCE.isAnonymous(otherEClass))
242         {
243           result.add(otherEClass);
244         }
245       }
246     }
247     else if (ExtendedMetaData.INSTANCE.isAnonymous(eClass))
248     {
249       result.add(eClass);
250     }
251     else
252     {
253       for (Iterator JavaDoc i = getAllEClasses(eClass).iterator(); i.hasNext(); )
254       {
255         EClass otherEClass = (EClass)i.next();
256         if (!otherEClass.isAbstract() && eClass.isSuperTypeOf(otherEClass) && !ExtendedMetaData.INSTANCE.isAnonymous(otherEClass))
257         {
258           result.add(otherEClass);
259         }
260       }
261     }
262     return result;
263   }
264
265   /**
266    */

267   protected Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
268   {
269     // if (childrenFeatures == null)
270
{
271       childrenFeatures = new ArrayList JavaDoc();
272       EObject eObject = (EObject)object;
273       EClass eClass = eObject.eClass();
274       if (ExtendedMetaData.INSTANCE.getContentKind(eClass) != ExtendedMetaData.MIXED_CONTENT)
275       {
276         for (Iterator JavaDoc i = eClass.getEAllReferences().iterator(); i.hasNext(); )
277         {
278           EReference eReference = (EReference)i.next();
279           if (eReference.isContainment() && ExtendedMetaData.INSTANCE.getGroup(eReference) == null)
280           {
281             childrenFeatures.add(eReference);
282           }
283         }
284       }
285       for (Iterator JavaDoc i = eClass.getEAllAttributes().iterator(); i.hasNext(); )
286       {
287         EAttribute eAttribute = (EAttribute)i.next();
288         if (ExtendedMetaData.INSTANCE.getGroup(eAttribute) == null &&
289               eAttribute.getEType().getInstanceClass() == FeatureMap.Entry.class &&
290               !eAttribute.isDerived())
291         {
292           childrenFeatures.add(eAttribute);
293         }
294       }
295     }
296     return childrenFeatures;
297   }
298
299   /**
300    */

301   public Object JavaDoc getImage(Object JavaDoc object)
302   {
303     EObject eObject = (EObject)object;
304     EClass eClass = eObject.eClass();
305     return URI.createURI(getResourceLocator().getImage("full/obj16/Item").toString() + "#" + eClass.getName());
306   }
307
308   /**
309    */

310   public String JavaDoc getText(Object JavaDoc object)
311   {
312     EObject eObject = (EObject)object;
313     EClass eClass = eObject.eClass();
314     String JavaDoc label = format(capName(eClass.getName()), ' ');
315
316     EStructuralFeature feature = getLabelFeature(eClass);
317     if (feature != null)
318     {
319       Object JavaDoc value = eObject.eGet(feature);
320       if (value != null)
321       {
322         return label + " " + value.toString();
323       }
324     }
325     return label;
326   }
327
328   /**
329    */

330   protected EStructuralFeature getLabelFeature(EClass eClass)
331   {
332     EAttribute result = null;
333     for (Iterator JavaDoc i = eClass.getEAllAttributes().iterator(); i.hasNext(); )
334     {
335       EAttribute eAttribute = (EAttribute)i.next();
336       if (!eAttribute.isMany() && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class)
337       {
338         if ("name".equalsIgnoreCase(eAttribute.getName()))
339         {
340           result = eAttribute;
341           break;
342         }
343         else if (result == null)
344         {
345           result = eAttribute;
346         }
347         else if (eAttribute.getEAttributeType().getInstanceClass() == String JavaDoc.class &&
348                  result.getEAttributeType().getInstanceClass() != String JavaDoc.class)
349         {
350           result = eAttribute;
351         }
352       }
353     }
354     return result;
355   }
356
357   /**
358    */

359   protected String JavaDoc capName(String JavaDoc name)
360   {
361     return name.length() == 0 ? name : name.substring(0, 1).toUpperCase() + name.substring(1);
362   }
363
364   /**
365    */

366   public String JavaDoc format(String JavaDoc name, char separator)
367   {
368     StringBuffer JavaDoc result = new StringBuffer JavaDoc();
369
370     for (Iterator JavaDoc i = parseName(name, '_').iterator(); i.hasNext(); )
371     {
372       String JavaDoc component = (String JavaDoc)i.next();
373       result.append(component);
374       if (i.hasNext() && component.length() > 1)
375       {
376         result.append(separator);
377       }
378     }
379     return result.toString();
380   }
381
382   /**
383    */

384   protected List JavaDoc parseName(String JavaDoc sourceName, char sourceSeparator)
385   {
386     List JavaDoc result = new ArrayList JavaDoc();
387     StringBuffer JavaDoc currentWord = new StringBuffer JavaDoc();
388
389     int length = sourceName.length();
390     boolean lastIsLower = false;
391
392     for (int index = 0; index < length; index++)
393     {
394       char curChar = sourceName.charAt(index);
395       if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == sourceSeparator)
396       {
397         if (lastIsLower || curChar == sourceSeparator)
398         {
399           result.add(currentWord.toString());
400           currentWord = new StringBuffer JavaDoc();
401         }
402         lastIsLower = false;
403       }
404       else
405       {
406         if (!lastIsLower)
407         {
408           int currentWordLength = currentWord.length();
409           if (currentWordLength > 1)
410           {
411             char lastChar = currentWord.charAt(--currentWordLength);
412             currentWord.setLength(currentWordLength);
413             result.add(currentWord.toString());
414             currentWord = new StringBuffer JavaDoc();
415             currentWord.append(lastChar);
416           }
417         }
418         lastIsLower = true;
419       }
420       if (curChar != sourceSeparator)
421       {
422         currentWord.append(curChar);
423       }
424     }
425
426     result.add(currentWord.toString());
427     return result;
428   }
429
430   /**
431    */

432   protected List JavaDoc getAllDelegatedFeatures(EStructuralFeature feature)
433   {
434     if (!FeatureMapUtil.isFeatureMap(feature)) return Collections.EMPTY_LIST;
435
436     EClass eClass = feature.getEContainingClass();
437     List JavaDoc delegated = new ArrayList JavaDoc();
438
439     if (ExtendedMetaData.INSTANCE.getMixedFeature(eClass) == feature)
440     {
441        delegated.add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Comment());
442        delegated.add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text());
443
444        if (ExtendedMetaData.INSTANCE.getDocumentRoot(eClass.getEPackage()) != eClass)
445        {
446          delegated.add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_CDATA());
447        }
448
449        for (Iterator JavaDoc i = eClass.getEAllStructuralFeatures().iterator(); i.hasNext(); )
450        {
451          EStructuralFeature otherFeature = (EStructuralFeature)i.next();
452          if (otherFeature != feature && otherFeature.isDerived() && otherFeature.isChangeable() &&
453              ExtendedMetaData.INSTANCE.getGroup(otherFeature) == null)
454          {
455            delegated.add(otherFeature);
456          }
457        }
458     }
459     else
460     {
461       switch (ExtendedMetaData.INSTANCE.getFeatureKind(feature))
462       {
463         case ExtendedMetaData.GROUP_FEATURE:
464         {
465           Set JavaDoc allDelegated = new HashSet JavaDoc();
466           Set JavaDoc qNames = new HashSet JavaDoc();
467           for (Iterator JavaDoc i = eClass.getEStructuralFeatures().iterator(); i.hasNext(); )
468           {
469             EStructuralFeature otherFeature = (EStructuralFeature)i.next();
470             if (otherFeature != feature && otherFeature.isDerived() &&
471                 ExtendedMetaData.INSTANCE.getGroup(otherFeature) == feature)
472             {
473               if (otherFeature.isChangeable())
474               {
475                 delegated.add(otherFeature);
476                 qNames.add
477                   (ExtendedMetaData.INSTANCE.getNamespace(otherFeature) + "#" +
478                      ExtendedMetaData.INSTANCE.getName(otherFeature));
479               }
480               allDelegated.add(otherFeature);
481             }
482           }
483           
484           for (Iterator JavaDoc i = getAllEPackages(eClass).iterator(); i.hasNext(); )
485           {
486             EPackage ePackage = (EPackage)i.next();
487             EClass documentRootEClass = ExtendedMetaData.INSTANCE.getDocumentRoot(ePackage);
488             if (documentRootEClass != null)
489             {
490               for (Iterator JavaDoc j = documentRootEClass.getEAllStructuralFeatures().iterator(); j.hasNext(); )
491               {
492                 EStructuralFeature otherFeature = (EStructuralFeature)j.next();
493                 if (otherFeature != feature &&
494                       otherFeature.isChangeable() &&
495                       otherFeature.isDerived() &&
496                       allDelegated.contains(ExtendedMetaData.INSTANCE.getAffiliation(eClass, otherFeature)) &&
497                       qNames.add
498                         (ExtendedMetaData.INSTANCE.getNamespace(otherFeature) + "#" +
499                            ExtendedMetaData.INSTANCE.getName(otherFeature)))
500                 {
501                   delegated.add(otherFeature);
502                 }
503               }
504             }
505           }
506             
507           break;
508         }
509         case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE:
510         case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE:
511         {
512           for (Iterator JavaDoc i = getAllEPackages(eClass).iterator(); i.hasNext(); )
513           {
514             EPackage ePackage = (EPackage)i.next();
515             EClass documentRootEClass = ExtendedMetaData.INSTANCE.getDocumentRoot(ePackage);
516             if (documentRootEClass != null)
517             {
518               for (Iterator JavaDoc j = documentRootEClass.getEAllStructuralFeatures().iterator(); j.hasNext(); )
519               {
520                 EStructuralFeature otherFeature = (EStructuralFeature)j.next();
521                 if (otherFeature != feature &&
522                       otherFeature.isDerived() &&
523                       otherFeature.isChangeable() &&
524                       ExtendedMetaData.INSTANCE.getAffiliation(eClass, otherFeature) == feature)
525                 {
526                   delegated.add(otherFeature);
527                 }
528               }
529             }
530           }
531           break;
532         }
533       }
534     }
535
536     List JavaDoc result = new ArrayList JavaDoc();
537     for (Iterator JavaDoc iter = delegated.iterator(); iter.hasNext(); )
538     {
539       EStructuralFeature delegatedFeature = (EStructuralFeature)iter.next();
540       if (FeatureMapUtil.isFeatureMap(delegatedFeature))
541       {
542         result.addAll(getAllDelegatedFeatures(delegatedFeature));
543       }
544       else
545       {
546         result.add(delegatedFeature);
547       }
548     }
549     return result;
550   }
551
552   /**
553    */

554   protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object)
555   {
556     // This ensure that this package itself is traversed even if the reference type is EObject...
557
//
558
gatherAllMetaData((EObject)object);
559
560     for (Iterator JavaDoc i = getChildrenFeatures(object).iterator(); i.hasNext(); )
561     {
562       EStructuralFeature feature = (EStructuralFeature)i.next();
563
564       if (FeatureMapUtil.isFeatureMap(feature))
565       {
566         for (Iterator JavaDoc j = getAllDelegatedFeatures(feature).iterator(); j.hasNext(); )
567         {
568           EStructuralFeature delegatedFeature = (EStructuralFeature)j.next();
569
570           if (delegatedFeature instanceof EAttribute)
571           {
572             EDataType type = ((EAttribute)delegatedFeature).getEAttributeType();
573             Object JavaDoc value = delegatedFeature.getDefaultValue();
574
575             if (value == null)
576             {
577               Class JavaDoc instanceClass = type.getInstanceClass();
578
579               if (instanceClass == String JavaDoc.class)
580               {
581                 value = "";
582               }
583               else if (instanceClass == Boolean JavaDoc.class)
584               {
585                 value = Boolean.FALSE;
586               }
587               else if (instanceClass == Character JavaDoc.class)
588               {
589                 value = new Character JavaDoc('\u0000');
590               }
591               else
592               {
593                 String JavaDoc literal = instanceClass != null && Number JavaDoc.class.isAssignableFrom(instanceClass) ? "0" : "";
594                 try
595                 {
596                   value = EcoreUtil.createFromString(type, literal);
597                 }
598                 catch (Exception JavaDoc e) {}
599               }
600             }
601
602             if (value != null)
603             {
604               newChildDescriptors.add(createChildParameter(feature, FeatureMapUtil.createEntry(delegatedFeature, value)));
605             }
606           }
607           else if (delegatedFeature instanceof EReference)
608           {
609             for (Iterator JavaDoc k = getAllConcreteSubclasses((EClass)delegatedFeature.getEType()).iterator(); k.hasNext(); )
610             {
611               FeatureMap.Entry entry = FeatureMapUtil.createEntry(delegatedFeature, EcoreUtil.create((EClass)k.next()));
612               newChildDescriptors.add(createChildParameter(feature, entry));
613             }
614           }
615         }
616       }
617       else if (feature instanceof EReference && feature.isChangeable())
618       {
619         for (Iterator JavaDoc j = getAllConcreteSubclasses((EClass)feature.getEType()).iterator(); j.hasNext(); )
620         {
621           newChildDescriptors.add(createChildParameter(feature, EcoreUtil.create((EClass)j.next())));
622         }
623       }
624     }
625   }
626
627   /**
628    */

629   public Object JavaDoc getCreateChildImage(Object JavaDoc owner, Object JavaDoc feature, Object JavaDoc child, Collection JavaDoc selection)
630   {
631     if (feature instanceof EStructuralFeature && FeatureMapUtil.isFeatureMap((EStructuralFeature)feature))
632     {
633       FeatureMap.Entry entry = (FeatureMap.Entry)child;
634       feature = entry.getEStructuralFeature();
635       child = entry.getValue();
636     }
637
638     if (feature instanceof EReference && child instanceof EObject)
639     {
640       EReference reference = (EReference)feature;
641       EClass parentClass = reference.getEContainingClass();
642       EClass childClass = ((EObject)child).eClass();
643       return
644         URI.createURI
645           (getResourceLocator().getImage("full/ctool16/CreateChild").toString() +
646              "#" + parentClass.getName() + "/" + childClass.getName());
647     }
648
649     return getResourceLocator().getImage("full/ctool16/CreateChild");
650   }
651
652   /**
653    */

654   protected String JavaDoc getTypeText(Object JavaDoc object)
655   {
656     String JavaDoc text = object instanceof EObject ? ((EObject)object).eClass().getName() : getString("_UI_Unknown_type");
657     return format(capName(text), ' ');
658   }
659
660   /**
661    */

662   protected String JavaDoc getTypeText(EAttribute attribute)
663   {
664     return format(capName(attribute.getEAttributeType().getName()), ' ');
665   }
666
667   /**
668    */

669   protected String JavaDoc getFeatureText(Object JavaDoc feature)
670   {
671     String JavaDoc text = feature instanceof EStructuralFeature ?
672       ((EStructuralFeature)feature).getName() : getResourceLocator().getString("_UI_Unknown_feature");
673     return format(capName(text), ' ');
674   }
675
676   /**
677    */

678   public void notifyChanged(Notification notification)
679   {
680     updateChildren(notification);
681
682     EObject object = (EObject)notification.getNotifier();
683     EClass eClass = object.eClass();
684     EStructuralFeature feature = (EStructuralFeature)notification.getFeature();
685
686     // Is this a containment reference child?
687
//
688
boolean child =
689       ExtendedMetaData.INSTANCE.getContentKind(eClass) != ExtendedMetaData.MIXED_CONTENT &&
690       feature instanceof EReference && ((EReference)feature).isContainment() &&
691       ExtendedMetaData.INSTANCE.getGroup(feature) == null;
692
693     // Or a feature map child?
694
//
695
child |=
696       feature instanceof EAttribute &&
697       ExtendedMetaData.INSTANCE.getGroup(feature) == null &&
698       feature.getEType().getInstanceClass() == FeatureMap.Entry.class &&
699       !feature.isDerived();
700
701     // Is this the label feature?
702
//
703
boolean label = feature == getLabelFeature(eClass);
704
705     fireNotifyChanged(new ViewerNotification(notification, object, child, !child || (child && label)));
706   }
707   
708   protected boolean isWrappingNeeded(Object JavaDoc object)
709   {
710     wrappingNeeded = null;
711     return super.isWrappingNeeded(object);
712   }
713 }
714
Popular Tags