protected void _createChildren(IOutlineNode parentNode, JvmOperation inferredOperation) {
   List<XtendFunction> xtendFunctions =
       newArrayList(
           filter(associations.getSourceElements(inferredOperation), XtendFunction.class));
   sort(
       xtendFunctions,
       new Comparator<XtendFunction>() {
         public int compare(XtendFunction arg0, XtendFunction arg1) {
           return index(arg0) - index(arg1);
         }
       });
   for (XtendFunction xtendFunction : xtendFunctions) {
     if (xtendFunction.isDispatch()) createEObjectNode(parentNode, xtendFunction);
   }
 }
예제 #2
0
 protected void createFeatureNodesForType(
     IOutlineNode parentNode,
     XtendTypeDeclaration xtendType,
     JvmDeclaredType inferredType,
     final JvmDeclaredType baseType,
     Set<JvmFeature> processedFeatures,
     int inheritanceDepth) {
   if (xtendType instanceof XtendClass) {
     for (JvmOperation operation : inferredType.getDeclaredOperations()) {
       if (dispatchHelper.isDispatcherFunction(operation)) {
         JvmOperation dispatcher = operation;
         XtendFeatureNode dispatcherNode =
             createNodeForFeature(parentNode, baseType, dispatcher, dispatcher, inheritanceDepth);
         if (dispatcherNode != null) {
           dispatcherNode.setDispatch(true);
           processedFeatures.add(dispatcher);
           boolean inheritsDispatchCases = false;
           Iterable<JvmOperation> dispatchCases;
           if (getCurrentMode() == SHOW_INHERITED_MODE)
             dispatchCases = dispatchHelper.getAllDispatchCases(dispatcher);
           else {
             dispatchCases = newArrayList(dispatchHelper.getLocalDispatchCases(dispatcher));
             sort(
                 (List<JvmOperation>) dispatchCases,
                 new Comparator<JvmOperation>() {
                   public int compare(JvmOperation o1, JvmOperation o2) {
                     return baseType.getMembers().indexOf(o1) - baseType.getMembers().indexOf(o2);
                   }
                 });
           }
           for (JvmOperation dispatchCase : dispatchCases) {
             inheritsDispatchCases |= dispatchCase.getDeclaringType() != baseType;
             XtendFunction xtendFunction = associations.getXtendFunction(dispatchCase);
             if (xtendFunction == null) {
               createNodeForFeature(
                   dispatcherNode, baseType, dispatchCase, dispatchCase, inheritanceDepth);
             } else {
               createNodeForFeature(
                   dispatcherNode, baseType, dispatchCase, xtendFunction, inheritanceDepth);
             }
             processedFeatures.add(dispatchCase);
           }
           if (inheritsDispatchCases)
             dispatcherNode.setImageDescriptor(
                 images.forDispatcherFunction(
                     dispatcher.getVisibility(),
                     adornments.get(dispatcher) | JavaElementImageDescriptor.OVERRIDES));
         }
       }
     }
   }
   for (JvmFeature feature : filter(inferredType.getMembers(), JvmFeature.class)) {
     if (!processedFeatures.contains(feature)) {
       EObject primarySourceElement = associations.getPrimarySourceElement(feature);
       createNodeForFeature(
           parentNode,
           baseType,
           feature,
           primarySourceElement != null ? primarySourceElement : feature,
           inheritanceDepth);
     }
   }
   if (getCurrentMode() == SHOW_INHERITED_MODE) {
     if (inferredType instanceof JvmGenericType) {
       JvmTypeReference extendedClass = ((JvmGenericType) inferredType).getExtendedClass();
       if (extendedClass != null)
         createInheritedFeatureNodes(
             parentNode, baseType, processedFeatures, inheritanceDepth, extendedClass);
       for (JvmTypeReference extendedInterface :
           ((JvmGenericType) inferredType).getExtendedInterfaces()) {
         createInheritedFeatureNodes(
             parentNode, baseType, processedFeatures, inheritanceDepth, extendedInterface);
       }
     }
   }
 }