diff options
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse')
18 files changed, 0 insertions, 1837 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerLibInitializer.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerLibInitializer.java deleted file mode 100644 index 6b8ade8a..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerLibInitializer.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -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.IJsGlobalScopeContainer; -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"; - //private static final char[][] LIBRARY_FILE_NAMES = { { 'I','n','t','e','r','n','e','t','E','x','p','l','o','r','e','r','.','j','s' } }; - protected static final String PLUGIN_ID = "org.eclipse.wst.jsdt.support.ie"; - - - static class IeLibLocation extends SystemLibraryLocation { - IeLibLocation() { - super(); - } - - - public char[][] getLibraryFileNames() { - return getAllFilesInPluginDirectory(getLibraryPathInPlugin().toString()); - } - - - protected String getPluginId() { - return InternetExplorerLibInitializer.PLUGIN_ID; - } - private static LibraryLocation fInstance; - 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 InternetExplorerLibInitializer.ContainerDescription; - } - - public String getDescription() { - return InternetExplorerLibInitializer.ContainerDescription; - } - - public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project) { - - if(containerPath==null) return null; - /* Dont use the rino image for the individual files */ - String requestedContainerPath = new Path(element).getFileExtension(); - if(requestedContainerPath!=null && requestedContainerPath.equalsIgnoreCase("js")) return null; - - -// char[][] allLibFiles = ( new IeLibLocation()).getLibraryFileNames(); -// for(int i = 0;i<allLibFiles.length;i++) { -// String libName = new String(allLibFiles[i]); -// if (element!=null && requestedContainerPath.equals(libName)) { -// return null; -// } -// } - return ImageDescriptor.createFromFile(this.getClass(),"ie_small.gif"); - //return ImageDescriptor.createFromFile(this.getClass(),"ie_small.gif"); - // System.out.println("Unimplemented method:BasicBrowserLibraryJsGlobalScopeContainerInitializer.getImage"); - //return null; - } - public IPath getPath() { - return new Path(InternetExplorerLibInitializer.CONTAINER_ID); - } - - - /* (non-Javadoc) - * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#getKind() - */ - public int getKind() { - - - return IJsGlobalScopeContainer.K_SYSTEM; } - - - public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project) { - return true; - - - } - - - public String[] containerSuperTypes() { - return new String[] {"window", "object", "array"}; - } - - -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerUILibInitializer.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerUILibInitializer.java deleted file mode 100644 index e6d7ec98..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/InternetExplorerUILibInitializer.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -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; - -/** - * @author childsb - * - */ -public class InternetExplorerUILibInitializer implements IJsGlobalScopeContainerInitializerExtension{ - public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project) { - - if(containerPath==null) return null; - /* Dont use the rino image for the individual files */ - String requestedContainerPath = new Path(element).getFileExtension(); - if(requestedContainerPath!=null && requestedContainerPath.equalsIgnoreCase("js")) return null; - - -// char[][] allLibFiles = ( new IeLibLocation()).getLibraryFileNames(); -// for(int i = 0;i<allLibFiles.length;i++) { -// String libName = new String(allLibFiles[i]); -// if (element!=null && requestedContainerPath.equals(libName)) { -// return null; -// } -// } - return ImageDescriptor.createFromFile(this.getClass(),"ie_small.gif"); - //return ImageDescriptor.createFromFile(this.getClass(),"ie_small.gif"); - // System.out.println("Unimplemented method:BasicBrowserLibraryJsGlobalScopeContainerInitializer.getImage"); - //return null; - } -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/Thumbs.db b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/Thumbs.db Binary files differdeleted file mode 100644 index 4ec14a42..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/Thumbs.db +++ /dev/null diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.JPG b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.JPG Binary files differdeleted file mode 100644 index b04642f8..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.JPG +++ /dev/null diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.gif b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.gif Binary files differdeleted file mode 100644 index aa1c038c..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_logo2.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_small.gif b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_small.gif Binary files differdeleted file mode 100644 index cb729107..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/core/compiler/libraries/ie_small.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.java deleted file mode 100644 index 05f2b6b7..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.java +++ /dev/null @@ -1,20 +0,0 @@ -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";//$NON-NLS-1$
-
- private IEMessages() {
- // Do not instantiate
- }
-
- public static String IELibraryWizardPage_title;
- public static String IELibraryWizardPage_IELibraryAdded;
- public static String IELibraryWizardPage_BrowserSupport;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, IEMessages.class);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.properties b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.properties deleted file mode 100644 index 30cd9b9c..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/IEMessages.properties +++ /dev/null @@ -1,14 +0,0 @@ -###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-IELibraryWizardPage_title=Internet Explorer Library
-IELibraryWizardPage_IELibraryAdded=Internet Explorer Browser (5.0) Library added to Project.\n\n - This library supports JavaScript elements provided by Microsoft's Internet Explorer web browser.
-IELibraryWizardPage_BrowserSupport=Internet Explorer Browser Support
diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/buildpaths/InternetExplorerLibraryWizardPage.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/buildpaths/InternetExplorerLibraryWizardPage.java deleted file mode 100644 index f4ae236e..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/internal/ui/wizards/buildpaths/InternetExplorerLibraryWizardPage.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.internal.ui.wizards.buildpaths; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -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; - -/** - * Wizard page for adding IE library support to the project. - */ -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, SWT.NONE); - composite.setFont(parent.getFont()); - DialogField field = new DialogField(); - - field.setLabelText(IEMessages.IELibraryWizardPage_IELibraryAdded); - LayoutUtil.doDefaultLayout(composite, new DialogField[] {field }, false, SWT.DEFAULT, SWT.DEFAULT); - Dialog.applyDialogFont(composite); - setControl(composite); - setDescription(IEMessages.IELibraryWizardPage_BrowserSupport); - } - - public void initialize(IJavaScriptProject project, IIncludePathEntry[] currentEntries) { - // nothing to initialize - } - - public IIncludePathEntry[] getNewContainers() { - IIncludePathEntry library = JavaScriptCore.newContainerEntry( new Path(CONTAINER_ID)); - return new IIncludePathEntry[] {library}; - } -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/ElementInfo.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/ElementInfo.java deleted file mode 100644 index cba5fe4b..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/ElementInfo.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.jsdoc; - -import java.io.IOException; -import java.util.ArrayList; - -/** - * - */ -/** - * @author childsb - * - */ -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; - boolean equal = other.getUrl().trim().equalsIgnoreCase(this.getUrl().trim()); -// boolean equal = other.getName().equals(this.getName()) && -// other.getType()==this.getType() && -// ( -// other.getParent().getName().equals(this.getParent().getName()) && -// other.getParent().getType()== (this.getParent().getType()) || -// other.getParent()==null && this.getParent()==null -// ); - return equal; - } catch (Exception ex) {} - - 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(); - - //found.add(this); - for(int i = 0;i<children.length;i++) { - - if(children[i].getType() == COLLECTION || children[i].getType()==EVENT) { - children[i].clearVisit(); - found.add(children[i]); - } - } - - return (ElementInfo[])found.toArray(new ElementInfo[found.size()]); - } - public void clearVisit() { - visited=false; - } - - { - nodes = new ArrayList(); - } - - public ElementInfo(String baseUrl,ElementInfo parent) { - this.baseUrl = baseUrl; - this.parent = parent; - //addNode(this); - 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 this.parent; - } - - public ElementInfo[] getChildren() { - return this.children; - } - - public boolean hasChildren() { return this.children!=null && this.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 ElementInfo.PROPERTY: - return "Property"; - case ElementInfo.METHOD: - return "Method"; - case ElementInfo.CLASS: - 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("translation : " + translation + "\n"); - 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 ex) { - - } - return null; -// if(pageText!=null) return pageText; -// try { -// pageText = Util.retrieveFromUrl(getUrl()); -// } catch (IOException ex) { -// // TODO Auto-generated catch block -// //ex.printStackTrace(); -// } -// return pageText; - } - - 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; } -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/GenerateJsDoc.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/GenerateJsDoc.java deleted file mode 100644 index caf6a557..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/GenerateJsDoc.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.jsdoc; - -import java.io.File; -import java.util.ArrayList; - -import org.eclipse.wst.jsdt.jsdoc.msdn.IeFromMsdn; - -// import com.sun.org.apache.xpath.internal.FoundIndex; - -/** - * - */ -/** - * @author childsb - * - */ -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 = SKIP_FILE; - static final boolean CLEAR_CACHE_ON_EXIT = false; - static final boolean USE_CACHE=true; - static final IJsDocSource source = new IeFromMsdn(USE_CACHE, !CLEAR_CACHE_ON_EXIT); - static final String JS_PREFIX="IE_"; - - - public static String getOutFile(String fileName) { - File outDir = new File(outDirectory); - 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; - //allFoundNodes = new ArrayList(); - for(int i = 0;i<tops.length;i++) { - String fileName = getOutFile(JS_PREFIX + tops[i].getName().toLowerCase().trim() + ".js"); - //String fileName = getOutFile(outFileName); - File theFile = new File(fileName); - switch(LIB_FILE_ACTION) { - case SKIP_FILE: - - 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(); - continue; - } - break; - case REPLACE_FILE: - { - - if(theFile.exists()) theFile.delete(); - break; - } - case APPEND: - - - } - 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()]); - } - - } - - - - -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/IJsDocSource.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/IJsDocSource.java deleted file mode 100644 index b3e176c0..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/IJsDocSource.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.jsdoc; -/** - * - */ -/** - * @author childsb - * - */ -public interface IJsDocSource { - - - public ElementInfo[] getTopObjects(); - - -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/MappingException.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/MappingException.java deleted file mode 100644 index a4e372b3..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/MappingException.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.wst.jsdt.jsdoc; -/* - * Created on Apr 24, 2006 - * - * Bradley Childs (childsb@us.ibm.com) - * Copyright IBM 2006. - * - * Error thrown for any mapping related issues. - */ -public class MappingException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public MappingException() { - super(); - } - - public MappingException(String ex) { - super(ex); - } -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/Util.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/Util.java deleted file mode 100644 index 6c0a7462..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/Util.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -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.net.URL; -import java.net.URLConnection; -import java.util.StringTokenizer; - -/** - * - */ -/** - * @author childsb - * - */ -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(BUFFER_DIR); - 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 e) { - } - if (text != null) { - // System.out.println("Found file in cache.."); - 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) - pageText.append(inputLine); - in.close(); - if (useCache) { - if (VERBOSE) 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"; - /* Changes all UTF-8 and UTF-16 encoding to stated encoding string */ - 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 { - // Create temp file. - temp = File.createTempFile(System.currentTimeMillis() + "_tmp", ".tmp"); - // Delete temp file when program exits. - temp.deleteOnExit(); - // Write to temp file - BufferedWriter out = new BufferedWriter(new FileWriter(temp)); - out.write(data); - out.close(); - } catch (IOException e) { - } - return temp; - } - - public static String fileToString(String fileName) throws IOException { - System.gc(); - File file = new File(fileName); - FileInputStream fis = new FileInputStream(file); - //BufferedInputStream bis = null; - BufferedReader dis = new BufferedReader(new InputStreamReader(fis)); - // dis.available() returns 0 if the file does not have more lines. - StringBuffer buff = new StringBuffer(); - String line = null; - while ((line = dis.readLine()) != null) { - buff.append(line); - } - // dispose all the resources after using them. - 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 { - // Create temp file. - temp = new File(fileName); - if(deleteOnExit) temp.deleteOnExit(); - // Delete temp file when program exits. - // temp.deleteOnExit(); - // Write to temp file - 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 /* + Util.NEW_LINE */); - } else { - out.write(fullLine /* + Util.NEW_LINE */); - } - } - out.close(); - } catch (IOException e) { - } - return temp; - } - - public static String getBaseUrl(String url) { - int last = url.lastIndexOf('/'); - if (last < 0) return url; - return url.substring(0, last); - } -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XSLTMap.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XSLTMap.java deleted file mode 100644 index 9a446281..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XSLTMap.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.eclipse.wst.jsdt.jsdoc; -/* - * Created on Apr 24, 2006 - * - * Bradley Childs (childsb@us.ibm.com) - * Copyright IBM 2006. - * - * XSL Mapper. Very simple, takes a few things as input and translates them - * via the XSL file defined. - */ - -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); // Buffer size- trivial - applyMap(datastring, xOutputStream); - String XMLText = xOutputStream.toString(); - try{ - xOutputStream.close(); - }catch(IOException ex){ - // I ran into a door. I'm so clumsy. - } - return XMLText; - } - - public void applyMap(String dataString, OutputStream _os) throws MappingException { - Document document; - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(false); - - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - - byte[] docBytes = dataString.getBytes(); - - document = builder.parse(new ByteArrayInputStream(docBytes)); - // Use a Transformer for output - TransformerFactory tFactory = TransformerFactory.newInstance(); - StreamSource stylesource = new StreamSource(stylesheet); - Transformer transformer = tFactory.newTransformer(stylesource); - DOMSource source = new DOMSource(document); - /* Need to get an output stream to a string */ - StreamResult result = new StreamResult(_os); - transformer.transform(source, result); - - /* close things */ - transformer.clearParameters(); - - - - } catch (SAXException sxe) { - throw new MappingException("Transformer c error:\n" + sxe.getMessage()); - } catch (TransformerConfigurationException tce) { - // Error generated by the parser - throw new MappingException("Transformer c error:\n" + tce.getMessage()); - } catch (TransformerException te) { - // Error generated by the parser - throw new MappingException("Transformer error:\n" + te.getMessage()); - } catch (ParserConfigurationException pce) { - // Parser with specified options can't be built - throw new MappingException("Transformer factory error:\n" + pce.getMessage()); - } catch (IOException ioe) { - // I/O error (probably corrupt DTD) - 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()); - } - - - } - -// public static void main(String argv[]) { -// if (argv.length != 2) { -// System.err.println("Usage: java Stylizer stylesheet xmlfile"); -// System.exit(1); -// } -// File stylesheet = new File(argv[0]); -// File datafile = new File(argv[1]); -// XSLTMap t = new XSLTMap(stylesheet); -// String dataString = ""; -// //System.out.println(t.applyMap(dataString)); -// -// } - - -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XmlBasedSource.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XmlBasedSource.java deleted file mode 100644 index 6fc90357..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/XmlBasedSource.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.jsdoc; - -/** - * - */ -/** - * @author childsb - * - */ -public abstract class XmlBasedSource implements IJsDocSource{ - - - public String toStringObjectTree() { - ElementInfo[] tops = getTopObjects(); - if(tops==null) return "No Top Level Objects Found in " + this.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 Util.XSL_HEADER + "" + Util.XSL_FOOTER; - } - - 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("------------------------- Translated Page ----------------------\n" ); -// File tempTran = Util.dataToTempFile(getXsl()); -// try { -// buff.append(Util.applyTranslation(page, tempTran) + "\n"); -// } catch (Exception ex) { -// // TODO Auto-generated catch block -// buff.append(ex.toString() + "\n"); -// } - buff.append("================================================================================" + Util.NEW_LINE ); - return buff.toString(); - } -} - - diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/IeFromMsdn.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/IeFromMsdn.java deleted file mode 100644 index f3f3c2f5..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/IeFromMsdn.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -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; - -/** - * - */ -/** - * @author childsb - * - */ -public class IeFromMsdn extends XmlBasedSource { - - //String topUrl = "http://msdn2.microsoft.com/en-us/library/ms535873.aspx#"; - 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) { - // TODO Auto-generated catch block - ex.printStackTrace(); - } - - String p1 = "<h2>Objects</h2><blockquote>"; - String end = "</blockquote>"; - int i1 = pageText.indexOf(p1); - - if(i1<0) return null; - - i1 = i1 + p1.length() ; - int indexOfEnd = pageText.indexOf(end, i1); - - - - String p2 = "href=\""; - String p3 = "\""; - String baseUrl = Util.getBaseUrl(getUrl()); - - //System.out.println(pageText.substring(i1, indexOfEnd)); - 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; - } - -} diff --git a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/MsdnElement.java b/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/MsdnElement.java deleted file mode 100644 index 21585906..00000000 --- a/bundles/org.eclipse.wst.jsdt.support.ie/src/org/eclipse/wst/jsdt/jsdoc/msdn/MsdnElement.java +++ /dev/null @@ -1,703 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.wst.jsdt.jsdoc.msdn; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.wst.jsdt.jsdoc.ElementInfo; -import org.eclipse.wst.jsdt.jsdoc.Util; - -/** - * @author childsb - * - * parsers msdn web pages into a JSDoc and JavaScript prototype structure for library purposes. - * - */ -public class MsdnElement extends ElementInfo{ - - - String typeName; - String[][] parsedParams = null; - - - public String getJsTypeName() { - if(typeName!=null) return typeName; - - switch(getType()) { - case ElementInfo.PROPERTY: - 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 = i1 + p1.length() ; - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "<b>"; - String p3 = "</b>"; - - - //System.out.println(pageText.substring(i1, indexOfEnd)); - 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 ElementInfo.COLLECTION: - typeName="Array"; - break; - case METHOD: - pageText = getPageText(); - p1 = "<p class=\"clsRef\">Return Value</p>"; - end = "</blockquote>"; - i1 = pageText.indexOf(p1); - - if(i1<0) return null; - - i1 = i1 + p1.length() ; - indexOfEnd = pageText.indexOf(end, i1); - p2 = "<b>"; - p3 = "</b>"; - - - //System.out.println(pageText.substring(i1, indexOfEnd)); - i2 = pageText.indexOf(p2, i1); - if(i2<0) return null; - i2 = i2+ p2.length(); - - i3 = pageText.indexOf(p3,i2); - if(i2>indexOfEnd || i3>indexOfEnd) return null; - - typeName = pageText.substring(i2,i3); - break; - - } - 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 COLLECTION: - case EVENT: - case ElementInfo.CLASS: - 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); - break; - } - 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 ElementInfo.METHOD: - 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 ElementInfo.PROPERTY: - 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); - break; - } - 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 = 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 =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 = 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 ex) { - // TODO Auto-generated catch block - //ex.printStackTrace(); - break; - } - - paramStart = pageText.indexOf(paramTypeEendFallback1End, typeStart); - //paramStart = typeEnd; - - if(contains(typeName, "integer")) typeName = "Number"; - - params.add(paramName); - types.add(typeName); - } - - //int paramTypeStart = i1; - - -// while(paramTypeStart<indexOfEnd) { -// paramTypeStart = pageText.indexOf(p2, paramTypeStart); -// if(paramTypeStart<0) break; -// paramTypeStart =paramTypeStart + p2.length(); -// int paramEnd = pageText.indexOf(p3, paramTypeStart); -// String paramName = pageText.substring(paramTypeStart,paramEnd); -// types.add(paramName.trim()); -// } - - 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()==COLLECTION) return "Array"; - if(getType()==EVENT) return "Object"; - if(getType()==PROPERTY) { - 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()==CLASS) { - - return "Object"; - - } - if(getType()==METHOD) { - 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++) { - - //if( !children[i].visit()) - 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 ElementInfo.PROPERTY: - 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 ElementInfo.METHOD: - 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 CLASS: - case EVENT: - case COLLECTION: - 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); - } - //System.out.println("adding complex structure : \n" + structure.toString()); - 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(super.name!=null) return super.name; - String pageText = getPageText(); - if(pageText==null) return null; - - String p1 = "<div class=\"stat\"><strong> "; - - int i1 = pageText.indexOf(p1) + p1.length() ; - - String p2 = " "; - - int i2 = pageText.indexOf(p2,i1); - super.name = pageText.substring(i1,i2); - return super.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(super.type>-1) return super.type; - - String pageText; - int i1; - int i2; - try { - pageText = getPageText(); - - String p1 = "<div class=\"stat\"><strong> " + getName(); - - i1 = pageText.indexOf(p1) + p1.length(); - - String p2 = "</strong>"; - - i2 = pageText.indexOf(p2,i1); - } catch (RuntimeException ex) { - return -1; - } - - - - try { - typeName = pageText.substring(i1,i2).trim(); - } catch (Exception ex) { - return -1; - // TODO Auto-generated catch block - //ex.printStackTrace(); - } - - if(contains(typeName,("object")) || contains(typeName,"Collection")){ - super.type = ElementInfo.CLASS; - } - - if(contains(typeName,"Property")){ - super.type = ElementInfo.PROPERTY; - } - - if(contains(typeName,"Method")){ - super.type = ElementInfo.METHOD; - } - if(contains(typeName,"Event")){ - super.type = ElementInfo.EVENT; - } - if(contains(typeName,"Collection")){ - super.type = ElementInfo.COLLECTION; - } - return super.type; - } - - public String getTypeName() { - switch(getType()) { - case ElementInfo.EVENT: - return "Event"; - case ElementInfo.COLLECTION: - return "Collection"; - default: - return super.getTypeName(); - } - } - - public ElementInfo[] getChildren() { - if(super.children!=null && super.children.length!=0) return super.children; - ArrayList children = new ArrayList(); - - ElementInfo[] elemnts; - - elemnts = getProperties(); - children.addAll(Arrays.asList(elemnts)); - if(DEBUG) { - System.out.println("Found the following in getProperties()"); - for(int i = 0;i<elemnts.length;i++) { - String name = elemnts[i].getName(); - System.out.println("\t" + name); - } - } - elemnts =getMethods(); - children.addAll(Arrays.asList(elemnts)); - - if(DEBUG) { - System.out.println("Found the following in getMethods()"); - for(int i = 0;i<elemnts.length;i++) { - String name = elemnts[i].getName(); - System.out.println("\t" + name); - } - } - elemnts =getObjects(); - children.addAll(Arrays.asList(elemnts)); - if(DEBUG) { - System.out.println("Found the following in getObjects()"); - for(int i = 0;i<elemnts.length;i++) { - String name = elemnts[i].getName(); - System.out.println("\t" + name); - } - } - elemnts =getEvents(); - children.addAll(Arrays.asList(elemnts)); - - if(DEBUG) { - System.out.println("Found the following in getEvents()"); - for(int i = 0;i<elemnts.length;i++) { - String name = elemnts[i].getName(); - System.out.println("\t" + name); - } - } - elemnts =getCollections(); - children.addAll(Arrays.asList(elemnts)); - if(DEBUG) { - System.out.println("Found the following in getCollections()"); - for(int i = 0;i<elemnts.length;i++) { - String name = elemnts[i].getName(); - System.out.println("\t" + name); - } - } - super.children = (ElementInfo[])children.toArray(new ElementInfo[children.size()]); - - - return super.children; - } - - - - public boolean hasChildren() { - ElementInfo[] children = getChildren(); - return children!=null && children.length>0; - } - - public ElementInfo[] getProperties() { - ArrayList foundProps = new ArrayList(); - String baseUrl = getBaseUrl(); - String pageText = getPageText(); - String p1 = "<tr><th>Property</th><th>Description</th></tr>"; - String end = "</table>"; - int i1 = pageText.indexOf(p1); - - if(i1<0) { - p1 = "<th>Attribute</th><th>Property</th><th>Description</th>"; - i1 = pageText.indexOf(p1); - } - if(i1<0) { - //System.out.println("No properties"); - return new ElementInfo[0]; - } - i1 = i1 + p1.length() ; - - - - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "href=\""; - int i2 = i1; - String p3 = "\""; - while(i2<indexOfEnd) { - i2 = pageText.indexOf(p2,i2) + p2.length(); - - int i3 = pageText.indexOf(p3,i2); - String urlName = pageText.substring(i2,i3); - - - - ElementInfo info = getMsdnElement(baseUrl + "/" + urlName); - if(!foundProps.contains(info)) foundProps.add(info); - } - return (ElementInfo[])foundProps.toArray(new ElementInfo[foundProps.size()]); - } - - public ElementInfo[] getMethods() { - - ArrayList foundProps = new ArrayList(); - String baseUrl = getBaseUrl(); - String pageText = getPageText(); - String p1 = "<tr><th>Method</th><th>Description</th></tr>"; - String end = "</table>"; - int i1 = pageText.indexOf(p1); - - if(i1<0) { - //System.out.println("no methods"); - return new ElementInfo[0]; - } - - i1 = i1 + p1.length() ; - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "href=\""; - int i2 = i1; - String p3 = "\""; - while(i2<indexOfEnd) { - i2 = pageText.indexOf(p2,i2) + p2.length(); - if(i2>indexOfEnd) break; - int i3 = pageText.indexOf(p3,i2); - String urlName = pageText.substring(i2,i3); - - - ElementInfo info = getMsdnElement(baseUrl + "/" + urlName); - if(!foundProps.contains(info)) foundProps.add(info); - } - return (ElementInfo[])foundProps.toArray(new ElementInfo[foundProps.size()]); - } - - public ElementInfo[] getObjects() { - ArrayList foundProps = new ArrayList(); - String baseUrl = getBaseUrl(); - String pageText = getPageText(); - String p1 = "<tr><th>Object</th><th>Description</th></tr>"; - String end = "</table>"; - int i1 = pageText.indexOf(p1); - if(i1<0) { - p1 = "<tr><th>Element</th><th>Object</th><th>Description</th>"; - i1 = pageText.indexOf(p1); - } - - if(i1<0) { - //System.out.println("no Objects"); - return new ElementInfo[0]; - } - - i1 = i1 + p1.length() ; - - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "href=\""; - int i2 = i1; - String p3 = "\""; - while(i2<indexOfEnd) { - i2 = pageText.indexOf(p2,i2) + p2.length(); - if(i2>indexOfEnd) break; - int i3 = pageText.indexOf(p3,i2); - String urlName = pageText.substring(i2,i3); - - - ElementInfo info = getMsdnElement(baseUrl + "/" + urlName); - //System.out.println("Adding object: " + baseUrl + "/" + urlName); - if(!foundProps.contains(info)) { - //String objectName = info.getName(); - //System.out.println("Adding " + objectName); - foundProps.add(info); - } - } - return (ElementInfo[])foundProps.toArray(new ElementInfo[foundProps.size()]); - } - - public ElementInfo[] getEvents() { - - ArrayList foundProps = new ArrayList(); - String baseUrl = getBaseUrl(); - String pageText = getPageText(); - String p1 = "<tr><th>Event</th><th>Description</th></tr>"; - String end = "</table>"; - int i1 = pageText.indexOf(p1); - - if(i1<0) { - //System.out.println("No events"); - return new ElementInfo[0]; - } - - i1 = i1 + p1.length() ; - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "href=\""; - int i2 = i1; - String p3 = "\""; - while(i2<indexOfEnd) { - i2 = pageText.indexOf(p2,i2) + p2.length(); - if(i2>indexOfEnd) break; - int i3 = pageText.indexOf(p3,i2); - String urlName = pageText.substring(i2,i3); - - - ElementInfo info = getMsdnElement(baseUrl + "/" + urlName); - - if(!foundProps.contains(info)) foundProps.add(info); - } - return (ElementInfo[])foundProps.toArray(new ElementInfo[foundProps.size()]); - } - - public ElementInfo[] getCollections() { - - ArrayList foundProps = new ArrayList(); - String baseUrl = getBaseUrl(); - String pageText = getPageText(); - String p1 = "<tr><th>Collection</th><th>Description</th></tr>"; - String end = "</table>"; - int i1 = pageText.indexOf(p1); - if(i1<0) { - //System.out.println("No Collections"); - return new ElementInfo[0]; - } - i1 = i1 + p1.length() ; - int indexOfEnd = pageText.indexOf(end, i1); - String p2 = "href=\""; - int i2 = i1; - String p3 = "\""; - while(i2<indexOfEnd) { - i2 = pageText.indexOf(p2,i2) + p2.length(); - if(i2>indexOfEnd) break; - int i3 = pageText.indexOf(p3,i2); - String urlName = pageText.substring(i2,i3); - - - ElementInfo info = getMsdnElement(baseUrl + "/" + urlName); - - if(!foundProps.contains(info)) foundProps.add(info); - } - return (ElementInfo[])foundProps.toArray(new ElementInfo[foundProps.size()]); - } - - private static String getInitializer(String className) { - if(className.trim().equalsIgnoreCase("Integer")) return "0"; - if(className.trim().equalsIgnoreCase("Boolean")) return "false"; - if(className.trim().equalsIgnoreCase("String")) return "\"\""; - if(className.trim().equalsIgnoreCase("Number")) return "0"; - - return "new " + className + "()"; - - - } - - public String toString() { - if(name!=null) return name + " URL " + baseUrl; - return baseUrl; - } -} |