org.eclipse.wst.jsdt.support.ie_1.0.400.v201008112000

16:49:13.810 INFO  jd.cli.Main - Decompiling org.eclipse.wst.jsdt.support.ie_1.0.400.v201008112000.jar
package org.eclipse.wst.jsdt.core.compiler.libraries;

import org.eclipse.core.runtime.IPath;

class InternetExplorerLibInitializer$IeLibLocation
  extends SystemLibraryLocation
{
  private static LibraryLocation fInstance;
  
  public char[][] getLibraryFileNames()
  {
    return getAllFilesInPluginDirectory(getLibraryPathInPlugin().toString());
  }
  
  protected String getPluginId()
  {
    return "org.eclipse.wst.jsdt.support.ie";
  }
  
  public static LibraryLocation getInstance()
  {
    if (fInstance == null) {
      fInstance = new IeLibLocation();
    }
    return fInstance;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.core.compiler.libraries.InternetExplorerLibInitializer.IeLibLocation
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.core.compiler.libraries;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainerInitializer;
import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer;

public class InternetExplorerLibInitializer
  extends JsGlobalScopeContainerInitializer
  implements IJsGlobalScopeContainerInitializer
{
  protected static final String CONTAINER_ID = "org.eclipse.wst.jsdt.launching.InternetExplorer";
  protected static final String ContainerDescription = "Internet Explorer Support Library";
  protected static final String PLUGIN_ID = "org.eclipse.wst.jsdt.support.ie";
  
  static class IeLibLocation
    extends SystemLibraryLocation
  {
    private static LibraryLocation fInstance;
    
    public char[][] getLibraryFileNames()
    {
      return getAllFilesInPluginDirectory(getLibraryPathInPlugin().toString());
    }
    
    protected String getPluginId()
    {
      return "org.eclipse.wst.jsdt.support.ie";
    }
    
    public static LibraryLocation getInstance()
    {
      if (fInstance == null) {
        fInstance = new IeLibLocation();
      }
      return fInstance;
    }
  }
  
  public LibraryLocation getLibraryLocation()
  {
    return IeLibLocation.getInstance();
  }
  
  public String getDescription(IPath containerPath, IJavaScriptProject project)
  {
    return "Internet Explorer Support Library";
  }
  
  public String getDescription()
  {
    return "Internet Explorer Support Library";
  }
  
  public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project)
  {
    if (containerPath == null) {
      return null;
    }
    String requestedContainerPath = new Path(element).getFileExtension();
    if ((requestedContainerPath != null) && (requestedContainerPath.equalsIgnoreCase("js"))) {
      return null;
    }
    return ImageDescriptor.createFromFile(getClass(), "ie_small.gif");
  }
  
  public IPath getPath()
  {
    return new Path("org.eclipse.wst.jsdt.launching.InternetExplorer");
  }
  
  public int getKind()
  {
    return 2;
  }
  
  public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project)
  {
    return true;
  }
  
  public String[] containerSuperTypes()
  {
    return new String[] { "window", "object", "array" };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.core.compiler.libraries.InternetExplorerLibInitializer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.core.compiler.libraries;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.IJsGlobalScopeContainerInitializerExtension;

public class InternetExplorerUILibInitializer
  implements IJsGlobalScopeContainerInitializerExtension
{
  public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project)
  {
    if (containerPath == null) {
      return null;
    }
    String requestedContainerPath = new Path(element).getFileExtension();
    if ((requestedContainerPath != null) && (requestedContainerPath.equalsIgnoreCase("js"))) {
      return null;
    }
    return ImageDescriptor.createFromFile(getClass(), "ie_small.gif");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.core.compiler.libraries.InternetExplorerUILibInitializer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.internal.ui.wizards;

import org.eclipse.osgi.util.NLS;

public class IEMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.internal.ui.wizards.IEMessages";
  public static String IELibraryWizardPage_title;
  public static String IELibraryWizardPage_IELibraryAdded;
  public static String IELibraryWizardPage_BrowserSupport;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.jsdt.internal.ui.wizards.IEMessages", IEMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.internal.ui.wizards.IEMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.internal.ui.wizards.buildpaths;

import java.io.PrintStream;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.internal.ui.JavaPluginImages;
import org.eclipse.wst.jsdt.internal.ui.wizards.IEMessages;
import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPage;
import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPageExtension;
import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPageExtension2;
import org.eclipse.wst.jsdt.ui.wizards.NewElementWizardPage;

public class InternetExplorerLibraryWizardPage
  extends NewElementWizardPage
  implements IJsGlobalScopeContainerPage, IJsGlobalScopeContainerPageExtension, IJsGlobalScopeContainerPageExtension2
{
  private static final String CONTAINER_ID = "org.eclipse.wst.jsdt.launching.InternetExplorer";
  
  public InternetExplorerLibraryWizardPage()
  {
    super("InternetExplorerBrowserLib");
    setTitle(IEMessages.IELibraryWizardPage_title);
    setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);
  }
  
  public boolean finish()
  {
    return true;
  }
  
  public IIncludePathEntry getSelection()
  {
    System.out.println("Unimplemented method:BaseLibraryWizardPage.getSelection");
    return null;
  }
  
  public void setSelection(IIncludePathEntry containerEntry) {}
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setFont(parent.getFont());
    DialogField field = new DialogField();
    
    field.setLabelText(IEMessages.IELibraryWizardPage_IELibraryAdded);
    LayoutUtil.doDefaultLayout(composite, new DialogField[] { field }, false, -1, -1);
    Dialog.applyDialogFont(composite);
    setControl(composite);
    setDescription(IEMessages.IELibraryWizardPage_BrowserSupport);
  }
  
  public void initialize(IJavaScriptProject project, IIncludePathEntry[] currentEntries) {}
  
  public IIncludePathEntry[] getNewContainers()
  {
    IIncludePathEntry library = JavaScriptCore.newContainerEntry(new Path("org.eclipse.wst.jsdt.launching.InternetExplorer"));
    return new IIncludePathEntry[] { library };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.internal.ui.wizards.buildpaths.InternetExplorerLibraryWizardPage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;

public class ElementInfo
{
  public static final int CLASS = 1;
  public static final int METHOD = 2;
  public static final int PROPERTY = 3;
  public static final int EVENT = 4;
  public static final int COLLECTION = 5;
  protected String name;
  protected String baseUrl;
  protected ElementInfo parent;
  protected ElementInfo[] children;
  protected int type = -5;
  protected static ArrayList nodes;
  protected boolean visited = false;
  protected static int instances = 0;
  protected static boolean DEBUG = false;
  protected static boolean useCache;
  protected static boolean keepCache;
  
  public boolean shouldUseCache()
  {
    return useCache;
  }
  
  public boolean shouldKeepCache()
  {
    return keepCache;
  }
  
  public static void setUseCache(boolean shouldUseCache)
  {
    useCache = shouldUseCache;
  }
  
  public static void setKeepCache(boolean shouldKeepCache)
  {
    keepCache = shouldKeepCache;
  }
  
  public boolean visit()
  {
    boolean ov = visited;
    visited = true;
    return ov;
  }
  
  public boolean equals(Object o)
  {
    try
    {
      ElementInfo other = (ElementInfo)o;
      return other.getUrl().trim().equalsIgnoreCase(getUrl().trim());
    }
    catch (Exception localException) {}
    return false;
  }
  
  public static void freeObject(ElementInfo element)
  {
    for (int i = 0; i < nodes.size(); i++)
    {
      ElementInfo temp = (ElementInfo)nodes.get(i);
      if (temp.getUrl().equalsIgnoreCase(element.getUrl()))
      {
        nodes.remove(i);
        break;
      }
    }
  }
  
  public ElementInfo[] getFoundObjects()
  {
    ArrayList found = new ArrayList();
    ElementInfo[] children = getChildren();
    for (int i = 0; i < children.length; i++) {
      if ((children[i].getType() == 5) || (children[i].getType() == 4))
      {
        children[i].clearVisit();
        found.add(children[i]);
      }
    }
    return (ElementInfo[])found.toArray(new ElementInfo[found.size()]);
  }
  
  public void clearVisit()
  {
    visited = false;
  }
  
  public ElementInfo(String baseUrl, ElementInfo parent)
  {
    nodes = new ArrayList();
    
    this.baseUrl = baseUrl;
    this.parent = parent;
    if (DEBUG) {
      System.out.println("Creating new instance for total of : " + ++instances);
    }
  }
  
  public void finalize()
  {
    if (DEBUG) {
      System.out.println("Destroying instance for total of : " + --instances);
    }
  }
  
  public void addNode(ElementInfo element)
  {
    nodes.add(element);
  }
  
  public static ElementInfo findChild(String baseUrl)
  {
    for (int i = 0; i < nodes.size(); i++)
    {
      ElementInfo temp = (ElementInfo)nodes.get(i);
      if (temp.getUrl().equalsIgnoreCase(baseUrl)) {
        return temp;
      }
    }
    return null;
  }
  
  public boolean isDefined(String baseUrl)
  {
    return findChild(baseUrl) != null;
  }
  
  public ElementInfo getParent()
  {
    return parent;
  }
  
  public ElementInfo[] getChildren()
  {
    return children;
  }
  
  public boolean hasChildren()
  {
    return (children != null) && (children.length > 0);
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getUrl()
  {
    return baseUrl;
  }
  
  public String getJsDoc(String parentName)
  {
    return null;
  }
  
  public String getJsStructure()
  {
    return null;
  }
  
  public String getTypeName()
  {
    switch (getType())
    {
    case 3: 
      return "Property";
    case 2: 
      return "Method";
    case 1: 
      return "Class";
    }
    return "Unknown Type";
  }
  
  public int getType()
  {
    return -1;
  }
  
  public String toString()
  {
    StringBuffer buff = new StringBuffer();
    buff.append("name : " + getName() + Util.NEW_LINE);
    buff.append("Type : " + getTypeName() + "Util.NEW_LINE");
    if (getParent() != null)
    {
      buff.append("\tParent Name : " + getParent().getName() + Util.NEW_LINE);
      buff.append("\tParent Type : " + getParent().getTypeName() + Util.NEW_LINE);
    }
    else
    {
      buff.append("No Parent" + Util.NEW_LINE);
    }
    buff.append("baseUrl : " + baseUrl + Util.NEW_LINE);
    
    buff.append("----------------Children--------------" + Util.NEW_LINE + "Name\t\t\t\tType" + Util.NEW_LINE);
    if (hasChildren())
    {
      ElementInfo[] children = getChildren();
      for (int i = 0; i < children.length; i++) {
        buff.append(children[i].getName() + "\t\t\t" + children[i].getTypeName() + Util.NEW_LINE);
      }
    }
    else
    {
      buff.append(Util.NEW_LINE + "No Children" + Util.NEW_LINE);
    }
    buff.append("--------------------------------------");
    return buff.toString();
  }
  
  protected String getPageText()
  {
    try
    {
      return Util.retrieveFromUrl(getUrl(), shouldUseCache(), !shouldKeepCache());
    }
    catch (IOException localIOException) {}
    return null;
  }
  
  public String getBaseUrl()
  {
    return Util.getBaseUrl(getUrl());
  }
  
  public String getDeclarationString()
  {
    return null;
  }
  
  public String getJsStructure(String parent)
  {
    return "NOT DEFINED " + parent;
  }
  
  public boolean isStatic()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.ElementInfo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

import java.io.File;
import java.io.PrintStream;
import java.util.ArrayList;
import org.eclipse.wst.jsdt.jsdoc.msdn.IeFromMsdn;

public class GenerateJsDoc
{
  static final String outDirectory = "./libraries";
  static final String outFileName = "JScptBrowserObj.js";
  static final int REPLACE_FILE = 0;
  static final int SKIP_FILE = 1;
  static final int APPEND = 2;
  static final int LIB_FILE_ACTION = 1;
  static final boolean CLEAR_CACHE_ON_EXIT = false;
  static final boolean USE_CACHE = true;
  static final IJsDocSource source = new IeFromMsdn(true, true);
  static final String JS_PREFIX = "IE_";
  
  public static String getOutFile(String fileName)
  {
    File outDir = new File("./libraries");
    if (!outDir.exists()) {
      outDir.mkdir();
    }
    File outFile = new File(outDir.getAbsolutePath() + "/" + fileName);
    return outFile.getAbsolutePath();
  }
  
  public static void main(String[] args)
  {
    ElementInfo[] tops = source.getTopObjects();
    ArrayList allFoundNodes = new ArrayList();
    
    boolean workDone = true;
    while (workDone)
    {
      workDone = false;
      for (int i = 0; i < tops.length; i++)
      {
        String fileName = getOutFile("IE_" + tops[i].getName().toLowerCase().trim() + ".js");
        
        File theFile = new File(fileName);
        switch (1)
        {
        case 1: 
          if (theFile.exists())
          {
            System.out.println("Skipping output to file : " + theFile.getAbsolutePath());
            ElementInfo[] foundObjects = tops[i].getFoundObjects();
            for (int k = 0; k < foundObjects.length; k++) {
              if (!allFoundNodes.contains(foundObjects[k]))
              {
                workDone = true;
                allFoundNodes.add(foundObjects[k]);
              }
            }
            ElementInfo.freeObject(tops[i]);
            tops[i] = null;
            System.gc();
          }
          break;
        case 0: 
          if (theFile.exists()) {
            theFile.delete();
          }
          break;
        }
        workDone = true;
        System.out.println("Writing Class '" + tops[i].getName() + "' to disk in " + fileName);
        tops[i].getChildren();
        String jsSctureture = tops[i].getJsStructure();
        Util.stringToFile(jsSctureture, fileName, true, false);
        
        ElementInfo[] foundObjects = tops[i].getFoundObjects();
        for (int k = 0; k < foundObjects.length; k++) {
          if (!allFoundNodes.contains(foundObjects[k]))
          {
            allFoundNodes.add(foundObjects[k]);
            workDone = true;
          }
        }
        ElementInfo.freeObject(tops[i]);
        tops[i] = null;
        System.gc();
      }
      System.out.println("Writing Collections and Events....");
      
      tops = (ElementInfo[])allFoundNodes.toArray(new ElementInfo[allFoundNodes.size()]);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.GenerateJsDoc
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

public abstract interface IJsDocSource
{
  public abstract ElementInfo[] getTopObjects();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.IJsDocSource
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

public class MappingException
  extends Exception
{
  private static final long serialVersionUID = 1L;
  
  public MappingException() {}
  
  public MappingException(String ex)
  {
    super(ex);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.MappingException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.StringTokenizer;

public class Util
{
  public static final String XSL_HEADER = "<?xml version=\"1.0\"?> <xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">";
  public static final String XSL_FOOTER = "</xsl:stylesheet>";
  public static final String NEW_LINE = System.getProperty("line.separator");
  private static final String BUFFER_DIR = "./webCache";
  public static final boolean VERBOSE = true;
  
  private static File getTempDir()
  {
    File tempDir = new File("./webCache");
    if (tempDir.exists()) {
      return tempDir;
    }
    tempDir.mkdir();
    return tempDir;
  }
  
  public static String retrieveFromUrl(String url, boolean useCache, boolean deleteOnExit)
    throws IOException
  {
    System.gc();
    String buffFile = getTempDir().getAbsolutePath() + "\\" + toUniqueFileName(url);
    String text = null;
    if (useCache)
    {
      try
      {
        text = fileToString(buffFile);
      }
      catch (IOException localIOException) {}
      if (text != null) {
        return text;
      }
    }
    StringBuffer pageText = new StringBuffer();
    URL location = new URL(url);
    URLConnection yc = location.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    {
      String inputLine;
      pageText.append(inputLine);
    }
    in.close();
    if (useCache)
    {
      System.out.println("Caching URL.. " + url);
      stringToFile(pageText.toString(), buffFile, false, deleteOnExit);
    }
    return pageText.toString();
  }
  
  public static String toUniqueFileName(String url)
  {
    String temp = url.replace('/', '_');
    temp = temp.replace('\\', '_');
    temp = temp.replace(':', '_');
    temp = temp.replace('#', '_');
    temp = temp.replace('?', '_');
    temp = temp.replace('%', '_');
    temp = temp.replace('=', '_');
    temp = temp.replace('&', '_');
    temp = temp.replace(';', '_');
    temp = temp.replace('(', '_');
    temp = temp.replace(')', '_');
    temp = temp.replace('\'', '_');
    temp = temp.replace(',', '_');
    temp = temp.replace('$', '_');
    return temp;
  }
  
  public static String retrieveFromUrlFixEncode(String url, boolean useBuffer, boolean deleteOnExit)
    throws IOException
  {
    String encoding = "ISO-8859-1";
    
    String text = retrieveFromUrl(url, useBuffer, deleteOnExit);
    text = text.replaceAll("UTF-8", encoding);
    text = text.replaceAll("UTF-16", encoding);
    return text;
  }
  
  public static String applyTranslation(String text, File translation)
    throws MappingException
  {
    XSLTMap map = new XSLTMap(translation);
    return map.applyMap(text);
  }
  
  public static File dataToTempFile(String data)
  {
    File temp = null;
    try
    {
      temp = File.createTempFile(System.currentTimeMillis() + "_tmp", ".tmp");
      
      temp.deleteOnExit();
      
      BufferedWriter out = new BufferedWriter(new FileWriter(temp));
      out.write(data);
      out.close();
    }
    catch (IOException localIOException) {}
    return temp;
  }
  
  public static String fileToString(String fileName)
    throws IOException
  {
    System.gc();
    File file = new File(fileName);
    FileInputStream fis = new FileInputStream(file);
    
    BufferedReader dis = new BufferedReader(new InputStreamReader(fis));
    
    StringBuffer buff = new StringBuffer();
    String line = null;
    while ((line = dis.readLine()) != null) {
      buff.append(line);
    }
    fis.close();
    dis.close();
    return buff.toString();
  }
  
  public static File stringToFile(String data, String fileName, boolean appendToEnd, boolean deleteOnExit)
  {
    File temp = null;
    System.gc();
    try
    {
      temp = new File(fileName);
      if (deleteOnExit) {
        temp.deleteOnExit();
      }
      FileWriter writer = new FileWriter(temp, appendToEnd);
      BufferedWriter out = new BufferedWriter(writer);
      StringTokenizer st = new StringTokenizer(data, "\n");
      String fullLine = null;
      while (st.hasMoreTokens())
      {
        fullLine = st.nextToken();
        if (appendToEnd) {
          out.write(fullLine);
        } else {
          out.write(fullLine);
        }
      }
      out.close();
    }
    catch (IOException localIOException) {}
    return temp;
  }
  
  public static String getBaseUrl(String url)
  {
    int last = url.lastIndexOf('/');
    if (last < 0) {
      return url;
    }
    return url.substring(0, last);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.Util
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class XSLTMap
{
  private File stylesheet;
  
  public XSLTMap(File stylesheet)
  {
    this.stylesheet = stylesheet;
  }
  
  public String applyMap(String datastring)
    throws MappingException
  {
    ByteArrayOutputStream xOutputStream = new ByteArrayOutputStream(1024);
    applyMap(datastring, xOutputStream);
    String XMLText = xOutputStream.toString();
    try
    {
      xOutputStream.close();
    }
    catch (IOException localIOException) {}
    return XMLText;
  }
  
  public void applyMap(String dataString, OutputStream _os)
    throws MappingException
  {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(false);
    try
    {
      DocumentBuilder builder = factory.newDocumentBuilder();
      
      byte[] docBytes = dataString.getBytes();
      
      Document document = builder.parse(new ByteArrayInputStream(docBytes));
      
      TransformerFactory tFactory = TransformerFactory.newInstance();
      StreamSource stylesource = new StreamSource(stylesheet);
      Transformer transformer = tFactory.newTransformer(stylesource);
      DOMSource source = new DOMSource(document);
      
      StreamResult result = new StreamResult(_os);
      transformer.transform(source, result);
      
      transformer.clearParameters();
    }
    catch (SAXException sxe)
    {
      throw new MappingException("Transformer c error:\n" + sxe.getMessage());
    }
    catch (TransformerConfigurationException tce)
    {
      throw new MappingException("Transformer c error:\n" + tce.getMessage());
    }
    catch (TransformerException te)
    {
      throw new MappingException("Transformer error:\n" + te.getMessage());
    }
    catch (ParserConfigurationException pce)
    {
      throw new MappingException("Transformer factory error:\n" + pce.getMessage());
    }
    catch (IOException ioe)
    {
      throw new MappingException("I/O Exception error (probably bad/missing XSL map) :\n" + ioe.getMessage());
    }
    catch (Exception ex)
    {
      throw new MappingException("General exceptioned occured while mapping: " + ex.getMessage());
    }
    Document document;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.XSLTMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc;

public abstract class XmlBasedSource
  implements IJsDocSource
{
  public String toStringObjectTree()
  {
    ElementInfo[] tops = getTopObjects();
    if (tops == null) {
      return "No Top Level Objects Found in " + getClass().getName();
    }
    StringBuffer buff = new StringBuffer();
    buff.append("Top Level Object tree for : " + getClass().getName() + Util.NEW_LINE);
    for (int i = 0; i < tops.length; i++) {
      buff.append(tops[i]);
    }
    return buff.toString();
  }
  
  public String getXsl()
  {
    return "<?xml version=\"1.0\"?> <xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\"></xsl:stylesheet>";
  }
  
  public String getUrl()
  {
    return null;
  }
  
  public String toString()
  {
    return toStringObjectTree();
  }
  
  public String pageToString()
  {
    StringBuffer buff = new StringBuffer();
    String page = "error retrieving page";
    try
    {
      page = Util.retrieveFromUrlFixEncode(getUrl(), false, false);
    }
    catch (Exception ex)
    {
      return "Error retrieving page " + ex.toString();
    }
    buff.append("------------------------- Page ----------------------" + Util.NEW_LINE);
    buff.append(page + Util.NEW_LINE);
    
    buff.append("================================================================================" + Util.NEW_LINE);
    return buff.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.XmlBasedSource
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc.msdn;

import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.wst.jsdt.jsdoc.ElementInfo;
import org.eclipse.wst.jsdt.jsdoc.Util;
import org.eclipse.wst.jsdt.jsdoc.XmlBasedSource;

public class IeFromMsdn
  extends XmlBasedSource
{
  String topUrl = "http://msdn2.microsoft.com/en-us/library/ms533054.aspx";
  boolean useCache = false;
  boolean keepCache = false;
  
  public IeFromMsdn(boolean useCache, boolean keepCache)
  {
    this.useCache = useCache;
    this.keepCache = keepCache;
    ElementInfo.setUseCache(useCache);
    ElementInfo.setKeepCache(keepCache);
  }
  
  public ElementInfo[] getTopObjects()
  {
    String[] allUrls = parseTopObjectPage();
    
    MsdnElement[] parents = new MsdnElement[allUrls.length];
    for (int i = 0; i < allUrls.length; i++) {
      parents[i] = new MsdnElement(allUrls[i]);
    }
    return parents;
  }
  
  private String[] parseTopObjectPage()
  {
    ArrayList allObject = new ArrayList();
    
    String pageText = null;
    try
    {
      pageText = Util.retrieveFromUrl(getUrl(), useCache, keepCache);
    }
    catch (IOException ex)
    {
      ex.printStackTrace();
    }
    String p1 = "<h2>Objects</h2><blockquote>";
    String end = "</blockquote>";
    int i1 = pageText.indexOf(p1);
    if (i1 < 0) {
      return null;
    }
    i1 += p1.length();
    int indexOfEnd = pageText.indexOf(end, i1);
    
    String p2 = "href=\"";
    String p3 = "\"";
    String baseUrl = Util.getBaseUrl(getUrl());
    
    int i2 = 0;
    while ((i2 < indexOfEnd) && (i2 >= 0))
    {
      i2 = pageText.indexOf(p2, i1) + p2.length();
      if (i2 >= indexOfEnd) {
        break;
      }
      int i3 = pageText.indexOf(p3, i2);
      String href = baseUrl + "/" + pageText.substring(i2, i3);
      allObject.add(href);
      i1 = i3 + p3.length();
    }
    return (String[])allObject.toArray(new String[allObject.size()]);
  }
  
  public String getUrl()
  {
    return topUrl;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.jsdoc.msdn.IeFromMsdn
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.jsdoc.msdn;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.wst.jsdt.jsdoc.ElementInfo;
import org.eclipse.wst.jsdt.jsdoc.Util;

public class MsdnElement
  extends ElementInfo
{
  String typeName;
  String[][] parsedParams = null;
  
  public String getJsTypeName()
  {
    if (typeName != null) {
      return typeName;
    }
    switch (getType())
    {
    case 3: 
      String pageText = getPageText();
      String p1 = "<p class=\"clsRef\">Possible Values</p>";
      String end = "</blockquote>";
      int i1 = pageText.indexOf(p1);
      if (i1 < 0) {
        return null;
      }
      i1 += p1.length();
      int indexOfEnd = pageText.indexOf(end, i1);
      String p2 = "<b>";
      String p3 = "</b>";
      
      int i2 = pageText.indexOf(p2, i1) + p2.length();
      
      int i3 = pageText.indexOf(p3, i2);
      if ((i2 > indexOfEnd) || (i3 > indexOfEnd)) {
        return null;
      }
      typeName = pageText.substring(i2, i3);
      break;
    case 5: 
      typeName = "Array";
      break;
    case 2: 
      String pageText = getPageText();
      String p1 = "<p class=\"clsRef\">Return Value</p>";
      String end = "</blockquote>";
      int i1 = pageText.indexOf(p1);
      if (i1 < 0) {
        return null;
      }
      i1 += p1.length();
      int indexOfEnd = pageText.indexOf(end, i1);
      String p2 = "<b>";
      String p3 = "</b>";
      
      int i2 = pageText.indexOf(p2, i1);
      if (i2 < 0) {
        return null;
      }
      i2 += p2.length();
      
      int i3 = pageText.indexOf(p3, i2);
      if ((i2 > indexOfEnd) || (i3 > indexOfEnd)) {
        return null;
      }
      typeName = pageText.substring(i2, i3);
    }
    return typeName;
  }
  
  public String getJsDoc(String parentName)
  {
    StringBuffer jsDoc = new StringBuffer();
    jsDoc.append("/**" + Util.NEW_LINE);
    String dec = "  * ";
    String endDec = Util.NEW_LINE;
    switch (getType())
    {
    case 1: 
    case 4: 
    case 5: 
      if (parentName != null)
      {
        jsDoc.append(dec + "Property " + getName() + endDec);
        jsDoc.append(dec + "@type " + getName() + endDec);
        jsDoc.append(dec + "@return " + getName() + endDec);
        jsDoc.append(dec + "@class " + parentName + endDec);
        jsDoc.append(dec + "@since " + getSince() + endDec);
      }
      else
      {
        jsDoc.append(dec + "Object " + getName() + "()" + endDec);
        jsDoc.append(dec + "@type " + getName() + endDec);
        jsDoc.append(dec + "@super " + getSuperType() + endDec);
        jsDoc.append(dec + "@class " + getName() + endDec);
        jsDoc.append(dec + "@since " + getSince() + endDec);
      }
      break;
    case 2: 
      String superType = getSuperType();
      jsDoc.append(dec + "function " + getName() + "(" + getParamString() + ")" + endDec);
      String[][] params = getParamaters();
      for (int i = 0; i < params.length; i++) {
        jsDoc.append(dec + "@param " + params[i][0] + " " + params[i][1] + endDec);
      }
      if (superType != null) {
        jsDoc.append(dec + "@type " + superType + endDec);
      }
      if (superType != null) {
        jsDoc.append(dec + "@return " + superType + endDec);
      }
      jsDoc.append(dec + "@class " + parentName + endDec);
      jsDoc.append(dec + "@since " + getSince() + endDec);
      break;
    case 3: 
      jsDoc.append(dec + "Property " + getName() + endDec);
      jsDoc.append(dec + "@type " + getSuperType() + endDec);
      jsDoc.append(dec + "@return " + getSuperType() + endDec);
      jsDoc.append(dec + "@class " + parentName + endDec);
      jsDoc.append(dec + "@since " + getSince() + endDec);
    }
    jsDoc.append(dec + "@link " + getUrl() + endDec);
    jsDoc.append("*/" + Util.NEW_LINE);
    return jsDoc.toString();
  }
  
  public String[][] getParamaters()
  {
    if (parsedParams != null) {
      return parsedParams;
    }
    String[][] noParams = new String[0][];
    
    String pageText = getPageText();
    String p1 = "<p class=\"clsRef\">Parameters</p>";
    String end = "</blockquote>";
    int i1 = pageText.indexOf(p1);
    if (i1 < 0)
    {
      parsedParams = noParams;
      return parsedParams;
    }
    i1 += p1.length();
    int indexOfEnd = pageText.indexOf(end, i1);
    
    int paramStart = i1;
    
    ArrayList params = new ArrayList();
    ArrayList types = new ArrayList();
    
    String paramI = "<i>";
    String paramIend = "</i>";
    String p2 = "<b>";
    String p3 = "</b>";
    String paramTypeEendFallback1 = "<td>";
    String paramTypeEendFallback1End = "</td>";
    while (paramStart < indexOfEnd)
    {
      paramStart = pageText.indexOf(paramI, paramStart);
      if ((paramStart < 0) || (paramStart > indexOfEnd)) {
        break;
      }
      paramStart += paramI.length();
      int paramEnd = pageText.indexOf(paramIend, paramStart);
      String paramName = pageText.substring(paramStart, paramEnd);
      
      int typeStart = pageText.indexOf(p2, paramEnd);
      int typeEnd = -1;
      if (typeStart > 0)
      {
        typeStart += p2.length();
        typeEnd = pageText.indexOf(p3, typeStart);
      }
      else
      {
        typeStart = pageText.indexOf(paramTypeEendFallback1, paramEnd + paramI.length()) + paramTypeEendFallback1.length();
        typeEnd = pageText.indexOf(paramTypeEendFallback1End, typeStart);
      }
      String typeName = null;
      try
      {
        typeName = pageText.substring(typeStart, typeEnd);
      }
      catch (RuntimeException localRuntimeException)
      {
        break;
      }
      paramStart = pageText.indexOf(paramTypeEendFallback1End, typeStart);
      if (contains(typeName, "integer")) {
        typeName = "Number";
      }
      params.add(paramName);
      types.add(typeName);
    }
    if (params.size() == 0) {
      return noParams;
    }
    parsedParams = new String[params.size()][2];
    for (int i = 0; i < params.size(); i++)
    {
      parsedParams[i][0] = ((String)params.get(i));
      parsedParams[i][1] = ((String)types.get(i));
    }
    return parsedParams;
  }
  
  public String getSuperType()
  {
    if (getType() == 5) {
      return "Array";
    }
    if (getType() == 4) {
      return "Object";
    }
    if (getType() == 3)
    {
      String jsTypeName = getJsTypeName();
      if (jsTypeName == null) {
        return "Object";
      }
      jsTypeName = jsTypeName.trim();
      if (contains(jsTypeName, "variant")) {
        return "Object";
      }
      if (contains(jsTypeName, "integer")) {
        return "Number";
      }
      return jsTypeName;
    }
    if (getType() == 1) {
      return "Object";
    }
    if (getType() == 2)
    {
      String jsTypeName = getJsTypeName();
      if (jsTypeName == null) {
        return null;
      }
      jsTypeName = jsTypeName.trim();
      if (contains(jsTypeName, "variant")) {
        return "Object";
      }
      if (contains(jsTypeName, "integer")) {
        return "Number";
      }
      return jsTypeName;
    }
    return "Object";
  }
  
  public String getSince()
  {
    return "JScript 5.6";
  }
  
  public String getJsStructure()
  {
    StringBuffer structure = new StringBuffer();
    structure.append(getJsDoc(null) + Util.NEW_LINE);
    ElementInfo[] children = getChildren();
    String myName = getName();
    structure.append("function " + myName + "(){};" + Util.NEW_LINE);
    structure.append(myName + ".prototype= new " + getSuperType() + "();" + Util.NEW_LINE);
    for (int i = 0; i < children.length; i++) {
      structure.append(children[i].getJsStructure(myName));
    }
    return structure.toString();
  }
  
  public String getParamString()
  {
    String[][] params = getParamaters();
    String paramString = "";
    for (int i = 0; i < params.length; i++) {
      paramString = paramString + params[i][0] + (i + 1 < params.length ? "," : "");
    }
    return paramString;
  }
  
  public String getJsStructure(String parent)
  {
    StringBuffer structure = new StringBuffer();
    switch (getType())
    {
    case 3: 
      structure.append(getJsDoc(parent) + Util.NEW_LINE);
      if (!isStatic()) {
        structure.append(parent + ".prototype." + getName() + "=" + getInitializer(getSuperType()) + ";" + Util.NEW_LINE);
      } else {
        structure.append(parent + "." + getName() + "=" + getInitializer(getSuperType()) + ";" + Util.NEW_LINE);
      }
      break;
    case 2: 
      structure.append(getJsDoc(parent) + Util.NEW_LINE);
      if (!isStatic()) {
        structure.append(parent + ".prototype." + getName() + "=function(" + getParamString() + "){};" + Util.NEW_LINE);
      } else {
        structure.append(parent + getName() + "=function(" + getParamString() + "){};" + Util.NEW_LINE);
      }
      break;
    case 1: 
    case 4: 
    case 5: 
      structure.append(getJsDoc(parent) + Util.NEW_LINE);
      if (!isStatic()) {
        structure.append(parent + ".prototype." + getName() + "= new " + getName() + "();" + Util.NEW_LINE);
      } else {
        structure.append(parent + "." + getName() + "= new " + getName() + "();" + Util.NEW_LINE);
      }
      break;
    }
    return structure.toString();
  }
  
  public boolean isStatic()
  {
    return false;
  }
  
  public MsdnElement(String baseUrl, ElementInfo parent)
  {
    super(baseUrl, parent);
  }
  
  public MsdnElement(String baseUrl)
  {
    super(baseUrl, null);
  }
  
  private ElementInfo getMsdnElement(String baseUrl)
  {
    ElementInfo temp = findChild(baseUrl);
    if (temp != null) {
      return temp;
    }
    MsdnElement element = new MsdnElement(baseUrl, this);
    nodes.add(element);
    return element;
  }
  
  public String getName()
  {
    if (name != null) {
      return name;
    }
    String pageText = getPageText();
    if (pageText == null) {
      return null;
    }
    String p1 = "<div class=\"stat\"><strong>&nbsp;";
    
    int i1 = pageText.indexOf(p1) + p1.length();
    
    String p2 = " ";
    
    int i2 = pageText.indexOf(p2, i1);
    name = pageText.substring(i1, i2);
    return name;
  }
  
  public boolean contains(String s1, String searchFor)
  {
    String temp = s1.toLowerCase();
    String temp2 = searchFor.toLowerCase();
    
    return temp.indexOf(temp2) > -1;
  }
  
  public int getType()
  {
    String typeName = null;
    if (type > -1) {
      return type;
    }
    try
    {
      String pageText = getPageText();
      
      String p1 = "<div class=\"stat\"><strong>&nbsp;" + getName();
      
      int i1 = pageText.indexOf(p1) + p1.length();
      
      String p2 = "</strong>";
      
      i2 = pageText.indexOf(p2, i1);
    }
    catch (RuntimeException localRuntimeException)
    {
      int i2;
      return -1;
    }
    try
    {
      int i2;
      int i1;
      String pageText;
      typeName = pageText.substring(i1, i2).trim();
    }
    catch (Exception localException)
    {
      return -1;
    }
    if ((contains(typeName, "object")) || (contains(typeName, "Collection"))) {
      type = 1;
    }
    if (contains(typeName,
1 2

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