org.eclipse.pde.api.tools_1.0.301.v20111129-2053

      //   start	length	slot	name	signature
      //   0	588	0	this	MissingRefVisitor
      //   0	588	1	report	MissingRefReportConverter.Report
      //   1	583	2	writer	java.io.PrintWriter
      //   3	553	3	originhtml	File
      //   22	21	4	htmlroot	File
      //   69	464	5	buffer	StringBuffer
      //   197	195	6	typeProblems	StringBuffer
      //   206	209	7	methodProblems	StringBuffer
      //   215	223	8	fieldProblems	StringBuffer
      //   218	50	9	entry	Map.Entry
      //   221	59	10	key	Integer
      //   224	122	11	types	TreeMap
      //   238	117	12	iterator	Iterator
      //   566	11	13	localObject	Object
      //   547	1	14	localIOException	java.io.IOException
      // Exception table:
      //   from	to	target	type
      //   4	544	547	java/io/IOException
      //   4	566	566	finally
    }
    
    private StringBuffer getProblemRow(StringBuffer type, String header)
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("<tr>\n");
      buffer.append("<td align=\"left\">\n");
      buffer.append("<b>");
      buffer.append("<a href=\"javascript:void(0)\" class=\"typeslnk\" onclick=\"expand(this)\" title=\"");
      buffer.append(header).append("\">\n");
      buffer.append("<span>[+] </span>").append(header).append("\n");
      buffer.append("</a>\n").append("</b>");
      buffer.append("<div colspan=\"6\" class=\"types\">\n");
      buffer.append(type).append("\n");
      buffer.append("</div>\n");
      buffer.append("</tr>\n");
      return buffer;
    }
    
    private StringBuffer getProblemTable(TreeMap types)
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"6\">\n");
      Map.Entry entry = null;
      String tname = null;
      ArrayList pbs = null;
      Iterator i2;
      for (Iterator i = types.entrySet().iterator(); i.hasNext(); i2.hasNext())
      {
        entry = (Map.Entry)i.next();
        tname = (String)entry.getKey();
        pbs = (ArrayList)entry.getValue();
        buffer.append("<tr align=\"left\"> \n");
        buffer.append("<td colspan=\"1\" bgcolor=\"#CCCCCC\">").append("<b>").append(tname).append("</b>").append("</td>\n");
        buffer.append("</tr>\n");
        ApiProblem pb = null;
        Collections.sort(pbs, MissingRefReportConverter.compare);
        i2 = pbs.iterator(); continue;
        pb = (ApiProblem)i2.next();
        buffer.append("<tr>\n");
        buffer.append("<td align=\"left\" width=\"75%\">").append(pb.getMessage()).append("</td>\n");
        buffer.append("</tr>\n");
      }
      buffer.append("</table>\n");
      return buffer;
    }
    
    private Object getProblemSummary(MissingRefReportConverter.Report report)
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("<h4>").append(SearchMessages.MissingRefReportConverter_Summary).append("</h4>\n");
      buffer.append("<p>").append(NLS.bind(SearchMessages.MissingRefReportConverter_SummaryDesc, new String[] { name, Integer.toString(apiProblems.size()) })).append("</p>\n");
      return buffer.toString();
    }
    
    String getProblemsTableHeader(String sectionname, String type)
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("<h4>").append(sectionname).append("</h4>\n");
      buffer.append("<p>").append(SearchMessages.MissingRefReportConverter_ProblemTableHeader).append("</p>\n");
      buffer.append("<div align=\"left\" class=\"main\">");
      buffer.append("<table border=\"1\" width=\"80%\">\n");
      
      buffer.append("<tr>\n");
      buffer.append("<td bgcolor=\"").append("#E0C040").append("\">").append("<b>").append(type).append("</b></td>\n");
      buffer.append("</tr>\n");
      
      return buffer.toString();
    }
    
    protected String getProblemTitle(String bundle)
    {
      return NLS.bind(SearchMessages.MissingRefReportConverter_ProblemTitle, bundle);
    }
    
    public void addToCurrentReport(List apiProblems)
    {
      currentreport.add(apiProblems);
    }
  }
  
  private String xmlLocation = null;
  private String htmlLocation = null;
  private File reportsRoot = null;
  private File htmlIndex = null;
  Report currentreport = null;
  static final Comparator compare = new Comparator()
  {
    public int compare(Object o1, Object o2)
    {
      if (((o1 instanceof String)) && ((o2 instanceof String))) {
        return ((String)o1).compareTo((String)o2);
      }
      if (((o1 instanceof ApiProblem)) && ((o2 instanceof ApiProblem))) {
        return ((ApiProblem)o1).getMessage().compareTo(((ApiProblem)o2).getMessage());
      }
      return 0;
    }
  };
  
  static class Report
  {
    String name = null;
    TreeMap apiProblems = new TreeMap();
    int typeProblems = 0;
    int methodProblems = 0;
    int fieldProblems = 0;
    
    public void add(List apiProblems)
    {
      ApiProblem pb = null;
      ArrayList list = null;
      TreeMap types = null;
      for (Iterator i = apiProblems.iterator(); i.hasNext();)
      {
        pb = (ApiProblem)i.next();
        Integer key = new Integer(pb.getKind());
        types = (TreeMap)this.apiProblems.get(key);
        if (types == null)
        {
          types = new TreeMap(MissingRefReportConverter.compare);
          this.apiProblems.put(key, types);
        }
        String tname = pb.getTypeName();
        list = (ArrayList)types.get(tname);
        if (list == null)
        {
          list = new ArrayList();
          types.put(tname, list);
        }
        list.add(pb);
        switch (pb.getKind())
        {
        case 1: 
          typeProblems += 1;
          break;
        case 2: 
          methodProblems += 1;
          break;
        case 3: 
          fieldProblems += 1;
        }
      }
    }
    
    public int getTotal()
    {
      return typeProblems + methodProblems + fieldProblems;
    }
  }
  
  public MissingRefReportConverter(String htmlroot, String xmlroot)
  {
    super(htmlroot, xmlroot, null, null);
    xmlLocation = xmlroot;
    htmlLocation = htmlroot;
  }
  
  public void convert(String xslt, IProgressMonitor monitor)
    throws Exception
  {
    File htmlRoot = new File(htmlLocation);
    if (!htmlRoot.exists())
    {
      if (!htmlRoot.mkdirs()) {
        throw new Exception(NLS.bind(SearchMessages.could_not_create_file, htmlLocation));
      }
    }
    else {
      htmlRoot.mkdirs();
    }
    File reportsRoot = getReportsRoot();
    if ((!reportsRoot.exists()) || (!reportsRoot.isDirectory())) {
      throw new Exception(NLS.bind(SearchMessages.invalid_directory_name, xmlLocation));
    }
    long start = 0L;
    if (DEBUG) {
      start = System.currentTimeMillis();
    }
    writeNotSearchedPage(htmlRoot);
    if (DEBUG)
    {
      System.out.println("done in: " + (System.currentTimeMillis() - start) + " ms");
      System.out.println("Parsing use scan...");
      start = System.currentTimeMillis();
    }
    List result = parse();
    if (DEBUG)
    {
      System.out.println("done in: " + (System.currentTimeMillis() - start) + " ms");
      System.out.println("Sorting reports and writing index...");
      start = System.currentTimeMillis();
    }
    writeIndexPage(result);
  }
  
  /* Error */
  void writeIndexPage(List result)
    throws Exception
  {
    // Byte code:
    //   0: aload_1
    //   1: new 257	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter$2
    //   4: dup
    //   5: aload_0
    //   6: invokespecial 508	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter$2:<init>	(Lorg/eclipse/pde/api/tools/internal/search/MissingRefReportConverter;)V
    //   9: invokestatic 479	java/util/Collections:sort	(Ljava/util/List;Ljava/util/Comparator;)V
    //   12: aconst_null
    //   13: astore_2
    //   14: new 239	java/io/File
    //   17: dup
    //   18: aload_0
    //   19: invokevirtual 492	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getHtmlLocation	()Ljava/lang/String;
    //   22: ldc 20
    //   24: invokespecial 460	java/io/File:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   27: astore_3
    //   28: aload_3
    //   29: invokevirtual 454	java/io/File:exists	()Z
    //   32: ifne +8 -> 40
    //   35: aload_3
    //   36: invokevirtual 453	java/io/File:createNewFile	()Z
    //   39: pop
    //   40: new 247	java/lang/StringBuffer
    //   43: dup
    //   44: invokespecial 470	java/lang/StringBuffer:<init>	()V
    //   47: astore 4
    //   49: aload 4
    //   51: ldc 2
    //   53: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   56: pop
    //   57: aload 4
    //   59: ldc 13
    //   61: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   64: ldc 12
    //   66: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   69: ldc 14
    //   71: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   74: pop
    //   75: aload_0
    //   76: aload 4
    //   78: invokevirtual 498	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:writeMetadataHeaders	(Ljava/lang/StringBuffer;)V
    //   81: aload 4
    //   83: ldc 16
    //   85: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   88: aload_0
    //   89: invokevirtual 493	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getIndexTitle	()Ljava/lang/String;
    //   92: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   95: ldc 7
    //   97: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   100: pop
    //   101: aload 4
    //   103: ldc 6
    //   105: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   108: pop
    //   109: aload 4
    //   111: ldc 9
    //   113: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   116: pop
    //   117: aload 4
    //   119: ldc 10
    //   121: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   124: aload_0
    //   125: invokevirtual 493	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getIndexTitle	()Ljava/lang/String;
    //   128: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   131: ldc 4
    //   133: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   136: pop
    //   137: aload_0
    //   138: aload 4
    //   140: invokevirtual 499	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:writeMetadataSummary	(Ljava/lang/StringBuffer;)V
    //   143: aload 4
    //   145: ldc 11
    //   147: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   150: getstatic 424	org/eclipse/pde/api/tools/internal/search/SearchMessages:MissingRefReportConverter_AddlBundleInfo	Ljava/lang/String;
    //   153: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   156: ldc 5
    //   158: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   161: pop
    //   162: aload 4
    //   164: ldc 15
    //   166: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   169: pop
    //   170: aload 4
    //   172: getstatic 430	org/eclipse/pde/api/tools/internal/search/SearchMessages:MissingRefReportConverter_NotSearched	Ljava/lang/String;
    //   175: iconst_2
    //   176: anewarray 246	java/lang/String
    //   179: dup
    //   180: iconst_0
    //   181: ldc 8
    //   183: aastore
    //   184: dup
    //   185: iconst_1
    //   186: ldc 3
    //   188: aastore
    //   189: invokestatic 481	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   192: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   195: pop
    //   196: aload_1
    //   197: invokeinterface 514 1 0
    //   202: ifle +146 -> 348
    //   205: aload 4
    //   207: aload_0
    //   208: invokespecial 497	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getProblemSummaryTable	()Ljava/lang/StringBuffer;
    //   211: invokevirtual 477	java/lang/StringBuffer:append	(Ljava/lang/StringBuffer;)Ljava/lang/StringBuffer;
    //   214: pop
    //   215: aload_1
    //   216: invokeinterface 514 1 0
    //   221: ifle +137 -> 358
    //   224: aconst_null
    //   225: astore 5
    //   227: aload_1
    //   228: invokeinterface 515 1 0
    //   233: astore 6
    //   235: goto +91 -> 326
    //   238: aload 6
    //   240: invokeinterface 513 1 0
    //   245: checkcast 259	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter$Report
    //   248: astore 5
    //   250: aload 5
    //   252: ifnull +74 -> 326
    //   255: new 239	java/io/File
    //   258: dup
    //   259: aload_0
    //   260: invokevirtual 490	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getReportsRoot	()Ljava/io/File;
    //   263: new 247	java/lang/StringBuffer
    //   266: dup
    //   267: aload 5
    //   269: getfield 423	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter$Report:name	Ljava/lang/String;
    //   272: invokestatic 469	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   275: invokespecial 472	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   278: getstatic 410	java/io/File:separator	Ljava/lang/String;
    //   281: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   284: ldc 20
    //   286: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   289: invokevirtual 471	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   292: invokespecial 459	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   295: astore 7
    //   297: aload_0
    //   298: aload_0
    //   299: invokevirtual 490	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getReportsRoot	()Ljava/io/File;
    //   302: aload 7
    //   304: invokevirtual 457	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   307: invokevirtual 506	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:extractLinkFrom	(Ljava/io/File;Ljava/lang/String;)Ljava/lang/String;
    //   310: astore 8
    //   312: aload 4
    //   314: aload_0
    //   315: aload 5
    //   317: aload 8
    //   319: invokespecial 505	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getReferenceTableEntry	(Lorg/eclipse/pde/api/tools/internal/search/MissingRefReportConverter$Report;Ljava/lang/String;)Ljava/lang/Object;
    //   322: invokevirtual 475	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   325: pop
    //   326: aload 6
    //   328: invokeinterface 512 1 0
    //   333: ifne -95 -> 238
    //   336: aload 4
    //   338: ldc_w 224
    //   341: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   344: pop
    //   345: goto +13 -> 358
    //   348: aload 4
    //   350: aload_0
    //   351: invokevirtual 494	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getNoReportsInformation	()Ljava/lang/String;
    //   354: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   357: pop
    //   358: aload 4
    //   360: ldc_w 230
    //   363: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   366: pop
    //   367: aload 4
    //   369: ldc_w 221
    //   372: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   375: ldc_w 222
    //   378: invokevirtual 476	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   381: pop
    //   382: new 244	java/io/PrintWriter
    //   385: dup
    //   386: new 242	java/io/OutputStreamWriter
    //   389: dup
    //   390: new 240	java/io/FileOutputStream
    //   393: dup
    //   394: aload_3
    //   395: invokespecial 461	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   398: ldc_w 235
    //   401: invokespecial 462	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;Ljava/lang/String;)V
    //   404: invokespecial 466	java/io/PrintWriter:<init>	(Ljava/io/Writer;)V
    //   407: astore_2
    //   408: aload_2
    //   409: aload 4
    //   411: invokevirtual 471	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   414: invokevirtual 467	java/io/PrintWriter:print	(Ljava/lang/String;)V
    //   417: aload_2
    //   418: invokevirtual 465	java/io/PrintWriter:flush	()V
    //   421: goto +38 -> 459
    //   424: pop
    //   425: new 245	java/lang/Exception
    //   428: dup
    //   429: getstatic 451	org/eclipse/pde/api/tools/internal/search/SearchMessages:ioexception_writing_html_file	Ljava/lang/String;
    //   432: aload_0
    //   433: invokevirtual 489	org/eclipse/pde/api/tools/internal/search/MissingRefReportConverter:getReportIndex	()Ljava/io/File;
    //   436: invokevirtual 457	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   439: invokestatic 480	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   442: invokespecial 468	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   445: athrow
    //   446: astore 9
    //   448: aload_2
    //   449: ifnull +7 -> 456
    //   452: aload_2
    //   453: invokevirtual 464	java/io/PrintWriter:close	()V
    //   456: aload 9
    //   458: athrow
    //   459: aload_2
    //   460: ifnull +7 -> 467
    //   463: aload_2
    //   464: invokevirtual 464	java/io/PrintWriter:close	()V
    //   467: return
    // Line number table:
    //   Java source line #350	-> byte code offset #0
    //   Java source line #356	-> byte code offset #12
    //   Java source line #358	-> byte code offset #14
    //   Java source line #359	-> byte code offset #28
    //   Java source line #360	-> byte code offset #35
    //   Java source line #364	-> byte code offset #40
    //   Java source line #365	-> byte code offset #49
    //   Java source line #366	-> byte code offset #57
    //   Java source line #367	-> byte code offset #75
    //   Java source line #368	-> byte code offset #81
    //   Java source line #369	-> byte code offset #101
    //   Java source line #370	-> byte code offset #109
    //   Java source line #371	-> byte code offset #117
    //   Java source line #373	-> byte code offset #137
    //   Java source line #375	-> byte code offset #143
    //   Java source line #382	-> byte code offset #162
    //   Java source line #383	-> byte code offset #170
    //   Java source line #384	-> byte code offset #196
    //   Java source line #385	-> byte code offset #205
    //   Java source line #386	-> byte code offset #215
    //   Java source line #387	-> byte code offset #224
    //   Java source line #388	-> byte code offset #227
    //   Java source line #389	-> byte code offset #238
    //   Java source line #390	-> byte code offset #250
    //   Java source line #391	-> byte code offset #255
    //   Java source line #392	-> byte code offset #297
    //   Java source line #393	-> byte code offset #312
    //   Java source line #388	-> byte code offset #326
    //   Java source line #396	-> byte code offset #336
    //   Java source line #399	-> byte code offset #348
    //   Java source line #401	-> byte code offset #358
    //   Java source line #402	-> byte code offset #367
    //   Java source line #405	-> byte code offset #382
    //   Java source line #406	-> byte code offset #408
    //   Java source line #407	-> byte code offset #417
    //   Java source line #408	-> byte code offset #424
    //   Java source line #409	-> byte code offset #425
    //   Java source line #410	-> byte code offset #446
    //   Java source line #411	-> byte code offset #448
    //   Java source line #412	-> byte code offset #452
    //   Java source line #414	-> byte code offset #456
    //   Java source line #411	-> byte code offset #459
    //   Java source line #412	-> byte code offset #463
    //   Java source line #415	-> byte code offset #467
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	468	0	this	MissingRefReportConverter
    //   0	468	1	result	List
    //   13	451	2	writer	java.io.PrintWriter
    //   27	368	3	reportIndex	File
    //   47	363	4	buffer	StringBuffer
    //   225	91	5	report	Report
    //   233	94	6	iter	Iterator
    //   295	8	7	refereehtml	File
    //   310	8	8	link	String
    //   446	11	9	localObject	Object
    //   424	1	10	localIOException	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   14	421	424	java/io/IOException
    //   14	446	446	finally
  }
  
  protected String getNoReportsInformation()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<p>").append("<br>").append(SearchMessages.no_use_scan_ref_problems).append("</p>\n");
    return buffer.toString();
  }
  
  private Object getReferenceTableEntry(Report report, String link)
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<tr>\n");
    buffer.append("<td><b><a href=\"").append(link).append("\">").append(getBundleOnlyName(name)).append("</a>").append("</b>").append("</td>\n");
    buffer.append("\t<td align=\"left\">").append(getVersion(name)).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(typeProblems).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(methodProblems).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(fieldProblems).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(report.getTotal()).append("</td>\n");
    buffer.append("</tr>\n");
    return buffer.toString();
  }
  
  private StringBuffer getProblemSummaryTable()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<h4>").append(SearchMessages.MissingRefReportConverter_ProblemSummaryTitle).append("</h4>\n");
    buffer.append("<p>").append(SearchMessages.MissingRefReportConverter_ProblemSummary).append("</p>\n");
    buffer.append("<table border=\"1\" width=\"80%\">\n");
    buffer.append("<tr>\n");
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" width=\"25%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnBundleTooltip).append("\"\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnBundle).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"15%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnVersionTooltip).append("\"\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnVersion).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"15%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingTypesTooltip).append("\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingTypes).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"15%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingMethodsTooltip).append("\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingMethods).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"15%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingFieldsTooltip).append("\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnMissingFields).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"15%\" title=\"");
    buffer.append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnTotalTooltip).append("\">");
    buffer.append("<b>").append(SearchMessages.MissingRefReportConverter_ProblemTable_ColumnTotal).append("</b>").append("</td>\n");
    return buffer;
  }
  
  void writeMetadataSummary(StringBuffer buffer)
    throws Exception
  {
    MissingRefMetadata metadata = (MissingRefMetadata)getMetadata();
    buffer.append("<h4>").append(SearchMessages.MissingRefReportConverter_MetadataTitle).append("</h4>\n");
    buffer.append("<table border=\"0px\" title=\"").append(SearchMessages.MissingRefReportConverter_MetadataTableTitle).append("\"width=\"50%\">");
    
    buffer.append("<tr>\n");
    buffer.append(openTD(14)).append(SearchMessages.MissingRefReportConverter_ReportDate).append("</td>\n");
    buffer.append(openTD(36)).append(metadata.getRunAtDate()).append("</td>\n");
    buffer.append("</tr>\n");
    
    buffer.append("<tr>\n");
    buffer.append(openTD(14)).append(SearchMessages.MissingRefReportConverter_ProfileLocation).append("</td>\n");
    String value = metadata.getProfile();
    buffer.append(openTD(36)).append(value != null ? value : SearchMessages.MissingRefReportConverter_NONE).append("</td>\n");
    buffer.append("</tr>\n");
    
    buffer.append("<tr>\n");
    buffer.append(openTD(14)).append(SearchMessages.MissingRefReportConverter_ReportLocation).append("</td>\n");
    value = metadata.getReportLocation();
    buffer.append(openTD(36)).append(value != null ? value : SearchMessages.MissingRefReportConverter_NONE).append("</td>\n");
    buffer.append("</tr>\n");
    
    buffer.append("<tr>\n");
    buffer.append(openTD(14)).append(SearchMessages.MissingRefReportConverter_ApiUseScanLocations).append("</td>\n");
    value = metadata.getApiUseScans();
    buffer.append(openTD(36)).append(value != null ? value : SearchMessages.MissingRefReportConverter_NONE).append("</td>\n");
    buffer.append("</tr>\n");
    
    buffer.append("</td>\n");
    buffer.append("</tr>\n");
    buffer.append("</table>\n");
  }
  
  IMetadata getMetadata()
    throws Exception
  {
    File xmlFile = new File(getReportsRoot(), "meta.xml");
    if (!xmlFile.exists()) {
      xmlFile = new File(getReportsRoot() + File.separator + "xml", "meta.xml");
    }
    return MissingRefMetadata.getMetadata(xmlFile);
  }
  
  protected String getIndexTitle()
  {
    return SearchMessages.MissingRefReportConverter_ReportTitle;
  }
  
  protected void writeMetadataHeaders(StringBuffer buffer)
  {
    buffer.append("<meta name=\"").append("description").append("\" content=\"").append(SearchMessages.MissingRefReportConverter_IndexMetaTag).append("\">");
  }
  
  protected List parse()
    throws Exception
  {
    MissingRefParser parser = new MissingRefParser();
    MissingRefVisitor visitor = new MissingRefVisitor();
    parser.parse(getXmlLocation(), visitor);
    return reports;
  }
  
  protected String getHtmlLocation()
  {
    return htmlLocation;
  }
  
  protected String getXmlLocation()
  {
    return xmlLocation;
  }
  
  protected File getReportsRoot()
  {
    if (reportsRoot == null) {
      reportsRoot = new File(getXmlLocation());
    }
    return reportsRoot;
  }
  
  public File getReportIndex()
  {
    if (htmlIndex == null) {
      return new File(htmlLocation);
    }
    return htmlIndex;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.search.MissingRefReportConverter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.search;

import org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMemberDescriptor;

public class ReferenceDescriptor
  implements IReferenceDescriptor
{
  private IMemberDescriptor origin;
  private IMemberDescriptor target;
  private IComponentDescriptor from;
  private IComponentDescriptor to;
  private int line;
  private int kind;
  private int flags;
  private int visibility;
  private String[] messages = null;
  
  public ReferenceDescriptor(IComponentDescriptor from, IMemberDescriptor origin, int line, IComponentDescriptor to, IMemberDescriptor target, int kind, int flags, int vis, String[] messages)
  {
    this.origin = origin;
    this.target = target;
    this.from = from;
    this.to = to;
    this.line = line;
    this.kind = kind;
    this.flags = flags;
    visibility = vis;
    this.messages = messages;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof ReferenceDescriptor))
    {
      ReferenceDescriptor rd = (ReferenceDescriptor)obj;
      
      return (origin.equals(origin)) && (target.equals(target)) && (from.equals(from)) && (to.equals(to)) && (line == line) && (kind == kind) && (visibility == visibility);
    }
    return false;
  }
  
  public int hashCode()
  {
    return origin.hashCode() + target.hashCode() + from.hashCode() + to.hashCode() + line + kind + visibility;
  }
  
  public IComponentDescriptor getComponent()
  {
    return from;
  }
  
  public int getLineNumber()
  {
    return line;
  }
  
  public IMemberDescriptor getMember()
  {
    return origin;
  }
  
  public int getReferenceKind()
  {
    return kind;
  }
  
  public int getReferenceFlags()
  {
    return flags;
  }
  
  public int getReferenceType()
  {
    switch (getReferencedMember().getElementType())
    {
    case 2: 
      return 1;
    case 6: 
      return 3;
    case 5: 
      return 2;
    }
    return -1;
  }
  
  public IComponentDescriptor getReferencedComponent()
  {
    return to;
  }
  
  public IMemberDescriptor getReferencedMember()
  {
    return target;
  }
  
  public int getVisibility()
  {
    return visibility;
  }
  
  public String[] getProblemMessages()
  {
    return messages;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.search.ReferenceDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.search;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.api.tools.internal.builder.Reference;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.Factory;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMemberDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMethodDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IPackageDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiMember;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiType;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
import org.eclipse.pde.api.tools.internal.util.FilteredElements;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class ReferenceLookupVisitor
  extends UseScanVisitor
{
  private IApiBaseline baseline;
  private IComponentDescriptor targetComponent;
  private IComponentDescriptor referencingComponent;
  private IApiComponent currComponent;
  private boolean skipped = false;
  private IMemberDescriptor targetMember;
  private IReferenceTypeDescriptor targetType;
  private IApiType currType;
  private List missingComponents = new ArrayList();
  private List skippedComponents = new ArrayList();
  private String location;
  private List unresolved = null;
  private String analysisScope = null;
  private String targetScope = null;
  private FilteredElements excludedElements = null;
  private FilteredElements includedElements = null;
  
  public ReferenceLookupVisitor(IApiBaseline base, String xmlLocation)
  {
    baseline = base;
    location = xmlLocation;
  }
  
  public boolean visitComponent(IComponentDescriptor target)
  {
    unresolved = new ArrayList();
    targetComponent = target;
    skipped = false;
    String id = targetComponent.getId();
    if ((includedElements != null) && (!includedElements.isEmpty()) && 
      (!includedElements.containsExactMatch(id)) && (!includedElements.containsPartialMatch(id)))
    {
      skipped = true;
      return false;
    }
    if ((excludedElements != null) && ((excludedElements.containsExactMatch(id)) || (excludedElements.containsPartialMatch(id))))
    {
      skipped = true;
      return false;
    }
    if ((targetScope == null) || (id.matches(targetScope)))
    {
      currComponent = baseline.getApiComponent(id);
      return true;
    }
    skipped = true;
    return false;
  }
  
  public boolean visitReferencingComponent(IComponentDescriptor component)
  {
    referencingComponent = component;
    if (currComponent == null) {
      return false;
    }
    if ((analysisScope == null) || (component.getId().matches(analysisScope))) {
      return true;
    }
    return false;
  }
  
  public boolean visitMember(IMemberDescriptor referencedMember)
  {
    targetMember = referencedMember;
    switch (targetMember.getElementType())
    {
    case 2: 
      targetType = ((IReferenceTypeDescriptor)targetMember);
      break;
    case 5: 
    case 6: 
      targetType = targetMember.getEnclosingType();
    }
    currType = null;
    try
    {
      IApiTypeRoot typeRoot = null;
      IApiComponent[] comps = currComponent.getBaseline().resolvePackage(currComponent, targetType.getPackage().getName());
      for (int i = 0; i < comps.length; i++)
      {
        typeRoot = comps[i].findTypeRoot(targetType.getQualifiedName());
        if (typeRoot != null) {
          break;
        }
      }
      if (typeRoot != null) {
        currType = typeRoot.getStructure();
      }
      return true;
    }
    catch (CoreException e)
    {
      ApiPlugin.log(e.getStatus());
    }
    return false;
  }
  
  public void visitReference(IReferenceDescriptor reference)
  {
    Reference ref = null;
    IApiMember resolved = null;
    int refKind = reference.getReferenceKind();
    int lineNumber = reference.getLineNumber();
    IMemberDescriptor origin = reference.getMember();
    if (currType != null) {
      switch (targetMember.getElementType())
      {
      case 2: 
        ref = Reference.typeReference(currType, targetType.getQualifiedName(), refKind);
        break;
      case 6: 
        ref = Reference.methodReference(currType, targetType.getQualifiedName(), targetMember.getName(), ((IMethodDescriptor)targetMember).getSignature(), refKind);
        break;
      case 5: 
        ref = Reference.fieldReference(currType, targetType.getQualifiedName(), targetMember.getName(), refKind);
      }
    }
    if (ref != null) {
      try
      {
        ref.resolve();
        resolved = ref.getResolvedReference();
      }
      catch (CoreException e)
      {
        ApiPlugin.log(e.getStatus());
      }
    }
    if (resolved == null) {
      addError(Factory.referenceDescriptor(
        referencingComponent, 
        origin, 
        lineNumber, 
        targetComponent, 
        targetMember, 
        refKind, 
        reference.getReferenceFlags(), 
        reference.getVisibility(), 
        null));
    }
  }
  
  private void addError(IReferenceDescriptor error)
  {
    unresolved.add(error);
  }
  
  public void endVisitComponent(IComponentDescriptor target)
  {
    if (skipped)
    {
      skippedComponents.add(target);
    }
    else if (currComponent == null)
    {
      missingComponents.add(target);
    }
    else if (!unresolved.isEmpty())
    {
      XmlReferenceDescriptorWriter writer = new XmlReferenceDescriptorWriter(location);
      writer.setAlternate((IComponentDescriptor)currComponent.getHandle());
      writer.writeReferences((IReferenceDescriptor[])unresolved.toArray(new IReferenceDescriptor[unresolved.size()]));
    }
  }
  
  /* Error */
  public void endVisitScan()
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: new 161	java/io/File
    //   5: dup
    //   6: aload_0
    //   7: getfield 330	org/eclipse/pde/api/tools/internal/search/ReferenceLookupVisitor:location	Ljava/lang/String;
    //   10: invokespecial 353	java/io/File:<init>	(Ljava/lang/String;)V
    //   13: astore_2
    //   14: aload_2
    //   15: invokevirtual 351	java/io/File:exists	()Z
    //   18: ifne +8 -> 26
    //   21: aload_2
    //   22: invokevirtual 352	java/io/File:mkdirs	()Z
    //   25: pop
    //   26: new 161	java/io/File
    //   29: dup
    //   30: aload_2
    //   31: ldc_w 157
    //   34: invokespecial 354	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   37: astore_3
    //   38: aload_3
    //   39: invokevirtual 351	java/io/File:exists	()Z
    //   42: ifne +8 -> 50
    //   45: aload_3
    //   46: invokevirtual 350	java/io/File:createNewFile	()Z
    //   49: pop
    //   50: invokestatic 376	org/eclipse/pde/api/tools/internal/util/Util:newDocument	()Lorg/w3c/dom/Document;
    //   53: astore 4
    //   55: aload 4
    //   57: ldc_w 154
    //   60: invokeinterface 405 2 0
    //   65: astore 5
    //   67: aload 4
    //   69: aload 5
    //   71: invokeinterface 406 2 0
    //   76: pop
    //   77: aload_0
    //   78: aload_0
    //   79: getfield 332	org/eclipse/pde/api/tools/internal/search/ReferenceLookupVisitor:missingComponents	Ljava/util/List;
    //   82: getstatic 344	org/eclipse/pde/api/tools/internal/search/SearchMessages:ReferenceLookupVisitor_0	Ljava/lang/String;
    //   85: aload 4
    //   87: aload 5
    //   89: invokespecial 368	org/eclipse/pde/api/tools/internal/search/ReferenceLookupVisitor:addMissingComponents	(Ljava/util/List;Ljava/lang/String;Lorg/w3c/dom/Document;Lorg/w3c/dom/Element;)V
    //   92: aload_0
    //   93: aload_0
    //   94: getfield 333	org/eclipse/pde/api/tools/internal/search/ReferenceLookupVisitor:skippedComponents	Ljava/util/List;
    //   97: getstatic 345	org/eclipse/pde/api/tools/internal/search/SearchMessages:SkippedComponent_component_was_excluded	Ljava/lang/String;
    //   100: aload 4
    //   102: aload 5
    //   104: invokespecial 368	org/eclipse/pde/api/tools/internal/search/ReferenceLookupVisitor:addMissingComponents	(Ljava/util/List;Ljava/lang/String;Lorg/w3c/dom/Document;Lorg/w3c/dom/Element;)V
    //   107: new 160	java/io/BufferedWriter
    //   110: dup
    //   111: new 165	java/io/OutputStreamWriter
    //   114: dup
    //   115: new 163	java/io/FileOutputStream
    //   118: dup
    //   119: aload_3
    //   120: invokespecial 355	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   123: ldc_w 152
    //   126: invokespecial 356	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;Ljava/lang/String;)V
    //   129: invokespecial 348	java/io/BufferedWriter:<init>	(Ljava/io/Writer;)V
    //   132: astore_1
    //   133: aload_1
    //   134: aload 4
    //   136: invokestatic 377	org/eclipse/pde/api/tools/internal/util/Util:serializeDocument	(Lorg/w3c/dom/Document;)Ljava/lang/String;
    //   139: invokevirtual 349	java/io/BufferedWriter:write	(Ljava/lang/String;)V
    //   142: aload_1
    /
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd