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

n table:
    //   from	to	target	type
    //   153	164	167	java/lang/Exception
    //   14	591	594	java/io/IOException
    //   14	616	616	finally
  }
  
  protected String getColourLegend()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<p>");
    buffer.append("<table width=\"20%\" border=\"1\">");
    buffer.append("<tr>\n");
    buffer.append("<td width=\"25px\" bgcolor=\"").append("#F2C3C3").append("\">\n").append("&nbsp;").append("</td>\n");
    buffer.append("<td width=\"82%\">").append(SearchMessages.UseReportConverter_marks_internal_references).append("</td>\n");
    buffer.append("</tr>\n");
    buffer.append("<tr>\n");
    buffer.append("<td width=\"25px\" bgcolor=\"").append("#E0E0E0").append("\">\n").append("&nbsp;").append("</td>\n");
    buffer.append("<td width=\"82%\">").append(SearchMessages.UseReportConverter_marks_illegal_use_references).append("</td>\n");
    buffer.append("</tr>\n");
    buffer.append("</table>\n");
    buffer.append("</p>\n");
    return buffer.toString();
  }
  
  protected String getNoReportsInformation()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<p>").append("<br>").append(SearchMessages.UseReportConverter_no_reported_usage).append("</p>\n");
    return buffer.toString();
  }
  
  void writeMetadataHeaders(StringBuffer buffer)
    throws Exception
  {
    writeMetaTag(buffer, "description", SearchMessages.UseReportConverter_root_index_description);
  }
  
  void writeMetadataSummary(StringBuffer buffer)
    throws Exception
  {
    buffer.append("<h4>").append(SearchMessages.UseReportConverter_scan_details).append("</h4>\n");
    if (metadata != null)
    {
      buffer.append("<table border=\"0px\" title=\"").append(SearchMessages.UseReportConverter_scan_details).append("\"width=\"50%\">");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_scan_date).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.UseReportConverter_description).append("</td>\n");
      String desc = metadata.getDescription();
      buffer.append(openTD(36)).append(desc != null ? desc : SearchMessages.UseReportConverter_none).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_includes_API_refs).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.includesAPI()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_includes_internal_refs).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.includesInternal()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_includes_illegal_use).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.includesIllegalUse()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_baseline_loc).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.getBaselineLocation()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_scope_pattern).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.getScopePattern()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_reference_pattern).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.getReferencePattern()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_report_location).append("</td>\n");
      buffer.append(openTD(36)).append(metadata.getReportLocation()).append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_api_pattern).append("</td>\n");
      buffer.append(openTD(36));
      String[] patterns = metadata.getApiPatterns();
      if (patterns != null) {
        for (int i = 0; i < patterns.length; i++) {
          buffer.append(patterns[i]).append("<br>");
        }
      } else {
        buffer.append(SearchMessages.UseReportConverter_none);
      }
      buffer.append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_internal_patterns).append("</td>\n");
      buffer.append(openTD(36));
      patterns = metadata.getInternalPatterns();
      if (patterns != null) {
        for (int i = 0; i < patterns.length; i++) {
          buffer.append(patterns[i]).append("<br>");
        }
      } else {
        buffer.append(SearchMessages.UseReportConverter_none);
      }
      buffer.append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_archive_patterns).append("</td>\n");
      buffer.append(openTD(36));
      patterns = metadata.getArchivePatterns();
      if (patterns != null) {
        for (int i = 0; i < patterns.length; i++) {
          buffer.append(patterns[i]).append("<br>");
        }
      } else {
        buffer.append(SearchMessages.UseReportConverter_none);
      }
      buffer.append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_filter_pattern).append("</td>\n");
      buffer.append(openTD(36));
      if (frompatterns != null) {
        for (int i = 0; i < frompatterns.length; i++) {
          buffer.append(frompatterns[i].pattern()).append("<br>");
        }
      } else {
        buffer.append(SearchMessages.UseReportConverter_none);
      }
      buffer.append("</td>\n");
      buffer.append("</tr>\n");
      
      buffer.append("<tr>\n");
      buffer.append(openTD(14)).append(SearchMessages.UseReportConverter_to_filter_patterns).append("</td>\n");
      buffer.append(openTD(36));
      if (topatterns != null) {
        for (int i = 0; i < topatterns.length; i++) {
          buffer.append(topatterns[i].pattern()).append("<br>");
        }
      } else {
        buffer.append(SearchMessages.UseReportConverter_none);
      }
      buffer.append("</td>\n");
      buffer.append("</tr>\n");
      buffer.append("</table>\n");
    }
    else
    {
      buffer.append("<p>").append(SearchMessages.UseReportConverter_no_additional_scan_info).append("</p>\n");
    }
  }
  
  IMetadata getMetadata()
    throws Exception
  {
    if (metadata == null)
    {
      File xml = null;
      try
      {
        xml = new File(getReportsRoot(), "meta.xml");
        if (!xml.exists()) {
          xml = new File(getReportsRoot() + File.separator + "xml", "meta.xml");
        }
        if (xml.exists())
        {
          String xmlstr = Util.getFileContentAsString(xml);
          Element doc = Util.parseDocument(xmlstr.trim());
          metadata = new UseMetadata();
          Element element = null;
          String value = null;String name = null;
          NodeList nodes = doc.getElementsByTagName("*");
          for (int i = 0; i < nodes.getLength(); i++)
          {
            element = (Element)nodes.item(i);
            value = element.getAttribute("value");
            name = element.getNodeName();
            if ("flags".equals(name)) {
              try
              {
                metadata.setSearchflags(Integer.parseInt(value));
              }
              catch (NumberFormatException localNumberFormatException) {}
            } else if ("runatdate".equals(name)) {
              metadata.setRunAtDate(value);
            } else if ("description".equals(name)) {
              metadata.setDescription(value);
            } else if ("baselinelocation".equals(name)) {
              metadata.setBaselineLocation(value);
            } else if ("reportlocation".equals(name)) {
              metadata.setReportLocation(value);
            } else if ("scopepattern".equals(name)) {
              metadata.setScopePattern(value);
            } else if ("referencepattern".equals(name)) {
              metadata.setReferencePattern(value);
            } else if ("apipatterns".equals(name)) {
              metadata.setApiPatterns(readPatterns(element));
            } else if ("internalpatterns".equals(name)) {
              metadata.setInternalPatterns(readPatterns(element));
            } else if ("archivepatterns".equals(name)) {
              metadata.setArchivePatterns(readPatterns(element));
            }
          }
        }
      }
      catch (CoreException localCoreException)
      {
        throw new Exception(NLS.bind(SearchMessages.UseReportConverter_core_exep_reading_metadata, xml.getAbsolutePath()));
      }
    }
    return metadata;
  }
  
  private String[] readPatterns(Element element)
  {
    String[] pats = (String[])null;
    NodeList patterns = element.getElementsByTagName("pattern");
    int length = patterns.getLength();
    if (length > 0)
    {
      pats = new String[length];
      for (int j = 0; j < length; j++) {
        pats[j] = ((Element)patterns.item(j)).getAttribute("value");
      }
    }
    return pats;
  }
  
  void writeMetaTag(StringBuffer buffer, String name, String content)
  {
    buffer.append("<meta name=\"").append(name).append("\" content=\"").append(content).append("\">");
  }
  
  String getReferencesTableHeader(String sectionname, String columnname, boolean includeversion)
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<h4>").append(sectionname).append("</h4>\n");
    buffer.append("<table border=\"1\" width=\"80%\">\n");
    buffer.append("<tr>\n");
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" width=\"30%\">").append("<b>").append(columnname).append("</b>").append("</td>\n");
    if (includeversion)
    {
      buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"20%\" title=\"");
      buffer.append(SearchMessages.UseReportConverter_version_column_description).append("\"\">");
      buffer.append("<b>").append(SearchMessages.UseReportConverter_version).append("</b>").append("</td>\n");
    }
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"8%\" title=\"");
    buffer.append(SearchMessages.UseReportConverter_api_ref_description).append("\">");
    buffer.append("<b>").append(SearchMessages.UseReportConverter_api_references).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"8%\" title=\"");
    buffer.append(SearchMessages.UseReportConverter_internal_ref_description).append("\">");
    buffer.append("<b>").append(SearchMessages.UseReportConverter_internal_references).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"8%\" title=\"");
    buffer.append(SearchMessages.UseReportConverter_permissible_ref_description).append("\">");
    buffer.append("<b>").append(SearchMessages.UseReportConverter_internal_permissible_references).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"8%\" title=\"");
    buffer.append(SearchMessages.UseReportConverter_fragment_ref_description).append("\">");
    buffer.append("<b>").append(SearchMessages.UseReportConverter_fragment_permissible_references).append("</b>").append("</td>\n");
    
    buffer.append("\t<td bgcolor=\"").append("#E0C040").append("\" align=\"center\" width=\"8%\" title=\"");
    buffer.append(SearchMessages.UseReportConverter_illegal_ref_description).append("\">");
    buffer.append("<b>").append(SearchMessages.UseReportConverter_illegal).append("</b>").append("</td>\n");
    return buffer.toString();
  }
  
  String getReferenceTableEntry(CountGroup counts, String link, String linktext, boolean includeversion)
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<tr bgcolor=\"").append(getRowColour(counts)).append("\">\n");
    buffer.append("\t<td><b><a href=\"").append(link).append("\">").append(getBundleOnlyName(linktext)).append("</a>").append("</b>").append("</td>\n");
    if (includeversion) {
      buffer.append("\t<td align=\"left\">").append(getVersion(linktext)).append("</td>\n");
    }
    buffer.append("\t<td align=\"center\">").append(counts.getTotalApiRefCount()).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(counts.getTotalInternalRefCount()).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(counts.getTotalPermissableRefCount()).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(counts.getTotalFragmentPermissibleRefCount()).append("</td>\n");
    buffer.append("\t<td align=\"center\">").append(counts.getTotalIllegalRefCount()).append("</td>\n");
    buffer.append("</tr>\n");
    return buffer.toString();
  }
  
  String getBundleOnlyName(String text)
  {
    int idx = text.indexOf('(');
    if (idx > -1) {
      return text.substring(0, idx - 1);
    }
    return text;
  }
  
  String getVersion(String text)
  {
    int idx = text.indexOf('(');
    if (idx > -1)
    {
      int idx2 = text.indexOf(')', idx);
      String version = text.substring(idx + 1, idx2);
      try
      {
        Version ver = new Version(version);
        return ver.toString();
      }
      catch (IllegalArgumentException localIllegalArgumentException) {}
    }
    return "-";
  }
  
  protected String getAdditionalIndexInfo(boolean hasreports)
  {
    return null;
  }
  
  protected String getTypeCountSummary(String typename, CountGroup counts, int membercount)
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<h4>").append(SearchMessages.UseReportConverter_summary).append("</h4>\n");
    buffer.append("<p>").append(NLS.bind(SearchMessages.UseReportConverter___has_total_refs, new String[] { typename, Integer.toString(counts.getTotalRefCount()), Integer.toString(membercount) })).append("</p>\n");
    return buffer.toString();
  }
}

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

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class UseScanManager$1
  implements FileFilter
{
  public boolean accept(File pathname)
  {
    if (UseScanManager.NAME_REGEX.matcher(pathname.getName()).matches()) {
      throw new RuntimeException(pathname.getName());
    }
    return false;
  }
}

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

