private void printImports(CompilationUnit node) { ImplementationImportCollector collector = new ImplementationImportCollector(); collector.collect(node, getSourceFileName()); Set<Import> imports = collector.getImports(); if (!imports.isEmpty()) { Set<String> includeStmts = Sets.newTreeSet(); for (Import imp : imports) { includeStmts.add(String.format("#include \"%s.h\"", imp.getImportFileName())); } for (String stmt : includeStmts) { println(stmt); } // Print native includes. int endOfImportText = node.types().isEmpty() ? node.getLength() : ((ASTNode) node.types().get(0)).getStartPosition(); for (Comment c : ASTUtil.getCommentList(node)) { int start = c.getStartPosition(); if (start >= endOfImportText) { break; } if (c instanceof BlockComment) { String nativeImport = extractNativeCode(start, c.getLength(), true); if (nativeImport != null) { // if it has a JSNI section println(nativeImport.trim()); } } } newline(); } }
public boolean visit(CompilationUnit node) { if (fShowCU) push(JavaNode.CU, null, node.getStartPosition(), node.getLength()); return true; }