コード例 #1
0
 protected SignatureHashBuilder appendMemberSignatures(
     JvmDeclaredType type, boolean innerTypesOnly) {
   Iterable<? extends JvmMember> members = type.getMembers();
   if (innerTypesOnly) members = filter(members, JvmDeclaredType.class);
   for (JvmMember member : members) {
     if (member.getVisibility() != JvmVisibility.PRIVATE && member.getSimpleName() != null) {
       appendAnnotationReferences(member);
       if (member instanceof JvmOperation) appendSignature((JvmOperation) member);
       else if (member instanceof JvmConstructor) appendSignature((JvmConstructor) member);
       else if (member instanceof JvmField) appendSignature((JvmField) member);
       else if (member instanceof JvmDeclaredType) {
         append(member.getQualifiedName());
         appendMemberSignatures((JvmDeclaredType) member, true);
       }
       append("\n");
     }
   }
   return this;
 }
コード例 #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);
       }
     }
   }
 }