import org.eclipse.jdt.internal.core.OverflowingLRUCache;
import org.eclipse.jdt.internal.core.util.LRUCache;
import org.eclipse.jdt.internal.core.util.LRUCache.LRUCacheEntry;

class UseScanManager$UseScanCache
  extends OverflowingLRUCache
{
  public UseScanManager$UseScanCache(int size)
  {
    super(size);
  }
  
  public UseScanManager$UseScanCache(int size, int overflow)
  {
    super(size, overflow);
  }
  
  protected boolean close(LRUCache.LRUCacheEntry entry)
  {
    IReferenceCollection references = (IReferenceCollection)value;
    references.clear();
    return true;
  }
  
  protected LRUCache newInstance(int size, int newOverflow)
  {
    return new UseScanCache(size, newOverflow);
  }
}

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

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.internal.core.OverflowingLRUCache;
import org.eclipse.jdt.internal.core.util.LRUCache;
import org.eclipse.jdt.internal.core.util.LRUCache.LRUCacheEntry;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.util.Util;

public class UseScanManager
{
  private static UseScanCache fApiComponentCache;
  private static UseScanManager fUseScanProcessor;
  private static String tempLocation = "${workspace_loc}/.metadata/.plugins/org.eclipse.pde.api.tools/ApiUseScans/";
  public static final String STATE_DELIM = "*";
  public static final String LOCATION_DELIM = "|";
  public static final String ESCAPE_REGEX = "\\";
  public static final Pattern NAME_REGEX = Pattern.compile("^.* \\(.*\\)$");
  public static final int DEFAULT_CACHE_SIZE = 1000;
  
