@Override protected void internalCreateChildren(DocumentRootNode parentNode, EObject modelElement) { if (modelElement instanceof XtendFile) { XtendFile xtendFile = (XtendFile) modelElement; if (xtendFile.getPackage() != null) factory.createEStructuralFeatureNode( parentNode, xtendFile, XtendPackage.Literals.XTEND_FILE__PACKAGE, images.forPackage(), xtendFile.getPackage(), true); if (xtendFile.getImportSection() != null && !xtendFile.getImportSection().getImportDeclarations().isEmpty()) factory.createEStructuralFeatureNode( parentNode, xtendFile.getImportSection(), XtypePackage.Literals.XIMPORT_SECTION__IMPORT_DECLARATIONS, images.forImportContainer(), "import declarations", false); for (XtendTypeDeclaration xtendType : xtendFile.getXtendTypes()) { EObjectNode classNode = createNode(parentNode, xtendType); createFeatureNodes(classNode, xtendType); } } }
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); } } } }