File reportIndex = new File(getHtmlLocation(), "index.html"); //$NON-NLS-1$ if (!reportIndex.exists()) { reportIndex.createNewFile(); setReportIndex(reportIndex); writeMetadataHeaders(buffer); buffer.append(OPEN_TITLE).append(getIndexTitle()).append(CLOSE_TITLE); buffer.append(CLOSE_HEAD); buffer.append(OPEN_BODY); buffer.append(OPEN_H3).append(getIndexTitle()).append(CLOSE_H3); try { getMetadata(); writeMetadataSummary(buffer); getFilteredCount(); writeFilterCount(buffer); } catch (Exception e) { if (hasMissing()) { buffer.append(OPEN_P); buffer.append(NLS.bind(SearchMessages.UseReportConverter_missing_bundles_prevented_scan, new String[] { useNotSearchedXml == false ? "<a href=\"./not_searched.html\">" : "<a href=\"../xml/not_searched.xml\">", //$NON-NLS-1$//$NON-NLS-2$ "</a></p>\n" }));//$NON-NLS-1$ String additional = getAdditionalIndexInfo(scanResult.size() > 0); if (additional != null) { buffer.append(additional); buffer.append(getColourLegend());
/** * Transforms the given set of xml files with the given XSLT and places the * result into a corresponding HTML file * * @param xmlfiles * @param xsltFile * @param html */ protected void tranformXml(File[] xmlfiles, File xsltFile) { File html = null; for (File xmlfile : xmlfiles) { try { File htmlroot = new File(getHtmlLocation(), getHTMLFileLocation(xmlfile)); if (!htmlroot.exists()) { htmlroot.mkdirs(); } html = new File(getNameFromXMLFilename(xmlfile)); applyXSLT(xsltFile, xmlfile, html); } catch (Exception e) { ApiPlugin.log(e); } } }
/** * Returns the HTML markup for one entry in the default references table. * Where the first column contains the linked item and the following five * columns are Version, API, Internal, Permissible, Fragment-Permissible * reference counts respectively * * @param counts * @param link * @param linktext * @param includeversion * @return a single reference table entry */ String getReferenceTableEntry(CountGroup counts, String link, String linktext, boolean includeversion) { StringBuilder buffer = new StringBuilder(); buffer.append("<tr bgcolor=\"").append(getRowColour(counts)).append("\">\n"); //$NON-NLS-1$//$NON-NLS-2$ buffer.append("\t<td><b><a href=\"").append(link).append("\">").append(getBundleOnlyName(linktext)).append("</a>").append(CLOSE_B).append(CLOSE_TD); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (includeversion) { buffer.append("\t<td align=\"left\">").append(getVersion(linktext)).append(CLOSE_TD); //$NON-NLS-1$ } buffer.append("\t<td align=\"center\">").append(counts.getTotalApiRefCount()).append(CLOSE_TD); //$NON-NLS-1$ buffer.append("\t<td align=\"center\">").append(counts.getTotalInternalRefCount()).append(CLOSE_TD); //$NON-NLS-1$ buffer.append("\t<td align=\"center\">").append(counts.getTotalPermissableRefCount()).append(CLOSE_TD); //$NON-NLS-1$ buffer.append("\t<td align=\"center\">").append(counts.getTotalFragmentPermissibleRefCount()).append(CLOSE_TD); //$NON-NLS-1$ buffer.append("\t<td align=\"center\">").append(counts.getTotalIllegalRefCount()).append(CLOSE_TD); //$NON-NLS-1$ buffer.append(CLOSE_TR); return buffer.toString(); }
originhtml.createNewFile(); File xml = new File(getReportsRoot(), filename + XML_EXTENSION); if (!xml.exists()) { xml = new File(getReportsRoot() + File.separator + "xml", filename + XML_EXTENSION); //$NON-NLS-1$ defaultXsltInputStream = UseReportConverter.class.getResourceAsStream(getNotSearchedXSLPath()); Source xslt = null; if (defaultXsltInputStream != null) { applyXSLT(xslt, xml, originhtml); } catch (TransformerException e) { useNotSearchedXml = true;
converter = new ConsumerReportConvertor(hlocation, rlocation, topatterns, frompatterns); } else { converter = new UseReportConverter(hlocation, rlocation, topatterns, frompatterns); converter.convert(null, localmonitor.split(5)); if (openhtml) { final File index = converter.getReportIndex(); if (index != null) { UIJob ujob = new UIJob(Util.EMPTY_STRING) {
File originhtml = null; try { File htmlroot = new File(getHtmlLocation(), report.name); if (!htmlroot.exists()) { htmlroot.mkdirs(); buffer.append(REF_STYLE); buffer.append(REF_SCRIPT); buffer.append(OPEN_TITLE).append(getReferencedTypeTitle(report.name)).append(CLOSE_TITLE); buffer.append(CLOSE_HEAD); buffer.append(OPEN_BODY); buffer.append(OPEN_H3).append(getReferencedTypeTitle(report.name)).append(CLOSE_H3); buffer.append(OPEN_P).append(NLS.bind(SearchMessages.UseReportConverter_list_of_all_refing_bundles, new String[] { "<a href=\"#bundles\">", "</a>" })).append(CLOSE_P); //$NON-NLS-1$ //$NON-NLS-2$ String additional = getAdditionalReferencedTypeInformation(); if (additional != null) { buffer.append(additional); buffer.append(getReferencesTableHeader(SearchMessages.UseReportConverter_references, SearchMessages.UseReportConverter_referenced_type, false)); CountGroup counts = null; String link = null; link = extractLinkFrom(htmlroot, typefile.getAbsolutePath()); buffer.append(getReferenceTableEntry(counts, link, fqname, false)); writeTypePage(map, type, typefile, fqname); type = referees.get(i); comp = (IComponentDescriptor) type.desc; buffer.append("<tr bgcolor=\"").append(getRowColour(counts)).append("\">\n"); //$NON-NLS-1$//$NON-NLS-2$
/** * Applies the given XSLT to the given XML to produce HTML in the given file * * @param xsltfile * @param xmlfile * @param htmloutput * @throws TransformerException */ protected void applyXSLT(File xsltFile, File xmlfile, File htmloutput) throws TransformerException, Exception { Source xslt = null; if (xsltFile != null) { xslt = new StreamSource(xsltFile); } else { InputStream defaultXsltInputStream = UseReportConverter.class.getResourceAsStream(DEFAULT_XSLT); if (defaultXsltInputStream != null) { xslt = new StreamSource(new BufferedInputStream(defaultXsltInputStream)); } } if (xslt == null) { throw new Exception(SearchMessages.UseReportConverter_no_xstl_specified); } applyXSLT(xslt, xmlfile, htmloutput); }
@Override public boolean visitComponent(IComponentDescriptor target) { this.currentreport = new Report(); this.currentreport.name = composeName(target.getId(), target.getVersion()); this.reports.add(this.currentreport); return true; }
converter = new ConsumerReportConvertor(hlocation, rlocation, topatterns, frompatterns); } else { converter = new UseReportConverter(hlocation, rlocation, topatterns, frompatterns); converter.convert(null, localmonitor.newChild(5)); if(openhtml) { final File index = converter.getReportIndex(); if(index != null) { UIJob ujob = new UIJob(Util.EMPTY_STRING){