  private static class UseScanCache
    extends OverflowingLRUCache
  {
    public UseScanCache(int size)
    {
      super();
    }
    
    public UseScanCache(int size, int overflow)
    {
      super(overflow);
    }
    
    protected boolean close(LRUCache.LRUCacheEntry entry)
    {
      IReferenceCollection references = (IReferenceCollection)value;
      references.clear();
      return true;
    }
    
    protected LRUCache newInstance(int size, int newOverflow)
    {
      return new UseScanCache(size, newOverflow);
    }
  }
  
  private String[] fLocations = null;
  static FileFilter USESCAN_FILTER = new FileFilter()
  {
    public boolean accept(File pathname)
    {
      if (UseScanManager.NAME_REGEX.matcher(pathname.getName()).matches()) {
        throw new RuntimeException(pathname.getName());
      }
      return false;
    }
  };
  
  public static synchronized UseScanManager getInstance()
  {
    if (fUseScanProcessor == null)
    {
      fUseScanProcessor = new UseScanManager();
      fApiComponentCache = new UseScanCache(1000);
    }
    return fUseScanProcessor;
  }
  
  public IReferenceDescriptor[] getExternalDependenciesFor(IApiComponent apiComponent, String[] apiUseTypes, IProgressMonitor monitor)
  {
    IReferenceCollection references = (IReferenceCollection)fApiComponentCache.get(apiComponent);
    if (references == null) {
      references = apiComponent.getExternalDependencies();
    }
    SubMonitor localmonitor = SubMonitor.convert(monitor, SearchMessages.collecting_external_dependencies, 10);
    try
    {
      ArrayList unavailableMembers = new ArrayList();
      IReferenceDescriptor[] arrayOfIReferenceDescriptor;
      if ((apiUseTypes != null) && (apiUseTypes.length > 0))
      {
        for (int i = 0; i < apiUseTypes.length; i++) {
          if (!references.hasReferencesTo(apiUseTypes[i])) {
            unavailableMembers.add(apiUseTypes[i]);
          }
        }
        if (unavailableMembers.size() > 0) {
          fetch(apiComponent, (String[])unavailableMembers.toArray(new String[unavailableMembers.size()]), references, monitor);
        }
        Util.updateMonitor(localmonitor, 1);
        return references.getExternalDependenciesTo(apiUseTypes);
      }
      fetch(apiComponent, null, references, localmonitor.newChild(8));
      Util.updateMonitor(localmonitor, 1);
      return references.getAllExternalDependencies();
    }
    finally
    {
      localmonitor.done();
    }
  }
  
