@ SuppressWarnings ( "unlikely-arg-type" ) protected List < TopElementDescription > generateTopElements ( boolean forInterface , boolean forAppender ) { final Set < String > memberElements = determineMemberElements ( ) ; final Collection < EObject > topElementContainers = new ArrayList <> ( ) ; final List < TopElementDescription > topElements = new ArrayList <> ( ) ; for ( final CodeElementExtractor . ElementDescription description : getCodeElementExtractor ( ) . getTopElements ( getGrammar ( ) , getCodeBuilderConfig ( ) ) ) { final TopElementDescription topElementDescription = new TopElementDescription ( description , memberElements . contains ( description . getElementType ( ) . getName ( ) ) , getCodeBuilderConfig ( ) . isXtendSupportEnabled ( ) && description . isAnnotationInfo ( ) ) ; generateTopElement ( topElementDescription , forInterface , forAppender ) ; topElements . add ( topElementDescription ) ; topElementContainers . add ( topElementDescription . getElementDescription ( ) . getGrammarComponent ( ) ) ; } // Remove the top elements as members. for ( final TopElementDescription description : topElements ) { description . getNamedMembers ( ) . removeAll ( topElementContainers ) ; } return topElements ; }
Generate top elements from the grammar .