javax.lang.model.element.ModuleElement Java Examples
The following examples show how to use
javax.lang.model.element.ModuleElement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElementsTable.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void computeSpecifiedPackages() throws ToolException { computeSubpackages(); Set<PackageElement> packlist = new LinkedHashSet<>(); cmdLinePackages.forEach((modpkg) -> { PackageElement pkg; if (modpkg.hasModule()) { ModuleElement mdle = toolEnv.elements.getModuleElement(modpkg.moduleName); pkg = toolEnv.elements.getPackageElement(mdle, modpkg.packageName); } else { pkg = toolEnv.elements.getPackageElement(modpkg.toString()); } if (pkg != null) { packlist.add(pkg); } else { messager.printWarningUsingKey("main.package_not_found", modpkg.toString()); } }); specifiedPackageElements = Collections.unmodifiableSet(packlist); }
Example #2
Source File: ModuleInfoTreeAccess.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test public void testTreePathForModuleDecl(Path base) throws Exception { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { Path src = base.resolve("src"); tb.writeJavaFiles(src, "/** Test module */ module m1x {}"); Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src)); JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files); task.analyze(); JavacTrees trees = JavacTrees.instance(task); ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x"); TreePath path = trees.getPath(mdle); assertNotNull("path", path); ModuleElement mdle1 = (ModuleElement) trees.getElement(path); assertNotNull("mdle1", mdle1); DocCommentTree docCommentTree = trees.getDocCommentTree(mdle); assertNotNull("docCommentTree", docCommentTree); } }
Example #3
Source File: ElementOverlay.java From netbeans with Apache License 2.0 | 6 votes |
public Collection<? extends Element> getAllVisibleThrough(ASTService ast, Elements elements, String what, ClassTree tree, ModuleElement modle) { Collection<Element> result = new ArrayList<Element>(); Element current = what != null ? resolve(ast, elements, what, modle) : null; if (current == null) { //can happen if: //what == null: anonymous class //TODO: what != null: apparently happens for JDK (where the same class occurs twice on one source path) //might be possible to use ASTService.getElementImpl(tree) to thet the correct element //use only supertypes: //XXX: will probably not work correctly for newly created NCT (as the ClassTree does not have the correct extends/implements: for (String sup : superFQNs(tree)) { Element c = resolve(ast, elements, sup, modle); if (c != null) {//may legitimely be null, e.g. if the super type is not resolvable at all. result.add(c); } } } else { result.addAll(getAllMembers(ast, elements, current)); } return result; }
Example #4
Source File: ElementOverlay.java From netbeans with Apache License 2.0 | 6 votes |
public Element resolve(ASTService ast, Elements elements, String what, Element original, ModuleElement modle) { Element result = original; if (classes.containsKey(what)) { result = createElement(ast, elements, what, null, modle); } if (result == null) { result = modle != null ? elements.getTypeElement(modle, what) : elements.getTypeElement(what); } if (result == null) { result = modle != null ? elements.getPackageElement(modle, what) : elements.getPackageElement(what); } result = createElement(ast, elements, what, result, modle); return result; }
Example #5
Source File: ModulePackageIndexFrameWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns each package name as a separate link. * * @param pkg PackageElement * @param mdle the module being documented * @return content for the package link */ protected Content getPackage(PackageElement pkg, ModuleElement mdle) { Content packageLinkContent; Content pkgLabel; if (!pkg.isUnnamed()) { pkgLabel = getPackageLabel(utils.getPackageName(pkg)); packageLinkContent = getHyperLink(pathString(pkg, DocPaths.PACKAGE_FRAME), pkgLabel, "", "packageFrame"); } else { pkgLabel = new StringContent("<unnamed package>"); packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); } Content li = HtmlTree.LI(packageLinkContent); return li; }
Example #6
Source File: Utils.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public boolean isSpecified(Element e) { if (specifiedVisitor == null) { specifiedVisitor = new SimpleElementVisitor9<Boolean, Void>() { @Override public Boolean visitModule(ModuleElement e, Void p) { return configuration.getSpecifiedModuleElements().contains(e); } @Override public Boolean visitPackage(PackageElement e, Void p) { return configuration.getSpecifiedPackageElements().contains(e); } @Override public Boolean visitType(TypeElement e, Void p) { return configuration.getSpecifiedTypeElements().contains(e); } @Override protected Boolean defaultAction(Element e, Void p) { return false; } }; } return specifiedVisitor.visit(e); }
Example #7
Source File: ModuleTestBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
Set<Element> getAllSelectedElements(DocletEnvironment docenv) { Set<Element> result = new TreeSet<Element>((Element e1, Element e2) -> { // some grouping by kind preferred int rc = e1.getKind().compareTo(e2.getKind()); if (rc != 0) return rc; rc = e1.toString().compareTo(e2.toString()); if (rc != 0) return rc; return Integer.compare(e1.hashCode(), e2.hashCode()); }); Set<? extends Element> elements = docenv.getIncludedElements(); for (ModuleElement me : ElementFilter.modulesIn(elements)) { addEnclosedElements(docenv, result, me); } for (PackageElement pe : ElementFilter.packagesIn(elements)) { ModuleElement mdle = docenv.getElementUtils().getModuleOf(pe); if (mdle != null) addEnclosedElements(docenv, result, mdle); addEnclosedElements(docenv, result, pe); } for (TypeElement te : ElementFilter.typesIn(elements)) { addEnclosedElements(docenv, result, te); } return result; }
Example #8
Source File: ModuleWriterImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Add the list of modules. * * @param mdleMap map of modules and modifiers * @param tbody the content tree to which the list will be added */ public void addModulesList(Map<ModuleElement, Content> mdleMap, Content tbody) { boolean altColor = true; for (ModuleElement m : mdleMap.keySet()) { Content tdModifiers = HtmlTree.TD(HtmlStyle.colFirst, mdleMap.get(m)); Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName())); Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colSecond, moduleLinkContent); HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); tdSummary.addStyle(HtmlStyle.colLast); addSummaryComment(m, tdSummary); HtmlTree tr = HtmlTree.TR(tdModifiers); tr.addContent(thModule); tr.addContent(tdSummary); tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); tbody.addContent(tr); altColor = !altColor; } }
Example #9
Source File: ModuleInfoSupport.java From netbeans with Apache License 2.0 | 6 votes |
private static Set<String> getDeclaredModules(final JavaSource src) { Set<String> declaredModuleNames = new HashSet<>(); try { src.runUserActionTask((cc)-> { cc.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED); final List<? extends Tree> decls = cc.getCompilationUnit().getTypeDecls(); final ModuleElement me = !decls.isEmpty() && decls.get(0).getKind() == Tree.Kind.MODULE ? (ModuleElement) cc.getTrees().getElement(TreePath.getPath(cc.getCompilationUnit(), decls.get(0))) : null; if (me != null) { for (ModuleElement.Directive d : me.getDirectives()) { if (d.getKind() == ModuleElement.DirectiveKind.REQUIRES) { final ModuleElement.RequiresDirective reqD = (ModuleElement.RequiresDirective) d; final String name = reqD.getDependency().getQualifiedName().toString(); declaredModuleNames.add(name); } } } }, true); } catch (IOException ex) { LOG.log(Level.WARNING, null, ex); } log("Declared modules:", declaredModuleNames); // NOI18N return declaredModuleNames; }
Example #10
Source File: JavaParsingContext.java From netbeans with Apache License 2.0 | 6 votes |
public void analyze( @NonNull final Iterable<? extends CompilationUnitTree> trees, @NonNull final JavacTaskImpl jt, @NonNull final CompileTuple active, @NonNull final Set<? super ElementHandle<TypeElement>> newTypes, @NonNull final Set<? super ElementHandle<ModuleElement>> newModules, @NonNull /*@Out*/ final boolean[] mainMethod) throws IOException { final SourceAnalyzerFactory.StorableAnalyzer analyzer = getSourceAnalyzer(); assert analyzer != null; analyzer.analyse(trees, jt, active, newTypes, newModules, mainMethod); final Lookup pluginServices = getPluginServices(jt); for (CompilationUnitTree cu : trees) { for (JavaIndexerPlugin plugin : getPlugins()) { plugin.process(cu, active.indexable, pluginServices); } } }
Example #11
Source File: ModuleIndexFrameWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) { Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true, contents.modulesLabel); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(HtmlStyle.indexContainer, heading) : HtmlTree.DIV(HtmlStyle.indexContainer, heading); HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.setTitle(contents.modulesLabel); for (ModuleElement mdle: modules) { ul.addContent(getModuleLink(mdle)); } htmlTree.addContent(ul); body.addContent(htmlTree); }
Example #12
Source File: SourceAnalyzerFactory.java From netbeans with Apache License 2.0 | 6 votes |
public UsagesVisitor ( @NonNull final JavacTaskImpl jt, @NonNull final CompilationUnitTree cu, @NonNull final JavaFileManager manager, @NonNull final javax.tools.JavaFileObject sibling, @NullAllowed final Set<? super ElementHandle<TypeElement>> newTypes, @NullAllowed final Set<? super ElementHandle<ModuleElement>> newModules, final JavaCustomIndexer.CompileTuple tuple) throws MalformedURLException, IllegalArgumentException { this( jt, cu, inferBinaryName(manager, sibling), tuple.virtual ? tuple.indexable.getURL() : sibling.toUri().toURL(), true, tuple.virtual, newTypes, newModules, null); }
Example #13
Source File: HtmlDoclet.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override // defined by AbstractDoclet protected void generateModuleFiles() throws DocletException { if (configuration.showModules) { if (configuration.frames && configuration.modules.size() > 1) { ModuleIndexFrameWriter.generate(configuration); } ModuleElement prevModule = null, nextModule; List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); int i = 0; for (ModuleElement mdle : mdles) { if (configuration.frames && configuration.modules.size() > 1) { ModulePackageIndexFrameWriter.generate(configuration, mdle); ModuleFrameWriter.generate(configuration, mdle); } nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null; AbstractBuilder moduleSummaryBuilder = configuration.getBuilderFactory().getModuleSummaryBuilder( mdle, prevModule, nextModule); moduleSummaryBuilder.build(); prevModule = mdle; i++; } } }
Example #14
Source File: OpenAction.java From netbeans with Apache License 2.0 | 6 votes |
@NonNull public static Openable openable( @NonNull final ModuleElement module, @NonNull final ModuleElement.Directive directive, @NonNull final ClasspathInfo cpInfo) { final String displayName = module.getQualifiedName().toString(); final ElementHandle<ModuleElement> moduleHandle = ElementHandle.create(module); final Object[] directiveHandle = createDirectiveHandle(directive); return () -> { final FileObject source = SourceUtils.getFile(moduleHandle, cpInfo); if (source == null) { noSource(displayName); } TreePathHandle path = resolveDirectiveHandle(source, directiveHandle); if (path == null) { noSource(displayName); } if (!ElementOpen.open(source, path)) { noSource(displayName); } }; }
Example #15
Source File: ElementNode.java From netbeans with Apache License 2.0 | 6 votes |
private static int directivePosInKind(ModuleElement.DirectiveKind kind) { switch (kind) { case EXPORTS: return 0; case OPENS: return 1; case REQUIRES: return 2; case USES: return 3; case PROVIDES: return 4; default: return 100; } }
Example #16
Source File: ModuleFrameWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Generate a module type summary page for the left-hand bottom frame. * * @param configuration the current configuration of the doclet. * @param moduleElement The package for which "module_name-type-frame.html" is to be generated. * @throws DocFileIOException if there is a problem generating the module summary file */ public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) throws DocFileIOException { ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement); String mdlName = moduleElement.getQualifiedName().toString(); Content mdlLabel = new StringContent(mdlName); HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName)); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN() : body; Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); mdlgen.addClassListing(div); htmlTree.addContent(div); if (configuration.allowTag(HtmlTag.MAIN)) { body.addContent(htmlTree); } mdlgen.printHtmlDocument( configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body); }
Example #17
Source File: ModuleGraph.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public String toString(List<? extends DocTree> tags, Element element) { if (!enableModuleGraph) { return ""; } String moduleName = ((ModuleElement) element).getQualifiedName().toString(); String imageFile = moduleName + "-graph.png"; int thumbnailHeight = -1; String hoverImage = ""; if (!moduleName.equals("java.base")) { thumbnailHeight = 100; // also appears in the stylesheet hoverImage = "<span>" + getImage(moduleName, imageFile, -1, true) + "</span>"; } return "<dt>" + "<span class=\"simpleTagLabel\">Module Graph:</span>\n" + "</dt>" + "<dd>" + "<a class=moduleGraph href=\"" + imageFile + "\">" + getImage(moduleName, imageFile, thumbnailHeight, false) + hoverImage + "</a>" + "</dd>"; }
Example #18
Source File: CompileWorker.java From netbeans with Apache License 2.0 | 5 votes |
public static ParsingOutput success ( @NullAllowed final String moduleName, final Map<JavaFileObject, List<String>> file2FQNs, final Set<ElementHandle<TypeElement>> addedTypes, final Set<ElementHandle<ModuleElement>> addedModules, final Set<File> createdFiles, final Set<Indexable> finishedFiles, final Set<ElementHandle<TypeElement>> modifiedTypes, final Set<javax.tools.FileObject> aptGenerated) { return new ParsingOutput(true, false, moduleName, file2FQNs, addedTypes, addedModules, createdFiles, finishedFiles, modifiedTypes, aptGenerated); }
Example #19
Source File: TraverseProc.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
Set<ModuleElement> findModules0(ModuleElement m, Set<ModuleElement> set, int nesting) { set.add(m); for (ModuleElement.Directive dir : m.getDirectives()) { if (dir.getKind() == ModuleElement.DirectiveKind.REQUIRES) { ModuleElement.RequiresDirective req = (ModuleElement.RequiresDirective)dir; findModules0(req.getDependency(), set, nesting + 1); } } return set; }
Example #20
Source File: ElementUtils.java From netbeans with Apache License 2.0 | 5 votes |
public static TypeElement getTypeElementByBinaryName(JavacTask task, String name) { Set<? extends ModuleElement> allModules = task.getElements().getAllModuleElements(); Context ctx = ((JavacTaskImpl) task).getContext(); Symtab syms = Symtab.instance(ctx); if (allModules.isEmpty()) { return getTypeElementByBinaryName(task, syms.noModule, name); } TypeElement result = null; boolean foundInUnamedModule = false; for (ModuleElement me : allModules) { TypeElement found = getTypeElementByBinaryName(task, me, name); if (found != null) { if ((ModuleSymbol) me == syms.unnamedModule) { foundInUnamedModule = true; } if (result != null) { if (foundInUnamedModule == true) { for (TypeElement elem : new TypeElement[]{result, found}) { if ((elem.getKind() == ElementKind.CLASS || elem.getKind() == ElementKind.INTERFACE) && (((ClassSymbol) elem).packge().modle != syms.unnamedModule)) { return elem; } } } else { return null; } } result = found; } } return result; }
Example #21
Source File: ElementsTable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean haveModuleSources(ModuleElement mdle) throws ToolException { ModuleSymbol msym = (ModuleSymbol)mdle; if (msym.sourceLocation != null) { return true; } if (msym.patchLocation != null) { Boolean value = haveModuleSourcesCache.get(msym); if (value == null) { value = fmList(msym.patchLocation, "", sourceKinds, true).iterator().hasNext(); haveModuleSourcesCache.put(msym, value); } return value; } return false; }
Example #22
Source File: PackageWriterImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Content getPackageHeader(String heading) { HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement))); HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) ? HtmlTree.HEADER() : bodyTree; addTop(htmlTree); addNavLinks(true, htmlTree); if (configuration.allowTag(HtmlTag.HEADER)) { bodyTree.addContent(htmlTree); } HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.header); if (configuration.showModules) { ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement); Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel); Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel); moduleNameDiv.addContent(Contents.SPACE); moduleNameDiv.addContent(getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()))); div.addContent(moduleNameDiv); } Content annotationContent = new HtmlTree(HtmlTag.P); addAnnotationInfo(packageElement, annotationContent); div.addContent(annotationContent); Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, contents.packageLabel); tHeading.addContent(Contents.SPACE); Content packageHead = new StringContent(heading); tHeading.addContent(packageHead); div.addContent(tHeading); if (configuration.allowTag(HtmlTag.MAIN)) { mainTree.addContent(div); } else { bodyTree.addContent(div); } return bodyTree; }
Example #23
Source File: ElementScanningTask.java From netbeans with Apache License 2.0 | 5 votes |
@NonNull private String createHtmlHeader( @NonNull final CompilationInfo info, @NonNull final ModuleElement.Directive directive, final boolean fqn) { final StringBuilder sb = new StringBuilder(); switch (directive.getKind()) { case REQUIRES: sb.append(((ModuleElement.RequiresDirective)directive).getDependency().getQualifiedName()); break; case EXPORTS: sb.append(((ModuleElement.ExportsDirective)directive).getPackage().getQualifiedName()); break; case OPENS: sb.append(((ModuleElement.OpensDirective)directive).getPackage().getQualifiedName()); break; case USES: final TypeElement service = ((ModuleElement.UsesDirective)directive).getService(); sb.append((fqn ? service.getQualifiedName() : service.getSimpleName())); break; case PROVIDES: final TypeElement intf = ((ModuleElement.ProvidesDirective)directive).getService(); sb.append(fqn ? intf.getQualifiedName() : intf.getSimpleName()); break; default: throw new IllegalArgumentException(directive.toString()); } return sb.toString(); }
Example #24
Source File: HtmlDocWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) { DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle)); DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle)); DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle)); HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label); String onclickStr = "updateModuleFrame('" + mtFrameLink + "','" + cFrameLink + "');"; anchor.addAttr(HtmlAttr.TARGET, target); anchor.addAttr(HtmlAttr.ONCLICK, onclickStr); return anchor; }
Example #25
Source File: DependencyCalculator.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isJDK(final ModuleElement me, ClasspathInfo cpinfo) { for (FileObject root : cpinfo.getClassPath(ClasspathInfo.PathKind.BOOT).getRoots()) { if (root.getNameExt().contentEquals(me.getQualifiedName())) return true; } return false; }
Example #26
Source File: MetaKeywords.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Get the module keywords. * * @param mdle the module being documented */ public List<String> getMetaKeywordsForModule(ModuleElement mdle) { if (config.keywords) { return Arrays.asList(mdle.getQualifiedName() + " " + "module"); } else { return Collections.emptyList(); } }
Example #27
Source File: ModuleIndexFrameWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns each module name as a separate link. * * @param mdle the module being documented * @return content for the module link */ protected Content getModuleLink(ModuleElement mdle) { Content moduleLinkContent; Content mdlLabel = new StringContent(mdle.getQualifiedName()); moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame"); Content li = HtmlTree.LI(moduleLinkContent); return li; }
Example #28
Source File: ModuleClassPathsTest.java From netbeans with Apache License 2.0 | 5 votes |
private static Collection<URL> reads( @NonNull final ClassPath base, @NonNull final Predicate<ModuleElement> predicate, @NonNull final FileObject... additionalRoots) throws IOException { final ClasspathInfo info = new ClasspathInfo.Builder(base) .setModuleBootPath(base) .build(); final Set<String> moduleNames = new HashSet<>(); JavaSource.create(info).runUserActionTask((cc)-> { final Set<ModuleElement> rootModules = base.entries().stream() .map((e) -> SourceUtils.getModuleName(e.getURL())) .filter((n) -> n != null) .map(cc.getElements()::getModuleElement) .filter((m) -> m != null) .filter(predicate) .collect(Collectors.toSet()); for (ModuleElement rootModule : rootModules) { collectDeps(rootModule, moduleNames); } }, true); final List<URL> l = new ArrayList<>(); base.entries().stream() .map((e) -> e.getURL()) .filter((url) -> moduleNames.contains(SourceUtils.getModuleName(url))) .forEach(l::add); Arrays.stream(additionalRoots) .map((fo) -> fo.toURL()) .forEach(l::add); Collections.sort(l, LEX_COMPARATOR); return l; }
Example #29
Source File: ModuleIndexWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Adds module index contents. * * @param title the title of the section * @param tableSummary summary for the table * @param body the document tree to which the index contents will be added */ protected void addIndexContents(Collection<ModuleElement> modules, String title, String tableSummary, Content body) { HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmltree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); if (configuration.showModules) { addAllModulesLink(ul); } htmltree.addContent(ul); body.addContent(htmltree); addModulesList(modules, title, tableSummary, body); }
Example #30
Source File: GoToSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Void visitModule(ModuleElement e, Boolean highlightName) { result.append("module "); boldStartCheck(highlightName); result.append(e.getQualifiedName()); boldStopCheck(highlightName); return null; }