  /* Error */
  private void fetch(IApiComponent apiComponent, String[] types, IReferenceCollection references, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: new 222	org/eclipse/pde/api/tools/internal/search/UseScanParser
    //   3: dup
    //   4: invokespecial 465	org/eclipse/pde/api/tools/internal/search/UseScanParser:<init>	()V
    //   7: astore 5
    //   9: new 223	org/eclipse/pde/api/tools/internal/search/UseScanReferenceVisitor
    //   12: dup
    //   13: aload_1
    //   14: aload_2
    //   15: aload_3
    //   16: invokespecial 467	org/eclipse/pde/api/tools/internal/search/UseScanReferenceVisitor:<init>	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;[Ljava/lang/String;Lorg/eclipse/pde/api/tools/internal/search/IReferenceCollection;)V
    //   19: astore 6
    //   21: aload 4
    //   23: getstatic 390	org/eclipse/pde/api/tools/internal/search/SearchMessages:load_external_dependencies	Ljava/lang/String;
    //   26: bipush 10
    //   28: invokestatic 446	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   31: astore 7
    //   33: aload_0
    //   34: getfield 393	org/eclipse/pde/api/tools/internal/search/UseScanManager:fLocations	[Ljava/lang/String;
    //   37: ifnonnull +12 -> 49
    //   40: aload_0
    //   41: invokevirtual 454	org/eclipse/pde/api/tools/internal/search/UseScanManager:getReportLocations	()[Ljava/lang/String;
    //   44: astore 8
    //   46: goto +9 -> 55
    //   49: aload_0
    //   50: getfield 393	org/eclipse/pde/api/tools/internal/search/UseScanManager:fLocations	[Ljava/lang/String;
    //   53: astore 8
    //   55: aload 8
    //   57: ifnull +441 -> 498
    //   60: aconst_null
    //   61: astore 9
    //   63: aload 7
    //   65: aload 8
    //   67: arraylength
    //   68: iconst_2
    //   69: imul
    //   70: invokevirtual 445	org/eclipse/core/runtime/SubMonitor:setWorkRemaining	(I)Lorg/eclipse/core/runtime/SubMonitor;
    //   73: pop
    //   74: iconst_0
    //   75: istore 10
    //   77: goto +368 -> 445
    //   80: aload 7
    //   82: iconst_1
    //   83: invokestatic 472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   86: new 191	java/io/File
    //   89: dup
    //   90: aload 8
    //   92: iload 10
    //   94: aaload
    //   95: invokespecial 405	java/io/File:<init>	(Ljava/lang/String;)V
    //   98: astore 11
    //   100: aload 11
    //   102: invokevirtual 398	java/io/File:exists	()Z
    //   105: ifne +6 -> 111
    //   108: goto +334 -> 442
    //   111: aload 11
    //   113: invokevirtual 400	java/io/File:isFile	()Z
    //   116: ifeq +225 -> 341
    //   119: aload 11
    //   121: invokevirtual 402	java/io/File:getName	()Ljava/lang/String;
    //   124: invokestatic 470	org/eclipse/pde/api/tools/internal/util/Util:isArchive	(Ljava/lang/String;)Z
    //   127: ifeq +315 -> 442
    //   130: new 198	java/lang/StringBuffer
    //   133: dup
    //   134: getstatic 392	org/eclipse/pde/api/tools/internal/search/UseScanManager:tempLocation	Ljava/lang/String;
    //   137: invokestatic 420	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   140: invokespecial 423	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   143: aload 11
    //   145: invokevirtual 402	java/io/File:getName	()Ljava/lang/String;
    //   148: invokevirtual 427	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   151: bipush 46
    //   153: invokevirtual 424	java/lang/StringBuffer:append	(C)Ljava/lang/StringBuffer;
    //   156: aload 11
    //   158: invokevirtual 401	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   161: invokevirtual 414	java/lang/String:hashCode	()I
    //   164: invokevirtual 425	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   167: invokevirtual 422	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   170: astore 12
    //   172: aload 9
    //   174: ifnonnull +11 -> 185
    //   177: invokestatic 448	org/eclipse/core/variables/VariablesPlugin:getDefault	()Lorg/eclipse/core/variables/VariablesPlugin;
    //   180: invokevirtual 447	org/eclipse/core/variables/VariablesPlugin:getStringVariableManager	()Lorg/eclipse/core/variables/IStringVariableManager;
    //   183: astore 9
    //   185: aload 9
    //   187: aload 12
    //   189: invokeinterface 481 2 0
    //   194: astore 12
    //   196: aload 8
    //   198: iload 10
    //   200: new 198	java/lang/StringBuffer
    //   203: dup
    //   204: aload 12
    //   206: invokestatic 420	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   209: invokespecial 423	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   212: bipush 47
    //   214: invokevirtual 424	java/lang/StringBuffer:append	(C)Ljava/lang/StringBuffer;
    //   217: aload 11
    //   219: invokevirtual 397	java/io/File:lastModified	()J
    //   222: invokevirtual 426	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   225: invokevirtual 422	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   228: aastore
    //   229: new 191	java/io/File
    //   232: dup
    //   233: aload 12
    //   235: invokespecial 405	java/io/File:<init>	(Ljava/lang/String;)V
    //   238: astore 13
    //   240: aload 13
    //   242: invokevirtual 398	java/io/File:exists	()Z
    //   245: ifeq +83 -> 328
    //   248: aload 13
    //   250: invokevirtual 404	java/io/File:list	()[Ljava/lang/String;
    //   253: astore 14
    //   255: iconst_0
    //   256: istore 15
    //   258: goto +59 -> 317
    //   261: aload 14
    //   263: iload 15
    //   265: aaload
    //   266: aload 11
    //   268: invokevirtual 397	java/io/File:lastModified	()J
    //   271: invokestatic 418	java/lang/String:valueOf	(J)Ljava/lang/String;
    //   274: invokevirtual 416	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   277: ifne +37 -> 314
    //   280: invokestatic 469	org/eclipse/pde/api/tools/internal/util/FileManager:getManager	()Lorg/eclipse/pde/api/tools/internal/util/FileManager;
    //   283: new 198	java/lang/StringBuffer
    //   286: dup
    //   287: aload 12
    //   289: invokestatic 420	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   292: invokespecial 423	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   295: bipush 47
    //   297: invokevirtual 424	java/lang/StringBuffer:append	(C)Ljava/lang/StringBuffer;
    //   300: aload 14
    //   302: iload 15
    //   304: aaload
    //   305: invokevirtual 427	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   308: invokevirtual 422	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   311: invokevirtual 468	org/eclipse/pde/api/tools/internal/util/FileManager:recordTempFileRoot	(Ljava/lang/String;)V
    //   314: iinc 15 1
    //   317: iload 15
    //   319: aload 14
    //   321: arraylength
    //   322: if_icmplt -61 -> 261
    //   325: goto +16 -> 341
    //   328: aload 11
    //   330: invokevirtual 403	java/io/File:getPath	()Ljava/lang/String;
    //   333: aload 8
    //   335: iload 10
    //   337: aaload
    //   338: invokestatic 473	org/eclipse/pde/api/tools/internal/util/Util:unzip	(Ljava/lang/String;Ljava/lang/String;)V
    //   341: aload 8
    //   343: iload 10
    //   345: aload 8
    //   347: iload 10
    //   349: aaload
    //   350: invokestatic 455	org/eclipse/pde/api/tools/internal/search/UseScanManager:getExactScanLocation	(Ljava/lang/String;)Ljava/lang/String;
    //   353: aastore
    //   354: aload 8
    //   356: iload 10
    //   358: aaload
    //   359: ifnonnull +50 -> 409
    //   362: aload 11
    //   364: invokevirtual 399	java/io/File:isDirectory	()Z
    //   367: ifeq +19 -> 386
    //   370: getstatic 388	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseScanManager_InvalidDir	Ljava/lang/String;
    //   373: aload 11
    //   375: invokevirtual 401	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   378: invokestatic 449	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   381: astore 12
    //   383: goto +16 -> 399
    //   386: getstatic 387	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseScanManager_InvalidArchive	Ljava/lang/String;
    //   389: aload 11
    //   391: invokevirtual 401	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   394: invokestatic 449	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   397: astore 12
    //   399: new 194	java/lang/Exception
    //   402: dup
    //   403: aload 12
    //   405: invokespecial 411	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   408: athrow
    //   409: aload 5
    //   411: aload 8
    //   413: iload 10
    //   415: aaload
    //   416: aload 7
    //   418: iconst_2
    //   419: invokevirtual 444	org/eclipse/core/runtime/SubMonitor:newChild	(I)Lorg/eclipse/core/runtime/SubMonitor;
    //   422: aload 6
    //   424: invokevirtual 466	org/eclipse/pde/api/tools/internal/search/UseScanParser:parse	(Ljava/lang/String;Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/pde/api/tools/internal/search/UseScanVisitor;)V
    //   427: aload 7
    //   429: invokestatic 471	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   432: goto +10 -> 442
    //   435: astore 12
    //   437: aload 12
    //   439: invokestatic 450	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   442: iinc 10 1
    //   445: iload 10
    //   447: aload 8
    //   449: arraylength
    //   450: if_icmplt -370 -> 80
    //   453: getstatic 396	org/eclipse/pde/api/tools/internal/search/UseScanManager:fApiComponentCache	Lorg/eclipse/pde/api/tools/internal/search/UseScanManager$UseScanCache;
    //   456: aload_1
    //   457: invokevirtual 463	org/eclipse/pde/api/tools/internal/search/UseScanManager$UseScanCache:remove	(Ljava/lang/Object;)Ljava/lang/Object;
    //   460: pop
    //   461: getstatic 396	org/eclipse/pde/api/tools/internal/search/UseScanManager:fApiComponentCache	Lorg/eclipse/pde/api/tools/internal/search/UseScanManager$UseScanCache;
    //   464: aload_1
    //   465: aload_3
    //   466: invokevirtual 464	org/eclipse/pde/api/tools/internal/search/UseScanManager$UseScanCache:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    //   469: pop
    //   470: goto +28 -> 498
    //   473: astore 8
    //   475: aload 8
    //   477: invokestatic 450	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   480: aload 7
    //   482: invokevirtual 443	org/eclipse/core/runtime/SubMonitor:done	()V
    //   485: goto +18 -> 503
    //   488: astore 16
    //   490: aload 7
    //   492: invokevirtual 443	org/eclipse/core/runtime/SubMonitor:done	()V
    //   495: aload 16
    //   497: athrow
    //   498: aload 7
    //   500: invokevirtual 443	org/eclipse/core/runtime/SubMonitor:done	()V
    //   503: return
    // Line number table:
    //   Java source line #163	-> byte code offset #0
    //   Java source line #164	-> byte code offset #9
    //   Java source line #165	-> byte code offset #21
    //   Java source line #168	-> byte code offset #33
    //   Java source line #169	-> byte code offset #40
    //   Java source line #172	-> byte code offset #49
    //   Java source line #174	-> byte code offset #55
    //   Java source line #175	-> byte code offset #60
    //   Java source line #176	-> byte code offset #63
    //   Java source line #177	-> byte code offset #74
    //   Java source line #178	-> byte code offset #80
    //   Java source line #179	-> byte code offset #86
    //   Java source line #180	-> byte code offset #100
    //   Java source line #181	-> byte code offset #108
    //   Java source line #183	-> byte code offset #111
    //   Java source line #184	-> byte code offset #119
    //   Java source line #185	-> byte code offset #130
    //   Java source line #186	-> byte code offset #172
    //   Java source line #187	-> byte code offset #177
    //   Java source line #189	-> byte code offset #185
    //   Java source line #190	-> byte code offset #196
    //   Java source line #191	-> byte code offset #229
    //   Java source line #192	-> byte code offset #240
    //   Java source line #193	-> byte code offset #248
    //   Java source line #194	-> byte code offset #255
    //   Java source line #195	-> byte code offset #261
    //   Java source line #196	-> byte code offset #280
    //   Java source line #194	-> byte code offset #314
    //   Java source line #200	-> byte code offset #328
    //   Java source line #207	-> byte code offset #341
    //   Java source line #208	-> byte code offset #354
    //   Java source line #210	-> byte code offset #362
    //   Java source line #211	-> byte code offset #370
    //   Java source line #213	-> byte code offset #386
    //   Java source line #215	-> byte code offset #399
    //   Java source line #217	-> byte code offset #409
    //   Java source line #218	-> byte code offset #427
    //   Java source line #219	-> byte code offset #435
    //   Java source line #220	-> byte code offset #437
    //   Java source line #177	-> byte code offset #442
    //   Java source line #223	-> byte code offset #453
    //   Java source line #224	-> byte code offset #461
    //   Java source line #226	-> byte code offset #473
    //   Java source line #227	-> byte code offset #475
    //   Java source line #230	-> byte code offset #480
    //   Java source line #229	-> byte code offset #488
    //   Java source line #230	-> byte code offset #490
    //   Java source line #231	-> byte code offset #495
    //   Java source line #230	-> byte code offset #498
    //   Java source line #232	-> byte code offset #503
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	504	0	this	UseScanManager
    //   0	504	1	apiComponent	IApiComponent
    //   0	504	2	types	String[]
    //   0	504	3	references	IReferenceCollection
    //   0	504	4	monitor	IProgressMonitor
    //   7	403	5	parser	UseScanParser
    //   19	404	6	visitor	UseScanReferenceVisitor
    //   31	468	7	localmonitor	SubMonitor
    //   44	3	8	locations	String[]
    //   53	395	8	locations	String[]
    //   473	3	8	e	Exception
    //   61	125	9	stringManager	org.eclipse.core.variables.IStringVariableManager
    //   75	371	10	i	int
    //   98	292	11	file	File
    //   170	118	12	destDirPath	String
    //   381	3	12	message	String
    //   397	7	12	message	String
    //   435	3	12	e	Exception
    //   238	11	13	unzipDirLoc	File
    //   253	67	14	childDirs	String[]
    //   256	62	15	j	int
    //   488	8	16	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   341	432	435	java/lang/Exception
    //   33	470	473	java/lang/Exception
    //   33	480	488	finally
  }
  
