+ initial contribution of core, tcl, ruby source.
diff --git a/core/features/org.eclipse.dltk.core-feature/.project b/core/features/org.eclipse.dltk.core-feature/.project
new file mode 100644
index 0000000..8d17f8e
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.core-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/features/org.eclipse.dltk.core-feature/build.properties b/core/features/org.eclipse.dltk.core-feature/build.properties
new file mode 100644
index 0000000..fb42383
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/build.properties
@@ -0,0 +1,22 @@
+#/**
+# * <copyright>
+# *
+# * Copyright (c) 2005 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: build.properties,v 1.1 2007/02/22 08:40:00 asobolev Exp $
+# */
+bin.includes = feature.xml,\
+ eclipse_update_120.jpg,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
+root=rootfiles
diff --git a/core/features/org.eclipse.dltk.core-feature/eclipse_update_120.jpg b/core/features/org.eclipse.dltk.core-feature/eclipse_update_120.jpg
new file mode 100644
index 0000000..68e3e02
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/eclipse_update_120.jpg
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/epl-v10.html b/core/features/org.eclipse.dltk.core-feature/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/feature.properties b/core/features/org.eclipse.dltk.core-feature/feature.properties
new file mode 100644
index 0000000..d83030c
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/feature.properties
@@ -0,0 +1,145 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2005 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: feature.properties,v 1.1 2007/02/22 08:40:00 asobolev Exp $
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+# This file contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Dynamic Languages Toolkit (DLTK) Core
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse.org
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Dynamic Languages Toolkit (DLTK) Updates
+
+# "description" property - description of the feature
+description=Dynamic Languages Toolkit Core API.
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+January 28, 2004\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments\n\
+("Fragments"), and features ("Features"). A Feature is a bundle of one or\n\
+more Plug-ins and/or Fragments and associated material. Files named\n\
+"feature.xml" may contain a list of the names and version numbers of the\n\
+Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments\n\
+are located in directories named "plugins" and Features are located in\n\
+directories named "features".\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Subdirectories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE CPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n
+########### end of license property ##########################################
diff --git a/core/features/org.eclipse.dltk.core-feature/feature.xml b/core/features/org.eclipse.dltk.core-feature/feature.xml
new file mode 100644
index 0000000..fe9c130
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/feature.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.dltk.core"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName"
+ image="eclipse_update_120.jpg">
+
+ <description url="http://www.eclipse.org/dltk">
+ %description
+ </description>
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2005, 2006 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
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/technology/dltk/updates/"/>
+ <discovery label="%updateSiteName" url="http://download.eclipse.org/technology/dltk/updates/"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime" version="3.3.0" match="compatible"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.dltk.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.debug"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.debug.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.launching"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.console"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.console.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/core/features/org.eclipse.dltk.core-feature/license.html b/core/features/org.eclipse.dltk.core-feature/license.html
new file mode 100644
index 0000000..3259fb9
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/license.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>January 28, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<p>Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features"). A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments are located in directories
+ named "plugins" and Features are located in directories named "features".</p>
+
+<p>Features may also include other Features ("Included Features"). Files named "feature.xml" may contain a list of the names and version numbers of Included Features.</p>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Subdirectories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties".
+Such Abouts, Feature Licenses and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+</body>
+</html>
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/build.properties b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/build.properties
new file mode 100644
index 0000000..5e00b63
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/build.properties
@@ -0,0 +1,23 @@
+#/**
+# * <copyright>
+# *
+# * Copyright (c) 2005 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: build.properties,v 1.1 2007/02/22 08:39:59 asobolev Exp $ build.properties,v 1.1 2005/11/25 20:30:36 cdamus Exp $
+# */
+bin.includes = epl-v10.html,\
+ eclipse_update_120.jpg,\
+ feature.properties,\
+ feature.xml,\
+ license.html
+root=rootfiles
+generate.feature@org.eclipse.dltk.core.source=org.eclipse.dltk.core
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.gif b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.gif
new file mode 100644
index 0000000..bdc2912
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.png b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.png
new file mode 100644
index 0000000..7397524
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.gif b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.gif
new file mode 100644
index 0000000..e6ad7cc
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.png b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.png
new file mode 100644
index 0000000..568fac1
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse32.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.gif b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.gif
new file mode 100644
index 0000000..501ab99
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.png b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.png
new file mode 100644
index 0000000..b60ab3c
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse48.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_lg.gif b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_lg.gif
new file mode 100644
index 0000000..bf8b872
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_lg.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_update_120.jpg b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/eclipse_update_120.jpg
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/epl-v10.html b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/epl-v10.html
new file mode 100644
index 0000000..cb1073a
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/epl-v10.html
@@ -0,0 +1,304 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+
+ }
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang="EN-US" style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.properties b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.properties
new file mode 100644
index 0000000..f3c04a7
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.properties
@@ -0,0 +1,147 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2005 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: feature.properties,v 1.1 2007/02/22 08:39:59 asobolev Exp $
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+# This file contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
+
+# "featureName" property - name of the feature
+featureName=Dynamic Languages Toolkit (DLTK) Core SDK
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse.org
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Eclipse.org update site
+
+# "description" property - description of the feature
+description=Binaries and API documentation and source zips for DLTK.
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+January 28, 2004\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments\n\
+("Fragments"), and features ("Features"). A Feature is a bundle of one or\n\
+more Plug-ins and/or Fragments and associated material. Files named\n\
+"feature.xml" may contain a list of the names and version numbers of the\n\
+Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments\n\
+are located in directories named "plugins" and Features are located in\n\
+directories named "features".\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Subdirectories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE CPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n
+########### end of license property ##########################################
+
+updateSiteName=Dynamic Languages Toolkit (DLTK) Updates
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.xml b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.xml
new file mode 100644
index 0000000..5ddb951
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/feature.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.dltk.core.sdk"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName"
+ image="eclipse_update_120.jpg">
+
+ <description>
+ %description
+ </description>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/technology/dltk/updates/"/>
+ <discovery label="%updateSiteName" url="http://download.eclipse.org/technology/dltk/updates/"/>
+ </url>
+
+ <includes
+ id="org.eclipse.dltk.core"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.dltk.core.source"
+ version="0.0.0"/>
+
+</feature>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/license.html b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/license.html
new file mode 100644
index 0000000..74122b2
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java<sup>TM</sup> ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/epl-v10.html b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/epl-v10.html
new file mode 100644
index 0000000..cb1073a
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/epl-v10.html
@@ -0,0 +1,304 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+
+ }
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang="EN-US" style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/notice.html b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/notice.html
new file mode 100644
index 0000000..74122b2
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/org.eclipse.dltk.core.sdk/rootfiles/notice.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java<sup>TM</sup> ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/core/features/org.eclipse.dltk.core-feature/rootfiles/epl-v10.html b/core/features/org.eclipse.dltk.core-feature/rootfiles/epl-v10.html
new file mode 100644
index 0000000..cb1073a
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/rootfiles/epl-v10.html
@@ -0,0 +1,304 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+
+ }
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang="EN-US" style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/rootfiles/notice.html b/core/features/org.eclipse.dltk.core-feature/rootfiles/notice.html
new file mode 100644
index 0000000..74122b2
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/rootfiles/notice.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java<sup>TM</sup> ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/build.properties b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/build.properties
new file mode 100644
index 0000000..01b0213
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/build.properties
@@ -0,0 +1,5 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ eclipse_update_120.jpg,\
+ license.html
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse.gif
new file mode 100644
index 0000000..bdc2912
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse_update_120.jpg b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/eclipse_update_120.jpg
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/epl-v10.html b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/epl-v10.html
new file mode 100644
index 0000000..cb1073a
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/epl-v10.html
@@ -0,0 +1,304 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+
+ }
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang="EN-US" style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/feature.properties b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/feature.properties
new file mode 100644
index 0000000..f0297fc
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/feature.properties
@@ -0,0 +1,147 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2006 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: feature.properties,v 1.1 2007/02/22 08:40:16 asobolev Exp $
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+# This file contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Dynamic Languages Toolkit (DLTK) Core Source
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse.org
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Eclipse.org update site
+
+# "description" property - description of the feature
+description=Dynamic Languages Toolkit Core. (source code)
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
+January 28, 2004\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse.org CVS\n\
+repository ("Repository") in CVS modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments\n\
+("Fragments"), and features ("Features"). A Feature is a bundle of one or\n\
+more Plug-ins and/or Fragments and associated material. Files named\n\
+"feature.xml" may contain a list of the names and version numbers of the\n\
+Plug-ins and/or Fragments associated with a Feature. Plug-ins and Fragments\n\
+are located in directories named "plugins" and Features are located in\n\
+directories named "features".\n\
+\n\
+Features may also include other Features ("Included Features"). Files named\n\
+"feature.xml" may contain a list of the names and version numbers of\n\
+Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Subdirectories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Eclipse Update Manager, you must agree to a license ("Feature Update\n\
+License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties". Such Abouts,\n\
+Feature Licenses and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your\n\
+use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE CPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use,\n\
+and re-export of encryption software, to see if this is permitted.\n
+########### end of license property ##########################################
+
+updateSiteName=Dynamic Languages Toolkit (DLTK) Updates
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/license.html b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/license.html
new file mode 100644
index 0000000..74122b2
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplateFeature/license.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java<sup>TM</sup> ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.html b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.html
new file mode 100644
index 0000000..4c99086
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>February 24, 2005</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.ini b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.ini
new file mode 100644
index 0000000..6ae9bf8
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.ini
@@ -0,0 +1,15 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=eclipse32.png
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.mappings b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.mappings
new file mode 100644
index 0000000..bddaab4
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=@build@
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.properties b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.properties
new file mode 100644
index 0000000..c451dff
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/about.properties
@@ -0,0 +1,46 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2006 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: about.properties,v 1.1 2007/02/22 08:40:23 asobolev Exp $
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+# about.properties
+# contains externalized strings for about.ini
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# fill-ins are supplied by about.mappings
+# This file should be translated.
+
+featureName=Dynamic Languages Toolkit (DLTK) Core Source
+
+featureText=Dynamic Languages Toolkit (DLTK) Core Source\n\
+Version: {featureVersion}\n\
+Build id: {0}\n\
+\n\
+(c) Copyright IBM and others. 2002, 2007. All rights reserved.\n\
+\n\
+Visit http://www.eclipse.org/dltk
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/build.properties b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/build.properties
new file mode 100644
index 0000000..e09db2a
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/build.properties
@@ -0,0 +1,10 @@
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ eclipse32.gif,\
+ src/,\
+ META-INF/
+sourcePlugin = true
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.gif
new file mode 100644
index 0000000..bdc2912
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.png b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.png
new file mode 100644
index 0000000..7397524
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse24.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse24.gif
new file mode 100644
index 0000000..fbb1d47
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse24.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.gif
new file mode 100644
index 0000000..e6ad7cc
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.png b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.png
new file mode 100644
index 0000000..568fac1
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse32.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.gif
new file mode 100644
index 0000000..501ab99
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.png b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.png
new file mode 100644
index 0000000..b60ab3c
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse48.png
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse_lg.gif b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse_lg.gif
new file mode 100644
index 0000000..bf8b872
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/eclipse_lg.gif
Binary files differ
diff --git a/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/plugin.properties b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/plugin.properties
new file mode 100644
index 0000000..a4a213f
--- /dev/null
+++ b/core/features/org.eclipse.dltk.core-feature/sourceTemplatePlugin/plugin.properties
@@ -0,0 +1,33 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2002, 2006 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 - Initial API and implementation
+# *
+# * </copyright>
+# *
+# * $Id: plugin.properties,v 1.1 2007/02/22 08:40:23 asobolev Exp $
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName=Dynamic Languages Toolkit (DLTK) Core Source
+providerName=Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/core/features/org.eclipse.dltk.runtime-feature/.cvsignore b/core/features/org.eclipse.dltk.runtime-feature/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/features/org.eclipse.dltk.runtime-feature/.project b/core/features/org.eclipse.dltk.runtime-feature/.project
new file mode 100644
index 0000000..0feb2f3
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.runtime-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/features/org.eclipse.dltk.runtime-feature/build.properties b/core/features/org.eclipse.dltk.runtime-feature/build.properties
new file mode 100644
index 0000000..39b0777
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/build.properties
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
diff --git a/core/features/org.eclipse.dltk.runtime-feature/epl-v10.html b/core/features/org.eclipse.dltk.runtime-feature/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/features/org.eclipse.dltk.runtime-feature/feature.properties b/core/features/org.eclipse.dltk.runtime-feature/feature.properties
new file mode 100644
index 0000000..dc139ee
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/feature.properties
@@ -0,0 +1,41 @@
+
+featureName = Eclipse DLTK Core Runtime
+featureProvider = xored software, Inc.
+
+updateSiteName=The Eclipse DLTK Project Updates
+description=Eclipse DLTK Core Runtime.
+copyright=\
+Copyright (c) 2005, 2006 xored software, Inc. and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n
+
+licenseURL=license.html
+
+license=\
+ECLIPSE DLTK SOFTWARE USER AGREEMENT\n\
+September 20, 2006\n\
+\n\
+Usage Of Content\n\
+\n\
+ECLSIPE DLTK PROJECT MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse DLTK Project\n\
+is provided to you under the terms and conditions of the Eclipse Public\n\
+License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
+Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
diff --git a/core/features/org.eclipse.dltk.runtime-feature/feature.xml b/core/features/org.eclipse.dltk.runtime-feature/feature.xml
new file mode 100644
index 0000000..efbeb24
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/feature.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.dltk.runtime"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.xored.com/dltk/update-dev"/>
+ <discovery label="%updateSiteName" url="http://download.xored.com/dltk/update-dev"/>
+ </url>
+
+ <plugin
+ id="org.eclipse.dltk.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.debug"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.debug.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.launching"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.console"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.dltk.console.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/core/features/org.eclipse.dltk.runtime-feature/license.html b/core/features/org.eclipse.dltk.runtime-feature/license.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/core/features/org.eclipse.dltk.runtime-feature/license.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console.ui/.classpath b/core/plugins/org.eclipse.dltk.console.ui/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/core/plugins/org.eclipse.dltk.console.ui/.cvsignore b/core/plugins/org.eclipse.dltk.console.ui/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/plugins/org.eclipse.dltk.console.ui/.project b/core/plugins/org.eclipse.dltk.console.ui/.project
new file mode 100644
index 0000000..02cd451
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.console.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/plugins/org.eclipse.dltk.console.ui/META-INF/MANIFEST.MF b/core/plugins/org.eclipse.dltk.console.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..935d84f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.dltk.console.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.dltk.console.ui.ScriptConsoleUIPlugin
+Bundle-Vendor: %pluginProvider
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jface,
+ org.eclipse.jface.text,
+ org.eclipse.ui,
+ org.eclipse.ui.console,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.debug.core,
+ org.eclipse.dltk.console,
+ org.eclipse.dltk.launching
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.dltk.console.ui
diff --git a/core/plugins/org.eclipse.dltk.console.ui/build.properties b/core/plugins/org.eclipse.dltk.console.ui/build.properties
new file mode 100644
index 0000000..0c86fe1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/,\
+ icons/,\
+ plugin.properties
diff --git a/core/plugins/org.eclipse.dltk.console.ui/icons/save.gif b/core/plugins/org.eclipse.dltk.console.ui/icons/save.gif
new file mode 100644
index 0000000..3767b16
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/icons/save.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.console.ui/icons/terminate.gif b/core/plugins/org.eclipse.dltk.console.ui/icons/terminate.gif
new file mode 100644
index 0000000..dc47edf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/icons/terminate.gif
Binary files differ
diff --git a/core/plugins/org.eclipse.dltk.console.ui/plugin.properties b/core/plugins/org.eclipse.dltk.console.ui/plugin.properties
new file mode 100644
index 0000000..1f1eaa7
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/plugin.properties
@@ -0,0 +1,2 @@
+pluginProvider=Eclipse.org
+pluginName=Dynamic Languages Toolkit Console UI
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console.ui/plugin.xml b/core/plugins/org.eclipse.dltk.console.ui/plugin.xml
new file mode 100644
index 0000000..6e9f6a6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="scriptConsole" name="Script Console" schema="schema/scriptConsole.exsd"/>
+
+</plugin>
diff --git a/core/plugins/org.eclipse.dltk.console.ui/schema/scriptConsole.exsd b/core/plugins/org.eclipse.dltk.console.ui/schema/scriptConsole.exsd
new file mode 100644
index 0000000..c9faef3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/schema/scriptConsole.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.dltk.console.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.dltk.console.ui" id="scriptConsole" name="%scriptConsole"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="scriptConsole"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="scriptConsole">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.dltk.console.ui.IScriptConsoleFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="natureID" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleFactory.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleFactory.java
new file mode 100644
index 0000000..78ad474
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleFactory.java
@@ -0,0 +1,7 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.dltk.console.IScriptInterpreter;
+
+public interface IScriptConsoleFactory {
+ void openConsole(IScriptInterpreter interpreter, String id);
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleInput.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleInput.java
new file mode 100644
index 0000000..c9bd7fd
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleInput.java
@@ -0,0 +1,5 @@
+package org.eclipse.dltk.console.ui;
+
+public interface IScriptConsoleInput {
+ void insertText(String line);
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleListener.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleListener.java
new file mode 100644
index 0000000..bd27a2e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleListener.java
@@ -0,0 +1,6 @@
+package org.eclipse.dltk.console.ui;
+
+public interface IScriptConsoleListener {
+ void userRequest(String text);
+ void interpreterResponse(String text);
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleSession.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleSession.java
new file mode 100644
index 0000000..0fae743
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleSession.java
@@ -0,0 +1,5 @@
+package org.eclipse.dltk.console.ui;
+
+public interface IScriptConsoleSession {
+
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleViewer.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleViewer.java
new file mode 100644
index 0000000..fa3aa5d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/IScriptConsoleViewer.java
@@ -0,0 +1,8 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.jface.text.ITextViewer;
+
+public interface IScriptConsoleViewer extends ITextViewer {
+ String getCommandLine();
+ int getCommandLineOffset();
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsole.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsole.java
new file mode 100644
index 0000000..d7820cb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsole.java
@@ -0,0 +1,143 @@
+package org.eclipse.dltk.console.ui;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.dltk.console.IScriptInterpreter;
+import org.eclipse.dltk.console.ScriptConsoleHistory;
+import org.eclipse.dltk.console.ScriptConsolePrompt;
+import org.eclipse.dltk.console.ui.internal.ICommandHandler;
+import org.eclipse.dltk.console.ui.internal.ScriptConsoleInput;
+import org.eclipse.dltk.console.ui.internal.ScriptConsolePage;
+import org.eclipse.dltk.console.ui.internal.ScriptConsoleSession;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.ui.console.IConsoleDocumentPartitioner;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.TextConsole;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+
+public class ScriptConsole extends TextConsole implements ICommandHandler {
+
+ private ScriptConsolePage page;
+
+ private ScriptConsolePartitioner partitioner;
+
+ private IContentAssistProcessor processor;
+
+ private ITextHover hover;
+
+ private IScriptInterpreter interpreter;
+
+ private ScriptConsoleSession session;
+
+ private ListenerList consoleListeners;
+
+ private ScriptConsolePrompt prompt;
+
+ private ScriptConsoleHistory history;
+
+ protected IConsoleDocumentPartitioner getPartitioner() {
+ return partitioner;
+ }
+
+ public ScriptConsole(String consoleName, String consoleType) {
+ super(consoleName, consoleType, null, true);
+
+ this.consoleListeners = new ListenerList(ListenerList.IDENTITY);
+ this.prompt = new ScriptConsolePrompt("=>", "->");
+ this.history = new ScriptConsoleHistory();
+
+ this.session = new ScriptConsoleSession();
+ addListener(this.session);
+
+ partitioner = new ScriptConsolePartitioner();
+ getDocument().setDocumentPartitioner(partitioner);
+ partitioner.connect(getDocument());
+ }
+
+ public IScriptConsoleSession getSession() {
+ return session;
+ }
+
+ public void addListener(IScriptConsoleListener listener) {
+ consoleListeners.add(listener);
+ }
+
+ public void removeListener(IScriptConsoleListener listener) {
+ consoleListeners.remove(listener);
+ }
+
+ protected void setContentAssistProcessor(IContentAssistProcessor processor) {
+ this.processor = processor;
+ }
+
+ protected void setInterpreter(IScriptInterpreter interpreter) {
+ this.interpreter = interpreter;
+ }
+
+ public void setPrompt(ScriptConsolePrompt prompt) {
+ this.prompt = prompt;
+ }
+
+ public ScriptConsolePrompt getPrompt() {
+ return prompt;
+ }
+
+ public ScriptConsoleHistory getHistory() {
+ return history;
+ }
+
+ protected void setTextHover(ITextHover hover) {
+ this.hover = hover;
+ }
+
+ public IPageBookViewPage createPage(IConsoleView view) {
+ SourceViewerConfiguration cfg = new ScriptConsoleSourceViewerConfiguration(
+ processor, hover);
+ page = new ScriptConsolePage(this, view, cfg);
+ return page;
+ }
+
+ public void clearConsole() {
+ page.clearConsolePage();
+ }
+
+ public IScriptConsoleInput getInput() {
+ return new ScriptConsoleInput(page);
+ }
+
+ public String handleCommand(String userInput) throws IOException {
+ Object[] listeners = consoleListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ((IScriptConsoleListener) listeners[i]).userRequest(userInput);
+ }
+
+ interpreter.exec(userInput);
+
+ String output = interpreter.getOutput();
+
+
+ if (interpreter.getState() == IScriptInterpreter.WAIT_NEW_COMMAND){
+ prompt.setMode(true);
+ } else {
+ prompt.setMode(false);
+ }
+
+ for (int i = 0; i < listeners.length; i++) {
+ ((IScriptConsoleListener) listeners[i]).interpreterResponse(output);
+ }
+
+ return output;
+ }
+
+ public void terminate() {
+ try {
+ interpreter.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleCompletionProcessor.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleCompletionProcessor.java
new file mode 100644
index 0000000..dea665e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleCompletionProcessor.java
@@ -0,0 +1,121 @@
+package org.eclipse.dltk.console.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.console.IScriptConsoleShell;
+import org.eclipse.dltk.console.ScriptConsoleCompletionProposal;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.swt.graphics.Image;
+
+
+public abstract class ScriptConsoleCompletionProcessor implements
+ IContentAssistProcessor {
+ protected static interface IProposalDecorator {
+ String formatProposal(ScriptConsoleCompletionProposal c);
+
+ Image getImage(ScriptConsoleCompletionProposal c);
+ }
+
+ private static IProposalDecorator defaultDecorator;
+
+ protected IProposalDecorator getDefaultDecorator() {
+ if (defaultDecorator == null) {
+ defaultDecorator = new IProposalDecorator() {
+ public String formatProposal(ScriptConsoleCompletionProposal c) {
+ return c.getDisplay();
+ }
+
+ public Image getImage(ScriptConsoleCompletionProposal c) {
+ return null;
+ }
+ };
+ }
+
+ return defaultDecorator;
+ }
+
+ private IScriptConsoleShell interpreterShell;
+
+ public ScriptConsoleCompletionProcessor(
+ IScriptConsoleShell interpreterShell) {
+ this.interpreterShell = interpreterShell;
+ }
+
+ protected IScriptConsoleShell getInterpreterShell() {
+ return this.interpreterShell;
+ }
+
+ protected List createProposalsFromString(List list, int offset,
+ IProposalDecorator decorator) {
+
+ if (decorator == null){
+ decorator = getDefaultDecorator();
+ }
+
+ List result = new ArrayList();
+
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ ScriptConsoleCompletionProposal c = (ScriptConsoleCompletionProposal) it.next();
+
+ CompletionProposal proposal = new CompletionProposal(c.getInsert(), // replacementString
+ offset, // replacementOffset
+ 0, // replacementLength
+ c.getInsert().length(), // cursorPosition
+ decorator.getImage(c), // image
+ decorator.formatProposal(c), // displayString
+ null, // contextInformation
+ null); // additionalContextInformation
+
+ result.add(proposal);
+ }
+
+ Collections.sort(result, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ CompletionProposal p1 = (CompletionProposal) o1;
+ CompletionProposal p2 = (CompletionProposal) o2;
+ return p1.getDisplayString().compareTo(p2.getDisplayString());
+ }
+ });
+
+ return result;
+ }
+
+ protected abstract ICompletionProposal[] computeCompletionProposalsImpl(
+ IScriptConsoleViewer viewer, int offset);
+
+ protected abstract IContextInformation[] computeContextInformationImpl(
+ ITextViewer viewer, int offset);
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int offset) {
+ return computeCompletionProposalsImpl((IScriptConsoleViewer) viewer,
+ offset);
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return null;
+ }
+
+ public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ int offset) {
+ return computeContextInformationImpl((IScriptConsoleViewer) viewer,
+ offset);
+ }
+
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ public String getErrorMessage() {
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleFactoryBase.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleFactoryBase.java
new file mode 100644
index 0000000..4433c97
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleFactoryBase.java
@@ -0,0 +1,21 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.ui.console.IConsoleFactory;
+
+
+public abstract class ScriptConsoleFactoryBase implements IConsoleFactory {
+ public ScriptConsoleFactoryBase(){
+ }
+
+ protected void registerAndOpenConsole(ScriptConsole console){
+ ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
+ manager.add(console);
+ manager.showConsole(console);
+ }
+
+ public void openConsole() {
+ registerAndOpenConsole(createConsoleInstance());
+ }
+
+ protected abstract ScriptConsole createConsoleInstance();
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleManager.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleManager.java
new file mode 100644
index 0000000..e0f8cf0
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleManager.java
@@ -0,0 +1,186 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.dltk.console.IScriptInterpreter;
+import org.eclipse.dltk.console.ScriptConsoleServer;
+import org.eclipse.dltk.console.ScriptInterpreterManager;
+import org.eclipse.dltk.launching.IDLTKLaunchConfigurationConstants;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IConsoleView;
+
+
+public class ScriptConsoleManager implements ILaunchListener {
+ private static ScriptConsoleManager instance;
+
+ public static ScriptConsoleManager getInstance() {
+ if (instance == null) {
+ instance = new ScriptConsoleManager();
+ }
+
+ return instance;
+ }
+
+ private IConsoleManager manager;
+
+ protected ScriptConsoleManager() {
+ this.manager = ConsolePlugin.getDefault().getConsoleManager();
+ }
+
+ public ScriptConsole[] getScriptConsoles(String consoleTypes) {
+ return null;
+ }
+
+ public ScriptConsole getActiveScriptConsole(String consoleType) {
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IViewPart part = page
+ .findView(IConsoleConstants.ID_CONSOLE_VIEW);
+
+ if (part != null && part instanceof IConsoleView) {
+ IConsoleView view = (IConsoleView) part;
+ IConsole console = view.getConsole();
+
+ if (console instanceof ScriptConsole
+ && console.getType().equals(consoleType)) {
+ return (ScriptConsole) console;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void close(ScriptConsole console) {
+ console.terminate();
+ remove(console);
+ }
+
+ public void closeAll() {
+ IConsole[] consoles = manager.getConsoles();
+ for (int i = 0; i < consoles.length; ++i) {
+ IConsole console = consoles[i];
+ if (console instanceof ScriptConsole) {
+ close((ScriptConsole) console);
+ }
+ }
+ }
+
+ public void showConsole(ScriptConsole console) {
+ manager.showConsoleView(console);
+ }
+
+ public void add(ScriptConsole console) {
+ manager.addConsoles(new IConsole[] { console });
+ }
+
+ public void remove(ScriptConsole console) {
+ manager.removeConsoles(new IConsole[] { console });
+ }
+
+ protected IScriptConsoleFactory findScriptConsoleFactory(String natureId)
+ throws CoreException {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint ep = reg
+ .getExtensionPoint(ScriptConsoleUIConstants.SCRIPT_CONSOLE_EP);
+ IExtension[] extensions = ep.getExtensions();
+
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension ext = extensions[i];
+ IConfigurationElement[] ce = ext.getConfigurationElements();
+ for (int j = 0; j < ce.length; j++) {
+ if (natureId
+ .equals(ce[j]
+ .getAttribute(ScriptConsoleUIConstants.SCRIPT_CONSOLE_NATURE_ID))) {
+ Object obj = ce[j]
+ .createExecutableExtension(ScriptConsoleUIConstants.SCRIPT_CONSOLE_CLASS);
+ if (obj instanceof IScriptConsoleFactory) {
+ return (IScriptConsoleFactory) obj;
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ // ILaunchListener
+ public void launchAdded(ILaunch launch) {
+ try {
+ final ILaunchConfiguration configuration = launch
+ .getLaunchConfiguration();
+
+ final String natureId = configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_NATURE, (String)null);
+
+ if (natureId == null){
+ return;
+ }
+
+ boolean useDltk = configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_USE_DLTK_OUTPUT, false);
+
+ if (!useDltk) {
+ return;
+ }
+
+ final String consoleId = configuration.getAttribute(IDLTKLaunchConfigurationConstants.ATTR_DLTK_CONSOLE_ID,
+ (String) null);
+
+ final IScriptConsoleFactory factory = findScriptConsoleFactory(natureId);
+
+ if (factory == null) {
+ return;
+ }
+
+ ISafeRunnable runnable = new ISafeRunnable() {
+ public void handleException(Throwable exception) {
+ }
+
+ public void run() throws Exception {
+ ScriptConsoleServer server = ScriptConsoleServer
+ .getInstance();
+
+ IScriptInterpreter interpreter = ScriptInterpreterManager
+ .getInstance().createInterpreter(natureId);
+
+ server.register(consoleId, interpreter);
+
+ factory.openConsole(interpreter, configuration.getName());
+ }
+ };
+
+ SafeRunner.run(runnable);
+
+ } catch (CoreException e) {
+ //TODO: log exception
+ e.printStackTrace();
+ }
+ }
+
+ public void launchChanged(ILaunch launch) {
+ }
+
+ public void launchRemoved(ILaunch launch) {
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsolePartitioner.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsolePartitioner.java
new file mode 100644
index 0000000..c3e3650
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsolePartitioner.java
@@ -0,0 +1,84 @@
+package org.eclipse.dltk.console.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.ui.console.IConsoleDocumentPartitioner;
+
+public class ScriptConsolePartitioner extends FastPartitioner
+ implements IConsoleDocumentPartitioner {
+
+ private static class Constants {
+ public static final String MY_DOUBLE_QUOTED = "__my_double";
+
+ public static final String MY_SINGLE_QUOTED = "__my_single";
+ }
+
+ private static class MyPartitionScanner extends RuleBasedPartitionScanner {
+ public MyPartitionScanner() {
+ IToken myDouble = new Token(Constants.MY_DOUBLE_QUOTED);
+ IToken mySingle = new Token(Constants.MY_SINGLE_QUOTED);
+
+ List rules = new ArrayList();
+
+ rules.add(new MultiLineRule("\'", "\'", mySingle, '\\'));
+ rules.add(new MultiLineRule("\"", "\"", myDouble, '\\'));
+
+ IPredicateRule[] result = new IPredicateRule[rules.size()];
+ rules.toArray(result);
+
+ setPredicateRules(result);
+ }
+ }
+
+ public ScriptConsolePartitioner() {
+
+ super(new MyPartitionScanner(), new String[] {
+ Constants.MY_DOUBLE_QUOTED, Constants.MY_SINGLE_QUOTED });
+ }
+
+ public StyleRange[] getStyleRanges(int offset, int length) {
+// int i = offset;
+//
+// int last = offset + length;
+//
+// List list = new ArrayList();
+// while (i < last) {
+// ITypedRegion region = getPartition(i);
+//
+// String type = region.getType();
+//
+// int off = region.getOffset();
+// int len = region.getLength();
+//
+// Color color = null;
+// if (type.equals(Constants.MY_DOUBLE_QUOTED)) {
+// color = new Color(null, 255, 0, 0);
+// }
+//
+// if (type.equals(Constants.MY_SINGLE_QUOTED)) {
+// color = new Color(null, 0, 255, 255);
+// }
+//
+// list.add(new StyleRange(off, len, color, null, SWT.ITALIC));
+//
+// i = off + len;
+// }
+//
+// return (StyleRange[]) list.toArray(new StyleRange[list.size()]);
+
+ return new StyleRange[]{new StyleRange(offset, length, null, null, SWT.NO)};
+ }
+
+ public boolean isReadOnly(int offset) {
+ return false;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleSourceViewerConfiguration.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleSourceViewerConfiguration.java
new file mode 100644
index 0000000..f268f8e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleSourceViewerConfiguration.java
@@ -0,0 +1,51 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
+public class ScriptConsoleSourceViewerConfiguration extends
+ SourceViewerConfiguration {
+ private static final int DEFAULT_TAB_WIDTH = 4;
+
+ private static final int DEFAULT_CA_DELAY = 50;
+
+ private static final String PARTITION_TYPE = IDocument.DEFAULT_CONTENT_TYPE;
+
+ private IContentAssistProcessor processor;
+
+ private ITextHover hover;
+
+ public ScriptConsoleSourceViewerConfiguration(
+ IContentAssistProcessor processor, ITextHover hover) {
+ this.processor = processor;
+ this.hover = hover;
+ }
+
+ public int getTabWidth(ISourceViewer sourceViewer) {
+ return DEFAULT_TAB_WIDTH;
+ }
+
+ public ITextHover getTextHover(ISourceViewer sv, String contentType) {
+ return hover;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return new String[] { PARTITION_TYPE };
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ assistant.setContentAssistProcessor(processor, PARTITION_TYPE);
+
+ assistant.enableAutoActivation(true);
+ assistant.enableAutoInsert(false);
+ assistant.setAutoActivationDelay(DEFAULT_CA_DELAY);
+
+ return assistant;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleTextHover.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleTextHover.java
new file mode 100644
index 0000000..339770f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleTextHover.java
@@ -0,0 +1,19 @@
+package org.eclipse.dltk.console.ui;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+
+public abstract class ScriptConsoleTextHover implements ITextHover {
+
+ protected abstract String getHoverInfoImpl(IScriptConsoleViewer viewer, IRegion hoverRegion);
+
+ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+ return getHoverInfoImpl((IScriptConsoleViewer)textViewer, hoverRegion);
+ }
+
+ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+ return new Region(offset, 0);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIConstants.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIConstants.java
new file mode 100644
index 0000000..23031fb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIConstants.java
@@ -0,0 +1,10 @@
+package org.eclipse.dltk.console.ui;
+
+public class ScriptConsoleUIConstants {
+ public static final String SCRIPT_CONSOLE_EP = "org.eclipse.dltk.console.ui.scriptConsole";
+ public static final String SCRIPT_CONSOLE_CLASS = "class";
+ public static final String SCRIPT_CONSOLE_NATURE_ID = "natureID";
+
+ public static final String TERMINATE_ICON = "icon.terminate";
+ public static final String SAVE_SESSION_ICON = "icon.save_session";
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIPlugin.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIPlugin.java
new file mode 100644
index 0000000..ffe147e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/ScriptConsoleUIPlugin.java
@@ -0,0 +1,90 @@
+package org.eclipse.dltk.console.ui;
+
+import java.net.URL;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ScriptConsoleUIPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.dltk.console.ui";
+
+ // The shared instance
+ private static ScriptConsoleUIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ScriptConsoleUIPlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault()
+ .getLaunchManager();
+ launchManager.addLaunchListener(ScriptConsoleManager.getInstance());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+
+ ScriptConsoleManager manager = ScriptConsoleManager.getInstance();
+
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(
+ manager);
+ manager.closeAll();
+ }
+
+ public ImageDescriptor getImageDescriptor(String key) {
+ ImageRegistry registry = getImageRegistry();
+ return registry.getDescriptor(key);
+ }
+
+ public Image getImage(String key) {
+ ImageRegistry registry = getImageRegistry();
+ return registry.get(key);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ScriptConsoleUIPlugin getDefault() {
+ return plugin;
+ }
+
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ String[][] images = new String[][] {
+ { "icons/save.gif", ScriptConsoleUIConstants.SAVE_SESSION_ICON },
+ { "icons/terminate.gif",
+ ScriptConsoleUIConstants.TERMINATE_ICON } };
+
+ for (int i = 0; i < images.length; ++i) {
+ URL url = getDefault().getBundle().getEntry(images[i][0]);
+ registry.put(images[i][1], ImageDescriptor.createFromURL(url));
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ICommandHandler.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ICommandHandler.java
new file mode 100644
index 0000000..6311f03
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ICommandHandler.java
@@ -0,0 +1,7 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import java.io.IOException;
+
+public interface ICommandHandler {
+ String handleCommand(String userInput) throws IOException;
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/IScriptConsoleContentHandler.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/IScriptConsoleContentHandler.java
new file mode 100644
index 0000000..6370a31
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/IScriptConsoleContentHandler.java
@@ -0,0 +1,6 @@
+package org.eclipse.dltk.console.ui.internal;
+
+public interface IScriptConsoleContentHandler {
+ void contentAssistRequired();
+}
+
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleInput.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleInput.java
new file mode 100644
index 0000000..fdd6c02
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleInput.java
@@ -0,0 +1,17 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import org.eclipse.dltk.console.ui.IScriptConsoleInput;
+
+public class ScriptConsoleInput implements IScriptConsoleInput {
+
+ private ScriptConsolePage page;
+
+ public ScriptConsoleInput(ScriptConsolePage page){
+ this.page = page;
+ }
+
+ public void insertText(String line) {
+ page.insertText(line);
+ }
+}
+
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.java
new file mode 100644
index 0000000..2253bef
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.java
@@ -0,0 +1,19 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ScriptConsoleMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.dltk.console.ui.internal.ScriptConsoleMessages"; //$NON-NLS-1$
+
+ public static String SaveSessionAction;
+
+ public static String SaveSessionTooltip;
+
+ public static String TerminateConsoleAction;
+
+ public static String TerminateConsoleTooltip;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ScriptConsoleMessages.class);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.properties b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.properties
new file mode 100644
index 0000000..9c0d6da
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleMessages.properties
@@ -0,0 +1,4 @@
+SaveSessionAction = Save
+SaveSessionTooltip = Save console session to file
+TerminateConsoleAction = Terminate
+TerminateConsoleTooltip = Terminate current console
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsolePage.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsolePage.java
new file mode 100644
index 0000000..79a5b94
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsolePage.java
@@ -0,0 +1,105 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import org.eclipse.dltk.console.ScriptConsoleConstants;
+import org.eclipse.dltk.console.ui.ScriptConsole;
+import org.eclipse.dltk.console.ui.internal.actions.CloseScriptConsoleAction;
+import org.eclipse.dltk.console.ui.internal.actions.SaveConsoleSessionAction;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.TextConsolePage;
+import org.eclipse.ui.console.TextConsoleViewer;
+import org.eclipse.ui.console.actions.TextViewerAction;
+
+
+public class ScriptConsolePage extends TextConsolePage implements
+ IScriptConsoleContentHandler {
+
+ protected class ContentAssistProposalsAction extends TextViewerAction {
+
+ public ContentAssistProposalsAction(ITextViewer viewer) {
+ super(viewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
+ }
+ }
+
+ protected class ContentAssistContextInfoAction extends TextViewerAction {
+ public ContentAssistContextInfoAction(ITextViewer viewer) {
+ super(viewer, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION);
+ }
+ }
+
+ private SourceViewerConfiguration cfg;
+
+ private ScriptConsoleViewer viewer;
+
+ private TextViewerAction proposalsAction;
+
+ //private TextViewerAction contextInfoAction;
+
+ protected void createActions() {
+ super.createActions();
+
+ proposalsAction = new ContentAssistProposalsAction(getViewer());
+ proposalsAction = new ContentAssistProposalsAction(getViewer());
+
+ SaveConsoleSessionAction saveSessionAction = new SaveConsoleSessionAction(
+ (ScriptConsole) getConsole(),
+ ScriptConsoleMessages.SaveSessionAction,
+ ScriptConsoleMessages.SaveSessionTooltip, "id1");
+
+ CloseScriptConsoleAction colseConsoleAction = new CloseScriptConsoleAction(
+ (ScriptConsole) getConsole(),
+ ScriptConsoleMessages.TerminateConsoleAction,
+ ScriptConsoleMessages.TerminateConsoleTooltip, "id1");
+
+ IActionBars bars = getSite().getActionBars();
+
+ IToolBarManager toolbarManager = bars.getToolBarManager();
+
+ toolbarManager.prependToGroup(IConsoleConstants.LAUNCH_GROUP,
+ new GroupMarker(ScriptConsoleConstants.SCRIPT_GROUP));
+ toolbarManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP,
+ new Separator());
+
+ toolbarManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP,
+ colseConsoleAction);
+
+ toolbarManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP,
+ saveSessionAction);
+
+ bars.updateActionBars();
+ }
+
+ protected TextConsoleViewer createViewer(Composite parent) {
+ viewer = new ScriptConsoleViewer(parent, (ScriptConsole) getConsole(),
+ this);
+ viewer.configure(cfg);
+ return viewer;
+ }
+
+ public ScriptConsolePage(ScriptConsole console, IConsoleView view,
+ SourceViewerConfiguration cfg) {
+ super(console, view);
+
+ this.cfg = cfg;
+ }
+
+ public void clearConsolePage() {
+ viewer.clear();
+ }
+
+ public void contentAssistRequired() {
+ proposalsAction.run();
+ }
+
+ public void insertText(String text) {
+ viewer.insertText(text);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleSession.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleSession.java
new file mode 100644
index 0000000..264b2b9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleSession.java
@@ -0,0 +1,30 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import org.eclipse.dltk.console.ui.IScriptConsoleListener;
+import org.eclipse.dltk.console.ui.IScriptConsoleSession;
+
+public class ScriptConsoleSession implements IScriptConsoleListener,
+ IScriptConsoleSession {
+ private StringBuffer session;
+
+ public ScriptConsoleSession() {
+ this.session = new StringBuffer();
+ }
+
+ public void interpreterResponse(String text) {
+ if (text != null) {
+ session.append("> ");
+ session.append(text);
+ }
+ }
+
+ public void userRequest(String text) {
+ session.append("< ");
+ session.append(text);
+ session.append('\n');
+ }
+
+ public String toString() {
+ return session.toString();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleViewer.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleViewer.java
new file mode 100644
index 0000000..8872a8c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/ScriptConsoleViewer.java
@@ -0,0 +1,431 @@
+package org.eclipse.dltk.console.ui.internal;
+
+import java.io.IOException;
+
+import org.eclipse.dltk.console.ScriptConsoleHistory;
+import org.eclipse.dltk.console.ScriptConsolePrompt;
+import org.eclipse.dltk.console.ui.IScriptConsoleViewer;
+import org.eclipse.dltk.console.ui.ScriptConsole;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ST;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.VerifyKeyListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.console.TextConsoleViewer;
+
+
+public class ScriptConsoleViewer extends TextConsoleViewer implements
+ IScriptConsoleViewer {
+
+ private static class ConsoleDocumentListener implements IDocumentListener {
+
+ private ICommandHandler handler;
+
+ private ScriptConsolePrompt prompt;
+
+ private ScriptConsoleHistory history;
+
+ private int offset;
+
+ private IDocument doc;
+
+ protected void connectListener(){
+ doc.addDocumentListener(this);
+ }
+
+ protected void disconnectListener(){
+ doc.removeDocumentListener(this);
+ }
+
+ public void clear() {
+ try {
+ disconnectListener();
+ doc.set("");
+ appendInvitation();
+ viewer.setCaretPosition(doc.getLength());
+ connectListener();
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private ScriptConsoleViewer viewer;
+
+ public ConsoleDocumentListener(ScriptConsoleViewer viewer,
+ ICommandHandler handler, ScriptConsolePrompt prompt,
+ ScriptConsoleHistory history) {
+ this.prompt = prompt;
+ this.handler = handler;
+ this.history = history;
+
+ this.viewer = viewer;
+
+ this.offset = 0;
+
+ this.doc = null;
+ }
+
+ public void setDocument(IDocument doc) {
+ if (this.doc != null) {
+ disconnectListener();
+ }
+
+ this.doc = doc;
+
+ if (this.doc != null) {
+ connectListener();
+ }
+ }
+
+ public void documentAboutToBeChanged(DocumentEvent event) {
+
+ }
+
+ protected void handleCommandLine() throws BadLocationException,
+ IOException {
+ //viewer.getTextWidget().setEditable(false);
+
+ final String command = getCommandLine();
+ appendDelimeter();
+
+ processResult(handler.handleCommand(command));
+
+// Thread thread = new Thread(new Runnable(){
+// public void run() {
+// try {
+//
+// } catch (BadLocationException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (IOException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// }
+// });
+
+ //thread.start();
+ }
+
+ protected void processResult(final String result) throws BadLocationException {
+ //viewer.getTextWidget().getDisplay().asyncExec(new Runnable() {
+ //public void run() {
+ //try {
+ //viewer.getTextWidget().setEditable(true);
+ if (result != null) {
+ appendText(result);
+ history.commit();
+ offset = getLastLineLength();
+ }
+ appendInvitation();
+ //} catch (BadLocationException e) {
+ //e.printStackTrace();
+ //}
+ //}
+ //});
+ }
+
+ protected void printString(String str) {
+ for (int i = 0; i < str.length(); ++i) {
+ char ch = str.charAt(i);
+ if (ch == '\r') {
+ System.out.print("\\r");
+ } else if (ch == '\n') {
+ System.out.print("\\n");
+ } else {
+ System.out.print(ch);
+ }
+ }
+
+ System.out.print('\n');
+ }
+
+ protected void proccessAddition(int offset, String text) {
+ try {
+ String delim = getDelimeter();
+
+ text = doc.get(offset, doc.getLength() - offset);
+
+ doc.replace(offset, text.length(), "");
+
+ text = text.replaceAll("\r\n|\n|\r", delim);
+
+ int start = 0;
+ int index = -1;
+ while ((index = text.indexOf(delim, start)) != -1) {
+ appendText(text.substring(start, index));
+ history.update(getCommandLine());
+ start = index + delim.length();
+ handleCommandLine();
+ }
+
+ appendText(text.substring(start, text.length()));
+ history.update(getCommandLine());
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void documentChanged(DocumentEvent event) {
+ disconnectListener();
+ proccessAddition(event.getOffset(), event.getText());
+ connectListener();
+ }
+
+ protected void appendText(String text) throws BadLocationException {
+ doc.replace(doc.getLength(), 0, text);
+ }
+
+ protected void appendInvitation() throws BadLocationException {
+ appendText(prompt.toString());
+ viewer.setCaretPosition(doc.getLength());
+ viewer.revealEndOfDocument();
+ }
+
+ protected void appendDelimeter() throws BadLocationException {
+ appendText(getDelimeter());
+ }
+
+ protected String getDelimeter() {
+ return TextUtilities.getDefaultLineDelimiter(doc);
+ }
+
+ protected int getLastLineLength() throws BadLocationException {
+ int lastLine = doc.getNumberOfLines() - 1;
+ return doc.getLineLength(lastLine);
+ }
+
+ public int getLastLineReadOnlySize() {
+ return prompt.toString().length() + offset;
+ }
+
+ public int getCommandLineOffset() throws BadLocationException {
+ int lastLine = doc.getNumberOfLines() - 1;
+ return doc.getLineOffset(lastLine) + getLastLineReadOnlySize();
+ }
+
+ public int getCommandLineLength() throws BadLocationException {
+ int lastLine = doc.getNumberOfLines() - 1;
+ return doc.getLineLength(lastLine) - getLastLineReadOnlySize();
+ }
+
+ public String getCommandLine() throws BadLocationException {
+ return doc.get(getCommandLineOffset(), getCommandLineLength());
+ }
+
+ public void setCommandLine(String command) throws BadLocationException {
+ doc
+ .replace(getCommandLineOffset(), getCommandLineLength(),
+ command);
+ }
+ }
+
+ private class ScriptCnosoleStyledText extends StyledText {
+
+ public ScriptCnosoleStyledText(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public void invokeAction(int action) {
+ if (isCaretOnLastLine()) {
+ try {
+ switch (action) {
+ case ST.LINE_UP:
+ history.prev();
+ listener.setCommandLine(history.get());
+ setCaretOffset(getDocument().getLength());
+ return;
+
+ case ST.LINE_DOWN:
+ history.next();
+ listener.setCommandLine(history.get());
+ setCaretOffset(getDocument().getLength());
+ return;
+
+ case ST.DELETE_PREVIOUS:
+ if (getCaretOffset() <= getCommandLineOffset()) {
+ return;
+ }
+ break;
+
+ case ST.DELETE_NEXT:
+ if (getCaretOffset() < getCommandLineOffset()) {
+ return;
+ }
+ break;
+
+ case ST.DELETE_WORD_PREVIOUS:
+ return;
+ }
+
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ super.invokeAction(action);
+
+ if (isCaretOnLastLine()
+ && getCaretOffset() <= getCommandLineOffset()) {
+ setCaretOffset(getCommandLineOffset());
+ }
+ } else {
+
+ super.invokeAction(action);
+ }
+ }
+
+ public void paste() {
+ if (isCaretOnLastLine()) {
+ super.paste();
+ }
+ }
+ }
+
+ private ScriptConsoleHistory history;
+
+ private ConsoleDocumentListener listener;
+
+ public int getCaretPosition() {
+ return getTextWidget().getCaretOffset();
+ }
+
+ public void setCaretPosition(final int offset) {
+ getTextWidget().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ getTextWidget().setCaretOffset(offset);
+ }
+ });
+ }
+
+ public int beginLineOffset() throws BadLocationException {
+ IDocument doc = getDocument();
+ int offset = getCaretPosition();
+ int line = doc.getLineOfOffset(offset);
+ return offset - doc.getLineOffset(line);
+ }
+
+ protected boolean isCaretOnLastLine() {
+ try {
+ IDocument doc = getDocument();
+ int line = doc.getLineOfOffset(getCaretPosition());
+ return line == doc.getNumberOfLines() - 1;
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ protected StyledText createTextWidget(Composite parent, int styles) {
+ return new ScriptCnosoleStyledText(parent, styles);
+ }
+
+ public ScriptConsoleViewer(Composite parent, ScriptConsole console,
+ final IScriptConsoleContentHandler contentHandler) {
+ super(parent, console);
+
+ this.history = console.getHistory();
+
+ this.listener = new ConsoleDocumentListener(this, console, console
+ .getPrompt(), console.getHistory());
+ this.listener.setDocument(getDocument());
+
+ final StyledText styledText = getTextWidget();
+
+ //styledText.setEditable(false);
+
+ // Correct keyboard actions
+ styledText.addFocusListener(new FocusListener() {
+
+ public void focusGained(FocusEvent e) {
+ setCaretPosition(getDocument().getLength());
+ styledText.removeFocusListener(this);
+ }
+
+ public void focusLost(FocusEvent e) {
+
+ }
+ });
+
+ styledText.addVerifyKeyListener(new VerifyKeyListener() {
+ public void verifyKey(VerifyEvent event) {
+ try {
+ if (event.character != '\0') {
+ // Printable character
+ if (!isCaretOnLastLine()) {
+ event.doit = false;
+ return;
+ }
+
+ if (beginLineOffset() < listener
+ .getLastLineReadOnlySize()) {
+ event.doit = false;
+ return;
+ }
+
+ if (event.character == SWT.CR) {
+ getTextWidget().setCaretOffset(
+ getDocument().getLength());
+ return;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ styledText.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == 32 && (e.stateMask & SWT.CTRL) > 0) {
+ //System.out.println(".keyPressed()");
+ contentHandler.contentAssistRequired();
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+
+ }
+ });
+
+ clear();
+ }
+
+ // IConsoleTextViewer
+ public String getCommandLine() {
+ try {
+ return listener.getCommandLine();
+ } catch (BadLocationException e) {
+ return null;
+ }
+ }
+
+ public int getCommandLineOffset() {
+ try {
+ return listener.getCommandLineOffset();
+ } catch (BadLocationException e) {
+ return -1;
+ }
+ }
+
+ public void clear() {
+ listener.clear();
+ }
+
+ public void insertText(String text) {
+ getTextWidget().append(text);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/CloseScriptConsoleAction.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/CloseScriptConsoleAction.java
new file mode 100644
index 0000000..f7587fb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/CloseScriptConsoleAction.java
@@ -0,0 +1,36 @@
+package org.eclipse.dltk.console.ui.internal.actions;
+
+import org.eclipse.dltk.console.ui.ScriptConsole;
+import org.eclipse.dltk.console.ui.ScriptConsoleManager;
+import org.eclipse.dltk.console.ui.ScriptConsoleUIConstants;
+import org.eclipse.dltk.console.ui.ScriptConsoleUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class CloseScriptConsoleAction extends Action {
+
+ private ScriptConsole console;
+
+ public CloseScriptConsoleAction(ScriptConsole console, String text,
+ String tooltip, String id) {
+ this.console = console;
+
+ setText(text);
+ setToolTipText(tooltip);
+ setActionDefinitionId(id);
+ }
+
+ public void run() {
+ ScriptConsoleManager.getInstance().close(console);
+ }
+
+ public void update() {
+ setEnabled(true);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return ScriptConsoleUIPlugin.getDefault().getImageDescriptor(
+ ScriptConsoleUIConstants.TERMINATE_ICON);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/SaveConsoleSessionAction.java b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/SaveConsoleSessionAction.java
new file mode 100644
index 0000000..98c3d64
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console.ui/src/org/eclipse/dltk/console/ui/internal/actions/SaveConsoleSessionAction.java
@@ -0,0 +1,63 @@
+package org.eclipse.dltk.console.ui.internal.actions;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.dltk.console.ui.ScriptConsole;
+import org.eclipse.dltk.console.ui.ScriptConsoleUIConstants;
+import org.eclipse.dltk.console.ui.ScriptConsoleUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+public class SaveConsoleSessionAction extends Action {
+ private ScriptConsole console;
+
+ public SaveConsoleSessionAction(ScriptConsole console, String text,
+ String tooltip, String id) {
+ this.console = console;
+ setText(text);
+ setToolTipText(tooltip);
+ setActionDefinitionId(id);
+ }
+
+ public void run() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+
+ FileDialog dialog = new FileDialog(window.getShell(), SWT.SAVE);
+
+ String file = dialog.open();
+
+ try {
+ if (file != null) {
+ //System.out.println("Saving session to: " + file);
+
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(file);
+ writer.write(console.getSession().toString());
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void update() {
+ setEnabled(true);
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return ScriptConsoleUIPlugin.getDefault().getImageDescriptor(
+ ScriptConsoleUIConstants.SAVE_SESSION_ICON);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/.classpath b/core/plugins/org.eclipse.dltk.console/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/core/plugins/org.eclipse.dltk.console/.cvsignore b/core/plugins/org.eclipse.dltk.console/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/plugins/org.eclipse.dltk.console/.project b/core/plugins/org.eclipse.dltk.console/.project
new file mode 100644
index 0000000..2783c93
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.console</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/plugins/org.eclipse.dltk.console/META-INF/MANIFEST.MF b/core/plugins/org.eclipse.dltk.console/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..076e909
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.dltk.console;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.dltk.console.ScriptConsolePlugin
+Bundle-Vendor: %pluginProvider
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime, org.eclipse.debug.core, org.eclipse.dltk.core
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.dltk.console
diff --git a/core/plugins/org.eclipse.dltk.console/build.properties b/core/plugins/org.eclipse.dltk.console/build.properties
new file mode 100644
index 0000000..d67426f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/,\
+ plugin.properties
diff --git a/core/plugins/org.eclipse.dltk.console/plugin.properties b/core/plugins/org.eclipse.dltk.console/plugin.properties
new file mode 100644
index 0000000..e3665d9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/plugin.properties
@@ -0,0 +1,2 @@
+pluginProvider=Eclipse.org
+pluginName=Dynamic Languages Toolkit Console Core
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console/plugin.xml b/core/plugins/org.eclipse.dltk.console/plugin.xml
new file mode 100644
index 0000000..bf5283c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="scriptInterpreter" name="Script Interpreter" schema="schema/scriptInterpreter.exsd"/>
+
+</plugin>
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ConsoleRequest.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ConsoleRequest.java
new file mode 100644
index 0000000..bfbb889
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ConsoleRequest.java
@@ -0,0 +1,5 @@
+package org.eclipse.dltk.console;
+
+public interface ConsoleRequest {
+ void consoleConnected(IScriptConsoleIO protocol);
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleIO.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleIO.java
new file mode 100644
index 0000000..236c29c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleIO.java
@@ -0,0 +1,10 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+
+public interface IScriptConsoleIO {
+ String getId();
+ InterpreterResponse execInterpreter(String command) throws IOException;
+ ShellResponse execShell(String command, String[] args) throws IOException;
+ void close() throws IOException;
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleInterpreter.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleInterpreter.java
new file mode 100644
index 0000000..4349566
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleInterpreter.java
@@ -0,0 +1,13 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+
+public interface IScriptConsoleInterpreter {
+ int WAIT_NEW_COMMAND = 0;
+ int WAIT_CONTINUE_COMMAND = 1;
+ int WAIT_USER_INPUT = 2;
+
+ void exec(String command) throws IOException;
+ String getOutput();
+ int getState();
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleShell.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleShell.java
new file mode 100644
index 0000000..be09d6c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptConsoleShell.java
@@ -0,0 +1,14 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface IScriptConsoleShell {
+ List getCompletions(String commandLine, int position) throws IOException;
+
+ String getDescription(String commandLine, int position) throws IOException;
+
+ String[] getNames(String type) throws IOException;
+
+ void close() throws IOException;
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptInterpreter.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptInterpreter.java
new file mode 100644
index 0000000..d9d2338
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/IScriptInterpreter.java
@@ -0,0 +1,5 @@
+package org.eclipse.dltk.console;
+
+public interface IScriptInterpreter extends IScriptConsoleShell, IScriptConsoleInterpreter, ConsoleRequest {
+
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/InterpreterResponse.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/InterpreterResponse.java
new file mode 100644
index 0000000..036dc1f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/InterpreterResponse.java
@@ -0,0 +1,19 @@
+package org.eclipse.dltk.console;
+
+public class InterpreterResponse {
+ private int state;
+ private String content;
+
+ public InterpreterResponse(int state, String content){
+ this.state = state;
+ this.content = content;
+ }
+
+ public int getState(){
+ return state;
+ }
+
+ public String getContent() {
+ return content;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleCompletionProposal.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleCompletionProposal.java
new file mode 100644
index 0000000..0249487
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleCompletionProposal.java
@@ -0,0 +1,27 @@
+package org.eclipse.dltk.console;
+
+public class ScriptConsoleCompletionProposal {
+ private String insert;
+
+ private String display;
+
+ private String type;
+
+ public ScriptConsoleCompletionProposal(String insert, String display, String type) {
+ this.insert = insert;
+ this.display = display;
+ this.type = type;
+ }
+
+ public String getDisplay() {
+ return display;
+ }
+
+ public String getInsert() {
+ return insert;
+ }
+
+ public String getType() {
+ return type;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleConstants.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleConstants.java
new file mode 100644
index 0000000..55c09ab
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleConstants.java
@@ -0,0 +1,11 @@
+package org.eclipse.dltk.console;
+
+public final class ScriptConsoleConstants {
+ private ScriptConsoleConstants() { }
+
+ public static final String SCRIPT_GROUP = "scriptGroup";
+
+ public static final String SCRIPT_INTERPRETER_EP = "org.eclipse.dltk.console.scriptInterpreter";
+ public static final String SCRIPT_INTERPRETER_CLASS = "class";
+ public static final String SCRIPT_INTERPRETER_NATURE_ID = "natureID";
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleHistory.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleHistory.java
new file mode 100644
index 0000000..b8a9a03
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleHistory.java
@@ -0,0 +1,56 @@
+package org.eclipse.dltk.console;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ScriptConsoleHistory {
+ private List lines;
+
+ private int currLine;
+
+ public ScriptConsoleHistory () {
+ this.lines = new ArrayList();
+ this.lines.add("");
+ this.currLine = 0;
+ }
+
+ public void update(String line) {
+ lines.set(currLine, line);
+ }
+
+ public void commit() {
+ if (get().length() == 0)
+ return;
+
+ lines.set(lines.size() - 1, get());
+
+ lines.add("");
+ currLine = lines.size() - 1;
+ }
+
+ public boolean prev() {
+ if (currLine > 0) {
+ --currLine;
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean next() {
+ if (currLine < lines.size() - 1) {
+ ++currLine;
+ return true;
+ }
+
+ return false;
+ }
+
+ public String get() {
+ if (lines.isEmpty()) {
+ return null;
+ }
+
+ return (String) lines.get(currLine);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleIO.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleIO.java
new file mode 100644
index 0000000..9a35140
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleIO.java
@@ -0,0 +1,99 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class ScriptConsoleIO implements IScriptConsoleIO {
+ private static final String INTERPRETER = "interpreter";
+
+ private static final String SHELL = "shell";
+
+ private InputStream input;
+
+ private OutputStream output;
+
+ private String id;
+
+ protected static String readFixed(int len, InputStream input)
+ throws IOException {
+ byte[] buffer = new byte[len];
+ int from = 0;
+ while (from < buffer.length) {
+ int n = input.read(buffer, from, buffer.length - from);
+ if (n == -1) {
+ return null;
+ }
+ from += n;
+ }
+ return new String(buffer);
+ }
+
+ protected static int readLength(InputStream input) throws IOException {
+ String strLen = readFixed(10, input);
+ if (strLen == null) {
+ return -1;
+ }
+
+ return Integer.parseInt(strLen);
+ }
+
+ protected static String readResponse(InputStream input) throws IOException {
+ int len = readLength(input);
+ if (len == -1) {
+ return null;
+ }
+
+ String xml = readFixed(len, input);
+
+ if (xml == null) {
+ return null;
+ }
+
+ return xml;
+ }
+
+ public ScriptConsoleIO(InputStream input, OutputStream output)
+ throws IOException {
+ if (input == null || output == null) {
+ throw new IllegalArgumentException();
+ }
+
+ this.input = input;
+ this.output = output;
+
+ this.id = ScriptConsoleXmlHelper.parseInfoXml(readResponse(input));
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public ShellResponse execShell(String command, String[] args)
+ throws IOException {
+
+ output.write((SHELL + "\n").getBytes());
+ output.write((command + "\n").getBytes());
+
+ for (int i = 0; i < args.length; ++i) {
+ output.write((args[i] + "\n").getBytes());
+ }
+
+ output.flush();
+ return ScriptConsoleXmlHelper.parseShellXml(readResponse(input));
+ }
+
+ public InterpreterResponse execInterpreter(String command)
+ throws IOException {
+ output.write((INTERPRETER + "\n").getBytes());
+ output.write((command + "\n").getBytes());
+ output.flush();
+
+ return ScriptConsoleXmlHelper.parseInterpreterXml(readResponse(input));
+ }
+
+ public void close() throws IOException {
+ input.close();
+ output.close();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePlugin.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePlugin.java
new file mode 100644
index 0000000..66a25ac
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePlugin.java
@@ -0,0 +1,47 @@
+package org.eclipse.dltk.console;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ScriptConsolePlugin extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.dltk.console"; //$NON-NLS-1$
+
+ //The shared instance.
+ private static ScriptConsolePlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public ScriptConsolePlugin() {
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static ScriptConsolePlugin getDefault() {
+ return plugin;
+ }
+}
+
+
+
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePrompt.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePrompt.java
new file mode 100644
index 0000000..b078be1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsolePrompt.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package org.eclipse.dltk.console;
+
+public class ScriptConsolePrompt {
+ private String newCommand;
+
+ private String continueCommand;
+
+ private boolean mode;
+
+ public ScriptConsolePrompt(String newCommand, String appendCommand) {
+ this.newCommand = newCommand;
+ this.continueCommand = appendCommand;
+ this.mode = true;
+ }
+
+ public void setMode(boolean mode) {
+ this.mode = mode;
+ }
+
+ public String toString() {
+ return mode ? newCommand : continueCommand;
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleProxy.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleProxy.java
new file mode 100644
index 0000000..981b2bf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleProxy.java
@@ -0,0 +1,53 @@
+package org.eclipse.dltk.console;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import org.eclipse.dltk.core.DLTKCore;
+
+
+public class ScriptConsoleProxy {
+ private File proxyFile;
+
+ protected ScriptConsoleProxy(URL url, String language) {
+ try {
+ proxyFile = DLTKCore.getDefault().getStateLocation().append(
+ language + "_proxy").toFile();
+
+ InputStream input = null;
+ OutputStream output = null;
+ try {
+ input = new BufferedInputStream(url.openStream());
+
+ output = new BufferedOutputStream(new FileOutputStream(
+ proxyFile));
+
+ // Simple copy
+ int ch = -1;
+ while ((ch = input.read()) != -1) {
+ output.write(ch);
+ }
+ } finally {
+ if (input != null) {
+ input.close();
+ }
+
+ if (output != null) {
+ output.close();
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public File getFile() {
+ return proxyFile;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleServer.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleServer.java
new file mode 100644
index 0000000..b2f5b64
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleServer.java
@@ -0,0 +1,94 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ScriptConsoleServer implements Runnable {
+
+ public static final int DEFAULT_PORT = 25000;
+
+ private static ScriptConsoleServer instance;
+
+ public static ScriptConsoleServer getInstance() {
+ if (instance == null) {
+ instance = new ScriptConsoleServer(DEFAULT_PORT);
+ }
+ return instance;
+ }
+
+ private int port;
+
+ private Map handlers;
+
+ protected ScriptConsoleServer(int port) {
+ this.port = port;
+
+ handlers = new HashMap();
+
+ (new Thread(this)).start();
+ }
+
+ public String register(ConsoleRequest request) {
+ String id = new Long(System.currentTimeMillis()).toString();
+ register(id, request);
+ return id;
+ }
+
+ public void register(String id, ConsoleRequest request) {
+ synchronized (handlers) {
+ handlers.put(id, request);
+ handlers.notifyAll();
+ }
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void run() {
+ try {
+ ServerSocket server = new ServerSocket(port);
+
+ while (true) {
+ final Socket client = server.accept();
+
+ Thread clientHandler = new Thread(new Runnable() {
+ public void run() {
+ try {
+ SocketScriptConsoleIO proxy = new SocketScriptConsoleIO(
+ client);
+
+ String id = proxy.getId();
+
+ ConsoleRequest request = null;
+
+ synchronized (handlers) {
+ request = (ConsoleRequest) handlers.get(id);
+ while (request == null) {
+ try {
+ handlers.wait();
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+ handlers.remove(id);
+ }
+
+ request.consoleConnected(proxy);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ clientHandler.start();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleXmlHelper.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleXmlHelper.java
new file mode 100644
index 0000000..1e7b415
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptConsoleXmlHelper.java
@@ -0,0 +1,172 @@
+package org.eclipse.dltk.console;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public final class ScriptConsoleXmlHelper {
+ private ScriptConsoleXmlHelper() {
+ }
+
+ protected static int convertState(String state) {
+ if (state.equals("new")) {
+ return IScriptConsoleInterpreter.WAIT_NEW_COMMAND;
+ } else if (state.equals("continue")) {
+ return IScriptConsoleInterpreter.WAIT_CONTINUE_COMMAND;
+ } else if (state.equals("user")) {
+ return IScriptConsoleInterpreter.WAIT_USER_INPUT;
+ }
+
+ return -1;
+ }
+
+ protected static boolean isElement(Node node, String name) {
+ return node.getNodeType() == Node.ELEMENT_NODE
+ && node.getNodeName().equals(name);
+ }
+
+ protected static String getAttrib(NamedNodeMap attribs, String name) {
+ return attribs.getNamedItem(name).getNodeValue();
+ }
+
+ protected static Document parse(String xml) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ factory.setValidating(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ StringReader reader = new StringReader(xml);
+ return builder.parse(new InputSource(reader));
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ protected static List parseCompletionList(Node completionNode) {
+ NodeList children = completionNode.getChildNodes();
+
+ List completions = new ArrayList();
+ for (int i = 0; i < children.getLength(); ++i) {
+ Node node = children.item(i);
+
+ if (!isElement(node, "case")) {
+ continue;
+ }
+
+ Element element = (Element)node;
+
+ String display = element.getAttribute("display");
+ String insert = element.getAttribute("insert");
+ String type = element.getAttribute("type");
+
+ completions.add(new ScriptConsoleCompletionProposal(insert,
+ display, type));
+ }
+
+ return completions;
+ }
+
+ public static String parseInfoXml(String xml) {
+ Document doc = parse(xml);
+
+ if (doc == null) {
+ return null;
+ }
+
+ NodeList list = doc.getElementsByTagName("console");
+ Node node = list.item(0);
+
+ list = node.getChildNodes();
+ for (int i = 0; i < list.getLength(); ++i) {
+ Node n = list.item(i);
+ if (isElement(n, "info")) {
+ return ((Element)n).getAttribute("id");
+ }
+ }
+
+ return null;
+ }
+
+ public static ShellResponse parseShellXml(String xml) {
+ Document doc = parse(xml);
+
+ if (doc == null) {
+ return null;
+ }
+
+ NodeList list1 = doc.getElementsByTagName("console");
+ Node node = list1.item(0);
+
+ list1 = node.getChildNodes();
+ for (int i = 0; i < list1.getLength(); ++i) {
+ Node n1 = list1.item(i);
+ if (isElement(n1, "shell")) {
+ NodeList list2 = n1.getChildNodes();
+ for (int j = 0; j < list2.getLength(); ++j) {
+ Node n2 = list2.item(j);
+ if (isElement(n2, "completion")) {
+ List completions = parseCompletionList(n2);
+ return new ShellResponse(completions);
+ } else if (isElement(n2, "description")) {
+ if (n2.getChildNodes().getLength() == 0) {
+ return new ShellResponse("");
+ } else {
+ return new ShellResponse(n2.getFirstChild()
+ .getNodeValue());
+ }
+ } else if (isElement(n2, "close")) {
+ return new ShellResponse();
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static InterpreterResponse parseInterpreterXml(String xml) {
+ Document doc = parse(xml);
+
+ NodeList list = doc.getElementsByTagName("console").item(0)
+ .getChildNodes();
+
+ for (int i = 0; i < list.getLength(); ++i) {
+ Node n = list.item(i);
+ if (isElement(n, "interpreter")) {
+ String state = getAttrib(n.getAttributes(), "state");
+ String response = "";
+
+ // Check for empty response
+ if (n.getChildNodes().getLength() > 0) {
+ response = n.getFirstChild().getNodeValue();
+ }
+
+ return new InterpreterResponse(convertState(state), response);
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptInterpreterManager.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptInterpreterManager.java
new file mode 100644
index 0000000..3dac74f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ScriptInterpreterManager.java
@@ -0,0 +1,58 @@
+package org.eclipse.dltk.console;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+public class ScriptInterpreterManager {
+ private static ScriptInterpreterManager instance;
+
+ protected IScriptInterpreter findScriptInterpreter(String natureId) throws CoreException {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint ep = reg
+ .getExtensionPoint(ScriptConsoleConstants.SCRIPT_INTERPRETER_EP);
+
+ IExtension[] extensions = ep.getExtensions();
+
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension ext = extensions[i];
+ IConfigurationElement[] ce = ext.getConfigurationElements();
+ for (int j = 0; j < ce.length; j++) {
+ if (natureId
+ .equals(ce[j]
+ .getAttribute(ScriptConsoleConstants.SCRIPT_INTERPRETER_NATURE_ID))) {
+ Object obj = ce[j]
+ .createExecutableExtension(ScriptConsoleConstants.SCRIPT_INTERPRETER_CLASS);
+ if (obj instanceof IScriptInterpreter) {
+ return (IScriptInterpreter) obj;
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static ScriptInterpreterManager getInstance() {
+ if (instance == null) {
+ instance = new ScriptInterpreterManager();
+ }
+
+ return instance;
+ }
+
+ public IScriptInterpreter createInterpreter(String natureId) {
+ try {
+ return findScriptInterpreter(natureId);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ShellResponse.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ShellResponse.java
new file mode 100644
index 0000000..ac0dbba
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/ShellResponse.java
@@ -0,0 +1,29 @@
+package org.eclipse.dltk.console;
+
+import java.util.List;
+
+public class ShellResponse {
+ private List completions;
+
+ private String description;
+
+ public ShellResponse() {
+
+ }
+
+ public ShellResponse(String description) {
+ this.description = description;
+ }
+
+ public ShellResponse(List completions) {
+ this.completions = completions;
+ }
+
+ public List getCompletions() {
+ return completions;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/SocketScriptConsoleIO.java b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/SocketScriptConsoleIO.java
new file mode 100644
index 0000000..7838c57
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.console/src/org/eclipse/dltk/console/SocketScriptConsoleIO.java
@@ -0,0 +1,43 @@
+package org.eclipse.dltk.console;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+
+public class SocketScriptConsoleIO implements IScriptConsoleIO {
+ private Socket socket;
+
+ private IScriptConsoleIO io;
+
+ public SocketScriptConsoleIO(Socket socket) throws IOException {
+ this.socket = socket;
+
+ BufferedInputStream input = new BufferedInputStream(socket
+ .getInputStream());
+
+ BufferedOutputStream output = new BufferedOutputStream(socket
+ .getOutputStream());
+
+ io = new ScriptConsoleIO(input, output);
+ }
+
+ public String getId() {
+ return io.getId();
+ }
+
+ public InterpreterResponse execInterpreter(String command)
+ throws IOException {
+ return io.execInterpreter(command);
+ }
+
+ public ShellResponse execShell(String command, String[] args)
+ throws IOException {
+ return io.execShell(command, args);
+ }
+
+ public void close() throws IOException {
+ io.close();
+ socket.close();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/.classpath b/core/plugins/org.eclipse.dltk.core/.classpath
new file mode 100644
index 0000000..6f8c1a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/.classpath
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="model"/>
+ <classpathentry kind="src" path="compiler"/>
+ <classpathentry kind="src" path="search"/>
+ <classpathentry kind="src" path="ast"/>
+ <classpathentry kind="src" path="utils"/>
+ <classpathentry kind="src" path="codeassist"/>
+ <classpathentry kind="src" path="typeinference"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/core/plugins/org.eclipse.dltk.core/.cvsignore b/core/plugins/org.eclipse.dltk.core/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/core/plugins/org.eclipse.dltk.core/.project b/core/plugins/org.eclipse.dltk.core/.project
new file mode 100644
index 0000000..9578f85
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.dltk.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/plugins/org.eclipse.dltk.core/META-INF/MANIFEST.MF b/core/plugins/org.eclipse.dltk.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7a9b3c6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/META-INF/MANIFEST.MF
@@ -0,0 +1,46 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.dltk.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.dltk.core.DLTKCore
+Bundle-Vendor: %pluginProvider
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.filesystem
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.dltk.ast,
+ org.eclipse.dltk.ast.declarations,
+ org.eclipse.dltk.ast.expressions,
+ org.eclipse.dltk.ast.references,
+ org.eclipse.dltk.ast.statements,
+ org.eclipse.dltk.ast.utils,
+ org.eclipse.dltk.codeassist,
+ org.eclipse.dltk.codeassist.complete,
+ org.eclipse.dltk.compiler,
+ org.eclipse.dltk.compiler.env,
+ org.eclipse.dltk.compiler.env.lookup,
+ org.eclipse.dltk.compiler.util;x-internal:=true,
+ org.eclipse.dltk.core,
+ org.eclipse.dltk.core.search,
+ org.eclipse.dltk.core.search.index,
+ org.eclipse.dltk.core.search.indexing,
+ org.eclipse.dltk.core.search.matching,
+ org.eclipse.dltk.ddp,
+ org.eclipse.dltk.evaluation.types,
+ org.eclipse.dltk.internal.codeassist;x-internal:=true,
+ org.eclipse.dltk.internal.codeassist.impl;x-internal:=true,
+ org.eclipse.dltk.internal.codeassist.select,
+ org.eclipse.dltk.internal.compiler.env;x-internal:=true,
+ org.eclipse.dltk.internal.compiler.impl;x-internal:=true,
+ org.eclipse.dltk.internal.compiler.lookup;x-internal:=true,
+ org.eclipse.dltk.internal.core;x-friends:="org.eclipse.dltk.ui",
+ org.eclipse.dltk.internal.core.builder;x-internal:=true,
+ org.eclipse.dltk.internal.core.search;x-internal:=true,
+ org.eclipse.dltk.internal.core.search.matching;x-internal:=true,
+ org.eclipse.dltk.internal.core.search.processing;x-internal:=true,
+ org.eclipse.dltk.internal.core.util;x-internal:=true,
+ org.eclipse.dltk.typeinference,
+ org.eclipse.dltk.utils
+Bundle-ClassPath: .
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTNode.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTNode.java
new file mode 100644
index 0000000..7bace04
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTNode.java
@@ -0,0 +1,155 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast;
+
+import java.io.StringWriter;
+
+import org.eclipse.dltk.core.ISourceRange;
+import org.eclipse.dltk.internal.core.SourceRange;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public abstract class ASTNode {
+
+// storage for internal flags (32 bits) BIT USAGE
+ public final static int Bit1 = 0x1; // return type (operator) | name reference kind (name ref) | add assertion (type decl) | useful empty statement (empty statement)
+ public final static int Bit2 = 0x2; // return type (operator) | name reference kind (name ref) | has local type (type, method, field decl)
+ public final static int Bit3 = 0x4; // return type (operator) | name reference kind (name ref) | implicit this (this ref)
+ public final static int Bit4 = 0x8; // return type (operator) | first assignment to local (local decl) | undocumented empty block (block, type and method decl)
+ public final static int Bit5 = 0x10; // value for return (expression) | has all method bodies (unit) | supertype ref (type ref)
+ public final static int Bit6 = 0x20; // depth (name ref, msg) | ignore need cast check (cast expression)
+ public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operator) | need runtime checkcast (cast expression) | label used (labelStatement)
+ public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operator) | unsafe cast (cast expression)
+ public final static int Bit9 = 0x100; // depth (name ref, msg) | operator (operator) | is local type (type decl)
+ public final static int Bit10= 0x200; // depth (name ref, msg) | operator (operator) | is anonymous type (type decl)
+ public final static int Bit11 = 0x400; // depth (name ref, msg) | operator (operator) | is member type (type decl)
+ public final static int Bit12 = 0x800; // depth (name ref, msg) | operator (operator) | has abstract methods (type decl)
+ public final static int Bit13 = 0x1000; // depth (name ref, msg) | is secondary type (type decl)
+ public final static int Bit14 = 0x2000; // strictly assigned (reference lhs)
+ public final static int Bit15 = 0x4000; // is unnecessary cast (expression) | is varargs (type ref) | isSubRoutineEscaping (try statement)
+ public final static int Bit16 = 0x8000; // in javadoc comment (name ref, type ref, msg)
+ public final static int Bit17 = 0x10000; // compound assigned (reference lhs)
+ public final static int Bit18 = 0x20000; // non null (expression)
+ public final static int Bit19 = 0x40000;
+ public final static int Bit20 = 0x80000;
+ public final static int Bit21 = 0x100000;
+ public final static int Bit22 = 0x200000; // parenthesis count (expression)
+ public final static int Bit23 = 0x400000; // parenthesis count (expression)
+ public final static int Bit24 = 0x800000; // parenthesis count (expression)
+ public final static int Bit25 = 0x1000000; // parenthesis count (expression)
+ public final static int Bit26 = 0x2000000; // parenthesis count (expression)
+ public final static int Bit27 = 0x4000000; // parenthesis count (expression)
+ public final static int Bit28 = 0x8000000; // parenthesis count (expression)
+ public final static int Bit29 = 0x10000000; // parenthesis count (expression)
+ public final static int Bit30 = 0x20000000; // elseif (if statement) | try block exit (try statement) | fall-through (case statement)
+ public final static int Bit31 = 0x40000000; // local declaration reachable (local decl) | ignore raw type check (type ref) | discard entire assignment (assignment)
+ public final static int Bit32 = 0x80000000; // reachable (statement)
+
+ public final static long Bit32L = 0x80000000L;
+ public final static long Bit33L = 0x100000000L;
+ public final static long Bit34L = 0x200000000L;
+ public final static long Bit35L = 0x400000000L;
+ public final static long Bit36L = 0x800000000L;
+ public final static long Bit37L = 0x1000000000L;
+ public final static long Bit38L = 0x2000000000L;
+ public final static long Bit39L = 0x4000000000L;
+ public final static long Bit40L = 0x8000000000L;
+ public final static long Bit41L = 0x10000000000L;
+ public final static long Bit42L = 0x20000000000L;
+ public final static long Bit43L = 0x40000000000L;
+ public final static long Bit44L = 0x80000000000L;
+ public final static long Bit45L = 0x100000000000L;
+ public final static long Bit46L = 0x200000000000L;
+ public final static long Bit47L = 0x400000000000L;
+ public final static long Bit48L = 0x800000000000L;
+ public final static long Bit49L = 0x1000000000000L;
+ public final static long Bit50L = 0x2000000000000L;
+ public final static long Bit51L = 0x4000000000000L;
+ public final static long Bit52L = 0x8000000000000L;
+ public final static long Bit53L = 0x10000000000000L;
+ public final static long Bit54L = 0x20000000000000L;
+ public final static long Bit55L = 0x40000000000000L;
+ public final static long Bit56L = 0x80000000000000L;
+ public final static long Bit57L = 0x100000000000000L;
+ public final static long Bit58L = 0x200000000000000L;
+ public final static long Bit59L = 0x400000000000000L;
+ public final static long Bit60L = 0x800000000000000L;
+ public final static long Bit61L = 0x1000000000000000L;
+ public final static long Bit62L = 0x2000000000000000L;
+ public final static long Bit63L = 0x4000000000000000L;
+ public final static long Bit64L = 0x8000000000000000L;
+
+ public final static int D_METHOD_DECL = 1;
+
+ public final static int D_TYPE_DECL = 2;
+
+ public final static int D_VAR_DECL = 3;
+
+ private int sourceStart;
+
+ private int sourceEnd;
+
+ protected ASTNode() {
+ this(0, -1);
+ }
+
+ protected ASTNode(int start, int end) {
+ this.sourceStart = start;
+ this.sourceEnd = end;
+ }
+
+ protected ASTNode(DLTKToken token) {
+ this.sourceStart = token.getColumn();
+ String tokenValue = token.getText();
+ if (tokenValue != null) {
+ this.sourceEnd = this.sourceStart + tokenValue.length();
+ } else {
+ this.sourceEnd = -1;
+ }
+ }
+
+ public final int sourceStart() {
+ return sourceStart;
+ }
+
+ public final int sourceEnd() {
+ return sourceEnd;
+ }
+
+ // TODO: Need to find way to change visibility to protected.
+ public void setStart(int start) {
+ this.sourceStart = start;
+ }
+
+ // TODO: Need to find way to change visibility to protected.
+ public void setEnd(int end) {
+ this.sourceEnd = end;
+ }
+
+ public abstract void traverse(ASTVisitor pVisitor) throws Exception;
+
+ public abstract void printNode(CorePrinter output);
+
+ protected ISourceRange getSourceRange () {
+ return new SourceRange(this.sourceStart(), this.sourceEnd() - this.sourceStart() + 1);
+ }
+
+ private static String simplifyClassName(String name) {
+ int pos = name.lastIndexOf('.');
+ return name.substring(pos + 1);
+ }
+
+ public String debugString () {
+ return simplifyClassName(this.getClass().getName()) + "@" + this.getSourceRange().toString();
+ }
+
+ public String toString() {
+ StringWriter writer = new StringWriter();
+ CorePrinter printer = new CorePrinter(writer);
+ this.printNode(printer);
+ printer.flush();
+ printer.close();
+ return writer.getBuffer().toString();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTVisitor.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTVisitor.java
new file mode 100644
index 0000000..ad4529e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/ASTVisitor.java
@@ -0,0 +1,65 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast;
+
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.compiler.IProblem;
+
+public abstract class ASTVisitor {
+ public void acceptProblem(IProblem problem) {
+ }
+
+ public boolean visitGeneral(ASTNode node) throws Exception {
+ return true;
+ }
+
+ public boolean endvisitGeneral(ASTNode node) throws Exception {
+ return true;
+ }
+
+ public boolean visit(Statement s) throws Exception {
+ return visitGeneral(s);
+ }
+
+ public boolean visit(Expression s) throws Exception {
+ return visitGeneral(s);
+ }
+
+ public boolean visit(TypeDeclaration s) throws Exception {
+ return visitGeneral(s);
+ }
+
+ public boolean visit(MethodDeclaration s) throws Exception {
+ return visitGeneral(s);
+ }
+
+ public boolean visit(ModuleDeclaration s) throws Exception {
+ return visitGeneral(s);
+ }
+
+ public boolean endvisit(Statement s) throws Exception {
+ return endvisitGeneral(s);
+ }
+
+ public boolean endvisit(Expression s) throws Exception {
+ return endvisitGeneral(s);
+ }
+
+ public boolean endvisit(TypeDeclaration s) throws Exception {
+ return endvisitGeneral(s);
+ }
+
+ public boolean endvisit(MethodDeclaration s) throws Exception {
+ return endvisitGeneral(s);
+ }
+
+ public boolean endvisit(ModuleDeclaration s) throws Exception {
+ return endvisitGeneral(s);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/DLTKToken.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/DLTKToken.java
new file mode 100644
index 0000000..a964ec3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/DLTKToken.java
@@ -0,0 +1,65 @@
+package org.eclipse.dltk.ast;
+
+public class DLTKToken implements Cloneable {
+ public static final int INVALID_TYPE = 0;
+ public static final int EOF_TYPE = 1;
+ public static final int SKIP = -1;
+
+ protected int line;
+ protected String text;
+ protected int col;
+
+ // each Token has at least a token type
+ protected int type = INVALID_TYPE;
+
+ // the illegal token object
+ public static DLTKToken badToken = new DLTKToken(INVALID_TYPE, "<no text>");
+
+ public DLTKToken() {
+ line = 0;
+ col = 0;
+ }
+
+ public DLTKToken(int t) {
+ type = t;
+ }
+
+ public DLTKToken(int t, String txt) {
+ type = t;
+ setText(txt);
+ line = 0;
+ col = 0;
+ }
+
+ public int getColumn() {
+ return this.col;
+ }
+
+ public String getText() {
+ return this.text;
+ }
+
+ public void setText(String t) {
+ this.text = t;
+ }
+
+ public void setColumn(int c) {
+ this.col = c;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int t) {
+ type = t;
+ }
+
+ public String toString() {
+ return "[\"" + getText() + "\",<" + getType() + ">]";
+ }
+
+ public void setLine(int line) {
+ this.line = line;
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/Modifiers.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/Modifiers.java
new file mode 100644
index 0000000..5421d28
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/Modifiers.java
@@ -0,0 +1,41 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast;
+
+/**
+ * Flags for declaration modifiers
+ */
+public interface Modifiers {
+ public static final int AccAbstract = 0x1;
+
+ public static final int AccConstant = 0x2;
+
+ public static final int AccDefault = 0;
+
+ public static final int AccFinal = 0x4;
+
+ public static final int AccInterface = 0x8;
+
+ public static final int AccPrivate = 0x10;
+
+ public static final int AccProtected = 0x20;
+
+ public static final int AccPublic = 0x40;
+
+ public static final int AccStatic = 0x80;
+
+ public final static int AccReference = 0x100;
+
+ public final static int AccConst = 0x200;
+
+ public static final int AccModule = 0x400;
+
+ // this is used from tcl to declare namespaces.
+ public static final int AccNameSpace = 0x800;
+
+ public static final int AccAnnotation = 0x1000;
+
+ public static final int USER_MODIFIER = 0x10000;
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/PositionInformation.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/PositionInformation.java
new file mode 100644
index 0000000..e8c3956
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/PositionInformation.java
@@ -0,0 +1,33 @@
+package org.eclipse.dltk.ast;
+
+public final class PositionInformation {
+ public final int sourceStart;
+ public final int sourceEnd;
+ public final int nameStart;
+ public final int nameEnd;
+
+ public PositionInformation(int nameStart, int nameEnd, int sourceStart,
+ int sourceEnd) {
+
+ this.nameStart = nameStart;
+ this.nameEnd = nameEnd;
+ this.sourceEnd = sourceEnd;
+ this.sourceStart = sourceStart;
+ }
+
+ public String toString() {
+ return "[" + sourceStart + "," + sourceEnd + "]";
+ }
+
+ public boolean equals(Object o) {
+ if (o instanceof PositionInformation) {
+ PositionInformation position = (PositionInformation) o;
+ return sourceStart == position.sourceStart
+ && sourceEnd == position.sourceEnd
+ && nameStart == position.nameStart
+ && nameEnd == position.nameEnd;
+ }
+
+ return false;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Argument.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Argument.java
new file mode 100644
index 0000000..92169d6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Argument.java
@@ -0,0 +1,93 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.declarations;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.references.SimpleReference;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class Argument extends Declaration {
+
+ protected Expression initialization;
+
+ public Argument(DLTKToken name, int start, int end, Expression init) {
+ super(name, start, end);
+ this.initialization = init;
+ }
+
+ public Argument(SimpleReference name, int start, Expression init, int mods) {
+ super(start, 0);
+
+ if (name != null) {
+ this.setName(name.getName());
+ this.setEnd(start + name.getName().length());
+ }
+ this.modifiers = mods;
+ this.initialization = init;
+ if (init != null) {
+ this.setEnd(init.sourceEnd());
+ }
+ }
+
+ public Argument() {
+ super();
+ this.setStart(0);
+ this.setEnd(-1);
+ }
+
+ public int getKind() {
+ return D_ARGUMENT;
+ }
+
+ /**
+ * Please don't use this function. Helper method for initializing Argument
+ *
+ */
+ public final void set(SimpleReference mn, Expression initialization) {
+ this.initialization = initialization;
+ this.setName(mn.getName());
+ this.setStart(mn.sourceStart());
+ this.setEnd(mn.sourceEnd());
+ }
+
+ public final Expression getInitialization() {
+ return initialization;
+ }
+
+ public final void setInitializationExpression(Expression initialization) {
+ this.initialization = initialization;
+ }
+
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ if (initialization != null) {
+ initialization.traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(getName());
+ if (initialization != null) {
+ sb.append('=');
+ sb.append(initialization);
+ }
+ return sb.toString();
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrint("Argument" + this.getSourceRange().toString() + ":");
+ output.formatPrintLn(super.toString());
+ }
+
+ public void setArgumentName(String name) {
+ this.setName(name);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Declaration.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Declaration.java
new file mode 100644
index 0000000..6ab0f0b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Declaration.java
@@ -0,0 +1,172 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.declarations;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.Modifiers;
+import org.eclipse.dltk.ast.PositionInformation;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.core.ISourceRange;
+import org.eclipse.dltk.internal.core.SourceRange;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public abstract class Declaration extends Statement implements Modifiers {
+ public final static int D_ARGUMENT = 3000;
+
+ public final static int D_CLASS = 3001;
+
+ public final static int D_METHOD = 3002;
+
+ public final static int D_DECLARATOR = 3004;
+
+ protected int nameStart;
+
+ protected int nameEnd;
+
+ protected String name;
+
+ protected int modifiers;
+
+ protected Declaration() {
+ this.modifiers = 0;
+ this.nameStart = 0;
+ this.nameEnd = -1;
+ }
+
+ protected Declaration(int start, int end) {
+ super(start, end);
+ this.modifiers = 0;
+ }
+
+ protected Declaration(DLTKToken name, int start, int end) {
+ super(start, end);
+ if (name != null) {
+ this.name = name.getText();
+ this.nameStart = name.getColumn();
+ this.nameEnd = nameStart + this.name.length();
+ }
+ }
+
+ public final int getNameStart() {
+ return nameStart;
+ }
+
+ public final int getNameEnd() {
+ return nameEnd;
+ }
+
+ protected ISourceRange getNameSourceRange () {
+ return new SourceRange(getNameStart(), getNameEnd() - getNameStart() + 1);
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ public final int getModifiers() {
+ return modifiers;
+ }
+
+ public final PositionInformation getPositionInformation() {
+ return new PositionInformation(nameStart, nameEnd, sourceStart(),
+ sourceEnd());
+ }
+
+ public final void setModifier(int mods) {
+ modifiers |= mods;
+ }
+
+ public final void setModifiers(int mods) {
+ modifiers = mods;
+ }
+
+ public final void setName(String name) {
+ this.name = name;
+ }
+
+ protected void setNameEnd(int end) {
+ nameEnd = end;
+ }
+
+ protected void setNameStart(int start) {
+ nameStart = start;
+ }
+
+ public boolean isStatic() {
+ return (modifiers & AccStatic) != 0;
+ }
+
+ public boolean isPublic() {
+ return (modifiers & AccPublic) != 0;
+ }
+
+ public boolean isPrivate() {
+ return (modifiers & AccPrivate) != 0;
+ }
+
+ public boolean isProtected() {
+
+ return (modifiers & AccProtected) != 0;
+ }
+
+ public boolean isFinal() {
+ return (modifiers & AccFinal) != 0;
+ }
+
+ public boolean isAbstract() {
+ return (modifiers & AccAbstract) != 0;
+ }
+
+ public boolean isInterface() {
+ return (modifiers & AccInterface) != 0;
+ }
+
+ public String toString() {
+ String buf = "";
+
+ if (this.isStatic()) {
+ buf += "static ";
+ }
+ if (this.name != null) {
+ buf += " " + this.name;
+ }
+ return buf;
+ }
+
+ public int getKind() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public void printNode(CorePrinter output) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this))
+ pVisitor.endvisit(this);
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Declaration)) {
+ return false;
+ }
+ Declaration d = (Declaration) obj;
+ // Only name.
+ return d.name.equals(this.name) && d.nameStart == this.nameStart
+ && d.nameEnd == this.nameEnd && super.equals(obj);
+ }
+
+ public int hashCode() {
+ return this.name.hashCode();
+ }
+
+ public String debugString () {
+ return super.debugString() + this.getNameSourceRange().toString();
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Decorator.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Decorator.java
new file mode 100644
index 0000000..821aa9a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/Decorator.java
@@ -0,0 +1,14 @@
+package org.eclipse.dltk.ast.declarations;
+
+import org.eclipse.dltk.ast.DLTKToken;
+
+public abstract class Decorator extends Declaration {
+
+ protected Decorator(DLTKToken nameToken, int sourceStart, int sourceEnd) {
+ super(nameToken, sourceStart, sourceEnd);
+ }
+
+ public int getKind() {
+ return Declaration.D_DECLARATOR;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/FieldDeclaration.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/FieldDeclaration.java
new file mode 100644
index 0000000..9f0d4e1
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/FieldDeclaration.java
@@ -0,0 +1,14 @@
+package org.eclipse.dltk.ast.declarations;
+
+
+public class FieldDeclaration extends Declaration {
+
+
+ public FieldDeclaration(String name, int nameStart, int nameEnd,
+ int declStart, int declEnd) {
+ super(declStart, declEnd);
+ this.setName(name);
+ this.setNameStart(nameStart);
+ this.setNameEnd(nameEnd);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ISourceParser.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ISourceParser.java
new file mode 100644
index 0000000..78d91c3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ISourceParser.java
@@ -0,0 +1,5 @@
+package org.eclipse.dltk.ast.declarations;
+
+public interface ISourceParser {
+ ModuleDeclaration parse(String source);
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/MethodDeclaration.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/MethodDeclaration.java
new file mode 100644
index 0000000..c9a6598
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/MethodDeclaration.java
@@ -0,0 +1,177 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.declarations;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.statements.Block;
+import org.eclipse.dltk.internal.compiler.lookup.MethodBinding;
+import org.eclipse.dltk.internal.compiler.lookup.MethodScope;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class MethodDeclaration extends Declaration {
+ public MethodScope scope;
+
+ protected int bodyStart = -1;
+
+ protected int bodyEnd = -1;
+
+ protected List arguments = new ArrayList();
+
+ private Block body = new Block();
+
+ private List decorators;
+
+ private String declaringTypeName;
+
+ public MethodDeclaration(DLTKToken function_t, DLTKToken name) {
+
+ super(name, function_t.getColumn(), name.getColumn()
+ + name.getText().length());
+ }
+
+ public MethodDeclaration(String name, int nameStart, int nameEnd,
+ int declStart, int declEnd) {
+ super(declStart, declEnd);
+ this.setName(name);
+ this.setNameStart(nameStart);
+ this.setNameEnd(nameEnd);
+ }
+
+ public void setDecorators(List decorators) {
+ this.decorators = decorators;
+ }
+
+ public List getDecorators() {
+ return this.decorators;
+ }
+
+ public int getKind() {
+ return D_METHOD;
+ }
+
+ public void traverse(ASTVisitor visitor) throws Exception {
+
+ if (visitor.visit(this)) {
+ // Deocrators
+ if (decorators != null) {
+ Iterator it = decorators.iterator();
+ while (it.hasNext()) {
+ Decorator dec = (Decorator) it.next();
+ dec.traverse(visitor);
+ }
+ }
+
+ // Arguments
+ Iterator it = arguments.iterator();
+ while (it.hasNext()) {
+ Argument arg = (Argument) it.next();
+ arg.traverse(visitor);
+ }
+
+ // Body
+ if (body != null) {
+ body.traverse(visitor);
+ }
+
+ visitor.endvisit(this);
+ }
+ }
+
+ public List getArguments() {
+ return arguments;
+ }
+
+ public void acceptArguments(List arguments) {
+ this.arguments = arguments;
+ }
+
+ public void acceptBody(Block block) {
+ acceptBody(block, true);
+ }
+
+ public void acceptBody(Block block, boolean replace) {
+ this.body = block;
+
+ if (block != null) {
+ this.bodyStart = block.sourceStart();
+ this.bodyEnd = block.sourceEnd();
+ if (replace) {
+ this.setEnd(block.sourceEnd());
+ }
+ }
+ }
+
+ public List getStatements() {
+ if (body == null) {
+ body = new Block(sourceStart(), sourceEnd());
+ }
+ return body.getStatements();
+ }
+
+ public Block getBody() {
+ return body;
+ }
+
+ public void printNode(CorePrinter output) {
+ if (decorators != null) {
+ Iterator i = decorators.iterator();
+ while (i.hasNext()) {
+ ((Decorator) i.next()).printNode(output);
+ }
+ }
+ output.formatPrintLn("Method" + this.getSourceRange().toString()
+ + this.getNameSourceRange().toString() + ": " + super.toString());
+ output.formatPrintLn("(");
+ if (this.arguments != null && this.arguments.size() > 0) {
+ boolean first = true;
+ Iterator i = this.arguments.iterator();
+ while (i.hasNext()) {
+ Argument argument = (Argument) i.next();
+ if (!first) {
+ output.formatPrintLn(", ");
+ } else {
+ first = false;
+ }
+ argument.printNode(output);
+ }
+ }
+ output.formatPrintLn(")");
+ if (this.body != null) {
+ this.body.printNode(output);
+ }
+ }
+
+ public void setDeclaringTypeName(String name) {
+ if (name != null && name.length() > 0) {
+ this.declaringTypeName = name;
+ }
+ }
+
+ public String getDeclaringTypeName() {
+ return declaringTypeName;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof MethodDeclaration)) {
+ return false;
+ }
+ MethodDeclaration d = (MethodDeclaration) obj;
+ if ((this.declaringTypeName == null && d.declaringTypeName != null)
+ || (this.declaringTypeName != null && d.declaringTypeName == null)) {
+ return false;
+ }
+ // Only name.
+ return d.name.equals(this.name)
+ && d.nameStart == this.nameStart
+ && d.nameEnd == this.nameEnd
+ && (this.declaringTypeName == null || this.declaringTypeName
+ .equals(d.declaringTypeName));
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ModuleDeclaration.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ModuleDeclaration.java
new file mode 100644
index 0000000..0faf274
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/ModuleDeclaration.java
@@ -0,0 +1,146 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.declarations;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.statements.Block;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.internal.compiler.lookup.SourceModuleScope;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class ModuleDeclaration extends ASTNode {
+ private List types;
+ private List functions;
+ protected List variables;
+
+ private Block body;
+
+ private boolean rebuildEnabled;
+
+ // TODO: make private
+ public SourceModuleScope scope;
+
+ protected List getTypeList() {
+ return types;
+ }
+
+ protected List getFunctionList() {
+ return functions;
+ }
+
+ protected List getVariablesList() {
+ return variables;
+ }
+
+ public ModuleDeclaration(int sourceLength) {
+ this(sourceLength, false);
+ }
+
+ public ModuleDeclaration(int sourceLength, boolean rebuildEnabled) {
+ super(0, sourceLength);
+
+ this.body = new Block();
+ this.types = new ArrayList();
+ this.functions = new ArrayList();
+ this.variables = new ArrayList();
+
+ this.rebuildEnabled = rebuildEnabled;
+ }
+
+ public final void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ body.traverse(visitor);
+ visitor.endvisit(this);
+ }
+ }
+
+ public void setStatements(List statements) {
+ body = new Block(sourceStart(), sourceEnd(), statements);
+ }
+
+ public void addStatement(Statement statement) {
+ body.addStatement(statement);
+ }
+
+ public List getStatements() {
+ return body.getStatements();
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("Module" + this.getSourceRange().toString() + ":");
+ body.printNode(output);
+ }
+
+ public boolean isEmpty() {
+ return body.getStatements().isEmpty();
+ }
+
+ protected void doRebuild() {
+// Iterator i = this.getStatements().iterator();
+// while( i.hasNext()) {
+// ASTNode node = (ASTNode)i.next();
+// if( node instanceof MethodDeclaration ) {
+// this.functions.add( node );
+// }
+// else if( node instanceof TypeDeclaration ) {
+// this.types.add(node);
+// }
+// }
+ }
+
+ public final void rebuild() {
+ if (rebuildEnabled) {
+ doRebuild();
+ }
+ }
+
+ protected boolean isRebuildEnabled() {
+ return rebuildEnabled;
+ }
+
+ public void disableRebuild() {
+ rebuildEnabled = false;
+ }
+
+ public TypeDeclaration[] getTypes() {
+ return (TypeDeclaration[]) types.toArray(new TypeDeclaration[types
+ .size()]);
+ }
+
+ public MethodDeclaration[] getFunctions() {
+ return (MethodDeclaration[]) functions
+ .toArray(new MethodDeclaration[functions.size()]);
+ }
+
+ public ASTNode[] getNonTypeOrMethodNode() {
+ List statements = getStatements();
+ List results = new ArrayList();
+ if (statements != null) {
+ Iterator it = statements.iterator();
+ while (it.hasNext()) {
+ ASTNode node = (ASTNode) it.next();
+ if (!(node instanceof TypeDeclaration)
+ && !(node instanceof MethodDeclaration)) {
+ results.add(node);
+ }
+ }
+ }
+ return (ASTNode[]) results.toArray(new ASTNode[results.size()]);
+ }
+
+ public FieldDeclaration[] getVariables() {
+ if (this.variables == null) {
+ return null;
+ }
+ FieldDeclaration[] vars = new FieldDeclaration[this.variables.size()];
+ this.variables.toArray(vars);
+ return vars;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/TypeDeclaration.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/TypeDeclaration.java
new file mode 100644
index 0000000..0c4cc6b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/declarations/TypeDeclaration.java
@@ -0,0 +1,451 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.declarations;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.Modifiers;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.expressions.ExpressionList;
+import org.eclipse.dltk.ast.references.ExtendedVariableReference;
+import org.eclipse.dltk.ast.references.SimpleReference;
+import org.eclipse.dltk.ast.statements.Block;
+import org.eclipse.dltk.internal.compiler.lookup.TypeBinding;
+import org.eclipse.dltk.utils.CorePrinter;
+
+
+/**
+ * Used to represent types or classes.
+ */
+public class TypeDeclaration extends Declaration
+{
+ /**
+ * Body start position in associated file.
+ */
+ protected int bodyEnd;
+
+ /**
+ * Body end position in associated file.
+ */
+ protected int bodyStart;
+
+ /**
+ * Parent classes end position in associated file.
+ */
+ protected int parentEnd;
+
+ /**
+ * Parent classes start position in associated file.
+ */
+ protected int parentStart;
+
+ /**
+ * List of all super classes. Expression may be complex such as templates or other constructions.
+ */
+ protected ExpressionList fSuperClasses;
+
+ /**
+ * List of body statements.
+ */
+ protected Block fBody;
+
+ protected List fMethods;
+
+ protected List fTypes;
+
+ protected String enclosingTypeName;
+
+ public TypeDeclaration( DLTKToken name, int start, int end ) {
+
+ super( name, start, end );
+ }
+
+ /**
+ * Creates new type declaration from type name ANTLR token, start and end position.
+ * @param name - type name ANTLR token.
+ * @param start - type start position in associated file.
+ * @param end - type end position in associated file.
+ */
+ public TypeDeclaration( String name, int nameStart, int nameEnd, int start, int end ) {
+
+ super( start, end );
+ setName(name);
+ setNameStart(nameStart);
+ setNameEnd(nameEnd);
+ this.enclosingTypeName = "";
+ }
+
+ public void setEnclosingTypeName(String name) {
+ if( name.startsWith("$")) {
+ name = name.substring(1);
+ }
+ if (name != null && name.length() > 0) {
+ this.enclosingTypeName = name;
+ }
+ }
+
+ public String getEnclosingTypeName() {
+ return this.enclosingTypeName;
+ }
+
+ /**
+ * Creates type declaration from name token.
+ * @param name - name ANTRL token.
+ */
+ public TypeDeclaration( DLTKToken name ) {
+
+ super( );
+ this.setName( name.getText( ) );
+ }
+
+ /**
+ * Used to walk on tree.
+ * traverse order:
+ * superclasses,
+ * body.
+ */
+ public void traverse( ASTVisitor visitor ) throws Exception {
+
+ if( visitor.visit( this ) ) {
+ if( this.fSuperClasses != null ) {
+ this.fSuperClasses.traverse( visitor );
+ }
+ if( this.fBody != null ) {
+ fBody.traverse( visitor );
+ }
+ }
+ visitor.endvisit( this );
+ }
+
+ /**
+ * Return list of superclass declaration expressions.
+ * @return
+ */
+ public ExpressionList getSuperClasses( ) {
+
+ return this.fSuperClasses;
+ }
+
+ /**
+ * Set superclases expression list.
+ * @param exprList
+ */
+ public void setSuperClasses( ExpressionList exprList ) {
+
+ this.fSuperClasses = exprList;
+ }
+
+ /**
+ * Add superclass expression to list of superclasses.
+ * List would be created if not yet.
+ * @param expression
+ */
+ public void addSuperClass( Expression expression ) {
+
+ if( this.fSuperClasses == null ) {
+ this.fSuperClasses = new ExpressionList( );
+ }
+
+ this.fSuperClasses.addExpression( expression );
+
+ }
+
+ /**
+ * Return TypeDeclaration kind.
+ */
+
+ public int getKind( ) {
+
+ return D_CLASS;
+ }
+
+ /**
+ * Return body end position in associated file.
+ * @return
+ */
+ public int getBodyEnd( ) {
+ if( getBody() != null ) {
+ return getBody().sourceEnd();
+ }
+ return bodyEnd;
+ }
+
+ /**
+ * Sets body end position in associated file.
+ * @param bodyEnd
+ */
+ protected void setBodyEnd( int bodyEnd ) {
+
+ this.bodyEnd = bodyEnd;
+ }
+
+ /**
+ * Return body start position in associated file.
+ * @return
+ */
+ public int getBodyStart( ) {
+ if( getBody() != null ) {
+ return getBody().sourceStart();
+ }
+ return bodyStart;
+ }
+
+ /**
+ * Set body start position in associated file.
+ */
+ protected void setBodyStart( int bodyStart ) {
+
+ this.bodyStart = bodyStart;
+ }
+
+ /**
+ * Use sourceEnd() instead.
+ * @return
+ * @deprecated
+ */
+
+ public int getDeclarationSourceEnd( ) {
+
+ return this.sourceEnd();
+ }
+
+ /**
+ * Use setEnd instead
+ * @param declarationSourceEnd
+ * @deprecated
+ */
+
+ protected void setDeclarationSourceEnd( int declarationSourceEnd ) {
+ this.setEnd(declarationSourceEnd);
+ }
+
+ /**
+ * Use sourceStart instead.
+ * @return
+ * @deprecated
+ */
+
+ public int getDeclarationSourceStart( ) {
+
+ return this.sourceStart();
+ }
+
+ /**
+ * Used setStart instead
+ * @param declarationSourceStart
+ * @deprecated
+ */
+
+ protected void setDeclarationSourceStart( int declarationSourceStart ) {
+
+ this.setStart(declarationSourceStart);
+ }
+
+ /**
+ * Return parents end position in associated file.
+ * @return
+ */
+ public int getParentEnd( ) {
+
+ return parentEnd;
+ }
+
+ /**
+ * Sets parents end position in associated file.
+ * @param parentEnd
+ */
+ protected void setParentEnd( int parentEnd ) {
+
+ this.parentEnd = parentEnd;
+ }
+
+ /**
+ * Return parents start position in associated file.
+ * @return
+ */
+ public int getParentStart( ) {
+
+ return parentStart;
+ }
+
+ /**
+ * Sets parents start position in associated file.
+ * @param parentStart
+ */
+ protected void setParentStart( int parentStart ) {
+
+ this.parentStart = parentStart;
+ }
+
+ /**
+ * Set inner statements.
+ * @param body
+ */
+ public void setBody( Block body ) {
+
+ this.fBody = body;
+ if( body != null ) {
+ this.bodyStart = body.sourceStart();
+ this.bodyEnd = body.sourceEnd();
+ //this.setEnd(body.sourceEnd()); //XXX: why?
+ }
+ }
+ public Block getBody() {
+ return this.fBody;
+ }
+
+ /**
+ * Set inner statements with start and end position in associated file.
+ * @param startBody - start position.
+ * @param body - inner statements.
+ * @param endBody - end position.
+ */
+ public void setBody( int startBody, Block body, int endBody ) {
+
+ this.setBody( body );
+ this.setBodyStart( startBody );
+ this.setBodyEnd( endBody );
+ }
+
+ /**
+ * Return super class names.
+ * @return
+ */
+ public List/*<String>*/ getSuperClassNames()
+ {
+ List/*< String >*/ names = new ArrayList/*< String >*/();
+ if( this.fSuperClasses != null ) {
+ List/*< Expression >*/ superClasseExpressions = this.fSuperClasses.getExpressions( );
+ Iterator i = superClasseExpressions.iterator();
+ while( i.hasNext() ) {
+ Expression expr = (Expression)i.next();
+ if( expr instanceof SimpleReference ) {
+ names.add( ((SimpleReference)expr ).getName() );
+ }
+ else if( expr instanceof ExtendedVariableReference ) {
+ // TODO: Add correct solution here.
+ ExtendedVariableReference ref = (ExtendedVariableReference)expr;
+ List/*< Expression >*/ exprs = ref.getExpressions();
+ boolean notAllSR = false;
+ Iterator j = exprs.iterator();
+ while( j.hasNext()) {
+ Expression ex = (Expression)j.next();
+ if( !( ex instanceof SimpleReference ) ) {
+ notAllSR = true;
+ }
+ }
+ if( notAllSR == false ) {
+ String name = "";
+ boolean bFirst = true;
+ Iterator j2 = exprs.iterator();
+ while( j2.hasNext()) {
+ Expression ex = (Expression)j2.next();
+ if( bFirst ) {
+ bFirst = false;
+ }
+ else {
+ name += ".";
+ }
+ name += ( (SimpleReference)ex ).getName();
+ }
+ names.add( ref.getStringRepresentation() );
+ }
+ }
+ }
+ }
+ return names;
+ }
+
+ /**
+ * Testing purpose only.
+ * Prints type and all inner statements to printer.
+ */
+ public void printNode( CorePrinter output ) {
+
+ output.formatPrintLn( "Type" + this.getSourceRange().toString()+ this.getNameSourceRange().toString() +":" );
+ String name = this.getName( );
+ if( name != null ) {
+ output.formatPrintLn( name );
+ }
+ if( this.fSuperClasses != null ) {
+ output.formatPrintLn( "(" );
+ this.fSuperClasses.printNode( output );
+ output.formatPrintLn( ")" );
+ }
+ if( this.fBody != null ) {
+ this.fBody.printNode( output );
+ }
+ }
+ public MethodDeclaration[] getMethods() {
+ if( this.fMethods == null ) {
+ initInners();
+ }
+ return (MethodDeclaration[])this.fMethods.toArray(new MethodDeclaration[this.fMethods.size()]);
+ }
+
+ public TypeDeclaration[] getTypes() {
+ if( this.fTypes == null ) {
+ initInners();
+ }
+ return (TypeDeclaration[])this.fTypes.toArray(new TypeDeclaration[this.fTypes.size()]);
+ }
+
+ private void initInners() {
+ this.fMethods = new ArrayList();
+ this.fTypes = new ArrayList();
+ if( this.fBody != null && this.fBody.getStatements() != null ) {
+ Iterator i = this.fBody.getStatements().iterator();
+ while( i.hasNext()) {
+ ASTNode node = (ASTNode)i.next();
+ if( node instanceof MethodDeclaration ) {
+ this.fMethods.add( node );
+ }
+ else if( node instanceof TypeDeclaration ) {
+ this.fTypes.add(node);
+ }
+ }
+ }
+ }
+ public List getStatements() {
+ if( this.fBody == null ) {
+ this.fBody = new Block(this.sourceStart(), this.sourceEnd(), null);
+ }
+ return this.fBody.getStatements();
+ }
+
+ public ASTNode[] getNonTypeOrMethodNode() {
+ List statements = getStatements();
+ if( statements != null ) {
+ Iterator i = statements.iterator();
+ List results = new ArrayList();
+ while( i.hasNext() ) {
+ ASTNode node = (ASTNode)i.next();
+ if( !(node instanceof TypeDeclaration) && !(node instanceof MethodDeclaration) ) {
+ results.add(node);
+ }
+ }
+ return (ASTNode[])results.toArray(new ASTNode[results.size()]);
+ }
+ return null;
+ }
+
+ public FieldDeclaration[] getVariables() {
+ return null;
+ }
+
+ public String debugString() {
+ String prev = super.debugString();
+ if ((this.getModifiers() & Modifiers.AccModule) != 0)
+ prev += "(module)";
+ return prev;
+ }
+
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Assignment.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Assignment.java
new file mode 100644
index 0000000..dcb4bdc
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Assignment.java
@@ -0,0 +1,76 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Assignment expression used to hold a = b expressions.
+ */
+public class Assignment extends BinaryExpression
+{
+
+ /**
+ * Construct from left, right and type expression. Used to construct NotStrictAssignment class.
+ *
+ * @param left
+ * @param type
+ * @param right
+ */
+ protected Assignment( Expression left, int type, Statement right ) {
+
+ super( left, type, right );
+ }
+
+ /**
+ * Construct default strict assignment.
+ *
+ * @param left
+ * @param right
+ */
+ public Assignment( Expression left, Statement right ) {
+
+ super( left, E_ASSIGN, right );
+ }
+
+ /**
+ * Traverse on childs. Order: left, right
+ */
+ public void traverse( ASTVisitor visitor ) throws Exception {
+
+ if( visitor.visit( this ) ) {
+ if( left != null ) {
+ left.traverse( visitor );
+ }
+ if( right != null ) {
+ right.traverse( visitor );
+ }
+ visitor.endvisit( this );
+ }
+ }
+
+ /**
+ * Convert to string in pettern: "left = right"
+ */
+ public String toString( ) {
+
+ return this.left.toString( ) + '=' + this.right.toString( );
+ }
+
+ /**
+ * Testing purposes only. Used to print expression.
+ */
+ public void printNode( CorePrinter output ) {
+
+ if( this.left != null ) {
+ this.left.printNode( output );
+ }
+ output.formatPrintLn( " = " );
+ if( this.right != null ) {
+ right.printNode( output );
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BinaryExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BinaryExpression.java
new file mode 100644
index 0000000..1f462bd
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BinaryExpression.java
@@ -0,0 +1,132 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Base binary class for binary Expressions.
+ */
+public class BinaryExpression extends Expression
+{
+
+ /**
+ * Left part of binary expression.
+ */
+
+ protected Expression left;
+
+ /**
+ * Right part of binary expression.
+ */
+ protected Statement right;
+
+ /**
+ * Expression kind.
+ *
+ * @see Expressions for kind constants.
+ */
+ protected int kind;
+
+ /**
+ * Construct binary expression from left, right and type.
+ *
+ * @param left -
+ * left expression.
+ * @param type -
+ * expression kind.
+ * @param right -
+ * right expression.
+ */
+ public BinaryExpression( Expression left, int type, Statement right ) {
+
+ super( );
+ if( left != null ) {
+ this.setStart( left.sourceStart( ) );
+ }
+ if( right != null ) {
+ this.setEnd( right.sourceEnd( ) );
+ }
+ this.kind = type;
+ this.left = left;
+ this.right = right;
+ }
+
+ /**
+ * Return Left Expression.
+ *
+ * @return
+ */
+ public Expression getLeft( ) {
+
+ return left;
+ }
+
+ /**
+ * Return right expression.
+ *
+ * @return
+ */
+ public Statement getRight( ) {
+
+ return right;
+ }
+
+ /**
+ * Traverse to childs.
+ */
+ public void traverse( ASTVisitor pVisitor ) throws Exception {
+
+ if( pVisitor.visit( this ) ) {
+ if( left != null ) {
+ left.traverse( pVisitor );
+ }
+ if( right != null ) {
+ right.traverse( pVisitor );
+ }
+ pVisitor.endvisit( this );
+ }
+ }
+
+ /**
+ * Convert this expression into string using Expression.getOperator to get operation presentation.
+ */
+ public String toString( ) {
+
+ String out = "";
+ if( left != null ) {
+ out += left.toString( );
+ }
+ out += this.getOperator( );
+ if( right != null ) {
+ out += this.right.toString( );
+ }
+ return out;
+ }
+
+ /**
+ * Return Binary Expression Kind.
+ */
+ public int getKind( ) {
+
+ return kind;
+ }
+
+ /**
+ * Testing purpose only.
+ */
+ public void printNode( CorePrinter output ) {
+
+ if( this.left != null ) {
+ this.left.printNode( output );
+ }
+ output.formatPrintLn( this.getOperator( ) );
+
+ if( this.right != null ) {
+ this.right.printNode( output );
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BooleanLiteral.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BooleanLiteral.java
new file mode 100644
index 0000000..ff8204e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/BooleanLiteral.java
@@ -0,0 +1,39 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Boolean literal representation.
+ *
+ */
+public class BooleanLiteral extends Literal {
+
+ /**
+ * Construct from ANTLR token.
+ *
+ * @param t
+ */
+ public BooleanLiteral(DLTKToken t) {
+ super(t);
+ }
+
+ /**
+ * Return expression kind.
+ */
+ public int getKind() {
+ return BOOLEAN_LITERAL;
+ }
+
+ /**
+ * Testing purposes only. Print boolean value.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("Boolean:" + this.getValue());
+
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallArgumentsList.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallArgumentsList.java
new file mode 100644
index 0000000..998e240
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallArgumentsList.java
@@ -0,0 +1,35 @@
+package org.eclipse.dltk.ast.expressions;
+
+import java.util.List;
+
+public class CallArgumentsList extends ExpressionList {
+
+ public static final CallArgumentsList EMPTY = new CallArgumentsList() {
+
+ public void addExpression(Expression ex) {
+ throw new IllegalStateException("This object is unmodifiable");
+ }
+
+ public void setExpresssions(List exs) {
+ throw new IllegalStateException("This object is unmodifiable");
+ }
+
+ public void setEnd(int end) {
+ throw new IllegalStateException("This object is unmodifiable");
+ }
+
+ public void setStart(int start) {
+ throw new IllegalStateException("This object is unmodifiable");
+ }
+
+ };
+
+ public CallArgumentsList() {
+ super();
+ }
+
+ public CallArgumentsList(int start, int end) {
+ super(start, end);
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallExpression.java
new file mode 100644
index 0000000..fd7e2b9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/CallExpression.java
@@ -0,0 +1,72 @@
+package org.eclipse.dltk.ast.expressions;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class CallExpression extends Expression {
+ private Statement receiver;
+ private String name;
+
+ /**
+ * The main reason why this is a list node rather than a simple array/collection is that
+ * the client might want to traverse the arguments separately.
+ */
+ private CallArgumentsList args;
+
+ public CallExpression(Statement receiver, String name, CallArgumentsList args) {
+ Assert.isNotNull(name);
+ Assert.isNotNull(args);
+
+ this.receiver = receiver;
+ this.name = name;
+ this.args = args;
+ }
+
+ public int getKind() {
+ return 0;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if( pVisitor.visit( this ) ) {
+ if( receiver != null ) {
+ receiver.traverse( pVisitor );
+ }
+
+ if( args != null ) {
+ args.traverse( pVisitor );
+ }
+ pVisitor.endvisit( this );
+ }
+ }
+
+ public Statement getReceiver() {
+ return receiver;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public CallArgumentsList getArgs () {
+ return args;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrint("CallExpression" + this.getSourceRange().toString() + ":");
+ if (this.receiver != null) {
+ output.formatPrint("{");
+ this.receiver.printNode(output);
+ output.formatPrint("}.");
+ }
+ output.formatPrint(this.getName() + "(");
+ if (this.getArgs() != null) {
+ this.getArgs().printNode(output);
+ }
+ output.formatPrintLn(")");
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/EmptyExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/EmptyExpression.java
new file mode 100644
index 0000000..de4da81
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/EmptyExpression.java
@@ -0,0 +1,40 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Empty Expression node. May be used as viod return type.
+ */
+public class EmptyExpression extends Expression {
+ /**
+ * Construct empty expression.
+ */
+ public EmptyExpression() {
+ }
+
+ /**
+ * Return kind.
+ */
+ public int getKind() {
+ return E_EMPTY;
+ }
+
+ /**
+ * Traverse.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Testing purposes only. No needed printing.
+ */
+ public void printNode(CorePrinter output) {
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Expression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Expression.java
new file mode 100644
index 0000000..be6dd07
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Expression.java
@@ -0,0 +1,169 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Base class for all expressions.
+ */
+public abstract class Expression extends Statement implements
+ ExpressionConstants {
+
+ /**
+ * Construct expression from start end end associated position.
+ *
+ * @param start
+ * @param end
+ */
+ protected Expression(int start, int end) {
+ super(start, end);
+ }
+
+ /**
+ * Construct expression without positions bintings.
+ */
+ protected Expression() {
+
+ }
+
+ /**
+ * Construct expression with bindings to ANTLR Token.
+ *
+ * @param token
+ */
+ public Expression(DLTKToken token) {
+ super(token);
+ }
+
+ /**
+ * Return string representation of this expression operator. If this is
+ * aruthmetic, binary of assigment expression return expressin symbol. For
+ * some custom expressions return *.
+ *
+ * @return string expression operator representation
+ */
+ public String getOperator() {
+ switch (this.getKind()) {
+ case E_BAND:
+ return " and ";
+ case E_BOR:
+ return " or ";
+ case E_BXOR:
+ return " xor ";
+ case E_DIV:
+ return "/";
+ case E_EQUAL:
+ return "==";
+ case E_LT:
+ return "<";
+ case E_LE:
+ return "<=";
+ case E_GT:
+ return ">";
+ case E_GE:
+ return ">=";
+ case E_MOD:
+ return "%";
+ case E_CONCAT:
+ return ".";
+ case E_XOR:
+ return " xor ";
+ case E_LAND:
+ return "&&";
+ case E_LOR:
+ return "||";
+ case E_LSHIFT:
+ return "<<";
+ case E_MINUS:
+ return "-";
+ case E_PLUS:
+ return "+";
+ case E_MULT:
+ return "*";
+ case E_RSHIFT:
+ return ">>";
+ case E_DOT_ASSIGN:
+ return ".=";
+ case E_IDENTICAL:
+ return "===";
+ case E_NOTIDENTICAL:
+ return "!===";
+ case E_LNOT:
+ return "!";
+ case E_BNOT:
+ return "~";
+ case E_BNOT_ASSIGN:
+ return "~=";
+ case E_NOT_EQUAL:
+ return "!=";
+ case E_NOT_EQUAL2:
+ return "<>";
+ case E_DIV_ASSIGN:
+ return "/=";
+ case E_PLUS_ASSIGN:
+ return "+=";
+ case E_INC:
+ return "++";
+ case E_MINUS_ASSIGN:
+ return "-=";
+ case E_DEC:
+ return "--";
+ case E_MOD_ASSIGN:
+ return "%=";
+ case E_MULT_ASSIGN:
+ return "*=";
+ case E_SR_ASSIGN:
+ return ">>=";
+ case E_SL_ASSIGN:
+ return "<<=";
+ case E_BXOR_ASSIGN:
+ return "^=";
+ case E_BAND_ASSIGN:
+ return "&=";
+ case E_DOUBLE_ARROW:
+ return "=>";
+ case E_SINGLE_ARROW:
+ return "->";
+ case E_AT:
+ return "@";
+ case E_DOLLAR:
+ return "$";
+ case E_COMMA:
+ return ",";
+ case E_BOR_ASSIGN:
+ return "|=";
+ case E_CONCAT_ASSIGN:
+ return ".=";
+ case E_TILDE:
+ return "~";
+ case E_DOUBLESTAR_ASSIGN:
+ return "**=";
+ case E_DOUBLEDIV_ASSIGN:
+ return "//=";
+ case E_POWER:
+ return "**";
+ }
+
+ return "*";
+ }
+
+ /**
+ * Testing purposes only. Print expression.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("Expression" + this.getSourceRange().toString() + ":" + this.getKind());
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Statement)) {
+ return false;
+ }
+ Statement d = (Statement) obj;
+ return sourceStart() == d.sourceStart() && sourceEnd() == d.sourceEnd()
+ && getKind() == d.getKind();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionConstants.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionConstants.java
new file mode 100644
index 0000000..73ad850
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionConstants.java
@@ -0,0 +1,175 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+/**
+ *
+ * Holds all constants used in expression. This is language independent set of
+ * constants.
+ *
+ */
+public interface ExpressionConstants {
+ /**
+ * Expression Constants
+ */
+ static public final int E_PLUS = 1000;
+
+ static public final int E_MINUS = 1001;
+
+ static public final int E_MULT = 1002;
+
+ static public final int E_DIV = 1003;
+
+ static public final int E_LOR = 1004;
+
+ static public final int E_XOR = 1005;
+
+ static public final int E_BOR = 1006;
+
+ static public final int E_EMPTY = 1006;
+
+ static public final int E_BAND = 1007;
+
+ static public final int E_LAND = 1008;
+
+ static public final int E_LSHIFT = 1009;
+
+ static public final int E_RSHIFT = 1010;
+
+ static public final int E_BXOR = 1011;
+
+ static public final int E_ALLOC = 1012;
+
+ static public final int E_EQUAL = 1013;
+
+ static public final int E_LT = 1014;
+
+ static public final int E_LE = 1015;
+
+ static public final int E_GT = 1016;
+
+ static public final int E_GE = 1017;
+
+ static public final int E_CONCAT = 1018;
+
+ static public final int E_MOD = 1019;
+
+ static public final int E_DOT_ASSIGN = 1020;
+
+ static public final int E_ARRAY = 1021;
+
+ static public final int E_IDENTICAL = 1022;
+
+ static public final int E_LIST = 1023;
+
+ static public final int E_NOTIDENTICAL = 1024;
+
+ static public final int E_NOT_IDENTICAL = 1025;
+
+ static public final int E_LNOT = 1026;
+
+ static public final int E_BNOT = 1027;
+
+ static public final int E_BNOT_ASSIGN = 1028;
+
+ static public final int E_NOT_EQUAL = 1029;
+
+ static public final int E_NOT_EQUAL2 = 1030;
+
+ static public final int E_DIV_ASSIGN = 1031;
+
+ static public final int E_PLUS_ASSIGN = 1032;
+
+ static public final int E_INC = 1033;
+
+ static public final int E_MINUS_ASSIGN = 1034;
+
+ static public final int E_DEC = 1035;
+
+ static public final int E_MOD_ASSIGN = 1036;
+
+ static public final int E_MULT_ASSIGN = 1037;
+
+ static public final int E_SR_ASSIGN = 1038;
+
+ static public final int E_SL_ASSIGN = 1039;
+
+ static public final int E_BXOR_ASSIGN = 1040;
+
+ static public final int E_BAND_ASSIGN = 1041;
+
+ static public final int E_DOUBLE_ARROW = 1042;
+
+ static public final int E_SINGLE_ARROW = 1043;
+
+ static public final int E_DOLLAR = 1045;
+
+ static public final int E_COMMA = 1046;
+
+ static public final int E_BOR_ASSIGN = 1047;
+
+ static public final int E_CONCAT_ASSIGN = 1048;
+
+ static public final int E_INDEX = 1049;
+
+ static public final int E_NOTIN = 1050;
+
+ static public final int E_IS = 1051;
+
+ static public final int E_ISNOT = 1052;
+
+ static public final int E_IN = 1053;
+
+ static public final int E_ASSIGN = 1054;
+
+ static public final int NUMBER_LITERAL = 1055;
+
+ static public final int STRING_LITERAL = 1056;
+
+ static public final int BOOLEAN_LITERAL = 1057;
+
+ static public final int E_IMPORT = 1058;
+
+ static public final int E_INSTANSEOF = 1059;
+
+ static public final int E_CAST = 1060;
+
+ static public final int E_PAREN = 1061;
+
+ static public final int E_CONDITIONAL = 1062;
+
+ static public final int E_REF = 1063;
+
+ static public final int E_EXPRESSION_LIST = 1064;
+
+ static public final int E_REFERENCE = 1065;
+
+ static public final int E_PRINT = 1066;
+
+ static public final int E_CALL = 1067;
+
+ static public final int E_DOT = 1068;
+
+ static public final int E_CURLY = 1069;
+
+ static public final int E_FACTOR = 1070;
+
+ static public final int E_IDENTIFIER = 1071;
+
+ static public final int E_DICT = 1072;
+
+ static public final int E_SUBSCRIPT = 1073;
+
+ static public final int E_AT = 1074;
+
+ static public final int E_TILDE = 1075;
+
+ static public final int E_DOUBLESTAR_ASSIGN = 1076;
+
+ static public final int E_DOUBLEDIV_ASSIGN = 1077;
+
+ static public final int E_POWER = 1078;
+
+ static public final int USER_EXPRESSION_START = 10000;
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionList.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionList.java
new file mode 100644
index 0000000..a53cb16
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ExpressionList.java
@@ -0,0 +1,117 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Holds list of expressions.
+ */
+public class ExpressionList extends Expression {
+ /**
+ * Expressions.
+ */
+ private List fExpressions = new ArrayList();
+
+ /**
+ * Construct from position bindings.
+ *
+ * @param start
+ * @param end
+ */
+ protected ExpressionList(int start, int end) {
+ super(start, end);
+ }
+
+ /**
+ * Construct without position bindings. And without elements. By default
+ * expression list is initialized. So you can call getExpressions after
+ * creation.
+ *
+ */
+ public ExpressionList() {
+
+ }
+
+ /**
+ * Walk on tree.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ Iterator i = fExpressions.iterator();
+ while (i.hasNext()) {
+ Expression e = (Expression) i.next();
+ e.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Return expression kind.
+ */
+ public int getKind() {
+ return E_EXPRESSION_LIST;
+ }
+
+ /**
+ * Set expressions to selected list.
+ *
+ * @param exs
+ */
+ public void setExpresssions(List exs) {
+ Iterator i = exs.iterator();
+ while (i.hasNext()) {
+ Expression e = (Expression) i.next();
+ this.addExpression(e);
+ }
+ }
+
+ /**
+ * Add expression to current list. If expressions list is null, then is is
+ * created.
+ */
+ public void addExpression(Expression ex) {
+ if (this.fExpressions == null) {
+ this.fExpressions = new ArrayList/* < Expression > */();
+ }
+ if (ex != null) {
+ this.fExpressions.add(ex);
+ }
+ }
+
+ /**
+ * Return expressions.
+ *
+ * @return - expressions list.
+ */
+ public List getExpressions() {
+ return fExpressions;
+ }
+
+ /**
+ * Testing purposes only. Prints all expressions.
+ */
+ public void printNode(CorePrinter output) {
+ if (this.fExpressions != null) {
+ int index = 0;
+ Iterator i = fExpressions.iterator();
+ while (i.hasNext()) {
+ Expression expr = (Expression) i.next();
+
+ expr.printNode(output);
+
+ if (index != this.fExpressions.size() - 1) {
+ output.formatPrintLn(", ");
+ }
+ index += 1;
+ }
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/InstanceOfExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/InstanceOfExpression.java
new file mode 100644
index 0000000..e2fc4f3
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/InstanceOfExpression.java
@@ -0,0 +1,20 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+/**
+ * Instanceof expression.
+ */
+public class InstanceOfExpression extends BinaryExpression {
+
+ /**
+ * Constructs from expression of variable and expression of type.
+ *
+ * @param variable
+ * @param type
+ */
+ public InstanceOfExpression(Expression variable, Expression type) {
+ super(variable, E_INSTANSEOF, type);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Literal.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Literal.java
new file mode 100644
index 0000000..83a08ad
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/Literal.java
@@ -0,0 +1,73 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ *
+ * Literal expression. Base class for various literals such as Number or String.
+ */
+public abstract class Literal extends Expression {
+
+ /**
+ * Value.
+ */
+ protected String fLiteralValue;
+
+ /**
+ * Construct with position bindings.
+ *
+ * @param start -
+ * start position in associated file.
+ * @param end -
+ * end position in associated file.
+ */
+ protected Literal(int start, int end) {
+ super(start, end);
+ }
+
+ /**
+ * Construcs from ANTLR token with position bindings. Token holds value.
+ *
+ * @param token -
+ * ANTLR token.
+ */
+ protected Literal(DLTKToken token) {
+ super(token);
+ this.fLiteralValue = token.getText();
+ }
+
+ /**
+ * Traverse to this node.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Return value of this literal.
+ */
+ public String toString() {
+ return fLiteralValue;
+ }
+
+ /**
+ * Return value of this literal.
+ */
+ public String getValue() {
+ return fLiteralValue;
+ }
+
+ /**
+ * Testing purposes only. Print literal.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("Literal" + this.getSourceRange().toString() + ":" + this.getValue());
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NotStrictAssignment.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NotStrictAssignment.java
new file mode 100644
index 0000000..0d634bb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NotStrictAssignment.java
@@ -0,0 +1,42 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * NonStrict Assignment representation. Used to hold assignments such as +=, -=
+ * etc.
+ *
+ */
+public class NotStrictAssignment extends Assignment {
+
+ /**
+ * Construct from Expression and expression type.
+ *
+ * @param left -
+ * left expression.
+ * @param type -
+ * expression type.
+ * @param right -
+ * right expression.
+ */
+ public NotStrictAssignment(Expression left, int type, Expression right) {
+ super(left, type, right);
+ }
+
+ /**
+ * Testing purposes only. Used to print expression.
+ */
+
+ public void printNode(CorePrinter output) {
+ if (this.left != null) {
+ this.left.printNode(output);
+ }
+ output.formatPrintLn(this.getOperator());
+ if (this.right != null) {
+ right.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NumericLiteral.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NumericLiteral.java
new file mode 100644
index 0000000..d800bce
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/NumericLiteral.java
@@ -0,0 +1,37 @@
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ *
+ * Numeric literal. Used to hold ints, floats and complex numbers.
+ *
+ */
+public class NumericLiteral extends Literal {
+
+ /**
+ * Construct from ANTLR token. With appropriate position information.
+ *
+ * @param number
+ */
+ public NumericLiteral(DLTKToken number) {
+ super(number);
+ }
+
+ /**
+ * Return kind.
+ */
+
+ public int getKind() {
+ return NUMBER_LITERAL;
+ }
+
+ /**
+ * Testing purposes only. Used to print number.
+ */
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn(this.getValue());
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ParenExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ParenExpression.java
new file mode 100644
index 0000000..d2b0913
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/ParenExpression.java
@@ -0,0 +1,23 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+/**
+ * ( x ) expression.
+ */
+public class ParenExpression extends UnaryExpression {
+
+ /**
+ * Construct from position bindings.
+ *
+ * @param start -
+ * start position in associated file.
+ * @param end -
+ * end position in associated file.
+ * @param parenExpression
+ */
+ public ParenExpression(int start, int end, Expression parenExpression) {
+ super(start, end, E_PAREN, parenExpression);
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/PrintExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/PrintExpression.java
new file mode 100644
index 0000000..52a2e54
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/PrintExpression.java
@@ -0,0 +1,39 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Print expression.
+ */
+public class PrintExpression extends UnaryExpression {
+
+ /**
+ * Construct from ANTLR token and right expression.
+ *
+ * @param p
+ * @param right
+ */
+ public PrintExpression(DLTKToken p, Expression right) {
+ super(p, E_PRINT, right);
+
+ if (right != null) {
+ this.setEnd(right.sourceEnd());
+ }
+ }
+
+ /**
+ * Testing purposes only. Print "print" expression.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("print ");
+ Expression expr = this.getExpression();
+ if (expr != null) {
+ expr.printNode(output);
+ }
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/StringLiteral.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/StringLiteral.java
new file mode 100644
index 0000000..0ea3acf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/StringLiteral.java
@@ -0,0 +1,51 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * String representation.
+ */
+public class StringLiteral extends Literal {
+
+ /**
+ * Construct from ATRL token.
+ *
+ * @param t
+ */
+ public StringLiteral(DLTKToken t) {
+ super(t);
+ }
+
+ /**
+ * Construct from position information and value.
+ *
+ * @param start -
+ * start position.
+ * @param end -
+ * end position.
+ * @param value -
+ * value.
+ */
+ public StringLiteral(int start, int end, String value) {
+ super(start, end);
+ this.fLiteralValue = value;
+ }
+
+ /**
+ * Return kind.
+ */
+ public int getKind() {
+ return STRING_LITERAL;
+ }
+
+ /**
+ * Testing purposes only. Used to print value.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn(this.getValue());
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/UnaryExpression.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/UnaryExpression.java
new file mode 100644
index 0000000..fafeb7d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/expressions/UnaryExpression.java
@@ -0,0 +1,107 @@
+/*
+ * Created on 06.06.2004
+ *
+ * TODO To change the template for this generated file go to Window - Preferences - Script - Code Style - Code Templates
+ */
+package org.eclipse.dltk.ast.expressions;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Unary expression.
+ *
+ * Such as ++x, --x, +x, -x and other.
+ *
+ */
+public class UnaryExpression extends Expression {
+
+ /**
+ * Expression.
+ */
+ protected Expression expression;
+
+ /**
+ * Unary kind.
+ */
+ protected int kind;
+
+ /**
+ * Construct from position information, kind and expression.
+ *
+ * @param start -
+ * start position.
+ * @param end -
+ * end position.
+ * @param knd -
+ * unary kind.
+ * @see ExpressionConstants.
+ * @param expression -
+ * expression.
+ */
+ public UnaryExpression(int start, int end, int knd, Expression expression) {
+ super(start, end);
+ this.kind = knd;
+ this.expression = expression;
+ }
+
+ /**
+ * Construct from ANTLR token, kind and expression.
+ *
+ * @param t -
+ * ANTLR token.
+ * @param knd -
+ * unary expression lind.
+ * @see ExpresionConstants.
+ * @param expression -
+ * expression.
+ */
+ public UnaryExpression(DLTKToken t, int knd, Expression expression) {
+ super(t);
+ if (expression != null) {
+ this.setEnd(expression.sourceEnd());
+ }
+ this.kind = knd;
+ this.expression = expression;
+ }
+
+ /**
+ * Traverse.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (expression != null) {
+ expression.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Return unary expression kind.
+ */
+
+ public int getKind() {
+ return kind;
+ }
+
+ /**
+ * Return expression.
+ *
+ * @return
+ */
+ public Expression getExpression() {
+ return this.expression;
+ }
+
+ /**
+ * Testing purposes only. Used to print unary expression.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn(this.getOperator());
+ if (this.expression != null) {
+ this.expression.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/CallHolder.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/CallHolder.java
new file mode 100644
index 0000000..c140cc6
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/CallHolder.java
@@ -0,0 +1,67 @@
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Holds call arguments. Used to ExtendedVariableReference holding.
+ *
+ * @author haiodo
+ *
+ */
+public class CallHolder extends Expression {
+ /**
+ * Can be EmptyExpression if no arguments are specified. Overwise it
+ * possible list of expressions, if only one argument too.
+ */
+ private Expression fArguments = null;
+
+ /**
+ * Construct from position information and arguments.
+ *
+ * @param start -
+ * start
+ * @param end
+ * @param arguments
+ */
+ public CallHolder(int start, int end, Expression arguments) {
+
+ super(start, end);
+ this.fArguments = arguments;
+ }
+
+ /**
+ * Return kind.
+ */
+ public int getKind() {
+ return Expression.E_CALL;
+ }
+
+ /**
+ * Traverse.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (this.fArguments != null) {
+ this.fArguments.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public Expression getArguments() {
+ return fArguments;
+ }
+
+ /**
+ * Testing purpose only. Used to print "call".
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("( ");
+ if (this.fArguments != null) {
+ this.fArguments.printNode(output);
+ }
+ output.formatPrintLn(" )");
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ConstantReference.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ConstantReference.java
new file mode 100644
index 0000000..5c3ba63
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ConstantReference.java
@@ -0,0 +1,18 @@
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.DLTKToken;
+
+public class ConstantReference extends SimpleReference {
+
+ public ConstantReference(DLTKToken token) {
+ super(token);
+ // TODO Auto-generated constructor stub
+ }
+
+ public ConstantReference(int start, int end, String name) {
+ super(start, end, name);
+ // TODO Auto-generated constructor stub
+ }
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Curly.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Curly.java
new file mode 100644
index 0000000..42bb811
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Curly.java
@@ -0,0 +1,32 @@
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.expressions.UnaryExpression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Curly expression.
+ */
+public class Curly extends UnaryExpression {
+ /**
+ * Construct curly.
+ *
+ * @param start
+ * @param end
+ * @param e
+ */
+ public Curly(int start, int end, Expression e) {
+ super(start, end, E_CURLY, e);
+ }
+
+ /**
+ * Testing purposes only. Print curly with expression.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn(" { ");
+ if (this.expression != null) {
+ this.expression.printNode(output);
+ }
+ output.formatPrintLn(" } ");
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ExtendedVariableReference.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ExtendedVariableReference.java
new file mode 100644
index 0000000..b08bcaf
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/ExtendedVariableReference.java
@@ -0,0 +1,237 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.references;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Holds extended variables as list of VariableReference, CallHolder,
+ * IndexHolder.. Example: 1) z.a.f() it is be: ( VariableReference,
+ * VariableReference, VariableReference, CallHolder ) 2) a.f().q[2] it is be: (
+ * VariableReference, VariableReference, CallHolder, VariableReference,
+ * IndexHolder )
+ */
+// TODO: May be needed add traverse for index and calls?
+public class ExtendedVariableReference extends Reference {
+ /**
+ * List of expressions.
+ */
+ private List fExpressions = new ArrayList();
+
+ /**
+ * @param expr -
+ * logically expr should be instance of VariableReference.
+ */
+ public ExtendedVariableReference(Expression expr) {
+ if (expr != null) {
+ this.addExpression(expr);
+ this.setStart(expr.sourceStart());
+ this.setEnd(expr.sourceEnd());
+ }
+ }
+
+ /**
+ * Return Identifier Kind.
+ */
+ public int getKind() {
+ return E_IDENTIFIER;
+ }
+
+ /**
+ * Adding expression to extended variable. Use only in parsers then
+ * construct.
+ *
+ * @param expr
+ */
+ public void addExpression(Expression expr) {
+ if (expr != null) {
+ this.fExpressions.add(expr);
+ if (expr.sourceEnd() > this.sourceEnd()) {
+ setEnd(expr.sourceEnd());
+ }
+ }
+ }
+
+ /**
+ * Set Expressions. Use only in parsers then construct.
+ *
+ * @param exprs
+ */
+ public void setExpresssions(List exprs) {
+ this.fExpressions = exprs;
+ }
+
+ /**
+ * Return expressions.
+ *
+ * @return
+ */
+ public List getExpressions() {
+ return this.fExpressions;
+ }
+
+ // Checkers
+
+ /**
+ * tests for next element of index is call
+ */
+ public boolean isCall(int index) {
+ List expressions = this.getExpressions();
+ if (expressions == null) {
+ return false;
+ }
+
+ if (index < expressions.size() - 1) {
+ Expression afterIndexExpression = (Expression) expressions
+ .get(index + 1);
+
+ if (afterIndexExpression instanceof CallHolder) {
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * tests for next element of index is index
+ */
+ public boolean isIndex(int index) {
+ List expressions = this.getExpressions();
+ if (expressions == null) {
+ return false;
+ }
+ if (index < expressions.size() - 1) {
+ Expression afterIndexExpression = (Expression) expressions
+ .get(index + 1);
+ if (afterIndexExpression instanceof IndexHolder) {
+ return true;
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * tests for next element of index is dot
+ */
+ public boolean isDot(int index) {
+ List expressions = this.getExpressions();
+ if (expressions == null) {
+ return false;
+ }
+ if (index < expressions.size() - 1) {
+ Expression afterIndexExpression = (Expression) expressions
+ .get(index + 1);
+ if (!(afterIndexExpression instanceof CallHolder)
+ && !(afterIndexExpression instanceof IndexHolder)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Used to get name of this variable from sub names.
+ */
+
+ // TODO: FIX MY PERFOMANCE
+ public String getStringRepresentation() {
+ StringBuffer b = new StringBuffer();
+ Iterator i = this.fExpressions.iterator();
+ while (i.hasNext()) {
+ Expression e = (Expression) i.next();
+ switch (e.getKind()) {
+ case E_IDENTIFIER:
+ Reference s = (Reference) e;
+ b.append(s.getStringRepresentation());
+
+ // TODO: Add to check for next is CallHolder, or next in
+ // IndexHolder.
+ b.append('.');
+ break;
+ // assuming that such shit is not changing type;
+ // (often true)
+ case E_INDEX:
+ b.append("[]");
+ break;
+ case E_CALL:
+ b.append("()");
+ break;
+ case E_CURLY:
+ b.append("{}");
+ break;
+ }
+ }
+ return b.toString();
+ }
+
+ /**
+ * Return i'th expression. No index checking.
+ *
+ * @param i
+ * @return expression on i' position.
+ */
+ public Expression getExpression(int i) {
+ if (this.fExpressions != null) {
+ return (Expression) fExpressions.get(i);
+ }
+ return null;
+ }
+
+ /**
+ * Return expressions count.
+ *
+ * @return
+ */
+ public int getExpressionCount() {
+ if (this.fExpressions != null) {
+ return fExpressions.size();
+ }
+ return 0;
+ }
+
+ /**
+ * Return true then index == this.fExpressions.size() - 1
+ *
+ * @param index
+ * @return
+ */
+ public boolean isLast(int index) {
+ if (this.fExpressions != null) {
+ return this.fExpressions.size() - 1 == index;
+ }
+ return false;
+ }
+
+ /**
+ * Testing purposes only. Print extended variable.
+ */
+ public void printNode(CorePrinter output) {
+ List expressions = this.getExpressions();
+ boolean bFirst = true;
+
+ if (expressions != null) {
+ Iterator i = expressions.iterator();
+ while (i.hasNext()) {
+ Expression expr = (Expression) i.next();
+ if (bFirst) {
+ bFirst = false;
+ } else {
+ if (!(expr instanceof CallHolder)
+ && !(expr instanceof IndexHolder)) {
+ output.formatPrintLn(".");
+ }
+ }
+ expr.printNode(output);
+ }
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/IndexHolder.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/IndexHolder.java
new file mode 100644
index 0000000..89a823a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/IndexHolder.java
@@ -0,0 +1,63 @@
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Used to hold index expression in ExtendedVariables.
+ *
+ * @author haiodo
+ *
+ */
+public class IndexHolder extends Expression {
+ /**
+ * Hond index expression.
+ */
+ private Expression fIndex = null;
+
+ /**
+ * Construc from start and end position and expression.
+ *
+ * @param start -
+ * start position.
+ * @param end -
+ * end position.
+ * @param indexExpression -
+ * index expression.
+ */
+ public IndexHolder(int start, int end, Expression indexExpression) {
+ super(start, end);
+ this.fIndex = indexExpression;
+ }
+
+ /**
+ * Return Index kind.
+ */
+ public int getKind() {
+ return Expression.E_INDEX;
+ }
+
+ /**
+ * Traverse.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (this.fIndex != null) {
+ this.fIndex.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Testing purpose only. Used to print index.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("[");
+ if (this.fIndex != null) {
+ this.fIndex.printNode(output);
+ }
+ output.formatPrintLn("]");
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Reference.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Reference.java
new file mode 100644
index 0000000..94aeaeb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/Reference.java
@@ -0,0 +1,32 @@
+/*
+ * Created on 14.11.2004
+ *
+ * TODO To change the template for this generated file go to Window - Preferences - Script - Code
+ * Style - Code Templates
+ */
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+public abstract class Reference extends Expression {
+ protected Reference() {
+ super();
+ }
+
+ protected Reference(int sourceStart, int sourceEnd) {
+ super(sourceStart, sourceEnd);
+ }
+
+ public int getKind() {
+ return E_IDENTIFIER;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public abstract String getStringRepresentation();
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/SimpleReference.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/SimpleReference.java
new file mode 100644
index 0000000..ac7a4fb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/SimpleReference.java
@@ -0,0 +1,59 @@
+/*
+ * (c) 2002, 2005 xored software and others all rights reserved. http://www.xored.com
+ */
+
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class SimpleReference extends Reference {
+
+ protected String fName;
+
+ public SimpleReference(int start, int end, String name) {
+ super(start, end);
+ this.fName = name;
+ }
+
+ public SimpleReference(DLTKToken token) {
+ this.fName = token.getText();
+ this.setStart(token.getColumn());
+ if (fName != null) {
+ this.setEnd(this.sourceStart() + this.fName.length());
+ }
+ }
+
+ public String getName() {
+ return fName;
+ }
+
+ public void setName(String name) {
+ this.fName = name;
+ }
+
+ public String getStringRepresentation() {
+ return fName;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("SimpleReference" + this.getSourceRange().toString() + ":(" + this.fName + ")");
+ }
+
+ public String toString() {
+ return this.fName;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof SimpleReference)) {
+ return false;
+ }
+ SimpleReference d = (SimpleReference) obj;
+ return sourceStart() == d.sourceStart() && sourceEnd() == d.sourceEnd()
+ && (fName != null && fName.equals(d.fName));
+ }
+
+ public int hashCode() {
+ return fName.hashCode();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableKind.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableKind.java
new file mode 100644
index 0000000..2a047e2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableKind.java
@@ -0,0 +1,96 @@
+package org.eclipse.dltk.ast.references;
+
+public interface VariableKind {
+
+ public static final int FIRST_VARIABLE_ID = 0;
+
+ int getId();
+
+ public class Unknown implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 0;
+
+ public int getId() {
+ return ID;
+ }
+ }
+
+ public class Local implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 1;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public class Global implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 2;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public class Instance implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 3;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public class Class implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 4;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public class Mixin implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 5;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public class Argument implements VariableKind {
+
+ public static final int ID = FIRST_VARIABLE_ID + 6;
+
+ public int getId() {
+ return ID;
+ }
+
+ }
+
+ public static final int LAST_CORE_VARIABLE_ID = FIRST_VARIABLE_ID + 50;
+
+ public static final int LAST_VARIABLE_ID = LAST_CORE_VARIABLE_ID + 50;
+
+ public static final VariableKind UNKNOWN = new Unknown();
+
+ public static final VariableKind LOCAL = new Local();
+
+ public static final VariableKind GLOBAL = new Global();
+
+ public static final VariableKind INSTANCE = new Instance();
+
+ public static final VariableKind CLASS = new Class();
+
+ public static final VariableKind MIXIN = new Mixin();
+
+ public static final VariableKind ARGUMENT = new Argument();
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableReference.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableReference.java
new file mode 100644
index 0000000..6dca6fe
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/references/VariableReference.java
@@ -0,0 +1,33 @@
+package org.eclipse.dltk.ast.references;
+
+import org.eclipse.dltk.ast.DLTKToken;
+
+public class VariableReference extends SimpleReference {
+
+ private VariableKind variableKind;
+
+ public VariableReference(int start, int end, String name) {
+ this(start, end, name, VariableKind.UNKNOWN);
+ }
+
+ public VariableReference(int start, int end, String name, VariableKind kind) {
+ super(start, end, name);
+ this.variableKind = kind;
+ }
+
+ public VariableReference(DLTKToken token) {
+ super(token);
+ this.variableKind = VariableKind.UNKNOWN;
+ }
+
+ public VariableKind getVariableKind() {
+ return variableKind;
+ }
+
+ public void setVariableKind(VariableKind kind) {
+ this.variableKind = kind;
+ }
+
+
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Block.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Block.java
new file mode 100644
index 0000000..1241fa2
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Block.java
@@ -0,0 +1,72 @@
+package org.eclipse.dltk.ast.statements;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class Block extends Statement {
+ private List statements;
+
+ public Block() {
+ this.statements = new ArrayList();
+ }
+
+ public Block(int start, int end) {
+ this(start, end, null);
+ }
+
+ public Block(int start, int end, List statems) {
+ super(start, end);
+ if (statems == null)
+ statems = new ArrayList();
+ this.statements = new ArrayList(statems);
+ }
+
+ public void traverse(ASTVisitor visitor) throws Exception {
+ if (visitor.visit(this)) {
+ Iterator it = statements.iterator();
+ while (it.hasNext()) {
+ ((Statement) it.next()).traverse(visitor);
+ }
+ visitor.endvisit(this);
+ }
+ }
+
+ public int getKind() {
+ return S_BLOCK;
+ }
+
+ public void acceptStatements(List statems) {
+ if (statems == null) {
+ throw new IllegalArgumentException();
+ }
+
+ statements.addAll(statems);
+ }
+
+ public List getStatements() {
+ return statements;
+ }
+
+ public void addStatement(Statement statem) {
+ if (statem == null) {
+ throw new IllegalArgumentException();
+ }
+
+ statements.add(statem);
+ }
+
+ public void printNode(CorePrinter output) {
+ output.indent();
+ Iterator it = statements.iterator();
+ while (it.hasNext()) {
+ ((Statement) it.next()).printNode(output);
+ output.formatPrint("");
+ }
+ output.formatPrint("");
+ output.dedent();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/BreakStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/BreakStatement.java
new file mode 100644
index 0000000..323b438
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/BreakStatement.java
@@ -0,0 +1,29 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.references.SimpleReference;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class BreakStatement extends SimpleStatement {
+ public BreakStatement(DLTKToken breakToken, DLTKToken label, int end) {
+ super(breakToken.getColumn(), end, null);
+ if (label != null) {
+ this.fExpression = new SimpleReference(label);
+ this.setEnd(fExpression.sourceEnd());
+ }
+ }
+
+ public int getKind() {
+ return S_BREAK;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("break ");
+
+ Expression expression = this.getExpression();
+ if (expression != null) {
+ expression.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/CaseStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/CaseStatement.java
new file mode 100644
index 0000000..04f89e9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/CaseStatement.java
@@ -0,0 +1,34 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * C like switch case conception. this is switch ( x ) { case A: case B: case C: }
+ * only case and expression of case.
+ */
+public class CaseStatement extends SimpleStatement {
+ public CaseStatement(DLTKToken caseToken, Expression caseExpression) {
+ super(caseToken, caseExpression);
+ }
+
+ public CaseStatement(DLTKToken defaultToken) {
+ super(defaultToken.getColumn(), defaultToken.getColumn()
+ + defaultToken.getText().length(), null);
+ }
+
+ public int getKind() {
+ return S_CASE;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("case: ");
+ output.indent();
+ Expression expression = this.getExpression();
+ if (expression != null) {
+ expression.printNode(output);
+ }
+ output.dedent();
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ContinueStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ContinueStatement.java
new file mode 100644
index 0000000..4e9a102
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ContinueStatement.java
@@ -0,0 +1,31 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.references.SimpleReference;
+import org.eclipse.dltk.utils.CorePrinter;
+
+public class ContinueStatement extends SimpleStatement {
+
+ public ContinueStatement(DLTKToken continueToken, DLTKToken labelToken,
+ int end) {
+ super(continueToken.getColumn(), end, null);
+ if (labelToken != null) {
+ this.fExpression = new SimpleReference(labelToken);
+ this.setEnd(fExpression.sourceEnd());
+ }
+ }
+
+ public int getKind() {
+ return S_CONTINUE;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("continue ");
+
+ Expression expression = this.getExpression();
+ if (expression != null) {
+ expression.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/DoWhileStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/DoWhileStatement.java
new file mode 100644
index 0000000..b167ea7
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/DoWhileStatement.java
@@ -0,0 +1,104 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Do while statement.
+ *
+ *
+ */
+public class DoWhileStatement extends Statement {
+
+ /**
+ * while condition.
+ */
+ private Expression fCondition;
+
+ /**
+ * Action Statement.
+ */
+ private Statement fAction;
+
+ /**
+ * Construct Do While statement from doToken, action, condition and final
+ * position.
+ *
+ * @param doToken -
+ * do ANTLR token.
+ * @param action -
+ * action.
+ * @param condition -
+ * condition.
+ * @param endPosition -
+ * end position.
+ */
+ public DoWhileStatement(DLTKToken doToken, Statement action,
+ Expression condition, int endPosition) {
+ super(doToken.getColumn(), endPosition);
+ this.fAction = action;
+ this.fCondition = condition;
+ }
+
+ /**
+ * Traverse
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (fAction != null) {
+ fAction.traverse(pVisitor);
+ }
+ if (fCondition != null) {
+ fCondition.traverse(pVisitor);
+ }
+
+ pVisitor.endvisit(this);
+ }
+ }
+
+ /**
+ * Return Do While Kind.
+ */
+
+ public int getKind() {
+ return S_DOWHILE;
+ }
+
+ /**
+ * return Action.
+ *
+ * @return - action statement.
+ */
+ public Statement getAction() {
+ return fAction;
+ }
+
+ /**
+ * Return condition.
+ *
+ * @return - condition expression.
+ */
+ public Expression getCondition() {
+ return fCondition;
+ }
+
+ /**
+ * Testing purpose only. Print do while expression.
+ */
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("do:");
+ output.indent();
+
+ if (this.fAction != null) {
+ this.fAction.printNode(output);
+ }
+ output.dedent();
+ if (fCondition != null) {
+ output.formatPrintLn("while: ");
+ this.fCondition.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/EmptyStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/EmptyStatement.java
new file mode 100644
index 0000000..378ee6e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/EmptyStatement.java
@@ -0,0 +1,33 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Empty Statement.
+ *
+ */
+public class EmptyStatement extends Statement {
+
+ public EmptyStatement(int start, int end) {
+ super(start, end);
+ }
+
+ public EmptyStatement(DLTKToken token) {
+ super(token);
+ }
+
+ public int getKind() {
+ return S_EMPTY;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public void printNode(CorePrinter output) {
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForEachStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForEachStatement.java
new file mode 100644
index 0000000..d7ae062
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForEachStatement.java
@@ -0,0 +1,62 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * For each statement.
+ *
+ */
+public class ForEachStatement extends ForStatement {
+
+ /**
+ * Construct foreach from ANTLR token, initialization, condition, increment
+ * expressions and action statement. foreach( A, C, I ) { Action. }
+ *
+ * @param forToken -
+ * ANTLR token.
+ * @param initialization -
+ * initalization expression.
+ * @param condition -
+ * condition expression.
+ * @param increment -
+ * increment expression.
+ * @param action -
+ * action statement.
+ */
+ public ForEachStatement(DLTKToken forToken, Expression initialization,
+ Expression condition, Expression increment, Statement action) {
+ super(forToken, initialization, condition, increment, action);
+ }
+
+ /**
+ * Testing purposes only. Print foreach statement.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("foreach: ");
+
+ Expression condition = this.getCondition();
+ Expression increment = this.getIncrement();
+ Expression intialization = this.getInitialization();
+ Statement action = this.getAction();
+
+ if (condition != null) {
+ output.formatPrintLn("condition:");
+ condition.printNode(output);
+ }
+ if (increment != null) {
+ output.formatPrintLn("increment:");
+ increment.printNode(output);
+ }
+ if (intialization != null) {
+ output.formatPrintLn("initialization:");
+ intialization.printNode(output);
+ }
+ if (action != null) {
+ output.indent();
+ action.printNode(output);
+ output.dedent();
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForStatement.java
new file mode 100644
index 0000000..0b8666e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ForStatement.java
@@ -0,0 +1,109 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * For Statement.
+ */
+public class ForStatement extends Statement {
+
+ private Expression fInitialization;
+
+ private Expression fCondition;
+
+ private Expression fIncrement;
+
+ private Statement fAction;
+
+ /**
+ * Construct from ANTLR token, initialization, condition, increment
+ * expressions and action statement
+ *
+ * @param forToken -
+ * ANTLR token.
+ * @param initialization -
+ * initialization expression.
+ * @param condition -
+ * condition expression.
+ * @param increment -
+ * increment expression.
+ * @param action -
+ * action statement.
+ */
+ public ForStatement(DLTKToken forToken, Expression initialization,
+ Expression condition, Expression increment, Statement action) {
+
+ this.fInitialization = initialization;
+ this.fCondition = condition;
+ this.fIncrement = increment;
+ this.fAction = action;
+ this.setStart(forToken.getColumn());
+ if (action != null) {
+ this.setEnd(action.sourceEnd());
+ }
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+
+ if (pVisitor.visit(this)) {
+ if (fInitialization != null) {
+ fInitialization.traverse(pVisitor);
+ }
+ if (fCondition != null) {
+ fCondition.traverse(pVisitor);
+ }
+ if (fIncrement != null) {
+ fIncrement.traverse(pVisitor);
+ }
+ if (fAction != null) {
+ fAction.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public int getKind() {
+ return S_FOR;
+ }
+
+ public Statement getAction() {
+ return fAction;
+ }
+
+ public Expression getCondition() {
+ return fCondition;
+ }
+
+ public Expression getIncrement() {
+ return fIncrement;
+ }
+
+ public Expression getInitialization() {
+ return fInitialization;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("for:");
+ if (this.fCondition != null) {
+ output.formatPrintLn("condition:");
+ this.fCondition.printNode(output);
+ }
+ if (this.fIncrement != null) {
+ output.formatPrintLn("increment:");
+ this.fIncrement.printNode(output);
+ }
+ if (this.fInitialization != null) {
+ output.formatPrintLn("initialization:");
+ this.fInitialization.printNode(output);
+ }
+ if (this.fAction != null) {
+ output.indent();
+ this.fAction.printNode(output);
+ output.dedent();
+ }
+
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/IfStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/IfStatement.java
new file mode 100644
index 0000000..aeb419b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/IfStatement.java
@@ -0,0 +1,124 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * If statement.
+ */
+public class IfStatement extends Statement {
+ /**
+ * Condition expression.
+ */
+ private Expression fCondition;
+
+ /**
+ * Then statement of if.
+ */
+ private Statement fThenStatement;
+
+ /**
+ * Else statement of if. Can be null, or possible EmptyStatement..
+ */
+ private Statement fElseStatement;
+
+ public IfStatement(DLTKToken ifToken, Expression condition,
+ Statement thenStatement) {
+
+ super(ifToken);
+ this.fCondition = condition;
+ this.fThenStatement = thenStatement;
+ }
+
+ public IfStatement(Expression condition, Statement thenStatement, Statement elseStatement) {
+ this.fCondition = condition;
+ this.fThenStatement = thenStatement;
+ fElseStatement = elseStatement;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+
+ if (pVisitor.visit(this)) {
+ if (fCondition != null) {
+ fCondition.traverse(pVisitor);
+ }
+ if (fThenStatement != null) {
+ fThenStatement.traverse(pVisitor);
+ }
+ if (fElseStatement != null) {
+ fElseStatement.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public int getKind() {
+ return S_IF;
+ }
+
+ // TODO: Replace to acceptElse for similarity.
+ /**
+ * @deprecated
+ */
+ public void setElse(Statement elses) {
+ this.acceptElse(elses);
+ }
+
+ /**
+ * Acccept Else statement.
+ *
+ * @param elseStatement
+ */
+ public void acceptElse(Statement elseStatement) {
+ this.fElseStatement = elseStatement;
+ if (this.fElseStatement != null) {
+ this.setEnd(this.fElseStatement.sourceEnd());
+ }
+ }
+
+ /**
+ * Return else statement.
+ *
+ * @return - else statement. Be aware can be null.
+ */
+ public Statement getElse() {
+ return fElseStatement;
+ }
+
+ public Statement getThen() {
+ return fThenStatement;
+ }
+
+ public Expression getCondition() {
+ return this.fCondition;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("if: ");
+ if (this.fCondition != null) {
+ this.fCondition.printNode(output);
+ }
+ if (this.fThenStatement != null) {
+ if (!(this.fThenStatement instanceof Block)) {
+ output.indent();
+ }
+ this.fThenStatement.printNode(output);
+ if (!(this.fThenStatement instanceof Block)) {
+ output.dedent();
+ }
+ }
+ if (this.fElseStatement != null) {
+ output.formatPrintLn("else:");
+ if (!(this.fElseStatement instanceof Block)) {
+ output.indent();
+ }
+ this.fElseStatement.printNode(output);
+ if (!(this.fElseStatement instanceof Block)) {
+ output.dedent();
+ }
+ }
+
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ReturnStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ReturnStatement.java
new file mode 100644
index 0000000..12058e9
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ReturnStatement.java
@@ -0,0 +1,27 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Return statement.
+ */
+public class ReturnStatement extends SimpleStatement {
+ public ReturnStatement(DLTKToken rt, Expression exp, int end) {
+ super(rt.getColumn(), end, exp);
+ }
+
+ public int getKind() {
+ return S_RETURN;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("return ");
+
+ Expression expression = this.getExpression();
+ if (expression != null) {
+ expression.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SimpleStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SimpleStatement.java
new file mode 100644
index 0000000..0efff5a
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SimpleStatement.java
@@ -0,0 +1,36 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+
+/**
+ * Abstract superclass for all simple statement;
+ */
+public abstract class SimpleStatement extends Statement {
+
+ protected Expression fExpression;
+
+ protected SimpleStatement(int start, int end, Expression expression) {
+ super(start, end);
+ this.fExpression = expression;
+ }
+
+ public SimpleStatement(DLTKToken token, Expression expression) {
+ super(token);
+ this.fExpression = expression;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (fExpression != null) {
+ fExpression.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public Expression getExpression() {
+ return fExpression;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Statement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Statement.java
new file mode 100644
index 0000000..a79d2fb
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/Statement.java
@@ -0,0 +1,33 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.DLTKToken;
+
+/**
+ * Base class for all statements.
+ */
+public abstract class Statement extends ASTNode implements StatementConstants {
+ protected Statement(int start, int end) {
+ super(start, end);
+ }
+
+ protected Statement() {
+ super();
+ }
+
+ protected Statement(DLTKToken token) {
+ super(token);
+ }
+
+ public abstract int getKind();
+
+ public boolean equals(Object obj) {
+ if (obj instanceof Statement) {
+ Statement s = (Statement) obj;
+ return sourceStart() == s.sourceStart()
+ && sourceEnd() == s.sourceEnd();
+ }
+
+ return false;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/StatementConstants.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/StatementConstants.java
new file mode 100644
index 0000000..e2de3ca
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/StatementConstants.java
@@ -0,0 +1,40 @@
+package org.eclipse.dltk.ast.statements;
+
+/**
+ * Statement type constants.
+ */
+public interface StatementConstants {
+ public final static int S_WHILE = 2000;
+
+ public final static int S_FOR = 2001;
+
+ public final static int S_TRY = 2002;
+
+ public final static int S_THROW = 2003;
+
+ public final static int S_PRINT = 2004;
+
+ public final static int S_IF = 2005;
+
+ public final static int S_CONTINUE = 2006;
+
+ public final static int S_BREAK = 2007;
+
+ public final static int S_BLOCK = 2008;
+
+ public final static int S_DOWHILE = 2009;
+
+ public final static int S_SWITCH = 2010;
+
+ public final static int S_RETURN = 2011;
+
+ public final static int S_CASE = 2012;
+
+ public final static int S_EMPTY = 2013;
+
+ public final static int S_FOREACH = 2014;
+
+ public static final int S_TRY_CATCH = 2015;
+
+ public static final int S_TRY_FINALLY = 2016;
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SwitchStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SwitchStatement.java
new file mode 100644
index 0000000..e778222
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/SwitchStatement.java
@@ -0,0 +1,122 @@
+package org.eclipse.dltk.ast.statements;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Switch statement.
+ */
+/*
+ * TODO: Concept need be fixed. Where are statements?
+ *
+ *
+ * Where echo is holding in this model?
+ */
+public class SwitchStatement extends Statement {
+ /**
+ * expression.
+ */
+ private Expression fExpression;
+
+ /**
+ * List of statements.
+ */
+ private ArrayList fStatements = new ArrayList();
+
+ /**
+ * Construct from ANTLR token for position binsings and expression.
+ *
+ * @param switchToken
+ * @param exp
+ */
+ public SwitchStatement(DLTKToken switchToken, Expression exp) {
+
+ super(switchToken.getColumn(), -1);
+ this.fExpression = exp;
+ if (this.fExpression != null) {
+ this.setEnd(this.fExpression.sourceEnd());
+ }
+ }
+
+ /**
+ * Traverse.
+ */
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+
+ if (pVisitor.visit(this)) {
+
+ if (fExpression != null) {
+ fExpression.traverse(pVisitor);
+ }
+ if (this.fStatements != null) {
+ Iterator i = this.fStatements.iterator();
+ while (i.hasNext()) {
+ Statement statement = (Statement) i.next();
+ statement.traverse(pVisitor);
+ }
+ }
+ pVisitor.endvisit(this);
+ }
+
+ }
+
+ /**
+ * Return switch Kind.
+ */
+
+ public int getKind() {
+ return S_SWITCH;
+ }
+
+ /**
+ * Accept case statements group.
+ */
+ public void acceptGroup(List l) {
+
+ fStatements.addAll(l);
+ }
+
+ /**
+ * Return expression.
+ *
+ * @return
+ */
+ public Expression getExpression() {
+ return fExpression;
+ }
+
+ /**
+ * Return list of case statements.
+ *
+ * @return
+ */
+ public List getStatements() {
+ return fStatements;
+ }
+
+ /**
+ * Testing purpose only. Print switch statement.
+ */
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("switch:");
+ if (this.fExpression != null) {
+ this.fExpression.printNode(output);
+ }
+ if (this.fStatements != null) {
+ output.indent();
+ Iterator i = this.fStatements.iterator();
+ while (i.hasNext()) {
+ Statement statement = (Statement) i.next();
+ statement.printNode(output);
+ output.formatPrint("");
+ }
+ output.dedent();
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ThrowStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ThrowStatement.java
new file mode 100644
index 0000000..b1a2eba
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/ThrowStatement.java
@@ -0,0 +1,29 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Throw statement. Exception throwing.
+ */
+public class ThrowStatement extends SimpleStatement {
+ public ThrowStatement(DLTKToken throwToken, Expression expression) {
+ super(throwToken.getColumn(), -1, expression);
+ if (expression != null) {
+ this.setEnd(expression.sourceEnd());
+ }
+ }
+
+ public int getKind() {
+ return S_THROW;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("throw: ");
+ Expression expression = this.getExpression();
+ if (expression != null) {
+ expression.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryCatchStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryCatchStatement.java
new file mode 100644
index 0000000..dab9443
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryCatchStatement.java
@@ -0,0 +1,56 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Try catch statement.
+ */
+public class TryCatchStatement extends Statement {
+ private Block fBody;
+
+ private Expression fExpression;
+
+ public TryCatchStatement(DLTKToken catchToken,
+ Expression exceptionExpression, Block body) {
+ super(catchToken);
+ this.fExpression = exceptionExpression;
+ this.fBody = body;
+ }
+
+ public int getKind() {
+ return Statement.S_TRY_CATCH;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (this.fExpression != null) {
+ this.fExpression.traverse(pVisitor);
+ }
+ if (this.fBody != null) {
+ this.fBody.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public Expression getExpression() {
+ return this.fExpression;
+ }
+
+ public Block getBody() {
+ return this.fBody;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("catch:");
+ if (this.fExpression != null) {
+ this.fExpression.printNode(output);
+ }
+ if (this.fBody != null) {
+ this.fBody.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryFinallyStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryFinallyStatement.java
new file mode 100644
index 0000000..dd38623
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryFinallyStatement.java
@@ -0,0 +1,38 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Try Finally statement.
+ */
+public class TryFinallyStatement extends Statement {
+ private Block fBody;
+
+ public TryFinallyStatement(DLTKToken token, Block body) {
+ super(token);
+ this.fBody = body;
+ }
+
+ public int getKind() {
+ return Statement.S_TRY_FINALLY;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (this.fBody != null) {
+ this.fBody.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("finally:");
+ if (this.fBody != null) {
+ this.fBody.printNode(output);
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryStatement.java
new file mode 100644
index 0000000..5dc179b
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/TryStatement.java
@@ -0,0 +1,71 @@
+package org.eclipse.dltk.ast.statements;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * Try statement.
+ */
+public class TryStatement extends Statement {
+ private Block body;
+
+ private List catchFinallyStatements;
+
+ protected TryStatement(int start, int end) {
+ super(start, end);
+ }
+
+ public TryStatement(DLTKToken tryToken, Block body, List catchFin) {
+
+ super(tryToken);
+ this.body = body;
+ this.catchFinallyStatements = catchFin;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (this.body != null) {
+ this.body.traverse(pVisitor);
+ }
+ if (this.catchFinallyStatements != null) {
+ Iterator i = this.catchFinallyStatements.iterator();
+ while (i.hasNext()) {
+ Statement st = (Statement) i.next();
+ st.traverse(pVisitor);
+ }
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public int getKind() {
+ return S_TRY;
+ }
+
+ public Block getBody() {
+ return body;
+ }
+
+ public List getCatchFinallyStatements() {
+ return catchFinallyStatements;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrint("try:");
+ if (this.body != null) {
+ this.body.printNode(output);
+ }
+ if (this.catchFinallyStatements != null) {
+ Iterator i = this.catchFinallyStatements.iterator();
+ while (i.hasNext()) {
+ Statement st = (Statement) i.next();
+ st.printNode(output);
+ output.println("");
+ }
+ }
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/WhileStatement.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/WhileStatement.java
new file mode 100644
index 0000000..8680a87
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/statements/WhileStatement.java
@@ -0,0 +1,62 @@
+package org.eclipse.dltk.ast.statements;
+
+import org.eclipse.dltk.ast.ASTVisitor;
+import org.eclipse.dltk.ast.DLTKToken;
+import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.utils.CorePrinter;
+
+/**
+ * While statement.
+ */
+public class WhileStatement extends Statement {
+ private Expression fCondition;
+ private Statement fAction;
+
+ public WhileStatement(DLTKToken token) {
+ super(token);
+ }
+
+ public WhileStatement(DLTKToken whileToken, Expression condition,
+ Statement action) {
+ this.setStart(whileToken.getColumn());
+ this.fCondition = condition;
+ this.fAction = action;
+ }
+
+ public void traverse(ASTVisitor pVisitor) throws Exception {
+ if (pVisitor.visit(this)) {
+ if (fCondition != null) {
+ fCondition.traverse(pVisitor);
+ }
+ if (fAction != null) {
+ fAction.traverse(pVisitor);
+ }
+ pVisitor.endvisit(this);
+ }
+ }
+
+ public int getKind() {
+ return S_WHILE;
+ }
+
+ public Expression getCondition() {
+ return fCondition;
+ }
+
+ public Statement getAction() {
+ return fAction;
+ }
+
+ public void printNode(CorePrinter output) {
+ output.formatPrintLn("while");
+ if (this.fCondition != null) {
+ this.fCondition.printNode(output);
+ }
+ if (this.fAction != null) {
+ output.indent();
+ this.fAction.printNode(output);
+ output.dedent();
+ }
+ output.formatPrint("");
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/utils/ASTUtil.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/utils/ASTUtil.java
new file mode 100644
index 0000000..1dda852
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/utils/ASTUtil.java
@@ -0,0 +1,21 @@
+package org.eclipse.dltk.ast.utils;
+
+import java.util.List;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+
+public class ASTUtil {
+ public static List getStatements(ASTNode node) {
+ if (node instanceof ModuleDeclaration) {
+ return ((ModuleDeclaration) node).getStatements();
+ } else if (node instanceof TypeDeclaration) {
+ return ((TypeDeclaration) node).getStatements();
+ } else if (node instanceof MethodDeclaration) {
+ return ((MethodDeclaration) node).getStatements();
+ }
+ return null;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/build.properties b/core/plugins/org.eclipse.dltk.core/build.properties
new file mode 100644
index 0000000..9198afa
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/build.properties
@@ -0,0 +1,25 @@
+source.. = ast/,\
+ compiler/,\
+ model/,\
+ search/,\
+ utils/,\
+ codeassist/,\
+ typeinference/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ schema/,\
+ plugin.xml,\
+ plugin.properties
+src.includes = ast/,\
+ compiler/,\
+ model/,\
+ utils/,\
+ schema/,\
+ search/,\
+ META-INF/,\
+ plugin.xml,\
+ codeassist/,\
+ build.properties,\
+ plugin.properties,\
+ typeinference/
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/CompletionEngine.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/CompletionEngine.java
new file mode 100644
index 0000000..475109c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/CompletionEngine.java
@@ -0,0 +1,526 @@
+package org.eclipse.dltk.codeassist;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.dltk.ast.declarations.Argument;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.compiler.CategorizedProblem;
+import org.eclipse.dltk.compiler.CharOperation;
+import org.eclipse.dltk.compiler.util.HashtableOfObject;
+import org.eclipse.dltk.core.CompletionProposal;
+import org.eclipse.dltk.core.CompletionRequestor;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IAccessRule;
+import org.eclipse.dltk.core.IDLTKProject;
+import org.eclipse.dltk.core.IField;
+import org.eclipse.dltk.core.IMethod;
+import org.eclipse.dltk.core.ISearchableEnvironment;
+import org.eclipse.dltk.core.IType;
+import org.eclipse.dltk.core.ModelException;
+import org.eclipse.dltk.internal.codeassist.impl.Engine;
+import org.eclipse.dltk.internal.compiler.lookup.LookupEnvironment;
+import org.eclipse.dltk.typeinference.ArgumentDescriptor;
+import org.eclipse.dltk.typeinference.IMethodDescriptor;
+
+
+public abstract class CompletionEngine extends Engine implements ICompletionEngine {
+ protected static boolean DEBUG = DLTKCore.DEBUG_COMPLETION;
+
+ protected IDLTKProject dltkProject;
+
+ protected CompletionRequestor requestor;
+
+ protected int startPosition, actualCompletionPosition, endPosition, offset;
+
+ protected char[] fileName = null;
+
+ protected HashtableOfObject knownPkgs = new HashtableOfObject(10);
+
+ protected HashtableOfObject knownTypes = new HashtableOfObject(10);
+
+ boolean insideQualifiedReference = false;
+
+ protected boolean noProposal = true;
+
+ protected CategorizedProblem problem = null;
+
+ protected char[] source;
+
+ public CompletionEngine(ISearchableEnvironment nameEnvironment, CompletionRequestor requestor, Map settings, IDLTKProject dltkProject) {
+ super(settings);
+ this.dltkProject = dltkProject;
+ this.requestor = requestor;
+ this.nameEnvironment = nameEnvironment;
+ this.lookupEnvironment = new LookupEnvironment(this, nameEnvironment);
+ }
+
+ protected CompletionProposal createProposal(int kind, int completionOffset) {
+ CompletionProposal proposal = CompletionProposal.create(kind, completionOffset - this.offset);
+ proposal.completionEngine = this;
+ proposal.nameLookup = this.nameEnvironment.getNameLookup();
+ return proposal;
+ }
+
+ protected void printDebug(CategorizedProblem error) {
+ if (CompletionEngine.DEBUG) {
+ System.out.print("COMPLETION - completionFailure("); //$NON-NLS-1$
+ System.out.print(error);
+ System.out.println(")"); //$NON-NLS-1$
+ }
+ }
+
+ protected void printDebug(CompletionProposal proposal) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("COMPLETION - "); //$NON-NLS-1$
+ switch (proposal.getKind()) {
+ case CompletionProposal.FIELD_REF:
+ buffer.append("FIELD_REF"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.KEYWORD:
+ buffer.append("KEYWORD"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.LABEL_REF:
+ buffer.append("LABEL_REF"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.LOCAL_VARIABLE_REF:
+ buffer.append("LOCAL_VARIABLE_REF"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.METHOD_DECLARATION:
+ buffer.append("METHOD_DECLARATION"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.METHOD_REF:
+ buffer.append("METHOD_REF"); //$NON-NLS-1$
+ break;
+ // case CompletionProposal.PACKAGE_REF :
+ // buffer.append("PACKAGE_REF"); //$NON-NLS-1$
+ // break;
+ case CompletionProposal.TYPE_REF:
+ buffer.append("TYPE_REF"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.VARIABLE_DECLARATION:
+ buffer.append("VARIABLE_DECLARATION"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.POTENTIAL_METHOD_DECLARATION:
+ buffer.append("POTENTIAL_METHOD_DECLARATION"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.METHOD_NAME_REFERENCE:
+ buffer.append("METHOD_NAME_REFERENCE"); //$NON-NLS-1$
+ break;
+ case CompletionProposal.ANNOTATION_ATTRIBUTE_REF:
+ buffer.append("ANNOTATION_ATTRIBUT_REF"); //$NON-NLS-1$
+ break;
+ default:
+ buffer.append("PROPOSAL"); //$NON-NLS-1$
+ break;
+
+ }
+
+ buffer.append("{\n");//$NON-NLS-1$
+ buffer.append("\tCompletion[").append(proposal.getCompletion() == null ? "null".toCharArray() : proposal.getCompletion()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer
+ .append("\tDeclarationSignature[").append(proposal.getDeclarationSignature() == null ? "null".toCharArray() : proposal.getDeclarationSignature()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer
+ .append("\tDeclarationKey[").append(proposal.getDeclarationKey() == null ? "null".toCharArray() : proposal.getDeclarationKey()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append("\tSignature[").append(proposal.getSignature() == null ? "null".toCharArray() : proposal.getSignature()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append("\tKey[").append(proposal.getKey() == null ? "null".toCharArray() : proposal.getKey()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // buffer.append("\tDeclarationPackage[").append(proposal.getDeclarationPackageName()
+ // == null ? "null".toCharArray() :
+ // proposal.getDeclarationPackageName()).append("]\n");
+ // buffer.append("\tDeclarationType[").append(proposal.getDeclarationTypeName()
+ // == null ? "null".toCharArray() :
+ // proposal.getDeclarationTypeName()).append("]\n");
+ // buffer.append("\tPackage[").append(proposal.getPackageName() == null
+ // ? "null".toCharArray() : proposal.getPackageName()).append("]\n");
+ // buffer.append("\tType[").append(proposal.getTypeName() == null ?
+ // "null".toCharArray() : proposal.getTypeName()).append("]\n");
+ buffer.append("\tName[").append(proposal.getName() == null ? "null".toCharArray() : proposal.getName()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ buffer.append("\tFlags[");//$NON-NLS-1$
+ // int flags = proposal.getFlags();
+ // buffer.append(Flags.toString(flags));
+ // if((flags & Flags.AccInterface) != 0) buffer.append("interface
+ // ");//$NON-NLS-1$
+ // if((flags & Flags.AccEnum) != 0) buffer.append("enum ");//$NON-NLS-1$
+ buffer.append("]\n"); //$NON-NLS-1$
+
+ buffer.append("\tCompletionLocation[").append(proposal.getCompletionLocation()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ int start = proposal.getReplaceStart();
+ int end = proposal.getReplaceEnd();
+ buffer.append("\tReplaceStart[").append(start).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("-ReplaceEnd[").append(end).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (this.source != null)
+ buffer.append("\tReplacedText[").append(this.source, start, end - start).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("\tTokenStart[").append(proposal.getTokenStart()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("-TokenEnd[").append(proposal.getTokenEnd()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("\tRelevance[").append(proposal.getRelevance()).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ buffer.append("}\n");//$NON-NLS-1$
+ System.out.println(buffer.toString());
+ }
+
+ protected void setSourceRange(int start, int end) {
+ this.setSourceRange(start, end, true);
+ }
+
+ protected abstract int getEndOfEmptyToken();
+
+ protected void setSourceRange(int start, int end, boolean emptyTokenAdjstment) {
+ this.startPosition = start;
+ if (emptyTokenAdjstment) {
+ int endOfEmptyToken = getEndOfEmptyToken();
+ this.endPosition = endOfEmptyToken > end ? endOfEmptyToken : end;
+ } else {
+ this.endPosition = end;
+ }
+ }
+
+ // what about onDemand types? Ignore them since it does not happen!
+ // import p1.p2.A.*;
+ protected void findKeywords(char[] keyword, char[][] choices, boolean canCompleteEmptyToken) {
+ if (choices == null || choices.length == 0)
+ return;
+
+ int length = keyword.length;
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < choices.length; i++) {
+ if (length <= choices[i].length && CharOperation.prefixEquals(keyword, choices[i], false /*
+ * ignore
+ * case
+ */
+ )) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(keyword, choices[i]);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+ /*
+ * access restriction for keywors
+ */
+
+ // if (CharOperation.equals(choices[i], Keywords.TRUE)
+ // || CharOperation.equals(choices[i], Keywords.FALSE)) {
+ // relevance +=
+ // computeRelevanceForExpectingType(TypeBinding.BOOLEAN);
+ // relevance += computeRelevanceForQualification(false);
+ // }
+ this.noProposal = false;
+ if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
+ CompletionProposal proposal = this.createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
+ proposal.setName(choices[i]);
+ proposal.setCompletion(choices[i]);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void findLocalVariables(char[] token, char[][] choices, boolean canCompleteEmptyToken, boolean provideDollar) {
+ int kind = CompletionProposal.LOCAL_VARIABLE_REF;
+ findElements(token, choices, canCompleteEmptyToken, provideDollar, kind);
+ }
+
+ protected void findElements(char[] token, char[][] choices,
+ boolean canCompleteEmptyToken, boolean provideDollar, int kind) {
+ if (choices == null || choices.length == 0)
+ return;
+
+ int length = token.length;
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < choices.length; i++) {
+ char[] co = choices[i];
+ if( !provideDollar && co.length > 1 && co[0] == '$' ) {
+ char co2[] = new char[co.length - 1];
+ System.arraycopy(co, 1, co2, 0, co2.length);
+ co = co2;
+ }
+ if (length <= choices[i].length && CharOperation.prefixEquals(token, co, false)) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, co);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+
+ // accept result
+ CompletionEngine.this.noProposal = false;
+
+ if (!CompletionEngine.this.requestor.isIgnored(kind)) {
+ CompletionProposal proposal = CompletionEngine.this.createProposal(kind,
+ CompletionEngine.this.actualCompletionPosition);
+ // proposal.setSignature(getSignature(typeBinding));
+ // proposal.setPackageName(q);
+ // proposal.setTypeName(displayName);
+ proposal.setName(co);
+ proposal.setCompletion(co);
+ // proposal.setFlags(Flags.AccDefault);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void findLocalMethods(char[] token, boolean canCompleteEmptyToken, List methods, List methodNames) {
+ if (methods == null || methods.size() == 0)
+ return;
+
+ int length = token.length;
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < methods.size(); i++) {
+ MethodDeclaration method = (MethodDeclaration)methods.get(i);
+ char[] name = ((String)(methodNames.get(i))).toCharArray();
+ if (length <= name.length && CharOperation.prefixEquals(token, name, false)) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, name);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+
+ // accept result
+ CompletionEngine.this.noProposal = false;
+ if (!CompletionEngine.this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
+ CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.METHOD_DECLARATION,
+ CompletionEngine.this.actualCompletionPosition);
+ // proposal.setSignature(getSignature(typeBinding));
+ // proposal.setPackageName(q);
+ // proposal.setTypeName(displayName);
+ List arguments = method.getArguments();
+ if( arguments != null && arguments.size() > 0 ) {
+ char[][] args = new char[arguments.size()][];
+ for( int j = 0; j < arguments.size(); ++j ) {
+ args[j] = ((Argument)arguments.get(j)).getName().toCharArray();
+ }
+ proposal.setParameterNames(args);
+ }
+
+ proposal.setName(name);
+ proposal.setCompletion(name);
+ // proposal.setFlags(Flags.AccDefault);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+ protected abstract String processMethodName(IMethod method, String token);
+ protected abstract String processTypeName(IType method, String token);
+ protected abstract String processFieldName(IField field, String token);
+ protected void findMethods(char[] token, boolean canCompleteEmptyToken, List methods) {
+ findMethods(token, canCompleteEmptyToken, methods,CompletionProposal.METHOD_DECLARATION);
+ }
+ protected void findFields(char[] token, boolean canCompleteEmptyToken, List methods, String prefix) {
+ findFields(token, canCompleteEmptyToken, methods,CompletionProposal.FIELD_REF, prefix );
+ }
+
+ protected void findMethods(char[] token, boolean canCompleteEmptyToken,
+ List methods,int kind) {
+ if (methods == null || methods.size() == 0)
+ return;
+
+ int length = token.length;
+ String tok = new String(token);
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < methods.size(); i++) {
+ IMethod method = (IMethod)methods.get(i);
+ String qname = processMethodName(method, tok);
+ char[] name = qname.toCharArray();
+ if( DLTKCore.DEBUG_COMPLETION ) {
+ System.out.println("Completion:" + qname);
+ }
+ if (length <= name.length && CharOperation.prefixEquals(token, name, false)) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, name);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+
+ // accept result
+ CompletionEngine.this.noProposal = false;
+ if (!CompletionEngine.this.requestor.isIgnored(kind)) {
+ CompletionProposal proposal = CompletionEngine.this.createProposal(kind,
+ CompletionEngine.this.actualCompletionPosition);
+ // proposal.setSignature(getSignature(typeBinding));
+ // proposal.setPackageName(q);
+ // proposal.setTypeName(displayName);
+ String[] arguments = null;
+
+ try {
+ arguments = method.getParameters();
+ } catch (ModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if( arguments != null && arguments.length > 0 ) {
+ char[][] args = new char[arguments.length][];
+ for( int j = 0; j < arguments.length; ++j ) {
+ args[j] = arguments[j].toCharArray();
+ }
+ proposal.setParameterNames(args);
+ }
+ if (kind==CompletionProposal.METHOD_REF){
+ StringBuffer sig=new StringBuffer();
+ sig.append(method.getElementName());
+ sig.append('(');
+ if (arguments!=null)
+ for (int a=0;a<arguments.length;a++){
+ sig.append('L');
+ sig.append("Object");
+ sig.append(';');
+ }
+ sig.append(')');
+ proposal.setSignature(sig.toString().toCharArray());
+ }
+ proposal.setName(name);
+ proposal.setCompletion(name);
+ // proposal.setFlags(Flags.AccDefault);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+ protected void findFields(char[] token, boolean canCompleteEmptyToken,
+ List fields,int kind, String prefix) {
+ if (fields == null || fields.size() == 0)
+ return;
+
+ int length = token.length;
+ String tok = new String(token);
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < fields.size(); i++) {
+ IField field = (IField)fields.get(i);
+ String qname = processFieldName(field, tok);
+ char[] name = qname.toCharArray();
+ if( DLTKCore.DEBUG_COMPLETION ) {
+ System.out.println("Completion:" + qname);
+ }
+ if (length <= name.length && CharOperation.prefixEquals(token, name, false)) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, name);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+
+ // accept result
+ CompletionEngine.this.noProposal = false;
+ if (!CompletionEngine.this.requestor.isIgnored(kind)) {
+ CompletionProposal proposal = CompletionEngine.this.createProposal(kind,
+ CompletionEngine.this.actualCompletionPosition);
+ // proposal.setSignature(getSignature(typeBinding));
+ // proposal.setPackageName(q);
+ // proposal.setTypeName(displayName);
+ proposal.setName(name);
+ proposal.setCompletion((prefix+qname).toCharArray());
+ // proposal.setFlags(Flags.AccDefault);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+ protected void findTypes(char[] token, boolean canCompleteEmptyToken, List types) {
+ if (types == null || types.size() == 0)
+ return;
+
+ int length = token.length;
+ String tok = new String(token);
+ if (canCompleteEmptyToken || length > 0) {
+ for (int i = 0; i < types.size(); i++) {
+ IType type = (IType)types.get(i);
+ String qname = processTypeName(type, tok);
+ char[] name = qname.toCharArray();
+ if( DLTKCore.DEBUG_COMPLETION ) {
+ System.out.println("Completion:" + qname);
+ }
+ if (length <= name.length && CharOperation.prefixEquals(token, name, false)) {
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, name);
+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no
+
+ // accept result
+ CompletionEngine.this.noProposal = false;
+ if (!CompletionEngine.this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
+ CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.TYPE_REF,
+ CompletionEngine.this.actualCompletionPosition);
+ // proposal.setSignature(getSignature(typeBinding));
+ // proposal.setPackageName(q);
+ // proposal.setTypeName(displayName);
+
+ proposal.setName(name);
+ proposal.setCompletion(name);
+ // proposal.setFlags(Flags.AccDefault);
+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
+ proposal.setRelevance(relevance);
+ this.requestor.accept(proposal);
+ if (DEBUG) {
+ this.printDebug(proposal);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ int computeBaseRelevance() {
+ return RelevanceConstants.R_DEFAULT;
+ }
+
+ private int computeRelevanceForInterestingProposal() {
+ return RelevanceConstants.R_INTERESTING;
+ }
+
+ protected int computeRelevanceForCaseMatching(char[] token, char[] proposalName) {
+ if (this.options.camelCaseMatch) {
+ if (CharOperation.equals(token, proposalName, true )) {
+ return RelevanceConstants.R_CASE + RelevanceConstants.R_EXACT_NAME;
+ } else if (CharOperation.prefixEquals(token, proposalName, true)) {
+ return RelevanceConstants.R_CASE;
+ } else if (CharOperation.camelCaseMatch(token, proposalName)) {
+ return RelevanceConstants.R_CAMEL_CASE;
+ } else if (CharOperation.equals(token, proposalName, false)) {
+ return RelevanceConstants.R_EXACT_NAME;
+ }
+ } else if (CharOperation.prefixEquals(token, proposalName, true)) {
+ if (CharOperation.equals(token, proposalName, true )) {
+ return RelevanceConstants.R_CASE + RelevanceConstants.R_EXACT_NAME;
+ } else {
+ return RelevanceConstants.R_CASE;
+ }
+ } else if (CharOperation.equals(token, proposalName, false )) {
+ return RelevanceConstants.R_EXACT_NAME;
+ }
+ return 0;
+ }
+
+ int computeRelevanceForRestrictions(int accessRuleKind) {
+ if (accessRuleKind == IAccessRule.K_ACCESSIBLE) {
+ return RelevanceConstants.R_NON_RESTRICTED;
+ }
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/IAssistParser.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/IAssistParser.java
new file mode 100644
index 0000000..20efb7f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/IAssistParser.java
@@ -0,0 +1,34 @@
+package org.eclipse.dltk.codeassist;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.compiler.env.ISourceModule;
+
+public interface IAssistParser {
+
+ /**
+ * Possible this method may be not needed in future.
+ * @param unit
+ */
+ void setSource(ModuleDeclaration unit);
+
+ /**
+ * Used to parse inner content of methods, and other non type or module statements.
+ * @param node
+ * @param unit
+ * @param position
+ */
+ void parseBlockStatements(ASTNode node, ASTNode unit, int position);
+
+ public ModuleDeclaration parse(ISourceModule sourceUnit);
+
+ // XXX wtf? what should this method do?
+ public ASTNode getAssistNodeParent();
+
+ /**
+ * Called when element couldn't be found.
+ * @param unit
+ * @param position
+ */
+ void handleNotInElement(ASTNode unit, int position);
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ICompletionEngine.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ICompletionEngine.java
new file mode 100644
index 0000000..56e2623
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ICompletionEngine.java
@@ -0,0 +1,7 @@
+package org.eclipse.dltk.codeassist;
+
+import org.eclipse.dltk.compiler.env.ISourceModule;
+
+public interface ICompletionEngine {
+ void complete(ISourceModule module, int position, int i);
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ISelectionEngine.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ISelectionEngine.java
new file mode 100644
index 0000000..622d834
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/ISelectionEngine.java
@@ -0,0 +1,8 @@
+package org.eclipse.dltk.codeassist;
+
+import org.eclipse.dltk.compiler.env.ISourceModule;
+import org.eclipse.dltk.core.IModelElement;
+
+public interface ISelectionEngine {
+ IModelElement[] select(ISourceModule module, int offset, int i);
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/RelevanceConstants.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/RelevanceConstants.java
new file mode 100644
index 0000000..c710806
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/RelevanceConstants.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.codeassist;
+
+public final class RelevanceConstants {
+
+ private RelevanceConstants() {
+ }
+
+ public static final int R_DEFAULT = 0;
+ public static final int R_INTERESTING = 5;
+ public static final int R_CASE = 10;
+ public static final int R_CAMEL_CASE = 5;
+ public static final int R_EXACT_NAME = 4;
+ public static final int R_EXPECTED_TYPE = 20;
+ public static final int R_EXACT_EXPECTED_TYPE = 30;
+ public static final int R_INTERFACE = 20;
+ public static final int R_TYPE = 20;
+ public static final int R_ANNOTATION = 20;
+ public static final int R_EXCEPTION = 20;
+ public static final int R_UNQUALIFIED = 3;
+ public static final int R_QUALIFIED = 2;
+ public static final int R_NAME_FIRST_PREFIX = 6;
+ public static final int R_NAME_PREFIX = 5;
+ public static final int R_NAME_FIRST_SUFFIX = 4;
+ public static final int R_NAME_SUFFIX = 3;
+ public static final int R_NAME_LESS_NEW_CHARACTERS = 15;
+ public static final int R_METHOD_OVERIDE = 3;
+ public static final int R_NON_RESTRICTED = 3;
+ public static final int R_TRUE_OR_FALSE = 1;
+ public static final int R_INLINE_TAG = 31;
+ public static final int R_VALUE_TAG = 31;
+ public static final int R_NON_INHERITED = 2;
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionNodeFound.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionNodeFound.java
new file mode 100644
index 0000000..d64ba9d
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionNodeFound.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.codeassist.complete;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.compiler.env.lookup.Scope;
+
+public class CompletionNodeFound extends RuntimeException {
+ private static final long serialVersionUID = 8556836876798770199L;
+ public ASTNode astNode;
+
+ public Scope scope;
+ public boolean insideTypeAnnotation = false;
+
+ // compatible
+ public CompletionNodeFound() {
+ // we found a problem in the completion
+ this(null, null, false);
+ }
+
+ public CompletionNodeFound(ASTNode astNode, Scope scope) {
+ this(astNode, scope, false);
+ }
+
+ public CompletionNodeFound(ASTNode astNode, Scope scope,
+ boolean insideTypeAnnotation) {
+ this.astNode = astNode;
+ this.scope = scope;
+ this.insideTypeAnnotation = insideTypeAnnotation;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionOnKeyword.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionOnKeyword.java
new file mode 100644
index 0000000..cf9882c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/CompletionOnKeyword.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.codeassist.complete;
+
+import org.eclipse.dltk.ast.references.SimpleReference;
+
+public class CompletionOnKeyword extends SimpleReference implements
+ ICompletionOnKeyword {
+ private String[] possibleKeywords;
+
+ public boolean canCompleteEmptyToken;
+
+ public CompletionOnKeyword(String token, int pos, char[] possibleKeyword) {
+ this(token, pos, new String[] { new String(possibleKeyword) });
+ }
+
+ public CompletionOnKeyword(String token, int pos, String[] possibleKeywords) {
+ super(pos, pos + token.length(), token);
+ this.possibleKeywords = possibleKeywords;
+ }
+
+ public boolean canCompleteEmptyToken() {
+ return this.canCompleteEmptyToken;
+ }
+
+ public char[] getToken() {
+ return this.getName().toCharArray();
+ }
+
+ public String[] getPossibleKeywords() {
+ return possibleKeywords;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ return output
+ .append("<CompleteOnKeyword:").append(getName()).append('>'); //$NON-NLS-1$
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/ICompletionOnKeyword.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/ICompletionOnKeyword.java
new file mode 100644
index 0000000..e43cb9c
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/codeassist/complete/ICompletionOnKeyword.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.codeassist.complete;
+
+public interface ICompletionOnKeyword {
+ char[] getToken();
+ String[] getPossibleKeywords();
+ boolean canCompleteEmptyToken();
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/ISearchRequestor.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/ISearchRequestor.java
new file mode 100644
index 0000000..1abd124
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/ISearchRequestor.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.internal.codeassist;
+
+import org.eclipse.dltk.internal.compiler.env.AccessRestriction;
+
+/**
+ * This is the internal requestor passed to the searchable name environment
+ * so as to process the multiple search results as they are discovered.
+ *
+ * It is used to allow the code assist engine to add some more information
+ * to the raw name environment results before answering them to the UI.
+ */
+public interface ISearchRequestor {
+ /**
+ * One result of the search consists of a new type.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c".
+ * Nested type names are in the qualified form "A.I".
+ * The default package is represented by an empty array.
+ */
+ public void acceptType(char[] packageName, char[] typeName, char[][] enclosingTypeNames, int modifiers, AccessRestriction accessRestriction);
+
+// /**
+// * One result of the search consists of a new annotation.
+// *
+// * NOTE - All package and type names are presented in their readable form:
+// * Package names are in the form "a.b.c".
+// * Nested type names are in the qualified form "A.I".
+// * The default package is represented by an empty array.
+// */
+// public void acceptAnnotation(char[] packageName, char[] typeName, int modifiers, AccessRestriction accessRestriction);
+//
+// /**
+// * One result of the search consists of a new class.
+// *
+// * NOTE - All package and type names are presented in their readable form:
+// * Package names are in the form "a.b.c".
+// * Nested type names are in the qualified form "A.M".
+// * The default package is represented by an empty array.
+// */
+// public void acceptClass(char[] packageName, char[] typeName, int modifiers, AccessRestriction accessRestriction);
+//
+// /**
+// * One result of the search consists of a new enum.
+// *
+// * NOTE - All package and type names are presented in their readable form:
+// * Package names are in the form "a.b.c".
+// * Nested type names are in the qualified form "A.I".
+// * The default package is represented by an empty array.
+// */
+// public void acceptEnum(char[] packageName, char[] typeName, int modifiers, AccessRestriction accessRestriction);
+//
+// /**
+// * One result of the search consists of a new interface.
+// *
+// * NOTE - All package and type names are presented in their readable form:
+// * Package names are in the form "a.b.c".
+// * Nested type names are in the qualified form "A.I".
+// * The default package is represented by an empty array.
+// */
+// public void acceptInterface(char[] packageName, char[] typeName, int modifiers, AccessRestriction accessRestriction);
+
+ /**
+ * One result of the search consists of a new package.
+ *
+ * NOTE - All package names are presented in their readable form:
+ * Package names are in the form "a.b.c".
+ * The default package is represented by an empty array.
+ */
+ public void acceptPackage(char[] packageName);
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionContext.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionContext.java
new file mode 100644
index 0000000..db20e07
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionContext.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.dltk.internal.codeassist;
+
+/**
+ * Internal completion context
+ */
+public class InternalCompletionContext {
+ protected char[][] expectedTypesSignatures;
+ protected char[][] expectedTypesKeys;
+ protected int doc;
+
+ protected int offset = -1;
+ protected int tokenStart = -1;
+ protected int tokenEnd = -1;
+ protected char[] token = null;
+ protected int tokenKind;
+
+ protected void setExpectedTypesSignatures(char[][] expectedTypesSignatures) {
+ this.expectedTypesSignatures = expectedTypesSignatures;
+ }
+
+ protected void setExpectedTypesKeys(char[][] expectedTypesKeys) {
+ this.expectedTypesKeys = expectedTypesKeys;
+ }
+
+ protected void setDoc(int doc) {
+ this.doc = doc;
+ }
+
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+ public void setTokenRange(int start, int end) {
+ this.setTokenRange(start, end, -1);
+ }
+
+ protected void setTokenRange(int start, int end, int endOfEmptyToken) {
+ this.tokenStart = start;
+ this.tokenEnd = endOfEmptyToken > end ? endOfEmptyToken : end;
+
+ // Work around for bug 132558
+ // (https://bugs.eclipse.org/bugs/show_bug.cgi?id=132558).
+ // completionLocation can be -1 if the completion occur at the start of
+ // a file or
+ // the start of a code snippet but this API isn't design to support
+ // negative position.
+ if (this.tokenEnd == -1) {
+ this.tokenEnd = 0;
+ }
+ }
+
+ protected void setToken(char[] token) {
+ this.token = token;
+ }
+
+ public void setTokenKind(int tokenKind) {
+ this.tokenKind = tokenKind;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionProposal.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionProposal.java
new file mode 100644
index 0000000..a3f2b72
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/InternalCompletionProposal.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 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.dltk.internal.codeassist;
+
+import org.eclipse.dltk.codeassist.ICompletionEngine;
+import org.eclipse.dltk.compiler.CharOperation;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.IAccessRule;
+import org.eclipse.dltk.internal.core.NameLookup;
+
+/**
+ * Internal completion proposal
+ */
+public class InternalCompletionProposal {
+
+ static final char[] ARG = "arg".toCharArray(); //$NON-NLS-1$
+ static final char[] ARG0 = "arg0".toCharArray(); //$NON-NLS-1$
+ static final char[] ARG1 = "arg1".toCharArray(); //$NON-NLS-1$
+ static final char[] ARG2 = "arg2".toCharArray(); //$NON-NLS-1$
+ static final char[] ARG3 = "arg3".toCharArray(); //$NON-NLS-1$
+ static final char[][] ARGS1 = new char[][]{ARG0};
+ static final char[][] ARGS2 = new char[][]{ARG0, ARG1};
+ static final char[][] ARGS3 = new char[][]{ARG0, ARG1, ARG2};
+ static final char[][] ARGS4 = new char[][]{ARG0, ARG1, ARG2, ARG3};
+
+ public ICompletionEngine completionEngine;
+ public NameLookup nameLookup;
+
+ protected char[] declarationPackageName;
+ protected char[] declarationTypeName;
+ protected char[] packageName;
+ protected char[] typeName;
+ protected char[][] parameterPackageNames;
+ protected char[][] parameterTypeNames;
+
+ protected char[] originalSignature;
+
+ protected int accessibility = IAccessRule.K_ACCESSIBLE;
+
+ protected boolean isConstructor = false;
+
+ protected char[][] createDefaultParameterNames(int length) {
+ char[][] parameterNames;
+ switch (length) {
+ case 0 :
+ parameterNames = new char[length][];
+ break;
+ case 1 :
+ parameterNames = ARGS1;
+ break;
+ case 2 :
+ parameterNames = ARGS2;
+ break;
+ case 3 :
+ parameterNames = ARGS3;
+ break;
+ case 4 :
+ parameterNames = ARGS4;
+ break;
+ default :
+ parameterNames = new char[length][];
+ for (int i = 0; i < length; i++) {
+ parameterNames[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray());
+ }
+ break;
+ }
+ return parameterNames;
+ }
+ protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames){
+ if (DLTKCore.DEBUG) {
+ System.err.println("TODO: Add find method parameter names");
+ }
+ return null;
+ }
+
+ protected char[] getDeclarationPackageName() {
+ return this.declarationPackageName;
+ }
+
+ protected char[] getDeclarationTypeName() {
+ return this.declarationTypeName;
+ }
+
+ protected char[] getPackageName() {
+ return this.packageName;
+ }
+
+ protected char[] getTypeName() {
+ return this.typeName;
+ }
+
+ protected char[][] getParameterPackageNames() {
+ return this.parameterPackageNames;
+ }
+
+
+ protected char[][] getParameterTypeNames() {
+ return this.parameterTypeNames;
+ }
+
+ protected void setDeclarationPackageName(char[] declarationPackageName) {
+ this.declarationPackageName = declarationPackageName;
+ }
+
+ protected void setDeclarationTypeName(char[] declarationTypeName) {
+ this.declarationTypeName = declarationTypeName;
+ }
+
+ protected void setPackageName(char[] packageName) {
+ this.packageName = packageName;
+ }
+
+ protected void setTypeName(char[] typeName) {
+ this.typeName = typeName;
+ }
+
+ protected void setParameterPackageNames(char[][] parameterPackageNames) {
+ this.parameterPackageNames = parameterPackageNames;
+ }
+
+ protected void setParameterTypeNames(char[][] parameterTypeNames) {
+ this.parameterTypeNames = parameterTypeNames;
+ }
+
+ protected void setAccessibility(int kind) {
+ this.accessibility = kind;
+ }
+
+ protected void setIsContructor(boolean isConstructor) {
+ this.isConstructor = isConstructor;
+ }
+ public void setOriginalSignature(char[] originalSignature) {
+ this.originalSignature = originalSignature;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/AssistOptions.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/AssistOptions.java
new file mode 100644
index 0000000..9602bac
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/AssistOptions.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.internal.codeassist.impl;
+
+import java.util.Map;
+
+import org.eclipse.dltk.compiler.CharOperation;
+
+
+public class AssistOptions {
+ /**
+ * Option IDs
+ */
+ public static final String OPTION_PerformVisibilityCheck =
+ "org.eclipse.dltk.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
+ public static final String OPTION_PerformDeprecationCheck =
+ "org.eclipse.dltk.core.codeComplete.deprecationCheck"; //$NON-NLS-1$
+ public static final String OPTION_ForceImplicitQualification =
+ "org.eclipse.dltk.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
+ public static final String OPTION_FieldPrefixes =
+ "org.eclipse.dltk.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_StaticFieldPrefixes =
+ "org.eclipse.dltk.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_LocalPrefixes =
+ "org.eclipse.dltk.core.codeComplete.localPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_ArgumentPrefixes =
+ "org.eclipse.dltk.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
+ public static final String OPTION_FieldSuffixes =
+ "org.eclipse.dltk.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_StaticFieldSuffixes =
+ "org.eclipse.dltk.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_LocalSuffixes =
+ "org.eclipse.dltk.core.codeComplete.localSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_ArgumentSuffixes =
+ "org.eclipse.dltk.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_PerformForbiddenReferenceCheck =
+ "org.eclipse.dltk.core.codeComplete.forbiddenReferenceCheck"; //$NON-NLS-1$
+ public static final String OPTION_PerformDiscouragedReferenceCheck =
+ "org.eclipse.dltk.core.codeComplete.discouragedReferenceCheck"; //$NON-NLS-1$
+ public static final String OPTION_CamelCaseMatch =
+ "org.eclipse.dltk.core.codeComplete.camelCaseMatch"; //$NON-NLS-1$
+
+ public static final String ENABLED = "enabled"; //$NON-NLS-1$
+ public static final String DISABLED = "disabled"; //$NON-NLS-1$
+
+ public boolean checkVisibility = false;
+ public boolean checkDeprecation = false;
+ public boolean checkForbiddenReference = false;
+ public boolean checkDiscouragedReference = false;
+ public boolean forceImplicitQualification = false;
+ public boolean camelCaseMatch = true;
+ public char[][] fieldPrefixes = null;
+ public char[][] staticFieldPrefixes = null;
+ public char[][] localPrefixes = null;
+ public char[][] argumentPrefixes = null;
+ public char[][] fieldSuffixes = null;
+ public char[][] staticFieldSuffixes = null;
+ public char[][] localSuffixes = null;
+ public char[][] argumentSuffixes = null;
+
+ /**
+ * Initializing the assist options with default settings
+ */
+ public AssistOptions() {
+ // Initializing the assist options with default settings
+ }
+
+ /**
+ * Initializing the assist options with external settings
+ */
+ public AssistOptions(Map settings) {
+ if (settings == null)
+ return;
+
+ set(settings);
+ }
+ public void set(Map optionsMap) {
+
+ Object optionValue;
+ if ((optionValue = optionsMap.get(OPTION_PerformVisibilityCheck)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.checkVisibility = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.checkVisibility = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ForceImplicitQualification)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.forceImplicitQualification = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.forceImplicitQualification = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_FieldPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.fieldPrefixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.fieldPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_StaticFieldPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.staticFieldPrefixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.staticFieldPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_LocalPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.localPrefixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.localPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ArgumentPrefixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.argumentPrefixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.argumentPrefixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_FieldSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.fieldSuffixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.fieldSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_StaticFieldSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.staticFieldSuffixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.staticFieldSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_LocalSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.localSuffixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.localSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_ArgumentSuffixes)) != null) {
+ if (optionValue instanceof String) {
+ String stringValue = (String) optionValue;
+ if (stringValue.length() > 0){
+ this.argumentSuffixes = this.splitAndTrimOn(',', stringValue.toCharArray());
+ } else {
+ this.argumentSuffixes = null;
+ }
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_PerformForbiddenReferenceCheck)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.checkForbiddenReference = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.checkForbiddenReference = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_PerformDiscouragedReferenceCheck)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.checkDiscouragedReference = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.checkDiscouragedReference = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_CamelCaseMatch)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.camelCaseMatch = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.camelCaseMatch = false;
+ }
+ }
+ if ((optionValue = optionsMap.get(OPTION_PerformDeprecationCheck)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.checkDeprecation = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.checkDeprecation = false;
+ }
+ }
+ }
+
+ private char[][] splitAndTrimOn(char divider, char[] arrayToSplit) {
+ char[][] result = CharOperation.splitAndTrimOn(',', arrayToSplit);
+
+ int length = result.length;
+
+ int resultCount = 0;
+ for (int i = 0; i < length; i++) {
+ if(result[i].length != 0) {
+ result[resultCount++] = result[i];
+ }
+ }
+ if(resultCount != length) {
+ System.arraycopy(result, 0, result = new char[resultCount][], 0, resultCount);
+ }
+ return result;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/Engine.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/Engine.java
new file mode 100644
index 0000000..600799f
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/impl/Engine.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.internal.codeassist.impl;
+
+import java.util.Map;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.MethodDeclaration;
+import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.declarations.TypeDeclaration;
+import org.eclipse.dltk.codeassist.IAssistParser;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.ISearchableEnvironment;
+import org.eclipse.dltk.core.search.SearchPattern;
+import org.eclipse.dltk.internal.compiler.impl.ITypeRequestor;
+import org.eclipse.dltk.internal.compiler.lookup.LookupEnvironment;
+import org.eclipse.dltk.internal.compiler.lookup.SourceModuleScope;
+
+public abstract class Engine implements ITypeRequestor {
+ public LookupEnvironment lookupEnvironment;
+ protected ISearchableEnvironment nameEnvironment;
+ protected SourceModuleScope unitScope;
+ public AssistOptions options;
+ public boolean forbiddenReferenceIsError;
+ public boolean discouragedReferenceIsError;
+
+ protected static int EXACT_RULE = SearchPattern.R_EXACT_MATCH
+ | SearchPattern.R_CASE_SENSITIVE;
+
+ public Engine(Map settings) {
+ this.options = new AssistOptions(settings);
+ this.forbiddenReferenceIsError = false;
+ this.discouragedReferenceIsError = false;
+ }
+
+ /*
+ * Find the node (a field, a method or an initializer) at the given position
+ * and parse its block statements if it is a method or an initializer.
+ * Returns the node or null if not found
+ */
+ protected ASTNode parseBlockStatements(ModuleDeclaration unit, int position) {
+ TypeDeclaration types[] = unit.getTypes();
+ int length = types.length;
+ for (int i = 0; i < length; i++) {
+ TypeDeclaration type = types[i];
+ if (type.sourceStart() <= position && type.sourceEnd() >= position) {
+ getParser().setSource(unit);
+ return parseBlockStatements(type, unit, position);
+ }
+ }
+ MethodDeclaration[] methods = unit.getFunctions();
+ length = methods.length;
+ for (int i = 0; i < length; i++) {
+ MethodDeclaration method = methods[i];
+ if (method.sourceStart() <= position
+ && method.sourceEnd() >= position) {
+ getParser().setSource(unit);
+ return parseMethod(method, unit, position);
+ }
+ }
+
+ ASTNode[] nodes = unit.getNonTypeOrMethodNode();
+ length = nodes.length;
+ for (int i = 0; i < length; i++) {
+ ASTNode node = nodes[i];
+ if (node.sourceStart() <= position && node.sourceEnd() >= position) {
+ getParser().setSource(unit);
+ getParser().parseBlockStatements(node, unit, position);
+ return node;
+ }
+ }
+ getParser().handleNotInElement(unit, position);
+ // Non type elements
+ return null;
+ }
+
+ private ASTNode parseBlockStatements(TypeDeclaration type,
+ ModuleDeclaration unit, int position) {
+ // members
+ TypeDeclaration[] memberTypes = type.getTypes();
+ if (memberTypes != null) {
+ int length = memberTypes.length;
+ for (int i = 0; i < length; i++) {
+ TypeDeclaration memberType = memberTypes[i];
+ if (memberType.getNameStart() <= position
+ && memberType.getNameEnd() >= position) {
+ getParser().handleNotInElement(memberType, position);
+ }
+ if (memberType.getBodyStart() > position)
+ continue;
+ if (memberType.sourceEnd() >= position) {
+ return parseBlockStatements(memberType, unit, position);
+ }
+ }
+ }
+ // methods
+ MethodDeclaration[] methods = type.getMethods();
+ if (methods != null) {
+ int length = methods.length;
+ for (int i = 0; i < length; i++) {
+ MethodDeclaration method = methods[i];
+ ASTNode node = parseMethod(method, unit, position);
+ if (node != null) {
+ return node;
+ }
+ }
+ }
+ ASTNode[] nodes = type.getNonTypeOrMethodNode();
+ int length = nodes.length;
+ for (int i = 0; i < length; i++) {
+ ASTNode node = nodes[i];
+ if (node.sourceStart() <= position && node.sourceEnd() >= position) {
+ getParser().setSource(unit);
+ getParser().parseBlockStatements(node, type, position);
+ return node;
+ }
+ }
+ getParser().handleNotInElement(type, position);
+ if (DLTKCore.DEBUG) {
+ System.err.println("TODO: Engine: Add fields support.");
+ }
+ return null;
+ }
+
+ private ASTNode parseMethod(MethodDeclaration method,
+ ModuleDeclaration unit, int position) {
+ if (method != null) {
+ if (method.sourceStart() > position)
+ return null;
+ if (method.sourceEnd() >= position) {
+ getParser().parseBlockStatements(method, unit, position);
+ return method;
+ }
+ }
+ return null;
+ }
+
+ public abstract IAssistParser getParser();
+
+ protected void reset() {
+ if (lookupEnvironment != null) {
+ lookupEnvironment.reset();
+ }
+ }
+
+}
diff --git a/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/select/SelectionNodeFound.java b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/select/SelectionNodeFound.java
new file mode 100644
index 0000000..e8b2075
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/codeassist/org/eclipse/dltk/internal/codeassist/select/SelectionNodeFound.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.internal.codeassist.select;
+
+import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.internal.compiler.lookup.Binding;
+
+public class SelectionNodeFound extends RuntimeException {
+
+ private static final long serialVersionUID = -4242506971248812583L;
+ private ASTNode node;
+ private Binding binding;
+ private boolean isDeclaration;
+
+ public SelectionNodeFound(ASTNode node) {
+ this.node = node;
+ }
+
+ public SelectionNodeFound(Binding binding, boolean isDeclaration) {
+ this.binding = binding;
+ this.isDeclaration = isDeclaration;
+ }
+
+ public ASTNode getNode() {
+ return node;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public boolean isDeclaration () {
+ return this.isDeclaration;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CategorizedProblem.java b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CategorizedProblem.java
new file mode 100644
index 0000000..2bf228e
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CategorizedProblem.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.dltk.compiler;
+
+
+public abstract class CategorizedProblem implements IProblem {
+ /**
+ * List of standard category IDs used by the problems, more categories will
+ * be added in the future.
+ */
+ public static final int CAT_UNSPECIFIED = 0;
+ /** Category for problems related to buildpath */
+ public static final int CAT_BUILDPATH = 10;
+ /** Category for fatal problems related to syntax */
+ public static final int CAT_SYNTAX = 20;
+ /** Category for fatal problems in import statements */
+ public static final int CAT_IMPORT = 30;
+ /**
+ * Category for fatal problems related to types, could be addressed by some
+ * type change
+ */
+ public static final int CAT_TYPE = 40;
+ /**
+ * Category for fatal problems related to type members, could be addressed
+ * by some field or method change
+ */
+ public static final int CAT_MEMBER = 50;
+ /**
+ * Category for fatal problems which could not be addressed by external
+ * changes, but require an edit to be addressed
+ */
+ public static final int CAT_INTERNAL = 60;
+ /** Category for optional problems related to coding style practices */
+ public static final int CAT_CODE_STYLE = 80;
+ /** Category for optional problems related to potential programming flaws */
+ public static final int CAT_POTENTIAL_PROGRAMMING_PROBLEM = 90;
+ /** Category for optional problems related to naming conflicts */
+ public static final int CAT_NAME_SHADOWING_CONFLICT = 100;
+ /** Category for optional problems related to deprecation */
+ public static final int CAT_DEPRECATION = 110;
+ /** Category for optional problems related to unnecessary code */
+ public static final int CAT_UNNECESSARY_CODE = 120;
+ /** Category for optional problems related to type safety in generics */
+ public static final int CAT_UNCHECKED_RAW = 130;
+ /**
+ * Category for optional problems related to internationalization of String
+ * literals
+ */
+ public static final int CAT_NLS = 140;
+ /** Category for optional problems related to access restrictions */
+ public static final int CAT_RESTRICTION = 150;
+
+ /**
+ * Returns an integer identifying the category of this problem. Categories,
+ * like problem IDs are defined in the context of some marker type. Custom
+ * implementations of <code>CategorizedProblem</code> may choose arbitrary
+ * values for problem/category IDs, as long as they are associated with a
+ * different marker type. Standard script problem markers (i.e. marker type is
+ * "org.eclipse.dltk.core.problem") carry an attribute "categoryId"
+ * persisting the originating problem category ID as defined by this
+ * method).
+ *
+ * @return id - an integer identifying the category of this problem
+ */
+ public abstract int getCategoryID();
+
+ /**
+ * Returns the marker type associated to this problem, if it gets persisted
+ * into a marker by the Standard Script problems are associated to
+ * marker type "org.eclipse.dltk.core.problem"). Note: problem markers are
+ * expected to extend "org.eclipse.core.resources.problemmarker" marker
+ * type.
+ *
+ * @return the type of the marker which would be associated to the problem
+ */
+ public abstract String getMarkerType();
+
+ /**
+ * Returns the names of the extra marker attributes associated to this
+ * problem when persisted into a marker. Extra attributes
+ * are only optional, and are allowing client customization of generated
+ * markers. By default, no EXTRA attributes is persisted, and a categorized
+ * problem only persists the following attributes:
+ * <ul>
+ * <li> <code>IMarker#MESSAGE</code> -> {@link IProblem#getMessage()}</li>
+ * <li> <code>IMarker#SEVERITY</code> ->
+ * <code> IMarker#SEVERITY_ERROR</code> or
+ * <code>IMarker#SEVERITY_WARNING</code> depending on
+ * {@link IProblem#isError()} or {@link IProblem#isWarning()}</li>
+ * <li> <code>IMarker#CHAR_START</code> ->
+ * {@link IProblem#getSourceStart()}</li>
+ * <li> <code>IMarker#CHAR_END</code> ->
+ * {@link IProblem#getSourceEnd()}</li>
+ * <li> <code>IMarker#LINE_NUMBER</code> ->
+ * {@link IProblem#getSourceLineNumber()}</li>
+ * </ul>
+ * The names must be eligible for marker creation, as defined by
+ * <code>IMarker#setAttributes(String[], Object[])</code>, and there must
+ * be as many names as values according to
+ * {@link #getExtraMarkerAttributeValues()}. Note that extra marker
+ * attributes will be inserted after default ones (as described in
+ * {@link CategorizedProblem#getMarkerType()}, and thus could be used to
+ * override defaults.
+ *
+ * @return the names of the corresponding marker attributes
+ */
+ public String[] getExtraMarkerAttributeNames() {
+ return CharOperation.NO_STRINGS;
+ }
+
+ /**
+ * Returns the respective values for the extra marker attributes associated
+ * to this problem when persisted into a marker. Each
+ * value must correspond to a matching attribute name, as defined by
+ * {@link #getExtraMarkerAttributeNames()}. The values must be eligible for
+ * marker creation, as defined by
+ * <code>IMarker#setAttributes(String[], Object[])</code>.
+ *
+ * @return the values of the corresponding extra marker attributes
+ */
+ public Object[] getExtraMarkerAttributeValues() {
+ return DefaultProblem.EMPTY_VALUES;
+ }
+}
diff --git a/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CharOperation.java b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CharOperation.java
new file mode 100644
index 0000000..532ef35
--- /dev/null
+++ b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/CharOperation.java
@@ -0,0 +1,3860 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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.dltk.compiler;
+
+import org.eclipse.dltk.compiler.util.ScannerHelper;
+
+/**
+ * This class is a collection of helper methods to manipulate char arrays.
+ *
+ *
+ */
+public final class CharOperation {
+
+ /**
+ * Constant for an empty char array
+ */
+ public static final char[] NO_CHAR = new char[0];
+
+ /**
+ * Constant for an empty char array with two dimensions.
+ */
+ public static final char[][] NO_CHAR_CHAR = new char[0][];
+
+ /**
+ * Constant for an empty String array.
+ *
+ *
+ */
+ public static final String[] NO_STRINGS = new String[0];
+
+ private static final char MAX_OBVIOUS = 128;
+
+ /**
+ * Answers a new array with appending the suffix character at the end of the
+ * array. <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b' }
+ * suffix = 'c'
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = null
+ * suffix = 'c'
+ * => result = { 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param array
+ * the array that is concanated with the suffix character
+ * @param suffix
+ * the suffix character
+ * @return the new array
+ */
+ public static final char[] append(char[] array, char suffix) {
+ if (array == null)
+ return new char[] { suffix };
+ int length = array.length;
+ System.arraycopy(array, 0, array = new char[length + 1], 0, length);
+ array[length] = suffix;
+ return array;
+ }
+
+ /**
+ * Append the given subarray to the target array starting at the given index
+ * in the target array. The start of the subarray is inclusive, the end is
+ * exclusive. Answers a new target array if it needs to grow, otherwise
+ * answers the same target array. <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * target = { 'a', 'b', '0' }
+ * index = 2
+ * array = { 'c', 'd' }
+ * start = 0
+ * end = 1
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * target = { 'a', 'b' }
+ * index = 2
+ * array = { 'c', 'd' }
+ * start = 0
+ * end = 1
+ * => result = { 'a', 'b' , 'c', '0', '0' , '0' } (new array)
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * target = { 'a', 'b', 'c' }
+ * index = 1
+ * array = { 'c', 'd', 'e', 'f' }
+ * start = 1
+ * end = 4
+ * => result = { 'a', 'd' , 'e', 'f', '0', '0', '0', '0' } (new array)
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param target
+ * the given target
+ * @param index
+ * the given index
+ * @param array
+ * the given array
+ * @param start
+ * the given start index
+ * @param end
+ * the given end index
+ *
+ * @return the new array
+ * @throws NullPointerException
+ * if the target array is null
+ */
+ public static final char[] append(char[] target, int index, char[] array,
+ int start, int end) {
+ int targetLength = target.length;
+ int subLength = end - start;
+ int newTargetLength = subLength + index;
+ if (newTargetLength > targetLength) {
+ System.arraycopy(target, 0, target = new char[newTargetLength * 2],
+ 0, index);
+ }
+ System.arraycopy(array, start, target, index, subLength);
+ return target;
+ }
+
+ /**
+ * Answers the concatenation of the two arrays. It answers null if the two
+ * arrays are null. If the first array is null, then the second array is
+ * returned. If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = null
+ * => result = null
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = { { ' a' } }
+ * => result = { { ' a' } }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { ' b' } }
+ * second = { { ' a' } }
+ * => result = { { ' b' }, { ' a' } }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays
+ * are null.
+ */
+ public static final char[][] arrayConcat(char[][] first, char[][] second) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ int length2 = second.length;
+ char[][] result = new char[length1 + length2][];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ return result;
+ }
+
+ /**
+ * Returns the char arrays as an array of Strings
+ *
+ * @param charArrays
+ * the char array to convert
+ * @return the char arrays as an array of Strings or null if the given char
+ * arrays is null.
+ *
+ */
+ public static String[] charArrayToStringArray(char[][] charArrays) {
+ if (charArrays == null)
+ return null;
+ int length = charArrays.length;
+ if (length == 0)
+ return NO_STRINGS;
+ String[] strings = new String[length];
+ for (int i = 0; i < length; i++)
+ strings[i] = new String(charArrays[i]);
+ return strings;
+ }
+
+ /**
+ * Returns the char array as a String
+ *
+ * @param charArray
+ * the char array to convert
+ * @return the char array as a String or null if the given char array is
+ * null.
+ *
+ */
+ public static String charToString(char[] charArray) {
+ if (charArray == null)
+ return null;
+ return new String(charArray);
+ }
+
+ /**
+ * Answers a new array adding the second array at the end of first array. It
+ * answers null if the first and second are null. If the first array is
+ * null, then a new array char[][] is created with second. If the second
+ * array is null, then the first array is returned. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = { 'a' }
+ * => result = { { ' a' } }
+ * </pre>
+ *
+ * <li>
+ *
+ * <pre>
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { ' a' } }
+ * second = { ' b' }
+ * => result = { { ' a' } , { ' b' } }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the array to add at the end of the first array
+ * @return a new array adding the second array at the end of first array, or
+ * null if the two arrays are null.
+ */
+ public static final char[][] arrayConcat(char[][] first, char[] second) {
+ if (second == null)
+ return first;
+ if (first == null)
+ return new char[][] { second };
+
+ int length = first.length;
+ char[][] result = new char[length + 1][];
+ System.arraycopy(first, 0, result, 0, length);
+ result[length] = second;
+ return result;
+ }
+
+ /**
+ * Compares the contents of the two arrays array and prefix. Returns
+ * <ul>
+ * <li>zero if the array starts with the prefix contents</li>
+ * <li>the difference between the first two characters that are not equal
+ * </li>
+ * <li>one if array length is lower than the prefix length and that the
+ * prefix starts with the array contents.</li>
+ * </ul>
+ * <p>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * array = null
+ * prefix = null
+ * => result = NullPointerException
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'b', 'c'}
+ * => result = 0
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'B', 'c'}
+ * => result = 32
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'd', 'b', 'c', 'd', 'e' }
+ * prefix = { 'a', 'b', 'c'}
+ * => result = 3
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b', 'c', 'd', 'e' }
+ * prefix = { 'd', 'b', 'c'}
+ * => result = -3
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'a', 'c', 'd', 'e' }
+ * prefix = { 'a', 'e', 'c'}
+ * => result = -4
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ * </p>
+ *
+ * @param array
+ * the given array
+ * @param prefix
+ * the given prefix
+ * @return the result of the comparison (>=0 if array>prefix)
+ * @throws NullPointerException
+ * if either array or prefix is null
+ */
+ public static final int compareWith(char[] array, char[] prefix) {
+ int arrayLength = array.length;
+ int prefixLength = prefix.length;
+ int min = Math.min(arrayLength, prefixLength);
+ int i = 0;
+ while (min-- != 0) {
+ char c1 = array[i];
+ char c2 = prefix[i++];
+ if (c1 != c2)
+ return c1 - c2;
+ }
+ if (prefixLength == i)
+ return 0;
+ return -1; // array is shorter than prefix (e.g. array:'ab' <
+ // prefix:'abc').
+ }
+
+ /**
+ * Answers the concatenation of the two arrays. It answers null if the two
+ * arrays are null. If the first array is null, then the second array is
+ * returned. If the second array is null, then the first array is returned.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = { 'a' }
+ * => result = { ' a' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { ' a' }
+ * second = null
+ * => result = { ' a' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { ' a' }
+ * second = { ' b' }
+ * => result = { ' a' , ' b' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays
+ * are null.
+ */
+ public static final char[] concat(char[] first, char[] second) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ int length2 = second.length;
+ char[] result = new char[length1 + length2];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the three arrays. It answers null if the
+ * three arrays are null. If first is null, it answers the concatenation of
+ * second and third. If second is null, it answers the concatenation of
+ * first and third. If third is null, it answers the concatenation of first
+ * and second. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = { 'a' }
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * second = null
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = null
+ * => result = { ' a', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = null
+ * third = null
+ * => result = null
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = { 'c' }
+ * => result = { 'a', 'b', 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @param third
+ * the third array to concatenate
+ *
+ * @return the concatenation of the three arrays, or null if the three
+ * arrays are null.
+ */
+ public static final char[] concat(char[] first, char[] second, char[] third) {
+ if (first == null)
+ return concat(second, third);
+ if (second == null)
+ return concat(first, third);
+ if (third == null)
+ return concat(first, second);
+
+ int length1 = first.length;
+ int length2 = second.length;
+ int length3 = third.length;
+ char[] result = new char[length1 + length2 + length3];
+ System.arraycopy(first, 0, result, 0, length1);
+ System.arraycopy(second, 0, result, length1, length2);
+ System.arraycopy(third, 0, result, length1 + length2, length3);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the two arrays inserting the separator
+ * character between the two arrays. It answers null if the two arrays are
+ * null. If the first array is null, then the second array is returned. If
+ * the second array is null, then the first array is returned. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = { 'a' }
+ * separator = '/'
+ * => result = { ' a' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { ' a' }
+ * second = null
+ * separator = '/'
+ * => result = { ' a' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { ' a' }
+ * second = { ' b' }
+ * separator = '/'
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @param separator
+ * the character to insert
+ * @return the concatenation of the two arrays inserting the separator
+ * character between the two arrays , or null if the two arrays are
+ * null.
+ */
+ public static final char[] concat(char[] first, char[] second,
+ char separator) {
+ if (first == null)
+ return second;
+ if (second == null)
+ return first;
+
+ int length1 = first.length;
+ if (length1 == 0)
+ return second;
+ int length2 = second.length;
+ if (length2 == 0)
+ return first;
+
+ char[] result = new char[length1 + length2 + 1];
+ System.arraycopy(first, 0, result, 0, length1);
+ result[length1] = separator;
+ System.arraycopy(second, 0, result, length1 + 1, length2);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the three arrays inserting the sep1
+ * character between the first two arrays and sep2 between the last two. It
+ * answers null if the three arrays are null. If the first array is null,
+ * then it answers the concatenation of second and third inserting the sep2
+ * character between them. If the second array is null, then it answers the
+ * concatenation of first and third inserting the sep1 character between
+ * them. If the third array is null, then it answers the concatenation of
+ * first and second inserting the sep1 character between them. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * sep1 = '/'
+ * second = { 'a' }
+ * sep2 = ':'
+ * third = { 'b' }
+ * => result = { ' a' , ':', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = null
+ * sep2 = ':'
+ * third = { 'b' }
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = { 'b' }
+ * sep2 = ':'
+ * third = null
+ * => result = { ' a' , '/', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { 'a' }
+ * sep1 = '/'
+ * second = { 'b' }
+ * sep2 = ':'
+ * third = { 'c' }
+ * => result = { ' a' , '/', 'b' , ':', 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array to concatenate
+ * @param sep1
+ * the character to insert
+ * @param second
+ * the second array to concatenate
+ * @param sep2
+ * the character to insert
+ * @param third
+ * the second array to concatenate
+ * @return the concatenation of the three arrays inserting the sep1
+ * character between the two arrays and sep2 between the last two.
+ */
+ public static final char[] concat(char[] first, char sep1, char[] second,
+ char sep2, char[] third) {
+ if (first == null)
+ return concat(second, third, sep2);
+ if (second == null)
+ return concat(first, third, sep1);
+ if (third == null)
+ return concat(first, second, sep1);
+
+ int length1 = first.length;
+ int length2 = second.length;
+ int length3 = third.length;
+ char[] result = new char[length1 + length2 + length3 + 2];
+ System.arraycopy(first, 0, result, 0, length1);
+ result[length1] = sep1;
+ System.arraycopy(second, 0, result, length1 + 1, length2);
+ result[length1 + length2 + 1] = sep2;
+ System.arraycopy(third, 0, result, length1 + length2 + 2, length3);
+ return result;
+ }
+
+ /**
+ * Answers a new array with prepending the prefix character and appending
+ * the suffix character at the end of the array. If array is null, it
+ * answers a new array containing the prefix and the suffix characters. <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * prefix = 'a'
+ * array = { 'b' }
+ * suffix = 'c'
+ * => result = { 'a', 'b' , 'c' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * prefix = 'a'
+ * array = null
+ * suffix = 'c'
+ * => result = { 'a', 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param prefix
+ * the prefix character
+ * @param array
+ * the array that is concanated with the prefix and suffix
+ * characters
+ * @param suffix
+ * the suffix character
+ * @return the new array
+ */
+ public static final char[] concat(char prefix, char[] array, char suffix) {
+ if (array == null)
+ return new char[] { prefix, suffix };
+
+ int length = array.length;
+ char[] result = new char[length + 2];
+ result[0] = prefix;
+ System.arraycopy(array, 0, result, 1, length);
+ result[length + 1] = suffix;
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the end. <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * name = { 'c' }
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' , '.', 'c' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * name = null
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param name
+ * the given name
+ * @param array
+ * the given array
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the
+ * end
+ */
+ public static final char[] concatWith(char[] name, char[][] array,
+ char separator) {
+ int nameLength = name == null ? 0 : name.length;
+ if (nameLength == 0)
+ return concatWith(array, separator);
+
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return name;
+
+ int size = nameLength;
+ int index = length;
+ while (--index >= 0)
+ if (array[index].length > 0)
+ size += array[index].length + 1;
+ char[] result = new char[size];
+ index = size;
+ for (int i = length - 1; i >= 0; i--) {
+ int subLength = array[i].length;
+ if (subLength > 0) {
+ index -= subLength;
+ System.arraycopy(array[i], 0, result, index, subLength);
+ result[--index] = separator;
+ }
+ }
+ System.arraycopy(name, 0, result, 0, nameLength);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the end. <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * name = { 'c' }
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' , '.', 'c' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * name = null
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param array
+ * the given array
+ * @param name
+ * the given name
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the
+ * end
+ */
+ public static final char[] concatWith(char[][] array, char[] name,
+ char separator) {
+ int nameLength = name == null ? 0 : name.length;
+ if (nameLength == 0)
+ return concatWith(array, separator);
+
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return name;
+
+ int size = nameLength;
+ int index = length;
+ while (--index >= 0)
+ if (array[index].length > 0)
+ size += array[index].length + 1;
+ char[] result = new char[size];
+ index = 0;
+ for (int i = 0; i < length; i++) {
+ int subLength = array[i].length;
+ if (subLength > 0) {
+ System.arraycopy(array[i], 0, result, index, subLength);
+ index += subLength;
+ result[index++] = separator;
+ }
+ }
+ System.arraycopy(name, 0, result, index, nameLength);
+ return result;
+ }
+
+ /**
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part. <br>
+ * <br>
+ * For example:<br>
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * array = { { 'a' }, { 'b' } }
+ * separator = '.'
+ * => result = { 'a', '.', 'b' }
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = null
+ * separator = '.'
+ * => result = { }
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param array
+ * the given array
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part
+ */
+ public static final char[] concatWith(char[][] array, char separator) {
+ int length = array == null ? 0 : array.length;
+ if (length == 0)
+ return CharOperation.NO_CHAR;
+
+ int size = length - 1;
+ int index = length;
+ while (--index >= 0) {
+ if (array[index].length == 0)
+ size--;
+ else
+ size += array[index].length;
+ }
+ if (size <= 0)
+ return CharOperation.NO_CHAR;
+ char[] result = new char[size];
+ index = length;
+ while (--index >= 0) {
+ length = array[index].length;
+ if (length > 0) {
+ System.arraycopy(array[index], 0, result, (size -= length),
+ length);
+ if (--size >= 0)
+ result[size] = separator;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of character, false
+ * otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * character = 'c'
+ * array = { { ' a' }, { ' b' } }
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * character = 'a'
+ * array = { { ' a' }, { ' b' } }
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param character
+ * the character to search
+ * @param array
+ * the array in which the search is done
+ * @return true if the array contains an occurrence of character, false
+ * otherwise.
+ * @throws NullPointerException
+ * if array is null.
+ */
+ public static final boolean contains(char character, char[][] array) {
+ for (int i = array.length; --i >= 0;) {
+ char[] subarray = array[i];
+ for (int j = subarray.length; --j >= 0;)
+ if (subarray[j] == character)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of character, false
+ * otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * character = 'c'
+ * array = { ' b' }
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * character = 'a'
+ * array = { ' a' , ' b' }
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param character
+ * the character to search
+ * @param array
+ * the array in which the search is done
+ * @return true if the array contains an occurrence of character, false
+ * otherwise.
+ * @throws NullPointerException
+ * if array is null.
+ */
+ public static final boolean contains(char character, char[] array) {
+ for (int i = array.length; --i >= 0;)
+ if (array[i] == character)
+ return true;
+ return false;
+ }
+
+ /**
+ * Answers true if the array contains an occurrence of one of the
+ * characters, false otherwise.
+ *
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * characters = { 'c', 'd' }
+ * array = { 'a', ' b' }
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * characters = { 'c', 'd' }
+ * array = { 'a', ' b', 'c' }
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param characters
+ * the characters to search
+ * @param array
+ * the array in which the search is done
+ * @return true if the array contains an occurrence of one of the
+ * characters, false otherwise.
+ * @throws NullPointerException
+ * if array is null.
+ *
+ */
+ public static final boolean contains(char[] characters, char[] array) {
+ for (int i = array.length; --i >= 0;)
+ for (int j = characters.length; --j >= 0;)
+ if (array[i] == characters[j])
+ return true;
+ return false;
+ }
+
+ /**
+ * Answers a deep copy of the toCopy array.
+ *
+ * @param toCopy
+ * the array to copy
+ * @return a deep copy of the toCopy array.
+ */
+
+ public static final char[][] deepCopy(char[][] toCopy) {
+ int toCopyLength = toCopy.length;
+ char[][] result = new char[toCopyLength][];
+ for (int i = 0; i < toCopyLength; i++) {
+ char[] toElement = toCopy[i];
+ int toElementLength = toElement.length;
+ char[] resultElement = new char[toElementLength];
+ System.arraycopy(toElement, 0, resultElement, 0, toElementLength);
+ result[i] = resultElement;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if array ends with the sequence of characters contained in
+ * toBeFound, otherwise false. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b', 'c', 'd' }
+ * toBeFound = { 'b', 'c' }
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * array = { 'a', 'b', 'c' }
+ * toBeFound = { 'b', 'c' }
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param array
+ * the array to check
+ * @param toBeFound
+ * the array to find
+ * @return true if array ends with the sequence of characters contained in
+ * toBeFound, otherwise false.
+ * @throws NullPointerException
+ * if array is null or toBeFound is null
+ */
+ public static final boolean endsWith(char[] array, char[] toBeFound) {
+ int i = toBeFound.length;
+ int j = array.length - i;
+
+ if (j < 0)
+ return false;
+ while (--i >= 0)
+ if (toBeFound[i] != array[i + j])
+ return false;
+ return true;
+ }
+
+ /**
+ * Answers true if the two arrays are identical character by character,
+ * otherwise false. The equality is case sensitive. <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li>
+ *
+ * <pre>
+ * first = null
+ * second = null
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { } }
+ * second = null
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { 'a' } }
+ * second = { { 'a' } }
+ * result => true
+ * </pre>
+ *
+ * </li>
+ * <li>
+ *
+ * <pre>
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * result => false
+ * </pre>
+ *
+ * </li>
+ * </ol>
+ *
+ * @param first
+ * the first array
+ * @param second
+ * the second array
+ * @return true if the two arrays are identical character by character,
+ * otherwise false
+ */
+ public static