  public static String getExactScanLocation(String location)
  {
    File file = new File(location);
    if (isValidDirectory(file)) {
      return location;
    }
    file = new File(location, "xml");
    if (isValidDirectory(file)) {
      return file.getAbsolutePath();
    }
    return null;
  }
  
  public static boolean isValidDirectory(File file)
  {
    if ((file.exists()) && (file.isDirectory())) {
      try
      {
        file.listFiles(USESCAN_FILTER);
      }
      catch (RuntimeException rte)
      {
        File f = new File(file, rte.getMessage());
        try
        {
          if ((f.exists()) && (f.isDirectory())) {
            f.listFiles(USESCAN_FILTER);
          }
        }
        catch (RuntimeException localRuntimeException1)
        {
          return true;
        }
      }
    }
    return false;
  }
  
  public static boolean isValidArchive(File file)
  {
    String fname = file.getName().toLowerCase();
    if ((file.exists()) && (Util.isArchive(fname)))
    {
      Enumeration entries = null;
      if (fname.endsWith(".jar")) {
        try
        {
          JarFile jfile = new JarFile(file);
          entries = jfile.entries();
        }
        catch (IOException localIOException1)
        {
          return false;
        }
      } else if (fname.endsWith(".zip")) {
        try
        {
          ZipFile zfile = new ZipFile(file);
          entries = zfile.entries();
        }
        catch (IOException localIOException2)
        {
          return false;
        }
      }
      if (entries != null) {
        while (entries.hasMoreElements())
        {
          ZipEntry o = (ZipEntry)entries.nextElement();
          if (o.isDirectory())
          {
            IPath path = new Path(o.getName());
            int count = path.segmentCount();
            if (count > 2) {
              return (NAME_REGEX.matcher(path.segment(0)).matches()) || (NAME_REGEX.matcher(path.segment(1)).matches());
            }
          }
        }
      }
    }
    return false;
  }
  
  public static boolean isValidScanLocation(String location)
  {
    if ((location != null) && (location.length() > 0))
    {
      IPath path = new Path(location);
      File file = path.toFile();
      return (isValidDirectory(file)) || (isValidArchive(file));
    }
    return false;
  }
  
  public String[] getReportLocations()
  {
    IEclipsePreferences node = InstanceScope.INSTANCE.getNode("org.eclipse.pde.api.tools");
    String apiUseScanPaths = node.get("API_USE_SCAN_LOCATION", null);
    if ((apiUseScanPaths == null) || (apiUseScanPaths.length() == 0)) {
      return new String[0];
    }
    String[] locations = apiUseScanPaths.split("\\|");
    ArrayList locationList = new ArrayList(locations.length);
    for (int i = 0; i < locations.length; i++)
    {
      String[] values = locations[i].split("\\*");
      if (Boolean.valueOf(values[1]).booleanValue()) {
        locationList.add(values[0]);
      }
    }
    return (String[])locationList.toArray(new String[locationList.size()]);
  }
  
  public void setReportLocations(String[] locations)
  {
    fLocations = locations;
  }
  
  public void setCacheSize(int size)
  {
    fApiComponentCache.setSpaceLimit(size);
  }
  
  public void clearCache()
  {
    Enumeration elementss = fApiComponentCache.elements();
    while (elementss.hasMoreElements())
    {
      IReferenceCollection reference = (IReferenceCollection)elementss.nextElement();
      reference.clear();
    }
    fApiComponentCache.flush();
  }
}

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

import java.io.File;
import java.io.FileFilter;

class UseScanParser$1
  implements FileFilter
{
  final UseScanParser this$0;
  
  UseScanParser$1(UseScanParser paramUseScanParser)
  {
    this$0 = paramUseScanParser;
  }
  
  public boolean accept(File pathname)
  {
    return (pathname.isDirectory()) || (pathname.getName().endsWith(".xml"));
  }
}

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

import java.io.File;
import java.io.FileFilter;

class UseScanParser$2
  implements FileFilter
{
  final UseScanParser this$0;
  
  UseScanParser$2(UseScanParser paramUseScanParser)
  {
    this$0 = paramUseScanParser;
  }
  
  public boolean accept(File pathname)
  {
    return (pathname.isDirectory()) &&
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-2019. Infinite Loop Ltd