This commit was manufactured by cvs2svn to create branch 'R3_2_5_patches'.
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/.project b/features/org.eclipse.jst.enterprise_core.feature.patch/.project
new file mode 100644
index 0000000..fa4494a
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.enterprise_core.feature.patch</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/features/org.eclipse.jst.enterprise_core.feature.patch/build.properties b/features/org.eclipse.jst.enterprise_core.feature.patch/build.properties
new file mode 100644
index 0000000..cb50260
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/build.properties
@@ -0,0 +1,5 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html,\
+ eclipse_update_120.jpg
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/buildnotes_org.eclipse.jst.enterprise_core.feature.patch.html b/features/org.eclipse.jst.enterprise_core.feature.patch/buildnotes_org.eclipse.jst.enterprise_core.feature.patch.html
new file mode 100644
index 0000000..e5f8898
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/buildnotes_org.eclipse.jst.enterprise_core.feature.patch.html
@@ -0,0 +1,38 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="Build" content="Build">
+<title>WTP 3.0.5 Patches</title>
+</head>
+
+<body>
+
+<h1>WTP 3.0.5 Patches</h1>
+
+<h2>org.eclipse.jst.enterprise_core.feature</h2>
+<p>Bug <a
+ href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=280624'>280624</a>.
+WebServicesManager's getAllWorkspaceServiceRefs should get the JEE 5 versions as well</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=291225'>291225</a>.
+Output folder support in JavaEE projects</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=292457'>292457</a>.
+EJB client project source and ouput should synch up with EJB project</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=299770'>299770</a>.
+Warning occurs on MessageDrivenBean creation due to .javajet template</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/313630'>313630</a>.
+V1 Validator extension point changes for performance</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/319735'>319735</a>.
+Unwanted newlines before display name value</p>
+<p>Bug <a
+ href='https://bugs.eclipse.org/346300'>346300</a>.
+Create EJB Client Jar action creates an empty project but with no source code or interfaces</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/eclipse_update_120.jpg b/features/org.eclipse.jst.enterprise_core.feature.patch/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/eclipse_update_120.jpg
Binary files differ
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/epl-v10.html b/features/org.eclipse.jst.enterprise_core.feature.patch/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/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/features/org.eclipse.jst.enterprise_core.feature.patch/feature.properties b/features/org.eclipse.jst.enterprise_core.feature.patch/feature.properties
new file mode 100644
index 0000000..45438bb
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/feature.properties
@@ -0,0 +1,153 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+# feature.properties
+# 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=WTP Patch for org.eclipse.jst.enterprise_core.feature
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse.org
+
+# "updateSiteName" property - label for the update site
+updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
+
+# "description" property - description of the feature
+description=\
+This patch feature fixes problems as described in following bugs:\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280624 WebServicesManager's getAllWorkspaceServiceRefs should get the JEE 5 versions as well\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=291225 Output folder support in JavaEE projects\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=292457 EJB client project source and ouput should synch up with EJB project\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=299770 Warning occurs on MessageDrivenBean creation due to .javajet template\n\
+Bug https://bugs.eclipse.org/313630 V1 Validator extension point changes for performance\n\
+Bug https://bugs.eclipse.org/319735 Unwanted newlines before display name value\n\
+Bug https://bugs.eclipse.org/346300 Create EJB Client Jar action creates an empty project but with no source code or interfaces\n\
+\n\
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2007 IBM Corporation 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\
+\n\
+Contributors:\n\
+ IBM Corporation - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "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\
+September 27, 2007\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 structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included 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\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories 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 EPL 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\
+\n\
+Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/feature.xml b/features/org.eclipse.jst.enterprise_core.feature.patch/feature.xml
new file mode 100644
index 0000000..0f21149
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/feature.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.jst.enterprise_core.feature.patch"
+ label="%featureName"
+ version="3.0.5.qualifier"
+ provider-name="%providerName">
+
+ <description>%description</description>
+
+ <copyright>%copyright</copyright>
+
+ <license url="%licenseURL">%license</license>
+
+
+ <requires>
+ <import feature="org.eclipse.jst.enterprise_core.feature" version="3.0.5.v200905070430-42E_5_kE77d9ICR7Z_H" patch="true"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.jst.j2ee.webservice"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.j2ee.ejb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.j2ee.jca"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+</feature>
diff --git a/features/org.eclipse.jst.enterprise_core.feature.patch/license.html b/features/org.eclipse.jst.enterprise_core.feature.patch/license.html
new file mode 100644
index 0000000..2347060
--- /dev/null
+++ b/features/org.eclipse.jst.enterprise_core.feature.patch/license.html
@@ -0,0 +1,93 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
+<!-- saved from url=(0044)http://www.eclipse.org/legal/epl/notice.html -->
+<HTML><HEAD><TITLE>Eclipse.org Software User Agreement</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<META content="MSHTML 6.00.2800.1479" name=GENERATOR></HEAD>
+<BODY lang=EN-US vLink=purple link=blue>
+<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>Plug-in and Fragment directories
+ <LI>Subdirectories of the directory named "src" of certain Plug-ins
+ <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>Apache Software License 1.1 (available at <A
+ href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</A>)
+
+ <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>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>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>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/features/org.eclipse.jst.web_ui.feature.patch/.cvsignore b/features/org.eclipse.jst.web_ui.feature.patch/.cvsignore
new file mode 100644
index 0000000..c14487c
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/.cvsignore
@@ -0,0 +1 @@
+build.xml
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/.project b/features/org.eclipse.jst.web_ui.feature.patch/.project
new file mode 100644
index 0000000..4603a67
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.web_ui.feature.patch</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/features/org.eclipse.jst.web_ui.feature.patch/build.properties b/features/org.eclipse.jst.web_ui.feature.patch/build.properties
new file mode 100644
index 0000000..82a5a4c
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html,\
+ eclipse_update_120.jpg,\
+ buildnotes_org.eclipse.jst.web_ui.feature.patch.html
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/buildnotes_org.eclipse.jst.web_ui.feature.patch.html b/features/org.eclipse.jst.web_ui.feature.patch/buildnotes_org.eclipse.jst.web_ui.feature.patch.html
new file mode 100644
index 0000000..9263678
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/buildnotes_org.eclipse.jst.web_ui.feature.patch.html
@@ -0,0 +1,20 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="Build" content="Build">
+<title>WTP 3.2.2 Patches</title>
+</head>
+
+<body>
+
+<h1>WTP 3.2.2 Patches</h1>
+
+<h2>org.eclipse.jst.web_ui.feature</h2>
+
+<p>Bug <a href='https://bugs.eclipse.org/326062'>326062</a>. No content assist in attribute-embedded scriptlets</p>
+<p>Bug <a href='https://bugs.eclipse.org/326602'>326602</a>. Auto activation does not work in javascript regions in webpages</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/eclipse_update_120.jpg b/features/org.eclipse.jst.web_ui.feature.patch/eclipse_update_120.jpg
new file mode 100644
index 0000000..bfdf708
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/eclipse_update_120.jpg
Binary files differ
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/epl-v10.html b/features/org.eclipse.jst.web_ui.feature.patch/epl-v10.html
new file mode 100644
index 0000000..abeecc4
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/epl-v10.html
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>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.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">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.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"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.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to 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.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+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.</p>
+
+<p class="list">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.</p>
+
+<p class="list">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.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">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;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">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.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>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.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>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.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>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.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+</body>
+
+</html>
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/feature.properties b/features/org.eclipse.jst.web_ui.feature.patch/feature.properties
new file mode 100644
index 0000000..ed38d16
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/feature.properties
@@ -0,0 +1,173 @@
+###############################################################################
+# Copyright (c) 2008 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+# feature.properties
+# 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=WTP Patches for org.eclipse.jst.web_ui.feature
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse Web Tools Platform
+
+# "updateSiteName" property - label for the update site
+updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
+
+# "description" property - description of the feature
+description=\
+This patch fixes problems described in the following bugs: \n\
+Bug https://bugs.eclipse.org/326062 No content assist in attribute-embedded scriptlets\n\
+Bug https://bugs.eclipse.org/326602 Auto activation does not work in javascript regions in webpages\n\
+\n\
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2010 IBM Corporation 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\
+\n\
+Contributors:\n\
+ IBM Corporation - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "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\
+April 14, 2010\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\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this 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 Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of 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\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories 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\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update 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" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL 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\
+ - 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\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\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, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/feature.xml b/features/org.eclipse.jst.web_ui.feature.patch/feature.xml
new file mode 100644
index 0000000..24d7205
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/feature.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.jst.web_ui.feature.patch"
+ label="%featureName"
+ version="3.2.2.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.jst.web_ui.feature" version="3.2.2.v201008170029-7F77FJSC25Tkdy1nqglPjqLAoDgh" patch="true"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.wst.jsdt.web.support.jsp"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.jst.jsp.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.jst.web_ui.feature.patch/license.html b/features/org.eclipse.jst.web_ui.feature.patch/license.html
new file mode 100644
index 0000000..c184ca3
--- /dev/null
+++ b/features/org.eclipse.jst.web_ui.feature.patch/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</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 Foundation source code
+ repository ("Repository") in software 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™ 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 Provisioning Technology (as defined below), 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>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>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<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>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
index c72de33..8373e00 100644
--- a/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.jst.j2ee.core; singleton:=true
-Bundle-Version: 1.2.6.qualifier
+Bundle-Version: 1.2.7.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.core.internal.plugin.J2EECorePlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.ui/.classpath b/plugins/org.eclipse.jst.j2ee.ui/.classpath
new file mode 100644
index 0000000..3dce472
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="j2ee_ui"/>
+ <classpathentry kind="src" path="property_files"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/.cvsignore b/plugins/org.eclipse.jst.j2ee.ui/.cvsignore
new file mode 100644
index 0000000..678089c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/.cvsignore
@@ -0,0 +1,8 @@
+bin
+doc
+temp.folder
+build.xml
+j2ee_ui.jar
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.jst.j2ee.ui/.project b/plugins/org.eclipse.jst.j2ee.ui/.project
new file mode 100644
index 0000000..937fa4b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.j2ee.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>
+ <nature>com.ibm.etools.ctc.javaprojectnature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..04a5d48
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Wed Jul 25 14:00:45 EDT 2007
+eclipse.preferences.version=1
+encoding//j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties=8859_1
diff --git a/plugins/org.eclipse.jst.servlet.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.jdt.core.prefs
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/.settings/org.eclipse.jdt.core.prefs
rename to plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.jdt.core.prefs
diff --git a/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..6cf9579
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Fri Apr 13 14:16:39 EDT 2007
+eclipse.preferences.version=1
+internal.default.compliance=default
diff --git a/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bf85ef4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,80 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.eclipse.jst.j2ee.ui; singleton:=true
+Bundle-Version: 1.1.406.qualifier
+Bundle-Activator: org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-Localization: plugin
+Export-Package: org.eclipse.jst.common.jdt.internal.integration.ui;x-internal:=true,
+ org.eclipse.jst.j2ee.internal;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.actions;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.classpathdep.ui,
+ org.eclipse.jst.j2ee.internal.client.actions;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.command;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.deployables;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.dialogs;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.ejb.provider;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.listeners;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.perspective;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.plugin;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.provider;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.ui;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.ui.util;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.war.ui.util;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.wizard;x-internal:=true,
+ org.eclipse.jst.j2ee.ui.archive,
+ org.eclipse.jst.j2ee.ui.archive.internal,
+ org.eclipse.jst.j2ee.ui.project.facet,
+ org.eclipse.jst.j2ee.ui.project.facet.appclient,
+ org.eclipse.jst.j2ee.internal.ui.preferences
+Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.common.frameworks.ui;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.ejb;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.jca;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.web;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.emf.edit.ui;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jem.workbench;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jem;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.wst.server.ui;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.wst.common.emf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.ltk.core.refactoring;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ltk.ui.refactoring;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.web;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.editors;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.workbench.texteditor;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.sse.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jst.common.annotations.controller;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.j2ee.ejb.annotation.model;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.wst.web.ui;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.ui.navigator.resources;bundle-version="[3.2.0,4.0.0)",
+ com.ibm.icu;bundle-version="3.8.1",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jst.jee;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.1,2.0.0)",
+ org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)",
+ org.eclipse.wst.common.modulecore.ui;bundle-version="1.0.0",
+ org.eclipse.jst.common.ui;bundle-version="1.0.0"
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.jst.servlet.ui/about.html b/plugins/org.eclipse.jst.j2ee.ui/about.html
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/about.html
rename to plugins/org.eclipse.jst.j2ee.ui/about.html
diff --git a/plugins/org.eclipse.jst.j2ee.ui/build.properties b/plugins/org.eclipse.jst.j2ee.ui/build.properties
new file mode 100644
index 0000000..c031d2c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+bin.includes = plugin.xml,\
+ icons/,\
+ plugin.properties,\
+ .,\
+ META-INF/,\
+ about.html
+jars.compile.order = .
+source.. = j2ee_ui/,\
+ property_files/
+output.. = bin/
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/20_cmpbean_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/20_cmpbean_obj.gif
new file mode 100644
index 0000000..023fe8d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/20_cmpbean_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/adown.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/adown.gif
new file mode 100644
index 0000000..91e708f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/adown.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/appclientgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/appclientgroup_obj.gif
new file mode 100644
index 0000000..2768428
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/appclientgroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/arrow_down.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/arrow_down.gif
new file mode 100644
index 0000000..3c455c9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/arrow_down.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/arrowp.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/arrowp.gif
new file mode 100644
index 0000000..a906320
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/arrowp.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left.gif
new file mode 100644
index 0000000..788e76d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left2.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left2.gif
new file mode 100644
index 0000000..3e31054
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_left2.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_right.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_right.gif
new file mode 100644
index 0000000..573b60f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/cascade_right.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/cmp.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/cmp.gif
new file mode 100644
index 0000000..20ed1f9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/cmp.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/connectorgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/connectorgroup_obj.gif
new file mode 100644
index 0000000..ad3af3c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/connectorgroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/deadend.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/deadend.gif
new file mode 100644
index 0000000..5df6193
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/deadend.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-banner.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-banner.gif
new file mode 100644
index 0000000..625e763
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-banner.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-icon.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-icon.gif
new file mode 100644
index 0000000..8b409b5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/ear-wiz-icon.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/ear.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/ear.gif
new file mode 100644
index 0000000..f52fa97
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/ear.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/eargroup_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/eargroup_obj.gif
new file mode 100644
index 0000000..2eeb3ef
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/eargroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/ejbgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/ejbgroup_obj.gif
new file mode 100644
index 0000000..b0adb3e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/ejbgroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/folder.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/folder.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/folder.gif
rename to plugins/org.eclipse.jst.j2ee.ui/icons/folder.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_client_remove_action_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_client_remove_action_obj.gif
new file mode 100644
index 0000000..1823211
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_client_remove_action_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_deploy_action_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_deploy_action_obj.gif
new file mode 100644
index 0000000..db8945f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/clcl16/ejb_deploy_action_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_export.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_export.gif
new file mode 100644
index 0000000..6f83300
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_export.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_import_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_import_wiz.gif
new file mode 100644
index 0000000..ce667f4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/appclient_import_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/ejbclientjar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/ejbclientjar_wiz.gif
new file mode 100644
index 0000000..6e65e7d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/ejbclientjar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ear.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ear.gif
new file mode 100644
index 0000000..2270b17
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ear.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ejbjar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ejbjar_wiz.gif
new file mode 100644
index 0000000..72cd417
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_ejbjar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_rar.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_rar.gif
new file mode 100644
index 0000000..befb3d4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/export_rar.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/exportwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/exportwar_wiz.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/exportwar_wiz.gif
rename to plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/exportwar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ear.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ear.gif
new file mode 100644
index 0000000..099201b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ear.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ejbjar.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ejbjar.gif
new file mode 100644
index 0000000..5644b48
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_ejbjar.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_rar.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_rar.gif
new file mode 100644
index 0000000..50f25a2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/import_rar.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/importwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/importwar_wiz.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/importwar_wiz.gif
rename to plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/importwar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newappclient_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newappclient_wiz.gif
new file mode 100644
index 0000000..0ce86a1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newappclient_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newconnectionprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newconnectionprj_wiz.gif
new file mode 100644
index 0000000..1bec6ba
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newconnectionprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newear_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newear_wiz.gif
new file mode 100644
index 0000000..8b409b5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newear_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newejbprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newejbprj_wiz.gif
new file mode 100644
index 0000000..ecda22b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newejbprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newwar_wiz.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newwar_wiz.gif
rename to plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/newwar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/re_execute.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/re_execute.gif
new file mode 100644
index 0000000..8f943a8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ctool16/re_execute.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_perspective.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_perspective.gif
new file mode 100644
index 0000000..20acd4c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_perspective.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_view.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_view.gif
new file mode 100644
index 0000000..20acd4c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/cview16/j2ee_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_client_remove_action_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_client_remove_action_obj.gif
new file mode 100644
index 0000000..928a0bf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_client_remove_action_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_deploy_action_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_deploy_action_obj.gif
new file mode 100644
index 0000000..9657388
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/dlcl16/ejb_deploy_action_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/13_ear_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/13_ear_obj.gif
new file mode 100644
index 0000000..54b9b17
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/13_ear_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_cmpbean_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_cmpbean_obj.gif
new file mode 100644
index 0000000..35835bc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_cmpbean_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejb_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejb_obj.gif
new file mode 100644
index 0000000..673ba6a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejb_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejbjar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejbjar_wiz.gif
new file mode 100644
index 0000000..9dae052
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/21_ejbjar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/annotation_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/annotation_positioned_overlay.gif
new file mode 100644
index 0000000..cec1d2d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/annotation_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14.gif
new file mode 100644
index 0000000..b248380
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14_deploy.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14_deploy.gif
new file mode 100644
index 0000000..b0d08af
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/appclient_14_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/extwebserviceitemprovider_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/extwebserviceitemprovider_obj.gif
new file mode 100644
index 0000000..f4cc6e3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/extwebserviceitemprovider_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/home_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/home_interface_positioned_overlay.gif
new file mode 100644
index 0000000..91a756a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/home_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/library_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/library_obj.gif
new file mode 100644
index 0000000..cb55e33
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/library_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_home_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_home_interface_positioned_overlay.gif
new file mode 100644
index 0000000..e5d6090
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_home_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_interface_positioned_overlay.gif
new file mode 100644
index 0000000..156febe
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/local_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/remote_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/remote_interface_positioned_overlay.gif
new file mode 100644
index 0000000..203e398
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/remote_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/service_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/service_interface_positioned_overlay.gif
new file mode 100644
index 0000000..6146667
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/service_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServiceItemProvider_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServiceItemProvider_obj.gif
new file mode 100644
index 0000000..8fb844f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServiceItemProvider_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServicesFolder_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServicesFolder_obj.gif
new file mode 100644
index 0000000..ab3039c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webServicesFolder_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_14.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_14.gif
new file mode 100644
index 0000000..83f9165
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_14.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_deploy.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_deploy.gif
new file mode 100644
index 0000000..80531e3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/obj16/webapp_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_bean_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_bean_overlay.gif
new file mode 100644
index 0000000..f277755
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_bean_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_positioned_overlay.gif
new file mode 100644
index 0000000..cec1d2d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/annotation_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/client_app_ovr.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/client_app_ovr.gif
new file mode 100644
index 0000000..3ff1ca5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/client_app_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/connector_ovr.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/connector_ovr.gif
new file mode 100644
index 0000000..b7e77bc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/connector_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/dis_annotation_bean_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/dis_annotation_bean_overlay.gif
new file mode 100644
index 0000000..dac498a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/dis_annotation_bean_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/ejb_module_ovr.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/ejb_module_ovr.gif
new file mode 100644
index 0000000..cf50d6d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/ejb_module_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/enterprise_app_ovr.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/enterprise_app_ovr.gif
new file mode 100644
index 0000000..ec19c47
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/enterprise_app_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/externalWebServiceOverlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/externalWebServiceOverlay_obj.gif
new file mode 100644
index 0000000..daff412
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/externalWebServiceOverlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_overlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_overlay_obj.gif
new file mode 100644
index 0000000..48380fc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_overlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_positioned_overlay.gif
new file mode 100644
index 0000000..91a756a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/home_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/key_interf_ov.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/key_interf_ov.gif
new file mode 100644
index 0000000..3070440
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/key_interf_ov.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_overlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_overlay_obj.gif
new file mode 100644
index 0000000..d782734
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_overlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_positioned_overlay.gif
new file mode 100644
index 0000000..e5d6090
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_home_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_overlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_overlay_obj.gif
new file mode 100644
index 0000000..43e1655
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_overlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_positioned_overlay.gif
new file mode 100644
index 0000000..156febe
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/local_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_overlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_overlay_obj.gif
new file mode 100644
index 0000000..19c9cae
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_overlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_positioned_overlay.gif
new file mode 100644
index 0000000..203e398
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/remote_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_overlay_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_overlay_obj.gif
new file mode 100644
index 0000000..93f0679
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_overlay_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_positioned_overlay.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_positioned_overlay.gif
new file mode 100644
index 0000000..6146667
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/service_interface_positioned_overlay.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/web_module_ovr.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/web_module_ovr.gif
new file mode 100644
index 0000000..c1e9617
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/ovr16/web_module_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_mess_dest_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_mess_dest_wiz_ban.gif
new file mode 100644
index 0000000..f9941ce
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_mess_dest_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_web_service_handler_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_web_service_handler_wiz.gif
new file mode 100644
index 0000000..e1fa98a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/add_web_service_handler_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addauthoritycontraints_wiz_.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addauthoritycontraints_wiz_.gif
new file mode 100644
index 0000000..2ec0ffb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addauthoritycontraints_wiz_.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcmpfiled_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcmpfiled_wiz_ban.gif
new file mode 100644
index 0000000..879329e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcmpfiled_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcontextparameter_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcontextparameter_wiz_ban.gif
new file mode 100644
index 0000000..6457e12
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addcontextparameter_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addenvirentry_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addenvirentry_wiz_ban.gif
new file mode 100644
index 0000000..653ab02
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addenvirentry_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/adderrorcodeerror_wiz_ban.g.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/adderrorcodeerror_wiz_ban.g.gif
new file mode 100644
index 0000000..2eb9efe
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/adderrorcodeerror_wiz_ban.g.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addexceptionerrorpage_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addexceptionerrorpage_wiz_ban.gif
new file mode 100644
index 0000000..e12d2ac
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addexceptionerrorpage_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addfiltermapping_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addfiltermapping_wiz_ban.gif
new file mode 100644
index 0000000..5b53010
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addfiltermapping_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addhandlersoapheader_wiz_ba.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addhandlersoapheader_wiz_ba.gif
new file mode 100644
index 0000000..189c3e9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addhandlersoapheader_wiz_ba.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addjsppropgropu_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addjsppropgropu_wiz_ban.gif
new file mode 100644
index 0000000..624fe7f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addjsppropgropu_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addlocencodingmap_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addlocencodingmap_wiz_ban.gif
new file mode 100644
index 0000000..46e3e08
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addlocencodingmap_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addmimemapping_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addmimemapping_wiz_ban.gif
new file mode 100644
index 0000000..bb856a4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addmimemapping_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addservletmapping_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addservletmapping_wiz_ban.gif
new file mode 100644
index 0000000..2820c5a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addservletmapping_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addtaglibref_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addtaglibref_wiz_ban.gif
new file mode 100644
index 0000000..d238b56
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addtaglibref_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebSecuritycontraint_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebSecuritycontraint_wiz.gif
new file mode 100644
index 0000000..fc97d84
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebSecuritycontraint_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebrescollection_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebrescollection_wiz_ban.gif
new file mode 100644
index 0000000..7dfe6e9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebrescollection_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebsecurityroleref_wiz_b.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebsecurityroleref_wiz_b.gif
new file mode 100644
index 0000000..aab4b50
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwebsecurityroleref_wiz_b.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwelcomepage_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwelcomepage_wiz_ban.gif
new file mode 100644
index 0000000..e0f50cc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/addwelcomepage_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/appclient_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/appclient_wiz.gif
new file mode 100644
index 0000000..56d7fa7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/appclient_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connection_migration_wizard_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connection_migration_wizard_wiz.gif
new file mode 100644
index 0000000..e9ecba5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connection_migration_wizard_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connector_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connector_wiz.gif
new file mode 100644
index 0000000..231f8d3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/connector_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ear_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ear_wiz.gif
new file mode 100644
index 0000000..625e763
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ear_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbclientjar_wizban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbclientjar_wizban.gif
new file mode 100644
index 0000000..231da61
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbclientjar_wizban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbproject_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbproject_wiz.gif
new file mode 100644
index 0000000..7f2aa1e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/ejbproject_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_appclient_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_appclient_wiz.gif
new file mode 100644
index 0000000..3515396
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_appclient_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ear_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ear_wiz.gif
new file mode 100644
index 0000000..a327fa6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ear_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ejbjar_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ejbjar_obj.gif
new file mode 100644
index 0000000..adca79e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_ejbjar_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_rar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_rar_wiz.gif
new file mode 100644
index 0000000..6047f1a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_rar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_war_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_war_wiz.gif
new file mode 100644
index 0000000..d251242
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/export_war_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_appclient_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_appclient_wiz.gif
new file mode 100644
index 0000000..351a31d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_appclient_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_class_file_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_class_file_wiz_ban.gif
new file mode 100644
index 0000000..81b1e3f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_class_file_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ear_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ear_wiz.gif
new file mode 100644
index 0000000..67754de
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ear_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ejbjar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ejbjar_wiz.gif
new file mode 100644
index 0000000..d123519
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_ejbjar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_rar_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_rar_wiz.gif
new file mode 100644
index 0000000..ea9dff4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_rar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_war_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_war_wiz.gif
new file mode 100644
index 0000000..514274d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/import_war_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/init_param_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/init_param_wiz_ban.gif
new file mode 100644
index 0000000..3fb6df4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/init_param_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_jms_creation_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_jms_creation_wiz.gif
new file mode 100644
index 0000000..51b1d5a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_jms_creation_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_non_jms_creation_wi.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_non_jms_creation_wi.gif
new file mode 100644
index 0000000..51b1d5a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/mdb_2_1_non_jms_creation_wi.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/newservlet_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/newservlet_wiz.gif
new file mode 100644
index 0000000..147e57a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/newservlet_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/versionmigrate3_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/versionmigrate3_wiz.gif
new file mode 100644
index 0000000..9b72bf5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/versionmigrate3_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/war_wiz.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/war_wiz.gif
new file mode 100644
index 0000000..d964e2e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/war_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/web_library_project_wiz_ban.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/web_library_project_wiz_ban.gif
new file mode 100644
index 0000000..767a416
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/full/wizban/web_library_project_wiz_ban.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/jar_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/jar_obj.gif
new file mode 100644
index 0000000..ec315d5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/jar_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/jcu_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/jcu_obj.gif
new file mode 100644
index 0000000..36a73ac
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/jcu_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/key_interf_ov.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/key_interf_ov.gif
new file mode 100644
index 0000000..3070440
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/key_interf_ov.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/left_arrow.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/left_arrow.gif
new file mode 100644
index 0000000..3bc3831
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/left_arrow.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/prj_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/prj_obj.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/prj_obj.gif
rename to plugins/org.eclipse.jst.j2ee.ui/icons/prj_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/right_arrow.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/right_arrow.gif
new file mode 100644
index 0000000..d03e351
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/right_arrow.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/servlet.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/servlet.gif
new file mode 100644
index 0000000..fc1bece
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/servlet.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/sessionBean_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/sessionBean_obj.gif
new file mode 100644
index 0000000..507b8a8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/sessionBean_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/showerr_tsk.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/showerr_tsk.gif
new file mode 100644
index 0000000..0bc6068
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/showerr_tsk.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/showwarn_tsk.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/showwarn_tsk.gif
new file mode 100644
index 0000000..14009e9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/showwarn_tsk.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/srvce_elem_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/srvce_elem_obj.gif
new file mode 100644
index 0000000..6fdcb3f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/srvce_elem_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-banner.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-banner.gif
new file mode 100644
index 0000000..9b93c9a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-banner.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-icon.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-icon.gif
new file mode 100644
index 0000000..2038b22
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/util-wiz-icon.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/webgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/webgroup_obj.gif
new file mode 100644
index 0000000..274d361
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/webgroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/webservicedesc.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/webservicedesc.gif
new file mode 100644
index 0000000..8fb844f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/webservicedesc.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/icons/wsdl.gif b/plugins/org.eclipse.jst.j2ee.ui/icons/wsdl.gif
new file mode 100644
index 0000000..8fb844f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/icons/wsdl.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/WTPUIWorkingCopyManager.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/WTPUIWorkingCopyManager.java
new file mode 100644
index 0000000..1b909a2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/common/jdt/internal/integration/ui/WTPUIWorkingCopyManager.java
@@ -0,0 +1,484 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.common.jdt.internal.integration.ui;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.javaeditor.ICompilationUnitDocumentProvider;
+import org.eclipse.jdt.internal.ui.javaeditor.InternalClassFileEditorInput;
+import org.eclipse.jdt.ui.IWorkingCopyManager;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jst.common.jdt.internal.integration.WTPWorkingCopyManager;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.wst.common.frameworks.internal.SaveFailedException;
+
+/**
+ * Insert the type's description here. Creation date: (4/25/2001 7:05:36 PM)
+ *
+ * @author: Administrator
+ */
+public class WTPUIWorkingCopyManager extends WTPWorkingCopyManager {
+ private IWorkingCopyManager javaWorkingCopyManager;
+ private ICompilationUnitDocumentProvider cuDocumentProvider;
+ private HashMap editorInputs;
+ private CoreException lastError;
+
+ /**
+ * WTPUIWorkingCopyManager constructor comment.
+ */
+ public WTPUIWorkingCopyManager() {
+ super();
+ cuDocumentProvider = JavaPlugin.getDefault().getCompilationUnitDocumentProvider();
+ javaWorkingCopyManager = JavaUI.getWorkingCopyManager();
+ }
+
+ protected void syncConnect(final IEditorInput input, final ICompilationUnit cu) throws CoreException {
+ Display d = Display.getCurrent();
+ if (d != null) {
+ lastError = null;
+ d.syncExec(new Runnable() {
+ public void run() {
+ try {
+ connect(input, cu);
+ } catch (CoreException e) {
+ lastError = e;
+ }
+ }
+ });
+ } else
+ connect(input, cu);
+ if (lastError != null)
+ throw lastError;
+ }
+
+ /**
+ * Connect the CompilationUnitDocumentProvider to the
+ *
+ * @input and connect the annotation model from the provider to the IDocument of the
+ * @input.
+ */
+ protected void connect(IEditorInput input, ICompilationUnit cu) throws CoreException {
+ if (input != null && javaWorkingCopyManager != null && cuDocumentProvider != null ) {
+ javaWorkingCopyManager.connect(input);
+ getEditorInputs().put(cu, input);
+ IDocument doc = cuDocumentProvider.getDocument(input);
+ if (doc != null && cuDocumentProvider.getAnnotationModel(input)!= null)
+ cuDocumentProvider.getAnnotationModel(input).connect(doc);
+ }
+ }
+
+ protected void revertWorkingCopies() {
+ if (getEditorInputs().isEmpty())
+ return;
+ Iterator it = getEditorInputs().values().iterator();
+ IEditorInput input;
+ while (it.hasNext()) {
+ input = (IEditorInput) it.next();
+ revert(input);
+ }
+ }
+
+ /**
+ * Disonnect the CompilationUnitDocumentProvider from the
+ *
+ * @input and disconnect the annotation model from the provider from the IDocument of the
+ * @input.
+ */
+ protected void disconnect(IEditorInput input) {
+ IDocument doc = cuDocumentProvider.getDocument(input);
+ cuDocumentProvider.getAnnotationModel(input).disconnect(doc);
+ javaWorkingCopyManager.disconnect(input);
+ }
+
+ protected void revert(IEditorInput input) {
+ try {
+ cuDocumentProvider.resetDocument(input);
+ } catch (CoreException e) {
+ Logger.getLogger().logError(e);
+ }
+ IDocument doc = cuDocumentProvider.getDocument(input);
+ IAnnotationModel model = cuDocumentProvider.getAnnotationModel(input);
+
+ if (model instanceof AbstractMarkerAnnotationModel) {
+ AbstractMarkerAnnotationModel markerModel = (AbstractMarkerAnnotationModel) model;
+ markerModel.resetMarkers();
+ }
+ model.disconnect(doc);
+ javaWorkingCopyManager.disconnect(input);
+ }
+
+ protected void disconnectEditorInputs() {
+ Iterator it = getEditorInputs().values().iterator();
+ IEditorInput input;
+ while (it.hasNext()) {
+ input = (IEditorInput) it.next();
+ disconnect(input);
+ }
+ }
+
+ protected void discardExistingCompilationUnits() {
+ if (getEditorInputs().isEmpty())
+ return;
+ Iterator it = getEditorInputs().values().iterator();
+ IEditorInput input;
+ while (it.hasNext()) {
+ input = (IEditorInput) it.next();
+ disconnect(input);
+ }
+ }
+
+ @Override
+ public Set getAffectedFiles() {
+ Set aSet = new HashSet();
+ Iterator it = getEditorInputs().keySet().iterator();
+ ICompilationUnit unit = null;
+ IResource resource = null;
+ while (it.hasNext()) {
+ unit = (ICompilationUnit) it.next();
+ if (isDirty(unit)) {
+ try {
+ resource = unit.getUnderlyingResource();
+ } catch (JavaModelException ignore) {
+ continue;
+ }
+ if (resource instanceof IFile)
+ aSet.add(resource);
+ }
+ }
+ return aSet;
+ }
+
+ protected IEditorInput getEditorInput(ICompilationUnit cu) {
+ IEditorInput input = primGetEditorInput(cu);
+ if (input == null) {
+ try {
+ input = getEditorInput((IJavaElement) cu);
+ } catch (JavaModelException e) {
+ //Ignore
+ }
+ }
+ return input;
+ }
+
+ protected IEditorInput getEditorInput(IJavaElement element) throws JavaModelException {
+ IJavaElement localElement = element;
+ while (localElement != null) {
+ switch (localElement.getElementType()) {
+ case IJavaElement.COMPILATION_UNIT : {
+ ICompilationUnit cu = (ICompilationUnit) localElement;
+ if (cu.isWorkingCopy())
+ cu = cu.getPrimary();
+ IResource resource = cu.getUnderlyingResource();
+ if (resource.getType() == IResource.FILE)
+ return new FileEditorInput((IFile) resource);
+ break;
+ }
+ case IJavaElement.CLASS_FILE :
+ return new InternalClassFileEditorInput((IClassFile) localElement);
+ }
+ localElement = localElement.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (4/25/2001 7:30:20 PM)
+ *
+ * @return java.util.HashMap
+ */
+ protected java.util.HashMap getEditorInputs() {
+ if (editorInputs == null)
+ editorInputs = new HashMap(20);
+ return editorInputs;
+ }
+
+ /**
+ * Returns the working copy remembered for the compilation unit encoded in the given editor
+ * input. Does not connect the edit model to the working copy.
+ *
+ * @param input
+ * ICompilationUnit
+ * @return the working copy of the compilation unit, or <code>null</code> if the input does
+ * not encode an editor input, or if there is no remembered working copy for this
+ * compilation unit
+ */
+ @Override
+ public org.eclipse.jdt.core.ICompilationUnit getExistingWorkingCopy(ICompilationUnit cu) throws CoreException {
+ if (cu == null || cu.isWorkingCopy()) {
+ return cu;
+ }
+ ICompilationUnit newCU = super.getExistingWorkingCopy(cu);
+ if (newCU != null)
+ return newCU;
+ IEditorInput editorInput = getEditorInput(cu);
+ return javaWorkingCopyManager.getWorkingCopy(editorInput);
+ }
+
+ /**
+ * Returns the working copy remembered for the compilation unit.
+ *
+ * @param input
+ * ICompilationUnit
+ * @return the working copy of the compilation unit, or <code>null</code> if there is no
+ * remembered working copy for this compilation unit
+ */
+ @Override
+ public org.eclipse.jdt.core.ICompilationUnit getWorkingCopy(ICompilationUnit cu, boolean forNewCU) throws org.eclipse.core.runtime.CoreException {
+ if (forNewCU)
+ return super.getWorkingCopy(cu, forNewCU);
+ return primGetWorkingCopy(cu);
+ }
+
+ public boolean isDirty(ICompilationUnit cu) {
+ if (cu == null)
+ return false;
+ IDocumentProvider p = cuDocumentProvider;
+ return p == null ? false : p.canSaveDocument(getEditorInput(cu));
+ }
+
+ /**
+ * mustSaveDocument method comment.
+ */
+ public boolean isSaveNeeded() {
+ Iterator it = getEditorInputs().entrySet().iterator();
+ while (it.hasNext()) {
+ if (cuDocumentProvider.mustSaveDocument(it.next()))
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void primDispose() {
+ super.primDispose();
+ discardExistingCompilationUnits();
+ editorInputs = null;
+ javaWorkingCopyManager = null;
+ }
+
+ @Override
+ protected void primRevert() {
+ super.primRevert();
+ revertWorkingCopies();
+ editorInputs = null;
+ javaWorkingCopyManager = null;
+ }
+
+ protected IEditorInput primGetEditorInput(ICompilationUnit cu) {
+ return (IEditorInput) getEditorInputs().get(cu);
+ }
+
+ /**
+ * Returns the working copy remembered for the compilation unit encoded in the given editor
+ * input.
+ *
+ * @param input
+ * ICompilationUnit
+ * @return the working copy of the compilation unit, or <code>null</code> if the input does
+ * not encode an editor input, or if there is no remembered working copy for this
+ * compilation unit
+ */
+ @Override
+ protected org.eclipse.jdt.core.ICompilationUnit primGetWorkingCopy(ICompilationUnit cu) throws CoreException {
+ if (cu == null) {
+ return cu;
+ }
+ ICompilationUnit primary = cu.getPrimary();
+ ICompilationUnit newCU = getNewCompilationUnitWorkingCopy(primary);
+ if (newCU != null)
+ return newCU;
+ IEditorInput editorInput = primGetEditorInput(primary);
+ if (editorInput == null) {
+ editorInput = getEditorInput(cu);
+ syncConnect(editorInput, cu);
+ }
+ if (cu.isWorkingCopy())
+ return cu;
+ return javaWorkingCopyManager.getWorkingCopy(editorInput);
+ }
+
+ /**
+ * This will save all of the referenced CompilationUnits to be saved.
+ */
+ @Override
+ protected void primSaveCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ super.primSaveCompilationUnits(null);
+ saveExistingCompilationUnits(monitor);
+ }
+
+ protected void primSaveDocument(IEditorInput input, IDocument doc, IProgressMonitor monitor) throws CoreException {
+ try {
+ cuDocumentProvider.saveDocument(monitor, input, doc, true); // overwrite if needed
+ } catch (CoreException ex) {
+ if (!isFailedWriteFileFailure(ex))
+ throw ex;
+ IResource resource = (IResource) input.getAdapter(IRESOURCE_CLASS);
+ if (resource == null || resource.getType() != IResource.FILE || !resource.getResourceAttributes().isReadOnly())
+ throw ex;
+
+ if (getSaveHandler().shouldContinueAndMakeFileEditable((IFile) resource))
+ cuDocumentProvider.saveDocument(monitor, input, doc, false);
+ else
+ throw ex;
+ }
+ }
+
+ protected void saveDocument(IEditorInput input, IProgressMonitor monitor) {
+ IDocument doc = cuDocumentProvider.getDocument(input);
+ boolean canSave = cuDocumentProvider.canSaveDocument(input);
+ try {
+ if (canSave) {
+ ICompilationUnit unit = javaWorkingCopyManager.getWorkingCopy(input);
+ synchronized (unit) {
+ cuDocumentProvider.aboutToChange(input);
+ primSaveDocument(input, doc, monitor);
+ }
+ }
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ throw new SaveFailedException(e);
+ } finally {
+ if (canSave)
+ cuDocumentProvider.changed(input);
+ }
+ }
+
+ /**
+ * This will save all of the referenced CompilationUnits to be saved.
+ */
+ protected void saveExistingCompilationUnits(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ if (getEditorInputs().isEmpty())
+ return;
+ if (!validateState()) {
+ if (monitor != null)
+ monitor.setCanceled(true);
+ return;
+ }
+ Iterator it = getEditorInputs().entrySet().iterator();
+ Map.Entry entry;
+ // ICompilationUnit cu;
+ IEditorInput input;
+ try {
+ while (it.hasNext()) {
+ entry = (Map.Entry) it.next();
+ // cu = (ICompilationUnit) entry.getKey();
+ input = (IEditorInput) entry.getValue();
+ try {
+ saveDocument(input, null);
+ } finally {
+ disconnect(input);
+ }
+ }
+ } finally {
+ getEditorInputs().clear();
+ }
+ }
+
+ /**
+ * Call validateEdit for all read only IFiles corresponding to each WorkingCopy.
+ *
+ * @return boolean
+ */
+ private boolean validateState() {
+ List readOnlyFiles = getReadOnlyModifiedFiles();
+ if (readOnlyFiles != null && !readOnlyFiles.isEmpty()) {
+ IFile[] files = new IFile[readOnlyFiles.size()];
+ readOnlyFiles.toArray(files);
+ IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ Object ctx = win == null ? null : win.getShell();
+ IStatus status = ResourcesPlugin.getWorkspace().validateEdit(files, ctx);
+ return status.isOK();
+ }
+ return true;
+ }
+
+ private List getReadOnlyModifiedFiles() {
+ List readOnlyFiles = null;
+ IFile readOnlyFile = null;
+ Iterator it = getEditorInputs().entrySet().iterator();
+ Map.Entry entry;
+ // ICompilationUnit cu;
+ IEditorInput input;
+ IDocumentProvider docProv = cuDocumentProvider;
+ while (it.hasNext()) {
+ readOnlyFile = null;
+ entry = (Map.Entry) it.next();
+ // cu = (ICompilationUnit) entry.getKey();
+ input = (IEditorInput) entry.getValue();
+ if (docProv.canSaveDocument(input))
+ readOnlyFile = getReadOnlyFile(input);
+ if (readOnlyFile != null) {
+ if (readOnlyFiles == null)
+ readOnlyFiles = new ArrayList();
+ readOnlyFiles.add(readOnlyFile);
+ }
+ }
+ return readOnlyFiles;
+ }
+
+ private IFile getReadOnlyFile(IEditorInput input) {
+ if (input instanceof IFileEditorInput) {
+ IFileEditorInput finput = (IFileEditorInput) input;
+ IFile file = finput.getFile();
+ if (file.isReadOnly())
+ return file;
+ }
+ return null;
+ }
+
+
+ @Override
+ protected void addDeletedCompilationUnit(ICompilationUnit cu) {
+ IEditorInput input = primGetEditorInput(cu);
+ if (input != null)
+ disconnect(input);
+ getEditorInputs().remove(cu);
+ super.addDeletedCompilationUnit(cu);
+ }
+
+ /**
+ * @see com.ibm.etools.j2ee.workbench.IJ2EEWorkingCopyManager#hasWorkingCopies()
+ */
+ @Override
+ public boolean hasWorkingCopies() {
+ return super.hasWorkingCopies() || (editorInputs != null && !editorInputs.isEmpty());
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java
new file mode 100644
index 0000000..42b92c1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java
@@ -0,0 +1,1282 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ * Stefan Dimov, stefan.dimov@sap.com - bugs 207826, 222651
+ * Milen Manov, milen.manov@sap.com - bugs 248623
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.dialogs.ChangeLibDirDialog;
+import org.eclipse.jst.j2ee.internal.dialogs.DependencyConflictResolveDialog;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.ui.DoubleCheckboxTableItem;
+import org.eclipse.jst.j2ee.internal.ui.DoubleCheckboxTableViewer;
+import org.eclipse.jst.j2ee.model.IEARModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.EarFacetRuntimeHandler;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
+import org.eclipse.jst.javaee.application.Application;
+import org.eclipse.jst.jee.project.facet.EarCreateDeploymentFilesDataModelProvider;
+import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * @deprecated wtp 3.2
+ */
+public class AddModulestoEARPropertiesPage implements IJ2EEDependenciesControl, Listener {
+
+ protected final String PATH_SEPARATOR = AvailableJ2EEComponentsForEARContentProvider.PATH_SEPARATOR;
+ protected final IProject project;
+ protected final J2EEDependenciesPage propPage;
+ protected IVirtualComponent earComponent = null;
+ protected Text componentNameText;
+ protected Label availableModules;
+ protected CheckboxTableViewer availableComponentsViewer;
+ protected Button selectAllButton;
+ protected Button deselectAllButton;
+ protected Button projectJarButton;
+ protected Button externalJarButton;
+ protected Button addVariableButton;
+ protected Button changeLibPathButton;
+ protected Composite buttonColumn;
+
+ protected String libDir = null;
+ protected String oldLibDir;
+ protected List j2eeComponentList = new ArrayList();
+ protected List javaProjectsList = new ArrayList();
+ protected List j2eeLibElementList = new ArrayList();
+ protected List javaLibProjectsList = new ArrayList();
+ protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
+ protected boolean isVersion5;
+ protected Set libsToUncheck;
+ protected Listener tableListener;
+ protected Listener labelListener;
+
+ //[Bug 238264] the cached list of jars selected using 'add jar' or 'add external jars'
+ protected List<IVirtualComponent> addedJARComponents = new ArrayList<IVirtualComponent>();
+
+
+ /**
+ * Constructor for AddModulestoEARPropertiesControl.
+ */
+ public AddModulestoEARPropertiesPage(final IProject project, final J2EEDependenciesPage page) {
+ this.project = project;
+ this.propPage = page;
+ earComponent = ComponentCore.createComponent(project);
+ boolean hasEE5Facet = false;
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if(facetedProject != null){
+ IProjectFacetVersion facetVersion = facetedProject.getProjectFacetVersion(EarUtilities.ENTERPRISE_APPLICATION_FACET);
+ //EE6TODO
+ if(facetVersion.equals(EarUtilities.ENTERPRISE_APPLICATION_50)){
+ hasEE5Facet = true;
+ }
+ }
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ //EE6TODO
+ if(hasEE5Facet){
+ String earDDVersion = JavaEEProjectUtilities.getJ2EEDDProjectVersion(project);
+ if (earDDVersion.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) {
+ isVersion5 = true;
+ Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ if (app != null)
+ oldLibDir = app.getLibraryDirectory();
+ if (oldLibDir == null) oldLibDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ libDir = oldLibDir;
+ }
+ }
+ libsToUncheck = new HashSet();
+ }
+
+ public Composite createContents(final Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ J2EEDependenciesPage.createDescriptionComposite(composite, ManifestUIResourceHandler.EAR_Modules_Desc);
+ createListGroup(composite);
+ refresh();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ protected void createListGroup(Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ listGroup.setLayout(layout);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalIndent = 5;
+ listGroup.setLayoutData(gData);
+
+ availableModules = new Label(listGroup, SWT.NONE);
+ gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ availableModules.setText(J2EEUIMessages.getResourceString("AVAILABLE_J2EE_COMPONENTS")); //$NON-NLS-1$ = "Available dependent JARs:"
+ availableModules.setLayoutData(gData);
+ createTableComposite(listGroup);
+ }
+
+ public boolean performOk() {
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ if (isVersion5) {
+ if (libDir.length() == 0) {
+
+ MessageDialog dlg = new MessageDialog(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR),
+ null, J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR_WARN_QUESTION),
+ MessageDialog.QUESTION, new String[] {J2EEUIMessages.YES_BUTTON,
+ J2EEUIMessages.NO_BUTTON,
+ J2EEUIMessages.CANCEL_BUTTON}, 1);
+ switch (dlg.open()) {
+ case 0: break;
+ case 1: {
+ handleChangeLibDirButton(false);
+ return false;
+ }
+ case 2: return false;
+ default: return false;
+ }
+ }
+ updateLibDir(monitor);
+ }
+ removeModulesFromEAR(monitor);
+ addModulesToEAR(monitor);
+ refresh();
+ return true;
+ }
+
+ public void performDefaults() {
+ }
+
+ public boolean performCancel() {
+ return true;
+ }
+
+ public void dispose() {
+ Table table = null;
+ if (availableComponentsViewer != null) {
+ table = availableComponentsViewer.getTable();
+ }
+ if(table != null){
+ table.removeListener(SWT.Dispose, tableListener);
+ table.removeListener(SWT.KeyDown, tableListener);
+ table.removeListener(SWT.MouseMove, tableListener);
+ table.removeListener(SWT.MouseHover, tableListener);
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ }
+
+ private List newJ2EEModulesToAdd(boolean inLibFolder){
+ if (inLibFolder && !isVersion5) return null;
+ List newComps = new ArrayList();
+ List comps = inLibFolder ? j2eeLibElementList : j2eeComponentList;
+ if (comps != null && !comps.isEmpty()){
+ for (int i = 0; i < comps.size(); i++){
+ IVirtualComponent handle = (IVirtualComponent)comps.get(i);
+ if (ClasspathDependencyUtil.isClasspathComponentDependency(handle)) {
+ continue;
+ }
+ if( !inEARAlready(handle))
+ newComps.add(handle);
+ }
+ }
+ return newComps;
+ }
+
+ private void updateLibDir(IProgressMonitor monitor) {
+ if (libDir.equals(oldLibDir)) return;
+ final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(project);
+ final Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ oldLibDir = app.getLibraryDirectory();
+ if (oldLibDir == null) oldLibDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ earModel.modify(new Runnable() {
+ public void run() {
+ app.setLibraryDirectory(libDir);
+ }}, null);
+ }
+
+ protected void createDD(IProgressMonitor monitor) {
+ if( earComponent != null ){
+ IDataModelOperation op = generateEARDDOperation();
+ try {
+ op.execute(monitor, null);
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ }
+
+ private void execAddOp(IProgressMonitor monitor, List componentList, String path) throws CoreException {
+ if (componentList == null || componentList.isEmpty()) return;
+ IDataModel dm = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
+
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentList);
+
+ //[Bug 238264] the uri map needs to be manually set correctly
+ Map uriMap = new HashMap();
+ IVirtualComponent virtComp;
+ String virtCompURIMapName;
+ for(int i=0; i<componentList.size(); i++) {
+ virtComp = (IVirtualComponent)componentList.get(i);
+ virtCompURIMapName = getVirtualComponentNameWithExtension(virtComp);
+ uriMap.put(virtComp, virtCompURIMapName);
+ }
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
+
+ if (isVersion5) dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+
+ IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ if (stat != OK_STATUS)
+ throw new CoreException(stat);
+ try {
+ dm.getDefaultOperation().execute(monitor, null);
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+
+ private void execAddOp1(IProgressMonitor monitor, List jProjList, List j2eeCompList, String path)
+ throws CoreException {
+ if (!jProjList.isEmpty()) {
+ Set moduleProjects = new HashSet();
+ for (int i = 0; i < jProjList.size(); i++) {
+ try {
+ IProject proj = (IProject) jProjList.get(i);
+ moduleProjects.add(proj);
+ IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
+ migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, proj.getName());
+ migrationdm.getDefaultOperation().execute(monitor, null);
+
+
+ IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
+ List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+
+ IVirtualComponent targetcomponent = ComponentCore.createComponent(proj);
+ targetCompList.add(targetcomponent);
+
+ refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
+ refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
+ if (isVersion5) refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+
+
+ // referenced java projects should have archiveName attribute
+ ((Map)refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP)).put(targetcomponent, proj.getName().replace(' ', '_') + IJ2EEModuleConstants.JAR_EXT);
+
+ refdm.getDefaultOperation().execute(monitor, null);
+ j2eeCompList.add(targetcomponent);
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ EarFacetRuntimeHandler.updateModuleProjectRuntime(earComponent.getProject(), moduleProjects, new NullProgressMonitor());
+ } // end
+
+ }
+
+ private IStatus addModulesToEAR(IProgressMonitor monitor) {
+ try {
+ if( earComponent != null ){
+ final List list = newJ2EEModulesToAdd(false);
+ final List bndList = newJ2EEModulesToAdd(true);
+ final boolean shouldRun = (list != null && !list.isEmpty()) || !javaProjectsList.isEmpty();
+ final boolean shouldBndRun = isVersion5 &&
+ ((bndList != null && !bndList.isEmpty()) || !javaLibProjectsList.isEmpty());
+ if(shouldRun || shouldBndRun){
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
+
+ public void run(IProgressMonitor monitor) throws CoreException{
+ if (shouldRun) {
+ execAddOp(monitor, list, J2EEConstants.EAR_ROOT_DIR);
+ execAddOp1(monitor, javaProjectsList, j2eeComponentList, J2EEConstants.EAR_ROOT_DIR);
+ }
+ if (shouldBndRun) {
+ execAddOp(monitor, bndList, libDir);
+ execAddOp1(monitor, javaLibProjectsList, j2eeLibElementList, libDir);
+ }
+ }
+ };
+ J2EEUIPlugin.getWorkspace().run(runnable, monitor);
+ }
+ }
+ } catch (Exception e) {
+ J2EEUIPlugin.logError(e);
+ }
+
+ //[Bug 238264] clear out the cache because they should all either be added as references now
+ // or no longer checked and therefore not wanted by the user
+ this.addedJARComponents.clear();
+
+ return OK_STATUS;
+ }
+
+ private void remComps(List list, String path) {
+ if( !list.isEmpty()){
+ try {
+ // remove the components from the EAR
+ IDataModelOperation op = removeComponentFromEAROperation(earComponent, list, path);
+ op.execute(null, null);
+ // if that succeeded, remove all EAR-scope J2EE dependencies on these components
+ J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(earComponent.getProject());
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ }
+
+ private IStatus removeModulesFromEAR(IProgressMonitor monitor) {
+ IStatus stat = OK_STATUS;
+ if (!isVersion5) {
+ if(earComponent != null && j2eeComponentList != null) {
+ List list = getComponentsToRemove();
+ remComps(list, J2EEConstants.EAR_ROOT_DIR);
+ }
+ } else {
+ if( earComponent != null && j2eeComponentList != null) {
+ List[] list = getComponentsToRemoveUpdate(!libDir.equals(oldLibDir));
+ remComps(list[0], J2EEConstants.EAR_ROOT_DIR);
+
+ remComps(list[1], oldLibDir);
+ }
+ }
+ return stat;
+ }
+
+ protected IDataModelOperation generateEARDDOperation() {
+ IDataModel model = DataModelFactory.createDataModel(new EarCreateDeploymentFilesDataModelProvider());
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, earComponent);
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, project);
+ return model.getDefaultOperation();
+ }
+
+ protected IDataModelOperation removeComponentFromEAROperation(IVirtualComponent sourceComponent, List targetComponentsHandles, String dir) {
+ IDataModel model = DataModelFactory.createDataModel(new RemoveComponentFromEnterpriseApplicationDataModelProvider());
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, sourceComponent);
+ List modHandlesList = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ modHandlesList.addAll(targetComponentsHandles);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, dir);
+ return model.getDefaultOperation();
+ }
+
+ protected List getComponentsToRemove(){
+ //j2eeComponentList = getCheckedJ2EEElementsAsList();
+ List list = new ArrayList();
+ if( earComponent != null){
+ IVirtualReference[] oldrefs = earComponent.getReferences();
+ for (int j = 0; j < oldrefs.length; j++) {
+ IVirtualReference ref = oldrefs[j];
+ IVirtualComponent handle = ref.getReferencedComponent();
+ if(!j2eeComponentList.contains(handle) && (isVersion5 ? !j2eeLibElementList.contains(handle) : true)){
+ if ((handle instanceof VirtualArchiveComponent) && (isPhysicallyAdded((VirtualArchiveComponent)handle)))
+ continue;
+ list.add(handle);
+ }
+ }
+ }
+ return list;
+ }
+
+ // EAR5 case
+ protected List[] getComponentsToRemoveUpdate(boolean dirUpdated){
+ //j2eeComponentList = getCheckedJ2EEElementsAsList();
+ List[] list = new ArrayList[2];
+ list[0] = new ArrayList();
+ list[1] = new ArrayList();
+ if( earComponent != null){
+ IVirtualReference[] oldrefs = earComponent.getReferences();
+ for (int j = 0; j < oldrefs.length; j++) {
+ IVirtualReference ref = oldrefs[j];
+ IVirtualComponent handle = ref.getReferencedComponent();
+ if (handle instanceof VirtualArchiveComponent) {
+ VirtualArchiveComponent comp = (VirtualArchiveComponent)handle;
+ if (isPhysicallyAdded(comp))
+ continue;
+ }
+ if(!j2eeComponentList.contains(handle) && ref.getRuntimePath().isRoot()) {
+ list[0].add(handle);
+ }
+ if((!j2eeLibElementList.contains(handle) || dirUpdated) &&
+ ref.getRuntimePath().toString().equals(oldLibDir)) {
+ list[1].add(handle);
+ }
+ }
+ }
+ return list;
+ }
+
+
+ public void handleEvent(Event event) {
+ if (event.widget == selectAllButton)
+ handleSelectAllButtonPressed();
+ else if (event.widget == deselectAllButton)
+ handleDeselectAllButtonPressed();
+ else if(event.widget == projectJarButton)
+ handleSelectProjectJarButton();
+ else if(event.widget == externalJarButton)
+ handleSelectExternalJarButton();
+ else if(event.widget == addVariableButton)
+ handleSelectVariableButton();
+ else if(event.widget == changeLibPathButton) {
+ this.handleChangeLibDirButton(true);
+ }
+ }
+
+ private void handleSelectAllButtonPressed() {
+ availableComponentsViewer.setAllChecked(true);
+ j2eeComponentList = getCheckedJ2EEElementsAsList(true);
+ javaProjectsList = getCheckedJavaProjectsAsList(true);
+ if (isVersion5) {
+ j2eeLibElementList = getCheckedJ2EEElementsAsList(false);
+ javaLibProjectsList = getCheckedJavaProjectsAsList(false);
+ }
+ }
+
+ /**
+ * [Bug 279386] Grayed items must not be deselected.
+ */
+ private void handleDeselectAllButtonPressed() {
+ TableItem[] items = availableComponentsViewer.getTable().getItems();
+ for (TableItem item : items) {
+ if (item.getChecked() && !item.getGrayed()) {
+ // uncheck this item if already checked and not grayed
+ item.setChecked(false);
+ if (isVersion5) {
+ ((DoubleCheckboxTableItem) item).setSecondChecked(false);
+ }
+
+ // remove from the cache lists
+ Object comp = item.getData();
+ if (comp != null) {
+ j2eeComponentList.remove(comp);
+ javaProjectsList.remove(comp);
+ if (isVersion5) {
+ libsToUncheck.remove(comp);
+ j2eeLibElementList.remove(comp);
+ javaLibProjectsList.remove(comp);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * [Bug 238264]
+ * Add an archive as a potential new reference for this.earComponent
+ * NOTE1: the given archive will not be added as a potential reference if there is already a reference to it
+ * NOTE2: the given archive will only be added as an actual reference when this.performOk is invoked
+ *
+ * @param archive the archive to add as a potential new reference in this.earComponent
+ *
+ */
+ private void addPotentialNewReference(IVirtualComponent archive) {
+ //check to see if a reference to the given archive already exists
+ IVirtualReference [] existingRefs = earComponent.getReferences();
+ IVirtualComponent referencedComponent;
+ boolean refAlreadyExists = false;
+ for(int i=0;i<existingRefs.length && !refAlreadyExists;i++){
+ referencedComponent = existingRefs[i].getReferencedComponent();
+ refAlreadyExists = referencedComponent.equals(archive);
+ }
+
+ //only add the archive as a potentialy new reference if it does not already exist
+ if(!refAlreadyExists && !j2eeComponentList.contains(archive) && !addedJARComponents.contains(archive)) {
+ this.j2eeComponentList.add(archive);
+ this.addedJARComponents.add(archive);
+ } else {
+ //TODO should inform user that they selected an already referenced archive?
+ }
+ }
+
+ private void handleSelectExternalJarButton(){
+ IPath[] selected= BuildPathDialogAccess.chooseExternalJAREntries(propPage.getShell());
+
+ if (selected != null) {
+ for (int i= 0; i < selected.length; i++) {
+
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( earComponent.getProject(), type +
+ selected[i].toString());
+
+ this.addPotentialNewReference(archive);
+ }
+ refresh();
+ }
+
+ }
+
+ private void handleSelectVariableButton(){
+ IPath existingPath[] = new Path[0];
+ IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(propPage.getShell(), existingPath);
+
+ if (paths != null) {
+ refresh();
+ for (int i = 0; i < paths.length; i++) {
+ IPath resolvedPath= JavaCore.getResolvedVariablePath(paths[i]);
+
+ java.io.File file = new java.io.File(resolvedPath.toOSString());
+ if( file.isFile() && file.exists()){
+ String type = VirtualArchiveComponent.VARARCHIVETYPE + IPath.SEPARATOR;
+
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( earComponent.getProject(), type +
+ paths[i].toString());
+
+ this.addPotentialNewReference(archive);
+ }else{
+ //display error
+ }
+ }
+ refresh();
+ }
+ }
+
+ private void handleChangeLibDirButton(boolean warnBlank) {
+ IVirtualFile vFile = earComponent.getRootFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
+ if (!vFile.exists()) {
+ if (!MessageDialog.openQuestion(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.NO_DD_MSG_TITLE),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.GEN_DD_QUESTION))) return;
+ createDD(new NullProgressMonitor());
+ }
+ Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ if (libDir == null) {
+ libDir = app.getLibraryDirectory();
+ if (libDir == null) libDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ }
+
+ ChangeLibDirDialog dlg = new ChangeLibDirDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), libDir, warnBlank);
+ if (dlg.open() == Dialog.CANCEL) return;
+ libDir = dlg.getValue().trim();
+ if (libDir.length() > 0) {
+ if (!libDir.startsWith(J2EEConstants.EAR_ROOT_DIR)) libDir = IPath.SEPARATOR + libDir;
+ }
+ setLibDirInContentProvider();
+ refresh();
+ }
+
+
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ fillComposite(composite);
+ }
+
+ public void fillComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createTable(parent);
+ createButtonColumn(parent);
+ }
+
+ protected void createButtonColumn(Composite parent) {
+ buttonColumn = createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createPushButtons();
+ }
+
+ protected void createPushButtons() {
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ projectJarButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_JAR));
+ externalJarButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.EXTERNAL_JAR));
+ addVariableButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.ADDVARIABLE));
+ if (isVersion5) changeLibPathButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.CHANGE_LIB_DIR));
+ }
+
+ protected Button createPushButton(String label) {
+ Button aButton = primCreatePushButton(label, buttonColumn);
+ aButton.addListener(SWT.Selection, this);
+ aButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return aButton;
+ }
+
+ public Button primCreatePushButton(String label, Composite aButtonColumn) {
+ Button aButton = new Button(aButtonColumn, SWT.PUSH);
+ aButton.setText(label);
+ return aButton;
+ }
+
+ public Composite createButtonColumnComposite(Composite parent) {
+ Composite aButtonColumn = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ aButtonColumn.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ aButtonColumn.setLayoutData(data);
+ return aButtonColumn;
+ }
+
+ public Group createGroup(Composite parent) {
+ return new Group(parent, SWT.NULL);
+ }
+
+ protected void createTable(Composite parent) {
+ availableComponentsViewer = createavailableComponentsViewer(parent);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ availableComponentsViewer.getTable().setLayoutData(gd);
+
+ if (earComponent != null) {
+ int j2eeVersion = J2EEVersionUtil.convertVersionStringToInt(earComponent);
+ ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+ AvailableJ2EEComponentsForEARContentProvider provider = new AvailableJ2EEComponentsForEARContentProvider(earComponent, j2eeVersion, decorator);
+ decorator.addListener(new ILabelProviderListener(){
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ refresh();
+ }
+ });
+ availableComponentsViewer.setContentProvider(provider);
+ availableComponentsViewer.setLabelProvider(provider);
+
+
+ setLibDirInContentProvider();
+ addTableListeners();
+ }
+ }
+
+ private void setLibDirInContentProvider() {
+ IContentProvider prov = availableComponentsViewer.getContentProvider();
+ if (prov instanceof AvailableJ2EEComponentsForEARContentProvider)
+ ((AvailableJ2EEComponentsForEARContentProvider)prov).setCurrentLibDir(libDir);
+ }
+
+ protected void addTableListeners() {
+ addCheckStateListener();
+ addHoverHelpListeners();
+ }
+
+ protected void addHoverHelpListeners() {
+ final Table table = availableComponentsViewer.getTable();
+ createLabelListener(table);
+ createTableListener(table);
+ table.addListener(SWT.Dispose, tableListener);
+ table.addListener(SWT.KeyDown, tableListener);
+ table.addListener(SWT.MouseMove, tableListener);
+ table.addListener(SWT.MouseHover, tableListener);
+ }
+
+ protected void createLabelListener(final Table table) {
+ labelListener = new Listener () {
+ public void handleEvent (Event event) {
+ Label label = (Label)event.widget;
+ Shell shell = label.getShell ();
+ switch (event.type) {
+ case SWT.MouseDown:
+ Event e = new Event ();
+ e.item = (TableItem) label.getData ("_TABLEITEM"); //$NON-NLS-1$
+ table.setSelection (new TableItem [] {(TableItem) e.item});
+ table.notifyListeners (SWT.Selection, e);
+ shell.dispose ();
+ table.setFocus();
+ break;
+ case SWT.MouseExit:
+ shell.dispose ();
+ break;
+ }
+ }
+ };
+ }
+
+ protected void createTableListener(final Table table) {
+ tableListener = new Listener () {
+ Shell tip = null;
+ Label label = null;
+ public void handleEvent (Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ case SWT.MouseMove: {
+ if (tip == null) break;
+ tip.dispose ();
+ tip = null;
+ label = null;
+ break;
+ }
+ case SWT.MouseHover: {
+ TableItem item = table.getItem (new Point (event.x, event.y));
+ if (item != null) {
+ if (!item.getGrayed())
+ return;
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = new Shell (PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tip.setBackground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_BACKGROUND));
+ FillLayout layout = new FillLayout ();
+ layout.marginWidth = 2;
+ tip.setLayout (layout);
+ label = new Label (tip, SWT.WRAP);
+ label.setForeground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_FOREGROUND));
+ label.setBackground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_BACKGROUND));
+ label.setData ("_TABLEITEM", item); //$NON-NLS-1$
+ label.setText (J2EEUIMessages.getResourceString(J2EEUIMessages.HOVER_HELP_FOR_DISABLED_LIBS));
+ label.addListener (SWT.MouseExit, labelListener);
+ label.addListener (SWT.MouseDown, labelListener);
+ Point size = tip.computeSize (SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle rect = item.getBounds (0);
+ Point pt = table.toDisplay (rect.x, rect.y);
+ tip.setBounds (pt.x, pt.y - size.y, size.x, size.y);
+ tip.setVisible (true);
+ }
+ }
+ }
+ }
+ };
+ }
+
+ protected void addCheckStateListener() {
+ availableComponentsViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ CheckboxTableViewer vr = (CheckboxTableViewer)event.getSource();
+ Object element = event.getElement();
+ if (vr.getGrayed(element))
+ vr.setChecked(element, !vr.getChecked(element));
+ if (!(event instanceof SecondCheckBoxStateChangedEvent) && (isVersion5)) {
+ Object[] items = ((DoubleCheckboxTableViewer)vr).getUncheckedItems();
+ for (int i = 0; i < items.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)items[i];
+ if (item.getSecondChecked()) {
+ item.setSecondChecked(false);
+ libsToUncheck.remove(event.getElement());
+ }
+ }
+ }
+ if ((event instanceof SecondCheckBoxStateChangedEvent)) {
+ SecondCheckBoxStateChangedEvent evt = (SecondCheckBoxStateChangedEvent)event;
+ DoubleCheckboxTableItem tblItem = evt.getTableItem();
+ if (tblItem.getSecondChecked() && isConflict(tblItem.getData())) {
+ DependencyConflictResolveDialog dlg = new DependencyConflictResolveDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), DependencyConflictResolveDialog.DLG_TYPE_2);
+ if (dlg.open() == DependencyConflictResolveDialog.BTN_ID_CANCEL) {
+ tblItem.setSecondChecked(false);
+ return;
+ }
+ }
+ if (tblItem.getSecondChecked()) {
+ if (!tblItem.getChecked())
+ tblItem.setChecked(true);
+ libsToUncheck.add(event.getElement());
+ } else {
+ libsToUncheck.remove(event.getElement());
+ }
+ }
+ j2eeComponentList = getCheckedJ2EEElementsAsList(true);
+ javaProjectsList = getCheckedJavaProjectsAsList(true);
+ if (isVersion5) {
+ j2eeLibElementList = getCheckedJ2EEElementsAsList(false);
+ javaLibProjectsList = getCheckedJavaProjectsAsList(false);
+
+ }
+ }
+ });
+ }
+
+ protected List getCPComponentsInEar(boolean inLibFolder) {
+ List list = new ArrayList();
+ Map pathToComp = new HashMap();
+ IVirtualReference refs[] = earComponent.getReferences();
+ for( int i=0; i< refs.length; i++){
+ IVirtualReference ref = refs[i];
+ if ((ref.getRuntimePath().isRoot() && !inLibFolder) ||
+ (!ref.getRuntimePath().isRoot() && inLibFolder) ||
+ !isVersion5) {
+
+ IVirtualComponent comp = ref.getReferencedComponent();
+ AvailableJ2EEComponentsForEARContentProvider.addClasspathComponentDependencies(list, pathToComp, comp);
+ }
+ }
+ return list;
+ }
+
+ protected List getComponentsInEar(boolean inLibFolder) {
+ List list = new ArrayList();
+ IVirtualReference refs[] = earComponent.getReferences();
+ for( int i=0; i< refs.length; i++){
+ IVirtualReference ref = refs[i];
+ if ((ref.getRuntimePath().isRoot() && !inLibFolder) ||
+ (!ref.getRuntimePath().isRoot() && inLibFolder) ||
+ !isVersion5) {
+
+ IVirtualComponent comp = ref.getReferencedComponent();
+ list.add(comp);
+ }
+ }
+ return list;
+ }
+
+ /**
+ *
+ * @param componentHandle
+ * @return
+ * @description returns true is a component is already in the EAR as a dependent
+ */
+ protected boolean inEARAlready(IVirtualComponent component){
+ IVirtualReference refs[] = earComponent.getReferences();
+ for( int i=0; i< refs.length; i++){
+ IVirtualReference ref = refs[i];
+ if ( ref.getReferencedComponent().equals( component ))
+ return true;
+ }
+ return false;
+ }
+
+ // The next two are used in EAR5 case
+ protected List getCheckedJ2EEElementsAsList(boolean singleChecked) {
+ Object[] elements;
+ if (isVersion5) {
+ elements = singleChecked ? ((DoubleCheckboxTableViewer)availableComponentsViewer).getSingleCheckedElements():
+ ((DoubleCheckboxTableViewer)availableComponentsViewer).getDoubleCheckedElements();
+
+ } else {
+ elements = availableComponentsViewer.getCheckedElements();
+ }
+ List list;
+ if (elements == null || elements.length == 0)
+ list = new ArrayList(0); // Collections.EMPTY_LIST would cause UnsupportedOperationException when a later attempt to add to it is made
+ else {
+ list = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof IVirtualComponent) {
+ list.add(elements[i]);
+ }
+ }
+ }
+ return list;
+ }
+
+ protected List getCheckedJavaProjectsAsList(boolean single) {
+ Object[] elements;
+ if (isVersion5) {
+ elements = single ? ((DoubleCheckboxTableViewer)availableComponentsViewer).getSingleCheckedElements() :
+ ((DoubleCheckboxTableViewer)availableComponentsViewer).getDoubleCheckedElements();
+ } else {
+ elements = availableComponentsViewer.getCheckedElements();
+ }
+
+ List list;
+ if (elements == null || elements.length == 0)
+ list = new ArrayList(0); // Collections.EMPTY_LIST would cause UnsupportedOperationException when a later attempt to add to it is made
+ else {
+ list = new ArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof IProject) {
+ list.add(elements[i]);
+ }
+ }
+ }
+ return list;
+ }
+
+ protected List getLibFolderLibsAsList() {
+ Object[] items = ((DoubleCheckboxTableViewer)availableComponentsViewer).getSecondCheckedItems();
+ List list;
+ if (items == null || items.length == 0)
+ list = new ArrayList(0); // Collections.EMPTY_LIST would cause UnsupportedOperationException when a later attempt to add to it is made
+ else {
+ list = new ArrayList();
+ for (int i = 0; i < items.length; i++) {
+ Object element = ((DoubleCheckboxTableItem)items[i]).getData();
+ if (element instanceof IProject) {
+ list.add(element);
+ }
+ }
+ }
+ return list;
+ }
+
+ public CheckboxTableViewer createavailableComponentsViewer(Composite parent) {
+ int flags = SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
+
+ Table table = isVersion5 ? new Table(parent, flags) : new Table(parent, flags);
+ availableComponentsViewer = isVersion5 ? new DoubleCheckboxTableViewer(table, 2) : new CheckboxTableViewer(table);
+
+ // set up table layout
+ TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ if (isVersion5) tableLayout.addColumnData(new ColumnWeightData(200, true));
+ table.setLayout(tableLayout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ availableComponentsViewer.setSorter(null);
+
+ // table columns
+ TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
+ fileNameColumn.setText(ManifestUIResourceHandler.JAR_Module_UI_);
+ fileNameColumn.setResizable(true);
+
+ TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
+ projectColumn.setText(ManifestUIResourceHandler.Project_UI_);
+ projectColumn.setResizable(true);
+
+ if (isVersion5) {
+ TableColumn bndColumn = new TableColumn(table, SWT.NONE, 2);
+ bndColumn.setText(ManifestUIResourceHandler.Packed_In_Lib_UI_);
+ bndColumn.setResizable(true);
+ }
+
+ tableLayout.layout(table, true);
+ return availableComponentsViewer;
+
+ }
+
+ private boolean secondShouldBeDisabled(IVirtualComponent component) {
+ if(component.isBinary()) return false;
+ if (JavaEEProjectUtilities.isApplicationClientComponent(component)) return true;
+ if (JavaEEProjectUtilities.isEARProject(component.getProject()) && component.isBinary()) return false;
+ if (JavaEEProjectUtilities.isEJBComponent(component)) return true;
+ if (JavaEEProjectUtilities.isDynamicWebComponent(component)) return true;
+ if (JavaEEProjectUtilities.isJCAComponent(component)) return true;
+ if (JavaEEProjectUtilities.isStaticWebProject(component.getProject())) return true;
+ if (JavaEEProjectUtilities.isProjectOfType(component.getProject(), IJ2EEFacetConstants.JAVA)) return false;
+ return false;
+ }
+
+ private boolean isPhysicallyAdded(VirtualArchiveComponent component) {
+ try {
+ if(component.getWorkspaceRelativePath() == null || !component.getWorkspaceRelativePath().segment(0).equals(earComponent.getName()))
+ return false;
+ component.getProjectRelativePath();
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+
+ private boolean isInLibDir(VirtualArchiveComponent comp) {
+ IPath p = comp.getProjectRelativePath();
+ if (p.segmentCount() == 2)
+ return false;
+ return true;
+ }
+
+
+ public void refresh() {
+ if(availableComponentsViewer.getContentProvider() == null){
+ return;
+ }
+ IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
+ availableComponentsViewer.setInput(input);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ int numlines = Math.min(10, availableComponentsViewer.getTable().getItemCount());
+ data.heightHint = availableComponentsViewer.getTable().getItemHeight() * numlines;
+ availableComponentsViewer.getTable().setLayoutData(data);
+
+ //[Bug 238264] for all the jars in the cache temparaly list them in the grid
+ // until the user applys the changes
+ for(IVirtualComponent jarComponent : this.addedJARComponents) {
+ availableComponentsViewer.add(jarComponent);
+ }
+
+ TableItem [] items = availableComponentsViewer.getTable().getItems();
+ List list = new ArrayList();
+ //Object[] comps = getComponentsInEar();
+ List cpComps;
+ List cpLibComps = new LinkedList();
+ HashSet j2eeComponentSet = new HashSet();
+ HashSet j2eeLibComponentSet = new HashSet();
+ if (isVersion5) {
+ if( j2eeComponentList.isEmpty() ){
+ List comps = getComponentsInEar(false);
+ j2eeComponentList.addAll(comps);
+ }
+ if( j2eeLibElementList.isEmpty() ){
+ List comps = getComponentsInEar(true);
+ j2eeLibElementList.addAll(comps);
+ }
+ // get all Classpath contributions to the Ear
+ cpComps = getCPComponentsInEar(false);
+ j2eeComponentList.addAll(cpComps);
+ cpLibComps = getCPComponentsInEar(true);
+ j2eeLibElementList.addAll(cpLibComps);
+ for (int i = 0; i < j2eeLibElementList.size(); i++) {
+ j2eeLibComponentSet.add(j2eeLibElementList.get(i));
+ }
+
+ } else {
+ if( j2eeComponentList.isEmpty() ){
+ List comps = getComponentsInEar(false);
+ j2eeComponentList.addAll(comps);
+ }
+ // get all Classpath contributions to the Ear
+ cpComps = getCPComponentsInEar(false);
+ j2eeComponentList.addAll(cpComps);
+ }
+ for (int i = 0; i < j2eeComponentList.size(); i++) {
+ j2eeComponentSet.add(j2eeComponentList.get(i));
+ }
+
+ for (int i = 0; i < items.length; i++) {
+ Object element = items[i].getData();
+ try {
+ if (element instanceof IVirtualComponent ||
+ (element instanceof IProject && ((IProject) element).hasNature(JavaCore.NATURE_ID))) {
+ if (j2eeComponentSet.contains(element)) {
+ list.add(element);
+ }
+ boolean shouldBeDisabled = false;
+ if (element instanceof VirtualArchiveComponent) {
+ shouldBeDisabled = isPhysicallyAdded((VirtualArchiveComponent)element);
+ if (shouldBeDisabled) {
+ items[i].setChecked(true);
+ items[i].setGrayed(true);
+ }
+ }
+ if (isVersion5) {
+ DoubleCheckboxTableItem dcbItem = (DoubleCheckboxTableItem)items[i];
+ boolean secondEnabled = true;
+ if (element instanceof IVirtualComponent)
+ secondEnabled = !secondShouldBeDisabled((IVirtualComponent) element);
+ if (shouldBeDisabled) {
+ dcbItem.setSecondChecked(isInLibDir((VirtualArchiveComponent)element));
+ dcbItem.setSecondEnabled(false);
+ } else {
+ dcbItem.setSecondChecked(j2eeLibComponentSet.contains(element));
+ dcbItem.setSecondEnabled(secondEnabled);
+ }
+ if (j2eeLibComponentSet.contains(element)) list.add(element);
+ }
+ }
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(0, e.getMessage(), e);
+ }
+ }
+
+ for (int i = 0; i < list.size(); i++)
+ availableComponentsViewer.setChecked(list.get(i), true);
+ GridData btndata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ buttonColumn.setLayoutData(btndata);
+
+ }
+
+ private boolean isConflict(Object lib) {
+ IProject libProj = (lib instanceof IProject) ? (IProject)lib : ((IVirtualComponent)lib).getProject();
+ IProject earProject = earComponent.getProject();
+ try {
+ IProject[] earRefProjects = earProject.getReferencedProjects();
+ for (int i = 0; i < earRefProjects.length; i++) {
+ if (!JavaEEProjectUtilities.isEARProject(earRefProjects[i]) &&
+ !earRefProjects[i].equals(libProj)) {
+ IVirtualComponent cmp1 = ComponentCore.createComponent(earRefProjects[i]);
+ if (cmp1 != null) {
+ IVirtualReference[] refs = cmp1.getReferences();
+ for (int j = 0; j < refs.length; j++) {
+ if (refs[j].getReferencedComponent().getProject().equals(libProj)) return true;
+ }
+ }
+ }
+ }
+ return false;
+ } catch (CoreException ce) {
+ J2EEUIPlugin.logError(ce);
+ }
+ return false;
+ }
+
+ private void handleSelectProjectJarButton(){
+ IPath[] selected= BuildPathDialogAccess.chooseJAREntries(propPage.getShell(), project.getLocation(), new IPath[0]);
+
+ if (selected != null) {
+ for (int i= 0; i < selected.length; i++) {
+ //IPath fullPath = project.getFile(selected[i]).getFullPath();
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( earComponent.getProject(), type +
+ selected[i].makeRelative().toString());
+
+ this.addPotentialNewReference(archive);
+ }
+ refresh();
+ }
+
+ }
+
+ /**
+ * [Bug 238264]
+ * determines a unique URI mapping name for a given component
+ * this is in case two components have the same name.
+ *
+ * @return returns a valid (none duplicate) uri mapping name for the given component\
+ */
+ private String getURIMappingName(IVirtualComponent archive) {
+
+ //get the default uri map name for the given archive
+ IPath componentPath = Path.fromOSString(archive.getName());
+ String uriMapName = componentPath.lastSegment().replace(' ', '_');
+
+
+ //check to be sure this uri mapping is not already in use by another reference
+ boolean dupeArchiveName;
+ int lastDotIndex;
+ String increment;
+ IVirtualReference [] existingRefs = earComponent.getReferences();
+ for(int i=0;i<existingRefs.length;i++){
+ existingRefs[i].getReferencedComponent().getName();
+
+ //if uri mapping names of the refed component and the given archive are the same
+ // find a new uri map name for the given archive
+ if(existingRefs[i].getArchiveName().equals(uriMapName)){
+ dupeArchiveName = true;
+ //find a new uriMapName for the given component
+ for(int j=1; dupeArchiveName; j++){
+ lastDotIndex = uriMapName.lastIndexOf('.');
+ increment = "_"+j; //$NON-NLS-1$
+
+ //create the new potential name
+ if(lastDotIndex != -1){
+ uriMapName = uriMapName.substring(0, lastDotIndex) + increment + uriMapName.substring(lastDotIndex);
+ } else {
+ uriMapName = uriMapName.substring(0)+increment;
+ }
+
+ //determine if the new potential name is valid
+ for(int k=0; k<existingRefs.length; k++) {
+ dupeArchiveName = existingRefs[k].getArchiveName().equals(uriMapName);
+ if(dupeArchiveName) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return uriMapName;
+ }
+
+ /**
+ * Method returns the name of the given IVirtualComponent being sure the correct extension
+ * is on the end of the name, this is important for internal projects. Added for [Bug 241509]
+ *
+ * @param virtComp the IVirtualComponent to get the name of with the correct extension
+ * @return the name of the given IVirtualComponent with the correct extension
+ */
+ private String getVirtualComponentNameWithExtension(IVirtualComponent virtComp) {
+ String virtCompURIMapName = this.getURIMappingName(virtComp);
+
+ boolean linkedToEAR = true;
+ try {
+ if(virtComp.isBinary()){
+ linkedToEAR = ((J2EEModuleVirtualArchiveComponent)virtComp).isLinkedToEAR();
+ ((J2EEModuleVirtualArchiveComponent)virtComp).setLinkedToEAR(false);
+ }
+ if(JavaEEProjectUtilities.isDynamicWebComponent(virtComp)) {
+ if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.WAR_EXT)) {
+ //web module URIs need to end in WAR
+ virtCompURIMapName += IJ2EEModuleConstants.WAR_EXT;
+ }
+ } else if(JavaEEProjectUtilities.isJCAComponent(virtComp)) {
+ if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.RAR_EXT)) {
+ //connector module URIs need to end in RAR
+ virtCompURIMapName += IJ2EEModuleConstants.RAR_EXT;
+ }
+ } else if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.JAR_EXT)) {
+ //all other modules (EJB, AppClient, Utility) need to end in JAR
+ virtCompURIMapName += IJ2EEModuleConstants.JAR_EXT;
+ }
+ } finally {
+ if(virtComp.isBinary()){
+ ((J2EEModuleVirtualArchiveComponent)virtComp).setLinkedToEAR(linkedToEAR);
+ }
+ }
+ return virtCompURIMapName;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java
new file mode 100644
index 0000000..f1f648d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AvailableJ2EEComponentsForEARContentProvider.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Stefan Dimov, stefan.dimov@sap.com - bug 207826
+ * Milen Manov, milen.manov@sap.com - bugs 248623
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.model.IEARModelProvider;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.javaee.application.Application;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+public class AvailableJ2EEComponentsForEARContentProvider extends LabelProvider
+ implements IStructuredContentProvider, ITableLabelProvider {
+
+ final static String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR);
+
+ private int j2eeVersion;
+ private IVirtualComponent earComponent;
+ private boolean isEE5 = false;
+ private String libDir = null;
+
+ private ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+
+ private ILabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
+
+ public AvailableJ2EEComponentsForEARContentProvider(IVirtualComponent aEarComponent, int j2eeVersion) {
+ super();
+ this.j2eeVersion = j2eeVersion;
+ earComponent = aEarComponent;
+ }
+
+ public AvailableJ2EEComponentsForEARContentProvider(IVirtualComponent aEarComponent, int j2eeVersion, ILabelDecorator decorator) {
+ this(aEarComponent, j2eeVersion);
+ this.decorator = decorator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ if (null != earComponent){
+ isEE5 = J2EEProjectUtilities.isJEEProject(earComponent.getProject());
+ }
+ Object[] empty = new Object[0];
+ if (!(inputElement instanceof IWorkspaceRoot))
+ return empty;
+ IProject[] projects = ((IWorkspaceRoot) inputElement).getProjects();
+ if (projects == null || projects.length == 0)
+ return empty;
+ List validCompList = new ArrayList();
+ Map pathToComp = new HashMap();
+ for (int i = 0; i < projects.length; i++) {
+ // get flexible project
+ IProject project = projects[i];
+ if(ModuleCoreNature.isFlexibleProject(project)){
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if (JavaEEProjectUtilities.isApplicationClientProject(project) ||
+ JavaEEProjectUtilities.isEJBProject(project) ||
+ JavaEEProjectUtilities.isDynamicWebProject(project) ||
+ JavaEEProjectUtilities.isJCAProject(project) ||
+ JavaEEProjectUtilities.isUtilityProject(project) ){
+ int compJ2EEVersion = J2EEVersionUtil.convertVersionStringToInt(component);
+ if( compJ2EEVersion <= j2eeVersion){
+ validCompList.add(component);
+ } else if(isEE5){
+ validCompList.add(component);
+ }
+ }else if(null != earComponent && JavaEEProjectUtilities.isEARProject(project)){
+ //find the ArchiveComponent
+ if (component.equals( earComponent )) {
+ if (isEE5) {
+ String earDDVersion = JavaEEProjectUtilities.getJ2EEDDProjectVersion(project);
+ //EE6TODO
+ boolean isDDVersion5 = earDDVersion.equals(J2EEVersionConstants.VERSION_5_0_TEXT) ? true : false;
+ if (isDDVersion5) {
+ Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ if (libDir == null)
+ libDir = app.getLibraryDirectory();
+ if (libDir == null)
+ libDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ }
+ }
+ IVirtualReference[] newrefs = component.getReferences();
+ for( int k=0; k< newrefs.length; k++ ){
+ IVirtualReference tmpref = newrefs[k];
+ IVirtualComponent referencedcomp = tmpref.getReferencedComponent();
+ boolean isBinary = referencedcomp.isBinary();
+ if( isBinary ){
+ if (shouldShow(referencedcomp))
+ validCompList.add(referencedcomp);
+ } else {
+ addClasspathComponentDependencies(validCompList, pathToComp, referencedcomp);
+ }
+ }
+ }
+ }
+ } else
+ try {
+ if (project.exists() && project.isAccessible() && project.hasNature("org.eclipse.jdt.core.javanature") ){ //$NON-NLS-1$
+ if( !project.getName().startsWith(".") ) //$NON-NLS-1$
+ validCompList.add(project);
+ }
+ } catch (CoreException e) {
+ Logger.getLogger().log(e);
+ }
+ }
+ return validCompList.toArray();
+ }
+
+ public void setCurrentLibDir(String libDir) {
+ this.libDir = libDir;
+ }
+
+ private boolean shouldShow(IVirtualComponent component) {
+ if (!component.isBinary())
+ return true;
+
+ IFile workspaceFile = (IFile)component.getAdapter(IFile.class);
+ if( workspaceFile == null )
+ return true;
+ if( workspaceFile.getFullPath().segment(0).equals(earComponent.getName()))
+ return true;
+
+ IPath p = workspaceFile.getProjectRelativePath();
+ if ((p == null) || (p.segmentCount() == 0))
+ return true;
+ IContainer f = earComponent.getRootFolder().getUnderlyingFolder();
+ String rootFolderName = f.getProjectRelativePath().segment(0);
+ if (!p.segment(0).equals(rootFolderName))
+ return false;
+ if (p.segmentCount() == 2)
+ return true;
+ if (isEE5) {
+ String strippedLibDir = stripSeparators(libDir);
+ String[] libDirSegs = strippedLibDir.split(PATH_SEPARATOR);
+ if (p.segmentCount() - 2 != libDirSegs.length)
+ return false;
+ for (int i = 0; i < libDirSegs.length; i++)
+ if (!libDirSegs[i].equals(p.segment(i + 1)))
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ private String stripSeparators(final String dir) {
+ String returnDir = dir;
+ if (returnDir.startsWith(PATH_SEPARATOR))
+ returnDir = returnDir.substring(1);
+ if (returnDir.endsWith(PATH_SEPARATOR))
+ returnDir = returnDir.substring(0, returnDir.length() - 1);
+ return returnDir;
+ }
+
+ public static void addClasspathComponentDependencies(final List componentList, final Map pathToComp, final IVirtualComponent referencedComponent) {
+ if (referencedComponent instanceof J2EEModuleVirtualComponent) {
+ J2EEModuleVirtualComponent j2eeComp = (J2EEModuleVirtualComponent) referencedComponent;
+ IVirtualReference[] cpRefs = j2eeComp.getJavaClasspathReferences();
+ for (int j=0; j < cpRefs.length; j++) {
+ // only ../ mappings supported at this level
+ if (!cpRefs[j].getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
+ continue;
+ }
+ // if the absolute path for this component already has a mapping, skip (the comp might be contributed by more than
+ // one child module)
+ final IPath path = ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(cpRefs[j]);
+ final IVirtualComponent comp = (IVirtualComponent) pathToComp.get(path);
+ if (comp != null) {
+ // replace with a temp VirtualArchiveComponent whose IProject is set to a new pseudo name that is
+ // the concatenation of all project contributions for that archive
+ if (comp.isBinary()) {
+ componentList.remove(comp);
+ IVirtualComponent newComponent = ClassPathSelection.updateVirtualArchiveComponentDisplay(comp, cpRefs[j]);
+ pathToComp.put(path, newComponent);
+ componentList.add(newComponent);
+ }
+ continue;
+ }
+ pathToComp.put(path, cpRefs[j].getReferencedComponent());
+ componentList.add(cpRefs[j].getReferencedComponent());
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex < 2){
+ if (element instanceof IVirtualComponent) {
+ IVirtualComponent comp = (IVirtualComponent)element;
+ return getDecoratedImage(comp);
+ } else if (element instanceof IProject){
+ return workbenchLabelProvider.getImage(element);
+ }
+ }
+ return null;
+ }
+
+ private Image getDecoratedImage(IVirtualComponent comp) {
+ return getDecoratedImage(comp.getProject());
+ }
+
+ private Image getDecoratedImage(IProject project) {
+ Image image = workbenchLabelProvider.getImage(project);
+ if (decorator != null) {
+ Image decorated = decorator.decorateImage(image, project);
+ if (decorated != null) {
+ return decorated;
+ }
+ }
+ return image;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IVirtualComponent) {
+ IVirtualComponent comp = (IVirtualComponent)element;
+ String name = ""; //$NON-NLS-1$
+ if( columnIndex == 0 ){
+ if (ClasspathDependencyUtil.isClasspathComponentDependency(comp)) {
+ return ClasspathDependencyUtil.getClasspathComponentDependencyDisplayString(comp);
+ }
+ IModelProvider provider = ModelProviderManager.getModelProvider(earComponent.getProject());
+ if (provider instanceof IEARModelProvider)
+ {
+ name = ((IEARModelProvider)provider).getModuleURI(comp);
+ }
+ if( name == null || name == "" ){ //$NON-NLS-1$
+ name = comp.getName();
+ }
+ return name;
+ } else if (columnIndex == 1) {
+ return comp.getProject().getName();
+ } else if (columnIndex == 2) {
+ return ""; //$NON-NLS-1$
+ }
+ } else if (element instanceof IProject){
+ if (columnIndex != 2) {
+ return ((IProject)element).getName();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClassHelperAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClassHelperAdapterFactory.java
new file mode 100644
index 0000000..163ae74
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClassHelperAdapterFactory.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+
+public class ClassHelperAdapterFactory implements IAdapterFactory {
+
+ private static final Class IFILE_CLASS = IFile.class;
+ private static final Class IRESOURCE_CLASS = IResource.class;
+
+ private static final Class[] ADAPTER_TYPES = new Class[] {
+ IFILE_CLASS, IRESOURCE_CLASS
+ };
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if(IRESOURCE_CLASS == adapterType || IFILE_CLASS == adapterType) {
+ if(adaptableObject instanceof J2EEJavaClassProviderHelper) {
+ J2EEJavaClassProviderHelper provider = (J2EEJavaClassProviderHelper) adaptableObject;
+ try {
+ IResource resource = (IResource) provider.getAdapter(IRESOURCE_CLASS);
+ return resource;
+ } catch (RuntimeException e) {
+ J2EEUIPlugin.logError(0, e.getMessage(), e);
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClasspathTableManager.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClasspathTableManager.java
new file mode 100644
index 0000000..a18b0d3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ClasspathTableManager.java
@@ -0,0 +1,643 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Stefan Dimov, stefan.dimov@sap.com - bug 207826
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
+import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModel;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModelEvent;
+import org.eclipse.jst.j2ee.internal.dialogs.DependencyConflictResolveDialog;
+import org.eclipse.jst.j2ee.internal.listeners.IValidateEditListener;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.wizard.AvailableJarsProvider;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+/**
+ * @author jialin
+ */
+public class ClasspathTableManager implements Listener, ICommonManifestUIConstants {
+
+ protected Button useClientJARsBtn;
+ protected Button useServerJARsBtn;
+ protected Button useAnyJARsBtn;
+ protected Button upButton;
+ protected Button downButton;
+ protected Button selectAllButton;
+ protected Button deselectAllButton;
+ protected IClasspathTableOwner owner;
+ protected Composite buttonColumn;
+ protected ClasspathModel model;
+ protected CheckboxTableViewer availableJARsViewer;
+ protected IValidateEditListener validateEditListener;
+ /**
+ * @deprecated this field should be removed
+ */
+ protected boolean isWLPEntry;
+ protected Group radioGroup;
+
+ protected boolean readOnly;
+ protected AvailableJarsProvider availableJarsProvider;
+ protected Button externalJarButton;
+ protected Button projectJarButton;
+ protected Button addVariableButton;
+
+ protected Set compsToUncheck = new HashSet();
+
+ /**
+ * Constructor for ButtonBarManager.
+ */
+ public ClasspathTableManager(IClasspathTableOwner owner, ClasspathModel model) {
+ this(owner, model, null);
+ }
+
+ public ClasspathTableManager(IClasspathTableOwner owner, ClasspathModel model, IValidateEditListener listener) {
+ super();
+ this.owner = owner;
+ this.model = model;
+ this.validateEditListener = listener;
+ }
+ public void fillComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createRadioGroup(parent);
+ createTable(parent);
+ createButtonColumn(parent);
+ }
+
+ public void fillWLPComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createTable(parent);
+ createWLPButtonColumn(parent);
+ }
+
+ public void fillWebRefComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createTable(parent);
+ createWebRefButtonColumn(parent);
+ }
+
+ private void initializeEJBClientDefaults() {
+ if (model == null || model.getClassPathSelection() == null)
+ return;
+ boolean shouldUseServerJARs = false;
+ ClassPathSelection selection = model.getClassPathSelection();
+ int filterLevel;
+ boolean ejbSelected = selection.isAnyEJBJarSelected();
+ boolean clientSelected = selection.isAnyEJBClientJARSelected();
+ if (ejbSelected && clientSelected)
+ filterLevel = ClassPathSelection.FILTER_NONE;
+ else if (shouldUseServerJARs) {
+ if (clientSelected)
+ filterLevel = ClassPathSelection.FILTER_NONE;
+ else
+ filterLevel = ClassPathSelection.FILTER_EJB_CLIENT_JARS;
+ } else {
+ if (ejbSelected)
+ filterLevel = ClassPathSelection.FILTER_NONE;
+ else
+ filterLevel = ClassPathSelection.FILTER_EJB_SERVER_JARS;
+ }
+ initFilterLevel(filterLevel);
+ }
+
+ private void initFilterLevel(int filterLevel) {
+ model.getClassPathSelection().setFilterLevel(filterLevel);
+ switch (filterLevel) {
+ case (ClassPathSelection.FILTER_NONE) :
+ useAnyJARsBtn.setSelection(true);
+ useClientJARsBtn.setSelection(false);
+ useServerJARsBtn.setSelection(false);
+ break;
+ case (ClassPathSelection.FILTER_EJB_CLIENT_JARS) :
+ useAnyJARsBtn.setSelection(false);
+ useClientJARsBtn.setSelection(false);
+ useServerJARsBtn.setSelection(true);
+ break;
+ case (ClassPathSelection.FILTER_EJB_SERVER_JARS) :
+ useAnyJARsBtn.setSelection(false);
+ useClientJARsBtn.setSelection(true);
+ useServerJARsBtn.setSelection(false);
+ break;
+ }
+ }
+
+ private void createRadioGroup(Composite parent) {
+ radioGroup = owner.createGroup(parent);
+ radioGroup.setText(EJB_CLIENT_RADIO_UI_);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ data.horizontalIndent = 0;
+ GridLayout layout = new GridLayout(3, false);
+ radioGroup.setLayout(layout);
+ radioGroup.setLayoutData(data);
+
+ useServerJARsBtn = createRadioButton(USE_EJB_SERVER_JARs_UI_, radioGroup);
+ useClientJARsBtn = createRadioButton(USE_EJB_CLIENT_JARs_UI_, radioGroup);
+ useAnyJARsBtn = createRadioButton(USE_BOTH_UI_, radioGroup);
+ initializeEJBClientDefaults();
+ }
+
+ protected void createButtonColumn(Composite parent) {
+ buttonColumn = owner.createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createPushButtons();
+ }
+
+ protected void createWLPButtonColumn(Composite parent) {
+ buttonColumn = owner.createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createWLPPushButtons();
+ }
+
+ protected void createWebRefButtonColumn(Composite parent) {
+ buttonColumn = owner.createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createWebRefPushButtons();
+ }
+
+ protected void createTable(Composite parent) {
+ availableJARsViewer = owner.createAvailableJARsViewer(parent);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ availableJARsViewer.getTable().setLayoutData(gd);
+ availableJarsProvider = new AvailableJarsProvider();
+ availableJARsViewer.setContentProvider(availableJarsProvider);
+ availableJARsViewer.setLabelProvider(availableJarsProvider);
+ addTableListeners();
+ }
+
+ protected void createWLPPushButtons() {
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ projectJarButton = createPushButton(J2EEUIMessages.getResourceString("PROJECT_JAR")); //$NON-NLS-1$
+ externalJarButton = createPushButton(J2EEUIMessages.getResourceString("EXTERNAL_JAR")); //$NON-NLS-1$
+ addVariableButton = createPushButton(J2EEUIMessages.getResourceString("ADDVARIABLE"));//$NON-NLS-1$
+ if (isReadOnly()) {
+ selectAllButton.setEnabled(false);
+ deselectAllButton.setEnabled(false);
+ projectJarButton.setEnabled(false);
+ externalJarButton.setEnabled(false);
+ addVariableButton.setEnabled(false);
+ }
+ }
+
+ protected void createWebRefPushButtons() {
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ if (isReadOnly()) {
+ selectAllButton.setEnabled(false);
+ deselectAllButton.setEnabled(false);
+ }
+ }
+
+ protected void createPushButtons() {
+ upButton = createPushButton(UP_BUTTON);
+ downButton = createPushButton(DOWN_BUTTON);
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ if (isReadOnly()) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ selectAllButton.setEnabled(false);
+ deselectAllButton.setEnabled(false);
+ }
+ }
+
+ protected void createWebLibPushButtons() {
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ projectJarButton = createPushButton(J2EEUIMessages.getResourceString("PROJECT_JAR")); //$NON-NLS-1$
+ externalJarButton = createPushButton(J2EEUIMessages.getResourceString("EXTERNAL_JAR")); //$NON-NLS-1$
+ addVariableButton = createPushButton(J2EEUIMessages.getResourceString("ADDVARIABLE"));//$NON-NLS-1$
+ if (isReadOnly()) {
+ selectAllButton.setEnabled(false);
+ deselectAllButton.setEnabled(false);
+ }
+ }
+
+ protected Button createPushButton(String label) {
+ Button aButton = owner.primCreatePushButton(label, buttonColumn);
+ aButton.addListener(SWT.Selection, this);
+ aButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return aButton;
+ }
+
+ protected Button createRadioButton(String label, Composite parent) {
+ Button aButton = owner.primCreateRadioButton(label, parent);
+ aButton.addListener(SWT.Selection, this);
+ return aButton;
+ }
+ /**
+ * @see Listener#handleEvent(Event)
+ */
+ public void handleEvent(Event event) {
+
+ ClasspathModelEvent evt = new ClasspathModelEvent(ClasspathModelEvent.CLASS_PATH_CHANGED);
+ model.fireNotification(evt);
+ if (event.widget == upButton)
+ upButtonSelected();
+ else if (event.widget == downButton)
+ downButtonSelected();
+ else if (event.widget == selectAllButton)
+ selectAllButtonSelected();
+ else if (event.widget == deselectAllButton)
+ deselectAllButtonSelected();
+ else if (event.widget == useServerJARsBtn)
+ handleServerJARsButtonSelected();
+ else if (event.widget == useClientJARsBtn)
+ handleClientJARsButtonSelected();
+ else if (event.widget == useAnyJARsBtn)
+ handleAnyJARsButtonSelected();
+ else if(event.widget == projectJarButton)
+ handleSelectProjectJarButton();
+ else if(event.widget == externalJarButton)
+ handleSelectExternalJarButton();
+ else if(event.widget == addVariableButton)
+ handleSelectVariableButton();
+ }
+
+ private void handleSelectExternalJarButton(){
+ //owner.handleSelectExternalJarButton();
+ if( owner instanceof WebLibDependencyPropertiesPage){
+ WebLibDependencyPropertiesPage control = (WebLibDependencyPropertiesPage)owner;
+ control.handleSelectExternalJarButton();
+ }
+ }
+ private void handleSelectProjectJarButton(){
+ //owner.handleSelectExternalJarButton();
+ if( owner instanceof WebLibDependencyPropertiesPage){
+ WebLibDependencyPropertiesPage control = (WebLibDependencyPropertiesPage)owner;
+ control.handleSelectProjectJarButton();
+ }
+ }
+
+ private void handleSelectVariableButton(){
+ //owner.handleSelectVariableButton();
+ if( owner instanceof WebLibDependencyPropertiesPage){
+ WebLibDependencyPropertiesPage control = (WebLibDependencyPropertiesPage)owner;
+ control.handleSelectVariableButton();
+ }
+ }
+
+ private void handleServerJARsButtonSelected() {
+ model.selectFilterLevel(ClassPathSelection.FILTER_EJB_CLIENT_JARS);
+ refresh();
+ }
+
+ private void handleClientJARsButtonSelected() {
+ model.selectFilterLevel(ClassPathSelection.FILTER_EJB_SERVER_JARS);
+ refresh();
+ }
+
+ private void handleAnyJARsButtonSelected() {
+ model.selectFilterLevel(ClassPathSelection.FILTER_NONE);
+ refresh();
+ }
+
+ public boolean validatateEdit() {
+ return validateEditListener.validateState().isOK();
+ }
+
+ protected void deselectAllButtonSelected() {
+ if (!validatateEdit())
+ return;
+ availableJARsViewer.setAllChecked(false);
+ model.setAllClasspathElementsSelected(false);
+ compsToUncheck.clear();
+ }
+
+ protected void selectAllButtonSelected() {
+ if (!validatateEdit())
+ return;
+ availableJARsViewer.setAllChecked(true);
+ Object[] elements = availableJARsViewer.getCheckedElements();
+ model.setAllClasspathElementsSelected(Arrays.asList(elements), true);
+ for (int i = 0; i < elements.length; i++) {
+ ClasspathElement el = (ClasspathElement)elements[i];
+ el.getComponent().getAdapter(IVirtualComponent.class);
+ IVirtualComponent ar = el.getTargetComponent();
+ IVirtualComponent comp = (ar instanceof J2EEModuleVirtualArchiveComponent) ? ar : el.getComponent();
+ if (isLibrary(comp))
+ compsToUncheck.add(comp);
+ }
+ }
+
+ protected java.util.List getSelectionAsList() {
+ return ((IStructuredSelection) availableJARsViewer.getSelection()).toList();
+ }
+
+ protected java.util.List getCheckedLibsAsList() {
+ List res = new LinkedList();
+ Iterator it = compsToUncheck.iterator();
+ while (it.hasNext()) {
+ IVirtualComponent comp = (IVirtualComponent)it.next();
+ res.add(comp);
+ }
+ return res;
+ }
+
+ protected void downButtonSelected() {
+ if (!validatateEdit())
+ return;
+ model.moveDown(getSelectionAsList());
+ refresh();
+ }
+
+ protected void upButtonSelected() {
+ if (!validatateEdit())
+ return;
+ model.moveUp(getSelectionAsList());
+ refresh();
+ }
+
+ /*
+ * Updates the enable state of the all buttons
+ */
+ protected void updateButtonEnablements() {
+ int[] indices = availableJARsViewer.getTable().getSelectionIndices();
+ if (upButton != null && downButton != null) {
+ upButton.setEnabled(canMoveUp(indices));
+ downButton.setEnabled(canMoveDown(indices, availableJARsViewer.getTable().getItemCount()));
+ }
+ }
+
+ protected boolean canMoveUp(int[] indices) {
+ return canMove(indices, 0);
+ }
+
+ protected boolean canMoveDown(int[] indices, int itemCount) {
+ return canMove(indices, itemCount - 1);
+ }
+
+ protected boolean canMove(int[] indices, int referenceIndex) {
+ int length = indices.length;
+ if (length == 0)
+ return false;
+ for (int i = 0; i < length; i++) {
+ if (indices[i] == referenceIndex)
+ return false;
+ }
+ return true;
+ }
+
+ protected void addTableListeners() {
+ addCheckStateListener();
+ addSelectionListener();
+ }
+
+ protected void addCheckStateListener() {
+ availableJARsViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ availableJARCheckStateChanged(event);
+ }
+ });
+ }
+
+ private boolean isLibrary(IVirtualComponent component) {
+ if (JavaEEProjectUtilities.isApplicationClientComponent(component)) return false;
+ if (JavaEEProjectUtilities.isEARProject(component.getProject()) && component.isBinary()) return true;
+ if (JavaEEProjectUtilities.isEJBComponent(component)) return false;
+ if (JavaEEProjectUtilities.isDynamicWebComponent(component)) return false;
+ if (JavaEEProjectUtilities.isJCAComponent(component)) return false;
+ if (JavaEEProjectUtilities.isStaticWebProject(component.getProject())) return false;
+ if (JavaEEProjectUtilities.isProjectOfType(component.getProject(), IJ2EEFacetConstants.JAVA)) return true;
+ return true;
+ }
+
+ protected void availableJARCheckStateChanged(CheckStateChangedEvent event) {
+ ClasspathElement el = (ClasspathElement)event.getElement();
+ //226823 targeting a regular java project from web libs
+ if(el.getComponent() == null){
+ ClasspathElement element = (ClasspathElement) event.getElement();
+ model.setSelection(element, event.getChecked());
+ return;
+ }
+ el.getComponent().getAdapter(IVirtualComponent.class);
+ IVirtualComponent ar = el.getTargetComponent();
+ IVirtualComponent comp = (ar instanceof J2EEModuleVirtualArchiveComponent) ? ar : el.getComponent();
+ CheckboxTableViewer v = (CheckboxTableViewer)event.getSource();
+ if (isLibrary(comp) && event.getChecked()) {
+ if (isConflict(comp)) {
+ DependencyConflictResolveDialog dlg = new DependencyConflictResolveDialog(PlatformUI.
+ getWorkbench().
+ getActiveWorkbenchWindow().
+ getShell(),
+ DependencyConflictResolveDialog.DLG_TYPE_1);
+ if (dlg.open() == DependencyConflictResolveDialog.BTN_ID_CANCEL) {
+ v.setChecked(el, false);
+ return;
+ }
+
+ }
+ compsToUncheck.add(comp);
+ } else if (!event.getChecked()) {
+ compsToUncheck.remove(comp);
+ }
+ if (!EarUtilities.isStandaloneProject(model.getComponent().getProject()) && (isReadOnly() || !validatateEdit() || (isMyClientJAR(event) && !event.getChecked()))) {
+ availableJARsViewer.setChecked(event.getElement(), !event.getChecked());
+ return;
+ }
+ ClasspathElement element = (ClasspathElement) event.getElement();
+ model.setSelection(element, event.getChecked());
+ }
+
+
+ private boolean isConflict(IVirtualComponent lib) {
+ IProject[] ears = EarUtilities.getReferencingEARProjects(lib.getProject());
+ for (int i = 0; i < ears.length; i++) {
+ if (J2EEProjectUtilities.isJEEProject(ears[i])) {
+ IVirtualComponent cmp = ComponentCore.createComponent(ears[i]);
+ IVirtualReference[] refs = cmp.getReferences();
+ for (int j = 0; j < refs.length; j++) {
+ if (model.getProject().equals(refs[j].getReferencedComponent().getProject())) {
+ IVirtualReference ref = cmp.getReference(lib.getName());
+ if (ref != null && !ref.getRuntimePath().isRoot()) return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+
+
+ /**
+ * @param event
+ * @return
+ */
+ private boolean isMyClientJAR(CheckStateChangedEvent event) {
+ ClasspathElement element = (ClasspathElement) event.getElement();
+ if(getClasspathSelection() != null)
+ return getClasspathSelection().isMyClientJAR(element);
+ return false;
+ }
+
+ protected void addSelectionListener() {
+ availableJARsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ tableSelectionChanged();
+ }
+ });
+ }
+
+ protected void tableSelectionChanged() {
+ if (!isReadOnly())
+ updateButtonEnablements();
+ }
+
+ protected ClassPathSelection getClasspathSelection() {
+ if (model == null || model.getSelectedEARComponent() == null && !(EarUtilities.isStandaloneProject(model.getComponent().getProject())))
+ return null;
+ return model.getClassPathSelection();
+ }
+
+ public void refreshCheckedItems() {
+ if (getClasspathSelection() == null)
+ return;
+ java.util.List elements = getClasspathSelection().getClasspathElements();
+ for (int i = 0; i < elements.size(); i++) {
+ ClasspathElement element = (ClasspathElement) elements.get(i);
+ availableJARsViewer.setChecked(element, element.isSelected());
+ if (element.isClasspathDependency()) {
+ availableJARsViewer.setGrayed(element, true);
+ }
+ }
+ }
+
+ public void refresh() {
+ final IProject project = model.getComponent().getProject();
+ // if not a web project and it is either referenced by an EAR or a dynamic web project.
+ if (!isWLPEntry() && (!EarUtilities.isStandaloneProject(project) ||
+ (J2EEProjectUtilities.getReferencingWebProjects(project).length > 0))) {
+ availableJARsViewer.setInput(getClasspathSelection());
+ GridData data = new GridData(GridData.FILL_BOTH);
+ int numlines = Math.min(10, availableJARsViewer.getTable().getItemCount());
+ data.heightHint = availableJARsViewer.getTable().getItemHeight() * numlines;
+ availableJARsViewer.getTable().setLayoutData(data);
+ refreshCheckedItems();
+ updateButtonEnablements();
+ } else {
+ availableJARsViewer.setInput(model.getClassPathSelectionForWLPs());
+ GridData data = new GridData(GridData.FILL_BOTH);
+ int numlines = Math.min(10, availableJARsViewer.getTable().getItemCount());
+ data.heightHint = availableJARsViewer.getTable().getItemHeight() * numlines;
+ availableJARsViewer.getTable().setLayoutData(data);
+ refreshWLPCheckedItems();
+ }
+ }
+
+ private void refreshWLPCheckedItems() {
+ if (availableJARsViewer.getInput() != null) {
+ java.util.List elements = ((ClassPathSelection) availableJARsViewer.getInput()).getClasspathElements();
+ for (int i = 0; i < elements.size(); i++) {
+ ClasspathElement element = (ClasspathElement) elements.get(i);
+ availableJARsViewer.setChecked(element, element.isSelected());
+ if (element.isClasspathDependency()) {
+ availableJARsViewer.setGrayed(element, true);
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the model.
+ * @return Returns a ClasspathModel
+ */
+ public ClasspathModel getModel() {
+ return model;
+ }
+
+ /**
+ * Sets the model.
+ * @param model The model to set
+ */
+ public void setModel(ClasspathModel model) {
+ this.model = model;
+ initializeEJBClientDefaults();
+ }
+
+ /**
+ * Returns the readOnly.
+ * @return boolean
+ */
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+
+ /**
+ * Sets the readOnly.
+ * @param readOnly The readOnly to set
+ */
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ public boolean isWLPEntry() {
+ return model.isWLPModel();
+ }
+
+ /**
+ * @deprecated do not use this method
+ * @param isWLPEntry
+ */
+ public void setWLPEntry(boolean isWLPEntry) {
+ this.isWLPEntry = isWLPEntry;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IClasspathTableOwner.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IClasspathTableOwner.java
new file mode 100644
index 0000000..c2af1d1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IClasspathTableOwner.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * @author jialin
+ */
+public interface IClasspathTableOwner {
+ Button primCreatePushButton(String label, Composite buttonColumn);
+ Button primCreateRadioButton(String label, Composite parent);
+ CheckboxTableViewer createAvailableJARsViewer(Composite parent);
+ Composite createButtonColumnComposite(Composite parent);
+ //Button createHideEJBClientJARsButton(Composite parent); This method is never used hence commeting it out - vkb
+ Group createGroup(Composite parent);
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ICommonManifestUIConstants.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ICommonManifestUIConstants.java
new file mode 100644
index 0000000..a61619b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ICommonManifestUIConstants.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.jst.j2ee.internal.common.CommonEditResourceHandler;
+
+/**
+ * @author jialin
+ */
+public interface ICommonManifestUIConstants {
+ String UP_BUTTON = ManifestUIResourceHandler.Up_1;
+ String DOWN_BUTTON = ManifestUIResourceHandler.Down_2;
+ String SELECT_ALL_BUTTON = ManifestUIResourceHandler.Select_All_3;
+ String DE_SELECT_ALL_BUTTON = ManifestUIResourceHandler.Deselect_All_4;
+ String ERROR_READING_MANIFEST_DIALOG_TITLE = ManifestUIResourceHandler.ERROR_READING_MANIFEST_DIALOG_TITLE;
+ String SAVE_MANIFEST_WITH_ERROR =ManifestUIResourceHandler.SAVE_MANIFEST_WITH_ERROR;
+ String ERROR_READING_MANIFEST_DIALOG_MESSAGE_EDITOR = ManifestUIResourceHandler.ERROR_READING_MANIFEST_DIALOG_MESSAGE_EDITOR;
+ String ERROR_READING_MANIFEST_DIALOG_MESSAGE_PROP_PAGE = ManifestUIResourceHandler.ERROR_READING_MANIFEST_DIALOG_MESSAGE_PROP_PAGE;
+ String MANIFEST_PROBLEM_1 = ManifestUIResourceHandler.MANIFEST_PROBLEM_1;
+ String MANIFEST_PROBLEM_2 = ManifestUIResourceHandler.MANIFEST_PROBLEM_2;
+ String MANIFEST_PROBLEM_3 = ManifestUIResourceHandler.MANIFEST_PROBLEM_3;
+ String MANIFEST_PROBLEM_4 = ManifestUIResourceHandler.MANIFEST_PROBLEM_4;
+ String REDIRECT_TEXT_EDITOR_UI_ = ManifestUIResourceHandler.REDIRECT_TEXT_EDITOR_UI_;
+
+ String EJB_CLIENT_RADIO_UI_ = CommonEditResourceHandler.getString("EJB_CLIENT_RADIO_UI_"); //$NON-NLS-1$
+ String USE_EJB_SERVER_JARs_UI_ = CommonEditResourceHandler.getString("USE_EJB_SERVER_JARs_UI_"); //$NON-NLS-1$
+ String USE_EJB_CLIENT_JARs_UI_ = CommonEditResourceHandler.getString("USE_EJB_CLIENT_JARs_UI_"); //$NON-NLS-1$
+ String USE_BOTH_UI_ = CommonEditResourceHandler.getString("USE_BOTH_UI_"); //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IJ2EEDependenciesControl.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IJ2EEDependenciesControl.java
new file mode 100644
index 0000000..f88e6ce
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/IJ2EEDependenciesControl.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * rfrost@bea.com - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Interface for classes that implement a portion the "J2EE Module Dependencies"
+ * property page logic.
+ * @deprecated wtp 3.2
+ */
+public interface IJ2EEDependenciesControl extends ICommonManifestUIConstants {
+
+ /**
+ * Creates the Composite associated with this control.
+ * @param parent Parent Composite.
+ * @return Composite for the control.
+ */
+ Composite createContents(Composite parent);
+
+ /**
+ * Called when the property page's <code>performOk()</code> method is called.
+ * @return
+ */
+ boolean performOk();
+
+ /**
+ * Called when the property page's <code>performDefaults()</code> method is called.
+ * @return
+ */
+ void performDefaults();
+
+ /**
+ * Called when the property page's <code>performCancel()</code> method is called.
+ * @return
+ */
+ boolean performCancel();
+
+ /**
+ * Called when the property page's <code>setVisible()</code> method is called.
+ * @return
+ */
+ void setVisible(boolean visible);
+
+ /**
+ * Called when the property page's <code>dispose()</code> method is called.
+ * @return
+ */
+ void dispose();
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java
new file mode 100644
index 0000000..0b72e01
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java
@@ -0,0 +1,634 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.jst.common.frameworks.CommonFrameworksPlugin;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
+import org.eclipse.jst.common.project.facet.WtpUtils;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainerUtils;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.earcreation.EarFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.internal.ejb.project.operations.EjbFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.internal.ejb.project.operations.IEjbFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.jca.project.facet.ConnectorFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.project.facet.AppClientFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.project.facet.IAppClientFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.UtilityFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.INavigatorContentService;
+import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.componentcore.internal.ComponentType;
+import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
+import org.eclipse.wst.common.componentcore.internal.IComponentProjectMigrator;
+import org.eclipse.wst.common.componentcore.internal.Property;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.SimpleValidateEdit;
+import org.eclipse.wst.project.facet.SimpleWebFacetInstallDataModelProvider;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+
+/**
+ * This has been deprecated since WTP 3.1.2 and will be deleted post WTP 3.2.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=292934
+ * @deprecated
+ * @author jsholl
+ */
+public class J2EEComponentProjectMigrator implements IComponentProjectMigrator {
+
+ private static final String WEB_LIB_CONTAINER = "org.eclipse.jst.j2ee.internal.web.container"; //$NON-NLS-1$
+ private static final String WEB_LIB_PATH = "/WEB-INF/lib"; //$NON-NLS-1$
+ private static final String OLD_DEPLOYABLES_PATH = ".deployables"; //$NON-NLS-1$
+ private IProject project;
+
+ private static final String[] J2EE_CONTENT_EXTENSION_IDS = new String[] {
+ "org.eclipse.jst.navigator.j2ee.ui.EARDDContent", //$NON-NLS-1$
+ "org.eclipse.jst.navigator.j2ee.ui.WebDDContent", //$NON-NLS-1$
+ "org.eclipse.jst.navigator.j2ee.ui.EJBDDContent", //$NON-NLS-1$
+ "org.eclipse.jst.navigator.j2ee.ui.ConnectorDDContent" //$NON-NLS-1$
+ };
+
+ private static final String PROJECT_EXPLORER = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+
+ public J2EEComponentProjectMigrator() {
+ super();
+ }
+
+ public void migrateProject(IProject aProject) {
+ if (aProject.isAccessible() && (aProject.getFile(StructureEdit.MODULE_META_FILE_NAME).exists())) {
+ // The file corresponding to StructureEdit.MODULE_META_FILE_NAME is crucial to migration.
+ // If it does not exist, the project cannot be migrated. We should never fail the test for existence
+ // of the file, if we do then something has gone badly wrong.
+ Resource resource = WorkbenchResourceHelperBase.getResource(aProject.getFile(StructureEdit.MODULE_META_FILE_NAME), false);
+ if(resource != null && resource.isLoaded()){
+ // Unload the resource because the model inside the StructureEdit was cached when the
+ // the project was imported, and files may have moved due to migration (.wtpmodules for example).
+ resource.unload();
+ }
+
+ final List files = new ArrayList();
+ files.add(aProject.getFile(J2EEProjectUtilities.DOT_PROJECT));
+ files.add(aProject.getFile(J2EEProjectUtilities.DOT_CLASSPATH));
+ files.add(aProject.getFile(StructureEdit.MODULE_META_FILE_NAME));
+ if(SimpleValidateEdit.validateEdit(files)){
+ project = aProject;
+
+ removeComponentBuilders(project);
+ if (multipleComponentsDetected())
+ createNewProjects();
+ String facetid = getFacetFromProject(project);
+ if (facetid.length() == 0)
+ addFacets(project);
+ J2EEComponentClasspathUpdater.getInstance().queueUpdate(project);
+ }
+ }
+ ensureJ2EEContentExtensionsEnabled();
+ }
+
+ /**
+ * Ensure the J2EE content extension ids are enabled on the project explorer
+ * for the projects being migrated.
+ */
+ private void ensureJ2EEContentExtensionsEnabled() {
+ IViewPart view = null;
+ try {
+ view = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().findView(PROJECT_EXPLORER);
+ } catch (Exception e) {
+ //Just bail and return if there is no view
+ }
+ if (view == null)
+ return;
+
+ INavigatorContentService contentService = (INavigatorContentService) view.getAdapter(INavigatorContentService.class);
+ CommonViewer viewer = (CommonViewer) view.getAdapter(CommonViewer.class);
+
+ // Set the J2EE content extensions as enabled now that we have set the J2EE facets
+ if (contentService != null)
+ contentService.getActivationService().activateExtensions(J2EE_CONTENT_EXTENSION_IDS, false);
+
+ // Update the viewer if we are in the current UI thread
+ if (viewer != null) {
+ Display display = viewer.getControl().getDisplay();
+ if (display!=null && Thread.currentThread().equals(display.getThread()))
+ viewer.refresh();
+ }
+ }
+
+ private void createNewProjects() {
+
+ StructureEdit se = null;
+ try {
+ se = StructureEdit.getStructureEditForWrite(project);
+ List comps = se.getComponentModelRoot().getComponents();
+ List removedComps = new ArrayList();
+ for (int i = 1;i<comps.size();i++) {
+ WorkbenchComponent comp = (WorkbenchComponent) comps.get(i);
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ IProject newProj = ws.getRoot().getProject(comp.getName());
+ if (!newProj.exists()) {
+ try {
+ createProj(newProj,(!comp.getComponentType().getComponentTypeId().equals(J2EEProjectUtilities.ENTERPRISE_APPLICATION)));
+ WtpUtils.addNatures(newProj);
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ if (comp.getComponentType()!=null)
+ addFacetsToProject(newProj,comp.getComponentType().getComponentTypeId(),comp.getComponentType().getVersion(),false);
+ removedComps.add(comp);
+ IFolder compFolder = project.getFolder(comp.getName());
+ if (compFolder.exists())
+ try {
+ compFolder.delete(true,null);
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ se.getComponentModelRoot().getComponents().removeAll(removedComps);
+ se.save(null);
+
+ } finally {
+ if (se != null)
+ se.dispose();
+ }
+
+
+ }
+
+ private void createProj(IProject newProj, boolean isJavaProject) throws CoreException {
+ newProj.create(null);
+ IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(newProj.getName());
+// if (isJavaProject)
+// description.setNatureIds(new String[]{JavaCore.NATURE_ID});
+ description.setLocation(null);
+ newProj.open(null);
+ newProj.setDescription(description, null);
+ }
+
+ private boolean multipleComponentsDetected() {
+ StructureEdit se = null;
+ try {
+ se = StructureEdit.getStructureEditForRead(project);
+ if (se == null) return false;
+ if (se.getComponentModelRoot() == null) return false;
+ return se.getComponentModelRoot().getComponents().size() > 1;
+ } finally {
+ if (se != null)
+ se.dispose();
+ }
+ }
+
+ private void removeComponentBuilders(IProject aProject) {
+ try {
+ aProject.refreshLocal(IResource.DEPTH_INFINITE,null);
+ } catch (CoreException e1) {
+ J2EEUIPlugin.logError(e1);
+ }
+ //IJavaProject javaP = JemProjectUtilities.getJavaProject(aProject);
+ List oldBuilders = new ArrayList();
+ oldBuilders.add("org.eclipse.wst.common.modulecore.ComponentStructuralBuilder"); //$NON-NLS-1$
+ oldBuilders.add("org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver"); //$NON-NLS-1$
+ oldBuilders.add("org.eclipse.wst.common.modulecore.DependencyGraphBuilder"); //$NON-NLS-1$
+ try {
+ J2EEProjectUtilities.removeBuilders(aProject,oldBuilders);
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+
+ public String getFacetFromProject(IProject aProject) {
+ return J2EEProjectUtilities.getJ2EEProjectType(aProject);
+ }
+
+
+ protected IDataModel setupJavaInstallAction(IProject aProject, boolean existing,String srcFolder) {
+ IDataModel dm = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
+ dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ String jVersion = "1.4"; //$NON-NLS-1$
+ IScopeContext context = new ProjectScope( project );
+ IEclipsePreferences prefs
+ = context.getNode( JavaCore.PLUGIN_ID );
+ if (JavaCore.VERSION_1_5.equals(prefs.get(JavaCore.COMPILER_COMPLIANCE,JavaCore.VERSION_1_4))) {
+ jVersion = "5.0"; //$NON-NLS-1$
+ }
+ dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, jVersion);
+ if (!existing)
+ dm.setStringProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, srcFolder);
+ return dm;
+ }
+
+ protected IDataModel setupUtilInstallAction(IProject aProject,String specVersion) {
+ IDataModel aFacetInstallDataModel = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, specVersion);
+ aFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,false);
+ aFacetInstallDataModel.setStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,null);
+ return aFacetInstallDataModel;
+ }
+ protected IDataModel setupEarInstallAction(IProject aProject,String specVersion) {
+ IDataModel earFacetInstallDataModel = DataModelFactory.createDataModel(new EarFacetInstallDataModelProvider());
+ earFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ earFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, specVersion);
+
+ return earFacetInstallDataModel;
+ }
+ protected IDataModel setupAppClientInstallAction(IProject aProject,String specVersion) {
+ IDataModel aFacetInstallDataModel = DataModelFactory.createDataModel(new AppClientFacetInstallDataModelProvider());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, specVersion);
+ aFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,false);
+ aFacetInstallDataModel.setStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,null);
+ aFacetInstallDataModel.setBooleanProperty(IAppClientFacetInstallDataModelProperties.CREATE_DEFAULT_MAIN_CLASS,false);
+ return aFacetInstallDataModel;
+ }
+ protected IDataModel setupConnectorInstallAction(IProject aProject,String specVersion) {
+ IDataModel aFacetInstallDataModel = DataModelFactory.createDataModel(new ConnectorFacetInstallDataModelProvider());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ aFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, specVersion);
+ aFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,false);
+ aFacetInstallDataModel.setStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,null);
+ return aFacetInstallDataModel;
+ }
+
+ private void addFacets(IProject aProject) {
+ StructureEdit edit = null;
+ try {
+ edit = StructureEdit.getStructureEditForWrite(aProject);
+ if (edit == null) return; // Not a component project....
+ edit.getModuleStructuralModel().setUseOldFormat(true);
+ if (edit.getComponent() == null) return; // Can't migrate
+ ComponentType type = edit.getComponent().getComponentType();
+ if (type == null) return; // Can't migrate
+ String compId = type.getComponentTypeId();
+ String specVersion = edit.getComponent().getComponentType().getVersion();
+ moveMetaProperties(edit.getComponent(),type);
+ addFacetsToProject(aProject, compId, specVersion,true);
+ }
+ finally {
+ if (edit != null) {
+ edit.save(null);
+ edit.getModuleStructuralModel().setUseOldFormat(false);
+ edit.dispose();
+ }
+ }
+
+ }
+
+ private void moveMetaProperties(WorkbenchComponent component, ComponentType type) {
+ List props = type.getProperties();
+ List compProps = component.getProperties();
+ for (Iterator iter = props.iterator(); iter.hasNext();) {
+ Property element = (Property) iter.next();
+ Property newProp = ComponentcoreFactory.eINSTANCE.createProperty();
+ newProp.setName(element.getName());
+ newProp.setValue(element.getValue());
+ compProps.add(newProp);
+ }
+ props.clear();
+ }
+
+ private void addFacetsToProject(IProject aProject, String compId, String specVersion,boolean existing) {
+ if (compId.equals(J2EEProjectUtilities.DYNAMIC_WEB))
+ installWEBFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.EJB))
+ installEJBFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.APPLICATION_CLIENT))
+ installAppClientFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.ENTERPRISE_APPLICATION))
+ installEARFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.JCA))
+ installConnectorFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.UTILITY))
+ installUtilityFacets(aProject,specVersion,existing);
+ else if (compId.equals(J2EEProjectUtilities.STATIC_WEB))
+ installStaticWebFacets(aProject,specVersion,existing);
+ }
+
+ private void installStaticWebFacets(IProject project2, String specVersion, boolean existing) {
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, project2.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ //facetDMs.add(setupJavaInstallAction(webProj,existing,CreationConstants.DEFAULT_WEB_SOURCE_FOLDER));
+ IDataModel newModel = setupStaticWebInstallAction(project2);
+ facetDMs.add(newModel);
+ //setRuntime(webProj,dm); //Setting runtime property
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+ }
+
+ private IDataModel setupStaticWebInstallAction(IProject project2) {
+ IDataModel webFacetInstallDataModel = DataModelFactory.createDataModel(new SimpleWebFacetInstallDataModelProvider());
+ webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, project2.getName());
+ webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$
+
+ return webFacetInstallDataModel;
+ }
+
+ private void installUtilityFacets(IProject aProject, String specVersion, boolean existing) {
+ replaceDeployablesOutputIfNecessary(project);
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ facetDMs.add(setupJavaInstallAction(aProject,existing,"src")); //$NON-NLS-1$
+ IDataModel newModel = setupUtilInstallAction(aProject,specVersion);
+ facetDMs.add(newModel);
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+
+ }
+
+ private void installConnectorFacets(IProject aProject, String specVersion, boolean existing) {
+ replaceDeployablesOutputIfNecessary(project);
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ facetDMs.add(setupJavaInstallAction(aProject,existing,J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.JCA_CONTENT_FOLDER)));
+ IDataModel newModel = setupConnectorInstallAction(aProject,specVersion);
+ facetDMs.add(newModel);
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+
+ }
+
+ private void installEARFacets(IProject aProject, String specVersion, boolean existing) {
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel newModel = setupEarInstallAction(aProject,specVersion);
+ facetDMs.add(newModel);
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+
+ }
+
+ private void installAppClientFacets(IProject aProject, String specVersion, boolean existing) {
+ replaceDeployablesOutputIfNecessary(project);
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ facetDMs.add(setupJavaInstallAction(aProject,existing,J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.APP_CLIENT_CONTENT_FOLDER)));
+ IDataModel newModel = setupAppClientInstallAction(aProject,specVersion);
+ facetDMs.add(newModel);
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+
+ }
+
+ private void installEJBFacets(IProject ejbProject2,String ejbVersion, boolean existing) {
+ replaceDeployablesOutputIfNecessary(project);
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, ejbProject2.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ facetDMs.add(setupJavaInstallAction(ejbProject2,existing,J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.EJB_CONTENT_FOLDER)));
+ IDataModel newModel = setupEjbInstallAction(ejbProject2,ejbVersion,existing);
+ facetDMs.add(newModel);
+ //setRuntime(ejbProject2,dm); //Setting runtime property
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ }
+
+ }
+ private void installWEBFacets(IProject webProj,String specVersion, boolean existing) {
+ removeOldWebContainerIfNecessary(project);
+ replaceDeployablesOutputIfNecessary(project);
+
+ IDataModel dm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, webProj.getName());
+ FacetDataModelMap facetDMs = (FacetDataModelMap) dm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ facetDMs.add(setupJavaInstallAction(webProj,existing, CommonFrameworksPlugin.getDefault().getPluginPreferences().getString(CommonFrameworksPlugin.DEFAULT_SOURCE_FOLDER)));
+ IDataModel newModel = setupWebInstallAction(webProj,specVersion);
+ facetDMs.add(newModel);
+ //setRuntime(webProj,dm); //Setting runtime property
+ try {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ //IStatus stat = dm.getDefaultOperation().execute(null,null);
+ dm.getDefaultOperation().execute(null,null);
+ } catch (ExecutionException e) {
+ Throwable realException = e.getCause();
+ if (realException != null && realException instanceof CoreException) {
+ IStatus st = ((CoreException)realException).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, realException);
+ }
+ } catch (Exception ex) {
+ if (ex instanceof CoreException) {
+ IStatus st = ((CoreException)ex).getStatus();
+ String message = st != null ? st.toString() : ""; //$NON-NLS-1$
+ J2EEUIPlugin.logError(message, ex);
+ }
+ }
+
+
+ }
+ private void replaceDeployablesOutputIfNecessary(IProject proj) {
+
+
+ IJavaProject jproj = JemProjectUtilities.getJavaProject(proj);
+ final IClasspathEntry[] current;
+ boolean deployablesFound = false;
+ try {
+ current = jproj.getRawClasspath();
+ List updatedList = new ArrayList();
+ IPath sourcePath = null;
+ for (int i = 0; i < current.length; i++) {
+ IClasspathEntry entry = current[i];
+ if ((entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) && (entry.getOutputLocation() != null && entry.getOutputLocation().toString().indexOf(OLD_DEPLOYABLES_PATH) != -1)) {
+ sourcePath = entry.getPath();
+ updatedList.add(JavaCore.newSourceEntry(sourcePath));
+ deployablesFound = true;
+ }
+ else
+ updatedList.add(entry);
+ }
+ if (deployablesFound) {
+ IClasspathEntry[] updated = (IClasspathEntry[])updatedList.toArray(new IClasspathEntry[updatedList.size()]);
+ jproj.setRawClasspath(updated, null);
+ jproj.save(null, true);
+ }
+ } catch (JavaModelException e) {
+ J2EEUIPlugin.logError(e);
+ }
+
+
+
+ }
+
+ private void removeOldWebContainerIfNecessary(IProject webProj) {
+
+ IJavaProject jproj = JemProjectUtilities.getJavaProject(webProj);
+ final IClasspathEntry[] current;
+ try {
+ current = jproj.getRawClasspath();
+ List updatedList = new ArrayList();
+ boolean useDefaultWebAppLibraries = J2EEComponentClasspathContainerUtils.getDefaultUseWebAppLibraries();
+ for (int i = 0; i < current.length; i++) {
+ IClasspathEntry entry = current[i];
+ // the web container is added to the classpath if:
+ // 1. they don't have an entry for WEB_LIB_CONTAINER AND
+ // 2. they have an entry for WEB_LIB_PATH BUT
+ // they do not have the preference checked to use the Web App classpath container
+ if ((entry.getPath().toString().indexOf(WEB_LIB_CONTAINER) == -1) &&
+ ((entry.getPath().toString().indexOf(WEB_LIB_PATH) == -1) || !useDefaultWebAppLibraries))
+ updatedList.add(entry);
+ }
+ IClasspathEntry[] updated = (IClasspathEntry[])updatedList.toArray(new IClasspathEntry[updatedList.size()]);
+ jproj.setRawClasspath(updated, null);
+ jproj.save(null, true);
+ } catch (JavaModelException e) {
+ J2EEUIPlugin.logError(e);
+ }
+
+ }
+
+ protected IRuntime getRuntimeByID(String id) {
+ IRuntime[] targets = ServerUtil.getRuntimes("", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < targets.length; i++) {
+ IRuntime target = targets[i];
+ if (id.equals(target.getId()))
+ return target;
+ }
+ return null;
+ }
+
+ protected IDataModel setupEjbInstallAction(IProject aProject,String ejbVersion, boolean existing) {
+ IDataModel ejbFacetInstallDataModel = DataModelFactory.createDataModel(new EjbFacetInstallDataModelProvider());
+ ejbFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ ejbFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, ejbVersion);
+ ejbFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,false);
+ ejbFacetInstallDataModel.setStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,null);
+ if (!existing)
+ ejbFacetInstallDataModel.setProperty(IEjbFacetInstallDataModelProperties.CONFIG_FOLDER, J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.EJB_CONTENT_FOLDER));
+ return ejbFacetInstallDataModel;
+ }
+
+ protected IDataModel setupWebInstallAction(IProject aProject,String specVersion) {
+ IDataModel webFacetInstallDataModel = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
+ webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, aProject.getName());
+ webFacetInstallDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, specVersion);
+ webFacetInstallDataModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,false);
+ webFacetInstallDataModel.setStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,null);
+ return webFacetInstallDataModel;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEDependenciesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEDependenciesPage.java
new file mode 100644
index 0000000..d95c6d1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEDependenciesPage.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial implementation as prop page heirarchy
+ * rfrost@bea.com - conversion to single property page impl
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * Primary project property page for J2EE dependencies; content is dynamically
+ * generated based on the project facets and will be comprised by a
+ * set of IJ2EEDependenciesControl implementations.
+ *
+ */
+public class J2EEDependenciesPage extends PropertyPage {
+
+ public String DESCRIPTION = J2EEUIMessages.getResourceString("DESCRIPTION"); //$NON-NLS-1$
+
+ private IProject project;
+ private IJ2EEDependenciesControl[] controls = new IJ2EEDependenciesControl[0];
+
+ public J2EEDependenciesPage() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+
+ // Need to find out what type of project we are handling
+ project = (IProject) getElement().getAdapter(IResource.class);
+ boolean isEAR = false;
+ boolean isWEB = false;
+ try {
+ final IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if (facetedProject == null) {
+ return getFacetErrorComposite(parent);
+ }
+ isEAR = facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE));
+ isWEB = facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE));
+ } catch (CoreException ce) {
+ return getFacetErrorComposite(parent);
+ }
+
+ if (isEAR) {
+ return createEARContent(parent);
+ } else if (isWEB) {
+ return createWebContent(parent);
+ } else {
+ return createNonEARContent(parent);
+ }
+ }
+
+ private Composite getFacetErrorComposite(final Composite parent) {
+ final String errorCheckingFacet = ManifestUIResourceHandler.Error_Checking_Project_Facets;
+ setErrorMessage(errorCheckingFacet);
+ setValid(false);
+ return getErrorComposite(parent, errorCheckingFacet);
+ }
+
+ private Composite getErrorComposite(final Composite parent, final String error) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final Label label= new Label(composite, SWT.NONE);
+ label.setText(error);
+ return composite;
+ }
+
+ private Composite createEARContent(final Composite parent) {
+ controls = new IJ2EEDependenciesControl[1];
+ controls[0] = new AddModulestoEARPropertiesPage(project, this);
+ return controls[0].createContents(parent);
+ }
+
+ private Composite createWebContent(final Composite parent) {
+ final boolean standalone = EarUtilities.isStandaloneProject(project);
+
+ if (standalone) {
+ // only need to create the Web Libraries page
+ controls = new IJ2EEDependenciesControl[1];
+ controls[0] = new WebLibDependencyPropertiesPage(project, this);
+ return controls[0].createContents(parent);
+ }
+ // Create a tabbed folder with both "J2EE Modules" and "Web Libraries"
+ final TabFolder folder = new TabFolder(parent, SWT.LEFT);
+ folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ folder.setFont(parent.getFont());
+
+ // Create the two tabs
+ controls = new IJ2EEDependenciesControl[2];
+
+ controls[0] = new JARDependencyPropertiesPage(project, this);
+ TabItem tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(controls[0].createContents(folder));
+ tab.setText(ManifestUIResourceHandler.J2EE_Modules);
+ controls[1] = new WebLibDependencyPropertiesPage(project, this);
+ tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(controls[1].createContents(folder));
+ tab.setText(ManifestUIResourceHandler.Web_Libraries);
+
+ folder.setSelection(0);
+ return folder;
+ }
+
+ private Composite createNonEARContent(final Composite parent) {
+ controls = new IJ2EEDependenciesControl[1];
+ final boolean standalone = EarUtilities.isStandaloneProject(project);
+ if (standalone) {
+ // if not referenced by an EAR, check if referenced by a dynamic web project
+ if (J2EEProjectUtilities.getReferencingWebProjects(project).length > 0) {
+ controls[0] = new WebRefDependencyPropertiesPage(project, this);
+ } else {
+ return getUnreferencedErrorComposite(parent);
+ }
+ } else {
+ controls[0] = new JARDependencyPropertiesPage(project, this);
+ }
+
+ return controls[0].createContents(parent);
+ }
+
+ private Composite getUnreferencedErrorComposite(final Composite parent) {
+ final String msg = ManifestUIResourceHandler.Unreferenced_Module_Error;
+ setErrorMessage(msg);
+ return getErrorComposite(parent, msg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performOk()) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ @Override
+ public void performDefaults() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].performDefaults();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
+ */
+ @Override
+ public boolean performCancel() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performCancel()) {
+ return false;
+ }
+ }
+ }
+ return super.performCancel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].setVisible(visible);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ for (int i = 0; i < controls.length; i++) {
+ if(controls[i] != null){
+ controls[i].dispose();
+ }
+ }
+ }
+
+ protected static void createDescriptionComposite(final Composite parent, final String description) {
+ Composite descriptionComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ descriptionComp.setLayout(layout);
+ descriptionComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fillDescription(descriptionComp, description);
+ }
+
+ private static void fillDescription(Composite c, String s) {
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 250;
+ Text text = new Text(c, SWT.READ_ONLY | SWT.WRAP);
+ text.setLayoutData(data);
+ text.setText(s);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEPropertiesConstants.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEPropertiesConstants.java
new file mode 100644
index 0000000..ddfb3ee
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEPropertiesConstants.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Apr 8, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+
+/**
+ * @author vijayb
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public interface J2EEPropertiesConstants {
+ //J2EEUIMessages.getResourceString("Import_Classes");
+ public String J2EE_LEVEL = J2EEUIMessages.getResourceString("J2EE_Level"); //$NON-NLS-1$
+ public String J2EE_12 = J2EEUIMessages.getResourceString("J2EE_12"); //$NON-NLS-1$
+ public String J2EE_12_DESCRIPTION = J2EEUIMessages.getResourceString("J2EE_12_DESCRIPTION"); //$NON-NLS-1$
+ public String J2EE_13 = J2EEUIMessages.getResourceString("J2EE_13"); //$NON-NLS-1$
+ public String J2EE_13_DESCRIPTION = J2EEUIMessages.getResourceString("J2EE_13_DESCRIPTION"); //$NON-NLS-1$
+ public String J2EE_14_DESCRIPTION = J2EEUIMessages.getResourceString("J2EE_14_DESCRIPTION"); //$NON-NLS-1$
+ public String EJB_LEVEL = J2EEUIMessages.getResourceString("EJB_LEVEL"); //$NON-NLS-1$
+ public String EJB_11 = J2EEUIMessages.getResourceString("EJB_11"); //$NON-NLS-1$
+ public String EJB_11_DESCRIPTION = J2EEUIMessages.getResourceString("EJB_11_DESCRIPTION"); //$NON-NLS-1$
+ public String EJB_20 = J2EEUIMessages.getResourceString("EJB_20"); //$NON-NLS-1$
+ public String EJB_20_DESCRIPTION = J2EEUIMessages.getResourceString("EJB_20_DESCRIPTION"); //$NON-NLS-1$
+ public String EJB_21_DESCRIPTION = J2EEUIMessages.getResourceString("EJB_21_DESCRIPTION"); //$NON-NLS-1$
+ public String CONNECTOR_LEVEL = J2EEUIMessages.getResourceString("CONNECTOR_LEVEL"); //$NON-NLS-1$
+ public String CONNECTOR_10 = J2EEUIMessages.getResourceString("CONNECTOR_10"); //$NON-NLS-1$
+ public String CONNECTOR_15 = J2EEUIMessages.getResourceString("CONNECTOR_15"); //$NON-NLS-1$
+ public String CONNECTOR_10_DESCRIPTION = J2EEUIMessages.getResourceString("CONNECTOR_10_DESCRIPTION"); //$NON-NLS-1$
+ public String CONNECTOR_15_DESCRIPTION = J2EEUIMessages.getResourceString("CONNECTOR_15_DESCRIPTION"); //$NON-NLS-1$
+ public String WEB_LEVEL = J2EEUIMessages.getResourceString("WEB_LEVEL"); //$NON-NLS-1$
+ public String WEB_22_DESCRIPTION = J2EEUIMessages.getResourceString("WEB_22_DESCRIPTION"); //$NON-NLS-1$
+ public String WEB_23_DESCRIPTION = J2EEUIMessages.getResourceString("WEB_23_DESCRIPTION"); //$NON-NLS-1$
+ public String WEB_24_DESCRIPTION = J2EEUIMessages.getResourceString("WEB_24_DESCRIPTION"); //$NON-NLS-1$
+ public String APP_CLIENT_LEVEL = J2EEUIMessages.getResourceString("APP_CLIENT_LEVEL"); //$NON-NLS-1$
+ public String APP_CLIENT_12_DESCRIPTION = J2EEUIMessages.getResourceString("APP_CLIENT_12_DESCRIPTION"); //$NON-NLS-1$
+ public String APP_CLIENT_13_DESCRIPTION = J2EEUIMessages.getResourceString("APP_CLIENT_13_DESCRIPTION"); //$NON-NLS-1$
+ public String APP_CLIENT_14_DESCRIPTION = J2EEUIMessages.getResourceString("APP_CLIENT_14_DESCRIPTION"); //$NON-NLS-1$
+ public String DESCRIPTION = J2EEUIMessages.getResourceString("DESCRIPTION"); //$NON-NLS-1$
+ public String WEB_CONTEXT_ROOT = J2EEUIMessages.getResourceString("WEB_CONTEXT_ROOT"); //$NON-NLS-1$
+ public String WEB_CONTENT_FOLDER_NAME = J2EEUIMessages.getResourceString("WEB_CONTENT_FOLDER_NAME"); //$NON-NLS-1$
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java
new file mode 100644
index 0000000..d42c66f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java
@@ -0,0 +1,1101 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ * Stefan Dimov, stefan.dimov@sap.com - bug 207826
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.Manifest;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
+import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
+import org.eclipse.jst.j2ee.application.internal.operations.RemoveComponentFromEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProperties;
+import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProvider;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.classpathdep.UpdateClasspathAttributeUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants.DependencyAttributeType;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent;
+import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModel;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModelEvent;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModelListener;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.listeners.IValidateEditListener;
+import org.eclipse.jst.j2ee.internal.listeners.ValidateEditListener;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.javaee.application.Application;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.UnresolveableURIException;
+import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.builder.IDependencyGraph;
+import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
+import org.eclipse.wst.common.componentcore.internal.operation.RemoveReferenceComponentsDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
+import org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation;
+
+/**
+ * @author jialin
+ * @deprecated wtp 3.2
+ */
+public class JARDependencyPropertiesPage implements IJ2EEDependenciesControl, IClasspathTableOwner, Listener, ClasspathModelListener, IElementChangedListener {
+
+ protected final IProject project;
+ protected final J2EEDependenciesPage propPage;
+ protected IOException caughtManifestException;
+ protected boolean isDirty;
+ protected Text classPathText;
+ protected Text componentNameText;
+ protected ClasspathModel model;
+ protected CCombo availableAppsCombo;
+ protected ClasspathTableManager tableManager;
+ protected IValidateEditListener validateEditListener;
+ protected Label manifestLabel;
+ protected Label enterpriseApplicationLabel;
+ protected Label availableDependentJars;
+ private final Display display;
+ private boolean isDisposed = false;
+
+ /**
+ * Constructor for JARDependencyPropertiesControl
+ */
+ public JARDependencyPropertiesPage(final IProject project, final J2EEDependenciesPage page) {
+ super();
+ J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
+ this.project = project;
+ this.propPage = page;
+ this.display = propPage.getShell().getDisplay();
+ }
+
+ /**
+ * Returns false if page should not be displayed for the project.
+ */
+ protected void initialize() {
+ model = createClasspathModel();
+ model.setProject(project);
+ if (model.getComponent() != null) {
+ model.addListener(this);
+ updateModelManifest();
+ initializeValidateEditListener();
+ }
+ }
+
+ protected ClasspathModel createClasspathModel(){
+ return new ClasspathModel(J2EEProjectUtilities.readManifest(project), false);
+ }
+
+ public void dispose() {
+ isDisposed = true;
+ JavaCore.removeElementChangedListener(this);
+ J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
+ }
+
+ private void updateModelManifest() {
+ if (JemProjectUtilities.isBinaryProject(project) || model.getAvailableEARComponents().length == 0)
+ return;
+
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component != null){
+ IVirtualFile vManifest = component.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI));
+ if(vManifest.exists()){
+ IFile iManifest = vManifest.getUnderlyingFile();
+ if(iManifest != null && iManifest.exists()){
+ InputStream in = null;
+ try {
+ in = iManifest.getContents();
+ ArchiveManifest mf = new ArchiveManifestImpl(new Manifest(in));
+ model.primSetManifest(mf);
+ } catch (CoreException e) {
+ Logger.getLogger().logError(e);
+ model.primSetManifest(new ArchiveManifestImpl());
+ } catch (IOException iox) {
+ Logger.getLogger().logError(iox);
+ model.primSetManifest(new ArchiveManifestImpl());
+ caughtManifestException = iox;
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException weTried) {
+ // Ignore
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ protected void initializeValidateEditListener() {
+ validateEditListener = new ValidateEditListener(null, model);
+ validateEditListener.setShell(propPage.getShell());
+ }
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ if (caughtManifestException != null && !model.isDirty()) {
+ ManifestErrorPrompter.showManifestException(propPage.getShell(), ERROR_READING_MANIFEST_DIALOG_MESSAGE_PROP_PAGE, false, caughtManifestException);
+ }
+ }
+ }
+
+ /**
+ * Refreshes the ClasspathModel if the project classpath is changed.
+ */
+ public void elementChanged(final ElementChangedEvent event) {
+ if (event.getType() == ElementChangedEvent.POST_CHANGE && classpathChanged(event.getDelta())) {
+ // trigger a recomputation and refresh for the currently selected EAR
+ if (!isDisposed) {
+ display.asyncExec (new Runnable () {
+ public void run () {
+ if (!isDisposed) {
+ handleClasspathChange();
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Called to refresh the UI when the classpath changes
+ */
+ protected void handleClasspathChange() {
+ model.resetClassPathSelection();
+ refresh();
+ }
+
+ private boolean classpathChanged(final IJavaElementDelta delta) {
+ final int kind = delta.getKind();
+ if (kind == IJavaElementDelta.CHANGED) {
+ final int flags = delta.getFlags();
+ final IJavaElement element = delta.getElement();
+ if (element instanceof IJavaModel) {
+ if ((flags & IJavaElementDelta.F_CHILDREN) == IJavaElementDelta.F_CHILDREN) {
+ final IJavaElementDelta[] children = delta.getChangedChildren();
+ for (int i = 0; i < children.length; i++) {
+ // check all of the IJavaProject children
+ if (classpathChanged(children[i])) {
+ return true;
+ }
+ }
+ }
+ } else if (element instanceof IJavaProject) {
+ // check if we either have a direct indication of a classpath change or a delta on the
+ // .classpath file (changes to classpath entry attributes only give us this...)
+ final IJavaProject jproject = (IJavaProject) element;
+ final IProject eventProject = jproject.getProject();
+ if (eventProject.equals(project)) {
+ if ((flags & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0) {
+ return true;
+ }
+ final IResourceDelta[] deltas = delta.getResourceDeltas();
+ if (deltas != null) {
+ for (int i = 0; i < deltas.length; i++) {
+ if (deltas[i].getProjectRelativePath().toString().equals(".classpath")) { //$NON-NLS-1$
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public Composite createContents(Composite parent) {
+ initialize();
+ Composite composite = createBasicComposite(parent);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ if (model.getComponent() != null) {
+ if (!isValidComponent())
+ return composite;
+ J2EEDependenciesPage.createDescriptionComposite(composite, ManifestUIResourceHandler.J2EE_Modules_Desc);
+ createProjectLabelsGroup(composite);
+ createListGroup(composite);
+ createTextGroup(composite);
+ refresh();
+ }
+ Dialog.applyDialogFont(parent);
+ postCreateContents();
+ return composite;
+ }
+
+ /**
+ * Called at the end of createContents().
+ */
+ protected void postCreateContents() {
+ // register this object as an IElementChangedListener so that it will react to user changes to the Java build path
+ JavaCore.addElementChangedListener(this);
+ }
+
+ /**
+ * @param comp
+ * @return
+ */
+ protected Composite createBasicComposite(Composite comp) {
+ Composite composite = new Composite(comp, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return composite;
+ }
+
+ protected boolean isValidComponent() {
+ if (JavaEEProjectUtilities.isEARProject(project)) {
+ propPage.setErrorMessage(ManifestUIResourceHandler.EAR_Module_Dep_Error);
+ return false;
+ } else if (EarUtilities.isStandaloneProject(model.getComponent().getProject())) {
+ propPage.setErrorMessage(ClasspathModel.NO_EAR_MESSAGE);
+ return false;
+ }
+ return true;
+ }
+
+ protected void createProjectLabelsGroup(Composite parent) {
+
+ Composite labelsGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ labelsGroup.setLayout(layout);
+ labelsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ /*
+ * Label label = new Label(labelsGroup, SWT.NONE);
+ * label.setText(ManifestUIResourceHandler.Project_name__UI_);
+ *
+ * componentNameText = new Text(labelsGroup, SWT.BORDER); GridData data = new
+ * GridData(GridData.FILL_HORIZONTAL); componentNameText.setEditable(false);
+ * componentNameText.setLayoutData(data); componentNameText.setText(project.getName());
+ */
+
+ createEnterpriseAppsControls(labelsGroup);
+
+ }
+
+ private void createEnterpriseAppsControls(Composite labelsGroup) {
+
+ enterpriseApplicationLabel = new Label(labelsGroup, SWT.NONE);
+ enterpriseApplicationLabel.setText(ManifestUIResourceHandler.EAR_Project_Name__UI__UI_);
+
+ availableAppsCombo = new CCombo(labelsGroup, SWT.READ_ONLY | SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ availableAppsCombo.setLayoutData(gd);
+
+ availableAppsCombo.addListener(SWT.Selection, this);
+
+ }
+
+ protected void createListGroup(Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ listGroup.setLayout(layout);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalIndent = 5;
+ listGroup.setLayoutData(gData);
+
+ availableDependentJars = new Label(listGroup, SWT.NONE);
+ gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ availableDependentJars.setText(ManifestUIResourceHandler.Available_dependent_JARs__UI_);
+ availableDependentJars.setLayoutData(gData);
+ createTableComposite(listGroup);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.ibm.etools.j2ee.common.ui.classpath.IClasspathTableOwner#createGroup(org.eclipse.swt.widgets.Composite)
+ */
+ public Group createGroup(Composite parent) {
+ return new Group(parent, SWT.NULL);
+ }
+
+ protected void createTextGroup(Composite parent) {
+
+ Composite textGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ textGroup.setLayout(layout);
+ textGroup.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL));
+
+ createClassPathText(textGroup);
+
+ }
+
+ protected void createClassPathText(Composite textGroup) {
+
+ manifestLabel = new Label(textGroup, SWT.NONE);
+ manifestLabel.setText(ManifestUIResourceHandler.Manifest_Class_Path__UI_);
+
+ classPathText = new Text(textGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.widthHint = 400;
+ gData.heightHint = 100;
+ classPathText.setLayoutData(gData);
+ classPathText.setEditable(false);
+ }
+
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ tableManager = new ClasspathTableManager(this, model, validateEditListener);
+ tableManager.fillComposite(composite);
+ }
+
+ /**
+ * @see IClasspathTableOwner#createAvailableJARsViewer(Composite)
+ */
+ public CheckboxTableViewer createAvailableJARsViewer(Composite parent) {
+ int flags = SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
+
+ Table table = new Table(parent, flags);
+ CheckboxTableViewer availableJARsViewer = new CheckboxTableViewer(table);
+
+ // set up table layout
+ TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ table.setLayout(tableLayout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ // do not create sorter otherwise order will go wrong
+ //availableJARsViewer.setSorter(new ViewerSorter());
+
+ // table columns
+ TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
+ fileNameColumn.setText(ManifestUIResourceHandler.JAR_Module_UI_);
+ fileNameColumn.setResizable(true);
+
+ TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
+ projectColumn.setText(ManifestUIResourceHandler.Project_UI_);
+ projectColumn.setResizable(true);
+ tableLayout.layout(table, true);
+ return availableJARsViewer;
+
+ }
+
+ /**
+ * @see IClasspathTableOwner#createButtonColumnComposite(Composite)
+ */
+ public Composite createButtonColumnComposite(Composite parent) {
+ Composite buttonColumn = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ buttonColumn.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ buttonColumn.setLayoutData(data);
+ return buttonColumn;
+ }
+
+ /**
+ * @see IClasspathTableOwner
+ */
+ public Button primCreatePushButton(String label, Composite buttonColumn) {
+ Button aButton = new Button(buttonColumn, SWT.PUSH);
+ aButton.setText(label);
+ return aButton;
+ }
+
+ /**
+ * @see IClasspathTableOwner
+ */
+ public Button primCreateRadioButton(String label, Composite parent) {
+ Button aButton = new Button(parent, SWT.RADIO);
+ aButton.setText(label);
+ return aButton;
+ }
+
+ /**
+ * @see Listener#handleEvent(Event)
+ */
+ public void handleEvent(Event event) {
+ if (event.widget == availableAppsCombo)
+ availableAppsSelected(event);
+ }
+
+ protected void availableAppsSelected(Event event) {
+ int index = availableAppsCombo.getSelectionIndex();
+ model.selectEAR(index);
+ }
+
+ protected void populateApps() {
+ IVirtualComponent[] components = model.getAvailableEARComponents();
+ String[] values = new String[components.length];
+ for (int i = 0; i < components.length; i++) {
+ values[i] = components[i].getProject().getName();
+ }
+ if (availableAppsCombo != null) {
+ availableAppsCombo.setItems(values);
+ IVirtualComponent selected = model.getSelectedEARComponent();
+ if (selected != null) {
+ int index = Arrays.asList(components).indexOf(selected);
+ availableAppsCombo.select(index);
+ } else
+ availableAppsCombo.clearSelection();
+ }
+ }
+
+ protected void refresh() {
+ populateApps();
+ if (tableManager != null) {
+ tableManager.refresh();
+ }
+ refreshText();
+ }
+
+
+ public void refreshText() {
+ ClassPathSelection sel = model.getClassPathSelection();
+ if (sel != null && classPathText != null)
+ classPathText.setText(sel.toString());
+ }
+
+ /**
+ * @see ClasspathModelListener#modelChanged(ClasspathModelEvent)
+ */
+ public void modelChanged(ClasspathModelEvent evt) {
+ if (evt.getEventType() == ClasspathModelEvent.CLASS_PATH_CHANGED) {
+ isDirty = true;
+ refreshText();
+ } else if (evt.getEventType() == ClasspathModelEvent.EAR_PROJECT_CHANGED) {
+ tableManager.refresh();
+ }
+ }
+
+ public void performDefaults() {
+ model.resetClassPathSelection();
+ refresh();
+ isDirty = false;
+ model.dispose();
+ }
+
+ public boolean performCancel() {
+ model.dispose();
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ if (!isDirty)
+ return true;
+ modifyEARBundledLibs();
+ WorkspaceModifyComposedOperation composed = new WorkspaceModifyComposedOperation(createManifestOperation());
+ createClasspathAttributeUpdateOperation(composed, model.getClassPathSelection(), false);
+ try {
+ new ProgressMonitorDialog(propPage.getShell()).run(true, true, composed);
+ } catch (InvocationTargetException ex) {
+ String title = ManifestUIResourceHandler.An_internal_error_occurred_ERROR_;
+ String msg = title;
+ if (ex.getTargetException() != null && ex.getTargetException().getMessage() != null)
+ msg = ex.getTargetException().getMessage();
+ MessageDialog.openError(propPage.getShell(), title, msg);
+ org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex);
+ return false;
+ } catch (InterruptedException e) {
+ // cancelled
+ return false;
+ } finally {
+ model.dispose();
+ }
+ isDirty = false;
+ return true;
+ }
+
+ List getUnSelectedClassPathElementsForJ2EEDependency() {
+ List unselectedForJ2EE = getUnSelectedClassPathSelection().getClasspathElements();
+
+ List unselected = new ArrayList();
+ if (model != null && model.getClassPathSelectionForWLPs() != null) {
+ List wlpSelected = model.getClassPathSelectionForWLPs().getSelectedClasspathElements();
+
+ java.util.Iterator it = unselectedForJ2EE.iterator();
+
+ while (it.hasNext()) {
+ ClasspathElement element = (ClasspathElement) it.next();
+ java.util.Iterator wlpIterator = wlpSelected.iterator();
+ boolean found = false;
+ while (wlpIterator.hasNext()) {
+ ClasspathElement wlpElement = (ClasspathElement) wlpIterator.next();
+ String text = element.getText();
+ int index = text.indexOf(IJ2EEModuleConstants.JAR_EXT);
+ if (index != -1) {
+ text = text.substring(0, index);
+ if (text.equals(wlpElement.getText())) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ if (!unselected.contains(element))
+ unselected.add(element);
+ }
+
+ }
+ }
+ return unselected;
+ }
+
+
+ /**
+ * @deprecated don't use this method it will be deleted
+ * @return
+ */
+ List getUnSelectedClassPathElementsForWebDependency() {
+ List unselectedForWLP = getUnSelectedClassPathSelectionForWLPs().getClasspathElements();
+ List unselected = new ArrayList();
+ if (model != null && model.getClassPathSelection() != null) {
+ List j2eeSelected = model.getClassPathSelection().getSelectedClasspathElements();
+ java.util.Iterator it = unselectedForWLP.iterator();
+
+ while (it.hasNext()) {
+ ClasspathElement element = (ClasspathElement) it.next();
+ java.util.Iterator j2eeIterator = j2eeSelected.iterator();
+ boolean found = false;
+ while (j2eeIterator.hasNext()) {
+ ClasspathElement j2eeElement = (ClasspathElement) j2eeIterator.next();
+ String text = j2eeElement.getText();
+ int index = text.indexOf(IJ2EEModuleConstants.JAR_EXT);
+ if( index != -1 ){
+ text = text.substring(0, index);
+ if (element.getText().equals(text)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ if (!unselected.contains(element))
+ unselected.add(element);
+ }
+
+ }
+ } else {
+ unselected = unselectedForWLP;
+ }
+ return unselected;
+ }
+
+ /**
+ * DoNotUseMeThisWillBeDeletedPost15
+ * @return
+ */
+ protected WorkspaceModifyComposedOperation createJ2EEComponentDependencyOperations() {
+ WorkspaceModifyComposedOperation composedOp = null;
+ List selected = getSelectedClassPathSelection().getClasspathElements();
+ List unselected = getUnSelectedClassPathElementsForJ2EEDependency();
+
+ List targetComponentsHandles = new ArrayList();
+ for (int i = 0; i < selected.size(); i++) {
+ ClasspathElement element = (ClasspathElement) selected.get(i);
+ IVirtualComponent component = element.getComponent();
+ if (null != component) {
+ targetComponentsHandles.add(component);
+ }
+ }
+ if (!targetComponentsHandles.isEmpty()) {
+ composedOp = new WorkspaceModifyComposedOperation();
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(ComponentUtilities.createReferenceComponentOperation(model.getComponent(), targetComponentsHandles)));
+ }
+ targetComponentsHandles = new ArrayList();
+ for (int i = 0; i < unselected.size(); i++) {
+ ClasspathElement element = (ClasspathElement) unselected.get(i);
+ IProject elementProject = element.getProject();
+ if (elementProject != null) {
+ if (ModuleCoreNature.isFlexibleProject(elementProject)) {
+ IVirtualComponent targetComp = ComponentCore.createComponent(elementProject);
+ targetComponentsHandles.add(targetComp);
+ }
+ } else {
+ URI archiveURI = element.getArchiveURI();
+ if (archiveURI != null && !archiveURI.equals("")) { //$NON-NLS-1$
+ String name = ""; //$NON-NLS-1$
+ try {
+ String type = ModuleURIUtil.getArchiveType(archiveURI);
+ String tmpname = ModuleURIUtil.getArchiveName(archiveURI);
+ name = type + IPath.SEPARATOR + tmpname;
+ } catch (UnresolveableURIException e) {
+ Logger.getLogger().logError(e.getMessage());
+ }
+ if (!name.equals("")) { //$NON-NLS-1$
+ IVirtualReference ref = model.getComponent().getReference(name);
+ if (ref != null) {
+ IVirtualComponent referenced = ref.getReferencedComponent();
+ targetComponentsHandles.add(referenced);
+ }
+ }
+ }
+ }
+ }
+ if (!targetComponentsHandles.isEmpty()) {
+ if (composedOp == null)
+ composedOp = new WorkspaceModifyComposedOperation();
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(ComponentUtilities.removeReferenceComponentOperation(model.getComponent(), targetComponentsHandles)));
+ }
+ return composedOp;
+ }
+
+
+ /**
+ * This should be moved to the {@link WebLibDependencyPropertiesPage} because it is only used there.
+ * @return
+ */
+ protected WorkspaceModifyComposedOperation createComponentDependencyOperations() {
+ WorkspaceModifyComposedOperation composedOp = null;
+ final ClassPathSelection selectedWLPs = getSelectedClassPathSelectionForWLPs();
+ List selected = selectedWLPs.getClasspathElements();
+ List unselected = getUnSelectedClassPathSelectionForWLPs().getClasspathElements();
+
+ List targetComponentsHandles = new ArrayList();
+ for (int i = 0; i < selected.size(); i++) {
+ ClasspathElement element = (ClasspathElement) selected.get(i);
+ if (element.isClasspathDependency() || element.isClasspathEntry()) {
+ continue;
+ }
+ IProject elementProject = element.getProject();
+ if (elementProject != null) {
+ IVirtualComponent targetComp = ComponentCore.createComponent(elementProject);
+ targetComponentsHandles.add(targetComp);
+ }
+ }
+ if (!targetComponentsHandles.isEmpty()) {
+ composedOp = new WorkspaceModifyComposedOperation();
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(ComponentUtilities.createWLPReferenceComponentOperation(model.getComponent(), targetComponentsHandles)));
+ }
+ targetComponentsHandles = new ArrayList();
+ for (int i = 0; i < unselected.size(); i++) {
+ ClasspathElement element = (ClasspathElement) unselected.get(i);
+ if (element.isClasspathDependency() || element.isClasspathEntry()) {
+ continue;
+ }
+ IProject elementProject = element.getProject();
+ if (elementProject != null) {
+ if (ModuleCoreNature.isFlexibleProject(elementProject)) {
+ IVirtualComponent targetComp = ComponentCore.createComponent(elementProject);
+ targetComponentsHandles.add(targetComp);
+ }
+ } else {
+ URI archiveURI = element.getArchiveURI();
+ if (archiveURI != null && !archiveURI.equals("")) { //$NON-NLS-1$
+ String name = ""; //$NON-NLS-1$
+ try {
+ String type = ModuleURIUtil.getArchiveType(archiveURI);
+ String tmpname = ModuleURIUtil.getArchiveName(archiveURI);
+ name = type + IPath.SEPARATOR + tmpname;
+ } catch (UnresolveableURIException e) {
+ Logger.getLogger().logError(e.getMessage());
+ }
+ if (!name.equals("")) { //$NON-NLS-1$
+ IVirtualReference ref = model.getComponent().getReference(name);
+ IVirtualComponent referenced = ref.getReferencedComponent();
+ targetComponentsHandles.add(referenced);
+ }
+ }
+ }
+ }
+ if (!targetComponentsHandles.isEmpty()) {
+ if (composedOp == null) {
+ composedOp = new WorkspaceModifyComposedOperation();
+ }
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(ComponentUtilities.removeWLPReferenceComponentOperation(model.getComponent(), targetComponentsHandles)));
+ }
+
+ if (composedOp == null) {
+ composedOp = new WorkspaceModifyComposedOperation();
+ }
+ createClasspathAttributeUpdateOperation(composedOp, model.getClassPathSelectionForWLPs(), true);
+
+ return composedOp;
+ }
+
+ protected WorkspaceModifyComposedOperation createFlexProjectOperations() {
+ WorkspaceModifyComposedOperation composedOp = null;
+ Object[] elements = tableManager.availableJARsViewer.getCheckedElements();
+ for (int i = 0; i < elements.length; i++) {
+ ClasspathElement element = (ClasspathElement) elements[i];
+ IProject elementProject = element.getProject();
+ try {
+ if (elementProject != null && !elementProject.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
+ if (composedOp == null) {
+ composedOp = new WorkspaceModifyComposedOperation();
+ }
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(elementProject, false)));
+ }
+ } catch (CoreException e) {
+ Logger.getLogger().logError(e);
+ }
+ }
+ return composedOp;
+ }
+
+ protected ClassPathSelection getUnSelectedClassPathSelectionForWLPs() {
+ ClassPathSelection selection = new ClassPathSelection();
+ Object[] checkedElements = tableManager.availableJARsViewer.getCheckedElements();
+ List modelElements = model.getClassPathSelectionForWLPs().getClasspathElements();
+ for (int i = 0; i < modelElements.size(); i++) {
+ List checkedElementsList = Arrays.asList(checkedElements);
+ if (!checkedElementsList.contains(modelElements.get(i))) {
+ selection.getClasspathElements().add(modelElements.get(i));
+ }
+ }
+ return selection;
+ }
+
+ private ClassPathSelection getSelectedClassPathSelection() {
+ ClassPathSelection selection = new ClassPathSelection();
+ Object[] checkedElements = tableManager.availableJARsViewer.getCheckedElements();
+ for (int i = 0; i < checkedElements.length; i++) {
+ selection.getClasspathElements().add(checkedElements[i]);
+ }
+ return selection;
+ }
+
+ protected ClassPathSelection getUnSelectedClassPathSelection() {
+ ClassPathSelection selection = new ClassPathSelection();
+ Object[] checkedElements = tableManager.availableJARsViewer.getCheckedElements();
+ List modelElements = model.getClassPathSelection().getClasspathElements();
+ for (int i = 0; i < modelElements.size(); i++) {
+ List checkedElementsList = Arrays.asList(checkedElements);
+ if (!checkedElementsList.contains(modelElements.get(i))) {
+ selection.getClasspathElements().add(modelElements.get(i));
+ }
+ }
+ return selection;
+ }
+
+
+ private ClassPathSelection getSelectedClassPathSelectionForWLPs() {
+ ClassPathSelection selection = new ClassPathSelection();
+ Object[] checkedElements = tableManager.availableJARsViewer.getCheckedElements();
+ for (int i = 0; i < checkedElements.length; i++) {
+ selection.getClasspathElements().add(checkedElements[i]);
+ }
+ return selection;
+ }
+
+ protected UpdateManifestOperation createManifestOperation() {
+ return new UpdateManifestOperation(project.getName(), model.getClassPathSelection().toString(), true);
+ }
+
+ protected void createClasspathAttributeUpdateOperation(final WorkspaceModifyComposedOperation composedOp, final ClassPathSelection selection, final boolean isWebApp) {
+ final boolean webLibsOnly = isWebApp && !ClasspathDependencyEnablement.isAllowClasspathComponentDependency();
+ final Map selectedEntriesToRuntimePath = new HashMap();
+ final Map unselectedEntriesToRuntimePath = new HashMap();
+ final List elements = selection.getClasspathElements();
+ for (int i = 0; i < elements.size(); i++) {
+ final ClasspathElement element = (ClasspathElement) elements.get(i);
+ if (element.isClasspathEntry()) {
+ final IClasspathEntry entry = element.getClasspathEntry();
+ final IClasspathAttribute attrib = ClasspathDependencyUtil.checkForComponentDependencyAttribute(entry, DependencyAttributeType.DEPENDENCY_OR_NONDEPENDENCY, webLibsOnly);
+ boolean hasDepAttrib = false;
+ if (attrib != null && attrib.getName().equals(IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY)) {
+ hasDepAttrib = true;
+ }
+ final IPath runtimePath = ClasspathDependencyUtil.getRuntimePath(attrib, isWebApp, ClasspathDependencyUtil.isClassFolderEntry(entry));
+ if (element.isSelected()) {
+ // only add if we don't already have the attribute
+ if (!hasDepAttrib) {
+ selectedEntriesToRuntimePath.put(entry, runtimePath);
+ }
+ } else {
+ // only add if we already have the attribute
+ if (hasDepAttrib) {
+ unselectedEntriesToRuntimePath.put(entry, runtimePath);
+ }
+ }
+ }
+ }
+
+ // if there are any attributes to add, create an operation to add all necessary attributes
+ if (!selectedEntriesToRuntimePath.isEmpty()) {
+ IDataModelOperation op = UpdateClasspathAttributeUtil.createAddDependencyAttributesOperation(project.getName(), selectedEntriesToRuntimePath);
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(op));
+ }
+ // if there are any attributes to remove, create an operation to remove all necessary attributes
+ if (!unselectedEntriesToRuntimePath.isEmpty()) {
+ IDataModelOperation op = UpdateClasspathAttributeUtil.createRemoveDependencyAttributesOperation(project.getName(), unselectedEntriesToRuntimePath);
+ composedOp.addRunnable(WTPUIPlugin.getRunnableWithProgress(op));
+ }
+ }
+
+ protected boolean isReadOnly() {
+ return JemProjectUtilities.isBinaryProject(project) && (project.findMember(IModuleConstants.COMPONENT_FILE_PATH) == null) ;
+ }
+
+ protected void modifyEARBundledLibs() {
+ List compsToUncheckList = tableManager.getCheckedLibsAsList();
+ if (compsToUncheckList.size() == 0) return;
+ Set allCompsToUncheck = new HashSet();
+ Set allCompNamesToUncheck = new HashSet();
+ for (int i = 0; i < compsToUncheckList.size(); i++) {
+ IVirtualComponent comp = (IVirtualComponent)compsToUncheckList.get(i);
+ allCompsToUncheck.add(comp);
+ if (comp instanceof J2EEModuleVirtualArchiveComponent) allCompNamesToUncheck.add(comp.getName());
+ }
+ IProject[] ears = EarUtilities.getReferencingEARProjects(project);
+ for (int i = 0; i < ears.length; i++) {
+ if (J2EEProjectUtilities.isJEEProject(ears[i])) {
+ IVirtualComponent earComponent = ComponentCore.createComponent(ears[i]);
+ List listToUncheck = createListToUncheck(earComponent, allCompsToUncheck, allCompNamesToUncheck);
+ if (listToUncheck.size() == 0) continue;
+ removeModulesFromEAR(new NullProgressMonitor(), earComponent, listToUncheck);
+ addModulesToEAR(new NullProgressMonitor(), earComponent, listToUncheck);
+ }
+ }
+ }
+ //---------------------------------
+ private IStatus removeModulesFromEAR(IProgressMonitor monitor, final IVirtualComponent earComponent, final List compsToUncheckList) {
+ IStatus stat = IDataModelProvider.OK_STATUS;
+ String libDir = ((Application)ModelProviderManager.getModelProvider(earComponent.getProject()).getModelObject()).getLibraryDirectory();
+ libDir = (libDir == null) ? J2EEConstants.EAR_DEFAULT_LIB_DIR : libDir;
+ Map dependentComps = getEARModuleDependencies(earComponent, compsToUncheckList);
+ try {
+ IDataModelOperation op = removeComponentFromEAROperation(earComponent, compsToUncheckList, libDir);
+ op.execute(null, null);
+ J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(earComponent.getProject());
+ removeEARComponentDependencies(dependentComps);
+ } catch (ExecutionException e) {
+ Logger.getLogger().log(e);
+ }
+ return stat;
+ }
+
+
+ private IStatus addModulesToEAR(IProgressMonitor monitor, final IVirtualComponent earComponent, final List compsToUncheckList) {
+ try {
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
+ public void run(IProgressMonitor monitor) throws CoreException{
+ execAddOp(monitor, compsToUncheckList, J2EEConstants.EAR_ROOT_DIR, earComponent);
+ }
+ };
+ J2EEUIPlugin.getWorkspace().run(runnable, monitor);
+ } catch (Exception e) {
+ Logger.getLogger().log(e);
+ }
+ return IDataModelProvider.OK_STATUS;
+ }
+
+ private List createListToUncheck(IVirtualComponent earComponent, Set compsToUncheckList, Set compNamesToUncheck) {
+ LinkedList res = new LinkedList();
+ IVirtualReference[] refs = earComponent.getReferences();
+ for (int j = 0; j < refs.length; j++) {
+ if (!refs[j].getRuntimePath().isRoot() &&
+ (compsToUncheckList.contains(refs[j].getReferencedComponent()) ||
+ compNamesToUncheck.contains(refs[j].getReferencedComponent().getName()))) {
+ res.add(refs[j].getReferencedComponent());
+ }
+ }
+ return res;
+ }
+
+ private void execAddOp(IProgressMonitor monitor, List list, String path, IVirtualComponent earComponent) throws CoreException {
+ IDataModel dm = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
+
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, list);
+ dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+
+ IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ if (stat != IDataModelProvider.OK_STATUS)
+ throw new CoreException(stat);
+ try {
+ dm.getDefaultOperation().execute(monitor, null);
+ } catch (ExecutionException e) {
+ Logger.getLogger().log(e);
+ }
+ }
+
+
+ protected IDataModelOperation removeComponentFromEAROperation(IVirtualComponent sourceComponent, List targetComponentsHandles, String dir) {
+ IDataModel model = DataModelFactory.createDataModel(new RemoveComponentFromEnterpriseApplicationDataModelProvider());
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, sourceComponent);
+ List modHandlesList = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ modHandlesList.addAll(targetComponentsHandles);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, dir);
+ return model.getDefaultOperation();
+ }
+
+ private Map getEARModuleDependencies(final IVirtualComponent earComponent, final List components) {
+ final Map dependentComps = new HashMap();
+ // get all current references to project within the scope of this EAR
+ for (int i = 0; i < components.size(); i++) {
+
+ final List compsForProject = new ArrayList();
+ final IVirtualComponent comp = (IVirtualComponent) components.get(i);
+ Set<IProject> referencingComponents = IDependencyGraph.INSTANCE.getReferencingComponents(project);
+ IProject [] dependentProjects = referencingComponents.toArray(new IProject[referencingComponents.size()]);
+ for (int j = 0; j < dependentProjects.length; j++) {
+ final IProject project = dependentProjects[j];
+ // if this is an EAR, can skip
+ if (JavaEEProjectUtilities.isEARProject(project)) {
+ continue;
+ }
+ final IVirtualComponent dependentComp = ComponentCore.createComponent(project);
+ // ensure that the project's share an EAR
+ final IProject[] refEARs = EarUtilities.getReferencingEARProjects(project);
+ boolean sameEAR = false;
+ for (int k = 0; k < refEARs.length; k++) {
+ if (refEARs[k].equals(earComponent.getProject())) {
+ sameEAR = true;
+ break;
+ }
+ }
+ if (!sameEAR) {
+ continue;
+ }
+ // if the dependency is a web lib dependency, can skip
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ IVirtualReference ref = dependentComp.getReference(comp.getName());
+ if (ref != null && ref.getRuntimePath().equals(new Path("/WEB-INF/lib"))) { //$NON-NLS-1$
+ continue;
+ }
+ }
+ compsForProject.add(dependentComp);
+ }
+ dependentComps.put(comp, compsForProject);
+ }
+ return dependentComps;
+ }
+
+ private void removeEARComponentDependencies(final Map dependentComps) throws ExecutionException {
+ final Iterator targets = dependentComps.keySet().iterator();
+ while (targets.hasNext()) {
+ final IVirtualComponent target = (IVirtualComponent) targets.next();
+ final List sources = (List) dependentComps.get(target);
+ for (int i = 0; i < sources.size(); i++) {
+ final IVirtualComponent source = (IVirtualComponent) sources.get(i);
+ final IDataModel model = DataModelFactory.createDataModel(new RemoveReferenceComponentsDataModelProvider());
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, source);
+ final List modHandlesList = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ modHandlesList.add(target);
+ model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
+ model.getDefaultOperation().execute(null, null);
+ // update the manifest
+ removeManifestDependency(source, target);
+ }
+ }
+ }
+
+ private void removeManifestDependency(final IVirtualComponent source, final IVirtualComponent target)
+ throws ExecutionException {
+ final String sourceProjName = source.getProject().getName();
+ final String targetProjName = target.getProject().getName();
+ final IProgressMonitor monitor = new NullProgressMonitor();
+ final IFile manifestmf = J2EEProjectUtilities.getManifestFile(source.getProject());
+ final ArchiveManifest mf = J2EEProjectUtilities.readManifest(source.getProject());
+ if (mf == null)
+ return;
+ final IDataModel updateManifestDataModel = DataModelFactory.createDataModel(new UpdateManifestDataModelProvider());
+ updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.PROJECT_NAME, sourceProjName);
+ updateManifestDataModel.setBooleanProperty(UpdateManifestDataModelProperties.MERGE, false);
+ updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.MANIFEST_FILE, manifestmf);
+ String[] cp = mf.getClassPathTokenized();
+ List cpList = new ArrayList();
+ String cpToRemove = targetProjName + IJ2EEModuleConstants.JAR_EXT;
+ for (int i = 0; i < cp.length; i++) {
+ if (!cp[i].equals(cpToRemove)) {
+ cpList.add(cp[i]);
+ }
+ }
+ updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.JAR_LIST, cpList);
+ updateManifestDataModel.getDefaultOperation().execute(monitor, null );
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestErrorPrompter.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestErrorPrompter.java
new file mode 100644
index 0000000..ce309b4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestErrorPrompter.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.jst.j2ee.internal.plugin.ErrorDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author jialin
+ */
+public class ManifestErrorPrompter implements ICommonManifestUIConstants {
+
+ /**
+ * Constructor for ManifestErrorPrompter.
+ */
+ private ManifestErrorPrompter() {
+ super();
+ }
+
+ public static boolean showManifestException(Shell shell, String baseMessage, boolean includeCancel, Throwable caught) {
+ StringBuffer msg = new StringBuffer(baseMessage);
+ msg.append("\n"); //$NON-NLS-1$
+ msg.append(MANIFEST_PROBLEM_1);
+ msg.append("\n"); //$NON-NLS-1$
+ msg.append(MANIFEST_PROBLEM_2);
+ msg.append("\n"); //$NON-NLS-1$
+ msg.append(MANIFEST_PROBLEM_3);
+ msg.append("\n"); //$NON-NLS-1$
+ msg.append(MANIFEST_PROBLEM_4);
+ return ErrorDialog.openError(shell,
+ ERROR_READING_MANIFEST_DIALOG_TITLE,
+ msg.toString(),
+ caught,
+ 0, includeCancel);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestUIResourceHandler.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestUIResourceHandler.java
new file mode 100644
index 0000000..50c1f23
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ManifestUIResourceHandler.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Stefan Dimov, stefan.dimov@sap.com - bug 207826
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class ManifestUIResourceHandler extends NLS {
+
+ private static final String BUNDLE_NAME = "manifest_ui";//$NON-NLS-1$
+
+ private ManifestUIResourceHandler() {
+ // Do not instantiate
+ }
+
+ public static String Up_1;
+ public static String Down_2;
+ public static String Select_All_3;
+ public static String Deselect_All_4;
+ public static String ERROR_READING_MANIFEST_DIALOG_TITLE;
+ public static String SAVE_MANIFEST_WITH_ERROR;
+ public static String ERROR_READING_MANIFEST_DIALOG_MESSAGE_EDITOR;
+ public static String ERROR_READING_MANIFEST_DIALOG_MESSAGE_PROP_PAGE;
+ public static String MANIFEST_PROBLEM_1;
+ public static String MANIFEST_PROBLEM_2;
+ public static String MANIFEST_PROBLEM_3;
+ public static String MANIFEST_PROBLEM_4;
+ public static String An_internal_error_occurred_ERROR_;
+ public static String Project_name__UI_;
+ public static String EAR_Project_Name__UI__UI_;
+ public static String Available_dependent_JARs__UI_;
+ public static String Manifest_Class_Path__UI_;
+ public static String JAR_Module_UI_;
+ public static String Packed_In_Lib_UI_;
+ public static String Project_UI_;
+ public static String EAR_Modules;
+ public static String EAR_Modules_Desc;
+ public static String J2EE_Modules;
+ public static String J2EE_Modules_Desc;
+ public static String Web_Libraries;
+ public static String Web_Libraries_Desc;
+ public static String Web_Ref_Desc;
+ public static String EAR_Module_Dep_Error;
+ public static String Unreferenced_Module_Error;
+ public static String Jar_Dep_One_Module_Error;
+ public static String Web_Lib_Error;
+ public static String REDIRECT_TEXT_EDITOR_UI_;
+ public static String Error_Checking_Project_Facets;
+ public static String WEB_LIB_LIST_DESCRIPTION;
+ public static String Dynamic_Web_Error;
+ public static String No_Web_Reference_Error;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ManifestUIResourceHandler.class);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/SecondCheckBoxStateChangedEvent.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/SecondCheckBoxStateChangedEvent.java
new file mode 100644
index 0000000..eeb1f5e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/SecondCheckBoxStateChangedEvent.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Stefan Dimov, stefan.dimov@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ICheckable;
+import org.eclipse.jst.j2ee.internal.ui.DoubleCheckboxTableItem;
+
+public class SecondCheckBoxStateChangedEvent extends CheckStateChangedEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4497186607413856367L;
+ private DoubleCheckboxTableItem item = null;
+
+ public SecondCheckBoxStateChangedEvent(ICheckable source,
+ Object element,
+ boolean state) {
+ super(source, element, state);
+ }
+
+ public void setTableItem(DoubleCheckboxTableItem itm) {
+ item = itm;
+ }
+
+ public DoubleCheckboxTableItem getTableItem() {
+ return item;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/UpdateManifestOperation.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/UpdateManifestOperation.java
new file mode 100644
index 0000000..f0637b9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/UpdateManifestOperation.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
+
+/**
+ * @deprecated as of wtp 3.2
+ * @author jialin
+ */
+public class UpdateManifestOperation implements org.eclipse.jface.operation.IRunnableWithProgress {
+ protected String projectName;
+ protected String classPathValue;
+ protected boolean replace;
+/**
+ * UpdateManifestOperation constructor comment.
+ * @deprecated as of wtp 3.2
+ */
+public UpdateManifestOperation(String aProjectName, String aSpaceDelimitedPath, boolean replaceInsteadOfMerge) {
+ super();
+ projectName = aProjectName;
+ classPathValue = aSpaceDelimitedPath;
+ replace = replaceInsteadOfMerge;
+}
+protected IProject getProject() {
+ return J2EEPlugin.getWorkspace().getRoot().getProject(projectName);
+}
+/**
+ * Runs this operation. Progress should be reported to the given progress monitor.
+ * This method is usually invoked by an <code>IRunnableContext</code>'s <code>run</code> method,
+ * which supplies the progress monitor.
+ * A request to cancel the operation should be honored and acknowledged
+ * by throwing <code>InterruptedException</code>.
+ *
+ * @param monitor the progress monitor to use to display progress and receive
+ * requests for cancelation
+ * @exception InvocationTargetException if the run method must propagate a checked exception,
+ * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
+ * wrapped in an <code>InvocationTargetException</code> by the calling context
+ * @exception InterruptedException if the operation detects a request to cancel,
+ * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
+ * <code>InterruptedException</code>
+ *
+ * @see IRunnableContext#run
+ */
+public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, InterruptedException {
+ IProject p = getProject();
+ try {
+ ArchiveManifest mf = J2EEProjectUtilities.readManifest(p);
+ if (mf == null)
+ mf = new ArchiveManifestImpl();
+ mf.addVersionIfNecessary();
+ if (replace)
+ mf.setClassPath(classPathValue);
+ else
+ mf.mergeClassPath(ArchiveUtil.getTokens(classPathValue));
+ J2EEProjectUtilities.writeManifest(p, mf);
+ } catch (java.io.IOException ex) {
+ throw new WFTWrappedException(ex);
+ }
+}
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebLibDependencyPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebLibDependencyPropertiesPage.java
new file mode 100644
index 0000000..bd6dbe5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebLibDependencyPropertiesPage.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
+import org.eclipse.jst.j2ee.internal.common.ClasspathModel;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+/**
+ * @deprecated wtp 3.2
+ */
+public class WebLibDependencyPropertiesPage extends JARDependencyPropertiesPage {
+
+ public WebLibDependencyPropertiesPage(final IProject project, final J2EEDependenciesPage page) {
+ super(project, page);
+ }
+
+ @Override
+ protected ClasspathModel createClasspathModel() {
+ return new ClasspathModel(null, true);
+ }
+
+ @Override
+ public Composite createContents(Composite parent) {
+ initialize();
+ Composite composite = createBasicComposite(parent);
+ if (model.getComponent() != null) {
+ if (!isValidWebModule())
+ return composite;
+ J2EEDependenciesPage.createDescriptionComposite(composite, ManifestUIResourceHandler.Web_Libraries_Desc);
+ // createProjectLabelsGroup(composite);
+ createListGroup(composite);
+ handleWLPSupport();
+ setEnablement();
+ }
+ Dialog.applyDialogFont(parent);
+ postCreateContents();
+ return composite;
+ }
+
+ @Override
+ protected void createProjectLabelsGroup(Composite parent) {
+
+ Composite labelsGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ labelsGroup.setLayout(layout);
+ labelsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label label = new Label(labelsGroup, SWT.NONE);
+ label.setText(ManifestUIResourceHandler.Project_name__UI_);
+
+ componentNameText = new Text(labelsGroup, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ componentNameText.setEditable(false);
+ componentNameText.setLayoutData(data);
+ componentNameText.setText(project.getName());
+ }
+
+ @Override
+ protected void createListGroup(Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ listGroup.setLayout(layout);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalIndent = 5;
+ listGroup.setLayoutData(gData);
+
+ availableDependentJars = new Label(listGroup, SWT.NONE);
+ gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ availableDependentJars.setText(ManifestUIResourceHandler.Available_dependent_JARs__UI_);
+ availableDependentJars.setLayoutData(gData);
+ createTableComposite(listGroup);
+ }
+
+ @Override
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ tableManager = new ClasspathTableManager(this, model, validateEditListener);
+ tableManager.fillWLPComposite(composite);
+ }
+
+ protected boolean isValidWebModule() {
+ if (!JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ propPage.setErrorMessage(ManifestUIResourceHandler.Web_Lib_Error);
+ return false;
+ }
+ return true;
+ }
+ private boolean equals(final Object obj1, final Object obj2) {
+ if (obj1 == obj2) {
+ return true;
+ } else if (obj1 == null || obj2 == null) {
+ return false;
+ } else {
+ return obj1.equals(obj2);
+ }
+ }
+
+ protected void setEnablement() {
+ if (tableManager.availableJARsViewer.getTable().getItems().length == 0) {
+ tableManager.selectAllButton.setEnabled(false);
+ tableManager.deselectAllButton.setEnabled(false);
+ } else {
+ tableManager.selectAllButton.setEnabled(true);
+ tableManager.deselectAllButton.setEnabled(true);
+ }
+ }
+ private IProgressMonitor submon(final IProgressMonitor parent, final int ticks) {
+ return (parent == null ? null : new SubProgressMonitor(parent, ticks));
+ }
+
+ private void handleWLPSupport() {
+ availableDependentJars.setText(ManifestUIResourceHandler.WEB_LIB_LIST_DESCRIPTION);
+ tableManager.refresh();
+ }
+
+ @Override
+ protected void handleClasspathChange() {
+ model.resetClassPathSelectionForWLPs();
+ super.handleClasspathChange();
+ setEnablement();
+ }
+
+ @Override
+ public boolean performOk() {
+ if (model.getComponent() == null || !isValidWebModule()) {
+ return true;
+ }
+ if (!isDirty) {
+ return true;
+ }
+ try {
+ IProject[] javaProjects = getJavaProjectsWithoutFacets();
+ boolean createdFlexProjects = runWLPOp(createFlexProjectOperations());
+
+ boolean createdComponentDependency = false;
+ if (createdFlexProjects) {
+ addTargetRuntimesToNewJavaProjects(javaProjects,new NullProgressMonitor());
+ createdComponentDependency = runWLPOp(createComponentDependencyOperations());
+ isDirty = false;
+ }
+ // treat as a classpath change for refresh purposes
+ // XXX this refresh is not working - suspect it is because the virtual component dependencies are
+ // not consistently being recomputed
+ //handleClasspathChange();
+ return createdComponentDependency;
+ } finally {
+ model.dispose();
+ }
+ }
+
+ private IProject[] getJavaProjectsWithoutFacets() {
+ List projectsList = new ArrayList();
+ Object[] elements = tableManager.availableJARsViewer.getCheckedElements();
+ for (int i = 0; i < elements.length; i++) {
+ ClasspathElement element = (ClasspathElement) elements[i];
+ IProject elementProject = element.getProject();
+ try {
+ if (elementProject != null && !elementProject.hasNature(IModuleConstants.MODULE_NATURE_ID))
+ projectsList.add(elementProject);
+ } catch (CoreException e) {
+ J2EEPlugin.logError(e);
+ }
+ }
+ return (IProject[])projectsList.toArray(new IProject[projectsList.size()]);
+ }
+
+ private boolean runWLPOp(WorkspaceModifyComposedOperation composed) {
+ try {
+ if (composed != null)
+ new ProgressMonitorDialog(propPage.getShell()).run(true, true, composed);
+ } catch (InvocationTargetException ex) {
+ if (ex.getCause() != null) {
+ J2EEUIPlugin.logError(ex.getCause());
+ }
+ String title = ManifestUIResourceHandler.An_internal_error_occurred_ERROR_;
+ String msg = title;
+ if (ex.getTargetException() != null && ex.getTargetException().getMessage() != null)
+ msg = ex.getTargetException().getMessage();
+ MessageDialog.openError(propPage.getShell(), title, msg);
+ J2EEUIPlugin.logError(ex);
+ return false;
+ } catch (InterruptedException e) {
+ // cancelled
+ return false;
+ }
+ return true;
+ }
+
+ private void addTargetRuntimesToNewJavaProjects(IProject[] javaProjects, final IProgressMonitor monitor )
+
+ {
+ if (monitor != null) {
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ }
+ IProject targetProject = project;
+ for (int i = 0; i < javaProjects.length; i++) {
+ IProject moduleProject = javaProjects[i];
+
+ try {
+ final IFacetedProject targetFacetedProject = ProjectFacetsManager.create(targetProject);
+
+ final IRuntime targetRuntime = targetFacetedProject.getRuntime();
+
+ final IFacetedProject moduleFacetedProject = ProjectFacetsManager.create(moduleProject);
+
+ if (moduleFacetedProject != null && !equals(targetRuntime, moduleFacetedProject.getRuntime())) {
+ boolean supports = true;
+
+ if (targetRuntime != null) {
+ for (Iterator itr = moduleFacetedProject.getProjectFacets().iterator(); itr.hasNext();) {
+ final IProjectFacetVersion fver = (IProjectFacetVersion) itr.next();
+
+ if (!targetRuntime.supports(fver)) {
+ supports = false;
+ break;
+ }
+ }
+ }
+
+ if (supports) {
+ moduleFacetedProject.setRuntime(targetRuntime, submon(monitor, 1));
+ }
+ }
+ } catch(CoreException ex) {
+ J2EEPlugin.logError(ex);
+ } finally {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+ }
+ }
+
+ private void createRef(String aComponentName){
+ IVirtualComponent archive = ComponentCore.createArchiveComponent(model.getComponent().getProject(), aComponentName);
+
+ // To do: check if archive component already exists
+ IVirtualReference ref = ComponentCore.createReference(model.getComponent(), archive, new Path("/WEB-INF/lib")); //$NON-NLS-1$
+ model.getComponent().addReferences(new IVirtualReference [] { ref });
+
+ ClasspathElement element = createClassPathElement(archive, archive.getName());
+// ClassPathSelection selection = createClassPathSelectionForExternalJar(element);
+ model.getClassPathSelectionForWLPs().getClasspathElements().add(element);
+ }
+
+ public void handleSelectExternalJarButton() {
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ IPath[] selected = BuildPathDialogAccess.chooseExternalJAREntries(propPage.getShell());
+ if (selected != null) {
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ for (int i = 0; i < selected.length; i++) {
+ createRef(type + selected[i].toString());
+ }
+ refresh();
+ }
+ }
+ }
+
+ public void handleSelectVariableButton() {
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ IPath existingPath[] = new Path[0];
+ IPath[] selected = BuildPathDialogAccess.chooseVariableEntries(propPage.getShell(), existingPath);
+
+ if (selected != null) {
+ String type = VirtualArchiveComponent.VARARCHIVETYPE + IPath.SEPARATOR;
+ for (int i = 0; i < selected.length; i++) {
+ IPath resolvedPath = JavaCore.getResolvedVariablePath(selected[i]);
+ java.io.File file = new java.io.File(resolvedPath.toOSString());
+ if (file.isFile() && file.exists()) {
+ createRef(type + selected[i].toString());
+ } else {
+ // display error
+ }
+ }
+ refresh();
+ }
+ }
+ }
+
+ private ClasspathElement createClassPathElement(IVirtualComponent archiveComp, String unresolvedName) {
+
+ URI uri = URI.createURI(ModuleURIUtil.getHandleString(archiveComp));
+ ClasspathElement element = new ClasspathElement(uri);
+ element.setValid(false);
+ element.setSelected(true);
+ element.setRelativeText(unresolvedName);
+ element.setText(unresolvedName);
+ element.setEarProject(null);
+ return element;
+ }
+
+// private ClassPathSelection createClassPathSelectionForExternalJar(ClasspathElement element) {
+// ClassPathSelection selection = new ClassPathSelection();
+// selection.getClasspathElements().add(element);
+// return selection;
+// }
+
+// private ClassPathSelection createClassPathSelectionForProjectJar(ClasspathElement element) {
+// ClassPathSelection selection = new ClassPathSelection();
+// selection.getClasspathElements().add(element);
+// return selection;
+// }
+
+ public void handleSelectProjectJarButton() {
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ IPath[] selected = BuildPathDialogAccess.chooseJAREntries(propPage.getShell(), project.getLocation(), new IPath[0]);
+ if (selected != null) {
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ for (int i = 0; i < selected.length; i++) {
+ createRef(type + selected[i].makeRelative().toString());
+ }
+ refresh();
+ }
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebRefDependencyPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebRefDependencyPropertiesPage.java
new file mode 100644
index 0000000..09187b2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WebRefDependencyPropertiesPage.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and BEA Systems, Inc.
+ * 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:
+ * rfrost@bea.com - derived from WebLibDependencyPropertiesPage for projects referenced just from a dynamic web project.
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Supports UI manipulation of the published/exported classpath entries for projects referenced by dynamic web projects.
+ * @deprecated wtp 3.2
+ */
+public class WebRefDependencyPropertiesPage extends JARDependencyPropertiesPage {
+
+ public WebRefDependencyPropertiesPage(final IProject project, final J2EEDependenciesPage page) {
+ super(project, page);
+ }
+
+ @Override
+ public Composite createContents(Composite parent) {
+ initialize();
+ Composite composite = createBasicComposite(parent);
+ if (model.getComponent() != null) {
+ if (!isValidComponent()) {
+ return composite;
+ }
+ J2EEDependenciesPage.createDescriptionComposite(composite, ManifestUIResourceHandler.Web_Ref_Desc);
+ createListGroup(composite);
+ tableManager.refresh();
+ setEnablement();
+ }
+ Dialog.applyDialogFont(parent);
+ postCreateContents();
+ return composite;
+ }
+
+ @Override
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ tableManager = new ClasspathTableManager(this, model, validateEditListener);
+ tableManager.setReadOnly(isReadOnly());
+ tableManager.fillWebRefComposite(composite);
+ }
+
+ @Override
+ protected boolean isValidComponent() {
+ // must have the Java nature and cannot be a dynamic web project
+ boolean isJavaProject = false;
+ try {
+ isJavaProject = project.hasNature(JavaCore.NATURE_ID);
+ } catch (CoreException ce) {}
+ if (JavaEEProjectUtilities.isDynamicWebProject(project) || !isJavaProject) {
+ propPage.setErrorMessage(ManifestUIResourceHandler.Dynamic_Web_Error);
+ return false;
+ } else if (J2EEProjectUtilities.getReferencingWebProjects(project).length == 0) {
+ propPage.setErrorMessage(ManifestUIResourceHandler.No_Web_Reference_Error);
+ return false;
+ }
+ return true;
+ }
+
+ protected void setEnablement() {
+ if (tableManager.availableJARsViewer.getTable().getItems().length == 0) {
+ tableManager.selectAllButton.setEnabled(false);
+ tableManager.deselectAllButton.setEnabled(false);
+ } else {
+ tableManager.selectAllButton.setEnabled(true);
+ tableManager.deselectAllButton.setEnabled(true);
+ }
+ }
+
+ @Override
+ protected void handleClasspathChange() {
+ super.handleClasspathChange();
+ setEnablement();
+ }
+
+ @Override
+ public boolean performOk() {
+ if (model.getComponent() == null || !isValidComponent()) {
+ return true;
+ }
+ if (!isDirty) {
+ return true;
+ }
+ return super.performOk();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WorkspaceModifyComposedOperation.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WorkspaceModifyComposedOperation.java
new file mode 100644
index 0000000..93fc4b0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/WorkspaceModifyComposedOperation.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 17, 2005
+ */
+package org.eclipse.jst.j2ee.internal;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+/**
+ * WARNING: This class will be deleted
+ *
+ * @deprecated use {@link org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation}
+ */
+public class WorkspaceModifyComposedOperation extends org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation {
+ public WorkspaceModifyComposedOperation(ISchedulingRule rule) {
+ super(rule);
+ }
+
+ public WorkspaceModifyComposedOperation() {
+ super();
+ }
+
+ public WorkspaceModifyComposedOperation(ISchedulingRule rule, List nestedRunnablesWithProgress) {
+ super(rule, nestedRunnablesWithProgress);
+ }
+
+ public WorkspaceModifyComposedOperation(List nestedRunnablesWithProgress) {
+ super(nestedRunnablesWithProgress);
+ }
+
+ public WorkspaceModifyComposedOperation(IRunnableWithProgress nestedOp) {
+ super(nestedOp);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionDelegate.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionDelegate.java
new file mode 100644
index 0000000..9d9a71e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionDelegate.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public abstract class AbstractActionDelegate implements org.eclipse.ui.IActionDelegate {
+ protected ISelection selection;
+ protected boolean allowsMultiSelect = false;
+ public static final Class IPROJECT_CLASS = IProject.class;
+ private final static String ERROR_OCCURRED_TITLE = J2EEUIMessages.getResourceString("ERROR_OCCURRED_TITLE"); //$NON-NLS-1$
+ private final static String ERROR_OCCURRED_MESSAGE = J2EEUIMessages.getResourceString("ERROR_OCCURRED_MESSAGE"); //$NON-NLS-1$
+
+ /**
+ * EditModuleDependencyAction constructor comment.
+ */
+ public AbstractActionDelegate() {
+ super();
+ }
+
+ /**
+ * Applicable only when this action does not allow multi select
+ */
+ protected IProject getProject() {
+ return getProject(getSelectedElement());
+ }
+
+ protected List getProjects() {
+ if ((selection == null) || !(selection instanceof IStructuredSelection))
+ return Collections.EMPTY_LIST;
+
+ List result = new ArrayList();
+ IStructuredSelection struct = (IStructuredSelection) selection;
+ Iterator it = struct.iterator();
+ while (it.hasNext()) {
+ IProject p = getProject(it.next());
+ if (p != null)
+ result.add(p);
+ }
+ return result;
+ }
+
+ protected IProject getProject(Object element) {
+
+ if (isSupportedAction(element))
+ return ProjectUtilities.getProject((EObject) element);
+ else if (element instanceof IAdaptable)
+ return (IProject) ((IAdaptable) element).getAdapter(IPROJECT_CLASS);
+ else
+ return null;
+ }
+
+ protected IStructuredSelection getStructuredSelection() {
+ if ((selection == null) || !(selection instanceof IStructuredSelection))
+ return null;
+ else if (selection.isEmpty()) {
+ selection = J2EEUIPlugin.getCurrentSelection();
+ }
+ return (IStructuredSelection) selection;
+ }
+
+ /*
+ * Only return if there is exactly one item selected
+ */
+ protected Object getSelectedElement() {
+ IStructuredSelection sel = getStructuredSelection();
+ return sel == null ? null : sel.getFirstElement();
+ }
+
+ protected IWorkbenchWindow getWorkbenchWindow() {
+ return J2EEUIPlugin.getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Can the receiver be executed for
+ *
+ * @element
+ */
+ protected abstract boolean isSupportedAction(Object element);
+
+ /**
+ * @deprecated use {@link #primRun(Shell)}
+ */
+ protected void primRun(IProject project, Shell shell) {
+ //Deprecated
+ }
+
+ /**
+ * Subclasses should override this instead of {@link #run(org.eclipse.jface.action.IAction)}
+ */
+ protected void primRun(Shell shell) {
+ primRun(getProject(), shell);
+ }
+
+ /**
+ * Performs this action.
+ * <p>
+ * This method is called when the delegating action has been triggered. Implement this method to
+ * do the actual work.
+ * </p>
+ *
+ * @param action
+ * the action proxy that handles the presentation portion of the action
+ */
+ public void run(org.eclipse.jface.action.IAction action) {
+
+ Shell shell = getWorkbenchWindow().getShell();
+ setActionStateFromProjects(action);
+ if (!action.isEnabled())
+ MessageDialog.openInformation(shell, J2EEUIMessages.getResourceString("INFORMATION_UI_"), J2EEUIMessages.getResourceString("CHOSEN_OP_NOT_AVAILABLE")); //$NON-NLS-2$ = "The chosen operation is not currently available." //$NON-NLS-1$ = "Information"
+ else {
+ try {
+ primRun(shell);
+ } catch (Throwable t) {
+ org.eclipse.jst.j2ee.internal.plugin.ErrorDialog.openError(shell, ERROR_OCCURRED_TITLE, ERROR_OCCURRED_MESSAGE, t, 0, false);
+ }
+ }
+
+
+ }
+
+ /**
+ * Notifies this action delegate that the selection in the workbench has changed.
+ * <p>
+ * Implementers can use this opportunity to change the availability of the action or to modify
+ * other presentation properties.
+ * </p>
+ *
+ * @param action
+ * the action proxy that handles presentation portion of the action
+ * @param aSelection
+ * the current selection in the workbench
+ */
+ public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection aSelection) {
+ this.selection = aSelection;
+ setActionState(action);
+ }
+
+ protected void setActionState(IAction action) {
+ if (allowsMultiSelect)
+ setActionStateForMultiSelect(action);
+ else
+ setActionStateForSingleSelect(action);
+ }
+
+ protected void setActionStateForSingleSelect(IAction action) {
+ IStructuredSelection sel = getStructuredSelection();
+ if (sel == null || sel.size() != 1) {
+ action.setEnabled(false);
+ return;
+ }
+ setActionStateFromProjects(action);
+ }
+
+ protected void setActionStateForMultiSelect(IAction action) {
+ setActionStateFromProjects(action);
+ }
+
+ protected void setActionStateFromProjects(IAction action) {
+ IStructuredSelection sel = getStructuredSelection();
+ boolean allOk = false;
+ if (sel != null && !sel.isEmpty()) {
+ allOk = true;
+ Iterator it = sel.iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
+ IProject project = getProject(o);
+ if (project == null || !project.isOpen()) {
+ allOk = false;
+ break;
+ }
+ }
+ }
+ action.setEnabled(allOk);
+ }
+
+ /**
+ * Returns the allowsMultiSelect.
+ *
+ * @return boolean
+ */
+ public boolean allowsMultiSelect() {
+ return allowsMultiSelect;
+ }
+
+
+ /**
+ * Sets the allowsMultiSelect.
+ *
+ * @param allowsMultiSelect
+ * The allowsMultiSelect to set
+ */
+ public void setAllowsMultiSelect(boolean allowsMultiSelect) {
+ this.allowsMultiSelect = allowsMultiSelect;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionWithDelegate.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionWithDelegate.java
new file mode 100644
index 0000000..b55aeab
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractActionWithDelegate.java
@@ -0,0 +1,71 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.actions;
+
+
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionDelegate;
+
+
+public abstract class AbstractActionWithDelegate extends org.eclipse.ui.actions.SelectionListenerAction {
+ protected IActionDelegate delegate;
+
+ /**
+ * EditModuleDependencyAction constructor comment.
+ *
+ * @param text
+ * java.lang.String
+ */
+ public AbstractActionWithDelegate() {
+ super("");//$NON-NLS-1$
+ initLabel();
+ initDelegate();
+ }
+
+ protected abstract IActionDelegate createDelegate();
+
+ protected abstract String getLabel();
+
+ protected void initDelegate() {
+ delegate = createDelegate();
+ }
+
+ protected void initLabel() {
+ setText(getLabel());
+ }
+
+ /**
+ * Implementation of method defined on <code>IAction</code>.
+ */
+ @Override
+ public void run() {
+ delegate.run(this);
+ }
+
+ /**
+ * Updates this action in response to the given selection.
+ * <p>
+ * The <code>SelectionListenerAction</code> implementation of this method returns
+ * <code>true</code>. Subclasses may extend to react to selection changes; however, if the
+ * super method returns <code>false</code>, the overriding method must also return
+ * <code>false</code>.
+ * </p>
+ *
+ * @param selection
+ * the new selection
+ * @return <code>true</code> if the action should be enabled for this selection, and
+ * <code>false</code> otherwise
+ */
+ @Override
+ protected boolean updateSelection(IStructuredSelection selection) {
+ delegate.selectionChanged(this, selection);
+ return this.isEnabled();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenAction.java
new file mode 100644
index 0000000..7d11ac6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenAction.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+/**
+ * Action for opening a J2EE resource from the J2EE navigator.
+ */
+public abstract class AbstractOpenAction extends SelectionListenerAction implements IActionDelegate2 {
+ // //$NON-NLS-1$
+ protected IEditorDescriptor currentDescriptor;
+ protected Object srcObject;
+
+ protected AbstractOpenAction(String text) {
+ super(text);
+ }
+
+ protected static IEditorDescriptor findEditorDescriptor(String id) {
+ IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
+ return registry.findEditor(id);
+ }
+
+ protected void setAttributesFromDescriptor() {
+ if (currentDescriptor == null)
+ return;
+ //setText(currentDescriptor.getLabel());
+ setToolTipText(currentDescriptor.getLabel());
+ //setImageDescriptor(currentDescriptor.getImageDescriptor());
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should override this method
+ * to react to the change. Returns true if the action should be enabled for this selection, and
+ * false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked. If the super method
+ * returns false, this method must also return false.
+ *
+ * @param sel
+ * the new structured selection
+ */
+ @Override
+ public boolean updateSelection(IStructuredSelection s) {
+ srcObject = null;
+ if (!super.updateSelection(s))
+ return false;
+
+ if (s.size() != 1)
+ return false;
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ //Dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ //init
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ runWithEvent(event);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO HACK!
+ updateSelection((IStructuredSelection) selection);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardAction.java
new file mode 100644
index 0000000..071b593
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardAction.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.activities.WorkbenchActivityHelper;
+
+
+public abstract class AbstractOpenWizardAction extends org.eclipse.jface.action.Action {
+ // //$NON-NLS-1$
+
+ private IWorkbench fWorkbench;
+
+ private Class[] fActivatedOnTypes;
+
+ private boolean fAcceptEmptySelection;
+
+ protected AbstractOpenWizardAction() {
+ //Default constructor
+ }
+
+ public AbstractOpenWizardAction(IWorkbench workbench, String label, Class[] activatedOnTypes, boolean acceptEmptySelection) {
+ super(label);
+ fWorkbench = workbench;
+ fActivatedOnTypes = activatedOnTypes;
+ fAcceptEmptySelection = acceptEmptySelection;
+ }
+
+ public AbstractOpenWizardAction(IWorkbench workbench, String label, boolean acceptEmptySelection) {
+ this(workbench, label, null, acceptEmptySelection);
+ }
+
+ public boolean canActionBeAdded() {
+ ISelection selection = getCurrentSelection();
+ if (selection == null || selection.isEmpty()) {
+ return fAcceptEmptySelection;
+ }
+ if (fActivatedOnTypes != null) {
+ if (selection instanceof IStructuredSelection) {
+ return isEnabled(((IStructuredSelection) selection).iterator());
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Create the specific Wizard (to be implemented by a subclass)
+ */
+ abstract protected Wizard createWizard();
+
+ protected IStructuredSelection getCurrentSelection() {
+ IWorkbenchWindow window = J2EEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+
+ }
+ return null;
+ }
+
+ protected IWorkbench getWorkbench() {
+ return fWorkbench;
+ }
+
+ private boolean isEnabled(Iterator iter) {
+ while (iter.hasNext()) {
+ Object obj = iter.next();
+ if (!isOfAcceptedType(obj) || !shouldAcceptElement(obj)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean isOfAcceptedType(Object obj) {
+ for (int i = 0; i < fActivatedOnTypes.length; i++) {
+ if (fActivatedOnTypes[i].isInstance(obj)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected String getDialogText() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_LBL);
+ }
+
+ /**
+ * The user has invoked this action.
+ */
+ @Override
+ public void run() {
+ Wizard wizard = createWizard();
+ if (wizard instanceof IWorkbenchWizard) {
+ IStructuredSelection sel = null;
+ if (null != getCurrentSelection())
+ sel = getCurrentSelection();
+ else
+ sel = new StructuredSelection();
+ ((IWorkbenchWizard) wizard).init(J2EEUIPlugin.getDefault().getWorkbench(), sel);
+ }
+ if (WorkbenchActivityHelper.allowUseOf(null,wizard)) {
+ IWorkbenchWindow window = J2EEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
+ dialog.create();
+ String text = getDialogText();
+ if (null != text) {
+ dialog.getShell().setText(text);
+ }
+ dialog.open();
+ }
+ }
+
+ protected void setWorkbench(IWorkbench workbench) {
+ fWorkbench = workbench;
+ }
+
+ /**
+ * can be overridden to add more checks obj is guaranteed to be instance of one of the accepted
+ * types
+ */
+ protected boolean shouldAcceptElement(Object obj) {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardWorkbenchAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardWorkbenchAction.java
new file mode 100644
index 0000000..ccc42ae
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/AbstractOpenWizardWorkbenchAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public abstract class AbstractOpenWizardWorkbenchAction extends AbstractOpenWizardAction implements org.eclipse.ui.IWorkbenchWindowActionDelegate {
+ protected AbstractOpenWizardWorkbenchAction() {
+ //Default
+ }
+
+ public AbstractOpenWizardWorkbenchAction(IWorkbench workbench, String label, Class[] activatedOnTypes, boolean acceptEmptySelection) {
+ super(workbench, label, null, acceptEmptySelection);
+ }
+
+ public AbstractOpenWizardWorkbenchAction(IWorkbench workbench, String label, boolean acceptEmptySelection) {
+ super(workbench, label, null, acceptEmptySelection);
+ }
+
+ /**
+ * @see AbstractOpenWizardAction#dispose
+ */
+ public void dispose() {
+ // do nothing.
+ setWorkbench(null);
+ }
+
+ /**
+ * @see AbstractOpenWizardAction#init
+ */
+ public void init(IWorkbenchWindow window) {
+ setWorkbench(window.getWorkbench());
+ }
+
+ /**
+ * @see IActionDelegate#run
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /**
+ * @see IActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // do nothing. Action doesn't depend on selection.
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/BaseAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/BaseAction.java
new file mode 100644
index 0000000..4a1ed7f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/BaseAction.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 27, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.plugin.ErrorDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+/**
+ * @author jsholl
+ *
+ * To change this generated comment go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public abstract class BaseAction extends Action implements IActionDelegate {
+
+ protected IStructuredSelection selection = null;
+
+ protected IWorkbenchWindow getWorkbenchWindow() {
+ return J2EEUIPlugin.getPluginWorkbench().getActiveWorkbenchWindow();
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ @Override
+ public void run() {
+ Shell shell = getWorkbenchWindow().getShell();
+ if (null == selection) {
+ ISelection autoselection = getWorkbenchWindow().getSelectionService().getSelection();
+ if (autoselection instanceof IStructuredSelection)
+ this.selection = (IStructuredSelection) autoselection;
+ }
+
+ try {
+ primRun(shell);
+ this.selection = null;
+ } catch (Throwable t) {
+ J2EEUIPlugin.logError(t);
+ String ERROR_OCCURRED_TITLE = J2EEUIMessages.getResourceString("ERROR_OCCURRED_TITLE"); //$NON-NLS-1$
+ String ERROR_OCCURRED_MESSAGE = J2EEUIMessages.getResourceString("ERROR_OCCURRED_MESSAGE"); //$NON-NLS-1$
+ ErrorDialog.openError(shell, ERROR_OCCURRED_TITLE, ERROR_OCCURRED_MESSAGE, t, 0, false);
+ }
+
+ }
+
+ protected abstract void primRun(Shell shell);
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ //dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ //init
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection aSelection) {
+ setSelection((IStructuredSelection) aSelection);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ComponentEditorInput.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ComponentEditorInput.java
new file mode 100644
index 0000000..1f2bba9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ComponentEditorInput.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class ComponentEditorInput implements IEditorInput {
+
+ private IVirtualComponent component;
+
+ public ComponentEditorInput(IVirtualComponent component){
+ this.component = component;
+ }
+
+ public boolean exists() {
+ return component.exists();
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return component.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public IVirtualComponent getComponent(){
+ return component;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ForceClasspathUpdateAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ForceClasspathUpdateAction.java
new file mode 100644
index 0000000..340756c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/ForceClasspathUpdateAction.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.ui.IActionDelegate;
+
+public class ForceClasspathUpdateAction extends Action implements IActionDelegate{
+
+ private List projectsList = new ArrayList();
+
+ @Override
+ public void run() {
+ J2EEComponentClasspathUpdater.getInstance().forceUpdate(projectsList);
+ }
+
+ public void run(IAction action) {
+ J2EEComponentClasspathUpdater.getInstance().forceUpdate(projectsList);
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ action.setEnabled(setSelection(selection));
+ }
+
+ private boolean setSelection(ISelection selection){
+ projectsList.clear();
+ if(selection != null && selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ if (structuredSelection.size() > 0) {
+ Iterator iterator = structuredSelection.iterator();
+ while(iterator.hasNext()){
+ Object next = iterator.next();
+ if (next instanceof IProject) {
+ projectsList.add(next);
+ } else {
+ projectsList.clear();
+ return false;
+ }
+ }
+ } else { // empty selection
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/IJ2EEUIContextIds.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/IJ2EEUIContextIds.java
new file mode 100644
index 0000000..71da360
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/IJ2EEUIContextIds.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+
+
+/**
+ * Insert the type's description here. Creation date: (9/6/2001 12:23:02 PM)
+ *
+ * @author: Administrator
+ */
+public interface IJ2EEUIContextIds {
+ // New creation wizards
+ public static final String NEW_EAR_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EAR_NEW_EAR_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_EAR_ADD_MODULES_PAGE = J2EEUIPlugin.PLUGIN_ID + ".NEW_EAR_ADD_MODULES_PAGE"; //$NON-NLS-1$
+ public static final String NEW_EAR_COMP_PAGE = J2EEUIPlugin.PLUGIN_ID + ".NEW_EAR_COMP_PAGE"; //$NON-NLS-1$
+ public static final String EAR_NEW_MODULE_PROJECTS_PAGE = J2EEUIPlugin.PLUGIN_ID + ".EAR_NEW_MODULE_PROJECTS_PAGE"; //$NON-NLS-1$
+ public static final String NEW_APPCLIENT_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".APPCLIENT_NEW_APPCLIENT_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_APPCLIENT_WIZARD_P3 = J2EEUIPlugin.PLUGIN_ID + ".APPCLIENT_NEW_APPCLIENT_WIZARD_PAGE3"; //$NON-NLS-1$
+ public static final String NEW_EJB_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EJB_NEW_EJB_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_EJB_WIZARD_P2 = J2EEUIPlugin.PLUGIN_ID + ".EJB_NEW_EJB_WIZARD_PAGE2"; //$NON-NLS-1$
+ public static final String NEW_EJB_WIZARD_P3 = J2EEUIPlugin.PLUGIN_ID + ".EJB_NEW_EJB_WIZARD_PAGE3"; //$NON-NLS-1$
+ public static final String NEW_CONNECTOR_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".JCA_NEWIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_CONNECTOR_WIZARD_P3 = J2EEUIPlugin.PLUGIN_ID + ".JCA_NEWIZARD_PAGE3"; //$NON-NLS-1$
+ public static final String NEW_JAVA_COMPONENT_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".NEW_JAVA_COMPONENT_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_JAVA_CLASS_OPTION_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".NEW_JAVA_CLASS_OPTION_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String NEW_UTILITY_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".NEW_UTILITY_WIZARD_P1"; //$NON-NLS-1$
+ public static final String NEW_UTILITY_WIZARD_P3 = J2EEUIPlugin.PLUGIN_ID + ".NEW_UTILITY_WIZARD_P3"; //$NON-NLS-1$
+
+ // Import, export wizards
+ public static final String IMPORT_EAR_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EAR_IMPORT_EAR_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String IMPORT_EAR_WIZARD_P2 = J2EEUIPlugin.PLUGIN_ID + ".EAR_IMPORT_EAR_WIZARD_PAGE2"; //$NON-NLS-1$
+ public static final String IMPORT_EAR_WIZARD_P3 = J2EEUIPlugin.PLUGIN_ID + ".EAR_IMPORT_EAR_WIZARD_PAGE3"; //$NON-NLS-1$
+ public static final String IMPORT_APPCLIENT_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".APPCLIENT_IMPORT_APPCLIENT_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String IMPORT_EJB_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EJB_IMPORT_EJB_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String IMPORT_RAR_WIZARD_PAGE = J2EEUIPlugin.PLUGIN_ID + ".IMPORT_RAR_WIZARD_PAGE"; //$NON-NLS-1$
+ public static final String IMPORT_UTILITY_JAR_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".IMPORT_UTILITY_JAR_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String IMPORT_UTILITY_JAR_WIZARD_P2 = J2EEUIPlugin.PLUGIN_ID + ".IMPORT_UTILITY_JAR_WIZARD_PAGE2"; //$NON-NLS-1$
+ public static final String IMPORT_CLASS_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".IMPORT_CLASS_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String IMPORT_CLASS_WIZARD_P2 = J2EEUIPlugin.PLUGIN_ID + ".IMPORT_CLASS_WIZARD_PAGE2"; //$NON-NLS-1$
+
+ public static final String EXPORT_EAR_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EAR_EXPORT_PAGE1"; //$NON-NLS-1$
+ public static final String EXPORT_APPCLIENT_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".APPCLIENT_EXPORT_APPCLIENT_WIZARD_PAGE1"; //$NON-NLS-1$
+ public static final String EXPORT_EJB_WIZARD_P1 = J2EEUIPlugin.PLUGIN_ID + ".EJB_EXPORT_PAGE1"; //$NON-NLS-1$
+ public static final String EXPORT_RAR_WIZARD_PAGE = J2EEUIPlugin.PLUGIN_ID + ".EXPORT_RAR_WIZARD_PAGE"; //$NON-NLS-1$
+
+ // dialogs
+ public static final String DELEATE_EAR_DIALOG_1 = J2EEUIPlugin.PLUGIN_ID + ".navm2000"; //$NON-NLS-1$
+ public static final String DELEATE_MODULE_DIALOG_1 = J2EEUIPlugin.PLUGIN_ID + ".navm2010"; //$NON-NLS-1$
+ public static final String RENAME_EAR_DIALOG_1 = J2EEUIPlugin.PLUGIN_ID + ".navm3000"; //$NON-NLS-1$
+ public static final String RENAME_MODULE_DIALOG_1 = J2EEUIPlugin.PLUGIN_ID + ".navm3010"; //$NON-NLS-1$
+ public static final String DEPLOYMENT_ASSEMBLY_PREFERENCE_PAGE_ADD_REFERENCED_PROJECT_CLASSPATH_ENTRIES= J2EEUIPlugin.PLUGIN_ID + ".DEPLOYMENT_ASSEMBLY_PREFERENCE_PAGE_ADD_REFERENCED_PROJECT_CLASSPATH_ENTRIES"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/J2EEDeployAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/J2EEDeployAction.java
new file mode 100644
index 0000000..245b05e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/J2EEDeployAction.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 30, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.actions;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.deploy.DeployerRegistry;
+import org.eclipse.jst.j2ee.internal.deploy.J2EEDeployOperation;
+import org.eclipse.jst.j2ee.internal.dialogs.Messages;
+import org.eclipse.jst.j2ee.internal.dialogs.RuntimeSelectionDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.internal.WTPResourceHandler;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.server.core.IRuntime;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class J2EEDeployAction extends BaseAction {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.ui.actions.BaseAction#primRun(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void primRun(Shell shell) {
+
+ if (checkEnabled(shell)) {
+ final IStructuredSelection deploySelection = selection;
+ Job deployJob = new Job(Messages.J2EEDeployAction_Deploy_) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus result = null;
+ J2EEDeployOperation op = new J2EEDeployOperation(deploySelection.toArray());
+ try {
+ result = op.execute(monitor, null);
+ } catch (Exception e) {
+ result = new Status(IStatus.ERROR, WTPCommonPlugin.PLUGIN_ID, IStatus.ERROR, WTPResourceHandler.getString("27"), e); //$NON-NLS-1$
+ Logger.getLogger().logError(e);
+ } finally {
+
+ }
+ return result;
+ }
+ };
+
+
+ try {
+ deployJob.setUser(true);
+ deployJob.schedule();
+ } catch (Exception e) {
+ //Ignore
+ }
+
+ }
+
+ }
+
+ /*
+ *
+ */
+ public J2EEDeployAction() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection aSelection) {
+ super.selectionChanged(action, aSelection);
+ action.setEnabled(true);
+ }
+
+
+ public boolean checkEnabled(Shell shell) {
+
+ try {
+ DeployerRegistry reg = DeployerRegistry.instance();
+
+ List components = DeployerRegistry.getSelectedModules(selection.toArray());
+ for (int i = 0; i < components.size(); i++) {
+ IVirtualComponent component = (IVirtualComponent) components.get(i);
+ IProject proj = component.getProject();
+ if (proj == null) {
+ displayMessageDialog(J2EEUIMessages.getResourceString("DEPLOY_PROJECT_NOT_FOUND") , shell); //$NON-NLS-1$
+ return false;
+ }
+
+ IRuntime runtime = J2EEProjectUtilities.getServerRuntime(proj);
+ if (runtime == null) {
+ String message = MessageFormat.format(J2EEUIMessages.getResourceString("DEPLOY_RUNTIME_NOT_FOUND"), new Object []{proj.getName()}); //$NON-NLS-1$
+ RuntimeSelectionDialog selectionDialog = new RuntimeSelectionDialog(shell,
+ J2EEUIMessages.getResourceString("DEPLOY_DIALOG_TITLE"), //$NON-NLS-1$
+ null /* default image */,
+ message,
+ MessageDialog.ERROR,
+ new String[] { IDialogConstants.OK_LABEL }, 0, proj) ;
+ selectionDialog.open();
+ runtime = J2EEProjectUtilities.getServerRuntime(proj);
+ if (runtime == null)
+ return false;
+ }
+ List visitors = reg.getDeployModuleExtensions(proj, runtime);
+ if (visitors.isEmpty()) {
+ displayMessageDialog(MessageFormat.format(J2EEUIMessages.getResourceString("DEPLOY_PROJECT_NOT_SUPPORTED"), new Object []{proj.getName()}), shell); //$NON-NLS-1$
+ return false;
+ }
+
+ }
+
+ return true;
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ return false;
+ }
+
+ private void displayMessageDialog(String message, Shell shell) {
+ String title = J2EEUIMessages.getResourceString("DEPLOY_DIALOG_TITLE"); //$NON-NLS-1$
+ MessageDialog dialog = new MessageDialog(shell,
+ title,
+ null /* default image */,
+ message,
+ MessageDialog.ERROR,
+ new String[] { IDialogConstants.OK_LABEL }, 0) ;
+ dialog.open();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEArtifactDropDownAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEArtifactDropDownAction.java
new file mode 100644
index 0000000..66a9d94
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEArtifactDropDownAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007,2009 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.actions;
+
+/**
+ * A wizard is added to the "New Java EE Artifact" drop down if it has a parameter 'javaeeartifact':
+ * <wizard
+ * name="My Java EE Project Wizard"
+ * icon="icons/wiz.gif"
+ * category="mycategory"
+ * id="xx.MyWizard">
+ * <class class="org.xx.MyWizard">
+ * <parameter name="javaeeartifact" value="true"/>
+ * </class>
+ * <description>
+ * My Wizard
+ * </description>
+ * </wizard>
+ */
+public class NewJavaEEArtifactDropDownAction extends NewJavaEEDropDownAction {
+
+ private final static String ATT_JAVAEEARTIFACT = "javaeeartifact";//$NON-NLS-1$
+
+ @Override
+ protected String getTypeAttribute() {
+ return ATT_JAVAEEARTIFACT;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEDropDownAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEDropDownAction.java
new file mode 100644
index 0000000..edb13a8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEDropDownAction.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2007,2009 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.actions;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.internal.ui.util.CoreUtility;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.layout.PixelConverter;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class NewJavaEEDropDownAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 {
+
+ public static class NewJavaEEWizardAction extends Action implements Comparable {
+
+ private final static String ATT_NAME = "name";//$NON-NLS-1$
+ private final static String ATT_CLASS = "class";//$NON-NLS-1$
+ private final static String ATT_ICON = "icon";//$NON-NLS-1$
+ private final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
+
+ private Shell fShell;
+ private IStructuredSelection fSelection;
+ private IConfigurationElement fConfigurationElement;
+
+ private int menuIndex;
+
+ public NewJavaEEWizardAction(IConfigurationElement element) {
+ fConfigurationElement= element;
+ setText(element.getAttribute(ATT_NAME));
+
+ String description = getDescriptionFromConfig(fConfigurationElement);
+ setDescription(description);
+ setToolTipText(description);
+ setImageDescriptor(getIconFromConfig(fConfigurationElement));
+ setMenuIndex(getMenuIndexFromConfig(fConfigurationElement));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ Shell shell = getShell();
+ try {
+ INewWizard wizard = createWizard();
+ wizard.init(PlatformUI.getWorkbench(), getSelection());
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
+ dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
+ dialog.create();
+ int res = dialog.open();
+
+ notifyResult(res == Window.OK);
+ } catch (CoreException e) {
+ Logger.getLogger().log(e);
+ }
+ }
+
+ /**
+ * Returns the configured selection. If no selection has been configured using {@link #setSelection(IStructuredSelection)},
+ * the currently selected element of the active workbench is returned.
+ * @return the configured selection
+ */
+ protected IStructuredSelection getSelection() {
+ if (fSelection == null) {
+ return evaluateCurrentSelection();
+ }
+ return fSelection;
+ }
+
+ private IStructuredSelection evaluateCurrentSelection() {
+ IWorkbenchWindow window = J2EEUIPlugin.getActiveWorkbenchWindow();
+ if (window != null) {
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * Configures the selection to be used as initial selection of the wizard.
+ * @param selection the selection to be set or <code>null</code> to use the selection of the active workbench window
+ */
+ public void setSelection(IStructuredSelection selection) {
+ fSelection = selection;
+ }
+
+ /**
+ * Returns the configured shell. If no shell has been configured using {@link #setShell(Shell)},
+ * the shell of the currently active workbench is returned.
+ * @return the configured shell
+ */
+ protected Shell getShell() {
+ if (fShell == null) {
+ return J2EEUIPlugin.getActiveWorkbenchShell();
+ }
+ return fShell;
+ }
+
+ /**
+ * Configures the shell to be used as parent shell by the wizard.
+ * @param shell the shell to be set or <code>null</code> to use the shell of the active workbench window
+ */
+ public void setShell(Shell shell) {
+ fShell = shell;
+ }
+
+ private String getDescriptionFromConfig(IConfigurationElement config) {
+ IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
+ if (children.length >= 1) {
+ return children[0].getValue();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private ImageDescriptor getIconFromConfig(IConfigurationElement config) {
+ String iconName = config.getAttribute(ATT_ICON);
+ if (iconName != null) {
+ return J2EEUIPlugin.imageDescriptorFromPlugin(config.getContributor().getName(), iconName);
+ }
+ return null;
+ }
+
+ private int getMenuIndexFromConfig(IConfigurationElement config) {
+ IConfigurationElement[] classElements = config.getChildren(TAG_CLASS);
+ if (classElements.length > 0) {
+ for (IConfigurationElement classElement : classElements) {
+ IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
+ for (IConfigurationElement paramElement : paramElements) {
+ if (ATT_MENUINDEX.equals(paramElement.getAttribute(TAG_NAME))) {
+ return Integer.parseInt(paramElement.getAttribute(TAG_VALUE));
+ }
+ }
+ }
+ }
+ return Integer.MAX_VALUE;
+ }
+
+ protected INewWizard createWizard() throws CoreException {
+ return (INewWizard) CoreUtility.createExtension(fConfigurationElement, ATT_CLASS);
+ }
+
+ public int getMenuIndex() {
+ return menuIndex;
+ }
+
+ public void setMenuIndex(int menuIndex) {
+ this.menuIndex = menuIndex;
+ }
+
+ public int compareTo(Object o) {
+ NewJavaEEWizardAction action = (NewJavaEEWizardAction) o;
+ return getMenuIndex() - action.getMenuIndex();
+ }
+ }
+
+ protected final static String TAG_WIZARD = "wizard";//$NON-NLS-1$
+ protected final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
+ protected final static String TAG_NAME = "name";//$NON-NLS-1$
+ protected final static String TAG_VALUE = "value";//$NON-NLS-1$
+ protected final static String TAG_CLASS = "class"; //$NON-NLS-1$
+ protected final static String ATT_MENUINDEX = "menuIndex";//$NON-NLS-1$
+ protected final static String PL_NEW = "newWizards"; //$NON-NLS-1$
+
+ protected Menu fMenu;
+
+ protected Shell fWizardShell;
+
+ public NewJavaEEDropDownAction() {
+ fMenu = null;
+ setMenuCreator(this);
+ }
+
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ public Menu getMenu(Control parent) {
+ if (fMenu == null) {
+ fMenu = new Menu(parent);
+ NewJavaEEWizardAction[] actions = getActionFromDescriptors();
+ for (NewJavaEEWizardAction action : actions) {
+ action.setShell(fWizardShell);
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(fMenu, -1);
+ }
+ }
+ return fMenu;
+ }
+
+ @Override
+ public void run() {
+ getDefaultAction().run();
+ }
+
+ public Action getDefaultAction() {
+ Action[] actions = getActionFromDescriptors();
+ if (actions.length > 0)
+ return actions[0];
+ return null;
+ }
+
+ public NewJavaEEWizardAction[] getActionFromDescriptors() {
+ ArrayList<NewJavaEEWizardAction> containers = new ArrayList<NewJavaEEWizardAction>();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
+ if (extensionPoint != null) {
+ IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(TAG_WIZARD) && isJavaEEProjectWizard(element)) {
+ containers.add(new NewJavaEEWizardAction(element));
+ }
+ }
+ }
+
+ NewJavaEEWizardAction[] actions = containers.toArray(new NewJavaEEWizardAction[containers.size()]);
+ Arrays.sort(actions);
+ return actions;
+ }
+
+ protected boolean isJavaEEProjectWizard(IConfigurationElement element) {
+ IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
+ if (classElements.length > 0) {
+ for (IConfigurationElement classElement : classElements) {
+ IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
+ for (IConfigurationElement paramElement : paramElements) {
+ if (getTypeAttribute().equals(paramElement.getAttribute(TAG_NAME))) {
+ return Boolean.valueOf(paramElement.getAttribute(TAG_VALUE)).booleanValue();
+ }
+ }
+ }
+ }
+ // old way, deprecated
+ if (Boolean.valueOf(element.getAttribute(getTypeAttribute())).booleanValue()) {
+ return true;
+ }
+ return false;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ fWizardShell = window.getShell();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+
+ }
+
+ protected abstract String getTypeAttribute();
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEProjectDropDownAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEProjectDropDownAction.java
new file mode 100644
index 0000000..7855306
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/NewJavaEEProjectDropDownAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007,2009 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.actions;
+
+/**
+ * A wizard is added to the "New Java EE Project" drop down if it has a parameter 'javaeeproject':
+ * <wizard
+ * name="My Java EE Project Wizard"
+ * icon="icons/wiz.gif"
+ * category="mycategory"
+ * id="xx.MyWizard">
+ * <class class="org.xx.MyWizard">
+ * <parameter name="javaeeproject" value="true"/>
+ * </class>
+ * <description>
+ * My Wizard
+ * </description>
+ * </wizard>
+ */
+public class NewJavaEEProjectDropDownAction extends NewJavaEEDropDownAction {
+
+ private final static String ATT_JAVAEEPROJECT = "javaeeproject";//$NON-NLS-1$
+
+ @Override
+ protected String getTypeAttribute() {
+ return ATT_JAVAEEPROJECT;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/OpenJ2EEResourceAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/OpenJ2EEResourceAction.java
new file mode 100644
index 0000000..e1d10b1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/OpenJ2EEResourceAction.java
@@ -0,0 +1,460 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.actions;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
+import org.eclipse.jst.j2ee.internal.archive.JavaEEArchiveUtilities;
+import org.eclipse.jst.j2ee.internal.componentcore.ComponentArchiveOptions;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
+import org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper;
+import org.eclipse.jst.j2ee.internal.plugin.BinaryEditorUtilities;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEEditorUtility;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.EJBLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServletLink;
+import org.eclipse.jst.jee.archive.IArchive;
+import org.eclipse.jst.jee.archive.IArchiveResource;
+import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+
+/**
+ * Action for opening a J2EE resource from the J2EE navigator.
+ */
+public class OpenJ2EEResourceAction extends AbstractOpenAction {
+
+ public static final String ID = "org.eclipse.jst.j2ee.internal.internal.ui.actions.OpenJ2EEResourceAction"; //$NON-NLS-1$
+ public static final String JAVA_EDITOR_ID = "org.eclipse.jst.j2ee.internal.internal.ejb.ui.java.EnterpriseBeanJavaEditor"; //$NON-NLS-1$
+ public static final String BASE_JAVA_EDITOR_ID = "org.eclipse.jdt.ui.CompilationUnitEditor"; //$NON-NLS-1$
+
+ protected static IEditorDescriptor javaEditorDescriptor;
+ protected static IEditorDescriptor baseJavaEditorDescriptor;
+
+ /**
+ * Create an instance of this class
+ */
+ public OpenJ2EEResourceAction() {
+ super(J2EEUIMessages.getResourceString(J2EEUIMessages.OPEN_J2EE_RESOURCE_ACTION_0));
+ }
+
+ /**
+ * Returns the action ID.
+ */
+ public String getID() {
+ return ID;
+ }
+
+ public static IEditorDescriptor getJavaEditorDescriptor() {
+ if (javaEditorDescriptor == null)
+ javaEditorDescriptor = findEditorDescriptor(JAVA_EDITOR_ID);
+ return javaEditorDescriptor;
+ }
+
+ public static IEditorDescriptor getBaseJavaEditorDescriptor() {
+ if (baseJavaEditorDescriptor == null)
+ baseJavaEditorDescriptor = findEditorDescriptor(BASE_JAVA_EDITOR_ID);
+ return baseJavaEditorDescriptor;
+ }
+
+ protected void openAppropriateEditor(IVirtualComponent c){
+ if (c == null){
+ return;
+ }
+ IWorkbenchPage page = null;
+ IEditorPart editor = null;
+ try {
+ page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ IEditorInput editorInput = null;
+
+ //[Bug 237794] if component c is a JEE 5 archive then editorInput needs to be a BinaryEditorInput
+ if (c.isBinary()) {
+ JavaEEQuickPeek qp = JavaEEBinaryComponentHelper.getJavaEEQuickPeek(c);
+ //[Bug 239440] because Connectors are opened with the basic XML editor and not a specialized editor they need binary editor input
+ if( qp.getJavaEEVersion() == JavaEEQuickPeek.JEE_5_0_ID || qp.getJavaEEVersion() == JavaEEQuickPeek.JEE_6_0_ID || qp.getType() == JavaEEQuickPeek.CONNECTOR_TYPE) {
+ String path = ((EObject)srcObject).eResource().getURI().toString();
+ editorInput = BinaryEditorUtilities.getBinaryEditorInput(c, path);
+ }
+ }
+
+ //this is for all other cases
+ if(editorInput == null) {
+ editorInput = new ComponentEditorInput(c);
+ }
+
+ editor = page.openEditor(editorInput, currentDescriptor.getId());
+ if (editor instanceof ISetSelectionTarget)
+ ((ISetSelectionTarget) editor).selectReveal(getStructuredSelection());
+ } catch (Exception e) {
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), J2EEUIMessages.getResourceString("Problems_Opening_Editor_ERROR_"), e.getMessage()); //$NON-NLS-1$ = "Problems Opening Editor"
+ }
+ }
+
+
+ /**
+ * open the appropriate editor
+ */
+ protected void openAppropriateEditor(IResource r) {
+ if (r == null)
+ return;
+ IWorkbenchPage page = null;
+ IEditorPart editor = null;
+ try {
+ page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if( currentDescriptor != null ){
+ editor = page.openEditor(new FileEditorInput((IFile) r), currentDescriptor.getId());
+ if (editor instanceof ISetSelectionTarget)
+ ((ISetSelectionTarget) editor).selectReveal(getStructuredSelection());
+ }
+ } catch (Exception e) {
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), J2EEUIMessages.getResourceString("Problems_Opening_Editor_ERROR_"), e.getMessage()); //$NON-NLS-1$ = "Problems Opening Editor"
+ }
+ }
+
+ /**
+ * The user has invoked this action
+ */
+ @Override
+ public void run() {
+ if (!isEnabled())
+ return;
+
+ if (srcObject instanceof J2EEJavaClassProviderHelper) {
+ ((J2EEJavaClassProviderHelper) srcObject).openInEditor();
+ return;
+ }
+
+ if( isEJB3BeanObject(srcObject) ){
+ String name = ""; //$NON-NLS-1$
+ if( srcObject instanceof org.eclipse.jst.javaee.ejb.SessionBean ){
+ org.eclipse.jst.javaee.ejb.SessionBean bean = (org.eclipse.jst.javaee.ejb.SessionBean)srcObject;
+ name = bean.getEjbClass();
+ }else if(srcObject instanceof org.eclipse.jst.javaee.ejb.MessageDrivenBean){
+ org.eclipse.jst.javaee.ejb.MessageDrivenBean bean = (org.eclipse.jst.javaee.ejb.MessageDrivenBean)srcObject;
+ name = bean.getEjbClass();
+ }else if(srcObject instanceof org.eclipse.jst.javaee.ejb.EntityBean){
+ org.eclipse.jst.javaee.ejb.EntityBean bean = (org.eclipse.jst.javaee.ejb.EntityBean)srcObject;
+ name = bean.getEjbClass();
+ }
+ openResourceInEditor(name, (EObject)srcObject);
+ return;
+ }
+
+ if(srcObject instanceof org.eclipse.jst.javaee.web.Servlet ){
+ String name = ""; //$NON-NLS-1$
+ name = ((org.eclipse.jst.javaee.web.Servlet)srcObject).getServletClass();
+ openResourceInEditor(name, (EObject)srcObject);
+ return;
+ }
+ if( srcObject instanceof org.eclipse.jst.javaee.web.Filter ){
+ String name = ""; //$NON-NLS-1$
+ name = ((org.eclipse.jst.javaee.web.Filter)srcObject).getFilterClass();
+ openResourceInEditor(name, (EObject)srcObject);
+ return;
+ }
+
+ if( srcObject instanceof org.eclipse.jst.javaee.core.Listener ){
+ String name = ""; //$NON-NLS-1$
+ name = ((org.eclipse.jst.javaee.core.Listener)srcObject).getListenerClass();
+ openResourceInEditor(name, (EObject)srcObject);
+ return;
+ }
+
+ if (srcObject instanceof EObject) {
+ EObject ro = (EObject) srcObject;
+ IProject p = ProjectUtilities.getProject(ro);
+
+ if (ro instanceof BeanLink) {
+ openBeanLinkInJavaEditor((BeanLink) ro, p);
+ return;
+ }
+ IResource resource = WorkbenchResourceHelper.getFile((EObject)srcObject);
+ if(resource != null && resource.exists()){
+ openAppropriateEditor(resource);
+ } else if(ro.eResource() != null) {
+ ModuleFile moduleFile = ArchiveUtil.getModuleFile(ro);
+ if (moduleFile != null) {
+ ArchiveOptions options = moduleFile.getOptions();
+ if(options instanceof ComponentArchiveOptions) {
+ IVirtualComponent component = ((ComponentArchiveOptions)options).getComponent();
+ openAppropriateEditor(component);
+ }
+ } else {
+ //if can't get a ModuleFile then get the component from the archive
+ IArchive archive = JavaEEArchiveUtilities.findArchive(ro);
+ if(archive != null) {
+ IVirtualComponent component = JavaEEArchiveUtilities.findComponent(archive);
+ if(component != null){
+ openAppropriateEditor(component);
+ }
+ }
+ }
+ }
+ } else if (srcObject instanceof Resource) {
+ openAppropriateEditor(WorkbenchResourceHelper.getFile((Resource)srcObject));
+ }
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should override this method
+ * to react to the change. Returns true if the action should be enabled for this selection, and
+ * false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked. If the super method
+ * returns false, this method must also return false.
+ *
+ * @param sel the new structured selection
+ */
+ @Override
+ public boolean updateSelection(IStructuredSelection s) {
+ if (!super.updateSelection(s))
+ return false;
+
+ // Make sure this is one of the selections we can handle,
+ // then set the source object as is. The run() will do the hard stuff.
+ Object obj = s.getFirstElement();
+
+ if (obj instanceof J2EEJavaClassProviderHelper) {
+ currentDescriptor = getJavaEditorDescriptor();
+ } else if (obj instanceof BeanLink) {
+ currentDescriptor = getBaseJavaEditorDescriptor();
+ } else if(isEJB3BeanObject(obj)) {
+ //[241685] if it is a EJB 3 bean the class is specially opened by the run() method
+ srcObject = obj;
+ return true;
+ } else if(obj instanceof org.eclipse.jst.javaee.web.Servlet ||
+ obj instanceof org.eclipse.jst.javaee.web.Filter ||
+ obj instanceof org.eclipse.jst.javaee.core.Listener ){
+ srcObject = obj;
+ return true;
+ }else if (obj instanceof EObject) {
+ IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
+ IFile file = WorkbenchResourceHelper.getFile((EObject)obj);
+ if(file != null) {
+ if(file.exists()){
+ IContentType contentType = IDE.getContentType(file);
+ currentDescriptor = registry.getDefaultEditor(file.getName(), contentType);
+ } else {
+ currentDescriptor = null;
+ return false;
+ }
+ } else if (((EObject)obj).eResource() != null) {
+ //[Bug 237794] if the file is null then it maybe a binary resource in an archive
+ // attempt to get the resource from the archive and the content type from that
+ EObject eObj = (EObject) obj;
+ IArchive archive = JavaEEArchiveUtilities.findArchive(eObj);
+ if(archive != null) {
+ IPath path = new Path(((EObject)obj).eResource().getURI().toString());
+ if(archive.containsArchiveResource(path)) {
+ InputStream stream = null;
+ try {
+ IArchiveResource resource = archive.getArchiveResource(path);
+ stream = resource.getInputStream();
+ IContentType type = Platform.getContentTypeManager().findContentTypeFor(stream, path.lastSegment());
+ currentDescriptor = registry.getDefaultEditor(path.lastSegment(),type);
+ } catch (FileNotFoundException e) {
+ J2EEUIPlugin.logError(-1, e.getMessage(), e);
+ } catch (IOException e) {
+ J2EEUIPlugin.logError(-1, e.getMessage(), e);
+ } finally {
+ if(stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ J2EEUIPlugin.logError(-1, e.getMessage(), e);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ else if (obj instanceof Resource) {
+ IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
+ IFile file = WorkbenchResourceHelper.getFile((Resource)obj);
+ IContentType contentType = IDE.getContentType(file);
+ currentDescriptor = registry.getDefaultEditor(file.getName(), contentType);
+ }
+ else {
+ currentDescriptor = null;
+ return false;
+ }
+ setAttributesFromDescriptor();
+ srcObject = obj;
+ return true;
+ }
+
+ /**
+ * @param link
+ */
+ private void openBeanLinkInJavaEditor(BeanLink link, IProject p) {
+ String linkName = null;
+ JavaClass javaClass = null;
+ IVirtualComponent comp = ComponentUtilities.findComponent(link);
+ // Handle EJB Link case
+ if (link instanceof EJBLink) {
+ linkName = ((EJBLink) link).getEjbLink();
+ EJBArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = EJBArtifactEdit.getEJBArtifactEditForRead(comp);
+ EJBJar ejbJar = artifactEdit.getEJBJar();
+ if (ejbJar == null)
+ return;
+ EnterpriseBean bean = ejbJar.getEnterpriseBeanNamed(linkName);
+ if (bean == null)
+ return;
+ javaClass = bean.getEjbClass();
+ } finally {
+ if (artifactEdit!=null)
+ artifactEdit.dispose();
+ }
+ }
+ // Handle Servlet Link case
+ else {
+ linkName = ((ServletLink) link).getServletLink();
+ WebArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = WebArtifactEdit.getWebArtifactEditForRead(comp);
+ WebApp webApp = artifactEdit.getWebApp();
+ if (webApp == null)
+ return;
+ Servlet servlet = webApp.getServletNamed(linkName);
+ if (servlet == null)
+ return;
+ javaClass = servlet.getServletClass();
+ } finally {
+ if (artifactEdit!=null)
+ artifactEdit.dispose();
+ }
+ }
+ // Open java editor on the selected objects associated java file
+ try {
+ J2EEEditorUtility.openInEditor(javaClass, p);
+ } catch (Exception cantOpen) {
+ J2EEUIPlugin.logError(-1, cantOpen.getMessage(), cantOpen);
+ }
+ }
+
+ protected EObject getRootObject(Object obj) {
+ if (obj instanceof EObject) {
+ EObject refObj = (EObject) obj;
+ while (refObj != null && refObj.eContainer() != null)
+ refObj = refObj.eContainer();
+ return refObj;
+ }
+ return null;
+ }
+
+ /**
+ * Determines if the given object is a EJB 3 Bean
+ * [241685] first added
+ *
+ * @param obj determine weather this object is an EJB 3 bean or not
+ * @return true if obj is a EJB 3 bean, false otherwise
+ */
+ private boolean isEJB3BeanObject(Object obj) {
+ boolean isBean =
+ obj instanceof org.eclipse.jst.javaee.ejb.SessionBean ||
+ obj instanceof org.eclipse.jst.javaee.ejb.MessageDrivenBean ||
+ obj instanceof org.eclipse.jst.javaee.ejb.EntityBean;
+
+ return isBean;
+ }
+
+ protected void openResourceInEditor(String name, EObject object){
+ IResource resource = WorkbenchResourceHelper.getFile(object);
+ if( resource == null )
+ return;
+
+ IProject project = resource.getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+ if(javaProject.exists()){
+ IType type = null;
+ try {
+ //if name is null then can't get type
+ if(name != null) {
+ type = javaProject.findType( name );
+ }
+
+ //if type is null then can't open its editor, so open editor for the resource
+ if(type != null) {
+ if( !type.isBinary() ){
+ ICompilationUnit cu = type.getCompilationUnit();
+ EditorUtility.openInEditor(cu);
+ }else{
+ IClassFile classFile = type.getClassFile();
+ EditorUtility.openInEditor(classFile);
+ }
+
+ } else{
+ if(resource.exists() && resource.getType() == IResource.FILE ){
+ IFile file = (IFile)resource;
+ IContentType contentType = IDE.getContentType(file);
+ currentDescriptor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName(), contentType);
+ }
+ openAppropriateEditor(resource);
+ }
+ } catch (JavaModelException e) {
+ J2EEUIPlugin.logError(-1, e.getMessage(), e);
+ } catch (PartInitException e) {
+ J2EEUIPlugin.logError(-1, e.getMessage(), e);
+ }
+
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/WorkspaceModifyComposedOperation.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/WorkspaceModifyComposedOperation.java
new file mode 100644
index 0000000..ec3fac9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/actions/WorkspaceModifyComposedOperation.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.actions;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+/**
+ * WARNING: This class will be deleted
+ *
+ * @deprecated use {@link org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation}
+ */
+public class WorkspaceModifyComposedOperation extends org.eclipse.wst.common.frameworks.internal.ui.WorkspaceModifyComposedOperation {
+ public WorkspaceModifyComposedOperation(ISchedulingRule rule) {
+ super(rule);
+ }
+
+ public WorkspaceModifyComposedOperation() {
+ super();
+ }
+
+ public WorkspaceModifyComposedOperation(ISchedulingRule rule, List nestedRunnablesWithProgress) {
+ super(rule, nestedRunnablesWithProgress);
+ }
+
+ public WorkspaceModifyComposedOperation(List nestedRunnablesWithProgress) {
+ super(nestedRunnablesWithProgress);
+ }
+
+ public WorkspaceModifyComposedOperation(IRunnableWithProgress nestedOp) {
+ super(nestedOp);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.java
new file mode 100644
index 0000000..f183b33
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 BEA Systems, Inc.
+ * 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:
+ * rfrost@bea.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.classpathdep.ui;
+
+import java.net.URL;
+
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+
+public class ClasspathDependencyAttributeConfiguration extends ClasspathAttributeConfiguration {
+
+ private static ImageDescriptor descriptor = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canEdit(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public boolean canEdit(ClasspathAttributeAccess attribute) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public boolean canRemove(ClasspathAttributeAccess attribute) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getImageDescriptor(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor(ClasspathAttributeAccess attribute) {
+ if (descriptor == null) {
+ final URL gifImageURL = (URL) J2EEPlugin.getPlugin().getImage("CPDep"); //$NON-NLS-1$
+ if (gifImageURL != null) {
+ descriptor = ImageDescriptor.createFromURL(gifImageURL);
+ }
+ }
+ return descriptor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getNameLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public String getNameLabel(ClasspathAttributeAccess attribute) {
+ return Resources.nameLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getValueLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public String getValueLabel(ClasspathAttributeAccess attribute) {
+ final IClasspathAttribute attrib = attribute.getClasspathAttribute();
+ if (attrib != null) {
+ final String value = attrib.getValue();
+ if (value != null) {
+ if (value.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER)) {
+ return Resources.containerMapping;
+ }
+ return value;
+ }
+ }
+ return Resources.unspecified;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performEdit(org.eclipse.swt.widgets.Shell, org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public IClasspathAttribute performEdit(Shell shell,
+ ClasspathAttributeAccess attribute) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public IClasspathAttribute performRemove(ClasspathAttributeAccess attribute) {
+ return JavaCore.newClasspathAttribute(IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY, null);
+ }
+
+ private static final class Resources extends NLS {
+ public static String nameLabel;
+ public static String unspecified;
+ public static String containerMapping;
+ static
+ {
+ initializeMessages( ClasspathDependencyAttributeConfiguration.class.getName(),
+ Resources.class );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.properties
new file mode 100644
index 0000000..3f050ff
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyAttributeConfiguration.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2007 BEA Systems, Inc.
+# 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:
+# rfrost@bea.com - initial API and implementation
+###############################################################################
+nameLabel = Publish/export dependency
+unspecified = (None)
+containerMapping = Added to parent module
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.java
new file mode 100644
index 0000000..24bf997
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.java
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * Copyright (c) 2007 BEA Systems, Inc.
+ * 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:
+ * rfrost@bea.com - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.classpathdep.ui;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jst.j2ee.classpathdep.UpdateClasspathAttributeUtil;
+import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.eclipse.wst.validation.internal.ConfigurationConstants;
+
+/**
+ * IMarkerResolutionGenerator for classpath dependency validator problem markers.
+ */
+public final class ClasspathDependencyValidatorMarkerResolutions implements IMarkerResolutionGenerator {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IMarkerResolutionGenerator#getResolutions(org.eclipse.core.resources.IMarker)
+ */
+ public IMarkerResolution[] getResolutions(final IMarker marker) {
+ // generate resolutions based on type of validation problem marker
+ String messageId = null;
+ String cpEntryPath = null;
+ try {
+ messageId = (String) marker.getAttribute(ConfigurationConstants.VALIDATION_MARKER_MESSAGEID);
+ cpEntryPath = (String) marker.getAttribute(ConfigurationConstants.VALIDATION_MARKER_GROUP);
+ } catch (CoreException ce) {
+ Logger.getLogger(J2EEUIPlugin.PLUGIN_ID).logError(ce);
+ return new IMarkerResolution[0];
+ }
+
+ if (messageId == null || cpEntryPath == null || cpEntryPath.length() == 0) {
+ return new IMarkerResolution[0];
+ }
+
+ if (ClasspathDependencyValidator.AppClientProject.equals(messageId)) {
+ // can apply to multiple cp entries so not currently supporting a quick fix...
+ } else if (ClasspathDependencyValidator.DuplicateClassFolderEntry.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.DuplicateArchiveName.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.FilteredContainer.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.InvalidNonWebRuntimePath.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.InvalidWebRuntimePath.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.NonTaggedExportedClasses.equals(messageId)) {
+ IResource resource = marker.getResource();
+ if(null != resource && resource.getType() == IResource.PROJECT && !JavaEEProjectUtilities.isApplicationClientProject((IProject)resource)){
+ // quick fix adds the dependency, and one to remove it
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, true),
+ new AddClasspathNonDependencyAttributeResolution(cpEntryPath)};
+ }
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new AddClasspathNonDependencyAttributeResolution(cpEntryPath) };
+ } else if (ClasspathDependencyValidator.ProjectClasspathEntry.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ } else if (ClasspathDependencyValidator.RootMappingNonEARWARRef.equals(messageId)) {
+ // can apply to multiple cp entries so not currently supporting a quick fix...
+ } else if (ClasspathDependencyValidator.SourceEntry.equals(messageId)) {
+ // quick fix removes the dependency
+ return new IMarkerResolution[] { new UpdateClasspathDependencyAttributeResolution(cpEntryPath, false) };
+ }
+
+ return new IMarkerResolution[0];
+ }
+
+ private static IClasspathEntry getClasspathEntryForMarker(final IMarker marker, final String cpEntryPath) throws CoreException {
+ final IProject proj = marker.getResource().getProject();
+ if (proj != null && proj.hasNature(JavaCore.NATURE_ID)) {
+ final IJavaProject jProject = JavaCore.create(proj);
+ if (cpEntryPath != null) {
+ IClasspathEntry[] rawCp = jProject.getRawClasspath();
+ for (int i = 0; i < rawCp.length; i++) {
+ if (rawCp[i].getPath().toString().equals(cpEntryPath)) {
+ return rawCp[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /* Resolution that add/removes the classpath dependency attribute */
+ private static final class UpdateClasspathDependencyAttributeResolution implements IMarkerResolution {
+ private final boolean add;
+ private final String cpEntryPath;
+ public UpdateClasspathDependencyAttributeResolution(final String cpEntryPath, final boolean add) {
+ this.add = add;
+ this.cpEntryPath = cpEntryPath;
+ }
+
+ public String getLabel() {
+ if (add) {
+ return Resources.addClasspathDependencyAttribute;
+ }
+ return Resources.removeClasspathDependencyAttribute;
+ }
+
+ public void run(final IMarker marker) {
+ final IProject proj = marker.getResource().getProject();
+ try {
+ final IClasspathEntry cpEntry = getClasspathEntryForMarker(marker, cpEntryPath);
+ if (add) {
+ UpdateClasspathAttributeUtil.addDependencyAttribute(null, proj.getName(), cpEntry);
+ } else {
+ UpdateClasspathAttributeUtil.removeDependencyAttribute(null, proj.getName(), cpEntry);
+ }
+ } catch (CoreException ce){
+ ErrorDialog.openError(null, Resources.errorDialogTitle,
+ Resources.errorDialogMessage,
+ ce.getStatus());
+ } catch (ExecutionException ee){
+ ErrorDialog.openError(null, Resources.errorDialogTitle,
+ Resources.errorDialogMessage,
+ new Status(IStatus.ERROR, J2EEUIPlugin.PLUGIN_ID, 0, ee.getLocalizedMessage(), ee));
+ }
+ }
+ }
+
+ /* Resolution that adds the classpath nondependency attribute */
+ private static final class AddClasspathNonDependencyAttributeResolution implements IMarkerResolution {
+ private final String cpEntryPath;
+ public AddClasspathNonDependencyAttributeResolution(final String cpEntryPath) {
+ this.cpEntryPath = cpEntryPath;
+ }
+
+ public String getLabel() {
+ return Resources.addClasspathNonDependencyAttribute;
+ }
+
+ public void run(final IMarker marker) {
+ final IProject proj = marker.getResource().getProject();
+ try {
+ final IClasspathEntry cpEntry = getClasspathEntryForMarker(marker, cpEntryPath);
+ UpdateClasspathAttributeUtil.addNonDependencyAttribute(null, proj.getName(), cpEntry);
+ } catch (CoreException ce){
+ ErrorDialog.openError(null, Resources.errorDialogTitle,
+ Resources.errorDialogMessage,
+ ce.getStatus());
+ } catch (ExecutionException ee){
+ ErrorDialog.openError(null, Resources.errorDialogTitle,
+ Resources.errorDialogMessage,
+ new Status(IStatus.ERROR, J2EEUIPlugin.PLUGIN_ID, 0, ee.getLocalizedMessage(), ee));
+ }
+ }
+ }
+
+ private static final class Resources extends NLS {
+ public static String removeClasspathDependencyAttribute;
+ public static String addClasspathDependencyAttribute;
+ public static String addClasspathNonDependencyAttribute;
+ public static String errorDialogTitle;
+ public static String errorDialogMessage;
+
+ static
+ {
+ initializeMessages( ClasspathDependencyValidatorMarkerResolutions.class.getName(),
+ Resources.class );
+ }
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.properties
new file mode 100644
index 0000000..c21e5af
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathDependencyValidatorMarkerResolutions.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2005, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+addClasspathDependencyAttribute = Mark the associated raw classpath entry as a publish/export dependency.
+addClasspathNonDependencyAttribute = Exclude the associated raw classpath entry from the set of potential publish/export dependencies.
+removeClasspathDependencyAttribute = Remove publish/export dependency on the associated raw classpath entry.
+errorDialogTitle = Error
+errorDialogMessage = Failed while applying the quick fix.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.java
new file mode 100644
index 0000000..cad0465
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007 BEA Systems, Inc.
+ * 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:
+ * rfrost@bea.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.classpathdep.ui;
+
+import java.net.URL;
+
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+
+public class ClasspathNonDependencyAttributeConfiguration extends ClasspathAttributeConfiguration {
+
+ private static ImageDescriptor descriptor = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canEdit(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public boolean canEdit(ClasspathAttributeAccess attribute) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public boolean canRemove(ClasspathAttributeAccess attribute) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getImageDescriptor(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor(ClasspathAttributeAccess attribute) {
+ if (descriptor == null) {
+ final URL gifImageURL = (URL) J2EEPlugin.getPlugin().getImage("CPDep"); //$NON-NLS-1$
+ if (gifImageURL != null) {
+ descriptor = ImageDescriptor.createFromURL(gifImageURL);
+ }
+ }
+ return descriptor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getNameLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public String getNameLabel(ClasspathAttributeAccess attribute) {
+ return Resources.nameLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getValueLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public String getValueLabel(ClasspathAttributeAccess attribute) {
+ return Resources.unspecified;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performEdit(org.eclipse.swt.widgets.Shell, org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public IClasspathAttribute performEdit(Shell shell,
+ ClasspathAttributeAccess attribute) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
+ */
+ @Override
+ public IClasspathAttribute performRemove(ClasspathAttributeAccess attribute) {
+ return JavaCore.newClasspathAttribute(IClasspathDependencyConstants.CLASSPATH_COMPONENT_NON_DEPENDENCY, null);
+ }
+
+ private static final class Resources extends NLS {
+ public static String nameLabel;
+ public static String unspecified;
+ static
+ {
+ initializeMessages( ClasspathNonDependencyAttributeConfiguration.class.getName(),
+ Resources.class );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.properties
new file mode 100644
index 0000000..5234408
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/classpathdep/ui/ClasspathNonDependencyAttributeConfiguration.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2007 BEA Systems, Inc.
+# 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:
+# rfrost@bea.com - initial API and implementation
+###############################################################################
+nameLabel = Excluded from publish/export structure
+unspecified = (None)
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/AppClientArchiveUIResourceHandler.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/AppClientArchiveUIResourceHandler.java
new file mode 100644
index 0000000..f610fcf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/AppClientArchiveUIResourceHandler.java
@@ -0,0 +1,59 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.client.actions;
+
+
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class AppClientArchiveUIResourceHandler {
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("appclientarchiveui");//$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String, String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ } catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ExportApplicationClientAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ExportApplicationClientAction.java
new file mode 100644
index 0000000..519b60b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ExportApplicationClientAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 27, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.client.actions;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.actions.BaseAction;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.wizard.AppClientComponentExportWizard;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * @author jsholl
+ *
+ * To change this generated comment go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ExportApplicationClientAction extends BaseAction {
+ public static String LABEL = J2EEUIPlugin.getDefault().getDescriptor().getResourceString("%client.export.action.label_ui_"); //$NON-NLS-1$
+ private static final String ICON = "appclient_export_wiz"; //$NON-NLS-1$
+
+ public ExportApplicationClientAction() {
+ super();
+ setText(LABEL);
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(ICON));
+ }
+
+ @Override
+ protected void primRun(Shell shell) {
+ AppClientComponentExportWizard wizard = new AppClientComponentExportWizard();
+ J2EEUIPlugin plugin = J2EEUIPlugin.getDefault();
+ wizard.init(plugin.getWorkbench(), selection);
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.open();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ImportApplicationClientAction.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ImportApplicationClientAction.java
new file mode 100644
index 0000000..393146f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/client/actions/ImportApplicationClientAction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 27, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.client.actions;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.actions.BaseAction;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.wizard.AppClientComponentImportWizard;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * @author jsholl
+ *
+ * To change this generated comment go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ImportApplicationClientAction extends BaseAction {
+
+ public static String LABEL = AppClientArchiveUIResourceHandler.getString("Application_Client_Import_UI_"); //$NON-NLS-1$
+ private static final String ICON = "appclient_import_wiz"; //$NON-NLS-1$
+
+ public ImportApplicationClientAction() {
+ super();
+ setText(LABEL);
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(ICON));
+ }
+
+ @Override
+ protected void primRun(Shell shell) {
+
+ AppClientComponentImportWizard wizard = new AppClientComponentImportWizard();
+
+ J2EEUIPlugin plugin = J2EEUIPlugin.getDefault();
+
+ wizard.init(plugin.getWorkbench(), StructuredSelection.EMPTY);
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.open();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/AbstractOverrideCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/AbstractOverrideCommand.java
new file mode 100644
index 0000000..acb50d9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/AbstractOverrideCommand.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.command;
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.edit.command.AbstractOverrideableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * Insert the type's description here. Creation date: (06/07/01 10:56:08 AM)
+ *
+ * @author: Administrator
+ */
+public abstract class AbstractOverrideCommand extends AbstractCommand {
+ private AbstractOverrideableCommand overridable;
+ private J2EEClipboard j2eeClipboard;
+
+ /**
+ * AbstractOverrideCommand constructor comment.
+ */
+ protected AbstractOverrideCommand() {
+ super();
+ }
+
+ public AbstractOverrideCommand(AbstractOverrideableCommand command) {
+ super(command.getLabel(), command.getDescription());
+ setOverridable(command);
+ }
+
+ @Override
+ public boolean canExecute() {
+ return super.canExecute() && overridable.doCanExecute();
+ }
+
+ @Override
+ public boolean canUndo() {
+ return overridable.doCanUndo();
+ }
+
+ @Override
+ public Collection getAffectedObjects() {
+ return overridable.doGetAffectedObjects();
+ }
+
+ public EditingDomain getDomain() {
+ return getOverridable().getDomain();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 11:19:27 AM)
+ *
+ * @return org.eclipse.jst.j2ee.internal.internal.internal.command.J2EEClipboard
+ */
+ public J2EEClipboard getJ2eeClipboard() {
+ return j2eeClipboard;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 10:58:33 AM)
+ *
+ * @return AbstractOverrideableCommand
+ */
+ public AbstractOverrideableCommand getOverridable() {
+ return overridable;
+ }
+
+ @Override
+ public Collection getResult() {
+ return getJ2eeClipboard();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 11:19:27 AM)
+ *
+ * @param newJ2eeClipboard
+ * org.eclipse.jst.j2ee.internal.internal.internal.command.J2EEClipboard
+ */
+ protected void setJ2eeClipboard(J2EEClipboard newJ2eeClipboard) {
+ j2eeClipboard = newJ2eeClipboard;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 10:58:33 AM)
+ *
+ * @param AbstractOverrideableCommand
+ */
+ protected void setOverridable(AbstractOverrideableCommand newOverridable) {
+ overridable = newOverridable;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEClipboard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEClipboard.java
new file mode 100644
index 0000000..313934d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEClipboard.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.command;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+
+public class J2EEClipboard extends ArrayList {
+ /**
+ * Warning cleanup 12/07/2005
+ */
+ private static final long serialVersionUID = 8713021573099134096L;
+ private Map bindings;
+ private Map extensions;
+
+ /**
+ * J2EEClipboard constructor comment.
+ */
+ public J2EEClipboard(Collection defaultClipboard) {
+ super(defaultClipboard);
+ }
+
+ @Override
+ public boolean addAll(Collection c) {
+ boolean result = super.addAll(c);
+ if (result && (c instanceof J2EEClipboard))
+ addAllExtra((J2EEClipboard) c);
+ return result;
+ }
+
+ protected void addAllExtra(J2EEClipboard c) {
+ getBindings().putAll(c.getBindings());
+ getExtensions().putAll(c.getExtensions());
+ }
+
+ protected void addBinding(EObject boundObject, EObject binding) {
+ getBindings().put(boundObject, binding);
+ }
+
+ protected void addExtension(EObject extendedObject, EObject extension) {
+ getExtensions().put(extendedObject, extension);
+ }
+
+ public EObject getBinding(EObject o) {
+ return (EObject) getBindings().get(o);
+ }
+
+ protected Map getBindings() {
+ if (bindings == null)
+ bindings = new HashMap(10);
+ return bindings;
+ }
+
+ public EObject getExtension(EObject o) {
+ return (EObject) getExtensions().get(o);
+ }
+
+ protected Map getExtensions() {
+ if (extensions == null)
+ extensions = new HashMap(10);
+ return extensions;
+ }
+
+ public boolean hasBindings() {
+ return bindings != null && !bindings.isEmpty();
+ }
+
+ public boolean hasExtensions() {
+ return extensions != null && !extensions.isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECompoundCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECompoundCommand.java
new file mode 100644
index 0000000..7fa7913
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECompoundCommand.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.command;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+
+/**
+ * Insert the type's description here. Creation date: (06/13/01 10:27:16 AM)
+ *
+ * @author: Administrator
+ */
+public class J2EECompoundCommand extends CompoundCommand {
+ /**
+ * J2EECompoundCommand constructor comment.
+ */
+ public J2EECompoundCommand() {
+ super();
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ */
+ public J2EECompoundCommand(int resultIndex) {
+ super(resultIndex);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ * @param label
+ * java.lang.String
+ */
+ public J2EECompoundCommand(int resultIndex, String label) {
+ super(resultIndex, label);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ */
+ public J2EECompoundCommand(int resultIndex, String label, String description) {
+ super(resultIndex, label, description);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(int resultIndex, String label, String description, java.util.List commandList) {
+ super(resultIndex, label, description, commandList);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ * @param label
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(int resultIndex, String label, java.util.List commandList) {
+ super(resultIndex, label, commandList);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param resultIndex
+ * int
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(int resultIndex, java.util.List commandList) {
+ super(resultIndex, commandList);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ */
+ public J2EECompoundCommand(String label) {
+ super(label);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ */
+ public J2EECompoundCommand(String label, String description) {
+ super(label, description);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(String label, String description, java.util.List commandList) {
+ super(label, description, commandList);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(String label, java.util.List commandList) {
+ super(label, commandList);
+ }
+
+ /**
+ * J2EECompoundCommand constructor comment.
+ *
+ * @param commandList
+ * java.util.List
+ */
+ public J2EECompoundCommand(java.util.List commandList) {
+ super(commandList);
+ }
+
+ @Override
+ protected Collection getMergedAffectedObjectsCollection() {
+ J2EEClipboard result = new J2EEClipboard(new ArrayList());
+
+ for (Iterator commands = commandList.iterator(); commands.hasNext();) {
+ Command command = (Command) commands.next();
+ result.addAll(command.getAffectedObjects());
+ }
+
+ return result;
+ }
+
+ @Override
+ protected Collection getMergedResultCollection() {
+ J2EEClipboard result = new J2EEClipboard(new ArrayList());
+
+ for (Iterator commands = commandList.iterator(); commands.hasNext();) {
+ Command command = (Command) commands.next();
+ result.addAll(command.getResult());
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyCommand.java
new file mode 100644
index 0000000..2a8f4fa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyCommand.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.command;
+
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.common.internal.emf.utilities.CopyGroup;
+import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility;
+
+
+public class J2EECopyCommand extends AbstractCommand {
+ protected EObject objectToCopy;
+ protected EObject bindingToCopy;
+ protected EObject extensionToCopy;
+ protected J2EEClipboard result;
+ protected EtoolsCopyUtility copyUtil;
+
+ public J2EECopyCommand(EObject object, EObject binding, EObject extension, EtoolsCopyUtility copyUtility) {
+ objectToCopy = object;
+ bindingToCopy = binding;
+ extensionToCopy = extension;
+ copyUtil = copyUtility;
+ }
+
+ /**
+ * This will perform the command activity required for the effect. The effect of calling execute
+ * when canExecute returns false, or when canExecute hasn't been called, is undefined.
+ */
+ public void execute() {
+ CopyGroup group = new CopyGroup();
+
+ group.add(objectToCopy);
+
+ if (bindingToCopy != null)
+ group.add(bindingToCopy);
+ if (extensionToCopy != null)
+ group.add(extensionToCopy);
+ copyUtil.copy(group);
+ EObject copy = copyUtil.getCopy(objectToCopy);
+ result = new J2EEClipboard(Collections.singleton(copy));
+
+ if (bindingToCopy != null)
+ result.addBinding(copy, copyUtil.getCopy(bindingToCopy));
+ if (extensionToCopy != null)
+ result.addExtension(copy, copyUtil.getCopy(extensionToCopy));
+ }
+
+ @Override
+ public Collection getAffectedObjects() {
+ return result;
+ }
+
+ @Override
+ public Collection getResult() {
+ return result;
+ }
+
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ /**
+ * This will again perform the command activity required to redo the effect after undoing the
+ * effect. The effect, if any, of calling redo before undo is called is undefined. Note that if
+ * you implement redo to call execute then any derived class will be restricted to by that
+ * decision also.
+ */
+ public void redo() {
+ //redo
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyFromClipboardCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyFromClipboardCommand.java
new file mode 100644
index 0000000..2c1a1dd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyFromClipboardCommand.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.command;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.j2ee.internal.provider.J2EEUIEditingDomain;
+import org.eclipse.wst.common.internal.emf.utilities.CopyGroup;
+import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility;
+
+
+/**
+ * Insert the type's description here. Creation date: (06/11/01 8:45:21 AM)
+ *
+ * @author: Administrator
+ */
+public class J2EECopyFromClipboardCommand extends AbstractCommand {
+ private J2EEUIEditingDomain domain;
+ private J2EEClipboard result;
+ private EtoolsCopyUtility copyUtil;
+
+ public J2EECopyFromClipboardCommand(J2EEUIEditingDomain editingDomain) {
+ domain = editingDomain;
+
+ }
+
+ /**
+ * This will perform the command activity required for the effect. The effect of calling execute
+ * when canExecute returns false, or when canExecute hasn't been called, is undefined.
+ */
+ public void execute() {
+ if (copyUtil != null)
+ return;
+ copyUtil = new EtoolsCopyUtility();
+ J2EEClipboard clipboard = domain.getJ2EEClipboard();
+ result = new J2EEClipboard(new ArrayList(0));
+ for (int i = 0; i < clipboard.size(); i++) {
+ CopyGroup group = new CopyGroup();
+ EObject o = (EObject) clipboard.get(i);
+ group.add(o);
+ EObject bnd = clipboard.getBinding(o);
+ if (bnd != null)
+ group.add(bnd);
+ EObject ext = clipboard.getExtension(o);
+ if (ext != null)
+ group.add(ext);
+ copyUtil.copy(group);
+ EObject copy = copyUtil.getCopy(o);
+ result.add(copy);
+ if (bnd != null)
+ result.addBinding(copy, copyUtil.getCopy(bnd));
+ if (ext != null)
+ result.addExtension(copy, copyUtil.getCopy(ext));
+ }
+ //Reset the util so redo will actuall redo
+ copyUtil = null;
+ }
+
+ @Override
+ public Collection getAffectedObjects() {
+ return result;
+ }
+
+ @Override
+ public Collection getResult() {
+ return result;
+ }
+
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ /**
+ * This will again perform the command activity required to redo the effect after undoing the
+ * effect. The effect, if any, of calling redo before undo is called is undefined. Note that if
+ * you implement redo to call execute then any derived class will be restricted to by that
+ * decision also.
+ */
+ public void redo() {
+ execute();
+ }
+
+ @Override
+ public void undo() {
+ result = null;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyToClipboardOverrideCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyToClipboardOverrideCommand.java
new file mode 100644
index 0000000..5d2b7fc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EECopyToClipboardOverrideCommand.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.command;
+
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.CopyToClipboardCommand;
+import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility;
+
+
+public class J2EECopyToClipboardOverrideCommand extends CopyToClipboardCommand {
+ //The collection of source objects, with bindings and extensions, if any exist
+ protected J2EEClipboard extendedSourceObjects;
+ protected boolean onlyRefObjects = true;
+
+ public J2EECopyToClipboardOverrideCommand(CopyToClipboardCommand cmd) {
+ super(cmd.getDomain(), cmd.getSourceObjects());
+ }
+
+ protected Command createCopyCommand() {
+ CompoundCommand cmd = new J2EECompoundCommand(CompoundCommand.MERGE_COMMAND_ALL);
+ Iterator it = extendedSourceObjects.iterator();
+ EtoolsCopyUtility copyUtil = new EtoolsCopyUtility();
+ while (it.hasNext()) {
+ Object o = it.next();
+ if (!(o instanceof EObject)) {
+ cmd.append(UnexecutableCommand.INSTANCE);
+ } else {
+ EObject r = (EObject) o;
+ cmd.append(new J2EECopyCommand(r, extendedSourceObjects.getBinding(r), extendedSourceObjects.getExtension(r), copyUtil));
+ }
+ }
+ return cmd.unwrap();
+ }
+
+ @Override
+ protected boolean prepare() {
+ prepareSourceObjects();
+ if (!onlyRefObjects) {
+ copyCommand = UnexecutableCommand.INSTANCE;
+ return copyCommand.canExecute();
+ }
+
+ if (!extendedSourceObjects.hasBindings() && !extendedSourceObjects.hasExtensions())
+ return super.prepare();
+
+ copyCommand = createCopyCommand();
+ return copyCommand.canExecute();
+ }
+
+ protected void prepareSourceObjects() {
+ extendedSourceObjects = new J2EEClipboard(getSourceObjects());
+ Iterator it = getSourceObjects().iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
+ if (o instanceof EObject) {
+ // EObject r = (EObject) o;
+ // TODO switch to adaptable commands
+ // EObject bnd = BindingAndExtensionHelper.getBinding(r);
+ // EObject ext = BindingAndExtensionHelper.getExtension(r);
+ // if (bnd != null)
+ // extendedSourceObjects.addBinding(r, bnd);
+ // if (ext != null)
+ // extendedSourceObjects.addExtension(r, ext);
+ } else {
+ //Right now we can only handle ref objects in the tree
+ onlyRefObjects = false;
+ return;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEPasteFromClipboardOverrideCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEPasteFromClipboardOverrideCommand.java
new file mode 100644
index 0000000..93cd5a9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEPasteFromClipboardOverrideCommand.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.command;
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandWrapper;
+import org.eclipse.emf.common.command.StrictCompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.PasteFromClipboardCommand;
+import org.eclipse.jst.j2ee.common.internal.util.IDUtility;
+import org.eclipse.jst.j2ee.internal.provider.J2EEUIEditingDomain;
+
+
+public class J2EEPasteFromClipboardOverrideCommand extends PasteFromClipboardCommand {
+ private J2EECopyFromClipboardCommand copyCommand;
+ private Command addBindingsCommand;
+ private Command addExtensionsCommand;
+
+ public J2EEPasteFromClipboardOverrideCommand(PasteFromClipboardCommand p) {
+ super(p.getDomain(), p.getOwner(), p.getFeature(), p.getIndex(), false);
+ }
+
+ @Override
+ public void doExecute() {
+ super.doExecute();
+ executeAddBindings();
+ executeAddExtensions();
+ J2EEClipboard result = (J2EEClipboard) doGetResult();
+ for (int i = 0; i < result.size(); i++) {
+ EObject o = (EObject) result.get(i);
+ if (result.getBinding(o) != null || result.getExtension(o) != null)
+ IDUtility.setDefaultID(o, true);
+ }
+ }
+
+ @Override
+ public Collection doGetAffectedObjects() {
+ return copyCommand.getAffectedObjects();
+ }
+
+ @Override
+ public Collection doGetResult() {
+ return copyCommand.getResult();
+ }
+
+ @Override
+ public void doRedo() {
+ super.doRedo();
+ if (addBindingsCommand != null)
+ addBindingsCommand.redo();
+ if (addExtensionsCommand != null)
+ addExtensionsCommand.redo();
+ }
+
+ @Override
+ public void doUndo() {
+ super.doUndo();
+ if (addBindingsCommand != null)
+ addBindingsCommand.undo();
+ if (addExtensionsCommand != null)
+ addExtensionsCommand.undo();
+ }
+
+ protected void executeAddBindings() {
+ if (addBindingsCommand != null && addBindingsCommand.canExecute())
+ addBindingsCommand.execute();
+ }
+
+ protected void executeAddExtensions() {
+ if (addExtensionsCommand != null && addExtensionsCommand.canExecute())
+ addExtensionsCommand.execute();
+ }
+
+ public J2EEClipboard getCopiedClipoard() {
+ return (J2EEClipboard) copyCommand.getResult();
+ }
+
+ protected J2EEClipboard getJ2EEClipboard() {
+ return (J2EEClipboard) domain.getClipboard();
+ }
+
+ @Override
+ protected boolean prepare() {
+ if (getJ2EEClipboard() == null)
+ return false;
+ command = new StrictCompoundCommand();
+
+ copyCommand = new J2EECopyFromClipboardCommand((J2EEUIEditingDomain) domain);
+ command.append(copyCommand);
+
+ command.append(new CommandWrapper() {
+ @Override
+ protected Command createCommand() {
+ Command addCommand = AddCommand.create(getDomain(), getOwner(), getFeature(), copyCommand.getResult(), getIndex());
+ return addCommand;
+ }
+ });
+ prepareBindingCommand(copyCommand);
+ prepareExtensionCommand(copyCommand);
+
+ boolean result;
+ if (optimize) {
+ // This will determine canExecute as efficiently as possible.
+ //
+ result = optimizedCanExecute();
+ } else {
+ // This will actually execute the copy command in order to check if the add can execute.
+ //
+ result = command.canExecute();
+ }
+
+ return result;
+ }
+
+ protected void prepareBindingCommand(final J2EECopyFromClipboardCommand cmd) {
+ if (!getJ2EEClipboard().hasBindings())
+ return;
+ //TODO make adaptable command
+ // addBindingsCommand = new CommandWrapper() {
+ // protected Command createCommand() {
+ // Object bindingOwner = BindingAndExtensionHelper.getBindingAddOwner((EObject)getOwner());
+ // Collection bindingsCopies = getCopiedClipoard().getBindings().values();
+ // Command addCommand = AddCommand.create(getDomain(), bindingOwner, null, bindingsCopies,
+ // CommandParameter.NO_INDEX);
+ // return addCommand;
+ // }
+ // };
+ }
+
+ protected void prepareExtensionCommand(final J2EECopyFromClipboardCommand cmd) {
+ if (!getJ2EEClipboard().hasExtensions())
+ return;
+ // TODO make adaptable command
+ // addExtensionsCommand = new CommandWrapper() {
+ // protected Command createCommand() {
+ // Object extensionOwner =
+ // BindingAndExtensionHelper.getExtensionAddOwner((EObject)getOwner());
+ // Collection extensionsCopies = getCopiedClipoard().getExtensions().values();
+ // Command addCommand = AddCommand.create(getDomain(), extensionOwner, null,
+ // extensionsCopies, CommandParameter.NO_INDEX);
+ // return addCommand;
+ // }
+ // };
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EERemoveOverrideCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EERemoveOverrideCommand.java
new file mode 100644
index 0000000..fad74e7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EERemoveOverrideCommand.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.command;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.command.RemoveCommand;
+
+/**
+ * Insert the type's description here. Creation date: (06/07/01 10:44:02 AM)
+ *
+ * @author: Administrator
+ */
+public class J2EERemoveOverrideCommand extends AbstractOverrideCommand {
+ private RemoveCommand bindingsRemoveCommand;
+ private RemoveCommand extensionsRemoveCommand;
+ private ResourceSet resourceSet;
+
+ /**
+ * J2EERemoveOverrideCommand constructor comment.
+ */
+ protected J2EERemoveOverrideCommand() {
+ super();
+ }
+
+ public J2EERemoveOverrideCommand(RemoveCommand command) {
+ super(command);
+ }
+
+ protected RemoveCommand createRemoveCommand(Collection elements) {
+ return (RemoveCommand) RemoveCommand.create(getDomain(), elements);
+ }
+
+ /**
+ * This will perform the command activity required for the effect. The effect of calling execute
+ * when canExecute returns false, or when canExecute hasn't been called, is undefined.
+ */
+ public void execute() {
+ /*
+ * For each object being removed, check if it has a binding, and an extension Make
+ * collections of these, make a command parameter for each collection, an instantiate a
+ * remove command
+ */
+
+ Collection objects = getRemoveCommand().getCollection();
+ List bindings = new ArrayList(objects.size());
+ List extensions = new ArrayList(objects.size());
+ Iterator it = objects.iterator();
+ while (it.hasNext()) {
+ EObject o = (EObject) it.next();
+ if (resourceSet == null)
+ resourceSet = o.eResource().getResourceSet();
+ // TODO make command adaptable
+ // EObject binding = BindingAndExtensionHelper.getBinding(o);
+ // if (binding != null) {
+ // bindings.add(binding);
+ // getJ2eeClipboard().addBinding(o, binding);
+ // }
+ // EObject extension = BindingAndExtensionHelper.getExtension(o);
+ // if (extension != null) {
+ // extensions.add(extension);
+ // getJ2eeClipboard().addExtension(o, extension);
+ // }
+ }
+ if (!bindings.isEmpty())
+ setBindingsRemoveCommand(createRemoveCommand(bindings));
+
+ if (!extensions.isEmpty())
+ setExtensionsRemoveCommand(createRemoveCommand(extensions));
+
+ executeAllChildren();
+ }
+
+ protected void executeAllChildren() {
+ executeNested(bindingsRemoveCommand);
+ executeNested(extensionsRemoveCommand);
+ getOverridable().doExecute();
+ }
+
+ protected void executeNested(RemoveCommand cmd) {
+ if (cmd != null && cmd.doCanExecute()) {
+ cmd.doExecute();
+ // Collection result = cmd.getResult();
+ //TODO
+ // BindingAndExtensionHelper.resolveAllProxies(result, resourceSet);
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 1:32:44 PM)
+ *
+ * @return RemoveCommand
+ */
+ protected RemoveCommand getBindingsRemoveCommand() {
+ return bindingsRemoveCommand;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 1:32:44 PM)
+ *
+ * @return RemoveCommand
+ */
+ protected RemoveCommand getExtensionsRemoveCommand() {
+ return extensionsRemoveCommand;
+ }
+
+ public RemoveCommand getRemoveCommand() {
+ return (RemoveCommand) getOverridable();
+ }
+
+ @Override
+ protected boolean prepare() {
+ setJ2eeClipboard(new J2EEClipboard(getRemoveCommand().getCollection()));
+ return true;
+ }
+
+ /**
+ * This will again perform the command activity required to redo the effect after undoing the
+ * effect. The effect, if any, of calling redo before undo is called is undefined. Note that if
+ * you implement redo to call execute then any derived class will be restricted to by that
+ * decision also.
+ */
+ public void redo() {
+ executeAllChildren();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 1:32:44 PM)
+ *
+ * @param newBindingsRemoveCommand
+ * RemoveCommand
+ */
+ protected void setBindingsRemoveCommand(RemoveCommand newBindingsRemoveCommand) {
+ bindingsRemoveCommand = newBindingsRemoveCommand;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (06/07/01 1:32:44 PM)
+ *
+ * @param newExtensionsRemoveCommand
+ * RemoveCommand
+ */
+ protected void setExtensionsRemoveCommand(RemoveCommand newExtensionsRemoveCommand) {
+ extensionsRemoveCommand = newExtensionsRemoveCommand;
+ }
+
+ @Override
+ public void undo() {
+ getRemoveCommand().doUndo();
+ undoNested(bindingsRemoveCommand);
+ undoNested(extensionsRemoveCommand);
+ }
+
+ protected void undoNested(RemoveCommand cmd) {
+ if (cmd != null && cmd.doCanUndo())
+ cmd.doUndo();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEStrictCompoundCommand.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEStrictCompoundCommand.java
new file mode 100644
index 0000000..e0df82a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/command/J2EEStrictCompoundCommand.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.command;
+
+import org.eclipse.emf.common.command.StrictCompoundCommand;
+
+
+
+/**
+ * Overridden to provide an accessor to the pessimistic field. This is needed for the case of
+ * undo/redo paste. We need the nested copy commmand in the paste command to redo itself when the
+ * paste command is copied, otherwise we run into sed exception.
+ */
+public class J2EEStrictCompoundCommand extends StrictCompoundCommand {
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ */
+ public J2EEStrictCompoundCommand() {
+ super();
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ */
+ public J2EEStrictCompoundCommand(String label) {
+ super(label);
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ */
+ public J2EEStrictCompoundCommand(String label, String description) {
+ super(label, description);
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param description
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EEStrictCompoundCommand(String label, String description, java.util.List commandList) {
+ super(label, description, commandList);
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ *
+ * @param label
+ * java.lang.String
+ * @param commandList
+ * java.util.List
+ */
+ public J2EEStrictCompoundCommand(String label, java.util.List commandList) {
+ super(label, commandList);
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ *
+ * @param commandList
+ * java.util.List
+ */
+ public J2EEStrictCompoundCommand(java.util.List commandList) {
+ super(commandList);
+ }
+
+ /**
+ * J2EEStrictCompoundCommand constructor comment.
+ */
+ public J2EEStrictCompoundCommand(boolean pessimistic) {
+ super();
+ setIsPessismistic(pessimistic);
+ }
+
+ public void setIsPessismistic(boolean aBool) {
+ isPessimistic = aBool;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java
new file mode 100644
index 0000000..c459345
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseDeployableArtifactAdapterFactory.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 18, 2005
+ */
+package org.eclipse.jst.j2ee.internal.deployables;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.ILaunchable;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
+
+public class EnterpriseDeployableArtifactAdapterFactory extends ModuleArtifactAdapterDelegate implements IAdapterFactory {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] {ILaunchable.class };
+ }
+
+ @Override
+ public IModuleArtifact getModuleArtifact(Object obj) {
+ return EnterpriseApplicationDeployableAdapterUtil.getModuleObject(obj);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseModuleArtifact.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseModuleArtifact.java
new file mode 100644
index 0000000..0dc0437
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/EnterpriseModuleArtifact.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Feb 21, 2005
+ */
+package org.eclipse.jst.j2ee.internal.deployables;
+
+import org.eclipse.debug.ui.actions.ILaunchable;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+
+/**
+ * @author blancett
+ *
+ */
+public class EnterpriseModuleArtifact implements IModuleArtifact {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.core.IModuleArtifact#getModule()
+ */
+ public IModule getModule() {
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[] { IModuleArtifact.class, ILaunchable.class };
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableAdapterFactory.java
new file mode 100644
index 0000000..78d7c98
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableAdapterFactory.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Feb 21, 2005
+ */
+package org.eclipse.jst.j2ee.internal.deployables;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.ILaunchable;
+import org.eclipse.wst.server.core.IModuleArtifact;
+
+
+public class J2EEDeployableAdapterFactory implements IAdapterFactory {
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ IModuleArtifact moduleArtifact = null;
+/* if (adapterType == IModuleArtifact.class ) {
+
+ if (moduleArtifact == null && Platform.getAdapterManager().hasAdapter(adaptableObject, "org.eclipse.jst.j2ee.internal.web.deployables.WebModuleArtifact")) {
+ moduleArtifact = (IModuleArtifact) Platform.getAdapterManager().loadAdapter(adaptableObject, "org.eclipse.jst.j2ee.internal.web.deployables.WebModuleArtifact");
+ }
+ if (moduleArtifact == null && Platform.getAdapterManager().hasAdapter(adaptableObject, "org.eclipse.jst.j2ee.ejb.internal.deployables.IEJBModuleArtifact")) {
+ moduleArtifact = (IModuleArtifact) Platform.getAdapterManager().loadAdapter(adaptableObject, "org.eclipse.jst.j2ee.ejb.internal.deployables.IEJBModuleArtifact");
+ }
+ if (moduleArtifact == null && Platform.getAdapterManager().hasAdapter(adaptableObject, "org.eclipse.jst.j2ee.internal.deployables.EnterpriseModuleArtifact")) {
+ moduleArtifact = (IModuleArtifact) Platform.getAdapterManager().loadAdapter(adaptableObject, "org.eclipse.jst.j2ee.internal.deployables.EnterpriseModuleArtifact");
+ }
+ if (moduleArtifact == null && Platform.getAdapterManager().hasAdapter(adaptableObject, "org.eclipse.wst.web.internal.deployables.IStaticWebModuleArtifact")) {
+ moduleArtifact = (IModuleArtifact) Platform.getAdapterManager().loadAdapter(adaptableObject, "org.eclipse.wst.web.internal.deployables.IStaticWebModuleArtifact");
+ }
+ }*/
+ return moduleArtifact;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[]{IModuleArtifact.class, ILaunchable.class};
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ChangeLibDirDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ChangeLibDirDialog.java
new file mode 100644
index 0000000..d9ac0dd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ChangeLibDirDialog.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Stefan Dimov, stefan.dimov@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.dialogs;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.widgets.Shell;
+
+@Deprecated
+public class ChangeLibDirDialog extends InputDialog {
+ private boolean warnBlank;
+
+ public ChangeLibDirDialog(Shell parentShell, String initialValue, boolean warnBlank) {
+ super(parentShell, J2EEUIMessages.getResourceString(J2EEUIMessages.CHANGE_LIB_DIR_HEAD),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_LIB_DIR_PROPMPT), initialValue, null);
+ this.warnBlank = warnBlank;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ String res = getText().getText().trim();
+ if (res.length() == 0) {
+ if (warnBlank)
+ if (!MessageDialog.openQuestion(this.getShell(),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR_CONFIRM))) return;
+ } else {
+ res = res.substring(1);
+ String[] segments = res.split("" + IPath.SEPARATOR); //$NON-NLS-1$
+ Path p = new Path(""); //$NON-NLS-1$
+ boolean valid = true;
+ for (int i = 0; i < segments.length; i++) {
+ valid = p.isValidSegment(segments[i]);
+ if (!valid)
+ break;
+ }
+ if (!valid) {
+ MessageDialog.openError(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.INVALID_PATH),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.INVALID_PATH_MSG));
+ return;
+ }
+ }
+ }
+ super.buttonPressed(buttonId);
+ }
+}
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/DependencyConflictResolveDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/DependencyConflictResolveDialog.java
new file mode 100644
index 0000000..87d55d5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/DependencyConflictResolveDialog.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Stefan Dimov, stefan.dimov@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.dialogs;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.widgets.Shell;
+
+public class DependencyConflictResolveDialog extends MessageDialogWithToggle {
+
+ public static final int BTN_ID_OK = 0;
+ public static final int BTN_ID_CANCEL = 1;
+
+ public static final int DLG_TYPE_1 = 1;
+ public static final int DLG_TYPE_2 = 2;
+
+ public static final String DONT_SHOW_AGAIN = "DependencyConflictResolveDialog.DONT_SHOW_AGAIN"; //$NON-NLS-1$
+
+ public DependencyConflictResolveDialog(Shell parentShell,
+ int dlgType) {
+
+ super(parentShell,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.DEPENDENCY_CONFLICT_TITLE),
+ null,
+ J2EEUIMessages.getResourceString((dlgType == DLG_TYPE_1) ?
+ J2EEUIMessages.DEPENDENCY_CONFLICT_MSG_1 :
+ J2EEUIMessages.DEPENDENCY_CONFLICT_MSG_2)
+
+ , MessageDialog.WARNING,
+
+ new String[] { J2EEUIMessages.OK_BUTTON,
+ J2EEUIMessages.CANCEL_BUTTON },
+ BTN_ID_CANCEL,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.DO_NOT_SHOW_WARNING_AGAIN),
+ false);
+ }
+
+ @Override
+ public int open() {
+ if (getPrefStore().getBoolean(DONT_SHOW_AGAIN))
+ return BTN_ID_OK;
+ setToggleState(getPrefStore().getBoolean(DONT_SHOW_AGAIN));
+ return super.open();
+ }
+
+ @Override
+ public boolean close() {
+ getPrefStore().setValue(DONT_SHOW_AGAIN, getToggleState());
+ return super.close();
+ }
+
+ @Override
+ public IPreferenceStore getPrefStore() {
+ return J2EEUIPlugin.getDefault().getPreferenceStore();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/FilteredFileSelectionDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/FilteredFileSelectionDialog.java
new file mode 100644
index 0000000..48d80d4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/FilteredFileSelectionDialog.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.dialogs;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+public class FilteredFileSelectionDialog extends ElementTreeSelectionDialog {
+ protected String[] fExtensions;
+ /**
+ * FilteredFileSelectionDialog constructor comment.
+ *
+ * @param parent
+ * Shell
+ * @parent extensions String[]
+ */
+ public FilteredFileSelectionDialog(Shell parent, String[] extensions) {
+ this(parent, null, null, extensions, false);
+ }
+ /**
+ * FilteredFileSelectionDialog constructor comment.
+ *
+ * @param parent
+ * Shell
+ * @param title
+ * String
+ * @param message
+ * String
+ * @parent extensions String[]
+ * @param allowMultiple
+ * boolean
+ */
+ public FilteredFileSelectionDialog(Shell parent, String title, String message, String[] extensions, boolean allowMultiple) {
+ super(parent, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+
+ setTitle(title);
+ if (title == null)
+ setTitle(J2EEUIMessages.getResourceString("File_Selection_UI_")); //$NON-NLS-1$
+ String localMessage = message;
+ if (localMessage == null)
+ localMessage = J2EEUIMessages.getResourceString("Select_a_file__UI_"); //$NON-NLS-1$
+ setMessage(localMessage);
+ setAllowMultiple(true);
+ setExtensions(extensions);
+ addFilter(new TypedFileViewerFilter(extensions));
+ setValidator(new TypedElementSelectionValidator(new Class[]{IFile.class}, allowMultiple));
+
+ }
+ public String[] getExtensions() {
+ return fExtensions;
+ }
+ public void setExtensions(String[] extensions) {
+ fExtensions = extensions;
+ }
+
+ public void setHelp(String helpCode) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this.getParentShell(), helpCode);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ListMessageDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ListMessageDialog.java
new file mode 100644
index 0000000..25282a8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/ListMessageDialog.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.dialogs;
+
+
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Insert the type's description here. Creation date: (9/7/2001 11:28:24 AM)
+ *
+ * @author: Administrator
+ */
+public class ListMessageDialog extends org.eclipse.jface.dialogs.MessageDialog {
+ protected String[] listItems;
+ protected List list;
+
+ /**
+ * EJBSelectiveImportDialog constructor comment.
+ *
+ * @param parentShell
+ * org.eclipse.swt.widgets.Shell
+ * @param dialogTitle
+ * java.lang.String
+ * @param dialogTitleImage
+ * org.eclipse.swt.graphics.Image
+ * @param dialogMessage
+ * java.lang.String
+ * @param dialogImageType
+ * int
+ * @param dialogButtonLabels
+ * java.lang.String[]
+ * @param defaultIndex
+ * int
+ */
+ public ListMessageDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, org.eclipse.swt.graphics.Image dialogTitleImage, String dialogMessage, int dialogImageType, java.lang.String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ }
+
+ /**
+ * ListMessageDialog constructor comment.
+ *
+ * @param parentShell
+ * org.eclipse.swt.widgets.Shell
+ * @param dialogTitle
+ * java.lang.String
+ * @param dialogTitleImage
+ * org.eclipse.swt.graphics.Image
+ * @param dialogMessage
+ * java.lang.String
+ * @param dialogImageType
+ * int
+ * @param dialogButtonLabels
+ * java.lang.String[]
+ * @param defaultIndex
+ * int
+ */
+ public ListMessageDialog(org.eclipse.swt.widgets.Shell parentShell, String dialogTitle, org.eclipse.swt.graphics.Image dialogTitleImage, String dialogMessage, int dialogImageType, java.lang.String[] dialogButtonLabels, int defaultIndex, String[] names) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ listItems = names;
+ }
+
+ /**
+ * Creates and returns the contents of an area of the dialog which appears below the message and
+ * above the button bar.
+ * <p>
+ * The default implementation of this framework method returns <code>null</code>. Subclasses
+ * may override.
+ * </p>
+ *
+ * @param the
+ * parent composite to contain the custom area
+ * @return the custom area control, or <code>null</code>
+ */
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ Composite composite = new Composite(parent, 0);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ if (listItems != null) {
+ list = new List(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+ list.setLayoutData(data);
+ list.setItems(listItems);
+ }
+
+ return composite;
+
+ }
+
+ /**
+ * Convenience method to open a simple confirm (OK/Cancel) dialog.
+ *
+ * @param parent
+ * the parent shell of the dialog, or <code>null</code> if none
+ * @param title
+ * the dialog's title, or <code>null</code> if none
+ * @param message
+ * the message
+ * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise
+ */
+ public static boolean openConfirm(Shell parent, String title, String message, String[] items) {
+ ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default
+ // window icon
+ message, QUESTION, new String[]{IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0, items); // OK
+ // is
+ // the
+ // default
+ return dialog.open() == 0;
+ }
+
+ /**
+ * Convenience method to open a standard error dialog.
+ *
+ * @param parent
+ * the parent shell of the dialog, or <code>null</code> if none
+ * @param title
+ * the dialog's title, or <code>null</code> if none
+ * @param message
+ * the message
+ */
+ public static void openError(Shell parent, String title, String message, String[] items) {
+ ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default
+ // window icon
+ message, ERROR, new String[]{IDialogConstants.OK_LABEL}, 0, items); // ok is the
+ // default
+ dialog.open();
+ return;
+ }
+
+ /**
+ * Convenience method to open a standard information dialog.
+ *
+ * @param parent
+ * the parent shell of the dialog, or <code>null</code> if none
+ * @param title
+ * the dialog's title, or <code>null</code> if none
+ * @param message
+ * the message
+ */
+ public static void openInformation(Shell parent, String title, String message, String[] items) {
+ ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default
+ // window icon
+ message, INFORMATION, new String[]{IDialogConstants.OK_LABEL}, 0, items);
+ // ok is the default
+ dialog.open();
+ return;
+ }
+
+ /**
+ * Convenience method to open a simple Yes/No question dialog.
+ *
+ * @param parent
+ * the parent shell of the dialog, or <code>null</code> if none
+ * @param title
+ * the dialog's title, or <code>null</code> if none
+ * @param message
+ * the message
+ * @return <code>true</code> if the user presses the OK button, <code>false</code> otherwise
+ */
+ public static boolean openQuestion(Shell parent, String title, String message, String[] items) {
+ ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default
+ // window icon
+ message, QUESTION, new String[]{IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0, items); // yes
+ // is
+ // the
+ // default
+ return dialog.open() == 0;
+ }
+
+ /**
+ * Convenience method to open a standard warning dialog.
+ *
+ * @param parent
+ * the parent shell of the dialog, or <code>null</code> if none
+ * @param title
+ * the dialog's title, or <code>null</code> if none
+ * @param message
+ * the message
+ */
+ public static void openWarning(Shell parent, String title, String message, String[] items) {
+ ListMessageDialog dialog = new ListMessageDialog(parent, title, null, // accept the default
+ // window icon
+ message, WARNING, new String[]{IDialogConstants.OK_LABEL}, 0, items); // ok is
+ // the
+ // default
+ dialog.open();
+ return;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/Messages.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/Messages.java
new file mode 100644
index 0000000..8b1ccb5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/Messages.java
@@ -0,0 +1,15 @@
+package org.eclipse.jst.j2ee.internal.dialogs;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.dialogs.messages"; //$NON-NLS-1$
+ public static String RuntimeSelectionDialog_Configure_Target_Runtime_;
+ public static String J2EEDeployAction_Deploy_;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/RuntimeSelectionDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/RuntimeSelectionDialog.java
new file mode 100644
index 0000000..16f06f1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/RuntimeSelectionDialog.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.jst.j2ee.internal.dialogs;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.jst.j2ee.internal.dialogs.Messages;
+
+
+/**
+ * @author Administrator
+ *
+ */
+public class RuntimeSelectionDialog extends MessageDialog {
+ private IProject project = null;
+ private String configuredMessage;
+
+ /**
+ * @param parentShell
+ * @param dialogTitle
+ * @param dialogTitleImage
+ * @param dialogMessage
+ * @param dialogImageType
+ * @param dialogButtonLabels
+ * @param defaultIndex
+ */
+ public RuntimeSelectionDialog(Shell parentShell, String dialogTitle,
+ Image dialogTitleImage, String dialogMessage, int dialogImageType,
+ String[] dialogButtonLabels, int defaultIndex, IProject project) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
+ dialogImageType, dialogButtonLabels, defaultIndex);
+ this.project = project;
+ this.configuredMessage = MessageFormat.format(J2EEUIMessages.getResourceString("DEPLOY_RUNTIME_CONFIGURED"), new Object []{project.getName()}); //$NON-NLS-1$
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ //Composite composite = new Composite(parent, 0);
+ createHyperLink(parent);
+ return parent;
+
+ }
+
+ private void createHyperLink(Composite parent) {
+ Hyperlink link = new Hyperlink(parent,SWT.None);
+ GridData layout = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ layout.horizontalSpan = 2;
+ link.setLayoutData(layout);
+ link.setUnderlined(true);
+ Color color = new Color(parent.getDisplay(),new RGB(0,0,255) );
+ link.setForeground(color);
+ link.setText(Messages.RuntimeSelectionDialog_Configure_Target_Runtime_);
+ link.addHyperlinkListener(new IHyperlinkListener() {
+ public static final String DATA_NO_LINK = "PropertyAndPreferencePage.nolink"; //$NON-NLS-1$
+
+ public void linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+ }
+
+ public void linkExited(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+ }
+
+ public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+ String id = getPreferencePageID();
+ PreferencesUtil.createPropertyDialogOn(getShell(), project, id, new String[]{id}, DATA_NO_LINK).open(); //
+ //(getShell(), id, new String[]{id}, DATA_NO_LINK).open();
+ try {
+ updateWidgets();
+ } catch (Exception ie) {
+
+ }
+ }
+
+ private String getPreferencePageID() {
+ return "org.eclipse.wst.common.project.facet.ui.internal.RuntimesPropertyPage"; //$NON-NLS-1$
+ }
+ });
+
+ }
+
+ private void updateWidgets() {
+ if (getTargetRuntime() != null) {
+ messageLabel.setText(configuredMessage);
+ imageLabel.setImage(this.getInfoImage());
+ } else {
+ messageLabel.setText(message);
+ imageLabel.setImage(getErrorImage());
+ }
+
+ }
+
+ private IRuntime getTargetRuntime() {
+ try {
+ IRuntime runtime = J2EEProjectUtilities.getServerRuntime(project);
+ return runtime;
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TwoArrayQuickSorter.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TwoArrayQuickSorter.java
new file mode 100644
index 0000000..855f5fb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TwoArrayQuickSorter.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.dialogs;
+
+/**
+ * @author jialin
+ *
+ * To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Generation - Code and Comments
+ */
+import java.util.Comparator;
+
+import org.eclipse.jface.util.Assert;
+
+/**
+ * Quick sort to sort key-value pairs. The keys and arrays are specified in
+ * separate arrays.
+ *
+ * @plannedfor 2.0
+ */
+public class TwoArrayQuickSorter {
+
+ private Comparator fComparator;
+
+ /**
+ * Default comparator.
+ */
+ public static final class StringComparator implements Comparator {
+ private boolean fIgnoreCase;
+
+ StringComparator(boolean ignoreCase) {
+ fIgnoreCase = ignoreCase;
+ }
+
+ public int compare(Object left, Object right) {
+ return fIgnoreCase ? ((String) left).compareToIgnoreCase((String) right) : ((String) left).compareTo((String) right);
+ }
+ }
+
+ /**
+ * Creates a sorter with default string comparator. The keys are assumed to
+ * be strings.
+ *
+ * @param ignoreCase
+ * specifies whether sorting is case sensitive or not.
+ */
+ public TwoArrayQuickSorter(boolean ignoreCase) {
+ fComparator = new StringComparator(ignoreCase);
+ }
+
+ /**
+ * Creates a sorter with a comparator.
+ *
+ * @param comparator
+ * the comparator to order the elements. The comparator must not
+ * be <code>null</code>.
+ */
+ public TwoArrayQuickSorter(Comparator comparator) {
+ fComparator = comparator;
+ }
+
+ /**
+ * Sorts keys and values in parallel.
+ *
+ * @param keys
+ * the keys to use for sorting.
+ * @param values
+ * the values associated with the keys.
+ */
+ public void sort(Object[] keys, Object[] values) {
+ if ((keys == null) || (values == null)) {
+ Assert.isTrue(false, "Either keys or values in null"); //$NON-NLS-1$
+ return;
+ }
+
+ if (keys.length <= 1)
+ return;
+
+ internalSort(keys, values, 0, keys.length - 1);
+ }
+
+ private void internalSort(Object[] keys, Object[] values, int left, int right) {
+ int localLeft = left;
+ int localRight = right;
+ int original_left = localLeft;
+ int original_right = localRight;
+
+ Object mid = keys[(localLeft + localRight) / 2];
+ do {
+ while (fComparator.compare(keys[localLeft], mid) < 0)
+ localLeft++;
+
+ while (fComparator.compare(mid, keys[localRight]) < 0)
+ localRight--;
+
+ if (localLeft <= localRight) {
+ swap(keys, localLeft, localRight);
+ swap(values, localLeft, localRight);
+ localLeft++;
+ localRight--;
+ }
+ } while (localLeft <= localRight);
+
+ if (original_left < localRight)
+ internalSort(keys, values, original_left, localRight);
+
+ if (localLeft < original_right)
+ internalSort(keys, values, localLeft, original_right);
+ }
+
+ /*
+ * Swaps x[a] with x[b].
+ */
+ private static final void swap(Object x[], int a, int b) {
+ Object t = x[a];
+ x[a] = x[b];
+ x[b] = t;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeJavaSearchScope.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeJavaSearchScope.java
new file mode 100644
index 0000000..6c430f6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeJavaSearchScope.java
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.dialogs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IOpenable;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+
+/**
+ * This class was derived from JavaSearchScope as that class did not have a
+ * provision to exclude classpath entries that are not exported A Java-specific
+ * scope for searching relative to one or more java elements.
+ */
+public class TypeJavaSearchScope implements IJavaSearchScope {
+
+ private boolean includeExportedClassPathEntriesOnly = true;
+
+ private ArrayList elements;
+
+ /*
+ * The paths of the resources in this search scope (or the classpath
+ * entries' paths if the resources are projects)
+ */
+ private IPath[] paths;
+ private boolean[] pathWithSubFolders;
+ private int pathsCount;
+
+ private IPath[] enclosingProjectsAndJars;
+
+ public TypeJavaSearchScope() {
+ this.initialize();
+
+ // disabled for now as this could be expensive
+ // JavaModelManager.getJavaModelManager().rememberScope(this);
+ }
+
+ private void addEnclosingProjectOrJar(IPath path) {
+ int length = this.enclosingProjectsAndJars.length;
+ for (int i = 0; i < length; i++) {
+ if (this.enclosingProjectsAndJars[i].equals(path))
+ return;
+ }
+ System.arraycopy(this.enclosingProjectsAndJars, 0, this.enclosingProjectsAndJars = new IPath[length + 1], 0, length);
+ this.enclosingProjectsAndJars[length] = path;
+ }
+
+ /**
+ * Method addProject. This method adds all the classpath entries for the
+ * current project to the search scope.
+ *
+ * @param javaProject
+ * @param includesPrereqProjects
+ * @param visitedProjects
+ * @throws JavaModelException
+ */
+ public void addProject(IJavaProject javaProject, boolean includesPrereqProjects, HashSet visitedProjects) throws JavaModelException {
+ IProject project = javaProject.getProject();
+ if (!project.isAccessible() || !visitedProjects.add(project))
+ return;
+
+ this.addEnclosingProjectOrJar(project.getFullPath());
+
+ IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
+ IJavaModel model = javaProject.getJavaModel();
+ for (int i = 0, length = entries.length; i < length; i++) {
+ IClasspathEntry entry = entries[i];
+ switch (entry.getEntryKind()) {
+ case IClasspathEntry.CPE_LIBRARY :
+ IPath path = entry.getPath();
+ this.add(path, true);
+ this.addEnclosingProjectOrJar(path);
+ break;
+ case IClasspathEntry.CPE_PROJECT :
+ if (includesPrereqProjects) {
+ this.add(model.getJavaProject(entry.getPath().lastSegment()), true, visitedProjects);
+ }
+ break;
+ case IClasspathEntry.CPE_SOURCE :
+ this.add(entry.getPath(), true);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Method add. This method filters out all the classpath entries of the
+ * project which are not exported.
+ *
+ * @param javaProject
+ * @param includesPrereqProjects
+ * @param visitedProjects
+ * @throws JavaModelException
+ */
+ public void add(IJavaProject javaProject, boolean includesPrereqProjects, HashSet visitedProjects) throws JavaModelException {
+ IProject project = javaProject.getProject();
+ if (!project.isAccessible() || !visitedProjects.add(project))
+ return;
+
+ this.addEnclosingProjectOrJar(project.getFullPath());
+
+ IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
+ IJavaModel model = javaProject.getJavaModel();
+ for (int i = 0, length = entries.length; i < length; i++) {
+ IClasspathEntry entry = entries[i];
+ if (includeExportedClassPathEntriesOnly()) {
+ if (!entry.isExported() && entry.getEntryKind() != IClasspathEntry.CPE_SOURCE)
+ continue;
+ }
+ switch (entry.getEntryKind()) {
+ case IClasspathEntry.CPE_LIBRARY :
+ IPath path = entry.getPath();
+ this.add(path, true);
+ this.addEnclosingProjectOrJar(path);
+ break;
+ case IClasspathEntry.CPE_PROJECT :
+ if (includesPrereqProjects) {
+ this.add(model.getJavaProject(entry.getPath().lastSegment()), true, visitedProjects);
+ }
+ break;
+ case IClasspathEntry.CPE_SOURCE :
+ this.add(entry.getPath(), true);
+ break;
+ }
+ }
+ }
+ public void add(IJavaElement element) throws JavaModelException {
+ IPackageFragmentRoot root = null;
+ switch (element.getElementType()) {
+ case IJavaElement.JAVA_MODEL :
+ // a workspace sope should be used
+ break;
+ case IJavaElement.JAVA_PROJECT :
+ this.add((IJavaProject) element, true, new HashSet(2));
+ break;
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT :
+ root = (IPackageFragmentRoot) element;
+ this.add(root.getPath(), true);
+ break;
+ case IJavaElement.PACKAGE_FRAGMENT :
+ root = (IPackageFragmentRoot) element.getParent();
+ if (root.isArchive()) {
+ this.add(root.getPath().append(new Path(element.getElementName().replace('.', '/'))), false);
+ } else {
+ IResource resource = element.getUnderlyingResource();
+ if (resource != null && resource.isAccessible()) {
+ this.add(resource.getFullPath(), false);
+ }
+ }
+ break;
+ default :
+ // remember sub-cu (or sub-class file) java elements
+ if (element instanceof IMember) {
+ if (this.elements == null) {
+ this.elements = new ArrayList();
+ }
+ this.elements.add(element);
+ }
+ this.add(this.fullPath(element), true);
+
+ // find package fragment root including this java element
+ IJavaElement parent = element.getParent();
+ while (parent != null && !(parent instanceof IPackageFragmentRoot)) {
+ parent = parent.getParent();
+ }
+ if (parent instanceof IPackageFragmentRoot) {
+ root = (IPackageFragmentRoot) parent;
+ }
+ }
+
+ if (root != null) {
+ if (root.getKind() == IPackageFragmentRoot.K_BINARY) {
+ this.addEnclosingProjectOrJar(root.getPath());
+ } else {
+ this.addEnclosingProjectOrJar(root.getJavaProject().getProject().getFullPath());
+ }
+ }
+ }
+
+ /**
+ * Adds the given path to this search scope. Remember if subfolders need to
+ * be included as well.
+ */
+ private void add(IPath path, boolean withSubFolders) {
+ if (this.paths.length == this.pathsCount) {
+ System.arraycopy(this.paths, 0, this.paths = new IPath[this.pathsCount * 2], 0, this.pathsCount);
+ System.arraycopy(this.pathWithSubFolders, 0, this.pathWithSubFolders = new boolean[this.pathsCount * 2], 0, this.pathsCount);
+ }
+ this.paths[this.pathsCount] = path;
+ this.pathWithSubFolders[this.pathsCount++] = withSubFolders;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IJavaSearchScope#encloses(String)
+ */
+ public boolean encloses(String resourcePathString) {
+ IPath resourcePath;
+ int separatorIndex = resourcePathString.indexOf(JAR_FILE_ENTRY_SEPARATOR);
+ if (separatorIndex != -1) {
+ resourcePath = new Path(resourcePathString.substring(0, separatorIndex)).append(new Path(resourcePathString.substring(separatorIndex + 1)));
+ } else {
+ resourcePath = new Path(resourcePathString);
+ }
+ return this.encloses(resourcePath);
+ }
+
+ /**
+ * Returns whether this search scope encloses the given path.
+ */
+ private boolean encloses(IPath path) {
+ for (int i = 0; i < this.pathsCount; i++) {
+ if (this.pathWithSubFolders[i]) {
+ if (this.paths[i].isPrefixOf(path)) {
+ return true;
+ }
+ } else {
+ IPath scopePath = this.paths[i];
+ if (scopePath.isPrefixOf(path) && (scopePath.segmentCount() == path.segmentCount() - 1)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IJavaSearchScope#encloses(IJavaElement)
+ */
+ public boolean encloses(IJavaElement element) {
+ if (this.elements != null) {
+ for (int i = 0, length = this.elements.size(); i < length; i++) {
+ IJavaElement scopeElement = (IJavaElement) this.elements.get(i);
+ IJavaElement searchedElement = element;
+ while (searchedElement != null) {
+ if (searchedElement.equals(scopeElement)) {
+ return true;
+ }
+ searchedElement = searchedElement.getParent();
+ }
+ }
+ return false;
+ }
+ return this.encloses(this.fullPath(element));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IJavaSearchScope#enclosingProjectsAndJars()
+ */
+ public IPath[] enclosingProjectsAndJars() {
+ return this.enclosingProjectsAndJars;
+ }
+ private IPath fullPath(IJavaElement element) {
+ if (element instanceof IPackageFragmentRoot) {
+ return ((IPackageFragmentRoot) element).getPath();
+ }
+ IJavaElement parent = element.getParent();
+ IPath parentPath = parent == null ? null : this.fullPath(parent);
+ IPath childPath;
+ if (element instanceof IPackageFragment) {
+ childPath = new Path(element.getElementName().replace('.', '/'));
+ } else if (element instanceof IOpenable) {
+ childPath = new Path(element.getElementName());
+ } else {
+ return parentPath;
+ }
+ return parentPath == null ? childPath : parentPath.append(childPath);
+ }
+
+ protected void initialize() {
+ this.paths = new IPath[1];
+ this.pathWithSubFolders = new boolean[1];
+ this.pathsCount = 0;
+ this.enclosingProjectsAndJars = new IPath[0];
+ }
+ /**
+ * Gets the includeExportedClassPathEntriesOnly.
+ *
+ * @return Returns a boolean
+ */
+ public boolean includeExportedClassPathEntriesOnly() {
+ return includeExportedClassPathEntriesOnly;
+ }
+
+ /**
+ * Sets the includeExportedClassPathEntriesOnly.
+ *
+ * @param includeExportedClassPathEntriesOnly
+ * The includeExportedClassPathEntriesOnly to set
+ */
+ public void setIncludeExportedClassPathEntriesOnly(boolean includeExportedClassPathEntriesOnly) {
+ this.includeExportedClassPathEntriesOnly = includeExportedClassPathEntriesOnly;
+ }
+ /**
+ * @see IJavaSearchScope#includesBinaries()
+ * @deprecated
+ */
+ public boolean includesBinaries() {
+ return true;
+ }
+
+ /**
+ * @see IJavaSearchScope#includesClasspaths()
+ * @deprecated
+ */
+ public boolean includesClasspaths() {
+ return true;
+ }
+
+ /**
+ * @see IJavaSearchScope#setIncludesBinaries(boolean)
+ * @deprecated
+ */
+ public void setIncludesBinaries(boolean includesBinaries) {
+ //Default nothing
+ }
+
+ /**
+ * @see IJavaSearchScope#setIncludesClasspaths(boolean)
+ * @deprecated
+ */
+ public void setIncludesClasspaths(boolean includesClasspaths) {
+ //Default nothing
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeSearchEngine.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeSearchEngine.java
new file mode 100644
index 0000000..353d443
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypeSearchEngine.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.dialogs;
+
+import java.util.HashSet;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+
+public class TypeSearchEngine extends SearchEngine {
+
+ /**
+ * Constructor for TypeSearchEngine.
+ */
+ public TypeSearchEngine() {
+ super();
+ }
+
+ /**
+ * Constructor for TypeSearchEngine.
+ *
+ * @param workingCopies
+ */
+ public TypeSearchEngine(ICompilationUnit[] workingCopies) {
+ super(workingCopies);
+ }
+
+ /**
+ * Method createJavaSearchScopeForAProject. Given a project it returns the
+ * scope of the classes within the project's scope
+ *
+ * @param project
+ * @param includeReferencedProjects
+ * @param includeExportedClassPathEntriesOnly
+ * @return IJavaSearchScope
+ */
+ public static IJavaSearchScope createJavaSearchScopeForAProject(IJavaProject project, boolean includeReferencedProjects, boolean includeExportedClassPathEntriesOnly) {
+ if (!includeExportedClassPathEntriesOnly) {
+ IJavaElement javaElements[] = new IJavaElement[]{project};
+ return SearchEngine.createJavaSearchScope(javaElements, includeReferencedProjects);
+ }
+ TypeJavaSearchScope scope = new TypeJavaSearchScope();
+ scope.setIncludeExportedClassPathEntriesOnly(true);
+ HashSet visitedProjects = new HashSet(2);
+ try {
+ scope.addProject(project, includeReferencedProjects, visitedProjects);
+ } catch (JavaModelException e) {
+ // ignore
+ }
+ return scope;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypedFileViewerFilter.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypedFileViewerFilter.java
new file mode 100644
index 0000000..26449e9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/TypedFileViewerFilter.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.dialogs;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.Viewer;
+
+public class TypedFileViewerFilter extends org.eclipse.jface.viewers.ViewerFilter {
+ private String[] fAcceptedExtensions;
+ private Hashtable visitedElements;
+ public TypedFileViewerFilter(String[] acceptedExtensions) {
+ fAcceptedExtensions = acceptedExtensions;
+ visitedElements = new Hashtable();
+ }
+ public boolean isFilterProperty(Object element, Object property) {
+ return false;
+ }
+ public boolean isValid(Object element) {
+ if (IFile.class.isInstance(element))
+ return isValidFile((IFile) element);
+ if (IContainer.class.isInstance(element))
+ return isValidContainer((IContainer) element);
+ return false;
+ }
+ /*
+ * A valid container is one that contains at least one valid member.
+ */
+ public boolean isValidContainer(IContainer container) {
+ IResource[] members;
+ Object valid = visitedElements.get(container);
+ if (valid != null)
+ return ((Boolean) valid).booleanValue();
+ try {
+ members = container.members();
+ for (int i = 0; i < members.length; i++) {
+ if (isValid(members[i])) {
+ visitedElements.put(container, Boolean.TRUE);
+ return true;
+ }
+ }
+ } catch (CoreException e) {
+ // Do nothing
+ }
+ visitedElements.put(container, Boolean.FALSE);
+ return false;
+ }
+ public boolean isValidFile(IFile file) {
+ String ext = file.getFileExtension();
+ for (int i = 0; i < fAcceptedExtensions.length; i++) {
+ if (fAcceptedExtensions[i].equalsIgnoreCase(ext)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return isValid(element);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/messages.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/messages.properties
new file mode 100644
index 0000000..a128a9b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/dialogs/messages.properties
@@ -0,0 +1,2 @@
+J2EEDeployAction_Deploy_=Deploy
+RuntimeSelectionDialog_Configure_Target_Runtime_=Configure Target Runtime...
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/AbstractMethodsContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/AbstractMethodsContentProvider.java
new file mode 100644
index 0000000..3676317
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/AbstractMethodsContentProvider.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.j2ee.ejb.CMPAttribute;
+import org.eclipse.jst.j2ee.ejb.EjbMethodElementComparator;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.MethodElement;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.wst.common.frameworks.internal.ui.DisplayUtility;
+
+
+public abstract class AbstractMethodsContentProvider extends AdapterFactoryContentProvider {
+ protected static EStructuralFeature ME_EJB_SF = EjbFactoryImpl.getPackage().getMethodElement_EnterpriseBean();
+ protected static EStructuralFeature JAR_ASSEMBLY_SF = EjbFactoryImpl.getPackage().getEJBJar_AssemblyDescriptor();
+ private static final EStructuralFeature ECORE_BEAN_NAME = EcorePackage.eINSTANCE.getENamedElement_Name(); //ENAMED_ELEMENT__NAME
+ protected Comparator meComparator;
+ protected boolean isRoot = true;
+
+ public class EJBMethodItem {
+ public EObject refObject;
+ public EnterpriseBean ejb;
+
+ public EJBMethodItem(EObject aRefObject, EnterpriseBean anEJB) {
+ refObject = aRefObject;
+ ejb = anEJB;
+ }
+
+ }
+
+ /**
+ * Constructor for AbstractMethodsContentProvider.
+ *
+ * @param adapterFactory
+ */
+ public AbstractMethodsContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ public AbstractMethodsContentProvider(AdapterFactory adapterFactory, boolean root) {
+ super(adapterFactory);
+ isRoot = root;
+ }
+
+ protected Comparator getEnterpriseBeanComparator() {
+ return EJBNameComparator.singleton();
+ }
+
+ protected Comparator getMethodElementComparator() {
+ if (meComparator == null)
+ meComparator = new EjbMethodElementComparator();
+ return meComparator;
+ }
+
+ /*
+ * @see ITreeContentProvider#getChildren(Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof AbstractMethodsContentProvider.EJBMethodItem)
+ return getMethodElements((AbstractMethodsContentProvider.EJBMethodItem) parentElement);
+ return new Object[0];
+ }
+
+ protected Object[] getMethodElements(AbstractMethodsContentProvider.EJBMethodItem ejbItem) {
+ EObject refObject = ejbItem.refObject;
+ if (refObject == null)
+ return new Object[0];
+ List elements = getMethodElements(refObject, ejbItem.ejb);
+ Object[] result = elements.toArray();
+ if (result.length == 1)
+ return result;
+ Arrays.sort(result, getMethodElementComparator());
+ return result;
+ }
+
+ protected abstract List getMethodElements(EObject aRefObject, EnterpriseBean anEJB);
+
+ protected Object[] getEnterpriseBeans(EObject parentElement, List someMethodElements) {
+ if (someMethodElements.isEmpty())
+ return new Object[0];
+ Set ejbs = new HashSet();
+ EnterpriseBean ejb = null;
+ MethodElement me = null;
+ for (int i = 0; i < someMethodElements.size(); i++) {
+ me = (MethodElement) someMethodElements.get(i);
+ ejb = me.getEnterpriseBean();
+ if (ejb != null)
+ ejbs.add(ejb);
+ }
+ Object[] result = ejbs.toArray();
+ if (result.length != 1)
+ Arrays.sort(result, getEnterpriseBeanComparator());
+ ejb = null;
+ for (int i = 0; i < result.length; i++) {
+ ejb = (EnterpriseBean) result[i];
+ result[i] = new EJBMethodItem(parentElement, ejb);
+ }
+ return result;
+ }
+
+ protected AssemblyDescriptor getAssemblyDescriptor(EnterpriseBean ejb) {
+ if (ejb == null)
+ return null;
+ return ejb.getEjbJar().getAssemblyDescriptor();
+ }
+
+ /*
+ * @see ITreeContentProvider#hasChildren(Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof AbstractMethodsContentProvider.EJBMethodItem)
+ return true;
+ return false;
+ }
+
+ protected TreeViewer getTreeViewer() {
+ return (TreeViewer) viewer;
+ }
+
+ protected void refreshTreeViewer(Object obj) {
+ if (viewer != null)
+ DisplayUtility.asyncExec(createRefreshTreeRunnable(obj));
+ }
+
+ protected void refreshTreeViewer() {
+ if (viewer != null)
+ DisplayUtility.asyncExec(createRefreshTreeRunnable(null));
+ }
+
+ protected void refreshTreeViewer(MethodElement me) {
+ refreshTreeViewer(me.eContainer());
+ }
+
+ protected void refreshTreeViewer(List aList) {
+ if (aList.isEmpty())
+ return;
+ refreshTreeViewer((MethodElement) aList.get(0));
+ }
+
+ protected void addToTreeViewer(final MethodElement me) {
+ if (viewer == null)
+ return;
+ DisplayUtility.asyncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ // findMethodItem() should be run in a Display thread
+ EJBMethodItem item = findMethodItem(me);
+ if (item != null)
+ DisplayUtility.asyncExec(createAddItemTreeRunnable(item, me));
+ else
+ refreshTreeViewer(me.eContainer());
+
+ }
+ });
+ }
+
+ protected void removeFromTreeViewer(final EObject parent, final MethodElement me) {
+ if (viewer == null)
+ return;
+ DisplayUtility.asyncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ EnterpriseBean ejb = me.getEnterpriseBean();
+ EJBMethodItem item = findMethodItem(ejb, parent);
+ if (item != null)
+ refreshTreeViewer(item);
+ else
+ refreshTreeViewer((Object) null);
+ }
+ });
+ }
+
+ protected EJBMethodItem findMethodItem(MethodElement me) {
+ return findMethodItem(me.getEnterpriseBean(), me.eContainer());
+ }
+
+ protected EJBMethodItem findMethodItem(EnterpriseBean ejb, EObject parentMethod) {
+ TreeItem[] items = getTreeViewer().getTree().getItems();
+ return findMethodItem(ejb, parentMethod, items);
+ }
+
+ protected EJBMethodItem findMethodItem(EnterpriseBean ejb, EObject parentMethod, TreeItem[] items) {
+ TreeItem item = null;
+ Object data = null;
+ EJBMethodItem methodItem = null, found = null;
+ for (int i = 0; i < items.length; i++) {
+ item = items[i];
+ data = item.getData();
+ if (data instanceof EJBMethodItem) {
+ methodItem = (EJBMethodItem) data;
+ if (methodItem.ejb == ejb && methodItem.refObject == parentMethod)
+ return methodItem;
+ }
+ found = findMethodItem(ejb, parentMethod, item.getItems());
+ if (found != null)
+ return found;
+ }
+ return null;
+ }
+
+ /*
+ * @see INotifyChangedListener#notifyChanged(new ENotificationImpl((InternalEObject)Object,
+ * int,(EStructuralFeature) Object, Object, Object, int))
+ */
+ @Override
+ public void notifyChanged(Notification notifier) {
+ if (notifier.getEventType() == Notification.RESOLVE)
+ return;
+ else if (notifier.getOldValue() instanceof CMPAttribute && notifier.getNewValue() == null)
+ return;
+ else if (notifier.getFeature() == ME_EJB_SF) {
+ refreshTreeViewer((MethodElement) notifier.getNotifier());
+ return;
+ } else if (notifier.getFeature() == ECORE_BEAN_NAME) {
+ refreshTreeViewer();
+ return;
+ } else if (getMethodElementsReference() == notifier.getFeature()) {
+ if (notifier.getEventType() == Notification.ADD)
+ addToTreeViewer((MethodElement) notifier.getNewValue());
+ else if (notifier.getEventType() == Notification.REMOVE)
+ removeFromTreeViewer((EObject) notifier.getNotifier(), (MethodElement) notifier.getOldValue());
+ return;
+ } else if (notifier.getFeature() == JAR_ASSEMBLY_SF && isRoot) {
+ updateTreeInput(notifier.getNewValue());
+ } else if (notifier.getFeature() == getMethodElementsContainerReference())
+ super.notifyChanged(notifier);
+ }
+
+ /**
+ * @param notifier
+ */
+ protected void updateTreeInput(final Object target) {
+ DisplayUtility.asyncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+
+ getTreeViewer().setInput(target); //reset the input
+ getTreeViewer().refresh(target);
+
+ }
+ });
+ }
+
+ private Runnable createAddItemTreeRunnable(final Object parent, final MethodElement me) {
+ return new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ getTreeViewer().add(parent, me);
+ }
+ };
+ }
+
+ private Runnable createRefreshTreeRunnable(final Object target) {
+ return new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ if (target != null)
+ getTreeViewer().refresh(target);
+ else
+ getTreeViewer().refresh();
+ }
+ };
+ }
+
+ protected abstract EStructuralFeature getMethodElementsReference();
+
+ protected abstract EStructuralFeature getMethodElementsContainerReference();
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/BeanClassProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/BeanClassProviderHelper.java
new file mode 100644
index 0000000..4adce7e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/BeanClassProviderHelper.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/21/2001 12:29:49 AM)
+ *
+ * @author: Administrator
+ */
+public class BeanClassProviderHelper extends J2EEJavaClassProviderHelper {
+ private static Image image;
+
+ /**
+ * BeanClassProviderHelper constructor comment.
+ */
+ public BeanClassProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:53:09 PM)
+ *
+ * @return org.eclipse.jem.internal.java.JavaClass
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return getEjb().getEjbClass();
+ }
+
+ @Override
+ protected String getOverlayKey() {
+ return "ejb_module_ovr";//$NON-NLS-1$
+ }
+
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("EJB_Class_UI_", new Object[]{className}); //$NON-NLS-1$ = "EJB Class"
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/EJBUIMessages.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/EJBUIMessages.java
new file mode 100644
index 0000000..d03ed28
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/EJBUIMessages.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+import org.eclipse.osgi.util.NLS;
+
+
+public class EJBUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "j2ee_ejb_ui";//$NON-NLS-1$
+
+ private EJBUIMessages() {
+ // Do not instantiate
+ }
+
+ public static String GroupedEJBJarItemProvider_UI_0;
+ public static String GroupedEJBJarItemProvider_UI_1;
+ public static String GroupedEJBJarItemProvider_UI_2;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, EJBUIMessages.class);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ExcludeListContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ExcludeListContentProvider.java
new file mode 100644
index 0000000..f4d5e4c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ExcludeListContentProvider.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.j2ee.ejb.CMPAttribute;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.ExcludeList;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+
+
+public class ExcludeListContentProvider extends AbstractMethodsContentProvider {
+ private static final EStructuralFeature EXCLUDE_ME_SF = EjbFactoryImpl.getPackage().getExcludeList_MethodElements();
+ private static final EStructuralFeature AD_EL_SF = EjbFactoryImpl.getPackage().getAssemblyDescriptor_ExcludeList();
+ protected static final EStructuralFeature ECORE_BEAN_NAME = EcorePackage.eINSTANCE.getENamedElement_Name(); //ENAMED_ELEMENT__NAME
+
+ /**
+ * Constructor for ExcludeListContentProvider.
+ *
+ * @param adapterFactory
+ * @param root
+ * @param viewer
+ */
+ public ExcludeListContentProvider(AdapterFactory adapterFactory, boolean root) {
+ super(adapterFactory, root);
+ }
+
+ /**
+ * Constructor for ExcludesListContentProvider.
+ *
+ * @param adapterFactory
+ */
+ public ExcludeListContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ protected Object[] getEnterpriseBeans(ExcludeList list) {
+ List mes = list.getMethodElements();
+ return getEnterpriseBeans(list, mes);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElements(EObject, EnterpriseBean)
+ */
+ @Override
+ protected List getMethodElements(EObject aRefObject, EnterpriseBean anEJB) {
+ if (aRefObject == null || !(aRefObject instanceof ExcludeList))
+ return Collections.EMPTY_LIST;
+ ExcludeList parentList = (ExcludeList) aRefObject;
+ return parentList.getMethodElements(anEJB);
+ }
+
+ /*
+ * @see IStructuredContentProvider#getElements(Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ super.getElements(inputElement);
+ ExcludeList list = null;
+ if (inputElement instanceof EJBJar) {
+ EJBJar jar = (EJBJar) inputElement;
+ if (jar.getAssemblyDescriptor() != null)
+ list = jar.getAssemblyDescriptor().getExcludeList();
+ if (list != null)
+ return getEnterpriseBeans(list);
+ }
+ if (inputElement instanceof AssemblyDescriptor) {
+ list = ((AssemblyDescriptor) inputElement).getExcludeList();
+ if (list != null)
+ return getEnterpriseBeans(list);
+ }
+ return new Object[0];
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.ui.providers.AbstractMethodsContentProvider#getChildren(Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof ExcludeList)
+ return getEnterpriseBeans((ExcludeList) parentElement);
+ return super.getChildren(parentElement);
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.ui.providers.AbstractMethodsContentProvider#hasChildren(Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof ExcludeList)
+ return !((ExcludeList) element).getMethodElements().isEmpty();
+ return super.hasChildren(element);
+ }
+
+ @Override
+ public void notifyChanged(Notification notifier) {
+ if ((notifier.getFeature() == EXCLUDE_ME_SF && notifier.getNotifier() instanceof ExcludeList) || notifier.getFeature() == ECORE_BEAN_NAME) {
+ if (notifier.getEventType() == Notification.RESOLVE)
+ return;
+ if (isRoot)
+ refreshTreeViewer();
+ else
+ refreshTreeViewer(notifier.getNotifier());
+ }
+ if (notifier.getOldValue() instanceof CMPAttribute && notifier.getNewValue() == null)
+ return;
+ if (notifier.getFeature() == getMethodElementsReference() || notifier.getFeature() == getMethodElementsContainerReference())
+ super.notifyChanged(notifier);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElementsReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsReference() {
+ return EXCLUDE_ME_SF;
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.ui.providers.AbstractMethodsContentProvider#getMethodElementsContainerReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsContainerReference() {
+ return AD_EL_SF;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBItemProvider.java
new file mode 100644
index 0000000..6529545
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBItemProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.Collection;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.internal.provider.J2EEItemProvider;
+
+
+
+/**
+ * This class is the item provider for EJB groups
+ */
+public abstract class GroupedEJBItemProvider extends J2EEItemProvider {
+
+ public GroupedEJBItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent, Collection children) {
+ super(adapterFactory, text, image, parent, children);
+ }
+
+ @Override
+ public IFile getAssociatedFile() {
+
+ try {
+ EJBJar ejbJar = (EJBJar) getParent();
+ if(ejbJar != null && ejbJar.eResource() != null) {
+ return WorkbenchResourceHelperBase.getIFile(ejbJar.eResource().getURI());
+ }
+ } catch (Throwable t) {
+
+ }
+ return null;
+ }
+
+ @Override
+ public abstract String getText(Object object);
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBJarItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBJarItemProvider.java
new file mode 100644
index 0000000..6757470
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEJBJarItemProvider.java
@@ -0,0 +1,381 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationWrapper;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EjbPackage;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.Entity;
+import org.eclipse.jst.j2ee.ejb.MessageDriven;
+import org.eclipse.jst.j2ee.ejb.Session;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.provider.J2EEItemProvider;
+
+
+/**
+ * @author Sachin P Patel
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class GroupedEJBJarItemProvider extends EJBJarItemProvider {
+
+ private GroupedSessionItemProvider sessionProvider = null;
+ private GroupedEntityItemProvider entityProvider = null;
+ private GroupedMessageItemProvider messageProvider = null;
+
+ private static Hashtable sessionTable = new Hashtable();
+ private static Hashtable entityTable = new Hashtable();
+ private static Hashtable messageTable = new Hashtable();
+
+ private static final String SESSION = EJBUIMessages.GroupedEJBJarItemProvider_UI_0;
+ private static final String ENTITY = EJBUIMessages.GroupedEJBJarItemProvider_UI_1;
+ private static final String MESSAGE = EJBUIMessages.GroupedEJBJarItemProvider_UI_2;
+
+ // Normally there is one instance of an item provider for all instances of the objecct
+ // in the tree. The item provider would be stateless. However, because we are doing tricks
+ // here, we are keeping track of all items this provider manages. The key in the map is the
+ // object (EJBJar), and the value is the children nodes that we inserted
+
+ protected Map children = new HashMap();
+ private boolean showAssemblyDescriptor;
+ private boolean isDisposing;
+
+ public GroupedEJBJarItemProvider(AdapterFactory adapterFactory, boolean showAssemblyDescriptor) {
+ super(adapterFactory);
+ this.showAssemblyDescriptor = showAssemblyDescriptor;
+ }
+
+ @Override
+ public Collection getChildren(Object object) {
+ List result = initChildren(object);
+ if (showAssemblyDescriptor) {
+ if (((EJBJar) object).getAssemblyDescriptor() != null)
+ result.add(((EJBJar) object).getAssemblyDescriptor());
+ }
+ return result;
+ }
+
+ protected List initChildren(Object object) {
+ EJBJar ejbJar = (EJBJar) object;
+ List allRootBeans = getAllRootBeans(ejbJar);
+
+ boolean is20Jar = is20Jar(ejbJar);
+
+ List localChildren = new ArrayList(5);
+
+ List entityBeans = new ArrayList();
+ List sessionBeans = new ArrayList();
+ List messageBeans = new ArrayList();
+
+ catagorizeBeans(allRootBeans, entityBeans, sessionBeans, messageBeans);
+ orderBeans(entityBeans);
+ orderBeans(sessionBeans);
+ orderBeans(messageBeans);
+
+ //ENABLE FOR: NOT TO SHOW EMPTY GROUPS
+ //if (sessionBeans.size() > 0) {
+ if (sessionTable.get(ejbJar) == null) {
+ //create new item provider instance
+ sessionProvider = new GroupedSessionItemProvider(adapterFactory, null, getImage(SESSION), object, sessionBeans);
+ sessionTable.put(ejbJar, sessionProvider);
+ localChildren.add(sessionProvider);
+ } else {
+ //use existing instance from table
+ localChildren.add(sessionTable.get(ejbJar));
+ }
+ //}
+
+ //ENABLE FOR: NOT TO SHOW EMPTY GROUPS
+ //if (entityBeans.size() > 0) {
+ if (entityTable.get(ejbJar) == null) {
+ //create new item provider instance
+ entityProvider = new GroupedEntityItemProvider(adapterFactory, null, getImage(ENTITY), object, entityBeans);
+ entityTable.put(ejbJar, entityProvider);
+ localChildren.add(entityProvider);
+ } else {
+ //use existing instance from table
+ localChildren.add(entityTable.get(ejbJar));
+ }
+ //}
+
+ //ENABLE FOR: NOT TO SHOW EMPTY GROUPS
+ //if (is20Jar && messageBeans.size() > 0) {
+ if (is20Jar) {
+ if (messageTable.get(ejbJar) == null) {
+ //create new item provider instance
+ messageProvider = new GroupedMessageItemProvider(adapterFactory, null, getImage(MESSAGE), object, messageBeans);
+ messageTable.put(ejbJar, messageProvider);
+ localChildren.add(messageProvider);
+ } else {
+ //use existing instance from table
+ localChildren.add(messageTable.get(ejbJar));
+ }
+ }
+ //}
+
+ children.put(object, localChildren);
+
+ return localChildren;
+ }
+
+ protected void orderBeans(List beans) {
+ Object[] beansArray = beans.toArray();
+ Arrays.sort(beansArray, EJBNameComparator.singleton());
+ beans.clear();
+ beans.addAll(Arrays.asList(beansArray));
+ }
+
+ protected static List getAllRootBeans(EJBJar ejbJar) {
+ return ejbJar.getEnterpriseBeans();
+ }
+
+ protected void catagorizeBeans(List allRootBeans, List entityBeans, List sessionBeans, List messageBeans) {
+ for (int i = 0; i < allRootBeans.size(); i++) {
+ if (((EnterpriseBean) allRootBeans.get(i)).isSession()) {
+ sessionBeans.add(allRootBeans.get(i));
+ } else if (((EnterpriseBean) allRootBeans.get(i)).isEntity()) {
+ entityBeans.add(allRootBeans.get(i));
+ } else if (((EnterpriseBean) allRootBeans.get(i)).isMessageDriven()) {
+ messageBeans.add(allRootBeans.get(i));
+ }
+ }
+ }
+
+ static protected GroupedSessionItemProvider getSessionNode(Object object) {
+ return (GroupedSessionItemProvider) sessionTable.get(object);
+ }
+
+ static protected GroupedEntityItemProvider getEntityNode(Object object) {
+ return (GroupedEntityItemProvider) entityTable.get(object);
+ }
+
+ static protected GroupedMessageItemProvider getMessageNode(Object object) {
+ return (GroupedMessageItemProvider) messageTable.get(object);
+ }
+
+ @Override
+ public Object getImage(String type) {
+ if (type.equals(SESSION))
+ return J2EEPlugin.getPlugin().getImage("sessionBean_obj"); //$NON-NLS-1$
+ else if (type.equals(MESSAGE))
+ return J2EEPlugin.getPlugin().getImage("message_bean_obj"); //$NON-NLS-1$
+ else if (type.equals(ENTITY))
+ return J2EEPlugin.getPlugin().getImage("entitybean_obj"); //$NON-NLS-1$
+ else
+ return null;
+ }
+
+ private boolean is20Jar(EJBJar ejbJar) {
+ switch (ejbJar.getVersionID()) {
+ case J2EEVersionConstants.EJB_1_0_ID :
+ case J2EEVersionConstants.EJB_1_1_ID :
+ return false;
+ case J2EEVersionConstants.EJB_2_0_ID :
+ case J2EEVersionConstants.EJB_2_1_ID :
+ default :
+ return true;
+ }
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getEventType() == Notification.REMOVING_ADAPTER && notification.getOldValue() == this && !isDisposing) {
+ removeTarget(notification);
+ return;
+ }
+ if (notification.getFeature() == EjbPackage.eINSTANCE.getEJBJar_EnterpriseBeans()) {
+ J2EEItemProvider provider = beansChanged((EJBJar) notification.getNotifier(), notification.getEventType(), notification.getOldValue(), notification.getNewValue(), notification.getPosition());
+
+ //EJB's group has not been added yet, need to add group to tree before EJB can be added
+ if (provider == null) {
+ Notification msg = new NotificationImpl(Notification.ADD, null, getEJBItemProvider((EnterpriseBean) notification.getNewValue()), 1);
+ NotificationWrapper notificationWrapper = new NotificationWrapper(notification.getNotifier(), msg);
+ fireNotifyChanged(notificationWrapper);
+ provider = beansChanged((EJBJar) notification.getNotifier(), notification.getEventType(), notification.getOldValue(), notification.getNewValue(), notification.getPosition());
+ }
+
+ //Fire notification for EJB add or remove
+ NotificationWrapper notificationWrapper = new NotificationWrapper(provider, notification);
+ fireNotifyChanged(notificationWrapper);
+
+ //ENABLE FOR: NOT TO SHOW EMPTY GROUPS
+ //If Group is empty remove the group
+ /*
+ * if (provider != null && provider.getChildren().size() == 0) { Notification msg = new
+ * NotificationImpl(Notification.REMOVE, provider, null, 1); notificationWrapper = new
+ * NotificationWrapper(notification.getNotifier(), msg);
+ * fireNotifyChanged(notificationWrapper);
+ *
+ * //Group is removed so flush out table entry if (provider instanceof
+ * GroupedSessionItemProvider) { sessionTable.remove(notification.getNotifier());
+ * provider = null; } else if (provider instanceof GroupedEntityItemProvider) {
+ * entityTable.remove(notification.getNotifier()); provider = null; } else if (provider
+ * instanceof GroupedMessageItemProvider) {
+ * messageTable.remove(notification.getNotifier()); provider = null; }
+ *
+ * //If all groups are removed remove the extended children List allChildren = new
+ * ArrayList(this.getChildren((EJBJar) notification.getNotifier()));
+ * if(sessionTable.get(notification.getNotifier()) == null &&
+ * entityTable.get(notification.getNotifier()) == null &&
+ * messageTable.get(notification.getNotifier()) == null) { for(int i = 0; i <
+ * allChildren.size(); i++) { Notification message = new
+ * NotificationImpl(Notification.REMOVE, allChildren.get(i), null, 1);
+ * notificationWrapper = new NotificationWrapper(notification.getNotifier(), message);
+ * fireNotifyChanged(notificationWrapper); } this.getChildren((EJBJar)
+ * notification.getNotifier()).clear(); } }
+ */
+ } else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ protected J2EEItemProvider beansChanged(EJBJar ejbJar, int eventType, Object oldValue, Object newValue, int pos) {
+ J2EEItemProvider provider = getItemProvider(ejbJar, oldValue, newValue);
+
+ if (provider != null) {
+ Collection grandChildren = provider.getChildren();
+
+ switch (eventType) {
+ case Notification.ADD : {
+ if (!grandChildren.contains(newValue))
+ grandChildren.add(newValue);
+
+ break;
+ }
+ case Notification.ADD_MANY : {
+ grandChildren.addAll((Collection) newValue);
+ break;
+ }
+ case Notification.REMOVE : {
+ grandChildren.remove(oldValue);
+ break;
+ }
+ case Notification.REMOVE_MANY : {
+ grandChildren.removeAll((Collection) oldValue);
+ break;
+ }
+ }
+ } else {
+ //GroupedProvider for new bean does not exist, create one.
+ List allRootBeans = getAllRootBeans(ejbJar);
+
+ List entityBeans = new ArrayList();
+ List sessionBeans = new ArrayList();
+ List messageBeans = new ArrayList();
+
+ catagorizeBeans(allRootBeans, entityBeans, sessionBeans, messageBeans);
+
+ if (newValue instanceof Session) {
+ sessionProvider = new GroupedSessionItemProvider(adapterFactory, null, getImage(SESSION), ejbJar, sessionBeans);
+ sessionTable.put(ejbJar, sessionProvider);
+ } else if (newValue instanceof Entity) {
+ entityProvider = new GroupedEntityItemProvider(adapterFactory, null, getImage(ENTITY), ejbJar, entityBeans);
+ entityTable.put(ejbJar, entityProvider);
+ } else if (newValue instanceof MessageDriven) {
+ messageProvider = new GroupedMessageItemProvider(adapterFactory, null, getImage(MESSAGE), ejbJar, messageBeans);
+ messageTable.put(ejbJar, messageProvider);
+ }
+ }
+ return provider;
+ }
+
+ static public J2EEItemProvider getEJBJarItemProvider(EJBJar ejbJar, Object bean) {
+ J2EEItemProvider provider = null;
+ if (ejbJar != null && bean != null) {
+ if (bean instanceof Session) {
+ provider = getSessionNode(ejbJar);
+ } else if (bean instanceof Entity) {
+ provider = getEntityNode(ejbJar);
+ } else if (bean instanceof MessageDriven) {
+ provider = getMessageNode(ejbJar);
+ }
+ }
+ return provider;
+ }
+
+ static public J2EEItemProvider getEJBItemProvider(EnterpriseBean bean) {
+ if (bean != null) {
+ EJBJar ejbJar = bean.getEjbJar();
+ return getEJBJarItemProvider(ejbJar, bean);
+ }
+ return null;
+ }
+
+ protected J2EEItemProvider getItemProvider(EJBJar ejbJar, Object oldValue, Object newValue) {
+ if (newValue != null)
+ return getEJBJarItemProvider(ejbJar, newValue);
+ else if (oldValue != null)
+ return getEJBJarItemProvider(ejbJar, oldValue);
+ else
+ return null;
+ }
+
+ public static boolean isRootBean(EnterpriseBean bean) {
+ List allRootBeans = getAllRootBeans(bean.getEjbJar());
+ if (allRootBeans != null && allRootBeans.contains(bean)) {
+ return true;
+ }
+ return false;
+ }
+
+ // Utility method for garbage collection - if EJBJar removed, remove
+ // all entires in table for EJBJar
+ static public void flushOutTableEntriesForEJBJar(EJBJar ejbJar) {
+ sessionTable.remove(ejbJar);
+ entityTable.remove(ejbJar);
+ messageTable.remove(ejbJar);
+ }
+
+ @Override
+ public boolean hasChildren(Object parent) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.provider.EJBJarItemProvider#removeTarget(org.eclipse.emf.common.notify.Notification)
+ */
+ protected void removeTarget(Notification not) {
+ if (not.getNotifier() instanceof EJBJar)
+ flushOutTableEntriesForEJBJar((EJBJar) not.getNotifier());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#dispose()
+ */
+ @Override
+ public void dispose() {
+ try {
+ isDisposing = true;
+ super.dispose();
+ } finally {
+ isDisposing = false;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEntityItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEntityItemProvider.java
new file mode 100644
index 0000000..80ef655
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedEntityItemProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+
+
+/**
+ * @author Sachin Patel
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class GroupedEntityItemProvider extends GroupedEJBItemProvider {
+
+ public static final String ENTITY = J2EEUIMessages.getResourceString("Entity_UI_"); //$NON-NLS-1$
+
+ public GroupedEntityItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent, Collection children) {
+ super(adapterFactory, text, image, parent, children);
+ }
+
+ @Override
+ public String getText(Object object) {
+ return ENTITY;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedMessageItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedMessageItemProvider.java
new file mode 100644
index 0000000..ca49732
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedMessageItemProvider.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+
+
+
+/**
+ * @author Sachin Patel
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class GroupedMessageItemProvider extends GroupedEJBItemProvider {
+
+ public static final String MESSAGE_BEANS = J2EEUIMessages.getResourceString("Message_Driven_Beans_UI_"); //$NON-NLS-1$
+
+ public GroupedMessageItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent, Collection children) {
+ super(adapterFactory, text, image, parent, children);
+ }
+
+ @Override
+ public String getText(Object object) {
+ return MESSAGE_BEANS;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedSessionItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedSessionItemProvider.java
new file mode 100644
index 0000000..5fc73a4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/GroupedSessionItemProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+
+
+/**
+ * @author Sachin Patel
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class GroupedSessionItemProvider extends GroupedEJBItemProvider {
+
+ public static final String SESSION_BEANS = J2EEUIMessages.getResourceString("Session_Beans_UI_"); //$NON-NLS-1$
+
+ public GroupedSessionItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent, Collection children) {
+ super(adapterFactory, text, image, parent, children);
+ }
+
+ @Override
+ public String getText(Object object) {
+ return SESSION_BEANS;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/HomeInterfaceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/HomeInterfaceProviderHelper.java
new file mode 100644
index 0000000..2348efa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/HomeInterfaceProviderHelper.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 11:23:30 PM)
+ *
+ * @author: Administrator
+ */
+public class HomeInterfaceProviderHelper extends J2EEJavaClassProviderHelper {
+ private static Image image;
+
+ /**
+ * HomeInterfaceProviderHelper constructor comment.
+ *
+ * @param cls
+ * org.eclipse.jem.internal.java.JavaClass
+ */
+ public HomeInterfaceProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:53:49 PM)
+ *
+ * @return org.eclipse.jem.internal.java.JavaClass
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return getEjb().getHomeInterface();
+ }
+
+ @Override
+ protected String getOverlayKey() {
+ return "home_interface_overlay_obj";//$NON-NLS-1$
+ }
+
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Home_Interface_UI_", new Object[]{className}); //$NON-NLS-1$ = "Home Interface"
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEContainerManagedEntityItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEContainerManagedEntityItemProvider.java
new file mode 100644
index 0000000..2a09f66
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEContainerManagedEntityItemProvider.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.ejb.ContainerManagedEntity;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 6:58:51 PM)
+ *
+ * @author: Administrator
+ */
+public class J2EEContainerManagedEntityItemProvider extends ContainerManagedEntityItemProvider {
+ /**
+ * J2EEContainerManagedEntityItemProvider constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ */
+ public J2EEContainerManagedEntityItemProvider(EjbItemProviderAdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ result.addAll(super.getChildren(object));
+ J2EEJavaClassProviderHelper.addChildren((ContainerManagedEntity) object, result);
+ result.addAll(((ContainerManagedEntity) object).getEnvironmentProperties());
+ result.addAll(J2EEReferenceProviderHelper.getReferences((EnterpriseBean) object));
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEjbItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEjbItemProviderAdapterFactory.java
new file mode 100644
index 0000000..ddd17bf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEjbItemProviderAdapterFactory.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+import org.eclipse.emf.common.notify.Adapter;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 7:20:07 PM)
+ *
+ * @author: Administrator
+ */
+public class J2EEEjbItemProviderAdapterFactory extends org.eclipse.jst.j2ee.internal.ejb.provider.EjbItemProviderAdapterFactory {
+ /**
+ * J2EEEjbItemProviderAdapterFactory constructor comment.
+ */
+ public J2EEEjbItemProviderAdapterFactory() {
+ super();
+ }
+
+ /**
+ * This creates an adapter for a
+ * {@link org.eclipse.jst.j2ee.internal.internal.ejb.ContainerManagedEntity}.
+ */
+ @Override
+ public Adapter createContainerManagedEntityAdapter() {
+ if (containerManagedEntityItemProvider == null) {
+ containerManagedEntityItemProvider = new J2EEContainerManagedEntityItemProvider(this);
+ }
+
+ return containerManagedEntityItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.ejb.EJBJar}.
+ */
+ @Override
+ public Adapter createEJBJarAdapter() {
+ if (eJBJarItemProvider == null) {
+ eJBJarItemProvider = new GroupedEJBJarItemProvider(this, true);
+ }
+
+ return eJBJarItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.ejb.Entity}.
+ */
+ @Override
+ public Adapter createEntityAdapter() {
+ if (entityItemProvider == null) {
+ entityItemProvider = new J2EEEntityItemProvider(this);
+ }
+
+ return entityItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.ejb.Session}.
+ */
+ @Override
+ public Adapter createSessionAdapter() {
+ if (sessionItemProvider == null) {
+ sessionItemProvider = new J2EESessionItemProvider(this);
+ }
+
+ return sessionItemProvider;
+ }
+
+ @Override
+ public Adapter createMessageDrivenAdapter() {
+ if (messageDrivenItemProvider == null) {
+ messageDrivenItemProvider = new J2EEMessageDrivenItemProvider(this);
+ }
+ return messageDrivenItemProvider;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEntityItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEntityItemProvider.java
new file mode 100644
index 0000000..e41eee6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEEntityItemProvider.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.ejb.Entity;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 11:10:06 PM)
+ *
+ * @author: Administrator
+ */
+public class J2EEEntityItemProvider extends EntityItemProvider {
+ /**
+ * J2EEEntityItemProvider constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ */
+ public J2EEEntityItemProvider(org.eclipse.emf.common.notify.AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ result.addAll(super.getChildrenSuper(object));
+ J2EEJavaClassProviderHelper.addChildren((Entity) object, result);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEJavaClassProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEJavaClassProviderHelper.java
new file mode 100644
index 0000000..00fe427
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEJavaClassProviderHelper.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.Collection;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.Entity;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEEditorUtility;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.frameworks.internal.ui.OverlayIcon;
+
+public abstract class J2EEJavaClassProviderHelper implements IAdaptable {
+ private EnterpriseBean ejb;
+ public static final Class IRESOURCE_CLASS = IResource.class;
+ public static final Class IPROJECT_CLASS = IProject.class;
+
+ /**
+ * J2EEJavaClassProviderHelper constructor comment.
+ */
+ public J2EEJavaClassProviderHelper(EnterpriseBean anEJB) {
+ super();
+ setEjb(anEJB);
+ }
+
+ public static void addChildren(Entity ejb, Collection children) {
+ addChildren((EnterpriseBean) ejb, children);
+ if (ejb.getPrimaryKey() != null)
+ children.add(new PrimaryKeyClassProviderHelper(ejb));
+ }
+
+ public static void addChildren(EnterpriseBean ejb, Collection children) {
+
+ if (ejb.getHomeInterface() != null)
+ children.add(new HomeInterfaceProviderHelper(ejb));
+ if (ejb.getRemoteInterface() != null)
+ children.add(new RemoteInterfaceProviderHelper(ejb));
+ if (ejb.getLocalHomeInterface() != null)
+ children.add(new LocalHomeInterfaceProviderHelper(ejb));
+ if (ejb.getLocalInterface() != null)
+ children.add(new LocalInterfaceProviderHelper(ejb));
+ if (ejb.getEjbClass() != null)
+ children.add(new BeanClassProviderHelper(ejb));
+ }
+
+ protected Image createImage() {
+ ImageDescriptor base = J2EEUIPlugin.getDefault().getImageDescriptor("jcu_obj");//$NON-NLS-1$
+ if (base == null)
+ return null;
+ ImageDescriptor overlay = getOverlayDescriptor();
+ if (overlay == null)
+ return base.createImage();
+ return new OverlayIcon(base, new ImageDescriptor[][]{{overlay}}).createImage();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:47:24 PM)
+ *
+ * @return org.eclipse.jst.j2ee.internal.internal.ejb.EnterpriseBean
+ */
+ public org.eclipse.jst.j2ee.ejb.EnterpriseBean getEjb() {
+ return ejb;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/20/2001 10:30:54 PM)
+ *
+ * @return JavaClass
+ */
+ public abstract JavaClass getJavaClass();
+
+ protected ImageDescriptor getOverlayDescriptor() {
+ return J2EEUIPlugin.getDefault().getImageDescriptor(getOverlayKey());
+ }
+
+ protected abstract String getOverlayKey();
+
+ protected IProject getProject() {
+ return ProjectUtilities.getProject(getJavaClass());
+ }
+
+ public String getStatusLineMessage() {
+ if (getJavaClass() != null)
+ return getTypeString(getJavaClass().getQualifiedName());
+ return ""; //$NON-NLS-1$
+ }
+
+ public String getText() {
+ if (getJavaClass() != null)
+ return getJavaClass().getName();
+ return ""; //$NON-NLS-1$
+ }
+
+ public abstract String getTypeString(String className);
+
+ public void openInEditor() {
+ IProject project = ProjectUtilities.getProject(getJavaClass());
+ try {
+ J2EEEditorUtility.openInEditor(getJavaClass(), project);
+ } catch (Exception cantOpen) {
+ //Ignore
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:47:24 PM)
+ *
+ * @param newEjb
+ * org.eclipse.jst.j2ee.internal.internal.ejb.EnterpriseBean
+ */
+ public void setEjb(org.eclipse.jst.j2ee.ejb.EnterpriseBean newEjb) {
+ ejb = newEjb;
+ }
+
+ /**
+ * @see IAdaptable#EcoreUtil.getAdapter(eAdapters(),Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == IRESOURCE_CLASS)
+ return J2EEEditorUtility.getFile(getJavaClass());
+ if (adapter == IPROJECT_CLASS)
+ return getProject();
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEMessageDrivenItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEMessageDrivenItemProvider.java
new file mode 100644
index 0000000..f56248a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEMessageDrivenItemProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.ejb.MessageDriven;
+
+
+/**
+ * @author jsholl
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class J2EEMessageDrivenItemProvider extends MessageDrivenItemProvider {
+
+ public J2EEMessageDrivenItemProvider(org.eclipse.emf.common.notify.AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ result.addAll(super.getChildrenSuper(object));
+ J2EEJavaClassProviderHelper.addChildren((MessageDriven) object, result);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEReferenceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEReferenceProviderHelper.java
new file mode 100644
index 0000000..b8b8948
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EEReferenceProviderHelper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on May 6, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.ejb.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+
+
+/**
+ * @author jsholl
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class J2EEReferenceProviderHelper {
+
+ public static Collection getReferences(EnterpriseBean bean) {
+ List result = new ArrayList();
+ if (!bean.getEjbRefs().isEmpty())
+ result.addAll(bean.getEjbRefs());
+ if (!bean.getEjbLocalRefs().isEmpty())
+ result.addAll(bean.getEjbLocalRefs());
+ if (!bean.getResourceRefs().isEmpty())
+ result.addAll(bean.getResourceRefs());
+ if (!bean.getSecurityRoleRefs().isEmpty())
+ result.addAll(bean.getSecurityRoleRefs());
+ if (!bean.getResourceEnvRefs().isEmpty())
+ result.addAll(bean.getResourceEnvRefs());
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EESessionItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EESessionItemProvider.java
new file mode 100644
index 0000000..ec372069
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/J2EESessionItemProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.ejb.Session;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 11:10:48 PM)
+ *
+ * @author: Administrator
+ */
+public class J2EESessionItemProvider extends org.eclipse.jst.j2ee.internal.ejb.provider.SessionItemProvider {
+ /**
+ * J2EESessionItemProvider constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ */
+ public J2EESessionItemProvider(org.eclipse.emf.common.notify.AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ result.addAll(super.getChildrenSuper(object));
+ addServiceEndpointInterface((Session) object, result);
+ J2EEJavaClassProviderHelper.addChildren((Session) object, result);
+ return result;
+ }
+
+ /**
+ * @param session
+ * @param result
+ */
+ private void addServiceEndpointInterface(Session session, Collection children) {
+ if (session.getVersionID() >= J2EEVersionConstants.EJB_2_1_ID && session.getServiceEndpoint() != null)
+ children.add(new ServiceEndpointInterfaceProviderHelper(session));
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalHomeInterfaceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalHomeInterfaceProviderHelper.java
new file mode 100644
index 0000000..22891ad
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalHomeInterfaceProviderHelper.java
@@ -0,0 +1,62 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+public class LocalHomeInterfaceProviderHelper extends J2EEJavaClassProviderHelper {
+
+ private static Image image;
+
+ /**
+ * Constructor for LocalHomeInterfaceProviderHelper.
+ *
+ * @param anEJB
+ */
+ public LocalHomeInterfaceProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getJavaClass()
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return getEjb().getLocalHomeInterface();
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getOverlayKey()
+ */
+ @Override
+ protected String getOverlayKey() {
+ return "local_home_interface_overlay_obj"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getTypeString(String)
+ */
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Local_Home_Interface_UI_", new Object[]{className}); //$NON-NLS-1$ = "Local Home Interface";
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalInterfaceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalInterfaceProviderHelper.java
new file mode 100644
index 0000000..249aa59
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/LocalInterfaceProviderHelper.java
@@ -0,0 +1,62 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+public class LocalInterfaceProviderHelper extends J2EEJavaClassProviderHelper {
+
+ private static Image image;
+
+ /**
+ * Constructor for LocalInterfaceProviderHelper.
+ *
+ * @param anEJB
+ */
+ public LocalInterfaceProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getJavaClass()
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return getEjb().getLocalInterface();
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getOverlayKey()
+ */
+ @Override
+ protected String getOverlayKey() {
+ return "local_interface_overlay_obj";//$NON-NLS-1$
+ }
+
+ /**
+ * @see J2EEJavaClassProviderHelper#getTypeString(String)
+ */
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Local_Interface_UI_", new Object[]{className}); //$NON-NLS-1$ = "Local Interface"
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodPermissionsContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodPermissionsContentProvider.java
new file mode 100644
index 0000000..2beda77
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodPermissionsContentProvider.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.j2ee.ejb.CMPAttribute;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.MethodPermission;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+
+
+public class MethodPermissionsContentProvider extends AbstractMethodsContentProvider {
+ private static final EStructuralFeature PERMISSION_MES_SF = EjbFactoryImpl.getPackage().getMethodPermission_MethodElements();
+ private static final EStructuralFeature PERMISSION_MES_UNCHECKED_SF = EjbFactoryImpl.getPackage().getMethodPermission_Unchecked();
+ private static final EStructuralFeature PERMISSION_MES_ROLES_SF = EjbFactoryImpl.getPackage().getMethodPermission_Roles();
+ private static final EStructuralFeature AD_MP_SF = EjbFactoryImpl.getPackage().getAssemblyDescriptor_MethodPermissions();
+
+ /**
+ * Constructor for MethodPermissionsContentProvider.
+ *
+ * @param adapterFactory
+ * @param root
+ * @param viewer
+ */
+ public MethodPermissionsContentProvider(AdapterFactory adapterFactory, boolean root) {
+ super(adapterFactory, root);
+ }
+
+ /**
+ * Constructor for MethodPermissionsContentProvider.
+ *
+ * @param adapterFactory
+ */
+ public MethodPermissionsContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /*
+ * @see ITreeContentProvider#getChildren(Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof MethodPermission)
+ return getEnterpriseBeans((MethodPermission) parentElement);
+ return super.getChildren(parentElement);
+ }
+
+ protected Object[] getEnterpriseBeans(MethodPermission mp) {
+ List mes = mp.getMethodElements();
+ return getEnterpriseBeans(mp, mes);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElements(EObject, EnterpriseBean)
+ */
+ @Override
+ protected List getMethodElements(EObject aRefObject, EnterpriseBean anEJB) {
+ if (aRefObject == null || !(aRefObject instanceof MethodPermission))
+ return Collections.EMPTY_LIST;
+ MethodPermission parentMP = (MethodPermission) aRefObject;
+ return parentMP.getMethodElements(anEJB);
+ }
+
+ /*
+ * @see IStructuredContentProvider#getElements(Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ super.getElements(inputElement);
+ if (inputElement instanceof EJBJar) {
+ EJBJar jar = (EJBJar) inputElement;
+ if (jar.getAssemblyDescriptor() != null)
+ return jar.getAssemblyDescriptor().getMethodPermissions().toArray();
+ }
+ if (inputElement instanceof AssemblyDescriptor)
+ return ((AssemblyDescriptor) inputElement).getMethodPermissions().toArray();
+ return new Object[0];
+ }
+
+ /*
+ * @see ITreeContentProvider#hasChildren(Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof MethodPermission)
+ return !((MethodPermission) element).getMethodElements().isEmpty();
+ return super.hasChildren(element);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElementsReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsReference() {
+ return PERMISSION_MES_SF;
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.ui.providers.AbstractMethodsContentProvider#getMethodElementsContainerReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsContainerReference() {
+ return AD_MP_SF;
+ }
+
+ /**
+ * @see org.eclipse.emf.edit.provider.INotifyChangedListener#notifyChanged(Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getFeature() == PERMISSION_MES_SF || notification.getFeature() == AD_MP_SF)
+ refreshTreeViewer();
+ else if (notification.getOldValue() instanceof CMPAttribute && notification.getNewValue() == null)
+ return;
+ if (notification.getFeature() == PERMISSION_MES_UNCHECKED_SF || notification.getFeature() == PERMISSION_MES_ROLES_SF || notification.getFeature() == getMethodElementsReference() || notification.getFeature() == getMethodElementsContainerReference())
+ super.notifyChanged(notification);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodTransactionContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodTransactionContentProvider.java
new file mode 100644
index 0000000..0ef2f26
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/MethodTransactionContentProvider.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ejb.provider;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.MethodTransaction;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+
+
+public class MethodTransactionContentProvider extends AbstractMethodsContentProvider {
+ private static final EStructuralFeature TRANSACTION_MES_SF = EjbFactoryImpl.getPackage().getMethodTransaction_MethodElements();
+ private static final EStructuralFeature AD_MT_SF = EjbFactoryImpl.getPackage().getAssemblyDescriptor_MethodTransactions();
+
+ /**
+ * Constructor for MethodTransactionContentProvider.
+ *
+ * @param adapterFactory
+ * @param root
+ * @param viewer
+ */
+ public MethodTransactionContentProvider(AdapterFactory adapterFactory, boolean root) {
+ super(adapterFactory, root);
+ }
+
+ /**
+ * Constructor for MethodTransationContentProvider.
+ *
+ * @param adapterFactory
+ */
+ public MethodTransactionContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /*
+ * @see ITreeContentProvider#getChildren(Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof MethodTransaction)
+ return getEnterpriseBeans((MethodTransaction) parentElement);
+ return super.getChildren(parentElement);
+ }
+
+ protected Object[] getEnterpriseBeans(MethodTransaction mt) {
+ List mes = mt.getMethodElements();
+ return getEnterpriseBeans(mt, mes);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElements(EObject, EnterpriseBean)
+ */
+ @Override
+ protected List getMethodElements(EObject aRefObject, EnterpriseBean anEJB) {
+ if (aRefObject == null || !(aRefObject instanceof MethodTransaction))
+ return Collections.EMPTY_LIST;
+ MethodTransaction parentMT = (MethodTransaction) aRefObject;
+ return parentMT.getMethodElements(anEJB);
+ }
+
+ /*
+ * @see IStructuredContentProvider#getElements(Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ super.getElements(inputElement);
+ if (inputElement instanceof EJBJar) {
+ EJBJar jar = (EJBJar) inputElement;
+ if (jar.getAssemblyDescriptor() != null)
+ return jar.getAssemblyDescriptor().getMethodTransactions().toArray();
+ }
+ if (inputElement instanceof AssemblyDescriptor)
+ return ((AssemblyDescriptor) inputElement).getMethodTransactions().toArray();
+ return new Object[0];
+ }
+
+ /*
+ * @see ITreeContentProvider#hasChildren(Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof MethodTransaction)
+ return !((MethodTransaction) element).getMethodElements().isEmpty();
+ return super.hasChildren(element);
+ }
+
+ /*
+ * @see AbstractMethodsContentProvider#getMethodElementsReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsReference() {
+ return TRANSACTION_MES_SF;
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.ejb.ui.providers.AbstractMethodsContentProvider#getMethodElementsContainerReference()
+ */
+ @Override
+ protected EStructuralFeature getMethodElementsContainerReference() {
+ return AD_MT_SF;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/PrimaryKeyClassProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/PrimaryKeyClassProviderHelper.java
new file mode 100644
index 0000000..437f797
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/PrimaryKeyClassProviderHelper.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.Entity;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/21/2001 12:28:55 AM)
+ *
+ * @author: Administrator
+ */
+public class PrimaryKeyClassProviderHelper extends J2EEJavaClassProviderHelper {
+ private static Image image;
+
+ /**
+ * PrimaryKeyClassProviderHelper constructor comment.
+ *
+ * @param cls
+ * org.eclipse.jem.internal.java.JavaClass
+ */
+ public PrimaryKeyClassProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:54:22 PM)
+ *
+ * @return org.eclipse.jem.internal.java.JavaClass
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return ((Entity) getEjb()).getPrimaryKey();
+ }
+
+ @Override
+ protected String getOverlayKey() {
+ return "key_interf_ov";//$NON-NLS-1$
+ }
+
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Primary_Key_Class_UI_", new Object[]{className}); //$NON-NLS-1$ = "Primary Key Class"
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/RemoteInterfaceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/RemoteInterfaceProviderHelper.java
new file mode 100644
index 0000000..a677d57
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/RemoteInterfaceProviderHelper.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.ejb.provider;
+
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/21/2001 12:28:12 AM)
+ *
+ * @author: Administrator
+ */
+public class RemoteInterfaceProviderHelper extends J2EEJavaClassProviderHelper {
+ private static Image image;
+
+ /**
+ * RemoteInterfaceProviderHelper constructor comment.
+ *
+ * @param cls
+ * org.eclipse.jem.internal.java.JavaClass
+ */
+ public RemoteInterfaceProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:55:48 PM)
+ *
+ * @return org.eclipse.jem.internal.java.JavaClass
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return getEjb().getRemoteInterface();
+ }
+
+ @Override
+ protected String getOverlayKey() {
+ return "remote_interface_overlay_obj";//$NON-NLS-1$
+ }
+
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Remote_Interface_UI_", new Object[]{className}); //$NON-NLS-1$ = "Remote Interface"
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ServiceEndpointInterfaceProviderHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ServiceEndpointInterfaceProviderHelper.java
new file mode 100644
index 0000000..53528b2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ejb/provider/ServiceEndpointInterfaceProviderHelper.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Mar 19, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.ejb.provider;
+
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.Session;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * @author dfholttp
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class ServiceEndpointInterfaceProviderHelper extends J2EEJavaClassProviderHelper {
+ private static Image image;
+
+ /**
+ * @param anEJB
+ */
+ public ServiceEndpointInterfaceProviderHelper(EnterpriseBean anEJB) {
+ super(anEJB);
+ }
+
+ @Override
+ public Image getImage() {
+ if (image == null)
+ image = createImage();
+ return image;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (7/11/2001 1:53:49 PM)
+ *
+ * @return org.eclipse.jem.internal.java.JavaClass
+ */
+ @Override
+ public JavaClass getJavaClass() {
+ return ((Session) getEjb()).getServiceEndpoint();
+ }
+
+ @Override
+ protected String getOverlayKey() {
+ //TODO: DFH we need an icon
+ return "";//$NON-NLS-1$
+ }
+
+ @Override
+ public String getTypeString(String className) {
+ return J2EEUIMessages.getResourceString("Service_Endpoint_Interface_UI_", new Object[]{className}); //$NON-NLS-1$ = "Home Interface"
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/IValidateEditListener.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/IValidateEditListener.java
new file mode 100644
index 0000000..0544eb5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/IValidateEditListener.java
@@ -0,0 +1,43 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.listeners;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter;
+
+
+public interface IValidateEditListener extends ResourceStateValidatorPresenter, IPartListener, ShellListener {
+ /**
+ * This method should be called by any action that is about to edit any contents of any IFile.
+ */
+ public IStatus validateState();
+
+ /**
+ * Return true if there are any read only IFiles that are being managed.
+ *
+ * @return boolean
+ * @see com.ibm.etools.emf.workbench.ResourceStateInputProvider#getResources()
+ */
+ boolean hasReadOnlyFiles();
+
+ /**
+ * This method should be called prior to saving the contents. It returns true if the contents
+ * can be saved.
+ */
+ boolean checkSave() throws CoreException;
+
+ /**
+ * Use this method to set the Shell that will be used to prompt to the user.
+ */
+ void setShell(Shell aShell);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/ValidateEditListener.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/ValidateEditListener.java
new file mode 100644
index 0000000..be6b1dc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/listeners/ValidateEditListener.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.listeners;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jst.j2ee.internal.dialogs.ListMessageDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext;
+import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidator;
+
+public class ValidateEditListener extends ShellAdapter implements IValidateEditListener, IValidateEditContext {
+
+ protected ResourceStateValidator fValidator;
+ private boolean fNeedsStateValidation = true;
+ private Shell fShell;
+ private IWorkbenchPart fPart;
+ private boolean fHasReadOnlyFiles = false;
+ private boolean firstReadOnlyFileAttempt = true;
+ private boolean fMessageUp = false;
+ private boolean fIsActivating = false;
+ private boolean fIsDeactivating = false;
+ private boolean inconsistentResult;
+ private boolean inconsistentOverwriteResult;
+
+ public ValidateEditListener() {
+ super();
+ try {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ if (wb == null) return;
+ IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
+ if (window == null && wb.getWorkbenchWindowCount()>0) {
+ for (int i=0; i<wb.getWorkbenchWindows().length; i++) {
+ window = wb.getWorkbenchWindows()[i];
+ if (window != null)
+ break;
+ }
+
+ }
+ if (window!=null)
+ setShell(window.getShell());
+ }
+ });
+
+ } catch (Exception e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ /**
+ * Constructor for ValidateEditHandler.
+ */
+ public ValidateEditListener(IWorkbenchPart part, ResourceStateValidator aValidator) {
+ super();
+ fPart = part;
+ fValidator = aValidator;
+ if (part != null)
+ part.getSite().getPage().addPartListener(this);
+ if (getShell() != null)
+ getShell().addShellListener(this);
+ }
+
+ protected Shell getShell() {
+ if (fShell == null) {
+ if (fPart != null && fPart.getSite() != null)
+ fShell = fPart.getSite().getShell();
+ }
+ return fShell;
+ }
+
+ /**
+ * @see IValidateEditListener#getValidator()
+ */
+ public ResourceStateValidator getValidator() {
+ return fValidator;
+ }
+
+ /**
+ * @see IValidateEditListener#getNeedsStateValidation()
+ */
+ public boolean getNeedsStateValidation() {
+ return fNeedsStateValidation;
+ }
+
+ /**
+ * @see IValidateEditListener#setNeedsStateValidation(boolean)
+ */
+ public void setNeedsStateValidation(boolean needsStateValidation) {
+ fNeedsStateValidation = needsStateValidation;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#promptForInconsistentFileRefresh(List)
+ */
+ public boolean promptForInconsistentFileRefresh(List inconsistentFiles) {
+ if (inconsistentFiles == null || inconsistentFiles.size() == 0) // this case should never
+ // occur.
+ return false;
+
+ List inconsistentFileNames = new ArrayList();
+ for (int i = 0; inconsistentFiles.size() > i; i++) {
+ Object file = inconsistentFiles.get(i);
+ if (file instanceof Resource) {
+ IFile aFile = WorkbenchResourceHelper.getFile((Resource) file);
+ inconsistentFileNames.add(aFile.getFullPath().toOSString());
+ } else if (file instanceof IResource) {
+ IResource resfile = (IResource) file;
+ if (!resfile.exists()) {
+ return false;
+ }
+ inconsistentFileNames.add(resfile.getFullPath().toOSString());
+ }
+ }
+
+ final String title = J2EEUIMessages.getResourceString("Inconsistent_Files_3"); //$NON-NLS-1$
+ final String message = J2EEUIMessages.getResourceString("The_following_workspace_files_are_inconsistent_with_the_editor_4") + J2EEUIMessages.getResourceString("Update_the_editor_with_the_workspace_contents__5"); //$NON-NLS-1$ //$NON-NLS-2$
+ final String[] fileNames = (String[])inconsistentFileNames.toArray(new String[inconsistentFileNames.size()]);
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ inconsistentResult = ListMessageDialog.openQuestion(getShell(), title, message, fileNames);
+ }
+ });
+ return inconsistentResult;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#getValidateEditContext()
+ */
+ public Object getValidateEditContext() {
+ return getShell();
+ }
+
+ /**
+ * @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
+ */
+ public void partActivated(IWorkbenchPart part) {
+ if (part == fPart) {
+ handleActivation();
+ }
+ }
+
+ protected void handleActivation() {
+ if (fIsActivating)
+ return;
+ fIsActivating = true;
+ try {
+ fValidator.checkActivation(this);
+ updatePartReadOnly();
+ } catch (CoreException e) {
+ // do nothing for now
+ } finally {
+ fIsActivating = false;
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ShellListener#shellActivated(ShellEvent)
+ */
+ @Override
+ public void shellActivated(ShellEvent event) {
+ handleActivation();
+ }
+
+ /**
+ * @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
+ */
+ public void partBroughtToTop(IWorkbenchPart part) {
+ //do nothing
+ }
+
+ /**
+ * @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
+ */
+ public void partClosed(IWorkbenchPart part) {
+ if (part == fPart)
+ part.getSite().getPage().removePartListener(this);
+ if (getShell() != null)
+ getShell().removeShellListener(this);
+ }
+
+ /**
+ * @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
+ */
+ public void partDeactivated(IWorkbenchPart part) {
+ if (part == fPart) {
+ if (fIsDeactivating)
+ return;
+ fIsDeactivating = true;
+ try {
+ fValidator.lostActivation(this);
+ updatePartReadOnly();
+ } catch (CoreException e) {
+ // do nothing for now
+ } finally {
+ fIsDeactivating = true;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
+ */
+ public void partOpened(IWorkbenchPart part) {
+ //do nothing
+ }
+
+ public IStatus validateState() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ if ((fShell==null) && (wb != null && (wb.getActiveWorkbenchWindow() != null)))
+ fShell=wb.getActiveWorkbenchWindow().getShell();
+ if (fNeedsStateValidation) {
+ setNeedsStateValidation(false);
+ try {
+ final IStatus status = fValidator.validateState(this);
+ if (status.getSeverity() == IStatus.ERROR) {
+ setNeedsStateValidation(true);
+ if (!fMessageUp) {
+ fMessageUp = true;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(getShell(), J2EEUIMessages.getResourceString("Error_checking_out_files_10"), status.getMessage()); //$NON-NLS-1$
+ }
+ });
+ fMessageUp = false;
+ }
+ }
+ fValidator.checkActivation(this);
+ updatePartReadOnly();
+ return status;
+ } catch (CoreException e) {
+ // do nothing for now
+ }
+ }
+ return ResourceStateValidator.OK_STATUS;
+ }
+
+ /**
+ * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#promptForInconsistentFileOverwrite(List)
+ */
+ public boolean promptForInconsistentFileOverwrite(List inconsistentFiles) {
+ int size = inconsistentFiles.size();
+ List files = new ArrayList();
+ IFile file = null;
+ for (int i = 0; i < size; i++) {
+ file = (IFile) inconsistentFiles.get(i);
+ files.add(file.getFullPath().toString());
+ }
+ final String[] items = (String[])files.toArray(new String[files.size()]);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ inconsistentOverwriteResult = ListMessageDialog.openQuestion(getShell(), J2EEUIMessages.getResourceString("Inconsistent_files_detected_11"), //$NON-NLS-1$
+ J2EEUIMessages.getResourceString("The_following_files_are_inconsistent_with_the_file_system._Do_you_want_to_save_and_overwrite_these_files_on_the_file_system__12_WARN_"), //$NON-NLS-1$
+ items);
+ }
+ });
+ return inconsistentOverwriteResult;
+ }
+
+ protected boolean checkReadOnly() {
+ fHasReadOnlyFiles = fValidator.checkReadOnly();
+ return fHasReadOnlyFiles;
+ }
+
+ /**
+ * @see IValidateEditListener#hasReadOnlyFiles()
+ */
+ public boolean hasReadOnlyFiles() {
+ if (firstReadOnlyFileAttempt) {
+ checkReadOnly();
+ firstReadOnlyFileAttempt = false;
+ }
+ return fHasReadOnlyFiles;
+ }
+
+ /**
+ * Method updatePartReadOnly.
+ */
+ protected void updatePartReadOnly() {
+ if (!getNeedsStateValidation()) {
+ checkReadOnly();
+ setNeedsStateValidation(true);
+ } else { //So that J2EEXMLActionBarContributor get updated info when editor Activated.
+ firstReadOnlyFileAttempt = true;
+ }
+ }
+
+ public boolean checkSave() throws CoreException {
+ return validateState().isOK() && getValidator().checkSave(this);
+ }
+
+ public void setShell(Shell aShell) {
+ fShell = aShell;
+ }
+
+ public void setEditModel(EditModel anEditModel) {
+ fValidator = anEditModel;
+
+ }
+
+ public IStatus validateState(EditModel anEditModel) {
+ setEditModel(anEditModel);
+ return validateState();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/perspective/J2EEPerspective.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/perspective/J2EEPerspective.java
new file mode 100644
index 0000000..4f60738
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/perspective/J2EEPerspective.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+/*
+ * Created on Dec 7, 2004
+ */
+package org.eclipse.jst.j2ee.internal.perspective;
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.eclipse.ui.views.IViewDescriptor;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+
+public class J2EEPerspective implements org.eclipse.ui.IPerspectiveFactory {
+
+ protected static String ID_SERVERS_VIEW = "org.eclipse.wst.server.ui.ServersView"; //$NON-NLS-1$
+ protected static String ID_J2EE_HIERARCHY_VIEW = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+
+ private static String ID_WST_SNIPPETS_VIEW = "org.eclipse.wst.common.snippets.internal.ui.SnippetsView"; //$NON-NLS-1$
+ private static final String ID_SEARCH_VIEW = "org.eclipse.search.ui.views.SearchView"; //$NON-NLS-1$
+ private static final String ID_DATA_VIEW = "org.eclipse.datatools.connectivity.DataSourceExplorerNavigator"; //$NON-NLS-1$
+ public static final String ID_CONSOLE_VIEW= "org.eclipse.ui.console.ConsoleView"; //$NON-NLS-1$
+ public static final String ID_MARKERS_VIEW= "org.eclipse.ui.views.AllMarkersView"; //$NON-NLS-1$
+ public static final String ID_TASKLIST_VIEW= "org.eclipse.mylyn.tasks.ui.views.tasks"; //$NON-NLS-1$
+
+ public J2EEPerspective() {
+ super();
+ //If preference exists for alternate view, replace.
+ String viewerID = ProductManager.getProperty(IProductConstants.ID_PERSPECTIVE_HIERARCHY_VIEW);
+ if (viewerID != null) {
+ // verify that the view actually exists
+ if (PlatformUI.getWorkbench().getViewRegistry().find(viewerID) != null){
+ ID_J2EE_HIERARCHY_VIEW = viewerID;
+ }
+ } else {
+ viewerID = J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.ID_PERSPECTIVE_HIERARCHY_VIEW);
+ if (viewerID != null){
+ if (PlatformUI.getWorkbench().getViewRegistry().find(viewerID) != null){
+ ID_J2EE_HIERARCHY_VIEW = viewerID;
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
+ */
+ public void createInitialLayout(IPageLayout layout) {
+ defineLayout(layout);
+ defineActions(layout);
+ }
+
+
+
+ public void defineActions(IPageLayout layout) {
+ layout.addActionSet("org.eclipse.jst.j2ee.J2eeMainActionSet"); //$NON-NLS-1$
+ layout.addActionSet("org.eclipse.jdt.ui.JavaActionSet"); //$NON-NLS-1$
+
+ layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
+ layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
+
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
+
+ layout.addShowViewShortcut(ID_J2EE_HIERARCHY_VIEW);
+ layout.addShowViewShortcut(ID_SERVERS_VIEW);
+ layout.addShowViewShortcut(ID_DATA_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
+ layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+ layout.addShowViewShortcut(ID_WST_SNIPPETS_VIEW);
+ layout.addShowViewShortcut(ID_MARKERS_VIEW);
+ layout.addShowViewShortcut(ID_TASKLIST_VIEW);
+
+ // views - search
+ layout.addShowViewShortcut(ID_SEARCH_VIEW);
+ // views - debugging
+ layout.addShowViewShortcut(ID_CONSOLE_VIEW);
+
+ layout.addShowInPart(ID_J2EE_HIERARCHY_VIEW);
+ }
+
+ public void defineLayout(IPageLayout layout) {
+ // Editors are placed for free.
+ String editorArea = layout.getEditorArea();
+
+ // Top left.
+ IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f, editorArea);//$NON-NLS-1$
+ topLeft.addView(ID_J2EE_HIERARCHY_VIEW);
+ topLeft.addPlaceholder(IPageLayout.ID_RES_NAV);
+ topLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
+ topLeft.addPlaceholder(JavaUI.ID_PACKAGES_VIEW);
+
+ // Bottom right.
+ IFolderLayout bottomRight = layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.7f, editorArea);//$NON-NLS-1$
+ bottomRight.addView(ID_MARKERS_VIEW);
+ bottomRight.addView(IPageLayout.ID_PROP_SHEET);
+ bottomRight.addView(ID_SERVERS_VIEW);
+ addDBViewIfPresent(layout,bottomRight);
+ bottomRight.addView(ID_WST_SNIPPETS_VIEW);
+
+ bottomRight.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
+ bottomRight.addPlaceholder(IPageLayout.ID_TASK_LIST);
+ bottomRight.addPlaceholder(ID_CONSOLE_VIEW);
+ bottomRight.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ bottomRight.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+ bottomRight.addPlaceholder(ID_SEARCH_VIEW);
+
+ // Top right.
+ IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, 0.7f, editorArea);//$NON-NLS-1$
+ topRight.addView(IPageLayout.ID_OUTLINE);
+ addTLViewIfPresent(layout, topRight);
+
+ }
+ private void addDBViewIfPresent(IPageLayout page,IFolderLayout bottomRight) {
+ IViewDescriptor dbView = PlatformUI.getWorkbench().getViewRegistry().find(ID_DATA_VIEW);
+ if (dbView != null)
+ bottomRight.addView(ID_DATA_VIEW);
+ }
+ private void addTLViewIfPresent(IPageLayout page,IFolderLayout topRight) {
+ IViewDescriptor tlView = PlatformUI.getWorkbench().getViewRegistry().find(ID_TASKLIST_VIEW);
+ if (tlView != null)
+ topRight.addView(ID_TASKLIST_VIEW);
+ }
+}
+
+
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/BinaryEditorUtilities.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/BinaryEditorUtilities.java
new file mode 100644
index 0000000..cc9eca4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/BinaryEditorUtilities.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jdt.core.IJavaModelStatusConstants;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.jdt.internal.core.JavaModelStatus;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.jee.archive.internal.ArchiveUtil;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class BinaryEditorUtilities {
+
+ private static class JarEntryFile extends PlatformObject implements
+ IStorage {
+ private String entryName;
+ private String zipName;
+ private IPath path;
+
+ public JarEntryFile(String entryName, String zipName) {
+ this.entryName = entryName;
+ this.zipName = zipName;
+ this.path = new Path(this.entryName);
+ }
+
+ public InputStream getContents() throws CoreException {
+
+ try {
+ if (JavaModelManager.ZIP_ACCESS_VERBOSE) {
+ //$ANALYSIS-IGNORE
+ System.out.println("(" + Thread.currentThread() + ") [JarEntryFile.getContents()] Creating ZipFile on " + this.zipName); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ ZipFile zipFile = ArchiveUtil.newZipFile(this.zipName);
+ ZipEntry zipEntry = zipFile.getEntry(this.entryName);
+ if (zipEntry == null) {
+ throw new JavaModelException(new JavaModelStatus(
+ IJavaModelStatusConstants.INVALID_PATH,
+ this.entryName));
+ }
+ return zipFile.getInputStream(zipEntry);
+ } catch (IOException e) {
+ throw new JavaModelException(e,
+ IJavaModelStatusConstants.IO_EXCEPTION);
+ }
+ }
+
+ /**
+ * @see IStorage#getFullPath
+ */
+ public IPath getFullPath() {
+ return this.path;
+ }
+
+ /**
+ * @see IStorage#getName
+ */
+ public String getName() {
+ return this.path.lastSegment();
+ }
+
+ /**
+ * @see IStorage#isReadOnly()
+ */
+ public boolean isReadOnly() {
+ return true;
+ }
+
+ /**
+ * @see IStorage#isReadOnly()
+ */
+ @Override
+ public String toString() {
+ return "JarEntryFile[" + this.zipName + "::" + this.entryName + "]"; //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ }
+ }
+
+ private static class JarEntryEditorInput implements IStorageEditorInput {
+
+ private IStorage fJarEntryFile;
+
+ public JarEntryEditorInput(IStorage jarEntryFile) {
+ fJarEntryFile = jarEntryFile;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode() + fJarEntryFile.hashCode();
+ }
+
+ /*
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!(obj instanceof JarEntryEditorInput))
+ return false;
+ JarEntryEditorInput other = (JarEntryEditorInput) obj;
+ return fJarEntryFile.equals(other.fJarEntryFile);
+ }
+
+ /*
+ * @see IEditorInput#getPersistable()
+ */
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /*
+ * @see IEditorInput#getName()
+ */
+ public String getName() {
+ return fJarEntryFile.getName();
+ }
+
+ /*
+ * @see IEditorInput#getToolTipText()
+ */
+ public String getToolTipText() {
+ return fJarEntryFile.getFullPath().toString();
+ }
+
+ /*
+ * @see IEditorInput#getImageDescriptor()
+ */
+ public ImageDescriptor getImageDescriptor() {
+ IEditorRegistry registry = PlatformUI.getWorkbench()
+ .getEditorRegistry();
+ return registry.getImageDescriptor(fJarEntryFile.getFullPath()
+ .getFileExtension());
+ }
+
+ /*
+ * @see IEditorInput#exists()
+ */
+ public boolean exists() {
+ // JAR entries can't be deleted
+ return true;
+ }
+
+ /*
+ * @see IAdaptable#getAdapter(Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ /*
+ * see IStorageEditorInput#getStorage()
+ */
+ public IStorage getStorage() {
+ return fJarEntryFile;
+ }
+ }
+
+ /**
+ *
+ * @param component
+ * @param archiveRelativePath
+ * @return
+ * @deprecated
+ */
+ public static IEditorInput getBinaryEditorInput(
+ VirtualArchiveComponent component, String archiveRelativePath) {
+ return getBinaryEditorInput((IVirtualComponent)component, archiveRelativePath);
+ }
+
+ public static IEditorInput getBinaryEditorInput(IVirtualComponent component, String archiveRelativePath) {
+ File f = (File)component.getAdapter(File.class);
+ return getBinaryEditorInput(f.getAbsolutePath(), archiveRelativePath);
+ }
+
+
+ public static IEditorInput getBinaryEditorInput(IPath archivePath,
+ String archiveRelativePath) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IResource resource = root.findMember(archivePath);
+ if (resource == null) {
+ return null;
+ }
+ String archiveOSPath = resource.getLocation().toOSString();
+ IEditorInput editorInput = getBinaryEditorInput(archiveOSPath, archiveRelativePath);
+ return editorInput;
+ }
+
+ /**
+ * [Bug 238616]
+ *
+ * Gets binary editor input given an OS relative path to an archive and
+ * the archive relative path to a file
+ *
+ * @param archiveOSPath the OS relative path to the archive
+ * @param archiveRelativePath the archive relative path to the file to get binary editor input for
+ * @return
+ */
+ public static IEditorInput getBinaryEditorInput(String archiveOSPath,
+ String archiveRelativePath) {
+ JarEntryFile jarFile = new JarEntryFile(archiveRelativePath, archiveOSPath);
+ JarEntryEditorInput editorInput = new JarEntryEditorInput(jarFile);
+ return editorInput;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/CommonEditorUtility.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/CommonEditorUtility.java
new file mode 100644
index 0000000..0739393
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/CommonEditorUtility.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.plugin;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+
+/**
+ * @author cbridgha
+ *
+ */
+public class CommonEditorUtility {
+
+ public static final Class IRESOURCE_CLASS = IResource.class;
+
+ private CommonEditorUtility() {
+ super();
+ }
+
+ /**
+ * Returns an array of all editors that have an unsaved content. If the identical content is
+ * presented in more than one editor, only one of those editor parts is part of the result.
+ *
+ * @return an array of all dirty editor parts.
+ */
+ public static IEditorPart[] getDirtyEditors() {
+ return getDirtyEditors(null);
+ }
+
+ /**
+ * Returns an array of all editors that have an unsaved content, where the content is include in
+ * one of the projects in the List parameter. If the identical content is presented in more than
+ * one editor, only one of those editor parts is part of the result.
+ *
+ * @return an array of all dirty editor parts.
+ */
+ public static IEditorPart[] getDirtyEditors(List projects) {
+ Set inputs = new HashSet();
+ List result = new ArrayList(0);
+ IWorkbench workbench = J2EEUIPlugin.getPluginWorkbench();
+ IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+ for (int i = 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages = windows[i].getPages();
+ for (int x = 0; x < pages.length; x++) {
+ IEditorPart[] editors = pages[x].getDirtyEditors();
+ for (int z = 0; z < editors.length; z++) {
+ IEditorPart ep = editors[z];
+ IEditorInput input = ep.getEditorInput();
+ if (!inputs.contains(input) && (projects == null || inputInProjects(input, projects))) {
+ inputs.add(input);
+ result.add(ep);
+ }
+ }
+ }
+ }
+ return (IEditorPart[]) result.toArray(new IEditorPart[result.size()]);
+ }
+
+ public static boolean inputInProjects(IEditorInput input, List projects) {
+ IResource res = (IResource) input.getAdapter(IRESOURCE_CLASS);
+ IProject project = res == null ? null : res.getProject();
+ if (project == null)
+ return false;
+ for (int i = 0; i < projects.size(); i++) {
+ if (project.equals(projects.get(i)))
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean promptToSaveAllDirtyEditors() {
+ boolean retVal = true;
+ IWorkbench workbench = J2EEUIPlugin.getPluginWorkbench();
+ IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+ for (int i = 0; retVal && i < windows.length; i++) {
+ IWorkbenchPage[] pages = windows[i].getPages();
+ for (int x = 0; retVal && x < pages.length; x++) {
+ retVal = pages[x].saveAllEditors(true);
+ }
+ }
+ return retVal;
+ }
+
+ /**
+ *
+ * This method used to save only the editors specified. It now saves all dirty editors
+ * due to changes in the Eclipse platform
+ * @param dirtyEditors
+ * @return true if it succeeds, false if the user cancels
+ * @deprecated due to changes in the Eclipse platform
+ */
+ public static boolean promptToSaveDirtyEditors(List dirtyEditors) {
+ if (dirtyEditors.isEmpty())
+ return true;
+ return promptToSaveAllDirtyEditors();
+ }
+
+ /**
+ * This will close all editors without prompting for save.
+ * @param dirtyEditors
+ * @return true is succeeded, false if not
+ */
+ public static void closeAllEditors() {
+
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.closeAllEditors(false);
+
+ }
+
+ public static boolean promptToSaveDirtyEditorsInProjects(List projects) {
+ return promptToSaveDirtyEditors(Arrays.asList(getDirtyEditors(projects)));
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/ErrorDialog.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/ErrorDialog.java
new file mode 100644
index 0000000..e6a4c6c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/ErrorDialog.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.plugin;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Added a Details button to the MessageDialog to show the exception stack trace.
+ *
+ * Borrowed from an eclipse InternalErrorDialog
+ */
+public class ErrorDialog extends MessageDialog {
+ protected static final String[] LABELS_OK = {IDialogConstants.OK_LABEL};
+ protected static final String[] LABELS_OK_CANCEL = {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL};
+ protected static final String[] LABELS_OK_DETAILS = {IDialogConstants.OK_LABEL, IDialogConstants.SHOW_DETAILS_LABEL};
+ protected static final String[] LABELS_OK_CANCEL_DETAILS = {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL, IDialogConstants.SHOW_DETAILS_LABEL};
+ private Throwable detail;
+ private int detailButtonID = -1;
+ private Text text;
+ private String message;
+ //Workaround. SWT does not seem to set the default button if
+ //there is not control with focus. Bug: 14668
+ private int defaultButtonIndex = 0;
+ /**
+ * Size of the text in lines.
+ */
+ private static final int TEXT_LINE_COUNT = 15;
+
+ public ErrorDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, Throwable detail, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ defaultButtonIndex = defaultIndex;
+ this.detail = detail;
+ message = dialogMessage;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.RESIZE);
+ }
+
+ //Workaround. SWT does not seem to set rigth the default button if
+ //there is not control with focus. Bug: 14668
+ @Override
+ public int open() {
+ create();
+ Button b = getButton(defaultButtonIndex);
+ b.setFocus();
+ b.getShell().setDefaultButton(b);
+ return super.open();
+ }
+
+ /**
+ * Set the detail button;
+ */
+ public void setDetailButton(int index) {
+ detailButtonID = index;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == detailButtonID) {
+ toggleDetailsArea();
+ } else {
+ setReturnCode(buttonId);
+ close();
+ }
+ }
+
+ /**
+ * Toggles the unfolding of the details area. This is triggered by the user pressing the details
+ * button.
+ */
+ private void toggleDetailsArea() {
+ Point windowSize = getShell().getSize();
+ Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ if (text != null) {
+ text.dispose();
+ text = null;
+ getButton(detailButtonID).setText(IDialogConstants.SHOW_DETAILS_LABEL);
+ } else {
+ createDropDownText((Composite) getContents());
+ getButton(detailButtonID).setText(IDialogConstants.HIDE_DETAILS_LABEL);
+ }
+ Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
+ }
+
+ /**
+ * Create this dialog's drop-down list component.
+ *
+ * @param parent
+ * the parent composite
+ * @return the drop-down list component
+ */
+ protected void createDropDownText(Composite parent) {
+ // create the list
+ text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ // print the stacktrace in the text field
+ try {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ detail.printStackTrace(ps);
+ if ((detail instanceof SWTError) && (((SWTError) detail).throwable != null)) {
+ ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$
+ ((SWTError) detail).throwable.printStackTrace(ps);
+ } else if ((detail instanceof SWTException) && (((SWTException) detail).throwable != null)) {
+ ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$
+ ((SWTException) detail).throwable.printStackTrace(ps);
+ }
+ ps.flush();
+ baos.flush();
+ text.setText(baos.toString());
+ } catch (IOException e) {
+ //Ignore
+ }
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
+ data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT;
+ text.setLayoutData(data);
+ }
+
+ public static boolean openError(Shell parent, String title, String message, Throwable detail, int defaultIndex, boolean showCancel) {
+ String[] labels;
+ if (detail == null)
+ labels = showCancel ? LABELS_OK_CANCEL : LABELS_OK;
+ else
+ labels = showCancel ? LABELS_OK_CANCEL_DETAILS : LABELS_OK_DETAILS;
+ ErrorDialog dialog = new ErrorDialog(parent, title, null, // accept
+ // the
+ // default
+ // window
+ // icon
+ message, detail, ERROR, labels, defaultIndex);
+ if (detail != null)
+ dialog.setDetailButton(labels.length - 1);
+ return dialog.open() == 0;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setFont(parent.getFont());
+ ((GridLayout) composite.getLayout()).numColumns = 2;
+ // create image
+ Image image = composite.getDisplay().getSystemImage(SWT.ICON_ERROR);
+ if (image != null) {
+ Label label = new Label(composite, 0);
+ image.setBackground(label.getBackground());
+ label.setImage(image);
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
+ }
+ // create message
+ if (message != null) {
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(message);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ }
+ return composite;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectActionFilter.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectActionFilter.java
new file mode 100644
index 0000000..db953bd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectActionFilter.java
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.plugin;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class FacetedProjectActionFilter
+
+ implements IActionFilter
+
+{
+ public boolean testAttribute( final Object target,
+ final String name,
+ final String value )
+ {
+
+ if( name.equals( "facet" ) ) //$NON-NLS-1$
+ {
+ IProject project = (IProject)target;
+ IFacetedProject fproj = null;
+ if(project.isAccessible()){
+ try {
+ fproj = ProjectFacetsManager.create( project );
+ } catch (CoreException e1) {
+ Logger.getLogger().logError(e1);
+ }
+ }
+
+ if( fproj != null ){
+ final int colon = value.indexOf( ':' );
+ final String fid;
+ final String vexprstr;
+
+ if( colon == -1 || colon == value.length() - 1 )
+ {
+ fid = value;
+ vexprstr = null;
+ }
+ else
+ {
+ fid = value.substring( 0, colon );
+ vexprstr = value.substring( colon + 1 );
+ }
+
+ if( ! ProjectFacetsManager.isProjectFacetDefined( fid ) )
+ {
+ return false;
+ }
+
+ final IProjectFacet f = ProjectFacetsManager.getProjectFacet( fid );
+
+ if( ! fproj.hasProjectFacet( f ) )
+ {
+ return false;
+ }
+
+ if( vexprstr == null )
+ {
+ return true;
+ }
+ final IProjectFacetVersion fv = fproj.getInstalledVersion( f );
+
+ try
+ {
+ if( f.getVersions( vexprstr ).contains( fv ) )
+ {
+ return true;
+ }
+ }
+ catch( CoreException e )
+ {
+ //EJBUIPlugin.getDefault().log
+ }
+ return false;
+ }
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectAdapterFactory.java
new file mode 100644
index 0000000..6bab544
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/FacetedProjectAdapterFactory.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.jst.j2ee.internal.plugin;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.IActionFilter;
+
+public class FacetedProjectAdapterFactory implements IAdapterFactory {
+
+
+ private static final Class[] ADAPTER_TYPES = { IActionFilter.class };
+
+ public Object getAdapter( final Object adaptable,
+ final Class adapterType )
+ {
+ if( adapterType == IActionFilter.class )
+ {
+ return new FacetedProjectActionFilter();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList()
+ {
+ return ADAPTER_TYPES;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEEditorUtility.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEEditorUtility.java
new file mode 100644
index 0000000..6fce02a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEEditorUtility.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2002, 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.jst.j2ee.internal.plugin;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jem.internal.adapters.jdom.JavaClassJDOMAdaptor;
+import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jem.java.JavaPackage;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+
+/**
+ * A number of routines for working with JavaElements in editors
+ *
+ * Use 'isOpenInEditor' to test if an element is already open in a editor Use 'openInEditor' to
+ * force opening an element in a editor With 'getWorkingCopy' you get the working copy (element in
+ * the editor) of an element
+ */
+public class J2EEEditorUtility {
+ // //$NON-NLS-1$
+ public static final String EJB_JAVA_EDITOR_ID = "org.eclipse.jst.j2ee.internal.internal.ejb.ui.misc.EJBJavaEditor"; //$NON-NLS-1$
+
+ public static ICompilationUnit getCompilationUnit(JavaClass javaClass) {
+ IProject project = ProjectUtilities.getProject(javaClass);
+ if (project == null)
+ return null;
+ return getCompilationUnit(javaClass, project);
+ }
+
+ public static ICompilationUnit getCompilationUnit(JavaClass javaClass, IProject project) {
+ if (javaClass == null)
+ return null;
+ IJavaProject javaProj = getJavaProject(project);
+ if (javaProj == null)
+ return null;
+ return getCompilationUnit(javaClass, javaProj);
+ }
+
+ public static ICompilationUnit getCompilationUnit(JavaClass javaClass, IJavaProject javaProject) {
+ if (javaClass == null)
+ return null;
+ IType type = getType(javaClass);
+ if (type != null)
+ return type.getCompilationUnit();
+ return null;
+ }
+
+ public static IType getType(JavaClass javaClass) {
+ if (javaClass != null) {
+ JavaClassJDOMAdaptor adaptor = (JavaClassJDOMAdaptor) EcoreUtil.getRegisteredAdapter(javaClass, ReadAdaptor.TYPE_KEY);
+ if (adaptor != null)
+ return adaptor.getSourceType();
+ }
+ return null;
+ }
+
+ public static IEditorInput getEditorInput(Object input) {
+ if (input instanceof EObject)
+ return new FileEditorInput(WorkbenchResourceHelper.getFile((EObject) input));
+ if (input instanceof IFile)
+ return new FileEditorInput((IFile) input);
+ return null;
+ }
+
+ public static IFile getFile(JavaClass javaClass) {
+ ICompilationUnit comp = getCompilationUnit(javaClass);
+ if (comp == null)
+ return null;
+ IEditorInput input = null;
+ input = EditorUtility.getEditorInput(comp);
+ if (input != null) {
+ return (IFile) input.getAdapter(IFile.class);
+ }
+ return null;
+ }
+
+ public static IJavaProject getJavaProject(IProject aProject) {
+ if (aProject == null)
+ return null;
+ IJavaModel javaModel = JemProjectUtilities.getJavaModel();
+ return javaModel.getJavaProject(aProject.getName());
+ }
+
+ /**
+ * Return the IPackageFragment for the JavaPackage for
+ *
+ * @javaClass.
+ */
+ public static IPackageFragment getPackageFragment(JavaClass javaClass, IJavaProject javaProject) {
+ if (javaProject != null) {
+ try {
+ JavaPackage javaPackage = (JavaPackage) javaClass.eContainer();
+ String packageName = javaPackage.getName();
+ IPackageFragment[] pkgFrags = javaProject.getPackageFragments();
+ for (int i = 0; i < pkgFrags.length; i++) {
+ if ((pkgFrags[i].getElementName().equals(packageName)))
+ return pkgFrags[i];
+ }
+ } catch (JavaModelException e) {
+ //Ignore
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Opens a Java editor for the given element if the element is a Java compilation unit or a Java
+ * class file.
+ *
+ * @return the IEditorPart or null if wrong element type or opening failed
+ */
+ public static IEditorPart openInEditor(JavaClass javaClass, IProject aProject) throws JavaModelException, PartInitException {
+ return openInEditor(javaClass, getJavaProject(aProject));
+ }
+
+ /**
+ * Opens a Java editor for the given element if the element is a Java compilation unit or a Java
+ * class file.
+ *
+ * @return the IEditorPart or null if wrong element type or opening failed
+ */
+ public static IEditorPart openInEditor(JavaClass javaClass, IJavaProject javaProject) throws JavaModelException, PartInitException {
+ if (javaClass == null || javaProject == null)
+ return null;
+ IType type = getType(javaClass);
+ if (type == null)
+ return openInEditor(getCompilationUnit(javaClass, javaProject));
+ return EditorUtility.openInEditor(type);
+ }
+
+
+ /**
+ * Opens a Java editor for the given element if the element is a Java compilation unit or a Java
+ * class file.
+ *
+ * @return the IEditorPart or null if wrong element type or opening failed
+ */
+ public static IEditorPart openInEditor(JavaClass javaClass, IJavaProject javaProject, String editorId) throws JavaModelException, PartInitException {
+ return openInEditor(getCompilationUnit(javaClass, javaProject), editorId);
+ }
+
+ /**
+ * Opens a Java editor for the given element if the element is a Java compilation unit or a Java
+ * class file.
+ *
+ * @return the IEditorPart or null if wrong element type or opening failed
+ */
+ public static IEditorPart openInEditor(ICompilationUnit aCompilationUnit) throws JavaModelException, PartInitException {
+ return EditorUtility.openInEditor(aCompilationUnit);
+ }
+
+ /**
+ * Opens a Java editor for the given element if the element is a Java compilation unit or a Java
+ * class file.
+ *
+ * @return the IEditorPart or null if wrong element type or opening failed
+ */
+ public static IEditorPart openInEditor(ICompilationUnit aCompilationUnit, String editorId) throws JavaModelException, PartInitException {
+ return openInEditor(EditorUtility.getEditorInput(aCompilationUnit), editorId);
+ }
+
+ private static IEditorPart openInEditor(IEditorInput input, String editorID) throws PartInitException {
+ if (input != null) {
+ IWorkbenchPage p = J2EEUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ if (p != null)
+ return p.openEditor(input, editorID, true);
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIAdapterFactory.java
new file mode 100644
index 0000000..372f44c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIAdapterFactory.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jun 30, 2004
+ */
+package org.eclipse.jst.j2ee.internal.plugin;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.ILaunchable;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @author jlanuti
+ */
+public class J2EEUIAdapterFactory implements IAdapterFactory {
+
+ protected static final Class ILAUNCHABLE_CLASS = ILaunchable.class;
+
+ /**
+ * Default Constructor
+ */
+ public J2EEUIAdapterFactory() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof EObject) {
+ if (adapterType == ILAUNCHABLE_CLASS)
+ return adaptableObject;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{ILAUNCHABLE_CLASS};
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIContextIds.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIContextIds.java
new file mode 100644
index 0000000..7d8053c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIContextIds.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Feb 27, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.plugin;
+
+/**
+ * @author vijayb
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public interface J2EEUIContextIds {
+
+ // Delete Enterprise Bean Dialog
+ public static final String DELETE_ENTERPRISE_BEAN_DIALOG = J2EEUIPlugin.PLUGIN_ID + ".delb1000"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIMessages.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIMessages.java
new file mode 100644
index 0000000..ef040c8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIMessages.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Stefan Dimov, stefan.dimov@sap.com - bug 207826
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.plugin;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.wst.common.frameworks.internal.Messages;
+
+
+public class J2EEUIMessages extends Messages {
+
+ private static final J2EEUIMessages INSTANCE = new J2EEUIMessages();
+
+ public static final String PROJECT_LOC_LBL = "1"; //$NON-NLS-1$
+ public static final String TARGET_RUNTIME_LBL = "2"; //$NON-NLS-1$
+ public static final String J2EE_VERSION_LBL = "3"; //$NON-NLS-1$
+ public static final String IMAGE_LOAD_ERROR = "4"; //$NON-NLS-1$
+ public static final String APP_PROJECT_WIZ_TITLE = "5"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MAIN_PG_TITLE = "6"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MAIN_PG_DESC = "7"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MODULES_PG_TITLE = "8"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MODULES_PG_DESC = "9"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MODULES_PG_SELECT = "10"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MODULES_PG_DESELECT = "11"; //$NON-NLS-1$
+ public static final String APP_PROJECT_MODULES_PG_NEW = "12"; //$NON-NLS-1$
+ public static final String EAR_PROJECT_FOR_MODULE_CREATION = "13"; //$NON-NLS-1$
+ public static final String NEW_THREE_DOTS_E = "14"; //$NON-NLS-1$
+ public static final String NEW_THREE_DOTS_W = "14a"; //$NON-NLS-1$
+ public static final String LINK_MODULETO_EAR_PROJECT = "15"; //$NON-NLS-1$
+ public static final String NEW_MOD_SEL_PG_TITLE = "16"; //$NON-NLS-1$
+ public static final String NEW_MOD_SEL_PG_DESC = "17"; //$NON-NLS-1$
+ public static final String NEW_MOD_WIZ_TITLE = "18"; //$NON-NLS-1$
+ public static final String NEW_MOD_SEL_PG_DEF_BTN = "19"; //$NON-NLS-1$
+ public static final String APP_CLIENT_PROJ_LBL = "20"; //$NON-NLS-1$
+ public static final String EJB_PROJ_LBL = "21"; //$NON-NLS-1$
+ public static final String WEB_PROJ_LBL = "22"; //$NON-NLS-1$
+ public static final String JCA_PROJ_LBL = "23"; //$NON-NLS-1$
+
+ public static final String APP_CLIENT_PROJECT_WIZ_TITLE = "24"; //$NON-NLS-1$
+ public static final String APP_CLIENT_VERSION_LBL = "3"; //$NON-NLS-1$
+ public static final String APP_CLIENT_PROJECT_MAIN_PG_TITLE = "25"; //$NON-NLS-1$
+ public static final String APP_CLIENT_SETTINGS = "101"; //$NON-NLS-1$
+
+ public static final String APP_CLIENT_PROJECT_MAIN_PG_DESC = "26"; //$NON-NLS-1$
+ public static final String MODULES_DEPENDENCY_PAGE_TITLE = "27"; //$NON-NLS-1$
+
+ public static final String MODULES_DEPENDENCY_PAGE_DESC = "28"; //$NON-NLS-1$
+ public static final String MODULES_DEPENDENCY_PAGE_AVAILABLE_JARS = "29"; //$NON-NLS-1$
+ public static final String MODULES_DEPENDENCY_PAGE_CLASSPATH = "30"; //$NON-NLS-1$
+ public static final String MODULES_DEPENDENCY_PAGE_TABLE_MODULE = "31"; //$NON-NLS-1$
+ public static final String MODULES_DEPENDENCY_PAGE_TABLE_PROJECT = "32"; //$NON-NLS-1$
+ public static final String NEW_LBL = "33"; //$NON-NLS-1$
+ public static final String APP_CLIENT_IMPORT_MAIN_PG_DESC = "34"; //$NON-NLS-1$
+ public static final String APP_CLIENT_IMPORT_MAIN_PG_TITLE = "35"; //$NON-NLS-1$
+ public static final String APP_CLIENT_IMPORT_FILE_LABEL = "36"; //$NON-NLS-1$
+
+ public static final String APP_CLIENT_IMPORT_PROJECT_LABEL = "37"; //$NON-NLS-1$
+
+ public static final String IMPORT_WIZ_TITLE = "38"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_MAIN_PG_DESC = "39"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_MAIN_PG_TITLE = "40"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_FILE_LABEL = "41"; //$NON-NLS-1$
+ public static final String OVERWRITE_RESOURCES = "42"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_TYPE = "43"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_TYPE_BINARY = "44"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_TYPE_SOURCE = "45"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PARTIAL_DEVELOPMENT = "46"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON = "48"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_SELECT_ALL_UTIL_BUTTON = "47"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_JARS_GROUP = "49"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS = "50"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_PG_DESC = "51"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_PG_TITLE = "52"; //$NON-NLS-1$
+ public static final String PROJECT_LOCATIONS_GROUP = "53"; //$NON-NLS-1$
+ public static final String NEW_PROJECT_GROUP_DESCRIPTION = "54"; //$NON-NLS-1$
+ public static final String USE_DEFAULT_ROOT_RADIO = "55"; //$NON-NLS-1$
+ public static final String USE_ALTERNATE_ROOT_RADIO = "56"; //$NON-NLS-1$
+ public static final String SELECT_DIRECTORY_DLG = "57"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_Modules_in_EAR = "58"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_New_Project_Name = "59"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_FILENAMES = "60"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECTNAMES = "61"; //$NON-NLS-1$
+ public static final String J2EE_EXPORT_DESTINATION = "62"; //$NON-NLS-1$
+ public static final String J2EE_EXPORT_OVERWRITE_CHECKBOX = "63"; //$NON-NLS-1$
+ public static final String J2EE_EXPORT_SOURCE_CHECKBOX = "64"; //$NON-NLS-1$
+ public static final String APP_CLIENT_EXPORT_MAIN_PG_TITLE = "65"; //$NON-NLS-1$
+ public static final String APP_CLIENT_EXPORT_MAIN_PG_DESC = "66"; //$NON-NLS-1$
+ public static final String EXPORT_WIZ_TITLE = "67"; //$NON-NLS-1$
+ public static final String EAR_EXPORT_MAIN_PG_TITLE = "68"; //$NON-NLS-1$
+ public static final String EAR_EXPORT_MAIN_PG_DESC = "69"; //$NON-NLS-1$
+ public static final String EAR_EXPORT_INCLUDE_PROJECT_FILES = "70"; //$NON-NLS-1$
+ public static final String EAR_EXPORT_INCLUDE_PROJECT_FILES_DESC = "71"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_INCLUDE_PROJECT = "72"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_OVERWRITE_NESTED = "74"; //$NON-NLS-1$
+ public static final String DELETE_PROJECT = "75"; //$NON-NLS-1$
+ public static final String EAR_IMPORT_PROJECT_LABEL = "76"; //$NON-NLS-1$
+
+ //string for migration
+ public static final String ERROR_OCCURRED_TITLE = "77"; //$NON-NLS-1$
+ public static final String ERROR_OCCURRED_MESSAGE = "78"; //$NON-NLS-1$
+ public static final String BINARY_PROJECT = "79"; //$NON-NLS-1$
+ public static final String ACTION_CANNOT_BE_PERFORMED_ON_BIN_PROJECT = "80"; //$NON-NLS-1$
+ public static final String INFORMATION_UI_ = "81"; //$NON-NLS-1$
+ public static final String CHOSEN_OP_NOT_AVAILABLE = "82"; //$NON-NLS-1$
+
+ public static final String CREATE_EJB_CLIENT_JAR = "90"; //$NON-NLS-1$
+ public static final String USE_ANNOTATIONS = "91"; //$NON-NLS-1$
+ public static final String USE_ANNOTATIONS_SERVLET = "98"; //$NON-NLS-1$
+ public static final String ADD_ANNOTATIONS_SUPPORT = "92"; //$NON-NLS-1$
+ public static final String BROWSE_LABEL = "93"; //$NON-NLS-1$
+ public static final String NAME_LABEL = "94"; //$NON-NLS-1$
+
+ public static final String APP_CLIENT_CREATE_MAIN = "95"; //$NON-NLS-1$
+ public static final String CREATE_DEFAULT_SESSION_BEAN = "96"; //$NON-NLS-1$
+
+ public static final String MODULE_NAME = "99"; //$NON-NLS-1$
+ public static final String MODULE_VERSION_LABEL = "100"; //$NON-NLS-1$
+
+ public static final String J2EE_UTILITY_JAR_LISTEAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS = "97"; //$NON-NLS-1$
+
+ public static final String J2EE_EXPORT_RUNTIME = "103"; //$NON-NLS-1$
+
+ public static final String FLEXIBLE_PROJECT_WIZ_TITLE = "FlexibleProjectCreationWizard.title"; //$NON-NLS-1$
+ public static final String FLEXIBLE_PROJECT_MAIN_PG_TITLE = "FlexibleProjectCreationWizard.mainPage.title"; //$NON-NLS-1$
+ public static final String FLEXIBLE_PROJECT_MAIN_PG_DESC = "FlexibleProjectCreationWizard.mainPage.desc"; //$NON-NLS-1$
+ public static final String EAR_COMPONENT_WIZ_TITLE = "EARComponentCreationWizard.title"; //$NON-NLS-1$
+ public static final String EAR_COMPONENT_MAIN_PG_TITLE = "EARComponentCreationWizard.mainPage.title"; //$NON-NLS-1$
+ public static final String EAR_COMPONENT_MAIN_PG_DESC = "EARComponentCreationWizard.mainPage.desc"; //$NON-NLS-1$
+ public static final String EAR_COMPONENT_SECOND_PG_TITLE = "EARComponentCreationWizard.secondPage.title"; //$NON-NLS-1$
+ public static final String EAR_COMPONENT_SECOND_PG_DESC = "EARComponentCreationWizard.secondPage.desc"; //$NON-NLS-1$
+ public static final String J2EE_MODULE_DEPENDENCIES_LABEL = "J2EEModuleDependencies.label"; //$NON-NLS-1$
+ public static final String J2EE_MODULE_DEPENDENCIES_LABEL_ACCESSIBILITY = "J2EEModuleDependencies.label_accessibility"; //$NON-NLS-1$
+ public static final String APPCLIENT_COMPONENT_WIZ_TITLE = "AppClientComponentCreationWizard.title"; //$NON-NLS-1$
+ public static final String APPCLIENT_COMPONENT_MAIN_PG_TITLE = "AppClientComponentCreationWizard.mainPage.title"; //$NON-NLS-1$
+ public static final String APPCLIENT_COMPONENT_MAIN_PG_DESC = "AppClientComponentCreationWizard.mainPage.desc"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_WIZ_TITLE = "DefaultJ2EEComponentCreationWizard.title"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_TITLE = "DefaultJ2EEComponentCreationWizard.page.title"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_DESC = "DefaultJ2EEComponentCreationWizard.page.desc"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_EJB_MODULE_LBL = "DefaultJ2EEComponentCreationWizard.page.label.ejb"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_WEB_MODULE_LBL = "DefaultJ2EEComponentCreationWizard.page.label.web"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_JCA_MODULE_LBL = "DefaultJ2EEComponentCreationWizard.page.label.jca"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_APPCLIENT_MODULE_LBL = "DefaultJ2EEComponentCreationWizard.page.label.appclient"; //$NON-NLS-1$
+ public static final String DEFAULT_COMPONENT_PAGE_NEW_MOD_SEL_PG_DEF_BTN = "DefaultJ2EEComponentCreationWizard.page.button.select"; //$NON-NLS-1$
+
+ public final static String EMPTY_STRING = ""; //$NON-NLS-1$
+ public final static String FOLDER_LABEL = getResourceString("FOLDER_LABEL"); //$NON-NLS-1$
+ public final static String BROWSE_BUTTON_LABEL = getResourceString("BROWSE_BUTTON_LABEL"); //$NON-NLS-1$
+ public final static String BROWSE_BUTTON_LABEL_O = getResourceString("BROWSE_BUTTON_LABEL_O"); //$NON-NLS-1$
+ public final static String BROWSE_BUTTON_LABEL_W = getResourceString("BROWSE_BUTTON_LABEL_W"); //$NON-NLS-1$
+ public final static String BROWSE_BUTTON_LABEL_E = getResourceString("BROWSE_BUTTON_LABEL_E"); //$NON-NLS-1$
+ public final static String JAVA_PACKAGE_LABEL = getResourceString("JAVA_PACKAGE_LABEL"); //$NON-NLS-1$
+ public final static String CLASS_NAME_LABEL = getResourceString("CLASS_NAME_LABEL"); //$NON-NLS-1$
+ public final static String SUPERCLASS_LABEL = getResourceString("SUPERCLASS_LABEL"); //$NON-NLS-1$
+ public final static String CONTAINER_SELECTION_DIALOG_TITLE = getResourceString("CONTAINER_SELECTION_DIALOG_TITLE"); //$NON-NLS-1$
+ public final static String CONTAINER_SELECTION_DIALOG_DESC = getResourceString("CONTAINER_SELECTION_DIALOG_DESC"); //$NON-NLS-1$
+ public final static String CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG = getResourceString("CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG"); //$NON-NLS-1$
+ public final static String PACKAGE_SELECTION_DIALOG_TITLE = getResourceString("PACKAGE_SELECTION_DIALOG_TITLE"); //$NON-NLS-1$
+ public final static String PACKAGE_SELECTION_DIALOG_DESC = getResourceString("PACKAGE_SELECTION_DIALOG_DESC"); //$NON-NLS-1$
+ public final static String PACKAGE_SELECTION_DIALOG_MSG_NONE = getResourceString("PACKAGE_SELECTION_DIALOG_MSG_NONE"); //$NON-NLS-1$
+ public final static String SUPERCLASS_SELECTION_DIALOG_TITLE = getResourceString("SUPERCLASS_SELECTION_DIALOG_TITLE"); //$NON-NLS-1$
+ public final static String SUPERCLASS_SELECTION_DIALOG_DESC = getResourceString("SUPERCLASS_SELECTION_DIALOG_DESC"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_MODIFIERS_LABEL = getResourceString("JAVA_CLASS_MODIFIERS_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_INTERFACES_LABEL = getResourceString("JAVA_CLASS_INTERFACES_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_METHOD_STUBS_LABEL = getResourceString("JAVA_CLASS_METHOD_STUBS_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_PUBLIC_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_PUBLIC_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_FINAL_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_FINAL_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_MAIN_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_MAIN_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String JAVA_CLASS_INHERIT_CHECKBOX_LABEL = getResourceString("JAVA_CLASS_INHERIT_CHECKBOX_LABEL"); //$NON-NLS-1$
+ public final static String ADD_BUTTON_LABEL = getResourceString("ADD_BUTTON_LABEL"); //$NON-NLS-1$
+ public static final String REMOVE_BUTTON = getResourceString("REMOVE_BUTTON"); //$NON-NLS-1$
+ public static final String YES_BUTTON = getResourceString("YES_BUTTON"); //$NON-NLS-1$
+ public static final String NO_BUTTON = getResourceString("NO_BUTTON"); //$NON-NLS-1$
+ public static final String OK_BUTTON = getResourceString("OK_BUTTON"); //$NON-NLS-1$
+ public static final String CANCEL_BUTTON = getResourceString("CANCEL_BUTTON"); //$NON-NLS-1$
+ public static final String BINARY = getResourceString("BINARY"); //$NON-NLS-1$
+ public final static String INTERFACE_SELECTION_DIALOG_TITLE = getResourceString("INTERFACE_SELECTION_DIALOG_TITLE"); //$NON-NLS-1$
+
+ public static final String JAVAUTIL_COMPONENT_WIZ_TITLE="JAVAUTIL_COMPONENT_WIZ_TITLE"; //$NON-NLS-1$
+ public static final String JAVAUTILITY_MAIN_PG_TITLE = "JAVAUTILITY_MAIN_PG_TITLE";//$NON-NLS-1$
+ public final static String JAVAUTILITY_MAIN_PG_DESC = "JAVAUTILITY_MAIN_PG_DESC";//$NON-NLS-1$
+ public static final String AVAILABLE_J2EE_COMPONENTS="AVAILABLE_J2EE_COMPONENTS"; //$NON-NLS-1$
+ public static final String EXTERNAL_JAR="EXTERNAL_JAR";//$NON-NLS-1$
+ public static final String PROJECT_JAR="PROJECT_JAR";//$NON-NLS-1$
+ public static final String ADDVARIABLE="ADDVARIABLE";//$NON-NLS-1$
+ public static final String CHANGE_LIB_DIR ="CHANGE_LIB_DIR";//$NON-NLS-1$
+ public static final String NO_DD_MSG_TITLE = "NO_DD_MSG_TITLE";//$NON-NLS-1$
+ public static final String GEN_DD_QUESTION = "GEN_DD_QUESTION";//$NON-NLS-1$
+
+ public static final String CHANGE_LIB_DIR_HEAD = "CHANGE_LIB_DIR_HEAD";//$NON-NLS-1$
+ public static final String NEW_LIB_DIR_PROPMPT = "NEW_LIB_DIR_PROPMPT";//$NON-NLS-1$
+ public static final String BLANK_LIB_DIR = "BLANK_LIB_DIR";//$NON-NLS-1$
+ public static final String BLANK_LIB_DIR_CONFIRM = "BLANK_LIB_DIR_CONFIRM";//$NON-NLS-1$
+ public static final String BLANK_LIB_DIR_WARN_QUESTION = "BLANK_LIB_DIR_WARN_QUESTION";//$NON-NLS-1$
+ public static final String INVALID_PATH = "INVALID_PATH";//$NON-NLS-1$
+ public static final String INVALID_PATH_MSG = "INVALID_PATH_MSG";//$NON-NLS-1$
+ public static final String DEPENDENCY_CONFLICT_TITLE = "DEPENDENCY_CONFLICT_TITLE";//$NON-NLS-1$
+ public static final String DEPENDENCY_CONFLICT_MSG_1 = "DEPENDENCY_CONFLICT_MSG_1";//$NON-NLS-1$
+ public static final String DEPENDENCY_CONFLICT_MSG_2 = "DEPENDENCY_CONFLICT_MSG_2";//$NON-NLS-1$
+ public static final String DO_NOT_SHOW_WARNING_AGAIN = "DO_NOT_SHOW_WARNING_AGAIN";//$NON-NLS-1$
+
+ public static final String SUPPORTMULTIPLEMODULES="SUPPORTMULTIPLEMODULES";//$NON-NLS-1$
+ public static final String SOURCEFOLDER="SOURCEFOLDER";//$NON-NLS-1$
+ public static final String CONTENT_FOLDER = "102"; //$NON-NLS-1$
+
+ public static final String HOVER_HELP_FOR_DISABLED_LIBS = "HOVER_HELP_FOR_DISABLED_LIBS"; //$NON-NLS-1$
+ public static final String JAVA_EE_PREFERENCE_PAGE_NAME = "JAVA_EE_PREFERENCE_PAGE_NAME"; //$NON-NLS-1$
+ public static final String JAVA_EE_PREFERENCE_PAGE_JET_TEMPLATE = "JAVA_EE_PREFERENCE_PAGE_JET_TEMPLATE"; //$NON-NLS-1$
+ public static final String JAVA_EE_PREFERENCE_PAGE_DYN_TRANSLATION_BTN_NAME = "JAVA_EE_PREFERENCE_PAGE_DYN_TRANSLATION_BTN_NAME"; //$NON-NLS-1$
+ public static final String OPEN_J2EE_RESOURCE_ACTION_0 = "OpenJ2EEResourceAction.0"; //$NON-NLS-1$
+ /**
+ * Returns the string from the resource bundle, or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ return INSTANCE.doGetResourceString(key);
+ }
+
+ public static String getResourceString(String key, Object[] args) {
+ return INSTANCE.doGetResourceString(key, args);
+ }
+
+ private J2EEUIMessages() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.Messages#initializeBundle()
+ */
+ @Override
+ protected void initializeBundle() {
+ try {
+ resourceBundle = ResourceBundle.getBundle("j2ee_ui"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ //Ignore
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPlugin.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPlugin.java
new file mode 100644
index 0000000..b67dbf4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPlugin.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.plugin;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.internal.boot.PlatformURLConnection;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import java.lang.Throwable;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class J2EEUIPlugin extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.jst.j2ee.ui"; //$NON-NLS-1$
+
+ //The shared instance.
+ private static J2EEUIPlugin plugin;
+ private static IPath location;
+
+ /**
+ * The constructor.
+ */
+ public J2EEUIPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static J2EEUIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public static IPath getInstallLocation() {
+ if (location == null) {
+ URL url = getInstallURL();
+ try {
+ String installLocation = ((PlatformURLConnection) url.openConnection()).getURLAsLocal().getFile();
+ location = new Path(installLocation);
+ }catch (IOException e) {
+ logWarning(J2EEPluginResourceHandler.getString("Install_Location_Error_", new Object[]{url}) + e); //$NON-NLS-1$
+ }
+ }
+ return location;
+ }
+
+ public static URL getInstallURL() {
+ return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get a .gif from the image registry.
+ */
+ public Image getImage(String key) {
+ ImageRegistry imageRegistry = getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null || image.isDisposed()) {
+ ImageDescriptor descriptor = getImageDescriptor(key);
+ if (descriptor != null) {
+ image = descriptor.createImage();
+ imageRegistry.put(key, image);
+ }
+ }
+ return image;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public ImageDescriptor getImageDescriptor(String key) {
+ ImageDescriptor imageDescriptor = null;
+ URL gifImageURL = getImageURL(key);
+ if (gifImageURL != null)
+ imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
+ return imageDescriptor;
+ }
+
+ /**
+ * @param key
+ * @return
+ */
+ private URL getImageURL(String key) {
+ return J2EEPlugin.getImageURL(key, getBundle());
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getPluginWorkbench().getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Return the workbench
+ *
+ * This method is internal to the j2ee plugin and must not be called by any other plugins.
+ */
+
+ public static IWorkbench getPluginWorkbench() {
+ return getDefault().getWorkbench();
+ }
+
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ public static IStructuredSelection getCurrentSelection() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+
+ }
+ return null;
+ }
+
+
+ /**
+ * Record an error against this plugin's log.
+ *
+ * @param aCode
+ * @param aMessage
+ * @param anException
+ */
+ public static void logError(int aCode, String aMessage,
+ Throwable anException) {
+ getDefault().getLog().log(
+ createErrorStatus(aCode, aMessage, anException));
+ }
+
+ /**
+ *
+ * Record a message against this plugin's log.
+ *
+ * @param severity
+ * @param aCode
+ * @param aMessage
+ * @param exception
+ */
+ public static void log(int severity, int aCode, String aMessage,
+ Throwable exception) {
+ log(createStatus(severity, aCode, aMessage, exception));
+ }
+
+ /**
+ *
+ * Record a status against this plugin's log.
+ *
+ * @param aStatus
+ */
+ public static void log(IStatus aStatus) {
+ getDefault().getLog().log(aStatus);
+ }
+
+ /**
+ * Create a status associated with this plugin.
+ *
+ * @param severity
+ * @param aCode
+ * @param aMessage
+ * @param exception
+ * @return A status configured with this plugin's id and the given parameters.
+ */
+ public static IStatus createStatus(int severity, int aCode,
+ String aMessage, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, aCode,
+ aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param aCode
+ * @param aMessage
+ * @param exception
+ * @return A status configured with this plugin's id and the given parameters.
+ */
+ public static IStatus createErrorStatus(int aCode, String aMessage,
+ Throwable exception) {
+ return createStatus(IStatus.ERROR, aCode, aMessage, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, message, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message) {
+ return createStatus(severity, message, null);
+ }
+
+ public static void logError(Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
+ }
+
+ public static void logError(CoreException exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
+ }
+
+ public static void logError(String message, Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message, exception));
+ }
+
+ public static void logError(String message, CoreException exception) {
+ MultiStatus status = new MultiStatus(PLUGIN_ID,IStatus.ERROR,new IStatus[]{exception.getStatus()},message,exception);
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( status );
+ }
+
+ public static void logWarning(String message) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log(createStatus(IStatus.WARNING, message));
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPluginIcons.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPluginIcons.java
new file mode 100644
index 0000000..6740842
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEUIPluginIcons.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Nov 10, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.plugin;
+
+/**
+ * @author jsholl
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class J2EEUIPluginIcons {
+
+ public static String EAR_IMPORT_WIZARD_BANNER = "import_ear_wiz"; //$NON-NLS-1$
+ public static final String JCA_IMPORT_WIZARD_BANNER = "import_rar_wiz"; //$NON-NLS-1$
+ public static final String EJB_IMPORT_WIZARD_BANNER = "import_ejbjar_wiz"; //$NON-NLS-1$
+ public static final String APP_CLIENT_IMPORT_WIZARD_BANNER = "import_appclient_wiz"; //$NON-NLS-1$
+ public static final String WEB_IMPORT_WIZARD_BANNER = "import_war_wiz"; //$NON-NLS-1$
+ public static final String EAR_WIZ_BANNER = "ear_wiz"; //$NON-NLS-1$
+ public static final String APP_CLIENT_PROJECT_WIZARD_BANNER = "appclient_wiz"; //$NON-NLS-1$
+ //EJB Icons
+ public static final String EJB_PROJECT_WIZARD_BANNER = "ejbproject_wiz"; //$NON-NLS-1$
+ //WEB Icons
+ public static final String WEB_PROJECT_WIZARD_BANNER = "war_wiz"; //$NON-NLS-1$
+ //JCA Icons
+ public static final String JCA_PROJECT_WIZARD_BANNER = "connector_wiz"; //$NON-NLS-1$
+ public static final String APP_CLIENT_EXPORT_WIZARD_BANNER = "export_appclient_wiz"; //$NON-NLS-1$
+ public static final String EJB_EXPORT_WIZARD_BANNER = "export_ejbjar_obj"; //$NON-NLS-1$;
+ public static final String WEB_EXPORT_WIZARD_BANNER = "export_war_wiz"; //$NON-NLS-1$;
+ public static final String JCA_EXPORT_WIZARD_BANNER = "export_rar_wiz"; //$NON-NLS-1$;
+ public static final String EAR_EXPORT_WIZARD_BANNER = "export_ear_wiz"; //$NON-NLS-1$;
+
+ //Migration Wizard Icons
+
+ public static final String WARNING_TASK = "showwarn_tsk"; //$NON-NLS-1$
+
+ public static final String CLIENT_BANNER = "ejbclientjar_wizban"; //$NON-NLS-1$
+
+ public static final String MIGRATION_WIZARD_BANNER = "versionmigrate3_wiz"; //$NON-NLS-1$
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEViewerSorter.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEViewerSorter.java
new file mode 100644
index 0000000..6c8095b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/J2EEViewerSorter.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.plugin;
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jst.j2ee.common.internal.util.CommonUtil;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+
+public class J2EEViewerSorter extends ViewerSorter {
+
+ /**
+ * Constructor for J2EEViewerSorter.
+ */
+ public J2EEViewerSorter() {
+ super();
+ }
+
+
+
+ /**
+ * @see ViewerSorter#compare(Viewer, Object, Object)
+ */
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (shouldSort(e1, e2))
+ return super.compare(viewer, e1, e2);
+ return 0;
+ }
+
+ protected boolean isEnterpriseBean(Object o) {
+ return o instanceof EnterpriseBean;
+ }
+
+ protected boolean isDeploymentDescriptorRoot(Object o) {
+ return CommonUtil.isDeploymentDescriptorRoot(o);
+ }
+
+ protected boolean shouldSort(Object e1, Object e2) {
+ return (isDeploymentDescriptorRoot(e1) && isDeploymentDescriptorRoot(e2)) || (isEnterpriseBean(e1) && isEnterpriseBean(e2)) || ((e1 instanceof IFile) && (e2 instanceof IFile));
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/UIProjectUtilities.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/UIProjectUtilities.java
new file mode 100644
index 0000000..deb4f97
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/plugin/UIProjectUtilities.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Feb 2, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.plugin;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.ItemProvider;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Utility class for retrieving the project from the specified selection
+ */
+public class UIProjectUtilities {
+
+ /**
+ * @param selection
+ * The current selection
+ * @return The first project (regardless of nature) in the selection
+ */
+ public static IProject getSelectedProject(IStructuredSelection selection) {
+ return getSelectedProject(selection, (String[]) null);
+ }
+
+ /**
+ * @param selection
+ * The current selection
+ * @param expectedNatureId
+ * The required Nature ID
+ * @return The first project, only if the first project has the given nature
+ */
+ public static IProject getSelectedProject(IStructuredSelection selection, String expectedNatureId) {
+ return getSelectedProject(selection, new String[] {expectedNatureId});
+ }
+
+ /**
+ *
+ * @param selection
+ * The current selection
+ * @param possibleNatureIds
+ * A list of possible nature ids
+ * @return The first project selected, only if it has AT LEAST ONE of the possible nature ids
+ */
+ public static IProject getSelectedProject(IStructuredSelection selection, String[] possibleNatureIds) {
+ IProject[] projects = getAllSelectedProjects(selection, possibleNatureIds);
+ if (projects == null || projects.length==0)
+ return null;
+ return projects[0];
+ }
+
+ /**
+ *
+ * @param selection
+ * The current selection
+ * @return All selected Projects, regardless of nature
+ */
+ public static IProject[] getAllSelectedProjects(IStructuredSelection selection) {
+ return getAllSelectedProjects(selection, (String[]) null);
+ }
+
+ /**
+ *
+ * @param selection
+ * The current selection
+ * @param expectedNatureId
+ * The expected nature id
+ * @return All selected Projects which have the expected nature id
+ */
+ public static IProject[] getAllSelectedProjects(IStructuredSelection selection, String expectedNatureId) {
+ return getAllSelectedProjects(selection, new String[] {expectedNatureId});
+ }
+
+ /**
+ *
+ * @param selection
+ * The current selection
+ * @param possibleNatureIds
+ * a list of possible nature ids
+ * @return All selected Projects which have AT LEAST ONE of the given nature ids
+ */
+ public static IProject[] getAllSelectedProjects(IStructuredSelection selection, String[] possibleNatureIds) {
+ if (selection != null && !selection.isEmpty()) {
+ Object obj = null;
+ List projects = new ArrayList();
+ Iterator selectionIterator = selection.iterator();
+ while (selectionIterator.hasNext()) {
+ obj = selectionIterator.next();
+ IProject project = null;
+ if (obj instanceof IProject)
+ project = (IProject) obj;
+ else if (obj instanceof IAdaptable) {
+ project = (IProject) ((IAdaptable) obj).getAdapter(IProject.class);
+ if (project == null) {
+ //Check for IJavaElements.
+ IJavaElement javaElement = (IJavaElement) ((IAdaptable) obj).getAdapter(IJavaElement.class);
+ if (javaElement != null) {
+ project = javaElement.getJavaProject().getProject();
+ }
+ }
+ }
+ // Selection may not be adaptable to a project so continue trying to get selected project
+ if (project == null && obj instanceof EObject)
+ project = ProjectUtilities.getProject((EObject) obj);
+ else if (project == null && obj instanceof ItemProvider) {
+ Object temp = ((ItemProvider) obj).getParent(EObject.class);
+ if (temp != null && temp instanceof EObject)
+ project = ProjectUtilities.getProject((EObject) temp);
+ }
+ else if (project == null && obj instanceof IFile)
+ project = ProjectUtilities.getProject(obj);
+
+ if (project != null && possibleNatureIds != null && possibleNatureIds.length > 0) {
+ try {
+ for (int i = 0; i < possibleNatureIds.length; i++)
+ if (project.hasNature(possibleNatureIds[i]))
+ projects.add(project);
+ } catch (CoreException e) {
+ //Ignore
+ }
+ }
+
+ else
+ projects.add(project);
+ }
+ IProject[] finalProjects = new IProject[projects.size()];
+ projects.toArray(finalProjects);
+ return finalProjects;
+ }
+ return new IProject[0];
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryContentProvider.java
new file mode 100644
index 0000000..609bee6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryContentProvider.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.provider;
+
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.ejb.provider.GroupedEJBJarItemProvider;
+
+
+public class J2EEAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ protected MethodsProviderDelegate methodsProviderDelegate;
+ protected static final Class ITreeItemContentProviderClass = ITreeItemContentProvider.class;
+ protected List roots = new ArrayList();
+
+ /**
+ * J2EEAdapterFactoryContentProvider constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ */
+ public J2EEAdapterFactoryContentProvider(org.eclipse.emf.common.notify.AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ methodsProviderDelegate = new MethodsProviderDelegate(adapterFactory);
+ }
+
+ @Override
+ public Object getParent(Object object) {
+
+ if (MethodsProviderDelegate.providesContentFor(object))
+ return methodsProviderDelegate.getParent(object);
+
+ //Added so internalExpand() in AbstractTreeViewer knows that EJB's parent is now instance
+ // of J2EEItemProvider
+ //rather than EJBJar only if bean is root bean
+ if (object instanceof EnterpriseBean && GroupedEJBJarItemProvider.isRootBean((EnterpriseBean) object)) {
+ J2EEItemProvider provider = GroupedEJBJarItemProvider.getEJBItemProvider((EnterpriseBean) object);
+ if (provider != null) {
+ return provider;
+ }
+ }
+
+ Object parent = super.getParent(object);
+
+ // if (parent == null) {
+ // if (object instanceof EObject)
+ // return J2EERoot.instance().groupFor((EObject) object);
+ // }
+ return parent;
+ }
+
+ protected boolean isEMFEditObject(Object object) {
+ ITreeItemContentProvider treeItemContentProvider = (ITreeItemContentProvider) adapterFactory.adapt(object, ITreeItemContentProviderClass);
+ return treeItemContentProvider != null;
+ }
+
+ /*
+ * @see ITreeContentProvider#getChildren(Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+
+ if (MethodsProviderDelegate.providesContentFor(parentElement))
+ return methodsProviderDelegate.getChildren(parentElement);
+ else if (isEMFEditObject(parentElement))
+ return super.getChildren(parentElement);
+ else
+ return null;
+ }
+
+ /*
+ * @see IStructuredContentProvider#getElements(Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getRoots(inputElement);
+ // else if (MethodsProviderDelegate.providesContentFor(inputElement))
+ // return methodsProviderDelegate.getChildren(inputElement);
+ // return super.getElements(inputElement);
+ }
+
+ public Object[] getRoots(Object parent) {
+ if (roots.isEmpty()) {
+ Object[] j2eeGroups = super.getChildren(parent);
+ roots.addAll(Arrays.asList(j2eeGroups));
+ }
+ return roots.toArray();
+ }
+
+ /*
+ * @see ITreeContentProvider#hasChildren(Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (MethodsProviderDelegate.providesContentFor(element))
+ return methodsProviderDelegate.hasChildren(element);
+ else if (isEMFEditObject(element))
+ return super.hasChildren(element);
+ else
+ return false;
+ }
+
+ /**
+ * @see IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (methodsProviderDelegate != null)
+ methodsProviderDelegate.dispose();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+ */
+ @Override
+ public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
+ super.inputChanged(aViewer, oldInput, newInput);
+ methodsProviderDelegate.inputChanged(aViewer, oldInput, newInput);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryLabelProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryLabelProvider.java
new file mode 100644
index 0000000..e50d06f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEAdapterFactoryLabelProvider.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.provider;
+
+
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.common.CommonPackage;
+import org.eclipse.jst.j2ee.common.internal.util.CommonUtil;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+import org.eclipse.jst.j2ee.internal.ejb.provider.AbstractMethodsContentProvider;
+import org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * Insert the type's description here. Creation date: (6/20/2001 10:40:41 PM)
+ *
+ * @author: Administrator
+ */
+public class J2EEAdapterFactoryLabelProvider extends AdapterFactoryLabelProvider {
+ // //$NON-NLS-1$
+ protected static final Class IItemLabelProviderClass = IItemLabelProvider.class;
+ private static final EStructuralFeature ROLE_NAME_SF = CommonPackage.eINSTANCE.getSecurityRole_RoleName();
+ private static final EStructuralFeature ROLES_SF = EjbFactoryImpl.getPackage().getMethodPermission_Roles();
+
+
+ /**
+ * This is used for delegation to get labels for server objects, which don't fit into EMF edit
+ */
+ protected WorkbenchLabelProvider wbLabelProvider;
+
+ public J2EEAdapterFactoryLabelProvider(org.eclipse.emf.common.notify.AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ wbLabelProvider = new WorkbenchLabelProvider();
+ }
+
+ @Override
+ public Image getImage(Object object) {
+ if (object instanceof J2EEJavaClassProviderHelper)
+ return ((J2EEJavaClassProviderHelper) object).getImage();
+ else if (isEMFEditObject(object))
+ return super.getImage(object);
+ else if (object instanceof AbstractMethodsContentProvider.EJBMethodItem)
+ return super.getImage(((AbstractMethodsContentProvider.EJBMethodItem) object).ejb);
+ else if (object instanceof File) {
+ URL url = (URL) J2EEPlugin.getPlugin().getImage("jar_obj"); //$NON-NLS-1$
+ return ImageDescriptor.createFromURL(url).createImage();
+ }
+ return wbLabelProvider.getImage(object);
+ }
+
+ @Override
+ public String getText(Object object) {
+
+ if (object instanceof J2EEJavaClassProviderHelper)
+ return ((J2EEJavaClassProviderHelper) object).getText();
+ else if (isEMFEditObject(object)) {
+ if (CommonUtil.isDeploymentDescriptorRoot(object))
+ return J2EEUIMessages.getResourceString("Deployment_Descriptor_UI_") + ": " + super.getText(object); //$NON-NLS-1$ //$NON-NLS-2$
+ return super.getText(object);
+ } else if (object instanceof AbstractMethodsContentProvider.EJBMethodItem)
+ return super.getText(((AbstractMethodsContentProvider.EJBMethodItem) object).ejb);
+ else if (object instanceof IFile) {
+ return ((IFile) object).getName();
+ } else if (object instanceof File) {
+ return ((File)object).getName();
+ }
+ return wbLabelProvider.getText(object);
+ }
+
+ protected boolean isEMFEditObject(Object object) {
+ IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProviderClass);
+ return itemLabelProvider != null;
+ }
+
+ /*
+ * @see INotifyChangedListener#notifyChanged(new ENotificationImpl((InternalEObject)Object,
+ * int,(EStructuralFeature) Object, Object, Object, int))
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ Object feature = notification.getFeature();
+ if (feature == ROLE_NAME_SF || feature == ROLES_SF)
+ fireLabelProviderChanged();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProvider.java
new file mode 100644
index 0000000..9d2705a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProvider.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.application.ApplicationPackage;
+import org.eclipse.jst.j2ee.application.internal.impl.ApplicationFactoryImpl;
+import org.eclipse.jst.j2ee.internal.application.provider.ApplicationItemProvider;
+import org.eclipse.jst.j2ee.internal.ejb.provider.J2EENotificationImpl;
+
+public class J2EEApplicationItemProvider extends ApplicationItemProvider implements IAdaptable {
+
+ protected static final Class IRESOURCE_CLASS = IResource.class;
+ protected static final Class IPROJECT_CLASS = IProject.class;
+
+ protected Map children = new HashMap();
+ protected List resourceAdapters = null;
+
+ /**
+ * Constructor for J2EEApplicationItemProvider.
+ *
+ * @param adapterFactory
+ */
+ public J2EEApplicationItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List localChildren = (List) children.get(object);
+ if (localChildren == null)
+ return initChildren(object);
+ return localChildren;
+ }
+
+ protected List initChildren(Object object) {
+ Application app = (Application) object;
+ List localChildren = new ArrayList(2);
+ // MDE: changed getParent(object) to just app
+ localChildren.add(new ModulesItemProvider(getAdapterFactory(), null, null, app));
+
+ // IProject project = ProjectUtilities.getProject(app);
+ // IVirtualComponent ear = ComponentUtilities.findComponent(app);
+ // TODO switch to retrieve referenceComponents
+ // EAREditModel editModel = null;
+ // try {
+ // EARNatureRuntime runtime = EARNatureRuntime.getRuntime(project);
+ // if (runtime != null) {
+ // editModel = runtime.getEarEditModelForRead(this);
+ // EARProjectMap map = editModel.getEARProjectMap();
+ // localChildren.add(map);
+ // map.eResource().eAdapters().add(getNewAdapter(app));
+ // }
+ // } finally {
+ // if (editModel != null)
+ // editModel.releaseAccess(this);
+ // }
+ localChildren.add(new J2EEUtilityJarItemProvider(app, getAdapterFactory(), this));
+
+ children.put(object, localChildren);
+ return localChildren;
+ }
+
+ protected ModulesItemProvider getModulesNode(Object object) {
+ return (ModulesItemProvider) ((List) getChildren(object)).get(0);
+ }
+
+
+ /**
+ * @see Adapter#notifyChanged(new ENotificationImpl((InternalEObject)Notifier,
+ * int,(EStructuralFeature) EObject, Object, Object, int))
+ * @deprecated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(Application.class)) {
+ case ApplicationPackage.APPLICATION__MODULES :
+ break;
+ default :
+ super.notifyChanged(notification);
+ }
+ if (notification.getEventType() == Notification.REMOVING_ADAPTER && notification.getOldValue() == this)
+ children.remove(notification.getNotifier());
+ else if (notification.getFeature() == ApplicationFactoryImpl.getPackage().getApplication_Modules())
+ modulesChanged((Application) notification.getNotifier(), notification.getEventType(), notification.getOldValue(), notification.getNewValue(), notification.getPosition());
+ }
+
+ protected void modulesChanged(Application app, int eventType, Object oldValue, Object newValue, int pos) {
+ ModulesItemProvider provider = getModulesNode(app);
+ Collection grandChildren = provider.getChildren();
+ switch (eventType) {
+ case Notification.ADD : {
+ grandChildren.add(newValue);
+ break;
+ }
+ case Notification.ADD_MANY : {
+ grandChildren.addAll((Collection) newValue);
+ break;
+ }
+ case Notification.REMOVE : {
+ grandChildren.remove(oldValue);
+ break;
+ }
+ case Notification.REMOVE_MANY : {
+ grandChildren.removeAll((Collection) oldValue);
+ break;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ List adapters = getResourceAdapters();
+ ResourceAdapter adapter = null;
+ for (int i = 0; i < adapters.size(); i++) {
+ adapter = (ResourceAdapter) adapters.get(i);
+ adapter.getTarget().eAdapters().remove(adapter);
+ }
+ }
+
+ protected class ResourceAdapter extends AdapterImpl {
+
+ private Application app = null;
+
+ public ResourceAdapter(Application app) {
+ this.app = app;
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ Resource res = (Resource) notification.getNotifier();
+ if (notification.getEventType() == Notification.SET && notification.getFeatureID(null) == Resource.RESOURCE__IS_LOADED && !res.isLoaded()) {
+ J2EEApplicationItemProvider.this.children.remove(app);
+ res.eAdapters().remove(ResourceAdapter.this);
+ fireNotifyChanged(new J2EENotificationImpl(app, Notification.MOVE, (Object) null, (Object) null, 0));
+
+ }
+ }
+ }
+
+ protected ResourceAdapter getNewAdapter(Application key) {
+ ResourceAdapter adapter = new ResourceAdapter(key);
+ getResourceAdapters().add(adapter);
+ return adapter;
+ }
+
+ /**
+ * @return Returns the resourceAdapters.
+ */
+ protected List getResourceAdapters() {
+ if (resourceAdapters == null)
+ resourceAdapters = new ArrayList();
+ return resourceAdapters;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProviderAdapterFactory.java
new file mode 100644
index 0000000..1df4baf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEApplicationItemProviderAdapterFactory.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.provider;
+
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.j2ee.internal.application.provider.ApplicationItemProviderAdapterFactory;
+
+
+public class J2EEApplicationItemProviderAdapterFactory extends ApplicationItemProviderAdapterFactory {
+
+ /**
+ * Constructor for J2EEApplicationAdapterFactory.
+ */
+ public J2EEApplicationItemProviderAdapterFactory() {
+ super();
+ }
+
+ /**
+ * @see ApplicationAdapterFactory#createApplicationAdapter()
+ */
+ @Override
+ public Adapter createApplicationAdapter() {
+ return new J2EEApplicationItemProvider(this);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEBinaryModulesItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEBinaryModulesItemProvider.java
new file mode 100644
index 0000000..86ae2a2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEBinaryModulesItemProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.provider;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+
+public class J2EEBinaryModulesItemProvider extends J2EEItemProvider {
+
+ public J2EEBinaryModulesItemProvider(Application app, AdapterFactory adapterFactory, Collection children) {
+ super(adapterFactory, children);
+ }
+
+ @Override
+ public String getText(Object obj) {
+ return J2EEUIMessages.BINARY;
+ }
+
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getPlugin().getImage("folder"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEEditingDomain.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEEditingDomain.java
new file mode 100644
index 0000000..a0da2f9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEEditingDomain.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.provider;
+
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CopyToClipboardCommand;
+import org.eclipse.emf.edit.command.CreateCopyCommand;
+import org.eclipse.emf.edit.command.DragAndDropCommand;
+import org.eclipse.emf.edit.command.InitializeCopyCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
+import org.eclipse.emf.edit.command.OverrideableCommand;
+import org.eclipse.emf.edit.command.PasteFromClipboardCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.ReplaceCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+
+/**
+ * Custom editing domain which provides hooks for creating override commands; should not be used
+ * directly but can be subclassed to override commands as necessary. All the override methods by
+ * default return null, so a subclass may override only a subset of the commands.
+ */
+public class J2EEEditingDomain extends AdapterFactoryEditingDomain {
+ /**
+ * J2EEEditingDomain constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ * @param commandStack
+ * CommandStack
+ */
+ public J2EEEditingDomain(org.eclipse.emf.common.notify.AdapterFactory adapterFactory, CommandStack commandStack) {
+ super(adapterFactory, commandStack);
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createAddOverrideCommand(AddCommand addCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createCopyToClipboardOverrideCommand(CopyToClipboardCommand copyToClipboardCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createCreateCopyOverrideCommand(CreateCopyCommand createCopyCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createDragAndDropOverrideCommand(DragAndDropCommand dragAndDropCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createInitializeCopyOverrideCommand(InitializeCopyCommand initializeCopyCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createMoveOverrideCommand(MoveCommand moveCommand) {
+ return null;
+ }
+
+ @Override
+ public Command createOverrideCommand(OverrideableCommand command) {
+ if (command instanceof AddCommand) {
+ AddCommand addCommand = (AddCommand) command;
+ return createAddOverrideCommand(addCommand);
+ } else if (command instanceof RemoveCommand) {
+ RemoveCommand removeCommand = (RemoveCommand) command;
+ return createRemoveOverrideCommand(removeCommand);
+ } else if (command instanceof SetCommand) {
+ SetCommand setCommand = (SetCommand) command;
+ return createSetOverrideCommand(setCommand);
+ } else if (command instanceof ReplaceCommand) {
+ ReplaceCommand replaceCommand = (ReplaceCommand) command;
+ return createReplaceOverrideCommand(replaceCommand);
+ } else if (command instanceof MoveCommand) {
+ MoveCommand moveCommand = (MoveCommand) command;
+ return createMoveOverrideCommand(moveCommand);
+ } else if (command instanceof CreateCopyCommand) {
+ CreateCopyCommand createCopyCommand = (CreateCopyCommand) command;
+ return createCreateCopyOverrideCommand(createCopyCommand);
+ } else if (command instanceof InitializeCopyCommand) {
+ InitializeCopyCommand initializeCopyCommand = (InitializeCopyCommand) command;
+ return createInitializeCopyOverrideCommand(initializeCopyCommand);
+ } else if (command instanceof CopyToClipboardCommand) {
+ CopyToClipboardCommand copyToClipboardCommand = (CopyToClipboardCommand) command;
+ return createCopyToClipboardOverrideCommand(copyToClipboardCommand);
+ } else if (command instanceof PasteFromClipboardCommand) {
+ PasteFromClipboardCommand pasteFromClipboardCommand = (PasteFromClipboardCommand) command;
+ return createPasteFromClipboardOverrideCommand(pasteFromClipboardCommand);
+ } else if (command instanceof DragAndDropCommand) {
+ DragAndDropCommand dragAndDropCommand = (DragAndDropCommand) command;
+ return createDragAndDropOverrideCommand(dragAndDropCommand);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createPasteFromClipboardOverrideCommand(PasteFromClipboardCommand pasteFromClipboardCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createRemoveOverrideCommand(RemoveCommand removeCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createReplaceOverrideCommand(ReplaceCommand replaceCommand) {
+ return null;
+ }
+
+ /**
+ * The default is not to override this command; subclasses can override if necessary
+ */
+ protected Command createSetOverrideCommand(SetCommand setCommand) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEProviderUtility.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEProviderUtility.java
new file mode 100644
index 0000000..3839ba3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEProviderUtility.java
@@ -0,0 +1,38 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.provider;
+
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+
+public class J2EEProviderUtility {
+
+ private J2EEProviderUtility() {
+ super();
+ }
+
+ public static String prependProjectName(EObject object, String label) {
+ String projectName = null;
+ if (object.eResource() != null) {
+ IProject proj = WorkbenchResourceHelper.getProject(object.eResource());
+ if (proj != null)
+ projectName = proj.getName();
+ }
+
+ if (projectName == null || projectName.equals(label))
+ return label;
+ else if (label == null || label.length() == 0)
+ return projectName;
+ else
+ return projectName + ": " + label; //$NON-NLS-1$
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUIEditingDomain.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUIEditingDomain.java
new file mode 100644
index 0000000..fd92251
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUIEditingDomain.java
@@ -0,0 +1,77 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.provider;
+
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.CopyToClipboardCommand;
+import org.eclipse.emf.edit.command.PasteFromClipboardCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.jst.j2ee.internal.command.J2EEClipboard;
+import org.eclipse.jst.j2ee.internal.command.J2EECopyToClipboardOverrideCommand;
+import org.eclipse.jst.j2ee.internal.command.J2EEPasteFromClipboardOverrideCommand;
+import org.eclipse.jst.j2ee.internal.command.J2EERemoveOverrideCommand;
+
+
+public class J2EEUIEditingDomain extends J2EEEditingDomain {
+ /**
+ * J2EEUIEditingDomain constructor comment.
+ *
+ * @param adapterFactory
+ * org.eclipse.emf.common.notify.AdapterFactory
+ * @param commandStack
+ * CommandStack
+ */
+ public J2EEUIEditingDomain(org.eclipse.emf.common.notify.AdapterFactory adapterFactory, CommandStack commandStack) {
+ super(adapterFactory, commandStack);
+ turnTraceOnIfDebugging();
+ }
+
+ @Override
+ protected Command createCopyToClipboardOverrideCommand(CopyToClipboardCommand copyToClipboardCommand) {
+
+ if (copyToClipboardCommand instanceof J2EECopyToClipboardOverrideCommand)
+ return null;
+ return new J2EECopyToClipboardOverrideCommand(copyToClipboardCommand);
+ }
+
+ @Override
+ protected Command createPasteFromClipboardOverrideCommand(PasteFromClipboardCommand pasteFromClipboardCommand) {
+ if (pasteFromClipboardCommand instanceof J2EEPasteFromClipboardOverrideCommand)
+ return null;
+ if (!(getClipboard() instanceof J2EEClipboard))
+ return null;
+ return new J2EEPasteFromClipboardOverrideCommand(pasteFromClipboardCommand);
+ }
+
+ @Override
+ protected Command createRemoveOverrideCommand(RemoveCommand removeCommand) {
+ return new J2EERemoveOverrideCommand(removeCommand);
+ }
+
+ public J2EEClipboard getJ2EEClipboard() {
+ return (J2EEClipboard) getClipboard();
+ }
+
+ @Override
+ public Object getParent(Object object) {
+ Object parent = super.getParent(object);
+ if (parent != null)
+ return parent;
+ if (object instanceof EObject)
+ return ((EObject) object).eContainer();
+ return null;
+ }
+
+ protected void turnTraceOnIfDebugging() {
+ //AbstractCommand.Trace.enable();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUtilityJarItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUtilityJarItemProvider.java
new file mode 100644
index 0000000..583452f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/J2EEUtilityJarItemProvider.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+/**
+ * @author jsholl
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class J2EEUtilityJarItemProvider extends J2EEItemProvider {
+
+ public final static String UTILITY_JARS = J2EEUIMessages.getResourceString("Utility_JARs_UI_"); //$NON-NLS-1$
+
+ private boolean childrenLoaded = false;
+ private Application application = null;
+
+ /**
+ * Constructor for J2EEUtilityJarItemProvider.
+ */
+ public J2EEUtilityJarItemProvider(Application app, AdapterFactory adapterFactory, Object parent) {
+ super(adapterFactory);
+ setParent(parent);
+ application = app;
+ UtilityJarResourceChangeListener.INSTANCE.addUtilityJarItemProvider(ProjectUtilities.getProject(application), this);
+ }
+
+ @Override
+ public boolean hasChildren(Object object) {
+ getChildren(object);
+ return !children.isEmpty();
+ }
+
+ @Override
+ public Collection getChildren(final Object object) {
+ if (!childrenLoaded) {
+ try {
+ disableNotification();
+ org.eclipse.swt.custom.BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ computeChildren();
+ }
+ });
+ } finally {
+ enableNotification();
+ }
+ }
+ return children;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ UtilityJarResourceChangeListener.INSTANCE.removeUtilityJarItemProvider(ProjectUtilities.getProject(application), this);
+
+ }
+
+ /**
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getChildren(Object)
+ */
+ private void computeChildren() {
+ childrenLoaded = true;
+ IVirtualComponent ear = ComponentUtilities.findComponent(application);
+ if (ear != null) {
+ EARArtifactEdit earEdit = null;
+ try {
+ earEdit = EARArtifactEdit.getEARArtifactEditForRead(ear);
+ IVirtualReference[] modules = earEdit.getUtilityModuleReferences();
+ for (int i = 0; i < modules.length; i++) {
+ IVirtualComponent module = modules[i].getReferencedComponent();
+ if (module.isBinary()) {
+ IFile utilityJar = (IFile)module.getAdapter(IFile.class);
+ if (utilityJar != null)
+ children.add(utilityJar);
+ else {
+ java.io.File diskFile = (java.io.File)module.getAdapter(java.io.File.class);
+ if (diskFile.exists())
+ children.add(diskFile);
+ }
+ }
+ if (module.getProject() == null || !module.getProject().isAccessible())
+ continue;
+ // return only jars for utility components
+ if (JavaEEProjectUtilities.isUtilityProject(module.getProject())) {
+ IProject project = ProjectUtilities.getProject(application);
+ if (project == null)
+ continue;
+ // we will assume the component name is in synch with the module uri
+ IFile utilityJar = project.getFile(module.getName() + IJ2EEModuleConstants.JAR_EXT);
+ if (utilityJar != null) {
+ if (utilityJar.exists())
+ children.add(utilityJar);
+ else
+ children.add(new UtilityModuleProjectItemProvider(getAdapterFactory(),module.getProject(),this));
+ }
+
+ }
+ }
+ } finally {
+ if (earEdit != null) {
+ earEdit.dispose();
+ }
+ }
+ }
+ }
+
+ // private Collection getJars(List list, IResource[] members) {
+ // for (int i = 0; i < members.length; i++) {
+ // if (isJarFile(members[i])) {
+ // list.add(members[i]);
+ // } else if (members[i].getType() == IResource.FOLDER) {
+ // try {
+ // getJars(list, ((IFolder) members[i]).members());
+ // } catch (CoreException e) {
+ // Logger.getLogger().logError(e);
+ // }
+ // }
+ // }
+ // return list;
+ // }
+
+ public static boolean isJarFile(IResource member) {
+ return member.getType() == IResource.FILE && member.getName().toLowerCase().endsWith(IJ2EEModuleConstants.JAR_EXT);
+ }
+
+ public static boolean isComponentFile(IResource member) {
+ return member.getType() == IResource.FILE && member.getName().toLowerCase().endsWith(IModuleConstants.COMPONENT_FILE_NAME);
+ }
+
+
+ /**
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getImage(Object)
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getPlugin().getImage("folder"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getText(Object)
+ */
+ @Override
+ public String getText(Object object) {
+ return UTILITY_JARS;
+ }
+
+ // assume this resource is a jar resource
+ public void utilityJarChanged(IResource resource, IResourceDelta delta) {
+ if (childrenLoaded) {
+ if (delta.getKind() == IResourceDelta.ADDED && !children.contains(resource)) {
+ children.add(resource);
+ } else if (delta.getKind() == IResourceDelta.REMOVED && children.contains(resource)) {
+ children.remove(resource);
+ }
+ }
+ }
+
+ protected static class UtilityJarResourceChangeListener implements IResourceChangeListener, IResourceDeltaVisitor {
+
+ protected static final UtilityJarResourceChangeListener INSTANCE = new UtilityJarResourceChangeListener();
+
+ private boolean listening = false;
+ private Map earProjectsToUtilityJarProviderMap;
+
+ public void addUtilityJarItemProvider(IProject project, J2EEUtilityJarItemProvider utilityJarItemProvider) {
+ List providers = getProviders(project);
+ if (providers != null)
+ providers.add(utilityJarItemProvider);
+ if (!listening) {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
+ listening = true;
+ }
+ }
+
+ /**
+ * @param project
+ * @return
+ */
+ private List getProviders(IProject project) {
+ List result = (List) getEarProjectsToUtilityJarProviderMap().get(project);
+ if (result == null && project != null)
+ getEarProjectsToUtilityJarProviderMap().put(project, (result = new ArrayList()));
+ return result;
+ }
+
+ /**
+ * @return
+ */
+ private Map getEarProjectsToUtilityJarProviderMap() {
+ if (earProjectsToUtilityJarProviderMap == null)
+ earProjectsToUtilityJarProviderMap = new HashMap();
+ return earProjectsToUtilityJarProviderMap;
+ }
+
+ public void removeUtilityJarItemProvider(IProject project, J2EEUtilityJarItemProvider utilityJarItemProvider) {
+ List providers = getProviders(project);
+ providers.remove(utilityJarItemProvider);
+ if (providers.isEmpty())
+ getEarProjectsToUtilityJarProviderMap().remove(project);
+
+ if (getEarProjectsToUtilityJarProviderMap().isEmpty()) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ listening = false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ try {
+ event.getDelta().accept(this);
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta) {
+ switch (delta.getResource().getType()) {
+ case IResource.ROOT :
+ case IResource.FOLDER :
+ return true;
+
+ case IResource.PROJECT :
+ return getEarProjectsToUtilityJarProviderMap().containsKey(delta.getResource());
+ case IResource.FILE : {
+ IResource resource = delta.getResource();
+ if (isComponentFile(resource)) {
+ List utilityJarItemProviders = getProviders(resource.getProject());
+ for (int i = 0; i < utilityJarItemProviders.size(); i++) {
+ ((J2EEUtilityJarItemProvider) utilityJarItemProviders.get(i)).getChildren().clear();
+ ((J2EEUtilityJarItemProvider) utilityJarItemProviders.get(i)).computeChildren();
+ }
+ }
+ return false;
+ }
+
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public IFile getAssociatedFile() {
+
+ try {
+ if (application != null && application.eResource() != null) {
+ return WorkbenchResourceHelperBase.getIFile(application.eResource().getURI());
+ }
+ } catch (Throwable t) {
+
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/MethodsProviderDelegate.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/MethodsProviderDelegate.java
new file mode 100644
index 0000000..1200806
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/MethodsProviderDelegate.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.provider;
+
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.ejb.ExcludeList;
+import org.eclipse.jst.j2ee.ejb.MethodPermission;
+import org.eclipse.jst.j2ee.ejb.MethodTransaction;
+import org.eclipse.jst.j2ee.ejb.internal.impl.EjbFactoryImpl;
+import org.eclipse.jst.j2ee.internal.ejb.provider.AbstractMethodsContentProvider;
+import org.eclipse.jst.j2ee.internal.ejb.provider.ExcludeListContentProvider;
+import org.eclipse.jst.j2ee.internal.ejb.provider.MethodPermissionsContentProvider;
+import org.eclipse.jst.j2ee.internal.ejb.provider.MethodTransactionContentProvider;
+
+
+public class MethodsProviderDelegate implements ITreeContentProvider {
+
+ protected ExcludeListContentProvider excludeListContentProvider;
+ protected MethodPermissionsContentProvider methodPermissionsContentProvider;
+ protected MethodTransactionContentProvider methodTransactionContentProvider;
+
+ protected static EObject EL_META = EjbFactoryImpl.getPackage().getExcludeList();
+ protected static EObject MP_META = EjbFactoryImpl.getPackage().getMethodPermission();
+ protected static EObject MT_META = EjbFactoryImpl.getPackage().getMethodTransaction();
+
+ public static boolean providesContentFor(Object object) {
+ return object instanceof AbstractMethodsContentProvider.EJBMethodItem || object instanceof MethodPermission || object instanceof MethodTransaction || object instanceof ExcludeList;
+ }
+
+ public MethodsProviderDelegate(AdapterFactory adapterFactory) {
+ super();
+ excludeListContentProvider = new ExcludeListContentProvider(adapterFactory, false);
+ methodPermissionsContentProvider = new MethodPermissionsContentProvider(adapterFactory, false);
+ methodTransactionContentProvider = new MethodTransactionContentProvider(adapterFactory, false);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ if (excludeListContentProvider != null)
+ excludeListContentProvider.dispose();
+ if (methodPermissionsContentProvider != null)
+ methodPermissionsContentProvider.dispose();
+ if (methodTransactionContentProvider != null)
+ methodTransactionContentProvider.dispose();
+ }
+
+ public AbstractMethodsContentProvider getContentProvider(Object object) {
+ EObject metaClass = null;
+ if (object instanceof AbstractMethodsContentProvider.EJBMethodItem)
+ metaClass = ((AbstractMethodsContentProvider.EJBMethodItem) object).refObject.eClass();
+ else
+ metaClass = ((EObject) object).eClass();
+
+ if (metaClass == EL_META)
+ return excludeListContentProvider;
+ else if (metaClass == MP_META)
+ return methodPermissionsContentProvider;
+ else if (metaClass == MT_META)
+ return methodTransactionContentProvider;
+
+ return null;
+ }
+
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ excludeListContentProvider.inputChanged(viewer, oldInput, newInput);
+ methodPermissionsContentProvider.inputChanged(viewer, oldInput, newInput);
+ methodTransactionContentProvider.inputChanged(viewer, oldInput, newInput);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
+ */
+ public Object[] getChildren(Object parentElement) {
+ AbstractMethodsContentProvider prov = getContentProvider(parentElement);
+ return prov == null ? null : prov.getChildren(parentElement);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
+ */
+ public Object getParent(Object element) {
+ AbstractMethodsContentProvider prov = getContentProvider(element);
+ return prov == null ? null : prov.getParent(element);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
+ */
+ public boolean hasChildren(Object element) {
+ AbstractMethodsContentProvider prov = getContentProvider(element);
+ return prov != null && prov.hasChildren(element);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ AbstractMethodsContentProvider prov = getContentProvider(inputElement);
+ return prov == null ? null : prov.getElements(inputElement);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/ModulesItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/ModulesItemProvider.java
new file mode 100644
index 0000000..ec8f20a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/ModulesItemProvider.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.provider;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.application.Module;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+public class ModulesItemProvider extends J2EEItemProvider {
+ public static final String MODULES = J2EEUIMessages.getResourceString("Modules_UI_"); //$NON-NLS-1$
+
+ /**
+ * Constructor for ModulesItemProvider.
+ */
+ public ModulesItemProvider() {
+ super();
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param children
+ */
+ public ModulesItemProvider(Collection children) {
+ super(children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ */
+ public ModulesItemProvider(String text) {
+ super(text);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ * @param children
+ */
+ public ModulesItemProvider(String text, Collection children) {
+ super(text, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ * @param image
+ */
+ public ModulesItemProvider(String text, Object image) {
+ super(text, image);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ * @param image
+ * @param children
+ */
+ public ModulesItemProvider(String text, Object image, Collection children) {
+ super(text, image, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ * @param image
+ * @param parent
+ */
+ public ModulesItemProvider(String text, Object image, Object parent) {
+ super(text, image, parent);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param text
+ * @param image
+ * @param parent
+ * @param children
+ */
+ public ModulesItemProvider(String text, Object image, Object parent, Collection children) {
+ super(text, image, parent, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text) {
+ super(adapterFactory, text);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ * @param image
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text, Object image) {
+ super(adapterFactory, text, image);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ * @param image
+ * @param parent
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent) {
+ super(adapterFactory, text, image, parent);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param children
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, Collection children) {
+ super(adapterFactory, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ * @param children
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text, Collection children) {
+ super(adapterFactory, text, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ * @param image
+ * @param children
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text, Object image, Collection children) {
+ super(adapterFactory, text, image, children);
+ }
+
+ /**
+ * Constructor for ModulesItemProvider.
+ *
+ * @param adapterFactory
+ * @param text
+ * @param image
+ * @param parent
+ * @param children
+ */
+ public ModulesItemProvider(AdapterFactory adapterFactory, String text, Object image, Object parent, Collection children) {
+ super(adapterFactory, text, image, parent, children);
+ }
+
+
+ /**
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getImage(Object)
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getPlugin().getImage("folder"); //$NON-NLS-1$
+ }
+
+ public Application getParentApplication() {
+ return (Application) getParent();
+ }
+
+ @Override
+ public IFile getAssociatedFile() {
+
+ try {
+ Application application = getParentApplication();
+ if (application != null && application.eResource() != null) {
+ return WorkbenchResourceHelperBase.getIFile(application.eResource().getURI());
+ }
+ } catch (Throwable t) {
+
+ }
+ return null;
+ }
+
+
+ /**
+ * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getText(Object)
+ */
+ @Override
+ public String getText(Object object) {
+ return MODULES;
+ }
+
+ @Override
+ public boolean hasChildren(Object object) {
+ getChildren(object);
+ return !localChildren.isEmpty();
+ }
+
+ private List localChildren = null;
+
+ @Override
+ public Collection getChildren(Object object) {
+ return initChildren(object);
+ }
+
+ protected List initChildren(Object object) {
+ localChildren = new ArrayList();
+ Application app = (Application) getParent();
+ IVirtualComponent ear = ComponentUtilities.findComponent(app);
+ List modules = app.getModules();
+ List binaryModules = new ArrayList();
+ IVirtualReference[] refs = ear.getReferences();
+ for (int i = 0; i < modules.size(); i++) {
+ Module module = (Module) modules.get(i);
+ String moduleURI = module.getUri();
+ boolean foundBinary = false;
+ if(moduleURI != null) {
+ String moduleName = new Path(moduleURI).lastSegment();
+ for (int j = 0; j < refs.length && !foundBinary; j++) {
+ IVirtualComponent component = refs[j].getReferencedComponent();
+ if (component.isBinary()) {
+ if (refs[j].getArchiveName().equals(moduleName)) {
+ foundBinary = true;
+ JavaEEBinaryComponentHelper helper = null;
+ try {
+ helper = new JavaEEBinaryComponentHelper(component);
+ Object binaryModule = helper.getPrimaryRootObject();
+ if (binaryModule != null) {
+ binaryModules.add(binaryModule);
+ }
+ } finally {
+ if(helper != null){
+ helper.dispose();
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!foundBinary) {
+ localChildren.add(module);
+ }
+ }
+
+ if (!binaryModules.isEmpty()) {
+ localChildren.add(new J2EEBinaryModulesItemProvider(app, getAdapterFactory(), binaryModules));
+ }
+
+ return localChildren;
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/UtilityModuleProjectItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/UtilityModuleProjectItemProvider.java
new file mode 100644
index 0000000..c7eed44
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/provider/UtilityModuleProjectItemProvider.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.provider;
+
+import java.util.Collection;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+
+public class UtilityModuleProjectItemProvider extends J2EEItemProvider {
+
+ private IProject utilProject;
+
+ public UtilityModuleProjectItemProvider(AdapterFactory adapterFactory, IProject project, Object parent) {
+ super(adapterFactory);
+ setParent(parent);
+ utilProject = project;
+ }
+
+ /**
+ * @see ItemProviderAdapter#getImage(Object)
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getPlugin().getImage("icons/full/obj16/prjutiljar_obj"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ItemProviderAdapter#getText(Object)
+ */
+ @Override
+ public String getText(Object object) {
+
+ return utilProject.getName();
+ }
+
+ @Override
+ public Collection<?> getChildren(Object object) {
+ return super.getChildren(object);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.java
new file mode 100644
index 0000000..ebd1d91
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.java
@@ -0,0 +1,444 @@
+/******************************************************************************
+ * Copyright (c) 2010 Oracle
+ * 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:
+ * Konstantin Komissarchik - initial implementation and ongoing maintenance
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui;
+
+import static org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.checkForComponentDependencyAttribute;
+import static org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.getDefaultRuntimePath;
+import static org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.isClassFolderEntry;
+import static org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil.modifyDependencyPath;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.ui.ISharedImages;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants.DependencyAttributeType;
+import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyExtensions;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.ui.internal.taskwizard.IWizardHandle;
+import org.eclipse.wst.common.componentcore.ui.internal.taskwizard.WizardFragment;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+
+@SuppressWarnings( "restriction" )
+
+public final class AddJavaBuildPathEntriesWizardFragment
+
+ extends WizardFragment
+
+{
+ public static final String PROP_SELECTION = "selection"; //$NON-NLS-1$
+
+ private IWizardHandle wizard;
+ private TreeViewer viewer;
+ private IJavaProject jproj;
+
+ public AddJavaBuildPathEntriesWizardFragment()
+ {
+ setComplete( false );
+ }
+
+ @Override
+ public boolean hasComposite()
+ {
+ return true;
+ }
+
+ @Override
+ public Composite createComposite( final Composite parent,
+ final IWizardHandle handle )
+ {
+ this.wizard = handle;
+
+ handle.setTitle( Resources.title );
+ handle.setDescription( Resources.description );
+ handle.setImageDescriptor( JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY );
+
+ final Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout() );
+
+ this.viewer = new TreeViewer( composite, SWT.MULTI | SWT.BORDER );
+
+ final GridData gd = new GridData( GridData.FILL_BOTH );
+ gd.widthHint = 390;
+ gd.heightHint = 185;
+
+ this.viewer.getTree().setLayoutData( gd );
+
+ this.viewer.setContentProvider( new BuildPathEntriesContentProvider() );
+ this.viewer.setLabelProvider( new BuildPathEntriesLabelProvider() );
+
+ this.viewer.addSelectionChangedListener
+ (
+ new ISelectionChangedListener()
+ {
+ public void selectionChanged( final SelectionChangedEvent event )
+ {
+ handleSelectionChanged();
+ }
+ }
+ );
+
+ this.viewer.addDoubleClickListener
+ (
+ new IDoubleClickListener()
+ {
+ public void doubleClick( final DoubleClickEvent event )
+ {
+ handleDoubleClick();
+ }
+ }
+ );
+
+ final IProject proj = (IProject) getTaskModel().getObject( IReferenceWizardConstants.PROJECT );
+ this.jproj = JavaCore.create( proj );
+
+ this.viewer.setInput( new Object() );
+
+ return composite;
+ }
+
+ private void handleSelectionChanged()
+ {
+ final List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ final IStructuredSelection selection = (IStructuredSelection) this.viewer.getSelection();
+ final IVirtualComponent virtualComponent = ComponentCore.createComponent(this.jproj.getProject());
+ final boolean isWebApp = JavaEEProjectUtilities.isDynamicWebProject( this.jproj.getProject() );
+
+ for( Iterator<?> itr = selection.iterator(); itr.hasNext(); )
+ {
+ final Object obj = itr.next();
+
+ if( obj instanceof IClasspathEntry )
+ {
+ final IClasspathEntry cpeOriginal = (IClasspathEntry) obj;
+
+ IPath runtimePath = null;
+ if(virtualComponent == null){
+ runtimePath = getDefaultRuntimePath( isWebApp, isClassFolderEntry( cpeOriginal ) );
+ } else {
+ runtimePath = getDefaultRuntimePath(virtualComponent, cpeOriginal);
+ }
+ final IClasspathEntry cpeTagged = modifyDependencyPath( cpeOriginal, runtimePath );
+
+ list.add( cpeTagged );
+ }
+ else
+ {
+ list.clear();
+ break;
+ }
+ }
+
+ getTaskModel().putObject( PROP_SELECTION, list );
+
+ setComplete( ! list.isEmpty() );
+ this.wizard.update();
+ }
+
+ private void handleDoubleClick()
+ {
+ advanceToNextPageOrFinish();
+ }
+
+ private IJavaProject getJavaProject()
+ {
+ return this.jproj;
+ }
+
+ public static String getClasspathEntryText( final IJavaProject jproj,
+ final IClasspathEntry cpe )
+ {
+ final int type = cpe.getEntryKind();
+
+ if( type == IClasspathEntry.CPE_CONTAINER )
+ {
+ try
+ {
+ final IClasspathContainer container = JavaCore.getClasspathContainer( cpe.getPath(), jproj );
+ return container.getDescription();
+ }
+ catch( Exception e )
+ {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ else if( type == IClasspathEntry.CPE_LIBRARY )
+ {
+ final IPath path = cpe.getPath();
+
+ final StringBuilder buf = new StringBuilder();
+ buf.append( path.lastSegment() );
+ buf.append( " - " ); //$NON-NLS-1$
+ buf.append( path.removeLastSegments( 1 ).toOSString() );
+
+ return buf.toString();
+ }
+
+ return cpe.getPath().toPortableString();
+ }
+
+ public static Image getClasspathEntryImage( final IJavaProject jproj,
+ final IClasspathEntry cpe )
+ {
+ final int type = cpe.getEntryKind();
+ final String imgId;
+
+ if( type == IClasspathEntry.CPE_CONTAINER )
+ {
+ imgId = ISharedImages.IMG_OBJS_LIBRARY;
+ }
+ else if( type == IClasspathEntry.CPE_LIBRARY )
+ {
+ imgId = ISharedImages.IMG_OBJS_JAR;
+ }
+ else if( type == IClasspathEntry.CPE_VARIABLE )
+ {
+ imgId = ISharedImages.IMG_OBJS_CLASSPATH_VAR_ENTRY;
+ }
+ else
+ {
+ imgId = null;
+ }
+
+ return ( imgId == null ? null : JavaUI.getSharedImages().getImage( imgId ) );
+ }
+
+ private final class BuildPathEntriesContentProvider
+
+ implements ITreeContentProvider
+
+ {
+ public Object[] getElements( final Object input )
+ {
+ final List<IClasspathEntry> elements = new ArrayList<IClasspathEntry>();
+ final List<?> filteredContainerIds = ClasspathDependencyExtensions.get().getFilteredClasspathContainerIDs();
+
+ try
+ {
+ for( IClasspathEntry cpe : getJavaProject().getRawClasspath() )
+ {
+ final int type = cpe.getEntryKind();
+ final IPath path = cpe.getPath();
+ boolean relevant = false;
+
+ if( type == IClasspathEntry.CPE_CONTAINER )
+ {
+ if( path.segmentCount() > 0 && ! filteredContainerIds.contains( path.segment( 0 ) ) )
+ {
+ relevant = true;
+ }
+ }
+ else if( type == IClasspathEntry.CPE_LIBRARY || type == IClasspathEntry.CPE_VARIABLE )
+ {
+ relevant = true;
+ }
+
+ if( relevant )
+ {
+ if( checkForComponentDependencyAttribute( cpe, DependencyAttributeType.CLASSPATH_COMPONENT_NONDEPENDENCY ) != null )
+ {
+ relevant = false;
+ }
+ }
+
+ if( relevant )
+ {
+ boolean found = false;
+
+ for( Object directive : (List<?>) getTaskModel().getObject( IReferenceWizardConstants.ALL_DIRECTIVES ) )
+ {
+ if( directive instanceof ClasspathEntryProxy )
+ {
+ final ClasspathEntryProxy proxy = (ClasspathEntryProxy) directive;
+
+ if( type == proxy.entry.getEntryKind() && path.equals( proxy.entry.getPath() ) )
+ {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if( found )
+ {
+ relevant = false;
+ }
+ }
+
+ if( relevant )
+ {
+ elements.add( cpe );
+ }
+ }
+ }
+ catch( CoreException e )
+ {
+ J2EEUIPlugin.logError(e);
+ }
+
+ return elements.toArray();
+ }
+
+ public boolean hasChildren( final Object element )
+ {
+ return ( element instanceof IClasspathEntry ) &&
+ ( ( (IClasspathEntry) element ).getEntryKind() == IClasspathEntry.CPE_CONTAINER );
+ }
+
+ public Object[] getChildren( final Object parent )
+ {
+ if( parent instanceof IClasspathEntry )
+ {
+ final IClasspathEntry cpe = (IClasspathEntry) parent;
+
+ if( cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER )
+ {
+ final List<ChildClasspathEntry> children = new ArrayList<ChildClasspathEntry>();
+
+ try
+ {
+ final IClasspathContainer container = JavaCore.getClasspathContainer( cpe.getPath(), getJavaProject() );
+
+ if( container != null )
+ {
+ for( IClasspathEntry child : container.getClasspathEntries() )
+ {
+ children.add( new ChildClasspathEntry( cpe, child ) );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ J2EEUIPlugin.logError(e);
+ }
+
+ return children.toArray();
+ }
+ }
+
+ return new Object[ 0 ];
+ }
+
+ public Object getParent( final Object element )
+ {
+ if( element instanceof ChildClasspathEntry )
+ {
+ return ( (ChildClasspathEntry) element ).parent;
+ }
+
+ return null;
+ }
+
+ public void inputChanged( final Viewer viewer,
+ final Object oldInput,
+ final Object newInput )
+ {
+ }
+
+ public void dispose()
+ {
+ }
+ }
+
+ private final class BuildPathEntriesLabelProvider
+
+ extends LabelProvider
+
+ {
+ @Override
+ public String getText( final Object element )
+ {
+ final IClasspathEntry cpe;
+
+ if( element instanceof IClasspathEntry )
+ {
+ cpe = (IClasspathEntry) element;
+ }
+ else
+ {
+ cpe = ( (ChildClasspathEntry) element ).entry;
+ }
+
+ return getClasspathEntryText( getJavaProject(), cpe );
+ }
+
+ @Override
+ public Image getImage( final Object element )
+ {
+ final IClasspathEntry cpe;
+
+ if( element instanceof IClasspathEntry )
+ {
+ cpe = (IClasspathEntry) element;
+ }
+ else
+ {
+ cpe = ( (ChildClasspathEntry) element ).entry;
+ }
+
+ return getClasspathEntryImage( getJavaProject(), cpe );
+ }
+ }
+
+ private static final class ChildClasspathEntry
+ {
+ public final IClasspathEntry parent;
+ public final IClasspathEntry entry;
+
+ public ChildClasspathEntry( final IClasspathEntry parent,
+ final IClasspathEntry entry )
+ {
+ this.parent = parent;
+ this.entry = entry;
+ }
+ }
+
+ public static final class Resources extends NLS
+ {
+ public static String title;
+ public static String description;
+
+ static
+ {
+ initializeMessages( AddJavaBuildPathEntriesWizardFragment.class.getName(), Resources.class );
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.properties
new file mode 100644
index 0000000..665e659
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/AddJavaBuildPathEntriesWizardFragment.properties
@@ -0,0 +1,2 @@
+title = Java Build Path Entries
+description = Select build path entries to include in the deployment assembly.
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableItem.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableItem.java
new file mode 100644
index 0000000..a4b6e46
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableItem.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Stefan Dimov, stefan.dimov@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jst.j2ee.internal.SecondCheckBoxStateChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+public class DoubleCheckboxTableItem extends TableItem {
+
+ protected int mSecondCheckboxColumnIndex;
+ protected Button secondCheckBox;
+ protected SelectionListener selLstnr;
+ protected ICheckStateListener tblLstnr = null;
+ protected DoubleCheckboxTableViewer tableViewer;
+
+ public DoubleCheckboxTableItem (Table parent, int style, int secondCheckboxColumnIndex, DoubleCheckboxTableViewer tableViewer) {
+ super(parent, style);
+ mSecondCheckboxColumnIndex = secondCheckboxColumnIndex;
+ this.tableViewer = tableViewer;
+ createCheckBox(parent);
+ }
+
+ public DoubleCheckboxTableItem(Table parent, int style, int index, int secondCheckboxColumnIndex, DoubleCheckboxTableViewer tableViewer) {
+ super(parent, style, index);
+ mSecondCheckboxColumnIndex = secondCheckboxColumnIndex;
+ this.tableViewer = tableViewer;
+ createCheckBox(parent);
+ }
+
+ public void setSecondChecked (boolean checked) {
+ secondCheckBox.setSelection(checked);
+ }
+
+ public boolean getSecondChecked() {
+ return secondCheckBox.getSelection();
+ }
+
+ public void setSecondGrayed(boolean grayed) {
+ secondCheckBox.setGrayed(grayed);
+ }
+
+ public boolean getSecondGrayed() {
+ return secondCheckBox.getGrayed();
+ }
+
+ public void setSecondEnabled(boolean enabled) {
+ secondCheckBox.setEnabled(enabled);
+ }
+
+ public boolean getSecondEnabled() {
+ return secondCheckBox.getEnabled();
+ }
+
+ public boolean isSecondEnabled() {
+ return secondCheckBox.isEnabled();
+ }
+
+ private void createCheckBox(Table parentTable) {
+ secondCheckBox = new Button(parentTable, SWT.CHECK | SWT.FLAT);
+ secondCheckBox.pack();
+ final DoubleCheckboxTableItem th = this;
+ selLstnr = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ SecondCheckBoxStateChangedEvent evt = new SecondCheckBoxStateChangedEvent(tableViewer,
+ getData(),
+ getChecked());
+ evt.setTableItem(th);
+ tblLstnr.checkStateChanged(evt);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ };
+ secondCheckBox.addSelectionListener(selLstnr);
+ }
+
+ public Button getSecondCheckBox() {
+ return secondCheckBox;
+ }
+
+ @Override
+ public void dispose() {
+ disposeSecondCheckbox();
+ super.dispose();
+ }
+
+ protected void disposeSecondCheckbox() {
+ if (secondCheckBox != null) {
+ secondCheckBox.removeSelectionListener(selLstnr);
+ secondCheckBox.dispose();
+ secondCheckBox = null;
+ }
+ selLstnr = null;
+ }
+
+ void setTableListener(ICheckStateListener tblLstnr) {
+ this.tblLstnr = tblLstnr;
+ }
+
+ @Override
+ protected void checkSubclass () {}
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableViewer.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableViewer.java
new file mode 100644
index 0000000..31510f4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/DoubleCheckboxTableViewer.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Stefan Dimov, stefan.dimov@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ViewerRow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+public class DoubleCheckboxTableViewer extends CheckboxTableViewer {
+
+ protected int mSecondCheckboxColumnIndex;
+ protected ICheckStateListener lstnr = null;
+
+ public DoubleCheckboxTableViewer(Table table, int secondCheckBoxColumnIndex) {
+ super(table);
+ if (secondCheckBoxColumnIndex < 1)
+ throw new IllegalArgumentException(
+ "The index of the second column with check box must be bigger than zero"); //$NON-NLS-1$
+
+ mSecondCheckboxColumnIndex = secondCheckBoxColumnIndex;
+ }
+
+ @Override
+ public void addCheckStateListener(ICheckStateListener listener) {
+ super.addCheckStateListener(listener);
+ lstnr = listener;
+ }
+
+ @Override
+ public void removeCheckStateListener(ICheckStateListener listener) {
+ super.removeCheckStateListener(listener);
+ lstnr = null;
+ getTable().getItems();
+ for (int i = 0; i < getTable().getItems().length; i++) {
+ DoubleCheckboxTableItem it = (DoubleCheckboxTableItem)getTable().getItem(i);
+ it.setTableListener(null);
+ }
+ }
+
+ @Override
+ protected ViewerRow internalCreateNewRowPart(int style, int rowIndex) {
+ DoubleCheckboxTableItem item;
+ if (rowIndex >= 0) {
+ item = new DoubleCheckboxTableItem(getTable(), style, rowIndex, mSecondCheckboxColumnIndex, this);
+ } else {
+ item = new DoubleCheckboxTableItem(getTable(), style, mSecondCheckboxColumnIndex, this);
+ }
+ item.setTableListener(lstnr);
+ TableEditor editor = new TableEditor(getTable());
+ editor.minimumWidth = item.getSecondCheckBox().getSize ().x;
+ editor.horizontalAlignment = SWT.CENTER;
+ editor.setEditor(item.getSecondCheckBox(), item, mSecondCheckboxColumnIndex);
+ return getViewerRowFromItem(item);
+ }
+
+ public Object[] getSecondCheckedItems() {
+ TableItem[] children = getTable().getItems();
+ ArrayList v = new ArrayList(children.length);
+ for (int i = 0; i < children.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)children[i];
+ if (item.getSecondChecked()) {
+ v.add(item);
+ }
+ }
+ return v.toArray();
+ }
+
+ public void setAllSecondChecked(boolean state) {
+ TableItem[] children = getTable().getItems();
+ for (int i = 0; i < children.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)children[i];
+ item.setSecondChecked(state);
+ }
+ }
+
+ public Object[] getSingleCheckedElements() {
+ TableItem[] children = getTable().getItems();
+ ArrayList v = new ArrayList(children.length);
+ for (int i = 0; i < children.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)children[i];
+ if (item.getChecked() && (!item.getSecondChecked())) {
+ v.add(item.getData());
+ }
+ }
+ return v.toArray();
+ }
+
+ public Object[] getDoubleCheckedElements() {
+ TableItem[] children = getTable().getItems();
+ ArrayList v = new ArrayList(children.length);
+ for (int i = 0; i < children.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)children[i];
+ if (item.getChecked() && item.getSecondChecked()) {
+ v.add(item.getData());
+ }
+ }
+ return v.toArray();
+ }
+
+ public Object[] getUncheckedItems() {
+ TableItem[] children = getTable().getItems();
+ ArrayList v = new ArrayList(children.length);
+ for (int i = 0; i < children.length; i++) {
+ TableItem item = children[i];
+ if (!item.getChecked()) {
+ v.add(item);
+ }
+ }
+ return v.toArray();
+ }
+
+
+ public Object[] getSecondUncheckedElements() {
+ TableItem[] children = getTable().getItems();
+ ArrayList v = new ArrayList(children.length);
+ for (int i = 0; i < children.length; i++) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)children[i];
+ if (!item.getSecondChecked()) {
+ v.add(item.getData());
+ }
+ }
+ return v.toArray();
+ }
+
+ public void setSecondCheckedItems(Object[] inputItems) {
+ assertElementsNotNull(inputItems);
+ Hashtable set = new Hashtable();
+ for (int i = 0; i < inputItems.length; ++i) {
+ set.put(inputItems[i], inputItems[i]);
+ }
+ TableItem[] items = getTable().getItems();
+ for (int i = 0; i < items.length; ++i) {
+ DoubleCheckboxTableItem item = (DoubleCheckboxTableItem)items[i];
+ boolean check = set.containsKey(item);
+ if (item.getSecondChecked() != check) {
+ item.setSecondChecked(check);
+ }
+
+ }
+ }
+
+ @Override
+ protected void doRemove(int start, int end) {
+ // ensure that the second check box is disposed
+ for (int i = start; i <= end; i++) {
+ disposeSecondCheckboxOfItem(i);
+ }
+
+ super.doRemove(start, end);
+ }
+
+ @Override
+ protected void doRemove(int[] indices) {
+ // ensure that the second check box is disposed
+ for (int i : indices) {
+ disposeSecondCheckboxOfItem(i);
+ }
+
+ super.doRemove(indices);
+ }
+
+ private void disposeSecondCheckboxOfItem(int index) {
+ TableItem item = getTable().getItem(index);
+ if (item instanceof DoubleCheckboxTableItem) {
+ ((DoubleCheckboxTableItem) item).disposeSecondCheckbox();
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/IJavaEEDeploymentAssemblySectionBuilder.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/IJavaEEDeploymentAssemblySectionBuilder.java
new file mode 100644
index 0000000..0374c29
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/IJavaEEDeploymentAssemblySectionBuilder.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jst.j2ee.internal.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
+
+public interface IJavaEEDeploymentAssemblySectionBuilder {
+
+ /**
+ * Builds the section
+ * @param parent - The composite to which this section will be added
+ */
+ public void buildSection(Composite parent);
+
+ public void loadContents();
+
+ public boolean saveContents();
+
+ public void directiveAdded(Object element);
+
+ public void directiveRemoved(Object element);
+
+ public IStatus validate(IStatus currentStatus);
+
+ public void componentResourceModified(ComponentResourceProxy originalResource, ComponentResourceProxy modifiedResource);
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEDependencyPageProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEDependencyPageProvider.java
new file mode 100644
index 0000000..4860f5d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEDependencyPageProvider.java
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * Copyright (c) 2010 Red Hat 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:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ * Konstantin Komissarchik - misc. UI cleanup
+ ******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.common.internal.modulecore.util.JavaModuleComponentUtility;
+import org.eclipse.jst.common.ui.internal.assembly.wizard.ManifestModuleDependencyControl;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
+import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class J2EEDependencyPageProvider implements IDependencyPageProvider {
+
+ private IModuleDependenciesControl[] controls;
+
+ public boolean canHandle(IFacetedProject project) {
+ return isJavaEENotEarWeb(project);
+ }
+
+ protected boolean isJavaEENotEarWeb(IFacetedProject fp) {
+ return fp.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EJB_MODULE)) ||
+ fp.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_APPCLIENT_MODULE)) ||
+ fp.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_CONNECTOR_MODULE)) ||
+ fp.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_UTILITY_MODULE)) ||
+ fp.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEBFRAGMENT_MODULE));
+ }
+
+ public IModuleDependenciesControl[] createPages(IFacetedProject project,
+ ModuleAssemblyRootPage parent) {
+
+ if( isStandalone(project.getProject()))
+ return new IModuleDependenciesControl[] {
+ new J2EEModuleDependenciesPropertyPage(project.getProject(), parent)};
+
+ return new IModuleDependenciesControl[] {
+ new J2EEModuleDependenciesPropertyPage(project.getProject(), parent),
+ new ManifestModuleDependencyControl(project.getProject(), parent)};
+
+ }
+
+ /*
+ * This now allows extenders to say whether this project is standalone or not
+ */
+ protected boolean isStandalone(IProject project) {
+ return JavaModuleComponentUtility.findParentProjects(project).length == 0;
+ }
+
+ public Composite createRootControl(IFacetedProject project,IModuleDependenciesControl[] pages,
+ Composite parent) {
+
+ if( isStandalone(project.getProject()))
+ return pages[0].createContents(parent);
+
+ final TabFolder folder = new TabFolder(parent, SWT.LEFT);
+ folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ folder.setFont(parent.getFont());
+
+ // Create the two tabs
+ controls = new IModuleDependenciesControl[2];
+ controls[0] = pages[0];
+ controls[1] = pages[1];
+
+ TabItem tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(create(controls[0],folder));
+ tab.setText(Messages.J2EEDependencyPageProvider_4);
+ tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(create(controls[1],folder));
+ tab.setText(Messages.J2EEDependencyPageProvider_5);
+
+ folder.setSelection(0);
+ return folder;
+ }
+
+ private static Control create( final IModuleDependenciesControl control,
+ final Composite parent )
+ {
+ final Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout() );
+ final Composite inner = control.createContents( composite );
+ inner.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+
+ return composite;
+ }
+
+ protected boolean isWeb(IFacetedProject project) {
+ return project.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE));
+ }
+
+ public String getPageTitle(IProject project) {
+
+ if (JavaEEProjectUtilities.isEJBProject(project))
+ return Messages.J2EEDependencyPageProvider_1;
+ if (JavaEEProjectUtilities.isApplicationClientProject(project))
+ return Messages.J2EEDependencyPageProvider_2;
+ if (JavaEEProjectUtilities.isJCAProject(project))
+ return Messages.J2EEDependencyPageProvider_3;
+ return Messages.J2EEDependencyPageProvider_4;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java
new file mode 100644
index 0000000..eda8a6b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDependenciesPropertyPage.java
@@ -0,0 +1,477 @@
+/******************************************************************************
+ * Copyright (c) 2009, 2011 Red Hat 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:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ * Chuck Bridgham - additional support
+ * Konstantin Komissarchik - misc. UI cleanup
+ * Roberto Sanchez - Add Advanced section
+ ******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.common.jdt.internal.javalite.IJavaProjectLite;
+import org.eclipse.jst.common.jdt.internal.javalite.JavaCoreLite;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants.DependencyAttributeType;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEModuleHandler;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.wst.common.componentcore.internal.IModuleHandler;
+import org.eclipse.wst.common.componentcore.internal.impl.TaskModel;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ComponentDependencyContentProvider;
+import org.eclipse.wst.common.componentcore.ui.internal.taskwizard.TaskWizard;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants.ProjectConverterOperationProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+public class J2EEModuleDependenciesPropertyPage extends
+ AddModuleDependenciesPropertiesPage {
+
+ private IJavaEEDeploymentAssemblySectionBuilder advancedHelper;
+
+ public J2EEModuleDependenciesPropertyPage(IProject project,
+ ModuleAssemblyRootPage page) {
+ super(project, page);
+ advancedHelper = getAdvancedSectionBuilder();
+ }
+
+ public class ClasspathEntryProxy {
+ public IClasspathEntry entry;
+ public ClasspathEntryProxy(IClasspathEntry entry){
+ this.entry = entry;
+ }
+ }
+
+ protected List <IClasspathEntry> originalClasspathEntries = new ArrayList<IClasspathEntry>();
+ protected List <ClasspathEntryProxy> currentClasspathEntries = new ArrayList<ClasspathEntryProxy>();
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ resetClasspathEntries();
+ }
+
+ @Override
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ fillTableComposite(composite);
+ addAdvancedComposite(composite);
+ }
+
+ private void resetClasspathEntries() {
+ originalClasspathEntries.clear();
+ currentClasspathEntries.clear();
+ originalClasspathEntries.addAll(readRawEntries());
+ for(IClasspathEntry entry:originalClasspathEntries){
+ currentClasspathEntries.add(new ClasspathEntryProxy(entry));
+ }
+ }
+
+ @Override
+ public void performDefaults() {
+ resetClasspathEntries();
+ if (advancedHelper != null)
+ advancedHelper.loadContents();
+ super.performDefaults();
+ }
+
+ protected List <IClasspathEntry> readRawEntries(){
+ return readRawEntries(rootComponent);
+ }
+
+ public static List <IClasspathEntry> readRawEntries(IVirtualComponent component){
+ List <IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ if (!component.getProject().isAccessible()){
+ return entries;
+ }
+ IJavaProjectLite javaProjectLite = JavaCoreLite.create(component.getProject());
+ try {
+ Map<IClasspathEntry, IClasspathAttribute> rawComponentClasspathDependencies = ClasspathDependencyUtil.getRawComponentClasspathDependencies(javaProjectLite, DependencyAttributeType.CLASSPATH_COMPONENT_DEPENDENCY);
+ entries.addAll(rawComponentClasspathDependencies.keySet());
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ return entries;
+ }
+
+ @Override
+ public boolean postHandleChanges(IProgressMonitor monitor) {
+ return true;
+ }
+
+ @Override
+ protected void handleRemoved(ArrayList<IVirtualReference> removed) {
+ super.handleRemoved(removed);
+ J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(rootComponent.getProject());
+ }
+
+ @Override
+ protected void remove(Object selectedItem) {
+ if(selectedItem instanceof ClasspathEntryProxy){
+ ClasspathEntryProxy entry = (ClasspathEntryProxy)selectedItem;
+ currentClasspathEntries.remove(entry);
+ } else {
+ super.remove(selectedItem);
+ }
+ if (advancedHelper != null)
+ advancedHelper.directiveRemoved(selectedItem);
+ }
+
+ @Override
+ protected String getModuleAssemblyRootPageDescription() {
+ if (JavaEEProjectUtilities.isEJBProject(project))
+ return Messages.J2EEModuleDependenciesPropertyPage_3;
+ if (JavaEEProjectUtilities.isApplicationClientProject(project))
+ return Messages.J2EEModuleDependenciesPropertyPage_4;
+ if (JavaEEProjectUtilities.isJCAProject(project))
+ return Messages.J2EEModuleDependenciesPropertyPage_5;
+ return super.getModuleAssemblyRootPageDescription();
+ }
+
+ @Override
+ protected IModuleHandler getModuleHandler() {
+ if(moduleHandler == null)
+ moduleHandler = new JavaEEModuleHandler();
+ return moduleHandler;
+ }
+
+ @Override
+ protected void setCustomReferenceWizardProperties(TaskModel model) {
+ model.putObject(IReferenceWizardConstants.PROJECT_CONVERTER_OPERATION_PROVIDER, getConverterProvider());
+ }
+
+ public ProjectConverterOperationProvider getConverterProvider() {
+ return new ProjectConverterOperationProvider() {
+ public IDataModelOperation getConversionOperation(IProject project) {
+ return J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(project);
+ }
+ };
+ }
+
+ @Override
+ protected ComponentDependencyContentProvider createProvider() {
+ JavaEEComponentDependencyContentProvider provider = new JavaEEComponentDependencyContentProvider(this);
+ provider.setClasspathEntries(currentClasspathEntries);
+ return provider;
+ }
+
+ @Override
+ protected boolean canRemove(Object selectedObject) {
+ return super.canRemove(selectedObject) && !(selectedObject instanceof JavaEEComponentDependencyContentProvider.ConsumedClasspathEntryProxy);
+ }
+
+ @Override
+ protected RuntimePathCellModifier getRuntimePathCellModifier() {
+ return new AddModuleDependenciesPropertiesPage.RuntimePathCellModifier(){
+ @Override
+ public boolean canModify(Object element, String property) {
+ if( property.equals(DEPLOY_PATH_PROPERTY) && element instanceof ClasspathEntryProxy) {
+ return true;
+ }
+ return super.canModify(element, property);
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ if(element instanceof ClasspathEntryProxy){
+ IClasspathEntry entry = ((ClasspathEntryProxy)element).entry;
+ IPath runtimePath = ClasspathDependencyUtil.getRuntimePath(entry);
+ if(runtimePath.isRoot())
+ return runtimePath.toString();
+ return runtimePath.makeRelative().toString();
+ }
+ return super.getValue(element, property);
+ }
+
+ @Override
+ public void modify(Object element, String property, Object value) {
+ ComponentResourceProxy originalResource = null;
+ ComponentResourceProxy modifiedResource = null;
+ if (property.equals(DEPLOY_PATH_PROPERTY)) {
+ TreeItem item = (TreeItem) element;
+ if( item.getData() instanceof ComponentResourceProxy) {
+ modifiedResource = (ComponentResourceProxy)item.getData();
+ originalResource = new ComponentResourceProxy(modifiedResource.source, modifiedResource.runtimePath);
+ }
+ if(item.getData() instanceof ClasspathEntryProxy){
+ TreeItem[] components = availableComponentsViewer.getTree().getItems();
+ int tableIndex = -1;
+ for(int i=0; i < components.length; i++) {
+ if(components[i] == item) {
+ tableIndex = i;
+ break;
+ }
+ }
+ ClasspathEntryProxy proxy = (ClasspathEntryProxy)item.getData();
+ IPath runtimePath = new Path(((String)value).trim()).makeRelative();
+ if(runtimePath.isEmpty())
+ runtimePath = runtimePath.makeAbsolute();
+ if(tableIndex >= 0)
+ components[tableIndex].setText(AddModuleDependenciesPropertiesPage.DEPLOY_COLUMN, runtimePath.toString());
+ if(!ClasspathDependencyUtil.isMappedIntoContainer(runtimePath.toString()))
+ runtimePath = runtimePath.makeAbsolute();
+ IClasspathEntry newEntry = ClasspathDependencyUtil.modifyDependencyPath(proxy.entry, runtimePath);
+ proxy.entry = newEntry;
+ resourceMappingsChanged = true;
+ }
+ }
+ super.modify(element, property, value);
+ if (originalResource != null && advancedHelper != null)
+ advancedHelper.componentResourceModified(originalResource, modifiedResource);
+ }
+ };
+ }
+
+
+ @Override
+ protected boolean saveReferenceChanges() {
+ boolean subResult = super.saveReferenceChanges();
+ if(!subResult){
+ return subResult;
+ }
+ Map <IPath, IClasspathEntry> modified = new HashMap <IPath, IClasspathEntry>();
+
+ Map <IPath, IClasspathEntry> originalMap = new HashMap <IPath, IClasspathEntry>();
+ for(IClasspathEntry originalEntry : originalClasspathEntries){
+ originalMap.put(originalEntry.getPath(), originalEntry);
+ }
+
+ for(ClasspathEntryProxy proxy: currentClasspathEntries){
+ IClasspathEntry currentEntry = proxy.entry;
+ IPath path = currentEntry.getPath();
+ IClasspathEntry originalEntry = originalMap.remove(path);
+ if(currentEntry.equals(originalEntry)){
+ //no change
+ continue;
+ }
+ modified.put(path, currentEntry);
+ }
+
+ Map <IPath, IClasspathEntry> removed = originalMap;
+
+ IJavaProject javaProject = JavaCore.create(rootComponent.getProject());
+ try {
+ final IClasspathEntry [] rawClasspath = javaProject.getRawClasspath();
+ List <IClasspathEntry> newClasspath = new ArrayList <IClasspathEntry>();
+ for(IClasspathEntry entry:rawClasspath){
+ IPath path = entry.getPath();
+ if(removed.containsKey(path)){
+ //user removed entry
+ IClasspathEntry newEntry = ClasspathDependencyUtil.modifyDependencyPath(entry, null);
+ newClasspath.add(newEntry);
+ } else if(modified.containsKey(path)){
+ //user changed path value
+ IClasspathEntry newEntry = modified.get(path);
+ IPath runtimePath = ClasspathDependencyUtil.getRuntimePath(newEntry);
+ if(runtimePath.toString().length() == 0){
+ //prevent the user from specifying no path
+ newEntry = ClasspathDependencyUtil.modifyDependencyPath(newEntry, new Path("/")); //$NON-NLS-1$
+ }
+ newClasspath.add(newEntry);
+ } else {
+ //no change
+ newClasspath.add(entry);
+ }
+ }
+ javaProject.setRawClasspath( newClasspath.toArray( new IClasspathEntry[ newClasspath.size() ] ), null );
+
+ originalClasspathEntries.clear();
+ currentClasspathEntries.clear();
+ resetClasspathEntries();
+ } catch (JavaModelException e) {
+ J2EEUIPlugin.logError(e);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void handleAddDirective( final TaskWizard wizard )
+ {
+ final List<IClasspathEntry> classpathEntries
+ = (List<IClasspathEntry>) wizard.getTaskModel().getObject( AddJavaBuildPathEntriesWizardFragment.PROP_SELECTION );
+
+ if( classpathEntries != null && ! classpathEntries.isEmpty() )
+ {
+ for( IClasspathEntry cpe : classpathEntries )
+ {
+ this.currentClasspathEntries.add( new ClasspathEntryProxy( cpe ) );
+ }
+ }
+ else
+ {
+ super.handleAddDirective(wizard);
+ }
+ if (advancedHelper != null)
+ advancedHelper.directiveAdded(wizard.getTaskModel());
+ }
+
+ @Override
+ protected void verify() {
+ propPage.refreshProblemsView();
+ }
+
+ @Override
+ public IStatus validate() {
+ ArrayList<ComponentResourceProxy> allMappings = new ArrayList<ComponentResourceProxy>();
+ allMappings.addAll(resourceMappings);
+ allMappings.addAll(hiddenMappings);
+ IStatus status = J2EEModuleDeploymentAssemblyVerifierHelper.verify(rootComponent, runtime, currentReferences, allMappings,resourceMappingsChanged, currentClasspathEntries);
+ if (advancedHelper != null)
+ status = advancedHelper.validate(status);
+ return status;
+ }
+
+ protected void addAdvancedComposite(Composite parent) {
+ if (advancedHelper != null) {
+ advancedHelper.buildSection(parent);
+ advancedHelper.loadContents();
+ }
+ }
+
+ @Override
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (advancedHelper != null)
+ result = result & advancedHelper.saveContents();
+ return result;
+ }
+
+ protected IJavaEEDeploymentAssemblySectionBuilder getAdvancedSectionBuilder(){
+ if (advancedHelper == null){
+ advancedHelper = new JavaEEDeploymentAssemblyAdvancedSectionBuilder(rootComponent, this);
+ }
+ return advancedHelper;
+ }
+
+//
+// @Override
+// protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualComponent component) {
+// return new AddComponentToEnterpriseApplicationDataModelProvider();
+// }
+//
+// protected void addToManifest(ArrayList<IVirtualComponent> components) {
+// StringBuffer newComps = getCompsForManifest(components);
+// if(newComps.toString().length() > 0) {
+// UpdateManifestOperation op = createManifestOperation(newComps.toString());
+// try {
+// op.run(new NullProgressMonitor());
+// } catch (InvocationTargetException e) {
+// J2EEUIPlugin.logError(e);
+// } catch (InterruptedException e) {
+// J2EEUIPlugin.logError(e);
+// }
+// }
+// }
+//
+// protected void addOneComponent(IVirtualComponent component, IPath path, String archiveName) throws CoreException {
+// //Find the Ear's that contain this component
+// IProject[] earProjects = EarUtilities.getReferencingEARProjects(rootComponent.getProject());
+// for (int i = 0; i < earProjects.length; i++) {
+// IProject project = earProjects[i];
+//
+// IDataModelProvider provider = getAddReferenceDataModelProvider(component);
+// IDataModel dm = DataModelFactory.createDataModel(provider);
+//
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, ComponentCore.createComponent(project));
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, Arrays.asList(component));
+//
+// //[Bug 238264] the uri map needs to be manually set correctly
+// Map<IVirtualComponent, String> uriMap = new HashMap<IVirtualComponent, String>();
+// uriMap.put(component, archiveName);
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+//
+// IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+// if (stat != OK_STATUS)
+// throw new CoreException(stat);
+// try {
+// dm.getDefaultOperation().execute(new NullProgressMonitor(), null);
+// } catch (ExecutionException e) {
+// ModuleCoreUIPlugin.logError(e);
+// }
+// }
+// }
+//
+//
+// protected StringBuffer getCompsForManifest(ArrayList<IVirtualComponent> components) {
+// StringBuffer newComps = new StringBuffer();
+// for (Iterator iterator = components.iterator(); iterator.hasNext();) {
+// IVirtualComponent comp = (IVirtualComponent) iterator.next();
+// String archiveName = new Path(derivedRefsObjectToRuntimePath.get(comp)).lastSegment();
+// newComps.append(archiveName);
+// newComps.append(' ');
+// }
+// return newComps;
+// }
+//
+// protected UpdateManifestOperation createManifestOperation(String newComps) {
+// return new UpdateManifestOperation(project.getName(), newComps, false);
+// }
+//
+// private void removeFromManifest(ArrayList<IVirtualComponent> removed) {
+// String sourceProjName = project.getName();
+// IProgressMonitor monitor = new NullProgressMonitor();
+// IFile manifestmf = J2EEProjectUtilities.getManifestFile(project);
+// ArchiveManifest mf = J2EEProjectUtilities.readManifest(project);
+// if (mf == null)
+// return;
+// IDataModel updateManifestDataModel = DataModelFactory.createDataModel(new UpdateManifestDataModelProvider());
+// updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.PROJECT_NAME, sourceProjName);
+// updateManifestDataModel.setBooleanProperty(UpdateManifestDataModelProperties.MERGE, false);
+// updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.MANIFEST_FILE, manifestmf);
+// String[] cp = mf.getClassPathTokenized();
+// List cpList = new ArrayList();
+//
+// for (int i = 0; i < cp.length; i++) {
+// boolean foundMatch = false;
+// for (Iterator iterator = removed.iterator(); iterator.hasNext();) {
+// IVirtualComponent comp = (IVirtualComponent) iterator.next();
+// String cpToRemove = new Path(derivedRefsOldComponentToRuntimePath.get(comp)).lastSegment();
+// if (cp[i].equals(cpToRemove))
+// foundMatch = true;
+// }
+// if (!foundMatch)
+// cpList.add(cp[i]);
+// }
+// updateManifestDataModel.setProperty(UpdateManifestDataModelProperties.JAR_LIST, cpList);
+// try {
+// updateManifestDataModel.getDefaultOperation().execute(monitor, null );
+// } catch (ExecutionException e) {
+// J2EEUIPlugin.logError(e);
+// }
+// }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java
new file mode 100644
index 0000000..af9bb7a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierData.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.DeploymentAssemblyVerifierData;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class J2EEModuleDeploymentAssemblyVerifierData extends DeploymentAssemblyVerifierData{
+
+ public J2EEModuleDeploymentAssemblyVerifierData(IVirtualComponent component, IRuntime runtime, ArrayList<IVirtualReference> currentReferences,
+ ArrayList<ComponentResourceProxy> resourceMappings, boolean resourceMappingsChanged, List<ClasspathEntryProxy> currentClasspathEntries2) {
+ super(component, runtime, currentReferences,resourceMappings, resourceMappingsChanged);
+ this.currentClasspathEntries = currentClasspathEntries2;
+ }
+ private List<ClasspathEntryProxy> currentClasspathEntries;
+
+ public List<ClasspathEntryProxy> getCurrentClasspathEntries() {
+ return currentClasspathEntries;
+ }
+ public void setCurrentClasspathEntries(List<ClasspathEntryProxy> currentClasspathEntries) {
+ this.currentClasspathEntries = currentClasspathEntries;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java
new file mode 100644
index 0000000..c8b1468
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEModuleDeploymentAssemblyVerifierHelper.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.Messages;
+import org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.DeploymentAssemblyVerifierHelper;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.IDeploymentAssemblyVerifier;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.VerifierRegistryReader;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class J2EEModuleDeploymentAssemblyVerifierHelper {
+
+
+ /**
+ * This method will use the facet framework to find all registered verifiers based on installed facets and runtimes.
+ * All the verifiers will have an opportunity to verify and return status on the proposed component mappings
+ * @param component
+ * @param runtime
+ * @param resourceMappingsChanged
+ * @param resourceMappings
+ * @param currentReferences
+ * @param currentClasspathEntries
+ * @return IStatus
+ */
+ public static IStatus verify(IVirtualComponent component,IRuntime runtime, ArrayList<IVirtualReference> currentReferences, ArrayList<ComponentResourceProxy> resourceMappings, boolean resourceMappingsChanged, List<ClasspathEntryProxy> currentClasspathEntries) {
+ IProject project = component.getProject();
+
+ List verifiers = DeploymentAssemblyVerifierHelper.collectAllVerifiers(project,runtime);
+ if (verifiers.isEmpty()) return Status.OK_STATUS;
+ MultiStatus masterStatus = new MultiStatus(ModuleCoreUIPlugin.PLUGIN_ID, IStatus.OK, Messages.DeploymentAssemblyVerifierHelper_0,null);
+
+ for (int i = 0; i < verifiers.size(); i++) {
+ if (!(verifiers.get(i) instanceof IConfigurationElement))
+ continue;
+ IDeploymentAssemblyVerifier verifier = null;
+ try {
+ verifier = (IDeploymentAssemblyVerifier) ((IConfigurationElement) verifiers.get(i)).createExecutableExtension(VerifierRegistryReader.VERIFIER_CLASS);
+ J2EEModuleDeploymentAssemblyVerifierData data = new J2EEModuleDeploymentAssemblyVerifierData(component, runtime,currentReferences,resourceMappings,resourceMappingsChanged,currentClasspathEntries );
+ IStatus verifyStatus = verifier.verify(data);
+ if(verifyStatus != null && verifyStatus.isMultiStatus()) {
+ masterStatus.addAll(verifyStatus);
+ } else {
+ masterStatus.add(verifyStatus);
+ }
+ } catch (Exception e) {
+ ModuleCoreUIPlugin.log(e);
+ continue;
+ }
+
+ }
+ return masterStatus;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEPropertiesPage.java
new file mode 100644
index 0000000..4c5c2f0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/J2EEPropertiesPage.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jst.j2ee.internal.J2EEPropertiesConstants;
+import org.eclipse.jst.j2ee.internal.ui.refactoring.RenameContextRootChange;
+import org.eclipse.jst.j2ee.internal.ui.refactoring.RenameContextRootRefactoringProcessor;
+import org.eclipse.jst.j2ee.internal.ui.refactoring.RenameContextRootWizard;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+
+public class J2EEPropertiesPage extends PropertyPage implements J2EEPropertiesConstants {
+
+ private Text contextRootNameField;
+ private boolean dirty = false;
+
+ /**
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite c = parent;
+ IProject project = getProject();
+ if (project != null
+ && JavaEEProjectUtilities.getJ2EEProjectType(project).equals(
+ JavaEEProjectUtilities.DYNAMIC_WEB)
+ || JavaEEProjectUtilities.getJ2EEProjectType(project).equals(
+ JavaEEProjectUtilities.STATIC_WEB)) {
+
+ c = new Composite(parent, SWT.NONE);
+
+ Label contextRootLabel = new Label(c, SWT.NONE);
+ contextRootLabel.setText(J2EEPropertiesConstants.WEB_CONTEXT_ROOT);
+
+ contextRootNameField = new Text(c, SWT.BORDER);
+ contextRootNameField.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ dirty = !contextRootNameField.getText().equals(
+ ComponentUtilities.getServerContextRoot(getProject()));
+ validateText();
+ }
+ });
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(c);
+ GridDataFactory.defaultsFor(contextRootLabel).applyTo(contextRootLabel);
+ GridDataFactory.defaultsFor(contextRootNameField).grab(true, false).applyTo(
+ contextRootNameField);
+ }
+ applyDialogFont(c);
+ return c;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ refresh();
+ refreshApplyButton();
+ }
+
+ private void validateText() {
+ IStatus status = RenameContextRootChange
+ .validateContextRoot(contextRootNameField.getText());
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ setValid(false);
+ }
+ else {
+ setErrorMessage(null);
+ setValid(true);
+ refreshApplyButton();
+ }
+ }
+
+ private void refreshApplyButton() {
+ if (dirty) {
+ if (getApplyButton() != null) {
+ getApplyButton().setEnabled(true);
+ }
+ }
+ else {
+ if (getApplyButton() != null) {
+ getApplyButton().setEnabled(false);
+ }
+ }
+ }
+
+ public void refresh() {
+ if (contextRootNameField != null) {
+ String s = ComponentUtilities.getServerContextRoot(getProject());
+ if (s == null) {
+ s = ""; //$NON-NLS-1$
+ }
+ contextRootNameField.setText(s);
+ validateText();
+ }
+ }
+
+ private IProject getProject() {
+
+ Object element = getElement();
+ if (element == null) {
+ return null;
+ }
+ if (element instanceof IProject) {
+ IProject project = (IProject) element;
+ return project;
+ }
+ return null;
+
+ }
+
+ private int doRefactor() {
+ int id = IDialogConstants.OK_ID;
+ if (dirty) {
+ RenameContextRootRefactoringProcessor processor = new RenameContextRootRefactoringProcessor();
+ processor.setProject(getProject());
+ processor.setNewName(contextRootNameField.getText());
+ RenameContextRootWizard wizard = new RenameContextRootWizard(processor,
+ RefactoringWizard.DIALOG_BASED_USER_INTERFACE);
+ wizard.setPrompt(false);
+ RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wizard);
+
+ try {
+ id = operation.run(getShell(), ""); //$NON-NLS-1$
+ }
+ catch (InterruptedException ee) {
+
+ }
+ if (id == IDialogConstants.OK_ID) {
+ dirty = false;
+ refresh();
+ }
+ }
+
+ return id;
+ }
+
+ @Override
+ protected void performApply() {
+ doRefactor();
+ }
+
+ @Override
+ protected void performDefaults() {
+ refresh();
+ }
+
+ @Override
+ public boolean performOk() {
+ return doRefactor() == IDialogConstants.OK_ID;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEComponentDependencyContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEComponentDependencyContentProvider.java
new file mode 100644
index 0000000..dd50b94
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEComponentDependencyContentProvider.java
@@ -0,0 +1,143 @@
+package org.eclipse.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants.DependencyAttributeType;
+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ComponentDependencyContentProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage;
+
+/**
+ * Same as {@link ComponentDependencyContentProvider} except this pulls in
+ * references tagged in the classpath to be pulled up by modules with ../
+ *
+ * @author jsholl
+ *
+ */
+public class JavaEEComponentDependencyContentProvider extends ComponentDependencyContentProvider {
+
+ public JavaEEComponentDependencyContentProvider(AddModuleDependenciesPropertiesPage addModuleDependenciesPropertiesPage) {
+ super(addModuleDependenciesPropertiesPage);
+ }
+
+ public class ConsumedClasspathEntryProxy {
+ public IClasspathEntry entry;
+ public ConsumedClasspathEntryProxy(IClasspathEntry entry){
+ this.entry = entry;
+ }
+ }
+
+ protected List<ClasspathEntryProxy> classpathEntries = null;
+
+ public void setClasspathEntries(List<ClasspathEntryProxy> classpathEntries) {
+ this.classpathEntries = classpathEntries;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ @SuppressWarnings("restriction")
+ Object[] superElements = super.getElements(inputElement);
+ List<Object> elements = new ArrayList<Object>();
+ for (Object obj : superElements) {
+ elements.add(obj);
+ }
+ elements.addAll(classpathEntries);
+ return elements.toArray();
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof ClasspathEntryProxy || element instanceof ConsumedClasspathEntryProxy) {
+ IClasspathEntry classpathEntry = ((element instanceof ConsumedClasspathEntryProxy) ? ((ConsumedClasspathEntryProxy)element).entry : ((ClasspathEntryProxy) element).entry);
+ if (columnIndex == AddModuleDependenciesPropertiesPage.SOURCE_COLUMN) {
+ final IJavaProject jproj = JavaCore.create(getComponent().getProject());
+ return AddJavaBuildPathEntriesWizardFragment.getClasspathEntryText(jproj, classpathEntry);
+ } else if (columnIndex == AddModuleDependenciesPropertiesPage.DEPLOY_COLUMN) {
+ IClasspathAttribute attribute = ClasspathDependencyUtil.checkForComponentDependencyAttribute(classpathEntry, DependencyAttributeType.CLASSPATH_COMPONENT_DEPENDENCY);
+ if (attribute != null) {
+ IPath runtimePath = new Path(attribute.getValue());
+ if(runtimePath.isRoot())
+ return runtimePath.toString();
+ return runtimePath.makeRelative().toString();
+ }
+ return null;
+ }
+ }
+ return super.getColumnText(element, columnIndex);
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (element instanceof ClasspathEntryProxy || element instanceof ConsumedClasspathEntryProxy) {
+ if (columnIndex == AddModuleDependenciesPropertiesPage.SOURCE_COLUMN) {
+ final IJavaProject jproj = JavaCore.create(getComponent().getProject());
+ IClasspathEntry classpathEntry = ((element instanceof ConsumedClasspathEntryProxy) ? ((ConsumedClasspathEntryProxy)element).entry : ((ClasspathEntryProxy) element).entry);
+ return AddJavaBuildPathEntriesWizardFragment.getClasspathEntryImage(jproj, classpathEntry);
+ } else if(columnIndex == AddModuleDependenciesPropertiesPage.DEPLOY_COLUMN) {
+ if(element instanceof ConsumedClasspathEntryProxy){
+ IClasspathEntry classpathEntry = ((ConsumedClasspathEntryProxy)element).entry;
+ if(classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY){
+ final IJavaProject jproj = JavaCore.create(getComponent().getProject());
+ return AddJavaBuildPathEntriesWizardFragment.getClasspathEntryImage(jproj, classpathEntry);
+ }
+ }
+ return ModuleCoreUIPlugin.getInstance().getImage("folder"); //$NON-NLS-1$
+ }
+ }
+ return super.getColumnImage(element, columnIndex);
+ }
+
+
+ @Override
+ public boolean hasChildren(Object element) {
+ Object [] children = getChildren(element);
+ return children != null && children.length > 0;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof IVirtualReference){
+ IVirtualReference ref = (IVirtualReference)parentElement;
+ IPath refRuntimePath = ref.getRuntimePath();
+ IVirtualComponent comp = ref.getReferencedComponent();
+ if(!comp.isBinary()){
+ List <IClasspathEntry> originalClasspathEntries = J2EEModuleDependenciesPropertyPage.readRawEntries(comp);
+ List <ConsumedClasspathEntryProxy> relativeClasspathEntries = new ArrayList<ConsumedClasspathEntryProxy>();
+ for(IClasspathEntry classpathEntry : originalClasspathEntries){
+ IClasspathAttribute attribute = ClasspathDependencyUtil.checkForComponentDependencyAttribute(classpathEntry, DependencyAttributeType.CLASSPATH_COMPONENT_DEPENDENCY);
+ if (attribute != null) {
+ String rawValue = attribute.getValue();
+ if(rawValue.startsWith("../")){ //$NON-NLS-1$
+ IPath basePath = new Path(rawValue);
+ IPath path = refRuntimePath.append(basePath.removeFirstSegments(1));
+ if(classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY){
+ path = path.append(classpathEntry.getPath().lastSegment());
+ }
+ IClasspathEntry relativeEntry = ClasspathDependencyUtil.modifyDependencyPath(classpathEntry, path);
+ relativeClasspathEntries.add(new ConsumedClasspathEntryProxy(relativeEntry));
+ }
+ }
+ }
+ return relativeClasspathEntries.toArray();
+ }
+ }
+ return super.getChildren(parentElement);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEDeploymentAssemblyAdvancedSectionBuilder.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEDeploymentAssemblyAdvancedSectionBuilder.java
new file mode 100644
index 0000000..e1026e7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/JavaEEDeploymentAssemblyAdvancedSectionBuilder.java
@@ -0,0 +1,440 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jst.j2ee.internal.ui;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.TaskModel;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ResourceMappingFilterExtensionRegistry;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage.ComponentResourceProxy;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+
+/**
+ * This is a helper class to build and handle the logic of the "Advanced" section
+ * of the Deployment Assembly page that is common to all the Java EE modules (EAR
+ * project, Web project, etc.)
+ *
+ */
+
+public class JavaEEDeploymentAssemblyAdvancedSectionBuilder implements IJavaEEDeploymentAssemblySectionBuilder, SelectionListener {
+
+ private Label defaulDDFolderLabel;
+ private Combo rootSourceMappings;
+
+ private IVirtualComponent rootComponent;
+ private AddModuleDependenciesPropertiesPage page;
+ private String currentSelectedDDFolder = null;
+ private List<String> resourceMappingsList = new ArrayList<String>();
+ boolean shouldDisplaySection;
+
+ String folderToLook;
+ String fileToLook;
+ String projectType;
+
+
+ public JavaEEDeploymentAssemblyAdvancedSectionBuilder(IVirtualComponent component, AddModuleDependenciesPropertiesPage page){
+ rootComponent = component;
+ this.page = page;
+ shouldDisplaySection = !JavaEEProjectUtilities.isUtilityProject(rootComponent.getProject());
+ IVirtualFolder rootFolder = rootComponent.getRootFolder();
+ IPath defaultDDFolder = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(rootFolder);
+ shouldDisplaySection &= (defaultDDFolder == null);
+ projectType = JavaEEProjectUtilities.getJ2EEProjectType(component.getProject());
+ if (projectType.equals(IJ2EEFacetConstants.APPLICATION_CLIENT)) {
+ folderToLook = J2EEConstants.META_INF;
+ fileToLook = J2EEConstants.APP_CLIENT_DD_URI;
+ }
+ else if (projectType.equals(IJ2EEFacetConstants.JCA)) {
+ folderToLook = J2EEConstants.META_INF;
+ fileToLook = J2EEConstants.RAR_DD_URI;
+ }
+ else if (projectType.equals(IJ2EEFacetConstants.EJB)){
+ folderToLook = J2EEConstants.META_INF;
+ fileToLook = J2EEConstants.EJBJAR_DD_URI;
+ }
+ else if (projectType.equals(IJ2EEFacetConstants.DYNAMIC_WEB)) {
+ folderToLook = J2EEConstants.WEB_INF;
+ fileToLook = J2EEConstants.WEBAPP_DD_URI;
+ }
+ else if (projectType.equals(IJ2EEFacetConstants.ENTERPRISE_APPLICATION)) {
+ folderToLook = J2EEConstants.META_INF;
+ fileToLook = J2EEConstants.APPLICATION_DD_URI;
+ }
+ else if (projectType.equals(IJ2EEFacetConstants.WEBFRAGMENT)) {
+ folderToLook = J2EEConstants.META_INF;
+ fileToLook = J2EEConstants.WEBFRAGMENT_DD_URI;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jst.j2ee.internal.ui.IJavaEEDeploymentAssemblySectionBuilder#buildSection(org.eclipse.swt.widgets.Composite)
+ */
+ public void buildSection(Composite parent){
+ if (shouldDisplaySection()) {
+ Composite advancedSectionComposite = createAdvancedSection(parent);
+ addDefaultDeploymentDescriptorFolderFields(advancedSectionComposite);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jst.j2ee.internal.ui.IJavaEEDeploymentAssemblySectionBuilder#loadContents()
+ */
+ public void loadContents(){
+ if (shouldDisplaySection()){
+ loadDefaultDeploymentDescriptorFolderContents();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jst.j2ee.internal.ui.IJavaEEDeploymentAssemblySectionBuilder#saveContents()
+ */
+ public boolean saveContents(){
+ boolean success = true;
+ if (shouldDisplaySection()){
+ success = saveDefaultDeploymentDescriptorFolderContents();
+ loadContents();
+ }
+ return success;
+ }
+
+
+ private void loadDefaultDeploymentDescriptorFolderContents(){
+ resourceMappingsList.clear();
+ // First, retrieve all the mappings to root. Assume there are no duplicated mappings.
+ IPath[] allRootMappings = findAllRootMappings();
+ // Now, see if any of that is tagged as default root mapping
+ IVirtualFolder rootFolder = rootComponent.getRootFolder();
+ IPath defaultDDFolder = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(rootFolder);
+
+ currentSelectedDDFolder = defaultDDFolder == null?null:defaultDDFolder.toString();
+
+ for (IPath mapping:allRootMappings){
+ resourceMappingsList.add(mapping.toString());
+ }
+
+ updateSourceMappingsCombo(currentSelectedDDFolder, resourceMappingsList);
+ }
+
+
+ private List<String> filterMappings(List <String> mappings){
+ Set<String> mappingWithDD = new HashSet<String>();
+ Set<String> mappingWithFolder = new HashSet<String>();
+
+ IProject project = this.rootComponent.getProject();
+ for (String mapping :mappings){
+ if (fileToLook != null && !fileToLook.equals("")){ //$NON-NLS-1$
+ IFile ddFile = project.getFile(new Path(mapping).addTrailingSeparator() + fileToLook);
+ if (ddFile != null && ddFile.exists()){
+ mappingWithDD.add(mapping);
+ }
+ }
+ if (folderToLook != null && !folderToLook.equals("")){ //$NON-NLS-1$
+ IFolder ddFolder = project.getFolder(new Path(mapping).addTrailingSeparator() + folderToLook);
+ if (ddFolder != null && ddFolder.exists()){
+ mappingWithFolder.add(mapping);
+ }
+ }
+ }
+ if (!mappingWithDD.isEmpty()){
+ // return only the mappings that contain a DD file.
+ return new ArrayList<String>(mappingWithDD);
+ }
+ return new ArrayList<String>(mappingWithFolder);
+ }
+
+ private void updateSourceMappingsCombo(String selectedDDFolder, List<String> resourceMappings) {
+
+ List<String> filteredMappings = filterMappings(resourceMappings);
+
+ ArrayList<String> tmpList = new ArrayList<String>(filteredMappings);
+ if (selectedDDFolder == null){
+ tmpList.add(0, Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER);
+ }
+ rootSourceMappings.setItems(tmpList.toArray(new String[]{}));
+ if (selectedDDFolder == null){
+ //No tagged source folder, so select "None"
+ rootSourceMappings.select(tmpList.indexOf(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER));
+ }
+ else {
+ rootSourceMappings.select(tmpList.indexOf(selectedDDFolder.toString()));
+ }
+ }
+
+ private boolean saveDefaultDeploymentDescriptorFolderContents(){
+ if (currentSelectedDDFolder != null){
+ IVirtualFolder rootFolder = rootComponent.getRootFolder();
+ J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(rootFolder, new Path(currentSelectedDDFolder), null);
+ }
+ return true;
+ }
+
+ private IPath[] findAllRootMappings(){
+
+ StructureEdit structureEdit = null;
+ try {
+ structureEdit = StructureEdit.getStructureEditForRead(rootComponent.getProject());
+ WorkbenchComponent component = structureEdit.getComponent();
+ Object[] arr = component.getResources().toArray();
+ Set <IPath> result = new LinkedHashSet<IPath>();
+ for( int i = 0; i < arr.length; i++ ){
+ ComponentResource resource = (ComponentResource)arr[i];
+ if (resource.getRuntimePath().equals(IVirtualComponent.ROOT) && !ResourceMappingFilterExtensionRegistry.shouldFilter(resource.getSourcePath())){
+ result.add(((ComponentResource)arr[i]).getSourcePath());
+ }
+ }
+ return result.toArray(new IPath[]{});
+ } catch (NullPointerException e) {
+ J2EEUIPlugin.logError(e);
+ } finally {
+ if(structureEdit != null)
+ structureEdit.dispose();
+ }
+ return new IPath[]{};
+ }
+
+ protected boolean shouldDisplaySection(){
+ return shouldDisplaySection;
+ }
+
+ /*
+ * Creates the Advanced section. Returns the composite to which all the other
+ * widgets should be added.
+ */
+ private Composite createAdvancedSection(Composite parent){
+
+ // Build the expandable composite
+ ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE
+ | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
+ excomposite.setText(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED);
+ excomposite.setExpanded(false);
+ excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
+ excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1));
+ excomposite.addExpansionListener(new ExpansionAdapter() {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ expandedStateChanged((ExpandableComposite) e.getSource());
+ }
+ });
+
+ // Build the composite has the contents of the expandable widget
+ Composite innerComposite = new Composite(excomposite, SWT.NONE);
+ excomposite.setClient(innerComposite);
+ GridLayout gl = new GridLayout(2, false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ innerComposite.setLayout(gl);
+ return innerComposite;
+ }
+
+ private void addDefaultDeploymentDescriptorFolderFields(Composite parent) {
+ defaulDDFolderLabel = new Label(parent, SWT.NONE);
+ defaulDDFolderLabel.setText(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_DDFOLDER);
+ rootSourceMappings = new Combo(parent, SWT.READ_ONLY);
+ rootSourceMappings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ rootSourceMappings.addSelectionListener(this);
+ }
+
+
+ private final void expandedStateChanged(ExpandableComposite expandable) {
+ // Get the scrolled composite of the deployment assembly page, and the child
+ // composite of this scrolled composite that contains the expandable composite
+ Composite[] composites = getCompositesToResize(expandable);
+ ScrolledComposite parentScrolledComposite = (ScrolledComposite)composites[0];
+ Composite childComposite = composites[1];
+ if (parentScrolledComposite != null && childComposite != null) {
+ parentScrolledComposite.layout(true, true);
+ // Resize the scrolled composite so the scroll bars are shown if necessary
+ parentScrolledComposite.setMinSize(childComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
+
+ }
+ }
+
+ /*
+ * Returns an array of composites used to resize the deployment assembly page
+ * when the advanced section is expanded.
+ * The first element is the scrolled composite (instance of ScrolledComposite) of the
+ * deployment assembly page
+ * The second element is the composite with the contents of the deployment assembly page
+ */
+ private Composite[] getCompositesToResize(Control control) {
+ Control parent = control.getParent();
+ Control previousParent = null;
+ Composite[] result = new Composite[2];
+ while (!(parent instanceof ScrolledComposite) && parent != null) {
+ previousParent = parent;
+ parent = parent.getParent();
+ }
+ if (parent instanceof ScrolledComposite) {
+ result[0] = (ScrolledComposite)parent;
+ }
+ if (previousParent instanceof Composite) {
+ result[1] = (Composite)previousParent;
+ }
+ return result;
+ }
+
+ public void directiveAdded(Object element) {
+ if (shouldDisplaySection()){
+ if (!(element instanceof TaskModel))
+ return;
+ TaskModel model = (TaskModel)element;
+ final Object folderMapping = model.getObject(IReferenceWizardConstants.FOLDER_MAPPING);
+ if( folderMapping != null && folderMapping instanceof ComponentResourceProxy){
+ ComponentResourceProxy proxy = (ComponentResourceProxy)folderMapping;
+ //if ((proxy.runtimePath.equals(IVirtualComponent.ROOT) && !resourceMappingsList.contains(proxy.source.toString()))){
+ if ((proxy.runtimePath.equals(IVirtualComponent.ROOT))){
+ resourceMappingsList.add(proxy.source.toString());
+ updateSourceMappingsCombo(currentSelectedDDFolder, resourceMappingsList);
+ }
+ }
+ }
+ }
+
+ public void directiveRemoved(Object element) {
+ if (shouldDisplaySection()){
+ if( element instanceof ComponentResourceProxy){
+ ComponentResourceProxy proxy = (ComponentResourceProxy)element;
+ if (proxy.runtimePath.equals(IVirtualComponent.ROOT)){
+ String proxySource = proxy.source.toString();
+ if (resourceMappingsList.contains(proxySource)){
+ resourceMappingsList.remove(proxySource);
+ if (proxySource.equals(currentSelectedDDFolder)){
+ currentSelectedDDFolder = null;
+ }
+ updateSourceMappingsCombo(currentSelectedDDFolder, resourceMappingsList);
+ }
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // Intentionally left blank
+
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ if (event.getSource() == rootSourceMappings){
+ String tmp = rootSourceMappings.getText();
+ if (tmp != null){
+ if (tmp.equals(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER) && currentSelectedDDFolder == null){
+ // Do nothing, because the value did not change.
+ return;
+ }
+ if (tmp.equals(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER)){
+ // This means the user selected None, but there was already a value selected (this should not happen)
+ J2EEUIPlugin.logWarning("Unexpected condition when validating deployment descriptor folder"); //$NON-NLS-1$
+ return;
+ }
+ // We now the user selected something different from None, so remove this item so it cannot be selected again
+ if (rootSourceMappings.indexOf(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER) != -1)
+ rootSourceMappings.remove(Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER);
+ // Only refresh if changing from None to a folder
+ boolean shouldRefresh = (currentSelectedDDFolder == null);
+ if (!tmp.equals(currentSelectedDDFolder)){
+ currentSelectedDDFolder = tmp;
+ if (shouldRefresh)
+ page.refresh();
+ }
+ }
+ }
+
+ }
+
+ public IStatus validate(IStatus currentStatus) {
+ IStatus status = currentStatus!=null?currentStatus:Status.OK_STATUS;
+ if (shouldDisplaySection()){
+ if (currentSelectedDDFolder == null && resourceMappingsList.size()>1){
+ // Only show the warning if none of the root mappings is selected and there are more than 1 root mapping
+ int severity = Status.WARNING;
+ status = appendStatusMessage(status, Messages.J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDERWARNING, severity);
+ }
+ }
+ return status;
+ }
+ private IStatus appendStatusMessage(IStatus existingStatus, String message, int severity) {
+ MultiStatus multiStatus;
+ IStatus newStatus = new Status(severity, J2EEUIPlugin.PLUGIN_ID, message);
+ int newSeverity = severity;
+ if(existingStatus.getSeverity() > severity)
+ newSeverity = existingStatus.getSeverity();
+ if(existingStatus instanceof MultiStatus){
+ multiStatus = (MultiStatus)existingStatus;
+ multiStatus.merge(newStatus);
+ } else {
+ if(!existingStatus.isMultiStatus() && existingStatus.isOK()) {
+ return newStatus;
+ }
+ IStatus [] children = new IStatus [] {existingStatus, newStatus};
+ multiStatus = new MultiStatus(J2EEUIPlugin.PLUGIN_ID, newSeverity, children, null, null);
+ }
+ return multiStatus;
+ }
+
+ public void componentResourceModified(ComponentResourceProxy originalResource, ComponentResourceProxy modifiedResource) {
+ if (shouldDisplaySection()){
+ // We are interested only in two cases:
+ // 1. When the deploy path changes from / to any other thing...
+ if (originalResource.runtimePath.isRoot() && !modifiedResource.runtimePath.isRoot()){
+ resourceMappingsList.remove(originalResource.source.toString());
+ if (originalResource.source.toString().equals(currentSelectedDDFolder)){
+ currentSelectedDDFolder = null;
+ }
+ updateSourceMappingsCombo(currentSelectedDDFolder, resourceMappingsList);
+ page.refresh();
+ }
+ // 2. When the deploy path changes from any thing to /
+ else if (!originalResource.runtimePath.isRoot() && modifiedResource.runtimePath.isRoot()){
+ resourceMappingsList.add(originalResource.source.toString());
+ updateSourceMappingsCombo(currentSelectedDDFolder, resourceMappingsList);
+ page.refresh();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/Messages.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/Messages.java
new file mode 100644
index 0000000..9e1b485
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/Messages.java
@@ -0,0 +1,32 @@
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.ui.messages"; //$NON-NLS-1$
+ public static String J2EEDependencyPageProvider_0;
+ public static String J2EEDependencyPageProvider_1;
+ public static String J2EEDependencyPageProvider_2;
+ public static String J2EEDependencyPageProvider_3;
+ public static String J2EEDependencyPageProvider_4;
+ public static String J2EEDependencyPageProvider_5;
+ public static String J2EEModuleDependenciesPropertyPage_0;
+ public static String J2EEModuleDependenciesPropertyPage_1;
+ public static String J2EEModuleDependenciesPropertyPage_2;
+ public static String J2EEModuleDependenciesPropertyPage_3;
+ public static String J2EEModuleDependenciesPropertyPage_4;
+ public static String J2EEModuleDependenciesPropertyPage_5;
+ public static String J2EEModuleDependenciesPropertyPage_6;
+ public static String J2EEModuleDependenciesPropertyPage_ADVANCED;
+ public static String J2EEModuleDependenciesPropertyPage_ADVANCED_DDFOLDER;
+ public static String J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER;
+ public static String J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDERWARNING;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.java
new file mode 100644
index 0000000..00aaeb6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.java
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * Copyright (c) 2008 Oracle
+ * 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:
+ * Konstantin Komissarchik - initial implementation and ongoing maintenance
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
+import org.eclipse.jst.common.project.facet.ui.libprov.osgi.OsgiBundlesLibraryProviderInstallPanel;
+import org.eclipse.jst.j2ee.internal.common.classpath.WtpOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a>
+ */
+
+public class WtpOsgiBundlesLibraryProviderInstallPanel
+
+ extends OsgiBundlesLibraryProviderInstallPanel
+
+{
+ @Override
+ protected Control createFooter( final Composite composite )
+ {
+ final WtpOsgiBundlesLibraryProviderInstallOperationConfig cfg
+ = (WtpOsgiBundlesLibraryProviderInstallOperationConfig) getOperationConfig();
+
+ final Button copyOnPublishCheckBox = new Button( composite, SWT.CHECK );
+ copyOnPublishCheckBox.setText( Resources.copyLibraries );
+ copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() );
+
+ copyOnPublishCheckBox.addSelectionListener
+ (
+ new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected( final SelectionEvent event )
+ {
+ cfg.setIncludeWithApplicationEnabled( copyOnPublishCheckBox.getSelection() );
+ }
+ }
+ );
+
+ final IPropertyChangeListener listener = new IPropertyChangeListener()
+ {
+ public void propertyChanged( final String property,
+ final Object oldValue,
+ final Object newValue )
+ {
+ copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() );
+ }
+ };
+
+ cfg.addListener( listener, WtpOsgiBundlesLibraryProviderInstallOperationConfig.PROP_INCLUDE_WITH_APPLICATION_ENABLED );
+
+ copyOnPublishCheckBox.addDisposeListener
+ (
+ new DisposeListener()
+ {
+ public void widgetDisposed( final DisposeEvent event )
+ {
+ cfg.removeListener( listener );
+ }
+ }
+ );
+
+ return copyOnPublishCheckBox;
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String copyLibraries;
+
+ static
+ {
+ initializeMessages( WtpOsgiBundlesLibraryProviderInstallPanel.class.getName(),
+ Resources.class );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.properties
new file mode 100644
index 0000000..fc11daf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpOsgiBundlesLibraryProviderInstallPanel.properties
@@ -0,0 +1 @@
+copyLibraries = &Include libraries with this application
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.java
new file mode 100644
index 0000000..f457e12
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.java
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * Copyright (c) 2008 Oracle
+ * 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:
+ * Konstantin Komissarchik - initial implementation and ongoing maintenance
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui;
+
+import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
+import org.eclipse.jst.common.project.facet.ui.libprov.user.UserLibraryProviderInstallPanel;
+import org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a>
+ */
+
+public class WtpUserLibraryProviderInstallPanel
+
+ extends UserLibraryProviderInstallPanel
+
+{
+ @Override
+ protected Control createControlNextToManageHyperlink( final Composite composite )
+ {
+ final WtpUserLibraryProviderInstallOperationConfig cfg
+ = (WtpUserLibraryProviderInstallOperationConfig) getOperationConfig();
+
+ final Button copyOnPublishCheckBox = new Button( composite, SWT.CHECK );
+ copyOnPublishCheckBox.setText( Resources.copyLibraries );
+ copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() );
+
+ copyOnPublishCheckBox.addSelectionListener
+ (
+ new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected( final SelectionEvent event )
+ {
+ cfg.setIncludeWithApplicationEnabled( copyOnPublishCheckBox.getSelection() );
+ }
+ }
+ );
+
+ final IPropertyChangeListener listener = new IPropertyChangeListener()
+ {
+ public void propertyChanged( final String property,
+ final Object oldValue,
+ final Object newValue )
+ {
+ copyOnPublishCheckBox.setSelection( cfg.isIncludeWithApplicationEnabled() );
+ }
+ };
+
+ cfg.addListener( listener, WtpUserLibraryProviderInstallOperationConfig.PROP_INCLUDE_WITH_APPLICATION_ENABLED );
+
+ copyOnPublishCheckBox.addDisposeListener
+ (
+ new DisposeListener()
+ {
+ public void widgetDisposed( final DisposeEvent event )
+ {
+ cfg.removeListener( listener );
+ }
+ }
+ );
+
+ return copyOnPublishCheckBox;
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String copyLibraries;
+
+ static
+ {
+ initializeMessages( WtpUserLibraryProviderInstallPanel.class.getName(),
+ Resources.class );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.properties
new file mode 100644
index 0000000..fc11daf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/WtpUserLibraryProviderInstallPanel.properties
@@ -0,0 +1 @@
+copyLibraries = &Include libraries with this application
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/messages.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/messages.properties
new file mode 100644
index 0000000..87c77fd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/messages.properties
@@ -0,0 +1,18 @@
+J2EEDependencyPageProvider_0=Web Deployment Assembly
+J2EEDependencyPageProvider_1=EJB Deployment Assembly
+J2EEDependencyPageProvider_2=Application Client Deployment Assembly
+J2EEDependencyPageProvider_3=Connector Deployment Assembly
+J2EEDependencyPageProvider_4=Deplo&yment Assembly
+J2EEDependencyPageProvider_5=&Manifest Entries
+J2EEModuleDependenciesPropertyPage_0=Add EJB Module Folder...
+J2EEModuleDependenciesPropertyPage_1=Add App Client Module Folder...
+J2EEModuleDependenciesPropertyPage_2=Add Connector Module Folder...
+J2EEModuleDependenciesPropertyPage_3=Assemble packaging structure for this EJB project
+J2EEModuleDependenciesPropertyPage_4=Assemble packaging structure for this Application Client project
+J2EEModuleDependenciesPropertyPage_5=Assemble packaging structure for this Connector project
+J2EEModuleDependenciesPropertyPage_6=Derived References
+J2EEModuleDependenciesPropertyPage_ADVANCED=Advanced
+J2EEModuleDependenciesPropertyPage_ADVANCED_DDFOLDER=Folder for deplo&yment descriptor:
+J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDER=(None)
+J2EEModuleDependenciesPropertyPage_ADVANCED_NODEFAULTDDFOLDERWARNING=A deployment descriptor folder should be selected. See the Advanced section.
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/ClasspathDependencyComponentLabelProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/ClasspathDependencyComponentLabelProvider.java
new file mode 100644
index 0000000..d963d98
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/ClasspathDependencyComponentLabelProvider.java
@@ -0,0 +1,32 @@
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.jst.j2ee.internal.modulecore.util.DummyClasspathDependencyContainerVirtualComponent;
+import org.eclipse.jst.j2ee.internal.wizard.AvailableJarsProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.IVirtualComponentLabelProvider;
+
+public class ClasspathDependencyComponentLabelProvider implements
+ IVirtualComponentLabelProvider {
+
+ public ClasspathDependencyComponentLabelProvider() {
+ // Do nothing
+ }
+
+ public boolean canHandle(IVirtualComponent component) {
+ if( component instanceof DummyClasspathDependencyContainerVirtualComponent)
+ return true;
+ return false;
+ }
+
+ public String getSourceText(IVirtualComponent component) {
+ return Messages.ChildClasspathDependencyDescription;
+ }
+
+ public Image getSourceImage(IVirtualComponent component) {
+ return AvailableJarsProvider.getClasspathDependencyImage();
+ }
+ public void dispose() {
+ // Do nothing
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/CustomEARProjectReferenceWizardFragment.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/CustomEARProjectReferenceWizardFragment.java
new file mode 100644
index 0000000..07ec2b0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/CustomEARProjectReferenceWizardFragment.java
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * Copyright (c) 2009 IBM
+ * 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:
+ * Aidyl Kareh - initial implementation
+ ******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualReference;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ProjectReferenceWizardFragment;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+
+public class CustomEARProjectReferenceWizardFragment extends ProjectReferenceWizardFragment {
+
+ public CustomEARProjectReferenceWizardFragment() {
+ super();
+ }
+
+ @Override
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ super.performFinish(monitor);
+ VirtualReference[] refs = (VirtualReference []) getTaskModel().getObject(IReferenceWizardConstants.FINAL_REFERENCE);
+ for (int i = 0; i < refs.length; i++) {
+ IProject proj = refs[i].getReferencedComponent().getProject();
+ if (JavaEEProjectUtilities.isApplicationClientProject(proj) ||
+ JavaEEProjectUtilities.isEJBProject(proj) ||
+ JavaEEProjectUtilities.isDynamicWebProject(proj) ||
+ JavaEEProjectUtilities.isJCAProject(proj)) {
+ refs[i].setRuntimePath(new Path("/").makeAbsolute()); //$NON-NLS-1$
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependenciesPropertyPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependenciesPropertyPage.java
new file mode 100644
index 0000000..f08563f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependenciesPropertyPage.java
@@ -0,0 +1,457 @@
+/******************************************************************************
+ * Copyright (c) 2009, 2011 Red Hat, IBM
+ * 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:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ * Chuck Bridgham - additional support
+ * Roberto Sanchez - Add Advanced section
+ ******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jst.j2ee.application.internal.operations.AddReferenceToEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.RemoveReferenceFromEnterpriseApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEModuleHandler;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.ui.IJavaEEDeploymentAssemblySectionBuilder;
+import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage.ClasspathEntryProxy;
+import org.eclipse.jst.j2ee.internal.ui.JavaEEComponentDependencyContentProvider;
+import org.eclipse.jst.j2ee.internal.ui.JavaEEDeploymentAssemblyAdvancedSectionBuilder;
+import org.eclipse.jst.j2ee.model.IEARModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.javaee.application.Application;
+import org.eclipse.jst.jee.project.facet.EarCreateDeploymentFilesDataModelProvider;
+import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties;
+import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.wst.common.componentcore.internal.IModuleHandler;
+import org.eclipse.wst.common.componentcore.internal.impl.TaskModel;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ComponentDependencyContentProvider;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.DependencyPageExtensionManager;
+import org.eclipse.wst.common.componentcore.ui.internal.propertypage.DependencyPageExtensionManager.ReferenceExtension;
+import org.eclipse.wst.common.componentcore.ui.internal.taskwizard.TaskWizard;
+import org.eclipse.wst.common.componentcore.ui.propertypage.AddModuleDependenciesPropertiesPage;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants.ProjectConverterOperationProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+public class EarModuleDependenciesPropertyPage extends
+ AddModuleDependenciesPropertiesPage {
+ private String libDir = null;
+ private Text libDirText;
+ private ControlDecoration libDirTextErrorDecoration = null;
+ private static String earDefaultLirDir = new Path(J2EEConstants.EAR_DEFAULT_LIB_DIR).makeRelative().toString();
+ boolean previousLibDirIsValid = true;
+ private IJavaEEDeploymentAssemblySectionBuilder advancedHelper;
+
+ public EarModuleDependenciesPropertyPage(IProject project,
+ ModuleAssemblyRootPage page) {
+ super(project, page);
+ advancedHelper = getAdvancedSectionBuilder();
+ }
+
+ @Override
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ fillTableComposite(composite);
+ if(JavaEEProjectUtilities.isJEEComponent(rootComponent, JavaEEProjectUtilities.DD_VERSION) && JavaEEProjectUtilities.isJEEComponent(rootComponent, JavaEEProjectUtilities.FACET_VERSION))
+ addLibDirComposite(composite);
+ addAdvancedComposite(composite);
+ }
+
+ private String loadLibDirString() {
+ return EarUtilities.getEARLibDir(rootComponent);
+ }
+
+ protected void addLibDirComposite(Composite parent) {
+ libDir = loadLibDirString();
+ if(libDir != null) {
+ Composite c = new Composite(parent, SWT.NONE);
+ GridData mainData = new GridData(GridData.FILL_HORIZONTAL);
+ c.setLayoutData(mainData);
+
+ GridLayout gl = new GridLayout(2,false);
+ gl.marginWidth = 0;
+ gl.marginHeight = 0;
+ c.setLayout(gl);
+ Label l = new Label(c, SWT.NONE);
+ l.setText(Messages.EarModuleDependenciesPropertyPage_LIBDIR);
+ libDirText = new Text(c, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ libDirText.setText(libDir);
+ libDirText.setLayoutData(gd);
+ libDirTextErrorDecoration = new ControlDecoration(libDirText, SWT.TOP | SWT.LEAD);
+ libDirTextErrorDecoration.hide();
+ libDirText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ libDirTextModified();
+ } });
+ new Label(parent, SWT.NONE); //Place holder to fill the second column
+ }
+ }
+
+ protected void libDirTextModified() {
+ boolean refresh = mustRefreshLibDirValidationMessages(libDir, libDirText.getText());
+ libDir = libDirText.getText();
+ if(refresh)
+ propPage.refreshProblemsView();
+ }
+
+ protected boolean mustRefreshLibDirValidationMessages(String oldLibDir, String newLibDir) {
+ boolean newIsValid = isValidLibDir(newLibDir);
+ boolean newIsEmpty = (newLibDir != null && newLibDir.trim().length() == 0);
+ // Both are valid; no need to refresh
+ if(previousLibDirIsValid && newIsValid && !newIsEmpty)
+ return false;
+ boolean oldIsValid = isValidLibDir(oldLibDir);
+ boolean oldIsEmpty = (oldLibDir != null && oldLibDir.trim().length() == 0);
+ // Both are invalid and no change in reason for being invalid; no need to refresh
+ if(!previousLibDirIsValid && oldIsValid == newIsValid && oldIsEmpty == newIsEmpty)
+ return false;
+ return true;
+ }
+
+ protected void validatelibDirText() {
+ if(libDirTextErrorDecoration != null) {
+ if(!isValidLibDir(libDir)) {
+ libDirTextErrorDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
+ libDirTextErrorDecoration.setDescriptionText(Messages.EarModuleDependenciesPropertyPage_ERROR_INVALID_LIBDIR);
+ libDirTextErrorDecoration.show();
+ previousLibDirIsValid = false;
+ }else if(libDir != null && libDir.trim().length() == 0){
+ libDirTextErrorDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage());
+ libDirTextErrorDecoration.setDescriptionText(Messages.EarModuleDependenciesPropertyPage_WARNING_EMPTY_LIB_DIR);
+ libDirTextErrorDecoration.show();
+ previousLibDirIsValid = false;
+ } else if(!previousLibDirIsValid){
+ previousLibDirIsValid = true;
+ libDirTextErrorDecoration.setImage(null);
+ libDirTextErrorDecoration.setDescriptionText(null);
+ libDirTextErrorDecoration.hide();
+ }
+ }
+ }
+
+ private boolean isValidLibDir(String libraryDirectory) {
+ if(libraryDirectory != null && libraryDirectory.trim().length() > 0 && new Path(libraryDirectory.trim()).isAbsolute()) {
+ return false;
+ }
+ return true;
+ }
+
+ protected IDataModelOperation generateEARDDOperation() {
+ IDataModel model = DataModelFactory.createDataModel(new EarCreateDeploymentFilesDataModelProvider());
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, rootComponent);
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, project);
+ return model.getDefaultOperation();
+ }
+
+ @Override
+ public boolean postHandleChanges(IProgressMonitor monitor) {
+ return true;
+ }
+
+ @Override
+ protected void handleRemoved(ArrayList<IVirtualReference> removed) {
+ super.handleRemoved(removed);
+ boolean binariesRemoved = false;
+ for(IVirtualReference ref : removed){
+ IVirtualComponent comp = ref.getReferencedComponent();
+ if(comp.isBinary()){
+ binariesRemoved = true;
+ break;
+ }
+ }
+ if(binariesRemoved){
+ JavaEEBinaryComponentHelper.clearDisconnectedArchivesInEAR(rootComponent);
+ }
+ J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(rootComponent.getProject());
+ }
+
+ @Override
+ protected IDataModelProvider getAddReferenceDataModelProvider(IVirtualReference component) {
+ return new AddReferenceToEnterpriseApplicationDataModelProvider();
+ }
+
+ @Override
+ protected String getModuleAssemblyRootPageDescription() {
+ return Messages.EarModuleDependenciesPropertyPage_3;
+ }
+
+ @Override
+ protected IDataModelProvider getRemoveReferenceDataModelProvider(IVirtualReference component) {
+ return new RemoveReferenceFromEnterpriseApplicationDataModelProvider();
+ }
+
+ @Override
+ protected void filterReferenceTypes( final List<ReferenceExtension> extensions )
+ {
+ // Replace the default one with our own custom one, in class CustomEARProjectReferenceWizardFragment
+
+ for( int i = 0, n = extensions.size(); i < n; i++ )
+ {
+ final ReferenceExtension ext = extensions.get( i );
+
+ if( ext.getId().equals( "org.eclipse.wst.common.componentcore.ui.newProjectReference" ) ) //$NON-NLS-1$
+ {
+ extensions.set( i, DependencyPageExtensionManager.getManager().findReferenceExtension( "org.eclipse.jst.j2ee.internal.ui.preferences.CustomEARProjectReferenceWizardFragment" ) ); //$NON-NLS-1$
+ }
+ }
+ }
+
+ protected void createDD(IProgressMonitor monitor) {
+ if( rootComponent != null ){
+ IDataModelOperation op = generateEARDDOperation();
+ try {
+ op.execute(monitor, null);
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ super.handleEvent(event);
+ }
+
+ @Override
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if(JavaEEProjectUtilities.isJEEComponent(rootComponent, JavaEEProjectUtilities.DD_VERSION) && JavaEEProjectUtilities.isJEEComponent(rootComponent, JavaEEProjectUtilities.FACET_VERSION) && libDir != null)
+ updateLibDir();
+ if (advancedHelper != null)
+ result = result & advancedHelper.saveContents();
+ return result;
+ }
+
+ private void updateLibDir() {
+ if (!libDir.equals(earDefaultLirDir)) {
+ IVirtualFile vFile = rootComponent.getRootFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
+ if (!vFile.exists()) {
+ if (!MessageDialog.openQuestion(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.NO_DD_MSG_TITLE),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.GEN_DD_QUESTION)))
+ return;
+ createDD(new NullProgressMonitor());
+ }
+ }
+
+ final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(project);
+ Application app = (Application)earModel.getModelObject();
+ String oldLibDir = app.getLibraryDirectory();
+ if (libDir.equals(earDefaultLirDir)) {
+ if(oldLibDir != null) {
+ earModel.modify(new Runnable() {
+ public void run() {
+ Application app2 = (Application)earModel.getModelObject();
+ app2.setLibraryDirectory(null);
+ }}, null);
+ }
+ } else if ((oldLibDir != null && !oldLibDir.equals(libDir)) || oldLibDir == null) {
+ earModel.modify(new Runnable() {
+ public void run() {
+ Application app2 = (Application)earModel.getModelObject();
+ app2.setLibraryDirectory(libDir);
+ }}, null);
+ }
+ }
+
+ @Override
+ protected void setCustomReferenceWizardProperties(TaskModel model) {
+ model.putObject(IReferenceWizardConstants.DEFAULT_LIBRARY_LOCATION, libDir);
+ model.putObject(IReferenceWizardConstants.PROJECT_CONVERTER_OPERATION_PROVIDER, getConverterProvider());
+ }
+
+ public ProjectConverterOperationProvider getConverterProvider() {
+ return new ProjectConverterOperationProvider() {
+ public IDataModelOperation getConversionOperation(IProject project) {
+ return J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(project);
+ }
+ };
+ }
+
+ @Override
+ protected IModuleHandler getModuleHandler() {
+ if(moduleHandler == null)
+ moduleHandler = new JavaEEModuleHandler();
+ return moduleHandler;
+ }
+
+ @Override
+ protected ComponentDependencyContentProvider createProvider() {
+ JavaEEComponentDependencyContentProvider provider = new JavaEEComponentDependencyContentProvider(this);
+ provider.setClasspathEntries(new ArrayList<ClasspathEntryProxy>());
+ return provider;
+ }
+
+ @Override
+ protected boolean canRemove(Object selectedObject) {
+ return super.canRemove(selectedObject) && !(selectedObject instanceof JavaEEComponentDependencyContentProvider.ConsumedClasspathEntryProxy);
+ }
+
+ @Override
+ protected void remove(Object selectedItem) {
+ super.remove(selectedItem);
+ advancedHelper.directiveRemoved(selectedItem);
+ }
+
+ @Override
+ public IStatus validate() {
+ IStatus status = super.validate();
+ validatelibDirText();
+ if(libDirTextErrorDecoration != null && libDirTextErrorDecoration.getImage() != null) {
+ int severity = Status.ERROR;
+ if(libDirTextErrorDecoration.getImage().equals(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()))
+ severity = Status.WARNING;
+ status = appendStatusMessage(status, libDirTextErrorDecoration.getDescriptionText(), severity);
+ }
+ status = advancedHelper.validate(status);
+ return status;
+ }
+
+ @Override
+ public void performDefaults() {
+ libDir = loadLibDirString();
+ if(libDir != null)
+ libDirText.setText(libDir);
+ if (advancedHelper != null)
+ advancedHelper.loadContents();
+ super.performDefaults();
+ }
+
+ private IStatus appendStatusMessage(IStatus existingStatus, String message, int severity) {
+ MultiStatus multiStatus;
+ IStatus newStatus = new Status(severity, J2EEUIPlugin.PLUGIN_ID, message);
+ int newSeverity = severity;
+ if(existingStatus.getSeverity() > severity)
+ newSeverity = existingStatus.getSeverity();
+ if(existingStatus instanceof MultiStatus){
+ multiStatus = (MultiStatus)existingStatus;
+ multiStatus.merge(newStatus);
+ } else {
+ if(!existingStatus.isMultiStatus() && existingStatus.isOK()) {
+ return newStatus;
+ }
+ IStatus [] children = new IStatus [] {existingStatus, newStatus};
+ multiStatus = new MultiStatus(J2EEUIPlugin.PLUGIN_ID, newSeverity, children, null, null);
+ }
+ return multiStatus;
+ }
+
+ @Override
+ protected void handleAddDirective( final TaskWizard wizard )
+ {
+ final Object folderMapping = wizard.getTaskModel().getObject(IReferenceWizardConstants.FOLDER_MAPPING);
+
+ if( folderMapping != null && folderMapping instanceof ComponentResourceProxy || libDir == null)
+ {
+ super.handleAddDirective(wizard);
+ }
+ else
+ {
+ Object reference = wizard.getTaskModel().getObject(IReferenceWizardConstants.FINAL_REFERENCE);
+
+ if( reference != null )
+ {
+ IVirtualReference[] referenceArray = reference instanceof IVirtualReference ?
+ new IVirtualReference[] { (IVirtualReference)reference } :
+ (IVirtualReference[])reference;
+ for(int i = 0; i < referenceArray.length; i++) {
+ IVirtualComponent component = referenceArray[i].getReferencedComponent();
+ if(component instanceof VirtualArchiveComponent) {
+ JavaEEQuickPeek qp = JavaEEBinaryComponentHelper.getJavaEEQuickPeek(component);
+ switch (qp.getType()) {
+ case JavaEEQuickPeek.EJB_TYPE:
+ case JavaEEQuickPeek.WEB_TYPE:
+ case JavaEEQuickPeek.APPLICATION_CLIENT_TYPE:
+ case JavaEEQuickPeek.CONNECTOR_TYPE:
+ referenceArray[i].setRuntimePath(new Path("/")); //$NON-NLS-1$
+ }
+ }
+ currentReferences.add(referenceArray[i]);
+ }
+ }
+ }
+ advancedHelper.directiveAdded(wizard.getTaskModel());
+ }
+
+ protected void addAdvancedComposite(Composite parent) {
+ if (advancedHelper != null) {
+ advancedHelper.buildSection(parent);
+ advancedHelper.loadContents();
+ }
+ }
+
+ protected IJavaEEDeploymentAssemblySectionBuilder getAdvancedSectionBuilder(){
+ if (advancedHelper == null){
+ advancedHelper = new JavaEEDeploymentAssemblyAdvancedSectionBuilder(rootComponent, this);
+ }
+ return advancedHelper;
+ }
+
+ @Override
+ protected RuntimePathCellModifier getRuntimePathCellModifier() {
+ return new AddModuleDependenciesPropertiesPage.RuntimePathCellModifier(){
+ @Override
+ public void modify(Object element, String property, Object value) {
+ ComponentResourceProxy originalResource = null;
+ ComponentResourceProxy modifiedResource = null;
+ if (property.equals(DEPLOY_PATH_PROPERTY)) {
+ TreeItem item = (TreeItem) element;
+ if( item.getData() instanceof ComponentResourceProxy) {
+ modifiedResource = (ComponentResourceProxy)item.getData();
+ originalResource = new ComponentResourceProxy(modifiedResource.source, modifiedResource.runtimePath);
+ }
+ }
+ super.modify(element, property, value);
+ if (originalResource != null && advancedHelper != null)
+ advancedHelper.componentResourceModified(originalResource, modifiedResource);
+ }
+ };
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependencyPageProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependencyPageProvider.java
new file mode 100644
index 0000000..4c2724a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/EarModuleDependencyPageProvider.java
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * Copyright (c) 2009 Red Hat, IBM
+ * 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:
+ * Rob Stryker - initial implementation and ongoing maintenance
+ * Chuck Bridgham - Additional support
+ ******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
+import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
+import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class EarModuleDependencyPageProvider implements IDependencyPageProvider {
+
+ public boolean canHandle(IFacetedProject project) {
+ boolean isEAR = project.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE));
+ return isEAR;
+ }
+
+ public IModuleDependenciesControl[] createPages(IFacetedProject project,
+ ModuleAssemblyRootPage parent) {
+ return new IModuleDependenciesControl[] {
+ new EarModuleDependenciesPropertyPage(project.getProject(), parent)
+ };
+ }
+
+ public Composite createRootControl(IFacetedProject project,IModuleDependenciesControl[] pages,
+ Composite parent) {
+ if( pages.length == 1 && pages[0] != null)
+ return pages[0].createContents(parent);
+ return null;
+ }
+
+ public String getPageTitle(IProject project) {
+ return Messages.EarModuleDependencyPageProvider_0;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/IJavaEEPreferencePageExtender.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/IJavaEEPreferencePageExtender.java
new file mode 100644
index 0000000..925a54b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/IJavaEEPreferencePageExtender.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+
+public abstract interface IJavaEEPreferencePageExtender {
+
+ Composite extendPage(Composite parent);
+ void performDefaults();
+ boolean performOk();
+ void dispose();
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePage.java
new file mode 100644
index 0000000..514f5b2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePage.java
@@ -0,0 +1,111 @@
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+public class JavaEEPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Preferences preferences;
+ private String name = J2EEPlugin.DYNAMIC_TRANSLATION_OF_JET_TEMPLATES_PREF_KEY;
+ private Button showReferences;
+ private boolean dynamicTranslation;
+ private ArrayList<IJavaEEPreferencePageExtender> extenders = new ArrayList();
+
+ public JavaEEPreferencePage() {
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVA_EE_PREFERENCE_PAGE_NAME));
+ }
+
+ @Override
+ protected void performDefaults() {
+ preferences.setToDefault(name);
+ J2EEPlugin.getDefault().savePluginPreferences();
+ dynamicTranslation = preferences.getBoolean(name);
+ showReferences.setSelection(dynamicTranslation);
+ for(IJavaEEPreferencePageExtender extender : extenders ){
+ extender.performDefaults();
+ }
+
+ super.performDefaults();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite result= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth= 0;
+ layout.verticalSpacing= convertVerticalDLUsToPixels(10);
+ layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ result.setLayout(layout);
+ Group buttonComposite= new Group(result, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout());
+ buttonComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonComposite.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVA_EE_PREFERENCE_PAGE_JET_TEMPLATE));
+
+ showReferences = new Button(buttonComposite, SWT.CHECK);
+ showReferences.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVA_EE_PREFERENCE_PAGE_DYN_TRANSLATION_BTN_NAME));
+ showReferences.setSelection(dynamicTranslation);
+ showReferences.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ dynamicTranslation = showReferences.getSelection();
+ }
+ });
+ invokeExtensions(result);
+
+ return result;
+ }
+
+ public void init(IWorkbench workbench) {
+ preferences = J2EEPlugin.getDefault().getPluginPreferences();
+ dynamicTranslation = preferences.getBoolean(name);
+ }
+
+ @Override
+ public boolean performOk() {
+ preferences.setValue(name, showReferences.getSelection());
+ J2EEPlugin.getDefault().savePluginPreferences();
+ boolean result = false;
+ for(IJavaEEPreferencePageExtender extender : extenders ){
+ result = extender.performOk();
+ }
+ result = super.performOk();
+ return result;
+ }
+
+
+ protected void invokeExtensions(Composite parent){
+ List<JavaEEPreferencePageExtension> list = JavaEEPreferencePageExtensionReader.getInstance().getJavaEEPageExtenders();
+ for(JavaEEPreferencePageExtension pageExtension : list ){
+ IJavaEEPreferencePageExtender extender = pageExtension.getInstance();
+ extenders.add(extender);
+ extender.extendPage(parent);
+ }
+ }
+
+ @Override
+ public void dispose(){
+ for(IJavaEEPreferencePageExtender extender : extenders ){
+ extender.dispose();
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtension.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtension.java
new file mode 100644
index 0000000..a20e338
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtension.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.wst.common.internal.emf.utilities.Assert;
+
+
+
+
+
+public class JavaEEPreferencePageExtension {
+
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ public static final String JAVAEE_PAGE_EXTENSION = "javaeepageextender"; //$NON-NLS-1$
+
+ private String id = null;
+ private IConfigurationElement element;
+ private IJavaEEPreferencePageExtender instance;
+ private boolean errorCondition = false;
+
+ public JavaEEPreferencePageExtension(){
+ super();
+ }
+
+ private void init() {
+ id = element.getAttribute(ATT_ID);
+ }
+
+ /**
+ * @return Returns the id.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * The id to set.
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public JavaEEPreferencePageExtension(IConfigurationElement element) {
+ Assert.isLegal(JAVAEE_PAGE_EXTENSION.equals(element.getName()), "Extensions must be of the type \"" + JAVAEE_PAGE_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
+ this.element = element;
+ init();
+ }
+
+ public IJavaEEPreferencePageExtender getInstance() {
+ try {
+ if (instance == null && !errorCondition)
+ instance = (IJavaEEPreferencePageExtender) element.createExecutableExtension("className"); //$NON-NLS-1$
+ } catch (Throwable e) {
+ errorCondition = true;
+ }
+ return instance;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtensionReader.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtensionReader.java
new file mode 100644
index 0000000..0dafb31
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/JavaEEPreferencePageExtensionReader.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jem.util.RegistryReader;
+
+
+
+public class JavaEEPreferencePageExtensionReader extends RegistryReader {
+
+ private static JavaEEPreferencePageExtensionReader instance = null;
+ private List<JavaEEPreferencePageExtension> pageExtenders = null;
+
+ public JavaEEPreferencePageExtensionReader(){
+ super("org.eclipse.jst.j2ee.ui", "JavaEEPreferencePageExtender"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ public static JavaEEPreferencePageExtensionReader getInstance() {
+ if (instance == null) {
+ instance = new JavaEEPreferencePageExtensionReader();
+ instance.readRegistry();
+ }
+ return instance;
+ }
+
+ @Override
+ public boolean readElement(IConfigurationElement element) {
+ if (JavaEEPreferencePageExtension.JAVAEE_PAGE_EXTENSION.equals(element.getName())) {
+ addExtension(element);
+ return true;
+ }
+ return false;
+ }
+
+ protected void addExtension(IConfigurationElement newExtension) {
+ getJavaEEPageExtenders().add(new JavaEEPreferencePageExtension(newExtension));
+ }
+
+ public List<JavaEEPreferencePageExtension> getJavaEEPageExtenders() {
+ if (pageExtenders == null)
+ pageExtenders = new ArrayList();
+ return pageExtenders;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/Messages.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/Messages.java
new file mode 100644
index 0000000..2118439
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/Messages.java
@@ -0,0 +1,28 @@
+package org.eclipse.jst.j2ee.internal.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.ui.preferences.messages"; //$NON-NLS-1$
+ public static String EarModuleDependenciesPropertyPage_0;
+ public static String EarModuleDependenciesPropertyPage_1;
+ public static String EarModuleDependenciesPropertyPage_2;
+ public static String EarModuleDependenciesPropertyPage_3;
+ public static String EarModuleDependenciesPropertyPage_LIBDIR;
+ public static String EarModuleDependenciesPropertyPage_ERROR_INVALID_LIBDIR;
+ public static String EarModuleDependenciesPropertyPage_WARNING_EMPTY_LIB_DIR;
+ public static String EarModuleDependencyPageProvider_0;
+ public static String WebDependencyPropertyPage_0;
+ public static String WebDependencyPropertyPage_1;
+ public static String ChildClasspathDependencyDescription;
+ public static String ClasspathDependencyFragmentTitle;
+ public static String ClasspathDependencyFragmentDescription;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/messages.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/messages.properties
new file mode 100644
index 0000000..c839fb5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/preferences/messages.properties
@@ -0,0 +1,13 @@
+EarModuleDependenciesPropertyPage_0=Add Ear Module Folder...
+EarModuleDependenciesPropertyPage_1=Add Ear Module Reference...
+EarModuleDependenciesPropertyPage_2=Edit Ear Module Reference...
+EarModuleDependenciesPropertyPage_3=Define packaging structure for this Java EE Application project.
+EarModuleDependenciesPropertyPage_LIBDIR=EAR &library directory:
+EarModuleDependenciesPropertyPage_ERROR_INVALID_LIBDIR=Library directory value cannot begin with a slash character. Specify as relative path to the root of the project.
+EarModuleDependenciesPropertyPage_WARNING_EMPTY_LIB_DIR=An empty library directory field indicates that no library directory will be used when creating the class paths! Set the value to 'lib' to use the default library directory.
+EarModuleDependencyPageProvider_0=Ear Module Assembly
+WebDependencyPropertyPage_0=Add Web Library Reference...
+WebDependencyPropertyPage_1=Define packaging structure for this Java EE Web Application project.
+ChildClasspathDependencyDescription=Pull in classpath elements from referenced projects.
+ClasspathDependencyFragmentTitle=Manage referenced classpath entries
+ClasspathDependencyFragmentDescription=Here you can adjust which referenced projects' classpath entries should be pulled into this component.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/ContextRootInputPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/ContextRootInputPage.java
new file mode 100644
index 0000000..4c49b49
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/ContextRootInputPage.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.refactoring;
+
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class ContextRootInputPage extends UserInputWizardPage {
+
+ private final RenameContextRootRefactoringProcessor fProcessor;
+ private Text fNameField;
+
+ public ContextRootInputPage(String name, RenameContextRootRefactoringProcessor processor) {
+ super(name);
+ this.fProcessor = processor;
+ }
+
+ public void createControl(Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+
+ Label label = new Label(c, SWT.NONE);
+ label.setText(J2EEUIMessages.getResourceString("NewContextRoot")); //$NON-NLS-1$
+
+ fNameField = new Text(c, SWT.BORDER);
+ fNameField.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
+
+ fNameField.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validatePage();
+ }
+
+ });
+ String oldName = fProcessor.getOldContextRoot();
+ if (oldName != null && oldName.length() > 0) {
+ fNameField.setText(oldName);
+ fNameField.setSelection(0, oldName.length());
+ }
+
+ GridLayoutFactory.swtDefaults().numColumns(2).applyTo(c);
+
+ setControl(c);
+ fNameField.setFocus();
+
+ validatePage();
+ }
+
+ private void validatePage() {
+ String text = fNameField.getText();
+ RefactoringStatus status = fProcessor.validateNewElementName(text);
+ setPageComplete(status);
+ }
+
+ @Override
+ protected boolean performFinish() {
+ initializeRefactoring();
+ return super.performFinish();
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ initializeRefactoring();
+ return super.getNextPage();
+ }
+
+ private void initializeRefactoring() {
+ fProcessor.setNewName(fNameField.getText());
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootChange.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootChange.java
new file mode 100644
index 0000000..f7d1440
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootChange.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+ package org.eclipse.jst.j2ee.internal.ui.refactoring;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+
+import com.ibm.icu.text.UTF16;
+import com.ibm.icu.util.StringTokenizer;
+
+public class RenameContextRootChange extends Change {
+
+ private final IProject project;
+ private final String newContextRoot;
+ private final String oldContextRoot;
+
+ public RenameContextRootChange(IProject project, String newContextRoot, String oldContextRoot) {
+ this.project = project;
+ this.oldContextRoot = oldContextRoot;
+ this.newContextRoot = newContextRoot;
+ }
+
+ @Override
+ public Object getModifiedElement() {
+ return project;
+ }
+
+ @Override
+ public String getName() {
+ return J2EEUIMessages.getResourceString("RenameContextRootFromXtoY", new String[]{oldContextRoot, //$NON-NLS-1$
+ newContextRoot});
+ }
+
+ @Override
+ public void initializeValidationData(IProgressMonitor pm) {
+
+ }
+
+ public static IStatus validateContextRoot(String name) {
+ IStatus status = Status.OK_STATUS;
+ if (name == null || name.length() == 0) {
+ // this was added because the error message shouldnt be shown
+ // initially. It should be shown only if context
+ // root field is edited to
+ status = new Status(IStatus.ERROR, J2EEUIPlugin.PLUGIN_ID,
+ ProjectSupportResourceHandler.getString(
+ ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2,
+ new Object[0]));
+
+ } else if (!(name.indexOf(' ') > -1)) {
+ StringTokenizer stok = new StringTokenizer(name, "."); //$NON-NLS-1$
+ while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ int cp;
+ for (int i = 0; i < token.length(); i += UTF16.getCharCount(cp)) {
+ cp = UTF16.charAt(token, i);
+ if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-')
+ && !(token.charAt(i) == '/')
+ && Character.isLetterOrDigit(token.charAt(i)) == false) {
+ if (Character.isWhitespace(token.charAt(i)) == false) {
+ String invalidCharString = null;
+ if (UTF16.getCharCount(cp)>1)
+ {
+ invalidCharString = UTF16.valueOf(cp);
+ }
+ else
+ {
+ invalidCharString = (new Character(token.charAt(i))).toString();
+ }
+ Object[] invalidChar = new Object[]{invalidCharString};
+ status = new Status(
+ IStatus.ERROR,
+ J2EEUIPlugin.PLUGIN_ID,
+ ProjectSupportResourceHandler
+ .getString(
+ ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root,
+ invalidChar));
+
+ }
+ }
+ }
+ }
+ } // en/ end of if(name.trim
+ else {
+ status = new Status(IStatus.ERROR, J2EEUIPlugin.PLUGIN_ID,
+ ProjectSupportResourceHandler.getString(
+ ProjectSupportResourceHandler.Names_cannot_contain_whitespace_,
+ new Object[0]));
+
+ }
+ return status;
+
+ }
+
+ @Override
+ public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ IStatus phase1 = validateContextRoot(newContextRoot);
+ if (phase1.isOK())
+ return new RefactoringStatus();
+ return RefactoringStatus.create(phase1);
+ }
+
+ @Override
+ public Change perform(IProgressMonitor pm) throws CoreException {
+
+ ComponentUtilities.setServerContextRoot(project, newContextRoot);
+
+ return new RenameContextRootChange(project, oldContextRoot, newContextRoot);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootRefactoringProcessor.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootRefactoringProcessor.java
new file mode 100644
index 0000000..2564e1b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootRefactoringProcessor.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.refactoring;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ParticipantManager;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+
+public class RenameContextRootRefactoringProcessor extends RenameProcessor {
+
+ private IProject fProject;
+ private String fNewName;
+ private boolean fUpdateReferences;
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException, OperationCanceledException {
+ if (!isApplicable())
+ return RefactoringStatus.createErrorStatus(J2EEUIMessages
+ .getResourceString("RefactoringNoInit")); //$NON-NLS-1$
+ return validateNewElementName(fNewName);
+ }
+
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ return new RefactoringStatus();
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ if (isApplicable() && fNewName != null)
+ return new RenameContextRootChange(getProject(), fNewName, getOldContextRoot());
+ return null;
+ }
+
+ @Override
+ public Object[] getElements() {
+ if (getProject() == null)
+ return new Object[0];
+ return new Object[] {
+ getProject()
+ };
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "org.eclipse.jst.j2ee.ChangeContextRootRefactoringProcessor"; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getProcessorName() {
+ return J2EEUIMessages.getResourceString("RenameContextRoot"); //$NON-NLS-1$
+ }
+
+ public IProject getProject() {
+ return fProject;
+ }
+
+ @Override
+ public boolean isApplicable() throws CoreException {
+ return getProject() != null;
+ }
+
+ private RenameArguments getRenameArguments() {
+ return new RenameArguments(fNewName, fUpdateReferences);
+ }
+
+ @Override
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants sharedParticipants) throws CoreException {
+ String[] natures = new String[0];
+ IProject project = getProject();
+ if (project != null && fNewName != null) {
+ natures = project.getDescription().getNatureIds();
+ return ParticipantManager.loadRenameParticipants(status, this, project,
+ getRenameArguments(), natures, sharedParticipants);
+ }
+ return new RefactoringParticipant[0];
+ }
+
+ public void setProject(IProject project) {
+ this.fProject = project;
+ }
+
+ public void setNewName(String newName) {
+ this.fNewName = newName;
+ }
+
+ public void setUpdateReferences(boolean updateReferences) {
+ this.fUpdateReferences = updateReferences;
+ }
+
+ public RefactoringStatus validateNewElementName(String newName) {
+ return RefactoringStatus.create(RenameContextRootChange.validateContextRoot(newName));
+ }
+
+ public String getOldContextRoot() {
+ return J2EEProjectUtilities.getServerContextRoot(getProject());
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootWizard.java
new file mode 100644
index 0000000..2919f8d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/refactoring/RenameContextRootWizard.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.ui.refactoring;
+
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+
+public class RenameContextRootWizard extends RefactoringWizard {
+
+ private boolean prompt = true;
+
+ public RenameContextRootWizard(RenameContextRootRefactoringProcessor processor, int flags) {
+ super(new RenameRefactoring(processor), flags);
+ setDefaultPageTitle(J2EEUIMessages.getResourceString("RenameContextRoot")); //$NON-NLS-1$
+
+ setChangeCreationCancelable(true);
+ setHelpAvailable(false);
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ protected void addUserInputPages() {
+ if (prompt) {
+ addPage(new ContextRootInputPage("", //$NON-NLS-1$
+ (RenameContextRootRefactoringProcessor) getRefactoring().getAdapter(
+ RenameContextRootRefactoringProcessor.class)));
+ }
+ }
+
+ public void setPrompt(boolean prompt) {
+ this.prompt = prompt;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/AnnotationIconDecorator.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/AnnotationIconDecorator.java
new file mode 100644
index 0000000..47b7996
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/AnnotationIconDecorator.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Aug 18, 2004
+ */
+package org.eclipse.jst.j2ee.internal.ui.util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsController;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerHelper;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.ejb.provider.BeanClassProviderHelper;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Add overlay for annotated objects
+ */
+public class AnnotationIconDecorator extends LabelProvider implements ILightweightLabelDecorator {
+
+ protected static final String ANNOTATION_IMAGE_DESC_STRING = "annotation_bean_overlay"; //$NON-NLS-1$
+ protected static final String ANNOTATION_DISABLED_IMAGE_DESC_STRING = "dis_annotation_bean_overlay"; //$NON-NLS-1$
+ private static final ImageDescriptor ANNOTATION_IMG_DESC = getImageDescriptor(ANNOTATION_IMAGE_DESC_STRING);
+ private static final ImageDescriptor ANNOTATION_DISABLED_IMG_DESC = getImageDescriptor(ANNOTATION_DISABLED_IMAGE_DESC_STRING);
+
+ public AnnotationIconDecorator() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object,
+ * org.eclipse.jface.viewers.IDecoration)
+ */
+ private boolean isAnnotatedSupported(EObject target) {
+ boolean bAnnotationSupported = false;
+ if (AnnotationsControllerHelper.INSTANCE.isAnnotated(target)) {
+ bAnnotationSupported = true;
+ }
+ return bAnnotationSupported;
+ }
+
+ private AnnotationsController getControllerForProject(IProject targetProject) {
+ AnnotationsController controller = AnnotationsControllerManager.INSTANCE.getAnnotationsController(targetProject);
+ return controller;
+ }
+
+ public void decorate(Object element, IDecoration decoration) {
+ EObject eObject = null;
+ if (element instanceof BeanClassProviderHelper) {
+ BeanClassProviderHelper beanClassHelper = (BeanClassProviderHelper) element;
+ eObject = beanClassHelper.getEjb();
+ } else if (element instanceof EnterpriseBean || element instanceof Servlet)
+ eObject = (EObject) element;
+ if (eObject == null)
+ return;
+ if (isAnnotatedSupported(eObject)) {
+ if (isAnnotationEnabled(eObject)) {
+ if (ANNOTATION_IMG_DESC != null)
+ decoration.addOverlay(ANNOTATION_IMG_DESC);
+ } else {
+ if (ANNOTATION_DISABLED_IMG_DESC != null)
+ decoration.addOverlay(ANNOTATION_DISABLED_IMG_DESC);
+ }
+ }
+ }
+
+ /**
+ * @param bean
+ * @return
+ */
+ private boolean isAnnotationEnabled(EObject eObject) {
+ IFile annotatedSource = null;
+ /* short circuit if possible */
+ if (AnnotationsControllerManager.INSTANCE.isAnyAnnotationsSupported()) {
+ IProject targetProject = ProjectUtilities.getProject(eObject);
+ AnnotationsController controller = getControllerForProject(targetProject);
+ if (controller != null)
+ annotatedSource = controller.getEnabledAnnotationFile(eObject);
+ }
+ return (annotatedSource != null) ? true : false;
+ }
+
+ public Image decorateImage(Image image, Object element) {
+ return image;
+ }
+
+ /**
+ * @see ILabelDecorator#decorateText(String, Object)
+ */
+ public String decorateText(String text, Object element) {
+ return text;
+ }
+
+ protected static ImageDescriptor getImageDescriptor(String imageFileName) {
+ if (imageFileName != null)
+ return J2EEUIPlugin.getDefault().getImageDescriptor(imageFileName);
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/BinaryProjectUIHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/BinaryProjectUIHelper.java
new file mode 100644
index 0000000..4205656
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/ui/util/BinaryProjectUIHelper.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.ui.util;
+
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.widgets.Shell;
+
+public class BinaryProjectUIHelper {
+
+ public static final String DIALOG_TITLE = J2EEUIMessages.getResourceString("BINARY_PROJECT"); //$NON-NLS-1$
+ public static final String DIALOG_MESSAGE = J2EEUIMessages.getResourceString("ACTION_CANNOT_BE_PERFORMED_ON_BIN_PROJECT"); //$NON-NLS-1$
+
+ /**
+ * Constructor for BinaryProjectUIHelper.
+ */
+ public BinaryProjectUIHelper() {
+ super();
+ }
+
+ public static void displayError(Shell parent) {
+ MessageDialog.openError(parent, DIALOG_TITLE, DIALOG_MESSAGE);
+ return;
+ }
+
+ public static boolean displayErrorIfBinaryProject(Shell parent, IProject aProject) {
+ boolean isBinary = JemProjectUtilities.isBinaryProject(aProject);
+ if (isBinary)
+ displayError(parent);
+ return isBinary;
+ }
+}
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebAppItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebAppItemProvider.java
new file mode 100644
index 0000000..d039bbd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebAppItemProvider.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationWrapper;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppItemProvider;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesClient;
+import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientPackage;
+import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent;
+import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener;
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class J2EEWebAppItemProvider extends WebAppItemProvider {
+
+ private List children = new ArrayList();
+ private boolean isInitializing = false;
+ private WebErrorPageGroupItemProvider webErrorPageGroup;
+ private WebServletGroupItemProvider webServletGroup;
+ private WebServletMappingGroupItemProvider webServletMappingGroup;
+ private WebFiltersGroupItemProvider webFiltersGroup;
+ private WebFilterMappingGroupItemProvider webFilterMappingGroup;
+ private WebReferencesGroupItemProvider webRefsGroup;
+ private WebSecurityGroupItemProvider webSecurityGroup;
+ private J2EEWebServiceClientDDManager clientMgr;
+ private WebListenerGroupItemProvider webListenerGroup;
+ private WebWelcomeFileGroupItemProvider webWelcomeFileGroup;
+ private WebContextParamGroupItemProvider webContextParamGroup;
+
+ /**
+ * Listen and fire updates for 1.3 web service clients
+ */
+ private class J2EEWebServiceClientDDManager extends AdapterImpl implements EditModelListener {
+ WebServicesClient client;
+
+ public J2EEWebServiceClientDDManager(WeakReference weakWebApp) {
+ init();
+ }
+
+ public void init() {
+ // TODO fix up notification
+ // editModel = webServiceMgr.getWSEditModel(ProjectUtilities.getProject(webApp));
+ // if (editModel != null) {
+ // editModel.addListener(this);
+ // if (editModel.get13WebServicesClientResource() != null) {
+ // client = editModel.get13WebServicesClientResource().getWebServicesClient();
+ // if (client != null)
+ // client.eAdapters().add(this);
+ // }
+ // }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener#editModelChanged(org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent)
+ */
+ public void editModelChanged(EditModelEvent anEvent) {
+ // TODO fix up notification
+ // if (editModel == null)
+ // init();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getEventType() == Notification.ADD || notification.getEventType() == Notification.ADD_MANY || notification.getEventType() == Notification.REMOVE || notification.getEventType() == Notification.REMOVE_MANY) {
+ if (notification.getFeatureID(WebServicesClient.class) == Webservice_clientPackage.WEB_SERVICES_CLIENT__SERVICE_REFS) {
+ NotificationWrapper notificationWrapper = new NotificationWrapper(webRefsGroup, notification);
+ fireNotifyChanged(notificationWrapper);
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ public void dispose() {
+ // TODO fix up notification
+
+ webErrorPageGroup.dispose();
+ webContextParamGroup.dispose();
+ webWelcomeFileGroup.dispose();
+ webServletGroup.dispose();
+ webServletMappingGroup.dispose();
+ webFiltersGroup.dispose();
+ webFilterMappingGroup.dispose();
+ webRefsGroup.dispose();
+ webSecurityGroup.dispose();
+ webListenerGroup.dispose();
+
+ weakWebApp = null;
+ if (client != null)
+ client.eAdapters().remove(this);
+ children.clear();
+ }
+ }
+
+ /**
+ * Default constructor
+ */
+ public J2EEWebAppItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * Initialize the list of children
+ */
+ private void initChildren(WebApp webApp) {
+ if (isInitializing)
+ return;
+
+ isInitializing = true;
+ try {
+ children.clear();
+ if (clientMgr == null) {
+ clientMgr = new J2EEWebServiceClientDDManager(weakWebApp);
+ }
+// if (!((WebApp)weakWebApp.get()).getErrorPages().isEmpty()) {
+// children.add(webErrorPageGroup = new WebErrorPageGroupItemProvider(adapterFactory, weakWebApp));
+// } else {
+// WebErrorPageGroupItemProvider child = null;
+// for (int i=0; i < children.size(); i++) {
+// Object object = children.get(i);
+// if (object instanceof WebErrorPageGroupItemProvider) {
+// child = (WebErrorPageGroupItemProvider) object;
+// break;
+// }
+// }
+// if (child != null) {
+// child.dispose();
+// }
+// }
+// if (!((WebApp)weakWebApp.get()).getContextParams().isEmpty()) {
+// children.add(webContextParamGroup = new WebContextParamGroupItemProvider(adapterFactory, weakWebApp));
+// } else {
+// WebContextParamGroupItemProvider child = null;
+// for (int i=0; i < children.size(); i++) {
+// Object object = children.get(i);
+// if (object instanceof WebContextParamGroupItemProvider) {
+// child = (WebContextParamGroupItemProvider) object;
+// break;
+// }
+// }
+// if (child != null) {
+// child.dispose();
+// }
+// }
+// WelcomeFileList welcomeFileList = ((WebApp)weakWebApp.get()).getFileList();
+// if (welcomeFileList != null && !welcomeFileList.getFile().isEmpty()) {
+// children.add(webWelcomeFileGroup = new WebWelcomeFileGroupItemProvider(adapterFactory, weakWebApp));
+// } else {
+// WebWelcomeFileGroupItemProvider child = null;
+// for (int i=0; i < children.size(); i++) {
+// Object object = children.get(i);
+// if (object instanceof WebWelcomeFileGroupItemProvider) {
+// child = (WebWelcomeFileGroupItemProvider) object;
+// break;
+// }
+// }
+// if (child != null) {
+// child.dispose();
+// }
+// }
+
+ children.add(webErrorPageGroup = new WebErrorPageGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webContextParamGroup = new WebContextParamGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webWelcomeFileGroup = new WebWelcomeFileGroupItemProvider(adapterFactory, weakWebApp));
+
+ children.add(webServletGroup = new WebServletGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webServletMappingGroup = new WebServletMappingGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webRefsGroup = new WebReferencesGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webSecurityGroup = new WebSecurityGroupItemProvider(adapterFactory, weakWebApp));
+
+ // show the below nodes only if Web 2.3 and greater
+ if (J2EEVersionUtil.convertVersionStringToInt(webApp.getVersion()) > J2EEVersionConstants.SERVLET_2_2) {
+ children.add(webFiltersGroup = new WebFiltersGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webFilterMappingGroup = new WebFilterMappingGroupItemProvider(adapterFactory, weakWebApp));
+ children.add(webListenerGroup = new WebListenerGroupItemProvider(adapterFactory, weakWebApp));
+ }
+ } finally {
+ isInitializing = false;
+ }
+ }
+
+ protected WeakReference weakWebApp = null;
+
+ @Override
+ public Collection getChildren(Object object) {
+ if (object instanceof WebApp) {
+ WebApp webApp = (WebApp) object;
+ // If uninitialized or web app needs to re-initialize, init the children
+ if(weakWebApp == null || children.isEmpty() || webApp != weakWebApp.get()) {
+ weakWebApp = new WeakReference(webApp);
+ initChildren(webApp);
+ }
+// if (isInitializing) return children;
+// isInitializing = true;
+// updateContextParams(webApp);
+// updateWelcomePages(webApp);
+// isInitializing = false;
+ return children;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ // We only care about adds and removes for the different item provider
+ // groups
+ if (notification.getEventType() == Notification.ADD || notification.getEventType() == Notification.ADD_MANY || notification.getEventType() == Notification.REMOVE || notification.getEventType() == Notification.REMOVE_MANY) {
+ Object notifier = null;
+ switch (notification.getFeatureID(WebApp.class)) {
+ case WebapplicationPackage.WEB_APP__ERROR_PAGES :
+ notifier = webErrorPageGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__CONTEXT_PARAMS :
+ notifier = webContextParamGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__FILE_LIST :
+ notifier = webWelcomeFileGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__SERVLETS :
+ notifier = webServletGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__SERVLET_MAPPINGS :
+ notifier = webServletMappingGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__FILTERS :
+ notifier = webFiltersGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__FILTER_MAPPINGS :
+ notifier = webFilterMappingGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__EJB_LOCAL_REFS :
+ case WebapplicationPackage.WEB_APP__EJB_REFS :
+ case WebapplicationPackage.WEB_APP__MESSAGE_DESTINATION_REFS :
+ case WebapplicationPackage.WEB_APP__RESOURCE_ENV_REFS :
+ case WebapplicationPackage.WEB_APP__RESOURCE_REFS :
+ case WebapplicationPackage.WEB_APP__SERVICE_REFS :
+ notifier = webRefsGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__SECURITY_ROLES :
+ case WebapplicationPackage.WEB_APP__CONSTRAINTS :
+ notifier = webSecurityGroup;
+ break;
+ case WebapplicationPackage.WEB_APP__LISTENERS :
+ notifier = webListenerGroup;
+ break;
+ }
+ if (notifier != null) {
+ NotificationWrapper notificationWrapper = new NotificationWrapper(notifier, notification);
+ fireNotifyChanged(notificationWrapper);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.IDisposable#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (clientMgr != null)
+ clientMgr.dispose();
+ super.dispose();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebItemProviderAdapterFactory.java
new file mode 100644
index 0000000..6882f43
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/J2EEWebItemProviderAdapterFactory.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jst.j2ee.internal.web.providers.WebapplicationItemProviderAdapterFactory;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class J2EEWebItemProviderAdapterFactory extends WebapplicationItemProviderAdapterFactory {
+
+ /**
+ * Default constructor
+ */
+ public J2EEWebItemProviderAdapterFactory() {
+ super();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.webapplication.util.WebapplicationAdapterFactory#createWebAppAdapter()
+ */
+ @Override
+ public Adapter createWebAppAdapter() {
+ if (webAppItemProvider == null)
+ webAppItemProvider = new J2EEWebAppItemProvider(this);
+ return webAppItemProvider;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebContextParamGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebContextParamGroupItemProvider.java
new file mode 100644
index 0000000..65d781e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebContextParamGroupItemProvider.java
@@ -0,0 +1,76 @@
+/*
+ * Created on Mar 29, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebContextParamGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebContextParamGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ if (weakWebApp!=null) {
+ Object webApp = weakWebApp.get();
+ if(null != webApp){
+ result.addAll(((WebApp)webApp).getContextParams());
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("initializ_parameter_context"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Context_Parameters_2"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebErrorPageGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebErrorPageGroupItemProvider.java
new file mode 100644
index 0000000..2806f52
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebErrorPageGroupItemProvider.java
@@ -0,0 +1,76 @@
+/*
+ * Created on Mar 29, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebErrorPageGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebErrorPageGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ if (weakWebApp!=null) {
+ Object webApp = weakWebApp.get();
+ if(null != webApp){
+ result.addAll(((WebApp)webApp).getErrorPages());
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("error_page"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Error_Pages_1"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFilterMappingGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFilterMappingGroupItemProvider.java
new file mode 100644
index 0000000..7d9bfcf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFilterMappingGroupItemProvider.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Jun 11, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jialin
+ */
+public class WebFilterMappingGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebFilterMappingGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory,weakWebApp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ Object webApp = weakWebApp.get();
+ if(null != webApp){
+ return ((WebApp)webApp).getFilterMappings();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("filter_mapping"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Filter_Mappings_1"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFiltersGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFiltersGroupItemProvider.java
new file mode 100644
index 0000000..7191d06
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebFiltersGroupItemProvider.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebFiltersGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebFiltersGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /**
+ * This returns Filter.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("filter"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ Object webApp = weakWebApp.get();
+ if(webApp != null){
+ result.addAll(((WebApp)webApp).getFilters());
+ }
+ return getSortedChildren(result);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Filters_1"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebGroupItemProvider.java
new file mode 100644
index 0000000..9084a9d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebGroupItemProvider.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Aug 11, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.common.Listener;
+import org.eclipse.jst.j2ee.internal.provider.J2EEItemProvider;
+import org.eclipse.jst.j2ee.webapplication.Filter;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+/**
+ * @author jlanuti
+ */
+public abstract class WebGroupItemProvider extends J2EEItemProvider {
+
+ class WebGroupComparator implements Comparator {
+ public int compare(Object o1, Object o2) {
+ if (o1 instanceof Servlet) {
+ Servlet s1 = (Servlet)o1;
+ Servlet s2 = (Servlet)o2;
+ if (s1.getServletName() != null && s2.getServletName() != null)
+ return s1.getServletName().compareTo(s2.getServletName());
+ return -1;
+ }
+ else if (o1 instanceof Filter) {
+ Filter f1 = (Filter) o1;
+ Filter f2 = (Filter) o2;
+ if (f1.getName() != null && f2.getName() != null)
+ return f1.getName().compareTo(f2.getName());
+ return -1;
+ }
+ else if (o1 instanceof Listener) {
+ Listener l1 = (Listener) o1;
+ Listener l2 = (Listener) o2;
+ if (l1.getListenerClassName() != null && l2.getListenerClassName() !=null)
+ return l1.getListenerClassName().compareTo(l2.getListenerClassName());
+ return -1;
+ }
+ else return -1;
+ }
+ }
+
+ protected WeakReference weakWebApp;
+
+ public WebGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory);
+ this.weakWebApp = weakWebApp;
+ }
+
+ public Collection getSortedChildren(List theChildren) {
+ Collections.sort(theChildren, new WebGroupComparator());
+ return theChildren;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ weakWebApp = null;
+ }
+
+
+ @Override
+ public IFile getAssociatedFile() {
+
+ try {
+ WebApp webapp = (WebApp) weakWebApp.get();
+ if(webapp != null && webapp.eResource() != null) {
+ return WorkbenchResourceHelperBase.getIFile(webapp.eResource().getURI());
+ }
+ } catch (Throwable t) {
+
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebListenerGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebListenerGroupItemProvider.java
new file mode 100644
index 0000000..49608e7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebListenerGroupItemProvider.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Jun 11, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jialin
+ */
+public class WebListenerGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebListenerGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /**
+ * This returns Filter.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getDefault().getImage("listener"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ Object webApp = weakWebApp.get();
+ if(webApp != null){
+ result.addAll(((WebApp)webApp).getListeners());
+ }
+ return getSortedChildren(result);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.IItemLabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("LISTENER"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebReferencesGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebReferencesGroupItemProvider.java
new file mode 100644
index 0000000..4a7ca31
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebReferencesGroupItemProvider.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceExtManager;
+import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceHelper;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebReferencesGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebReferencesGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ Object obj = weakWebApp.get();
+ if (null != obj) {
+ WebApp webApp = (WebApp) obj;
+ if (!webApp.getEjbLocalRefs().isEmpty())
+ result.addAll(webApp.getEjbLocalRefs());
+ if (!webApp.getEjbRefs().isEmpty())
+ result.addAll(webApp.getEjbRefs());
+ if (!webApp.getResourceEnvRefs().isEmpty())
+ result.addAll(webApp.getResourceEnvRefs());
+ if (!webApp.getResourceRefs().isEmpty())
+ result.addAll(webApp.getResourceRefs());
+ if (!webApp.getMessageDestinationRefs().isEmpty())
+ result.addAll(webApp.getMessageDestinationRefs());
+ if (!webApp.getServiceRefs().isEmpty())
+ result.addAll(webApp.getServiceRefs());
+ Collection serviceRefs = null;
+ try {
+ WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
+ serviceRefs = serviceHelper.get13ServiceRefs(webApp);
+ } catch (Exception re) {
+ serviceRefs = Collections.EMPTY_LIST;
+ }
+
+ if (serviceRefs != null && !serviceRefs.isEmpty())
+ result.addAll(serviceRefs);
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getDefault().getImage("resourceRef_obj"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("References_1"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebSecurityGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebSecurityGroupItemProvider.java
new file mode 100644
index 0000000..ae99987
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebSecurityGroupItemProvider.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebSecurityGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebSecurityGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Security_1"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ Object obj = weakWebApp.get();
+ if (null != obj) {
+ WebApp webApp = (WebApp) obj;
+ if (!webApp.getSecurityRoles().isEmpty())
+ result.addAll(webApp.getSecurityRoles());
+ if (!webApp.getConstraints().isEmpty())
+ result.addAll(webApp.getConstraints());
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return J2EEPlugin.getPlugin().getImage("security_role");//$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletGroupItemProvider.java
new file mode 100644
index 0000000..16d0bb5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletGroupItemProvider.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebServletGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebServletGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ if (weakWebApp!=null) {
+ Object webApp = weakWebApp.get();
+ if(null != webApp){
+ result.addAll(((WebApp)webApp).getServlets());
+ }
+ }
+ return getSortedChildren(result);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("servlet"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Servlets_1"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletMappingGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletMappingGroupItemProvider.java
new file mode 100644
index 0000000..a356099
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebServletMappingGroupItemProvider.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Jun 11, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * @author jialin
+ */
+public class WebServletMappingGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebServletMappingGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ Object webApp = weakWebApp.get();
+ if (null != webApp) {
+ return ((WebApp) webApp).getServletMappings();
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("servlet_mapping"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Servlet_Mappings_2"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebWelcomeFileGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebWelcomeFileGroupItemProvider.java
new file mode 100644
index 0000000..1bd59f2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/war/ui/util/WebWelcomeFileGroupItemProvider.java
@@ -0,0 +1,80 @@
+/*
+ * Created on Mar 29, 2004
+ */
+package org.eclipse.jst.j2ee.internal.war.ui.util;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFileList;
+
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebWelcomeFileGroupItemProvider extends WebGroupItemProvider {
+
+ /**
+ * @param adapterFactory
+ */
+ public WebWelcomeFileGroupItemProvider(AdapterFactory adapterFactory, WeakReference weakWebApp) {
+ super(adapterFactory, weakWebApp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ List result = new ArrayList();
+ if (weakWebApp!=null) {
+ Object webApp = weakWebApp.get();
+ if (null != webApp) {
+ WelcomeFileList fileList = ((WebApp)webApp).getFileList();
+ if (fileList != null) {
+ result.addAll(fileList.getFile());
+ }
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getImage()
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("welcome_list"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ItemProvider#getText()
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Welcome_Pages_1"); //$NON-NLS-1$
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return !getChildren(object).isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return weakWebApp.get();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java
new file mode 100644
index 0000000..e977b50
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AnnotationsStandaloneGroup.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on Mar 29, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
+
+/**
+ * @author jlanuti
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class AnnotationsStandaloneGroup {
+
+ protected Object model;
+ protected Object synchHelper;
+ protected Button useAnnotations;
+ private boolean isForBean;
+ private boolean useServletString = false;
+ public static final String EJBTAGSET = "ejb"; //$NON-NLS-1$
+
+ /**
+ * Constructor
+ */
+ public AnnotationsStandaloneGroup(Composite parent, Object model, boolean forBean) {
+ this(parent, model, forBean, false);
+ }
+
+ /**
+ * Constructor
+ */
+ public AnnotationsStandaloneGroup(Composite parent, Object model, boolean forBean, boolean useServlet) {
+ super();
+ synchHelper = new DataModelSynchHelper((IDataModel)model);
+ this.model = model;
+ this.isForBean = forBean;
+ this.useServletString = useServlet;
+
+ buildComposites(parent);
+ }
+
+ /**
+ * @param parent
+ */
+ protected void buildComposites(Composite parent) {
+ // Add separator
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ separator.setLayoutData(gd);
+ // Add spacer
+ Label spacer = new Label(parent, SWT.NONE);
+ GridData gd1 = new GridData(GridData.FILL_HORIZONTAL);
+ gd1.horizontalSpan = 3;
+ spacer.setLayoutData(gd1);
+ // Add annotations checkbox and label
+ useAnnotations = new Button(parent, SWT.CHECK);
+ String labelText;
+ if (useServletString)
+ labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.USE_ANNOTATIONS_SERVLET);
+ else if (isForBean)
+ labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.USE_ANNOTATIONS);
+ else
+ labelText = J2EEUIMessages.getResourceString(J2EEUIMessages.ADD_ANNOTATIONS_SUPPORT);
+ useAnnotations.setText(labelText);
+ ((DataModelSynchHelper)synchHelper).synchCheckbox(useAnnotations, IAnnotationsDataModel.USE_ANNOTATIONS, null);
+ GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
+ gd2.horizontalSpan = 2;
+ useAnnotations.setLayoutData(gd2);
+ Dialog.applyDialogFont(parent);
+ }
+
+ public void dispose() {
+ ((IDataModel)model).removeListener((DataModelSynchHelper)synchHelper);
+ synchHelper = null;
+ model = null;
+ }
+
+ public void setEnablement(IProject project) {
+ //TODO Remove - this is to be handled by the provider of the DataModel.
+ }
+
+
+
+ public void setUseServlet(boolean aBoolean) {
+ useServletString = aBoolean;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java
new file mode 100644
index 0000000..85131f7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentExportWizard.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.application.internal.operations.AppClientComponentExportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+/**
+ * <p>
+ * Wizard used to export J2EE Application Client module structures from the Eclipse Workbench to a
+ * deployable Application Client Archive *.jar file.
+ * </p>
+ */
+public final class AppClientComponentExportWizard extends J2EEArtifactExportWizard implements IExportWizard {
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public AppClientComponentExportWizard() {
+ super();
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public AppClientComponentExportWizard(IDataModel model) {
+ super(model);
+ }
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new AppClientComponentExportDataModelProvider();
+ }
+
+ /**
+ * <p>
+ * Adds the following pages:
+ * <ul>
+ * <li>{@link AppClientExportPage}as the main wizard page ({@link #MAIN_PG})
+ * </ul>
+ * </p>
+ */
+ @Override
+ public void doAddPages() {
+ addPage(new AppClientExportPage(getDataModel(), MAIN_PG, getSelection()));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Sets up the default wizard page image.
+ * </p>
+ */
+ @Override
+ protected void doInit() {
+ setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_EXPORT_WIZARD_BANNER));
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java
new file mode 100644
index 0000000..43be19e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportPage.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class AppClientComponentImportPage extends J2EEModuleImportPage {
+ /**
+ * @param model
+ * @param pageName
+ */
+ public AppClientComponentImportPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_IMPORT_WIZARD_BANNER));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
+ */
+ @Override
+ protected String getFileImportLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_FILE_LABEL);
+ }
+
+ @Override
+ protected String getFileNamesStoreID() {
+ return "APP_CLIENT"; //$NON-NLS-1$;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
+ */
+ @Override
+ protected String[] getFilterExpression() {
+ return new String[]{"*.jar"}; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
+ */
+ @Override
+ protected String getProjectImportLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_IMPORT_PROJECT_LABEL);
+ }
+
+ // protected J2EEComponentCreationDataModel getNewProjectCreationDataModel() {
+ // return getAppClientDataModel().getJ2eeArtifactCreationDataModel();
+ // }
+ //
+ // private AppClientModuleImportDataModel getAppClientDataModel() {
+ // return (AppClientModuleImportDataModel) model;
+ // }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ setInfopopID(IJ2EEUIContextIds.IMPORT_APPCLIENT_WIZARD_P1);
+ return super.createTopLevelComposite(parent);
+ }
+
+ @Override
+ protected String getModuleFacetID(){
+ return J2EEProjectUtilities.APPLICATION_CLIENT;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java
new file mode 100644
index 0000000..86c8685
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientComponentImportWizard.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+
+/**
+ * <p>
+ * Wizard used to import J2EE Application Client module structures into the Eclipse Workbench from
+ * an existing Application Client *.jar file.
+ * </p>
+ */
+public final class AppClientComponentImportWizard extends J2EEComponentImportWizard {
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public AppClientComponentImportWizard() {
+ super();
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public AppClientComponentImportWizard(IDataModel model) {
+ super(model);
+ }
+
+ /**
+ * <p>
+ * Adds an {@link AppClientImportPage}as the main wizard page ({@link #MAIN_PG}).
+ * </p>
+ */
+ @Override
+ public void doAddPages() {
+ addPage(new AppClientComponentImportPage(getDataModel(), MAIN_PG));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Sets up the dialog window title and default wizard page image.
+ * </p>
+ */
+ @Override
+ public final void doInit() {
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.IMPORT_WIZ_TITLE));
+ setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_IMPORT_WIZARD_BANNER));
+ }
+
+ @Override
+ protected String[] getModuleValidatorStrings() {
+ return new String[]{"org.eclipse.jst.j2ee.internal.validation.UIApplicationClientValidator"}; //$NON-NLS-1$
+ }
+
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new AppClientComponentImportDataModelProvider();
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_APPCLIENT);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java
new file mode 100644
index 0000000..42dfa68
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AppClientExportPage.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Dec 3, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.client.ApplicationClient;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class AppClientExportPage extends J2EEModuleExportPage {
+ /**
+ * @param model
+ * @param pageName
+ */
+ public AppClientExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
+ super(model, pageName, selection);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_EXPORT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_EXPORT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_EXPORT_WIZARD_BANNER));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
+ */
+ @Override
+ protected String getComponentLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJ_LBL);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
+ */
+ @Override
+ protected String[] getFilterExpression() {
+ return new String[]{"*.jar"}; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
+ */
+ @Override
+ protected boolean isMetaTypeSupported(Object o) {
+ return o instanceof ApplicationClient;
+ }
+
+ @Override
+ protected String getInfopopID() {
+ return IJ2EEUIContextIds.EXPORT_APPCLIENT_WIZARD_P1;
+ }
+
+ @Override
+ protected String getComponentID() {
+ return "JST_APPCLIENT"; //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java
new file mode 100644
index 0000000..9efe700
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableJarsProvider.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
+import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.frameworks.internal.ui.OverlayIcon;
+
+
+public class AvailableJarsProvider implements org.eclipse.jface.viewers.IStructuredContentProvider, org.eclipse.jface.viewers.ITableLabelProvider {
+ protected static Image utilImage;
+ protected static Image invalidImage;
+ protected static Image ejbImage;
+ protected static Image ejbClientImage;
+ protected static Image classpathImage;
+
+ /**
+ * AvailableJarsContentProvider constructor comment.
+ */
+ public AvailableJarsProvider() {
+ super();
+ }
+
+ /**
+ * Adds a listener to this label provider. Has no effect if an identical listener is already
+ * registered.
+ * <p>
+ * Label provider listeners are informed about state changes that affect the rendering of the
+ * viewer that uses this label provider.
+ * </p>
+ *
+ * @param listener
+ * a label provider listener
+ */
+ public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ //do nothing
+ }
+
+ /**
+ * Disposes of this label provider. When a label provider is attached to a viewer, the viewer
+ * will automatically call this method when the viewer is being closed. When label providers are
+ * used outside of the context of a viewer, it is the client's responsibility to ensure that
+ * this method is called when the provider is no longer needed.
+ */
+ public void dispose() {
+ //dispose
+ }
+
+ /**
+ * Returns the label image for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or <code>null</code> indicating that no
+ * input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public org.eclipse.swt.graphics.Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex > 0)
+ return null;
+ ClasspathElement cp = (ClasspathElement) element;
+ if (!cp.isValid())
+ return getInvalidImage();
+
+ if (cp.isClasspathEntry()) {
+ return getClasspathDependencyImage();
+ }
+
+ switch (cp.getJarType()) {
+ case ClasspathElement.EJB_JAR :
+ return getEjbImage();
+ case ClasspathElement.EJB_CLIENT_JAR :
+ return getEjbClientImage();
+ default :
+ return getUtilImage();
+ }
+ }
+
+ /**
+ * Returns the label text for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or <code>null</code> indicating that no
+ * input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ String value = null;
+ switch (columnIndex) {
+ case 0 : {
+ value = ((ClasspathElement) element).getText();
+ break;
+ }
+ case 1 :
+ value = ((ClasspathElement) element).getProjectName();
+ }
+ return value == null ? "" : value;//$NON-NLS-1$
+ }
+
+ public static Image getEjbImage() {
+ if (ejbImage == null)
+ ejbImage = getImageDescriptor("EJBJar").createImage();//$NON-NLS-1$
+ return ejbImage;
+ }
+
+ public static Image getEjbClientImage() {
+ if (ejbClientImage == null)
+ ejbClientImage = getImageDescriptor("ejbclientjar_obj").createImage();//$NON-NLS-1$
+ return ejbClientImage;
+ }
+
+ public static Image getClasspathDependencyImage() {
+ if (classpathImage == null)
+ classpathImage = getImageDescriptor("CPDep").createImage();//$NON-NLS-1$
+ return classpathImage;
+ }
+
+ /**
+ * Returns the elements to display in the viewer when its input is set to the given element.
+ * These elements can be presented as rows in a table, items in a list, etc. The result is not
+ * modified by the viewer.
+ *
+ * @param inputElement
+ * the input element
+ * @return the array of elements to display in the viewer
+ */
+ public java.lang.Object[] getElements(Object inputElement) {
+ ClassPathSelection selection = (ClassPathSelection) inputElement;
+ return filter(selection, selection.getFilterLevel()).toArray();
+ }
+
+ /**
+ * @param list
+ */
+ private List filter(ClassPathSelection selection, int filterLevel) {
+ List list = selection.getClasspathElements();
+ List result = new ArrayList(list.size());
+ for (int i = 0; i < list.size(); i++) {
+ ClasspathElement element = (ClasspathElement) list.get(i);
+ if (!element.isSelected()) {
+ switch (filterLevel) {
+ case (ClassPathSelection.FILTER_EJB_CLIENT_JARS) :
+ if (element.isEJBClientJar())
+ continue;
+ break;
+ case (ClassPathSelection.FILTER_EJB_SERVER_JARS) :
+ if (element.isEJBJar() && selection.getOppositeElement(element) != null)
+ continue;
+ }
+ }
+ result.add(element);
+ }
+ return result;
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ protected static ImageDescriptor getImageDescriptor(String key) {
+ ImageDescriptor imageDescriptor = null;
+
+ URL gifImageURL = (URL) J2EEPlugin.getPlugin().getImage(key);
+ imageDescriptor = ImageDescriptor.createFromURL(gifImageURL);
+ return imageDescriptor;
+ }
+
+ public static Image getInvalidImage() {
+ if (invalidImage == null) {
+ ImageDescriptor base = getImageDescriptor("jar_nonexist_obj");//$NON-NLS-1$
+ ImageDescriptor overlay = getImageDescriptor("warning_co");//$NON-NLS-1$
+ invalidImage = new OverlayIcon(base, new ImageDescriptor[][]{{overlay}}).createImage();
+ }
+ return invalidImage;
+ }
+
+ public static Image getUtilImage() {
+ if (utilImage == null)
+ utilImage = getImageDescriptor("jar_obj").createImage();//$NON-NLS-1$
+ return utilImage;
+ }
+
+ /**
+ * Notifies this content provider that the given viewer's input has been switched to a different
+ * element.
+ * <p>
+ * A typical use for this method is registering the content provider as a listener to changes on
+ * the new input (using model-specific means), and deregistering the viewer from the old input.
+ * In response to these change notifications, the content provider propagates the changes to the
+ * viewer.
+ * </p>
+ *
+ * @param viewer
+ * the viewer
+ * @param oldInput
+ * the old input element, or <code>null</code> if the viewer did not previously
+ * have an input
+ * @param newInput
+ * the new input element, or <code>null</code> if the viewer does not have an input
+ */
+ public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
+ //do nothing
+ }
+
+ /**
+ * Returns whether the label would be affected by a change to the given property of the given
+ * element. This can be used to optimize a non-structural viewer update. If the property
+ * mentioned in the update does not affect the label, then the viewer need not update the label.
+ *
+ * @param element
+ * the element
+ * @param property
+ * the property
+ * @return <code>true</code> if the label would be affected, and <code>false</code> if it
+ * would be unaffected
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * Removes a listener to this label provider. Has no affect if an identical listener is not
+ * registered.
+ *
+ * @param listener
+ * a label provider listener
+ */
+ public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ //do nothing
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java
new file mode 100644
index 0000000..a42118e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilJarsAndWebLibProvider.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Apr 22, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * @author vijayb
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class AvailableUtilJarsAndWebLibProvider implements IStructuredContentProvider, ITableLabelProvider {
+
+ public AvailableUtilJarsAndWebLibProvider() {
+ //Default constructor
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof ArchiveWrapper){
+ ArchiveWrapper wrapper = (ArchiveWrapper)inputElement;
+ List <ArchiveWrapper> utilities = wrapper.getEARUtilitiesAndWebLibs();
+ if (utilities.size() > 0){
+ filterEJBClientJars(utilities, wrapper);
+ Object [] array = utilities.toArray();
+ Arrays.sort(array, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
+ }
+ });
+ return array;
+ }
+ }
+ return new Object[0];
+ }
+
+ /**
+ * @param array
+ * @return
+ */
+ private void filterEJBClientJars(List <ArchiveWrapper> utilities, ArchiveWrapper earWrapper) {
+ List <ArchiveWrapper> modules = earWrapper.getEarModules();
+ for(ArchiveWrapper module : modules){
+ if(module.isEJBJarFile()){
+ ArchiveWrapper clientWrapper = earWrapper.getEJBClientArchiveWrapper(module);
+ if(null != clientWrapper){
+ boolean removed = false;
+ for(int i=0;i<utilities.size() && !removed; i++){
+ if(clientWrapper.getUnderLyingArchive() == utilities.get(i).getUnderLyingArchive()){
+ utilities.remove(i);
+ removed = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return AvailableJarsProvider.getUtilImage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ ArchiveWrapper wrapper = (ArchiveWrapper)element;
+ IPath path = wrapper.getPath();
+ if(path.toString().startsWith(ArchiveConstants.WEBAPP_LIB_URI)){
+ return wrapper.getParent().getName()+"#"+wrapper.getPath(); //$NON-NLS-1$
+ }
+ return wrapper.getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ //Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ //Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
+ * java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ //Auto-generated method stub
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java
new file mode 100644
index 0000000..8dbb87e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/AvailableUtilityJarsProvider.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Apr 22, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author vijayb
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class AvailableUtilityJarsProvider implements IStructuredContentProvider, ITableLabelProvider {
+
+ public AvailableUtilityJarsProvider() {
+ //default constructor
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ /*
+ * Object[] array = EARImportDataModel.getAllUtilities((EARFile) inputElement).toArray();
+ */
+ Object[] array = getJarFilesFromDirectory(inputElement);
+ Arrays.sort(array, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
+ }
+
+ });
+ return array;
+ }
+
+ /**
+ * @param inputElement
+ * @return
+ */
+ private Object[] getJarFilesFromDirectory(Object inputElement) {
+
+ List collectedJars = new ArrayList();
+ IDataModel model = null;
+ if (inputElement instanceof IDataModel)
+ model = (IDataModel) inputElement;
+ if (model != null) {
+
+ String fileName = model.getStringProperty(IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY);
+ File directory = new File(fileName);
+ if (directory.exists() && directory.canRead() && directory.isDirectory()) {
+ File[] availableFiles = directory.listFiles();
+
+ if (availableFiles == null)
+ return new File[0];
+
+ for (int i = 0; i < availableFiles.length; i++)
+ if (availableFiles[i] != null && availableFiles[i].getName().endsWith(IJ2EEModuleConstants.JAR_EXT))collectedJars.add(availableFiles[i]);
+ }
+ }
+ return collectedJars.toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return AvailableJarsProvider.getUtilImage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ /*
+ * FileImpl file = (FileImpl) element; if
+ * (file.getURI().startsWith(ArchiveConstants.WEBAPP_LIB_URI)) { String parentWarFileName =
+ * ((WARFile) file.eContainer()).getName(); return parentWarFileName + "#" + file.getURI();
+ * //$NON-NLS-1$ } else return file.getName();
+ */
+ return element.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ //dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ //do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
+ * java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ //do nothing
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java
new file mode 100644
index 0000000..aa77126
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/DefaultJ2EEComponentCreationWizard.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+/*
+ * Created on Mar 23, 2005
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jst.j2ee.internal.earcreation.DefaultJ2EEComponentCreationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
+
+public class DefaultJ2EEComponentCreationWizard extends DataModelWizard {
+ private static final String SELECTION_PG = "selection"; //$NON-NLS-1$
+
+ /**
+ * @param model
+ */
+ public DefaultJ2EEComponentCreationWizard(IDataModel model) {
+ super(model);
+ initialize();
+ }
+
+ /**
+ *
+ */
+ public DefaultJ2EEComponentCreationWizard() {
+ super();
+ initialize();
+ }
+
+ /**
+ *
+ */
+ private void initialize() {
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_WIZ_TITLE));
+ String iconPath = "icons/full/"; //$NON-NLS-1$
+ try {
+ URL installURL = IDEWorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
+ URL url = new URL(installURL, iconPath + "wizban/new_wiz.png"); //$NON-NLS-1$
+ ImageDescriptor desc = ImageDescriptor.createFromURL(url);
+ setDefaultPageImageDescriptor(desc);
+ } catch (MalformedURLException e) {
+ // Should not happen. Ignore.
+ }
+ setNeedsProgressMonitor(true);
+ setForcePreviousAndNextButtons(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void doAddPages() {
+ addPage(new NewJ2EEComponentSelectionPage(getDataModel(), SELECTION_PG));
+ }
+
+ @Override
+ public boolean canFinish() {
+ if (!super.canFinish()) {
+ return false;
+ }
+ return getDataModel().getBooleanProperty(IDefaultJ2EEComponentCreationDataModelProperties.ENABLED);
+ }
+
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new DefaultJ2EEComponentCreationDataModelProvider();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java
new file mode 100644
index 0000000..0a883f0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportPage.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Dec 3, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class EARComponentExportPage extends J2EEExportPage {
+ /**
+ * @param model
+ * @param pageName
+ */
+ public EARComponentExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
+ super(model, pageName, selection);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_EXPORT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_EXPORT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_EXPORT_WIZARD_BANNER));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
+ */
+ @Override
+ protected String getComponentLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_PROJECT_FOR_MODULE_CREATION);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
+ */
+ @Override
+ protected String[] getFilterExpression() {
+ return new String[]{"*.ear"}; //$NON-NLS-1$
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ protected boolean shouldShowProjectFilesCheckbox() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
+ */
+ @Override
+ protected boolean isMetaTypeSupported(Object o) {
+ return o instanceof Application;
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEComponentExportDataModelProperties.PROJECT_NAME, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING};
+ }
+
+ @Override
+ protected String getInfopopID() {
+ return IJ2EEUIContextIds.EXPORT_EAR_WIZARD_P1;
+ }
+
+ @Override
+ protected String getComponentID() {
+ return "JST_EAR"; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java
new file mode 100644
index 0000000..20a0b78
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentExportWizard.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.application.internal.operations.EARComponentExportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+/**
+ * <p>
+ * Wizard used to export J2EE Enterprise Application structures from the Eclipse Workbench to a
+ * deployable Enterprise Application Archive *.ear file.
+ * </p>
+ */
+public final class EARComponentExportWizard extends J2EEArtifactExportWizard implements IExportWizard {
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public EARComponentExportWizard() {
+ super();
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public EARComponentExportWizard(IDataModel model) {
+ super(model);
+ }
+
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new EARComponentExportDataModelProvider();
+ }
+
+ /**
+ * <p>
+ * Adds the following pages:
+ * <ul>
+ * <li>{@link EARComponentExportPage}as the main wizard page ({@link #MAIN_PG})
+ * </ul>
+ * </p>
+ */
+ @Override
+ public void doAddPages() {
+ addPage(new EARComponentExportPage(getDataModel(), MAIN_PG, getSelection()));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Sets up the default wizard page image.
+ * </p>
+ */
+ @Override
+ protected void doInit() {
+ setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_EXPORT_WIZARD_BANNER));
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java
new file mode 100644
index 0000000..2262415
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportOptionsPage.java
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Dec 8, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class EARComponentImportOptionsPage extends DataModelWizardPage {
+ private Button deselectAllButton;
+ private Button selectAllButton;
+ private Label moduleProjectLocationLabel;
+ protected Button browseButton;
+ protected Button useAlternateRootBtn;
+ protected Text systemDefaultText;
+ protected ArchiveWrapper aWrapper;
+ public CheckboxTableViewer availableJARsViewer;
+ public boolean utilJarSelectionChanged = false;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public EARComponentImportOptionsPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P2);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ createJARsComposite(composite);
+ createProjectRootComposite(composite);
+
+ return composite;
+ }
+
+ /*
+ * Updates the enable state of the all buttons
+ */
+ protected void updateButtonEnablements() {
+ utilJarSelectionChanged = true;
+ }
+
+ protected void createAvailableJarsList(Composite listGroup) {
+ availableJARsViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData gData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ gData.widthHint = 200;
+ gData.heightHint = 80;
+ availableJARsViewer.getControl().setLayoutData(gData);
+ AvailableUtilJarsAndWebLibProvider availableUtilJARsProvider = new AvailableUtilJarsAndWebLibProvider();
+ availableJARsViewer.setContentProvider(availableUtilJARsProvider);
+ availableJARsViewer.setLabelProvider(availableUtilJARsProvider);
+ availableJARsViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ availableJARCheckStateChanged(event);
+ }
+ });
+ availableJARsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtonEnablements();
+ }
+ });
+ TableLayout tableLayout = new TableLayout();
+ availableJARsViewer.getTable().setLayout(tableLayout);
+ availableJARsViewer.getTable().setHeaderVisible(false);
+ availableJARsViewer.getTable().setLinesVisible(false);
+
+ model.addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if (event.getPropertyName().equals(IEARComponentImportDataModelProperties.UTILITY_LIST)) {
+ availableJARsViewer.setCheckedElements(((List) model.getProperty(IEARComponentImportDataModelProperties.UTILITY_LIST)).toArray());
+ }
+ }
+ });
+ }
+
+ private void handleDeselectAllButtonPressed() {
+ ArrayList emptySelection = new ArrayList(2);
+ model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, emptySelection);
+ validatePage();
+ }
+
+ private void handleSelectAllButtonPressed() {
+ ArrayList allSelection = new ArrayList(2);
+ Object selection = null;
+ for (int i = 0; (null != (selection = availableJARsViewer.getElementAt(i))); i++) {
+ allSelection.add(selection);
+ }
+ model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, allSelection);
+ validatePage();
+ }
+
+ /**
+ * Open an appropriate directory browser
+ */
+ protected void handleBrowseButtonPressed() {
+ DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
+ dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
+
+ String dirName = getBrowseStartLocation();
+
+ if (!isNullOrEmpty(dirName)) {
+ File path = new File(dirName);
+ if (path.exists())
+ dialog.setFilterPath(dirName);
+ }
+
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null)
+ systemDefaultText.setText(selectedDirectory);
+
+ }
+
+ protected String getBrowseStartLocation() {
+ String text = systemDefaultText.getText();
+ return text;
+ }
+
+ protected void createButtonsGroup(Composite parent) {
+ Composite buttonGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ buttonGroup.setLayout(layout);
+ buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ selectAllButton = new Button(buttonGroup, SWT.PUSH);
+ selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON));
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ gd.widthHint = 160;
+ selectAllButton.setLayoutData(gd);
+ selectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleSelectAllButtonPressed();
+ }
+ });
+
+ deselectAllButton = new Button(buttonGroup, SWT.PUSH);
+ deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON));
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ gd.widthHint = 160;
+ deselectAllButton.setLayoutData(gd);
+ deselectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeselectAllButtonPressed();
+ }
+ });
+ }
+
+ protected void createJARsComposite(Composite parent) {
+ Group group = new Group(parent, SWT.NULL);
+ group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_JARS_GROUP));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label description = new Label(group, SWT.NULL);
+ description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS));
+ GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd2.horizontalSpan = 3;
+ description.setLayoutData(gd2);
+
+ // create jars check box viewer
+ createAvailableJarsList(group);
+ createButtonsGroup(group);
+ }
+
+ protected void createProjectRootComposite(Composite parent) {
+ Group group = new Group(parent, SWT.NULL);
+ group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_LOCATIONS_GROUP));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label description = new Label(group, SWT.NULL);
+ description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_PROJECT_GROUP_DESCRIPTION));
+ GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd2.horizontalSpan = 3;
+ description.setLayoutData(gd2);
+
+ moduleProjectLocationLabel = new Label(group, SWT.NULL);
+ moduleProjectLocationLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.USE_DEFAULT_ROOT_RADIO));
+ moduleProjectLocationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ systemDefaultText = new Text(group, SWT.READ_ONLY | SWT.WRAP | SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ systemDefaultText.setLayoutData(gd);
+ synchHelper.synchText(systemDefaultText, IEARComponentImportDataModelProperties.NESTED_MODULE_ROOT, null);
+
+ browseButton = new Button(group, SWT.PUSH);
+ browseButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL));
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ browseButton.setLayoutData(gd);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowseButtonPressed();
+ }
+ });
+ }
+
+ private void refreshEARFileIfNecessary() {
+ if (isEARFileChanged()) {
+ aWrapper = (ArchiveWrapper) model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
+ refresh();
+ }
+ }
+
+ protected void setJARsCompositeEnabled(boolean enabled) {
+ availableJARsViewer.getTable().setEnabled(enabled);
+ availableJARsViewer.setAllChecked(false);
+ availableJARsViewer.setAllGrayed(!enabled);
+ selectAllButton.setEnabled(enabled);
+ deselectAllButton.setEnabled(enabled);
+ }
+
+ private void refresh() {
+ availableJARsViewer.setInput(aWrapper);
+ }
+
+ public boolean isEARFileChanged() {
+ return aWrapper != model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
+ }
+
+ @Override
+ protected void enter() {
+ super.enter();
+ refreshEARFileIfNecessary();
+ }
+
+ public void availableJARCheckStateChanged(CheckStateChangedEvent event) {
+ model.setProperty(IEARComponentImportDataModelProperties.UTILITY_LIST, getJARsForProjects());
+ validatePage();
+ }
+
+ public List getJARsForProjects() {
+ refreshEARFileIfNecessary();
+ List result = new ArrayList();
+ result.addAll(Arrays.asList(availableJARsViewer.getCheckedElements()));
+ return result;
+ }
+
+ protected boolean isNullOrEmpty(String aString) {
+ return aString == null || aString.length() == 0;
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{};
+ }
+
+ protected void restoreWidgetValues() {
+ // This page doesn't implement...
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ // This page doesn't implement...
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java
new file mode 100644
index 0000000..9ad4663
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportPage.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on Dec 8, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModelProvider;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class EARComponentImportPage extends J2EEImportPage {
+ protected Combo serverTargetCombo;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public EARComponentImportPage(IDataModel dataModel, String pageName) {
+ super(dataModel, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P1);
+ GridLayout layout = new GridLayout(3, false);
+ composite.setLayout(layout);
+ createFileNameComposite(composite);
+ createProjectNameComposite(composite);
+ createAnnotationsStandaloneGroup(composite);
+ restoreWidgetValues();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ @Override
+ protected String getProjectImportLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_LABEL);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
+ */
+ @Override
+ protected String getFileImportLabel() {
+ return J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_FILE_LABEL);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
+ */
+ @Override
+ protected String[] getFilterExpression() {
+ return new String[]{"*.ear"}; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEModuleImportPage#createAnnotationsStandaloneGroup(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createAnnotationsStandaloneGroup(Composite composite) {
+ // new AnnotationsStandaloneGroup(composite, model, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
+ */
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEComponentImportDataModelProperties.FILE_NAME,
+ IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME,
+ EARComponentImportDataModelProvider.EAR_NAME_VALIDATION,
+ IFacetProjectCreationDataModelProperties.FACET_RUNTIME,
+ IAnnotationsDataModel.USE_ANNOTATIONS,
+ J2EEArtifactImportDataModelProvider.FACET_RUNTIME};
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileNamesStoreID()
+ */
+ @Override
+ protected String getFileNamesStoreID() {
+ return "EAR";//$NON-NLS-1$
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java
new file mode 100644
index 0000000..63fd90a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentImportWizard.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+
+/**
+ * <p>
+ * Wizard used to import J2EE Application structures into the Eclipse Workbench from an existing
+ * Enterprise Application Archive *.ear file.
+ * </p>
+ */
+public final class EARComponentImportWizard extends J2EEArtifactImportWizard{
+
+ /**
+ * <p>
+ * Constant used to identify the key of the Projects page of the Wizard.
+ * </p>
+ */
+ protected static final String PROJECT_PG = "projects"; //$NON-NLS-1$
+
+ /**
+ * <p>
+ * Constant used to identify the key of the Options page of the Wizard.
+ * </p>
+ */
+ protected static final String OPTIONS_PG = "options"; //$NON-NLS-1$
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public EARComponentImportWizard() {
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public EARComponentImportWizard(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * Adds the following pages:
+ * <ul>
+ * <li>{@link EARComponentImportPage}as the main wizard page ({@link #MAIN_PG})
+ * <li>{@link EARComponentImportOptionsPage}as the options wizard page ({@link #OPTIONS_PG})
+ * <li>{@link EARComponentProjectsPage}as the project wizard page ({@link #PROJECT_PG})
+ * </ul>
+ *
+ * </p>
+ */
+ @Override
+ public void doAddPages() {
+ addPage(new EARComponentImportPage(getDataModel(), MAIN_PG));
+ addPage(new EARComponentImportOptionsPage(getDataModel(), OPTIONS_PG));
+ addPage(new EARComponentProjectsPage(getDataModel(), PROJECT_PG));
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * Sets up the dialog window title and default wizard page image.
+ * </p>
+ */
+ @Override
+ protected void doInit() {
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.IMPORT_WIZ_TITLE));
+ setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+
+ }
+
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new EARComponentImportDataModelProvider();
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_EAR);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java
new file mode 100644
index 0000000..aeacb7d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentProjectsPage.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Dec 8, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.datamodel.properties.IEARComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class EARComponentProjectsPage extends DataModelWizardPage {
+
+ private CheckboxTableViewer earFileListViewer;
+
+ public static final String INCLUDE_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_0"); //$NON-NLS-1$
+ public static final String FILE_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_1"); //$NON-NLS-1$
+ public static final String PROJECT_COLUMN = J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_2"); //$NON-NLS-1$
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public EARComponentProjectsPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_PROJECT_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ setInfopopID(IJ2EEUIContextIds.IMPORT_EAR_WIZARD_P3);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ createListGroup(composite);
+ createButtonsGroup(composite);
+
+ return composite;
+ }
+
+ protected void setColumnEditors() {
+ Table t = earFileListViewer.getTable();
+ CellEditor[] columnEditors = new CellEditor[t.getColumnCount()];
+ columnEditors[1] = new TextCellEditor(t);
+
+ earFileListViewer.setCellEditors(columnEditors);
+ }
+
+ protected void createButtonsGroup(Composite parent) {
+ Composite buttonGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ buttonGroup.setLayout(layout);
+ buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Button selectNotInWorkspace = new Button(buttonGroup, SWT.PUSH);
+ selectNotInWorkspace.setText(J2EEUIMessages.getResourceString("EARImportProjectsPage_UI_3")); //$NON-NLS-1$
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ //gd.horizontalSpan = 1;
+ //gd.heightHint = 22;
+ gd.widthHint = 140;
+ selectNotInWorkspace.setLayoutData(gd);
+ selectNotInWorkspace.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ List list = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
+ List selectedList = (List) model.getProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST);
+ List newList = new ArrayList();
+ newList.addAll(selectedList);
+ IDataModel importDM = null;
+ for (int i = 0; i < list.size(); i++) {
+ importDM = (IDataModel) list.get(i);
+ if (!newList.contains(importDM)) {
+ IVirtualComponent tempComponent = (IVirtualComponent) importDM.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
+ if(tempComponent == null || !tempComponent.exists()){
+ newList.add(importDM);
+ }
+ }
+ }
+ model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
+ }
+ });
+
+ Button selectAllButton = new Button(buttonGroup, SWT.PUSH);
+ selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON));
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ //gd.horizontalSpan = 1;
+ //gd.heightHint = 22;
+ gd.widthHint = 140;
+ selectAllButton.setLayoutData(gd);
+ selectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ List list = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
+ List newList = new ArrayList();
+ newList.addAll(list);
+ model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
+ }
+ });
+
+ Button deselectAllButton = new Button(buttonGroup, SWT.PUSH);
+ deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON));
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ ////gd.horizontalSpan = 1;
+ //gd.heightHint = 22;
+ gd.widthHint = 140;
+ deselectAllButton.setLayoutData(gd);
+ deselectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ List newList = new ArrayList();
+ model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, newList);
+ }
+ });
+ }
+
+ @Override
+ public void propertyChanged(DataModelEvent event) {
+ if (event.getPropertyName().equals(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST)) {
+ if(earFileListViewer != null){
+ updateGUICheckSelection();
+ }
+ }
+ super.propertyChanged(event);
+ }
+
+ public void setFileListViewerInput() {
+ TableObjects files = new TableObjects();
+ Iterator iterator = ((List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST)).iterator();
+ while (iterator.hasNext()) {
+ files.tableObjectsList.add(iterator.next());
+ }
+ earFileListViewer.setInput(files);
+ updateGUICheckSelection();
+ }
+
+ private void updateGUICheckSelection() {
+ List selectedList = (List) model.getProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST);
+ List projectList = (List) model.getProperty(IEARComponentImportDataModelProperties.ALL_PROJECT_MODELS_LIST);
+ Object currentElement = null;
+ for (int i = 0; i < projectList.size(); i++) {
+ currentElement = projectList.get(i);
+ earFileListViewer.setChecked(currentElement, selectedList.contains(currentElement));
+ }
+ }
+
+ /**
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.wizard.J2EEWizardPage#enter()
+ */
+ @Override
+ protected void enter() {
+ super.enter();
+ setFileListViewerInput();
+ validatePage();
+ }
+
+ /**
+ * Creates the import source specification widgets. <b>Subclasses </b> must override this hook
+ * method.
+ *
+ * @param parent
+ * a <code>Composite</code> that is to be used as the parent of this group's
+ * collection of visual components
+ * @see org.eclipse.swt.widgets.Composite
+ */
+ protected void createListGroup(org.eclipse.swt.widgets.Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ listGroup.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ listGroup.setLayoutData(gd);
+
+ earFileListViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ EARImportListContentProvider provider = new EARImportListContentProvider();
+ earFileListViewer.setContentProvider(provider);
+ earFileListViewer.setLabelProvider(provider);
+ earFileListViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ List result = new ArrayList();
+ result.addAll(Arrays.asList(earFileListViewer.getCheckedElements()));
+ model.setProperty(IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, result);
+
+ }
+ });
+
+ Table earFileListTable = (Table) earFileListViewer.getControl();
+ earFileListTable.setHeaderVisible(true);
+ earFileListTable.setLinesVisible(true);
+ // set up table layout
+ TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(100, true));
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ earFileListTable.setLayout(tableLayout);
+
+ gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ gd.widthHint = 400;
+ earFileListTable.setLayoutData(gd);
+
+
+ TableColumn fileNameColumns = new TableColumn(earFileListTable, SWT.NONE);
+ fileNameColumns.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_Modules_in_EAR));
+ fileNameColumns.setResizable(true);
+
+ TableColumn importNameColumn = new TableColumn(earFileListTable, SWT.NONE);
+ importNameColumn.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_New_Project_Name));
+ importNameColumn.setResizable(true);
+
+ String[] columnProperties = new String[2];
+ columnProperties[0] = FILE_COLUMN;
+ columnProperties[1] = PROJECT_COLUMN;
+ earFileListViewer.setColumnProperties(columnProperties);
+
+ setColumnEditors();
+ earFileListViewer.setCellModifier(new ICellModifier() {
+ public boolean canModify(Object element, String property) {
+ return PROJECT_COLUMN.equals(property);
+ }
+
+ public Object getValue(Object element, String property) {
+ TableItem[] items = earFileListViewer.getTable().getSelection();
+ TableItem item = items[0];
+ return item.getText(1);
+ }
+
+ public void modify(Object element, String property, Object value) {
+ TableItem elementHolder = (TableItem) element;
+ if (property.equals(PROJECT_COLUMN)) {
+ elementHolder.setText(1, (String) value);
+ ((IDataModel) elementHolder.getData()).setProperty(IJ2EEComponentImportDataModelProperties.PROJECT_NAME, value);
+ }
+ }
+ });
+ }
+
+
+ protected void restoreWidgetValues() {
+ // This page doesn't implement...
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ // This page doesn't implement...
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IEARComponentImportDataModelProperties.SELECTED_MODELS_LIST, EARComponentImportDataModelProvider.NESTED_PROJECTS_VALIDATION};
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java
new file mode 100644
index 0000000..9023251
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARImportListContentProvider.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+
+
+/**
+ * Insert the type's description here. Creation date: (5/7/2001 11:39:11 AM)
+ *
+ * @author: Administrator
+ */
+public class EARImportListContentProvider extends LabelProvider implements IStructuredContentProvider, ITableLabelProvider {
+ /**
+ * EARImportListContentProvider constructor comment.
+ */
+ public EARImportListContentProvider() {
+ super();
+ }
+
+ /**
+ * Returns the elements to display in the viewer when its input is set to the given element.
+ * These elements can be presented as rows in a table, items in a list, etc. The result is not
+ * modified by the viewer.
+ *
+ * @param inputElement
+ * the input element
+ * @return the array of elements to display in the viewer
+ */
+ public java.lang.Object[] getElements(Object inputElement) {
+ if (inputElement instanceof TableObjects) {
+ Object[] array = ((TableObjects) inputElement).getTableObjects().toArray();
+ Arrays.sort(array, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
+ }
+ });
+ return array;
+ }
+ return new Object[0]; // should throw exception instead
+ }
+
+ /**
+ * Returns the label image for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or <code>null</code> indicating that no
+ * input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public org.eclipse.swt.graphics.Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /**
+ * Returns the label text for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or <code>null</code> indicating that no
+ * input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ IDataModel dataModel = (IDataModel) element;
+ if (columnIndex == 0) {
+ ArchiveWrapper wrapper = (ArchiveWrapper) dataModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
+ if (wrapper.getPath().toString().startsWith(ArchiveConstants.WEBAPP_LIB_URI)) {
+ String parentWarFileName = wrapper.getParent().getName();
+ return parentWarFileName + "#" + wrapper.getName(); //$NON-NLS-1$
+ }
+ return wrapper.getPath().toString();
+ } else if (columnIndex == 1) {
+ return dataModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // do nothing
+ }
+
+ @Override
+ public void dispose() {
+ // dispose
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java
new file mode 100644
index 0000000..f45daeb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARLibrariesContainerPage.java
@@ -0,0 +1,67 @@
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
+import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+public class EARLibrariesContainerPage extends NewElementWizardPage implements IClasspathContainerPage, IClasspathContainerPageExtension {
+
+ protected IClasspathEntry entry = null;
+
+ public EARLibrariesContainerPage() {
+ super("EARLibrariesContainerPage"); //$NON-NLS-1$
+ setTitle(EARLibrariesMessages.EARLibrariesContainerPage_0);
+ setDescription(EARLibrariesMessages.EARLibrariesContainerPage_1);
+ }
+
+ public boolean finish() {
+ return true;
+ }
+
+ public IClasspathEntry getSelection() {
+ return JavaCore.newContainerEntry(J2EEComponentClasspathContainer.CONTAINER_PATH);
+ }
+
+ public void setSelection(IClasspathEntry containerEntry) {
+ }
+
+ public void createControl(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ final Text text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
+ text.setText(getDescription());
+ text.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setControl(composite);
+ }
+
+ public void initialize(IJavaProject project, IClasspathEntry[] currentEntries) {
+ }
+
+
+ public static class EARLibrariesMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.wizard.earlibraries"; //$NON-NLS-1$
+
+ public static String EARLibrariesContainerPage_0;
+
+ public static String EARLibrariesContainerPage_1;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, EARLibrariesMessages.class);
+ }
+
+ private EARLibrariesMessages() {
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java
new file mode 100644
index 0000000..7b3772c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARValidationHelper.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.validation.UIEarValidator;
+import org.eclipse.wst.common.frameworks.internal.ui.RunnableWithProgressWrapper;
+import org.eclipse.wst.validation.internal.operations.OneValidatorOperation;
+import org.eclipse.wst.validation.internal.operations.ValidatorManager;
+
+public class EARValidationHelper {
+
+ /**
+ * Constructor for EARValidationHelper.
+ */
+ private EARValidationHelper() {
+ super();
+ }
+
+ /**
+ * Return a list of runnable validation operations for all EAR projects which have auto validate
+ * enabled, and are impacted by the list of projects; If the ear project itself is in the list,
+ * then it is skipped.
+ */
+ public static IRunnableWithProgress[] getEARValidationOperations(List modifiedProjects) {
+ List earProjects = Arrays.asList(J2EEProjectUtilities.getAllProjectsInWorkspaceOfType(J2EEProjectUtilities.ENTERPRISE_APPLICATION));
+ List result = new ArrayList(earProjects.size());
+ for (int i = 0; i < earProjects.size(); i++) {
+ IProject earProj = (IProject) earProjects.get(i);
+ if (willEARProjectNeedValidation(earProj, modifiedProjects)) {
+ result.add(createValidationRunnable(earProj));
+ }
+ }
+ return (IRunnableWithProgress[]) result.toArray(new IRunnableWithProgress[result.size()]);
+ }
+
+ /**
+ * Return a list of runnable validation operations for all EAR projects which have auto validate
+ * enabled, and are impacted by the j2ee project
+ */
+ public static IRunnableWithProgress[] getEARValidationOperations(IProject modifiedJ2EEProject) {
+ return getEARValidationOperations(Collections.singletonList(modifiedJ2EEProject));
+ }
+
+ public static boolean isEARValidationAutoEnabled(IProject earProj) {
+ return ValidatorManager.getManager().isAutoValidate(earProj) && ValidatorManager.getManager().isEnabled(earProj, UIEarValidator.VALIDATOR_ID);
+ }
+
+ private static boolean willEARProjectNeedValidation(IProject earProj, List modifiedProjects) {
+ if (modifiedProjects.contains(earProj) || !isEARValidationAutoEnabled(earProj))
+ return false;
+ //TODO migrate to use artifact edits and components
+// Object accessorKey = new Object();
+// EAREditModel editModel = runtime.getEarEditModelForRead(accessorKey);
+// try {
+// for (int i = 0; i < modifiedProjects.size(); i++) {
+// if (editModel.hasMappingToProject((IProject) modifiedProjects.get(i)))
+// return true;
+// }
+// } finally {
+// if (editModel != null)
+// editModel.releaseAccess(accessorKey);
+// }
+ return false;
+ }
+
+ /**
+ * Creates a new IRunnableWithProgress which runs a one validator operation on the EAR project
+ */
+ public static IRunnableWithProgress createValidationRunnable(IProject earProj) {
+ OneValidatorOperation op = new OneValidatorOperation(earProj, UIEarValidator.VALIDATOR_ID, true, false);
+
+ return new RunnableWithProgressWrapper(op);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java
new file mode 100644
index 0000000..8ca0623
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactExportWizard.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.plugin.CommonEditorUtility;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
+
+/**
+ * <p>
+ * Serves as a base class for Wizards which export J2EE artifact structures from Eclipse projects
+ * into a deployable form.
+ * </p>
+ * <p>
+ * Subclasses must provide the methods that are required by
+ * {@link com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard}.
+ * </p>
+ * <p>
+ * Optionally, subclasses may also override the following methods:
+ * <ul>
+ * <li>{@link #doInit()()}
+ * <li>{@link #doDispose()()}
+ * </ul>
+ * </p>
+ * <p>
+ * The base class will ensure that the Wizard is not spawned unless all open editors are in a
+ * non-dirty state. Additionally, the selection from the active view which spanwed the wizard will
+ * be made available to subclasses via {@link #getSelection()}.
+ * </p>
+ */
+public abstract class J2EEArtifactExportWizard extends DataModelWizard {
+
+ /**
+ * <p>
+ * Constant used to identify the key of the main page of the Wizard.
+ * </p>
+ */
+ protected static final String MAIN_PG = "main"; //$NON-NLS-1$
+
+ private IStructuredSelection currentSelection;
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public J2EEArtifactExportWizard() {
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString("67"));//$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public J2EEArtifactExportWizard(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString("67"));//$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * Invoked from init(IWorkbench, IStructuredSelection) once the workbench and selection have
+ * been safely stored away.
+ * </p>
+ * <p>
+ * No-op by default.
+ * </p>
+ */
+ protected void doInit() {
+ //init
+ }
+
+ /**
+ * <p>
+ * Invoked from {@link #dispose()}. Should be used to handle any specific Wizard disposal.
+ * </p>
+ */
+ private void doDispose() {
+ //dispose
+ }
+
+ /**
+ * <p>
+ * The selection is used to pre-populate values in the Wizard dialog controls.
+ * </p>
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ *
+ * @param workbench
+ * the current workbench parent of the wizard
+ * @param aSelection
+ * the selection from the view used to start the wizard (if any)
+ */
+ public final void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EXPORT_WIZ_TITLE));
+ this.currentSelection = selection;
+
+//TODO: enable selection defaults
+// if (this.currentSelection.size() > 0) {
+// Object element = this.currentSelection.getFirstElement();
+// IProject project = ProjectUtilities.getProject(element);
+// if (project != null) {
+// IDataModel m = getDataModel();
+// Object originalProjectName = m.getProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME);
+// m.setProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME, project.getName());
+// if (!m.validateProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME).isOK()) {
+// m.setProperty(IJ2EEComponentExportDataModelProperties.COMPONENT_NAME, originalProjectName);
+// }
+// }
+// }
+ setNeedsProgressMonitor(true);
+ doInit();
+ }
+
+ /**
+ * <p>
+ * Calls {@link #doDispose()}and then nulls out fields that are no longer needed once the
+ * wizard completes.
+ * </p>
+ *
+ * @see com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#dispose()
+ */
+ @Override
+ public final void dispose() {
+ super.dispose();
+ doDispose();
+ this.currentSelection = null;
+ }
+
+ @Override
+ protected final boolean prePerformFinish() {
+ if (!CommonEditorUtility.promptToSaveAllDirtyEditors()) {
+ return false;
+ }
+ if (CommonEditorUtility.getDirtyEditors().length != 0) { // all checkboxes were not selected
+ return false;
+ }
+ return super.prePerformFinish();
+ }
+
+ /**
+ * @return Returns the currentSelection.
+ */
+ protected final IStructuredSelection getSelection() {
+ return currentSelection;
+ }
+
+ /**
+ * @return
+ */
+ protected final J2EEExportPage getMainPage() {
+ return (J2EEExportPage) getPage(MAIN_PG);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java
new file mode 100644
index 0000000..39a1e62
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEArtifactImportWizard.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.plugin.CommonEditorUtility;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
+import org.eclipse.wst.web.internal.DelegateConfigurationElement;
+
+/**
+ * <p>
+ * Serves as a base class for Wizards which import J2EE artifact structures into Eclipse projects.
+ * </p>
+ * <p>
+ * Subclasses must provide the methods that are required by
+ * {@see org.eclipse.wst.common.frameworks.internal.ui.WTPWizard}.
+ * </p>
+ * <p>
+ * Optionally, subclasses may also override the following methods:
+ * <ul>
+ * <li>{@link #getFinalPerspectiveID()}
+ * <li>{@link #doInit()()}
+ * <li>{@link #doDispose()()}
+ * </ul>
+ * </p>
+ * <p>
+ * The base class will ensure that the Wizard is not spawned unless all open editors are in a
+ * non-dirty state. Additionally, the selection from the active view which spanwed the wizard will
+ * be made available to subclasses via {@link #getCurrentSelection()}.
+ * </p>
+ */
+public abstract class J2EEArtifactImportWizard extends DataModelWizard implements IImportWizard, IExecutableExtension {
+
+ /**
+ * <p>
+ * Constant used to identify the key of the main page of the Wizard.
+ * </p>
+ */
+ protected static final String MAIN_PG = "main"; //$NON-NLS-1$
+
+ private IConfigurationElement configurationElement;
+ private IStructuredSelection selection;
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public J2EEArtifactImportWizard() {
+ super();
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public J2EEArtifactImportWizard(IDataModel model) {
+ super(model);
+ }
+
+ /**
+ * <p>
+ * The selection is used to pre-populate values in the Wizard dialog controls.
+ * </p>
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ *
+ * @param workbench
+ * the current workbench parent of the wizard
+ * @param aSelection
+ * the selection from the view used to start the wizard (if any)
+ */
+ public final void init(IWorkbench workbench, IStructuredSelection aSelection) {
+ this.selection = aSelection;
+ setNeedsProgressMonitor(true);
+ doInit();
+ }
+
+ /**
+ * <p>
+ * Calls {@link #doDispose()}and then nulls out fields that are no longer needed once the
+ * wizard completes.
+ * </p>
+ *
+ * @see com.ibm.etools.j2ee.common.wizard.datamodel.WTPWizard#dispose()
+ */
+ @Override
+ public final void dispose() {
+ super.dispose();
+ doDispose();
+ this.selection = null;
+ this.configurationElement = null;
+ }
+
+ /**
+ * <p>
+ * Invoked after the selection has been saved off in
+ * {@link #init(IWorkbench, IStructuredSelection)}. Should be used to handle any specific
+ * Wizard initialization.
+ * </p>
+ */
+ protected void doInit() {
+ // init
+ }
+
+ /**
+ * <p>
+ * Invoked from {@link #dispose()}. Should be used to handle any specific Wizard disposal.
+ * </p>
+ */
+ protected void doDispose() {
+ // dispose
+ }
+
+ /**
+ * <p>
+ * The return value of this method will be used to suggest a final perspective to the user once
+ * the wizard completes.
+ * </p>
+ *
+ * @return Returns the J2EE Perpsective ID by default
+ */
+ protected String getFinalPerspectiveID() {
+ return null;
+ }
+
+ /**
+ * <p>
+ * Prompts the user to save open, dirty editors.
+ * </p>
+ *
+ * @return true only if all editors are saved
+ */
+ @Override
+ protected final boolean prePerformFinish() {
+ if (!CommonEditorUtility.promptToSaveAllDirtyEditors()) {
+ return false;
+ }
+ //Must have selected to not save, but should close all remaining
+ CommonEditorUtility.closeAllEditors();
+ return super.prePerformFinish();
+ }
+
+ /**
+ * <p>
+ * Invoked after the user has clicked the "Finish" button of the wizard. The default
+ * implementation will attempt to update the final perspective to the value specified by
+ * {@link #getFinalPerspectiveID() }
+ * </p>
+ *
+ * @throws InvocationTargetException
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
+ */
+ @Override
+ protected final void postPerformFinish() throws InvocationTargetException {
+ super.postPerformFinish();
+ if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0) {
+ final IConfigurationElement element = new DelegateConfigurationElement(configurationElement) {
+ @Override
+ public String getAttribute(String aName) {
+ if (aName.equals("finalPerspective")) { //$NON-NLS-1$
+ return getFinalPerspectiveID();
+ }
+ return super.getAttribute(aName);
+ }
+ };
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ BasicNewProjectResourceWizard.updatePerspective(element);
+ }
+ });
+ } else {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ BasicNewProjectResourceWizard.updatePerspective(configurationElement);
+ }
+ });
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * The configuration element is saved to use when the wizard completes in order to change the
+ * current perspective using either (1) the value specified by {@see #getFinalPerspectiveID()}
+ * or (2) the value specified by the finalPerspective attribute in the Wizard's configuration
+ * element.
+ * </p>
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ public final void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ this.configurationElement = config;
+ }
+
+ /**
+ * @return Returns the selection.
+ */
+ protected final IStructuredSelection getSelection() {
+ return selection;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java
new file mode 100644
index 0000000..ddea293
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentFacetCreationWizardPage.java
@@ -0,0 +1,260 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2011 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
+ *******************************************************************************/
+/*
+ * Created on Nov 10, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
+
+public abstract class J2EEComponentFacetCreationWizardPage extends DataModelFacetCreationWizardPage {
+
+ private static final String STORE_LABEL = "LASTEARNAME_"; //$NON-NLS-1$
+
+ protected EarSelectionPanel earPanel;
+
+ private boolean shouldAddEARComposite = true;
+
+
+
+ public J2EEComponentFacetCreationWizardPage(IDataModel dataModel, String pageName) {
+ super(dataModel, pageName);
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ final Composite top = super.createTopLevelComposite(parent);
+ if(isShouldAddEARComposite()){
+ createEarComposite(top);
+ createWorkingSetGroupPanel(top, new String[] { RESOURCE_WORKING_SET, JAVA_WORKING_SET });
+ }
+ return top;
+ }
+
+ private void createEarComposite(Composite top)
+ {
+ final IFacetedProjectWorkingCopy fpjwc
+ = (IFacetedProjectWorkingCopy) this.model.getProperty( FACETED_PROJECT_WORKING_COPY );
+
+ final String moduleFacetId = getModuleFacetID();
+ final IProjectFacet moduleFacet = ProjectFacetsManager.getProjectFacet( moduleFacetId );
+ final IFacetedProject.Action action = fpjwc.getProjectFacetAction( moduleFacet );
+
+ earPanel = new EarSelectionPanel( (IDataModel) action.getConfig(), top );
+ }
+
+ protected abstract String getModuleFacetID();
+
+ @Override
+ protected String getModuleTypeID() {
+ return getModuleFacetID();
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (earPanel != null)
+ earPanel.dispose();
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ super.storeDefaultSettings();
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ String facetID = getModuleFacetID();
+ IDataModel j2eeModel = map.getFacetDataModel(facetID);
+ if(j2eeModel.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)){
+ String lastEARName = j2eeModel.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME);
+ settings.put(STORE_LABEL, lastEARName);
+ }
+ }
+ }
+
+ @Override
+ public void restoreDefaultSettings() {
+ //get the values from the selected EAR to restore.
+ IProject selectedEARProject = getSelectedEAR();
+ if (selectedEARProject != null){
+ restoreEARName(selectedEARProject);
+ restoreEARRuntime(selectedEARProject);
+ } else{
+ restoreStoredLabelEARName();
+ }
+ super.restoreDefaultSettings();
+ }
+
+ /* Restore the EAR Name from the user selected EAR if there is any
+ * @param earName
+ */
+ private void restoreEARName(IProject earProject){
+ String earName = earProject.getName();
+ if (earName != null){
+ setEarName(earName, false);
+ }
+ }
+
+ /* Restore the EAR Name from the last created EAR Project
+ */
+ private void restoreStoredLabelEARName(){
+ IDialogSettings settings = getDialogSettings();
+ String earName = settings.get(STORE_LABEL);
+ if (earName != null){
+ setEarName(earName, true); //last ear created, old behavior
+ }
+ }
+
+ /* Sets the EAR Name to the the J2ee model and model
+ * @param String EAR Project Name
+ * @param boolean specifying if only the LAST_EAR_NAME property should be updated.
+ */
+ private void setEarName(String earName, boolean lastEAROnly) {
+ if (earName != null){
+ FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ String facetID = getModuleFacetID();
+ IDataModel j2eeModel = map.getFacetDataModel(facetID);
+ j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.LAST_EAR_NAME, earName);
+ if (!lastEAROnly)
+ j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME, earName);
+
+ }
+ }
+
+ /* Sets the Runtime to the J2EE model and common model
+ * @param IProject
+ */
+ public void restoreEARRuntime(IProject proj) {
+ FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ String facetID = getModuleFacetID();
+ IDataModel j2eeModel = map.getFacetDataModel(facetID);
+ IRuntime currentRuntime = getTargetRuntime(proj);
+ if (currentRuntime != null){
+ j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.RUNTIME_TARGET_ID, currentRuntime);
+ model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, currentRuntime);
+ }
+
+ }
+
+ /* Gets the Runtime from the user selected EAR if there is any
+ * @param IRuntime
+ */
+ public static IRuntime getTargetRuntime(IProject project) {
+ IFacetedProject fProject = null;
+ try {
+ fProject = ProjectFacetsManager.create(project);
+ } catch (CoreException ex) {
+ J2EEUIPlugin.logError(ex);
+ }
+ if(fProject != null)
+ return fProject.getRuntime() ;
+ return null;
+ }
+
+ /*
+ * Gets the EAR Name selected on the view (ActivePart).
+ * @return IProject or null if there is nothing selected.
+ */
+ private IProject getSelectedEAR(){
+ IProject retVal = null;
+ ISelection selection = getSelectionFromWorkbenchWindow();
+ if (selection instanceof IStructuredSelection) {
+ IProject selProject = getEARProjectFromSelection((IStructuredSelection)selection);
+ if (selProject != null){
+ if (JavaEEProjectUtilities.isEARProject(selProject)) {
+ retVal = selProject;
+ }
+ }
+ }
+ return retVal;
+ }
+
+ /*
+ * Gets the Selection from Workbench Window.
+ * @return ISelection
+ */
+ private ISelection getSelectionFromWorkbenchWindow() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ISelection selection = window.getSelectionService().getSelection();
+ return selection;
+ }
+
+
+ /*
+ * Extract the first element selected and checks for an EAR Project
+ * @param IStructuredSelection selection
+ * @return IProject EAR or null if there is Not selected EAR project.
+ */
+ private IProject getEARProjectFromSelection(IStructuredSelection selection) {
+ if (selection != null){
+ if (!selection.isEmpty()){
+ Object firstSelectedElement = selection.getFirstElement();
+ if (firstSelectedElement instanceof IProject) {
+ return (IProject)firstSelectedElement;
+
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return J2EEUIPlugin.getDefault().getDialogSettings();
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ String[] superProperties = super.getValidationPropertyNames();
+ List list = Arrays.asList(superProperties);
+ ArrayList arrayList = new ArrayList();
+ arrayList.addAll( list );
+ arrayList.add( IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME );
+ arrayList.add( IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR );
+ arrayList.add( IJ2EEFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ return (String[])arrayList.toArray( new String[0] );
+ }
+
+ protected boolean isShouldAddEARComposite() {
+ return shouldAddEARComposite;
+ }
+
+ protected void setShouldAddEARComposite(boolean shouldAddEARComposite) {
+ this.shouldAddEARComposite = shouldAddEARComposite;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java
new file mode 100644
index 0000000..f685333
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentImportWizard.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * <p>
+ * Serves as a base class for Wizards which import J2EE module structures into Eclipse projects.
+ * </p>
+ * <p>
+ * Import wizards must define the following methods:
+ * <ul>
+ * <li>{@link #getImportOperation()}
+ * <li>{@link #getModuleValidatorStrings()}
+ * </ul>
+ * </p>
+ * <p>
+ * And optionally, they may override the following methods from
+ * {@see org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactImportWizard}:
+ * <ul>
+ * <li>{@link #getFinalPerspectiveID()}
+ * <li>{@link #doInit()()}
+ * <li>{@link #doDispose()()}
+ * </ul>
+ */
+public abstract class J2EEComponentImportWizard extends J2EEArtifactImportWizard {
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public J2EEComponentImportWizard() {
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public J2EEComponentImportWizard(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString("38"));//$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * The Import Wizards can run arbitrary validators once the module has been created. These
+ * validators ensure that the structure created by the Import operation and the contents of that
+ * structure are valid. Any errors will be announced to the Problems view in Eclipse.
+ * </p>
+ *
+ * @return An array of validator IDs that should be used for this module type
+ */
+ protected abstract String[] getModuleValidatorStrings();
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java
new file mode 100644
index 0000000..99e1cd8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEComponentLabelProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Milen Manov, milen.manov@sap.com - bugs 248623
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.swt.graphics.Image;
+
+public class J2EEComponentLabelProvider extends LabelProvider {
+
+ ITableLabelProvider tableLableProvider;
+
+ private J2EEComponentLabelProvider instance;
+
+ public J2EEComponentLabelProvider(ITableLabelProvider tableLableProvider){
+ this.tableLableProvider = tableLableProvider;
+ instance = this;
+ tableLableProvider.addListener(new ILabelProviderListener(){
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent(instance);
+ fireLabelProviderChanged(newEvent);
+ }
+ });
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ return tableLableProvider.getColumnImage(element, 1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ return tableLableProvider.getColumnText(element, 1);
+// if(element instanceof IVirtualComponent){
+// IVirtualComponent comp = (IVirtualComponent)element;
+// return comp.getProject().getName();
+// }
+//
+// if (element instanceof IProject) {
+// IProject handle = (IProject)element;
+// return handle.getName();
+// }
+// return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java
new file mode 100644
index 0000000..01df3cd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEExportPage.java
@@ -0,0 +1,575 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on Dec 3, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.IArchiveExportParticipantData;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory;
+import org.eclipse.jst.j2ee.ui.archive.internal.ArchiveExportParticipantPanelsExtensionPoint;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public abstract class J2EEExportPage extends DataModelWizardPage {
+
+ public static boolean isWindows = SWT.getPlatform().toLowerCase().startsWith("win"); //$NON-NLS-1$
+
+ protected IStructuredSelection currentResourceSelection;
+ private static final int SIZING_TEXT_FIELD_WIDTH = 305;
+ protected static final String STORE_LABEL = "J2EE_EXPORT_"; //$NON-NLS-1$
+ protected static final String OVERWRITE_LABEL = "OVERWRITE"; //$NON-NLS-1$
+ protected static final String SOURCE_LABEL = "SOURCE"; //$NON-NLS-1$
+ protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL);
+ protected String LABEL_DESTINATION = J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_DESTINATION);
+ protected String LABEL_RUNTIME = J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_RUNTIME);
+ private Combo resourceNameCombo;
+ private Combo destinationNameCombo;
+ private Button optimizeForRuntimeCheckbox;
+ private Combo runtimeNameCombo;
+ private Button destinationBrowseButton;
+ protected Button overwriteExistingFilesCheckbox;
+ private Button sourceFilesCheckbox;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public J2EEExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
+ super(model, pageName);
+ currentResourceSelection = selection;
+ Object element = currentResourceSelection.getFirstElement();
+ IProject project = ProjectUtilities.getProject(element);
+ if (project != null) {
+ String projectName = project.getName();
+ DataModelPropertyDescriptor [] validProjectNames = model.getValidPropertyDescriptors(IJ2EEComponentExportDataModelProperties.PROJECT_NAME);
+ boolean projectNameSet = false;
+ for(int i=0;i<validProjectNames.length && !projectNameSet; i++){
+ if(projectName.equals(validProjectNames[i].getPropertyDescription())){
+ projectNameSet = true;
+ model.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, projectName);
+ }
+ }
+ if(!projectNameSet && validProjectNames.length > 0){
+ //if export dialog is invoked by selecting a non EAR project, get the corresponding EAR
+ IProject[] earProjects = EarUtilities.getReferencingEARProjects(project);
+ if( earProjects.length > 0 ){
+ model.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, earProjects[0].getName());
+ }else
+ model.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, validProjectNames[0].getPropertyDescription());
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ //WorkbenchHelp.setHelp(composite, getInfopopID());
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayout(layout);
+
+ createSourceAndDestinationGroup(composite);
+ createRuntimeGroup(composite);
+ createOptionsGroup(composite);
+
+ //setupBasedOnInitialSelections();
+ setupInfopop(composite);
+ restoreWidgetValues();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ private void createSourceAndDestinationGroup(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(3, false);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayoutData(data);
+ createExportComponentGroup(composite);
+ createDestinationGroup(composite);
+
+ }
+ /**
+ * Creates the export source resource specification widgets.
+ *
+ * @param parent
+ * a <code>Composite</code> that is to be used as the parent of this group's
+ * collection of visual components
+ * @see org.eclipse.swt.widgets.Composite
+ */
+ protected void createExportComponentGroup(Composite parent) {
+
+ //Project label
+ Label projectLabel = new Label(parent, SWT.NONE);
+ projectLabel.setText(getComponentLabel());
+ //Project combo
+ resourceNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ resourceNameCombo.setLayoutData(data);
+ synchHelper.synchCombo(resourceNameCombo, IJ2EEComponentExportDataModelProperties.PROJECT_NAME, null);
+
+
+ new Label(parent, SWT.NONE);//Pad label
+ }
+
+ /**
+ * @return
+ */
+ protected abstract String getComponentLabel();
+
+ protected void createDestinationGroup(org.eclipse.swt.widgets.Composite parent) {
+
+ //Destination label
+ Label destinationLabel = new Label(parent, SWT.NONE);
+ destinationLabel.setText(LABEL_DESTINATION);
+ // destination name combo field
+ destinationNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
+ destinationNameCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ synchHelper.synchCombo(destinationNameCombo, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, null);
+
+ // destination browse button
+ destinationBrowseButton = new Button(parent, SWT.PUSH);
+ destinationBrowseButton.setText(defBrowseButtonLabel);
+ // bug 290709
+// destinationBrowseButton.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
+ destinationBrowseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDestinationBrowseButtonPressed();
+ }
+ });
+ destinationBrowseButton.setEnabled(true);
+
+ }
+
+ protected void createRuntimeGroup( final Composite parent )
+ {
+ final Group group = new Group( parent, SWT.NONE );
+ group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+ group.setLayout( new GridLayout( 1, false ) );
+ group.setText( LABEL_RUNTIME );
+
+ this.optimizeForRuntimeCheckbox = new Button( group, SWT.CHECK );
+ this.optimizeForRuntimeCheckbox.setText( J2EEWizardNLS.J2EEExportPage_Optimize_for_a_specific_server_runt_ );
+ this.synchHelper.synchCheckbox( this.optimizeForRuntimeCheckbox, IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME, null );
+
+ final GridData gd = new GridData();
+ gd.verticalIndent = 2;
+
+ this.optimizeForRuntimeCheckbox.setLayoutData( gd );
+
+ this.runtimeNameCombo = new Combo( group, SWT.READ_ONLY | SWT.SINGLE | SWT.BORDER );
+ this.runtimeNameCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+ this.synchHelper.synchCombo( this.runtimeNameCombo, IJ2EEComponentExportDataModelProperties.RUNTIME, null );
+
+ final Composite extComposite = new EnhancedComposite( group, SWT.NONE );
+ extComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+
+ final GridLayout layout = new GridLayout( 1, false );
+ layout.marginWidth = 10;
+ layout.marginHeight = 1;
+
+ extComposite.setLayout( layout );
+
+ getDataModel().addListener
+ (
+ new IDataModelListener()
+ {
+ public void propertyChanged( final DataModelEvent event )
+ {
+ if( event.getPropertyName().equals( IJ2EEComponentExportDataModelProperties.RUNTIME ) &&
+ event.getFlag() == IDataModel.VALUE_CHG )
+ {
+ refreshExtensionsComposite( extComposite, true );
+ }
+ else if( event.getPropertyName().equals( IJ2EEComponentExportDataModelProperties.OPTIMIZE_FOR_SPECIFIC_RUNTIME ) &&
+ event.getFlag() == IDataModel.VALUE_CHG )
+ {
+ final boolean optimize = ( (Boolean) event.getProperty() ).booleanValue();
+ extComposite.setEnabled( optimize );
+ }
+ }
+ }
+ );
+
+ refreshExtensionsComposite( extComposite, false );
+ }
+
+ private void refreshExtensionsComposite( final Composite extComposite, boolean forceRefresh )
+ {
+ for( Control child : extComposite.getChildren() )
+ {
+ child.dispose();
+ }
+
+ final List<IArchiveExportParticipantData> extensions
+ = (List<IArchiveExportParticipantData>) getDataModel().getProperty( IJ2EEComponentExportDataModelProperties.RUNTIME_SPECIFIC_PARTICIPANTS );
+
+ if( extensions != null )
+ {
+ Composite innerComposite = null;
+
+ for( IArchiveExportParticipantData extension : extensions )
+ {
+ final String id = extension.getId();
+
+ final ArchiveExportParticipantPanelsExtensionPoint.PanelFactoryInfo panelExtInfo
+ = ArchiveExportParticipantPanelsExtensionPoint.getExtension( id );
+
+ if( panelExtInfo != null )
+ {
+ final IArchiveExportParticipantPanelFactory panelFactory = panelExtInfo.loadPanelFactory();
+
+ if( panelFactory != null )
+ {
+ if( innerComposite == null )
+ {
+ innerComposite = new EnhancedComposite( extComposite, SWT.NONE );
+ innerComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+
+ final GridLayout innerCompositeLayout = new GridLayout( 1, false );
+ innerCompositeLayout.marginWidth = 0;
+ innerCompositeLayout.marginHeight = 0;
+
+ innerComposite.setLayout( innerCompositeLayout );
+ }
+
+ try
+ {
+ panelFactory.createPanel( innerComposite, extension.getDataModel() );
+ }
+ catch( Exception e )
+ {
+ J2EEUIPlugin.logError( -1, e.getMessage(), e );
+ }
+ }
+ }
+ }
+ }
+
+ if (forceRefresh) {
+ extComposite.getShell().layout( true, true );
+ }
+ }
+
+ /**
+ * Create the export options specification widgets.
+ *
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ */
+ protected void createOptionsGroup(Composite parent) {
+
+ // options group
+ Composite optionsGroup = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(1, false);
+ optionsGroup.setLayout(layout);
+
+
+ // source files... checkbox
+ createSourceFilesCheckbox(optionsGroup);
+
+ // overwrite... checkbox
+ createOverwriteExistingFilesCheckbox(optionsGroup);
+
+ // advanced button
+ if (shouldShowProjectFilesCheckbox()) {
+ createProjectFilesCheckbox(optionsGroup);
+ }
+ }
+
+ protected void createOverwriteExistingFilesCheckbox(Composite optionsGroup) {
+ //Overwrite checkbox
+ overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
+ overwriteExistingFilesCheckbox.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_OVERWRITE_CHECKBOX));
+ overwriteExistingFilesCheckbox.setEnabled(true);
+ synchHelper.synchCheckbox(overwriteExistingFilesCheckbox, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING, null);
+ }
+
+ protected void createSourceFilesCheckbox(Composite optionsGroup) {
+ sourceFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
+ sourceFilesCheckbox.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_EXPORT_SOURCE_CHECKBOX));
+ synchHelper.synchCheckbox(sourceFilesCheckbox, IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES, null);
+ }
+
+ /**
+ * @return
+ */
+ protected boolean shouldShowProjectFilesCheckbox() {
+ return false;
+ }
+
+ protected void createProjectFilesCheckbox(Composite composite) {
+ //do nothing
+ }
+
+ /**
+ * Populates the resource name field based upon the currently-selected resources.
+ */
+ protected void setupBasedOnInitialSelections() {
+
+ if (currentResourceSelection.isEmpty() || setupBasedOnRefObjectSelection())
+ return; // no setup needed
+
+ java.util.List selections = new ArrayList();
+ Iterator aenum = currentResourceSelection.iterator();
+ while (aenum.hasNext()) {
+ IResource currentResource = (IResource) aenum.next();
+ // do not add inaccessible elements
+ if (currentResource.isAccessible())
+ selections.add(currentResource);
+ }
+ if (selections.isEmpty())
+ return; // setup not needed anymore
+
+// int selectedResourceCount = selections.size();
+//TODO: find a way to select an existing component
+// if (selectedResourceCount == 1) {
+// IResource resource = (IResource) selections.get(0);
+// if ((resource instanceof IProject) && checkForNature((IProject) resource)) {
+// resourceNameCombo.setText(resource.getName().toString());
+// }
+// }
+ }
+
+ /**
+ * @return
+ */
+ protected String getProjectImportLabel() {
+ return null;
+ }
+
+ /**
+ *
+ */
+ protected void handleDestinationBrowseButtonPressed() {
+
+ FileDialog dialog = new FileDialog(destinationNameCombo.getShell(), SWT.SAVE);
+ String fileName = getDataModel().getStringProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME);
+ String[] filters = getFilterExpression();
+ if (!isWindows) {
+ if (filters.length != 0 && filters[0] != null && filters[0].indexOf('.') != -1) {
+ fileName += filters[0].substring(filters[0].indexOf('.'));
+ }
+ }
+ dialog.setFileName(fileName);
+ if (isWindows) {
+ dialog.setFilterExtensions(filters);
+ }
+ String filename = dialog.open();
+ if (filename != null)
+ destinationNameCombo.setText(filename);
+ }
+
+ protected void restoreWidgetValues() {
+
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null)
+ return; // ie.- no settings stored
+ for (int i = 0; i < sourceNames.length; i++) {
+ if (sourceNames[i] == null)
+ sourceNames[i] = ""; //$NON-NLS-1$
+ }
+ destinationNameCombo.setItems(sourceNames);
+ boolean overwrite = settings.getBoolean(STORE_LABEL + OVERWRITE_LABEL);
+ model.setBooleanProperty(IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING, overwrite);
+ boolean includeSource = settings.getBoolean(STORE_LABEL + SOURCE_LABEL);
+ model.setBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES, includeSource);
+ }
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ // update source names history
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null) {
+ sourceNames = new String[0];
+ }
+
+ String newName = destinationNameCombo.getText();
+
+ //rip out any empty filenames and trim length to 5
+ ArrayList newNames = new ArrayList();
+ for (int i = 0; i < sourceNames.length && i < 5; i++) {
+ if (sourceNames[i].trim().length() > 0 && !newName.equals(sourceNames[i])) {
+ newNames.add(sourceNames[i]);
+ }
+ }
+ newNames.add(0, destinationNameCombo.getText());
+ sourceNames = new String[newNames.size()];
+ newNames.toArray(sourceNames);
+
+ settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
+ settings.put(STORE_LABEL + OVERWRITE_LABEL, model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING));
+ settings.put(STORE_LABEL + SOURCE_LABEL, model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES));
+ }
+ }
+
+ /**
+ * @return
+ */
+ protected String getFileNamesStoreID() {
+ return getComponentID();
+ }
+
+ @Deprecated
+ protected String getCompnentID() {
+ return null;
+ }
+
+ protected String getComponentID() {
+ return getCompnentID();
+ }
+
+ /**
+ * @return
+ */
+ protected String[] getFilterExpression() {
+ return new String[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#enter()
+ */
+ @Override
+ protected void enter() {
+ super.enter();
+ restoreWidgetValues();
+ }
+
+ /**
+ * @return
+ */
+ //protected abstract String getNatureID();
+
+ protected abstract boolean isMetaTypeSupported(Object o);
+
+ /**
+ * Populates the resource name field based upon the currently-selected resources.
+ */
+ protected boolean setupBasedOnRefObjectSelection() {
+
+ if (currentResourceSelection.size() != 1)
+ return false;
+
+ Object o = currentResourceSelection.getFirstElement();
+ if (!isMetaTypeSupported(o))
+ return false;
+
+ EObject ref = (EObject) o;
+ IResource resource = ProjectUtilities.getProject(ref);
+ if (resource != null) {
+ resourceNameCombo.setText(resource.getName().toString());
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
+ */
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return J2EEUIPlugin.getDefault().getDialogSettings();
+ }
+
+ private static class EnhancedComposite
+
+ extends Composite
+
+ {
+ public EnhancedComposite( final Composite parent,
+ final int style )
+ {
+ super( parent, style );
+ }
+
+ @Override
+ public void setEnabled( boolean enabled )
+ {
+ super.setEnabled( enabled );
+
+ for( Control child : getChildren() )
+ {
+ child.setEnabled( enabled );
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java
new file mode 100644
index 0000000..f21049d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEImportPage.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.server.ui.ServerUIUtil;
+import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
+
+public abstract class J2EEImportPage extends DataModelWizardPage {
+
+ private Combo componentCombo;
+ private Combo fileNameCombo;
+ private static final String STORE_LABEL = "J2EE_IMPORT_"; //$NON-NLS-1$
+ private static final int SIZING_TEXT_FIELD_WIDTH = 305;
+ protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL);
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public J2EEImportPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(3, false);
+ composite.setLayout(layout);
+ createFileNameComposite(composite);
+ createProjectNameComposite(composite);
+ restoreWidgetValues();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ protected void createProjectNameComposite(Composite parent) {
+// if (FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp()) {
+// new NewModuleDataModelGroup(parent, getDataModel(), synchHelper);
+// } else {
+ Label componentLabel = new Label(parent, SWT.NONE);
+
+ componentLabel.setText(getProjectImportLabel());
+ componentLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ // setting up combo
+ componentCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ componentCombo.setLayoutData(data);
+
+ // // setting up button
+ // Button newProjectButton = new Button(parent, SWT.PUSH);
+ // newProjectButton.setText(defNewButtonLabel); //$NON-NLS-1$
+ // newProjectButton.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
+ // newProjectButton.addSelectionListener(new SelectionAdapter() {
+ // public void widgetSelected(SelectionEvent e) {
+ // // handleNewProjectButtonPressed();
+ // }
+ // });
+ // newProjectButton.setEnabled(true);
+ synchHelper.synchCombo(componentCombo, IJ2EEComponentImportDataModelProperties.PROJECT_NAME, new Control[]{componentLabel});
+ new Label(parent, SWT.NULL);
+ createServerTargetComposite(parent);
+ //}
+ }
+
+
+
+ protected void createServerTargetComposite(Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.TARGET_RUNTIME_LBL));
+ Combo serverTargetCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ serverTargetCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Button newServerTargetButton = new Button(parent, SWT.NONE);
+ newServerTargetButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_THREE_DOTS_E));
+ newServerTargetButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ newServerTargetButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ //FlexibleProjectCreationWizardPage.launchNewRuntimeWizard(getShell(), model);
+ launchNewRuntimeWizard(getShell(), model);
+ }
+ });
+ Control[] deps = new Control[]{label, newServerTargetButton};
+ synchHelper.synchCombo(serverTargetCombo, IFacetProjectCreationDataModelProperties.FACET_RUNTIME, deps);
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return J2EEUIPlugin.getDefault().getDialogSettings();
+ }
+
+ protected String getProjectImportLabel() {
+ return null;
+ }
+
+ /**
+ * @param composite
+ */
+ protected void createFileNameComposite(Composite parent) {
+ Label fileLabel = new Label(parent, SWT.NONE);
+ fileLabel.setText(getFileImportLabel());
+
+ // setup combo
+ fileNameCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER);
+ fileNameCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
+
+ // setup browse button
+ Button browseButton = new Button(parent, SWT.PUSH);
+ browseButton.setText(defBrowseButtonLabel);
+ browseButton.setLayoutData((new GridData(GridData.HORIZONTAL_ALIGN_END)));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleFileBrowseButtonPressed();
+ }
+ });
+ browseButton.setEnabled(true);
+
+ synchHelper.synchCombo(fileNameCombo, IJ2EEComponentImportDataModelProperties.FILE_NAME, new Control[]{fileLabel, browseButton});
+ }
+
+ /**
+ *
+ */
+ protected void handleFileBrowseButtonPressed() {
+
+ FileDialog dialog = new FileDialog(fileNameCombo.getShell());
+ dialog.setFilterExtensions(getFilterExpression());
+ String filename = dialog.open();
+ if (filename != null)
+ model.setProperty(IJ2EEComponentImportDataModelProperties.FILE_NAME, filename);
+ }
+
+ /**
+ * @return
+ */
+ protected String[] getFilterExpression() {
+ return new String[0];
+ }
+
+ protected void restoreWidgetValues() {
+
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null)
+ return; // ie.- no settings stored
+ for (int i = 0; i < sourceNames.length; i++) {
+ if (sourceNames[i] == null)
+ sourceNames[i] = ""; //$NON-NLS-1$
+ }
+ fileNameCombo.setItems(sourceNames);
+ }
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ // update source names history
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null) {
+ sourceNames = new String[0];
+ }
+ // rip out any empty filenames and trim length to 5
+ ArrayList newNames = new ArrayList();
+ for (int i = 0; i < sourceNames.length && i < 5; i++) {
+ if (sourceNames[i].trim().length() > 0) {
+ newNames.add(sourceNames[i]);
+ }
+ }
+ String text = fileNameCombo.getText();
+ newNames.remove(text);
+ newNames.add(0, text);
+ sourceNames = new String[newNames.size()];
+ newNames.toArray(sourceNames);
+
+ // sourceNames = addToHistory(sourceNames,
+ // getJ2EEImportDataModel().getStringProperty(J2EEImportDataModel.FILE_NAME));
+ settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
+
+ DataModelFacetCreationWizardPage.saveRuntimeSettings(settings, model);
+ }
+ }
+
+ @Override
+ public void restoreDefaultSettings() {
+ IDialogSettings settings = getDialogSettings();
+ DataModelFacetCreationWizardPage.restoreRuntimeSettings(settings, model);
+ }
+
+ /**
+ * @return
+ */
+ protected String getFileNamesStoreID() {
+ return null;
+ }
+
+ /**
+ * Must override
+ */
+ protected String getFileImportLabel() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#enter()
+ */
+ @Override
+ protected void enter() {
+ super.enter();
+ }
+
+ private boolean launchNewRuntimeWizard(Shell shell, IDataModel model) {
+ DataModelPropertyDescriptor[] preAdditionDescriptors = model.getValidPropertyDescriptors(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ boolean isOK = ServerUIUtil.showNewRuntimeWizard(shell, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (isOK) {
+ DataModelPropertyDescriptor[] postAdditionDescriptors = model.getValidPropertyDescriptors(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ Object[] preAddition = new Object[preAdditionDescriptors.length];
+ for (int i = 0; i < preAddition.length; i++) {
+ preAddition[i] = preAdditionDescriptors[i].getPropertyValue();
+ }
+ Object[] postAddition = new Object[postAdditionDescriptors.length];
+ for (int i = 0; i < postAddition.length; i++) {
+ postAddition[i] = postAdditionDescriptors[i].getPropertyValue();
+ }
+ Object newAddition = ProjectUtilities.getNewObject(preAddition, postAddition);
+
+ model.notifyPropertyChange(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, IDataModel.VALID_VALUES_CHG);
+ if (newAddition != null)
+ model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, newAddition);
+ }
+ return isOK;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java
new file mode 100644
index 0000000..1064801
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleExportPage.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Dec 4, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public abstract class J2EEModuleExportPage extends J2EEExportPage {
+ /**
+ * @param model
+ * @param pageName
+ */
+ public J2EEModuleExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
+ super(model, pageName, selection);
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEComponentExportDataModelProperties.PROJECT_NAME, IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING};
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java
new file mode 100644
index 0000000..dc714af
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage;
+
+public abstract class J2EEModuleFacetInstallPage extends DataModelFacetInstallPage implements IJ2EEModuleFacetInstallDataModelProperties {
+
+ private IDataModelListener facetVersionListener = null;
+ protected Button addDD;
+
+ public J2EEModuleFacetInstallPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @deprecated This member should not be used any more. The EAR Panel is moved to the first wizard page.
+ */
+ protected EarSelectionPanel earPanel;
+
+ @Override
+ public void dispose() {
+ if (null != earPanel) {
+ earPanel.dispose();
+ }
+ this.model.removeListener( this.facetVersionListener );
+ super.dispose();
+ }
+
+ /**
+ * @deprecated This method should not be called any more. The EAR Panel is moved to the first wizard page.
+ */
+ protected void setupEarControl(final Composite parent) {
+ Composite c = new Composite(parent, SWT.NONE);
+ c.setLayoutData(gdhfill());
+ final GridLayout layout = new GridLayout(3, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ c.setLayout(layout);
+ this.earPanel = new EarSelectionPanel(model, c);
+ }
+
+ protected void createGenerateDescriptorControl(Composite parent) {
+ createGenerateDescriptorControl(parent, null);
+ }
+
+ protected void createGenerateDescriptorControl(Composite parent, String ddFileName) {
+ this.addDD = new Button(parent, SWT.CHECK);
+ if (ddFileName == null) {
+ this.addDD.setText(Resources.generateDeploymentDescriptor);
+ } else {
+ this.addDD.setText(NLS.bind(Resources.generateDeploymentDescriptorWithFileName, ddFileName));
+ }
+ //synchHelper.synchCheckbox(addDD, GENERATE_DD, null); bug 215284 - see enter()
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ this.addDD.setLayoutData(gd);
+ }
+
+ protected void registerFacetVersionChangeListener()
+ {
+ this.facetVersionListener = new IDataModelListener()
+ {
+ public void propertyChanged( final DataModelEvent event )
+ {
+ if( event.getFlag() == DataModelEvent.VALUE_CHG &&
+ event.getPropertyName().equals( FACET_VERSION ) )
+ {
+ final Runnable runnable = new Runnable()
+ {
+ public void run()
+ {
+ handleFacetVersionChangedEvent();
+ }
+ };
+ if(Thread.currentThread() == Display.getDefault().getThread()){
+ runnable.run();
+ } else {
+ Display.getDefault().asyncExec( runnable );
+ }
+ }
+ }
+ };
+
+ this.model.addListener( facetVersionListener );
+ handleFacetVersionChangedEvent();
+ }
+
+ protected void handleFacetVersionChangedEvent()
+ {
+ // The default implementation doesn't do anything. The subclass should override
+ // to handle this event.
+ }
+
+ private static final class Resources extends NLS {
+ public static String generateDeploymentDescriptor;
+ public static String generateDeploymentDescriptorWithFileName;
+
+ static {
+ initializeMessages(J2EEModuleFacetInstallPage.class.getName(), Resources.class);
+ }
+ }
+
+ @Override
+ protected void enter() {
+ if (isFirstTimeToPage() && addDD != null)
+ {
+ synchHelper.synchCheckbox(addDD, GENERATE_DD, null);
+ }
+ super.enter();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.properties
new file mode 100644
index 0000000..321d1db
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleFacetInstallPage.properties
@@ -0,0 +1,2 @@
+generateDeploymentDescriptor = &Generate deployment descriptor
+generateDeploymentDescriptorWithFileName = &Generate {0} deployment descriptor
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java
new file mode 100644
index 0000000..df85210
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEModuleImportPage.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Dec 4, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModelProvider;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
+import org.eclipse.jst.j2ee.ui.project.facet.EarSelectionPanel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+
+/**
+ * @author cbridgha
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public abstract class J2EEModuleImportPage extends J2EEImportPage {
+ /**
+ * @param model
+ * @param pageName
+ */
+
+ protected EarSelectionPanel earPanel;
+
+ public J2EEModuleImportPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = super.createTopLevelComposite(parent);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ createServerEarAndStandaloneGroup(composite);
+ createAnnotationsStandaloneGroup(composite);
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ protected void createAnnotationsStandaloneGroup(Composite composite) {
+ }
+
+ protected abstract String getModuleFacetID();
+ /**
+ * @param composite
+ */
+
+ private void createServerEarAndStandaloneGroup(Composite composite) {
+ IDataModel creationDM = getDataModel().getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
+ FacetDataModelMap map = (FacetDataModelMap) creationDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel facetModel = (IDataModel) map.get(getModuleFacetID());
+
+ Composite c = new Composite(composite, SWT.NONE);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 3;
+ c.setLayoutData(data);
+ final GridLayout layout = new GridLayout(3, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ c.setLayout(layout);
+ earPanel = new EarSelectionPanel(facetModel, c);
+ }
+
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEComponentImportDataModelProperties.FILE_NAME,
+ IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME,
+ IFacetProjectCreationDataModelProperties.FACET_RUNTIME,
+ IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAME,
+ IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR,
+ J2EEArtifactImportDataModelProvider.FACET_RUNTIME};
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (earPanel != null)
+ earPanel.dispose();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java
new file mode 100644
index 0000000..3253110
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportPageNew.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on Dec 8, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+
+/**
+ * @author mdelder
+ */
+public class J2EEUtilityJarImportPageNew extends J2EEImportPage {
+
+ private static final String STORE_LABEL = "J2EE_UTILITY_JAR_LIST_IMPORT_"; //$NON-NLS-1$
+ // private static final int SIZING_TEXT_FIELD_WIDTH = 305;
+
+ private Button deselectAllButton;
+
+ private Button selectAllButton;
+
+ protected Button browseButton;
+
+ protected Button useAlternateRootBtn;
+
+ private Button overwriteProjectCheckbox;
+
+ protected CheckboxTableViewer availableJARsViewer;
+
+ protected boolean utilJarSelectionChanged = false;
+
+ private Combo availableJarsCombo;
+
+ protected Button linkedPathCheckbox;
+
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public J2EEUtilityJarImportPageNew(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_0")); //$NON-NLS-1$
+ setDescription(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_1")); //$NON-NLS-1$
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ setInfopopID(IJ2EEUIContextIds.IMPORT_UTILITY_JAR_WIZARD_P1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ createUtilityJarFileNameComposite(composite);
+ createLinkedPathVariable(composite);
+ createJARsComposite(composite);
+ createOverwriteCheckbox(composite);
+
+ restoreWidgetValues();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ protected void createUtilityJarFileNameComposite(Composite parent) {
+ Group fileNameGroup = new Group(parent, SWT.NULL);
+ fileNameGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_2")); //$NON-NLS-1$
+ GridLayout layout = new GridLayout(3, false);
+ fileNameGroup.setLayout(layout);
+ fileNameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label fileLabel = new Label(fileNameGroup, SWT.NONE);
+ fileLabel.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_3")); //$NON-NLS-1$
+ fileLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ // setup combo
+ availableJarsCombo = new Combo(fileNameGroup, SWT.SINGLE | SWT.BORDER);
+ availableJarsCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
+
+ // setup browse button
+ browseButton = new Button(fileNameGroup, SWT.PUSH);
+ browseButton.setText(defBrowseButtonLabel);
+ browseButton.setLayoutData((new GridData(GridData.HORIZONTAL_ALIGN_END)));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowseButtonPressed();
+ }
+ });
+ browseButton.setEnabled(true);
+
+ synchHelper.synchCombo(availableJarsCombo, IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY, new Control[]{fileLabel, browseButton});
+ }
+
+ protected void createLinkedPathVariable(Composite parent) {
+
+
+ Group linkedPathGroup = new Group(parent, SWT.NULL);
+ linkedPathGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_4")); //$NON-NLS-1$
+
+ GridLayout layout = new GridLayout(1, true);
+ linkedPathGroup.setLayout(layout);
+ linkedPathGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite checkboxGroup = new Composite(linkedPathGroup, SWT.NULL);
+ GridLayout checkboxLayout = new GridLayout(2, false);
+ checkboxGroup.setLayout(checkboxLayout);
+ checkboxGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ linkedPathCheckbox = new Button(checkboxGroup, SWT.CHECK);
+ linkedPathCheckbox.setText(" "); //$NON-NLS-1$
+ final Text linkedPathText = new Text(checkboxGroup, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ linkedPathText.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_5")); //$NON-NLS-1$
+ linkedPathText.setEnabled(true);
+
+ getDataModel().addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE.equals(event.getPropertyName())) {
+ linkedPathText.setEnabled(getDataModel().isPropertyEnabled(IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE));
+ }
+
+ }
+ });
+
+ GridData textGridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ textGridData.heightHint = 50;
+ textGridData.widthHint = 350;
+ linkedPathText.setLayoutData(textGridData);
+ linkedPathText.setBackground(checkboxGroup.getBackground());
+
+ // setup combo
+ Combo availableLinkedPathsCombo = new Combo(linkedPathGroup, SWT.SINGLE | SWT.BORDER);
+ availableLinkedPathsCombo.setLayoutData((new GridData(GridData.FILL_HORIZONTAL)));
+
+ synchHelper.synchCombo(availableLinkedPathsCombo, IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE, new Control[]{availableLinkedPathsCombo});
+
+ synchHelper.synchCheckbox(linkedPathCheckbox, IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PATH_VARIABLE, new Control[]{availableLinkedPathsCombo});
+
+ }
+
+ /**
+ * Open an appropriate directory browser
+ */
+ protected void handleBrowseButtonPressed() {
+ DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
+ dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
+
+ String dirName = getBrowseStartLocation();
+
+ if (!isNullOrEmpty(dirName)) {
+ File path = new File(dirName);
+ if (path.exists())
+ dialog.setFilterPath(dirName);
+ }
+
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null)
+ availableJarsCombo.setText(selectedDirectory);
+ }
+
+ /**
+ * @return
+ */
+ protected String getBrowseStartLocation() {
+ if (availableJarsCombo.getText() != null && availableJarsCombo.getText().length() > 0)
+ return availableJarsCombo.getText();
+ return null;
+ }
+
+ protected boolean isNullOrEmpty(String aString) {
+ return aString == null || aString.length() == 0;
+ }
+
+ /*
+ * Updates the enable state of the all buttons
+ */
+ protected void updateButtonEnablements() {
+
+ utilJarSelectionChanged = true;
+ }
+
+ protected void createAvailableJarsList(Composite listGroup) {
+ availableJARsViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+
+ GridData gData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
+ gData.widthHint = 200;
+ gData.heightHint = 80;
+ availableJARsViewer.getControl().setLayoutData(gData);
+ AvailableUtilityJarsProvider availableUtilJARsProvider = new AvailableUtilityJarsProvider();
+ availableJARsViewer.setContentProvider(availableUtilJARsProvider);
+ availableJARsViewer.setLabelProvider(availableUtilJARsProvider);
+
+ availableJARsViewer.getTable().setHeaderVisible(false);
+ availableJARsViewer.getTable().setLinesVisible(false);
+
+ availableJARsViewer.setInput(model);
+
+ /* getModel().addListener(getOperationDataModelListener()); */
+ synchHelper.synchCheckBoxTableViewer(availableJARsViewer, IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, null);
+
+
+ model.addListener(new IDataModelListener() {
+
+ public void propertyChanged(DataModelEvent event) {
+ if (IJ2EEUtilityJarListImportDataModelProperties.AVAILABLE_JARS_DIRECTORY.equals(event.getPropertyName()))
+ availableJARsViewer.setInput(model);
+ }
+ });
+ }
+
+ private void handleDeselectAllButtonPressed() {
+ model.setProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, new Object[0]);
+ }
+
+ private void handleSelectAllButtonPressed() {
+ Object[] selection = new Object[availableJARsViewer.getTable().getItemCount()];
+ for (int i = 0; i < selection.length; i++) {
+ selection[i] = availableJARsViewer.getElementAt(i);
+ }
+ model.setProperty(IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, selection);
+ }
+
+ protected void createButtonsGroup(org.eclipse.swt.widgets.Composite parent) {
+ Composite buttonGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ buttonGroup.setLayout(layout);
+ buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ selectAllButton = new Button(buttonGroup, SWT.PUSH);
+ selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_SELECT_ALL_UTIL_BUTTON));
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan = 1;
+ gd.heightHint = 22;
+ gd.widthHint = 120;
+ selectAllButton.setLayoutData(gd);
+ selectAllButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleSelectAllButtonPressed();
+ }
+ });
+
+ deselectAllButton = new Button(buttonGroup, SWT.PUSH);
+ deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_DESELECT_ALL_UTIL_BUTTON));
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 22;
+ gd.widthHint = 120;
+ deselectAllButton.setLayoutData(gd);
+ deselectAllButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleDeselectAllButtonPressed();
+ }
+ });
+ }
+
+ protected void createJARsComposite(Composite parent) {
+ Group group = new Group(parent, SWT.NULL);
+ group.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_IMPORT_JARS_GROUP));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label description = new Label(group, SWT.NULL);
+ description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_UTILITY_JAR_LISTEAR_IMPORT_SELECT_UTIL_JARS_TO_BE_PROJECTS));
+ GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd2.horizontalSpan = 2;
+ description.setLayoutData(gd2);
+
+ // create jars check box viewer
+ createAvailableJarsList(group);
+ createButtonsGroup(group);
+ }
+
+ /**
+ * @param projectOptionsGroup
+ */
+ protected void createOverwriteCheckbox(Composite parent) {
+
+ overwriteProjectCheckbox = new Button(parent, SWT.CHECK);
+ overwriteProjectCheckbox.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_6")); //$NON-NLS-1$
+ synchHelper.synchCheckbox(overwriteProjectCheckbox, IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY, null);
+ }
+
+ protected void setJARsCompositeEnabled(boolean enabled) {
+ availableJARsViewer.getTable().setEnabled(enabled);
+ availableJARsViewer.setAllChecked(false);
+ availableJARsViewer.setAllGrayed(!enabled);
+ selectAllButton.setEnabled(enabled);
+ deselectAllButton.setEnabled(enabled);
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEUtilityJarListImportDataModelProperties.UTILITY_JAR_LIST, IJ2EEUtilityJarListImportDataModelProperties.OVERWRITE_IF_NECESSARY, IJ2EEUtilityJarListImportDataModelProperties.LINKED_PATH_VARIABLE};
+ }
+
+ @Override
+ protected void restoreWidgetValues() {
+
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null)
+ return; // ie.- no settings stored
+ for (int i = 0; i < sourceNames.length; i++) {
+ if (sourceNames[i] == null)
+ sourceNames[i] = ""; //$NON-NLS-1$
+ }
+ availableJarsCombo.setItems(sourceNames);
+ }
+ }
+
+ @Override
+ public void storeDefaultSettings() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ // update source names history
+ String[] sourceNames = settings.getArray(STORE_LABEL + getFileNamesStoreID());
+ if (sourceNames == null) {
+ sourceNames = new String[0];
+ }
+
+ String newName = availableJarsCombo.getText();
+
+ // rip out any empty filenames and trim length to 5
+ ArrayList newNames = new ArrayList();
+ for (int i = 0; i < sourceNames.length && i < 5; i++) {
+ if (sourceNames[i].trim().length() > 0 && !newName.equals(sourceNames[i])) {
+ newNames.add(sourceNames[i]);
+ }
+ }
+ newNames.add(0, availableJarsCombo.getText());
+ sourceNames = new String[newNames.size()];
+ newNames.toArray(sourceNames);
+
+ settings.put(STORE_LABEL + getFileNamesStoreID(), sourceNames);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileNamesStoreID()
+ */
+ @Override
+ protected String getFileNamesStoreID() {
+ return "UTIL";//$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFileImportLabel()
+ */
+ @Override
+ protected String getFileImportLabel() {
+ return J2EEUIMessages.getResourceString("J2EEUtilityJarImportPage_UI_7"); //$NON-NLS-1$
+ }
+
+
+ @Override
+ public void restoreDefaultSettings() {
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java
new file mode 100644
index 0000000..b7f43d4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportTypePageNew.java
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on May 13, 2004
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.application.Application;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEUtilityJarListImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+/**
+ * @author mdelder
+ */
+public class J2EEUtilityJarImportTypePageNew extends DataModelWizardPage {
+
+ protected static final String defBrowseButtonLabel = J2EEUIMessages.getResourceString(J2EEUIMessages.BROWSE_LABEL);
+
+ private static final int SIZING_TEXT_FIELD_WIDTH = 305;
+
+ protected IStructuredSelection currentResourceSelection;
+
+ private Combo resourceNameCombo;
+
+ private Button copyJarIntoEAR;
+
+ private Button linkJarIntoEAR;
+
+ private Button createLinkedProjects;
+
+ private Button createProjects;
+
+ protected Button browseButton;
+
+ private Button overrideProjectRootCheckbox;
+
+
+ protected Text projectRootLocationText;
+
+ private Label moduleProjectLocationLabel;
+
+ protected boolean synching;
+
+ public static final String TITLE = J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_0"); //$NON-NLS-1$
+ public static final String DESCRIPTION = J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_1"); //$NON-NLS-1$
+
+ private Group projectRootComposite;
+
+
+ /**
+ * @param model
+ * @param pageName
+ * @param title
+ * @param titleImage
+ */
+ public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName, String title, ImageDescriptor titleImage) {
+ super(model, pageName, title, titleImage);
+ setTitle(""); //$NON-NLS-1$
+ setDescription(""); //$NON-NLS-1$
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ setInfopopID(IJ2EEUIContextIds.IMPORT_UTILITY_JAR_WIZARD_P2);
+ }
+
+ public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName, IStructuredSelection selection) {
+ super(model, pageName);
+ this.currentResourceSelection = selection;
+ setTitle(TITLE);
+ setDescription(DESCRIPTION);
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ }
+
+ public J2EEUtilityJarImportTypePageNew(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(TITLE);
+ setDescription(DESCRIPTION);
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_IMPORT_WIZARD_BANNER));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#getValidationPropertyNames()
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME, IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT};
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ createEARProjectGroup(composite);
+ createUtilityJarImportTypes(composite);
+ // TODO The binary / project location options are not yet (re-) supported by the import operations.
+ createProjectCreationOptions(composite);
+
+ setupBasedOnInitialSelections();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ protected void createUtilityJarImportTypes(Composite parent) {
+ Group typesGroup = new Group(parent, SWT.NULL);
+ typesGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_2")); //$NON-NLS-1$
+
+ GridLayout layout = new GridLayout(1, false);
+ typesGroup.setLayout(layout);
+ typesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ createProjects = new Button(typesGroup, SWT.RADIO);
+ createProjects.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_3")); //$NON-NLS-1$
+ synchHelper.synchRadio(createProjects, IJ2EEUtilityJarListImportDataModelProperties.CREATE_PROJECT, null);
+
+ createLinkedProjects = new Button(typesGroup, SWT.RADIO);
+ createLinkedProjects.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_4")); //$NON-NLS-1$
+ synchHelper.synchRadio(createLinkedProjects, IJ2EEUtilityJarListImportDataModelProperties.CREATE_LINKED_PROJECT, null);
+
+ copyJarIntoEAR = new Button(typesGroup, SWT.RADIO);
+ copyJarIntoEAR.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_5")); //$NON-NLS-1$
+ synchHelper.synchRadio(copyJarIntoEAR, IJ2EEUtilityJarListImportDataModelProperties.COPY, null);
+
+ linkJarIntoEAR = new Button(typesGroup, SWT.RADIO);
+ linkJarIntoEAR.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_6")); //$NON-NLS-1$
+ /* linkJarIntoEAR.addSelectionListener(getTypeSelectionListener()); */
+ synchHelper.synchRadio(linkJarIntoEAR, IJ2EEUtilityJarListImportDataModelProperties.LINK_IMPORT, null);
+
+ }
+
+ protected void createProjectCreationOptions(Composite parent) {
+
+ Group projectOptionsGroup = new Group(parent, SWT.NULL);
+ projectOptionsGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_7")); //$NON-NLS-1$
+
+ GridLayout layout = new GridLayout(1, false);
+ projectOptionsGroup.setLayout(layout);
+ projectOptionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ overrideProjectRootCheckbox = new Button(projectOptionsGroup, SWT.CHECK);
+ overrideProjectRootCheckbox.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_11")); //$NON-NLS-1$
+ createProjectRootComposite(projectOptionsGroup);
+
+ synchHelper.synchCheckbox(overrideProjectRootCheckbox, IJ2EEUtilityJarListImportDataModelProperties.OVERRIDE_PROJECT_ROOT, new Control[]{/*
+ * moduleProjectLocationLabel,
+ * projectRootLocationText,
+ * browseButton
+ */});
+ }
+
+ /**
+ *
+ * @param parent
+ * a <code>Composite</code> that is to be used as the parent of this group's
+ * collection of visual components
+ * @see org.eclipse.swt.widgets.Composite
+ */
+ protected void createEARProjectGroup(Composite parent) {
+
+ Group earGroup = new Group(parent, SWT.NULL);
+ earGroup.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_8")); //$NON-NLS-1$
+
+ GridLayout layout = new GridLayout(2, false);
+ earGroup.setLayout(layout);
+ earGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Project label
+ Label projectLabel = new Label(earGroup, SWT.NONE);
+ projectLabel.setText(J2EEUIMessages.getResourceString("J2EEUtilityJarImportTypePage_UI_9")); //$NON-NLS-1$
+ // Project combo
+ resourceNameCombo = new Combo(earGroup, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = SIZING_TEXT_FIELD_WIDTH;
+ resourceNameCombo.setLayoutData(data);
+ synchHelper.synchCombo(resourceNameCombo, IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME, null);
+
+ }
+
+ protected void createProjectRootComposite(Composite parent) {
+ projectRootComposite = new Group(parent, SWT.NULL);
+ projectRootComposite.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_LOCATIONS_GROUP));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ projectRootComposite.setLayout(layout);
+ projectRootComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label description = new Label(projectRootComposite, SWT.NULL);
+ description.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.NEW_PROJECT_GROUP_DESCRIPTION));
+ GridData gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd2.horizontalSpan = 3;
+ description.setLayoutData(gd2);
+
+ moduleProjectLocationLabel = new Label(projectRootComposite, SWT.NULL);
+ moduleProjectLocationLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.USE_DEFAULT_ROOT_RADIO));
+ moduleProjectLocationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ projectRootLocationText = new Text(projectRootComposite, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ projectRootLocationText.setLayoutData(gd);
+ projectRootLocationText.setText(ResourcesPlugin.getWorkspace().getRoot().getFullPath().toOSString());
+ projectRootLocationText.setEnabled(false); /* disabled by default */
+
+ browseButton = new Button(projectRootComposite, SWT.PUSH);
+ browseButton.setText(defBrowseButtonLabel);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ browseButton.setLayoutData(gd);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleRootProjectBrowseButtonPressed();
+ }
+ });
+
+ synchHelper.synchText(projectRootLocationText, IJ2EEUtilityJarListImportDataModelProperties.PROJECT_ROOT, new Control[]{moduleProjectLocationLabel, projectRootLocationText, browseButton});
+ }
+
+
+ /**
+ * Open an appropriate directory browser
+ */
+ protected void handleRootProjectBrowseButtonPressed() {
+ DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell());
+ dialog.setMessage(J2EEUIMessages.getResourceString(J2EEUIMessages.SELECT_DIRECTORY_DLG));
+
+ String dirName = getBrowseStartLocation();
+
+ if (!isNullOrEmpty(dirName)) {
+ File path = new File(dirName);
+ if (path.exists())
+ dialog.setFilterPath(dirName);
+ }
+
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null)
+ projectRootLocationText.setText(selectedDirectory);
+
+ }
+
+ protected String getBrowseStartLocation() {
+ String text = projectRootLocationText.getText();
+ return text;
+ }
+
+
+ protected boolean isNullOrEmpty(String aString) {
+ return aString == null || aString.length() == 0;
+ }
+
+ /**
+ * Populates the resource name field based upon the currently-selected resources.
+ */
+ protected void setupBasedOnInitialSelections() {
+
+ if (null == currentResourceSelection || currentResourceSelection.isEmpty() || setupBasedOnRefObjectSelection())
+ return; // no
+ // setup
+ // needed
+
+ java.util.List selections = new ArrayList();
+ Iterator aenum = currentResourceSelection.iterator();
+ while (aenum.hasNext()) {
+ IResource currentResource = (IResource) aenum.next();
+ // do not add inaccessible elements
+ if (currentResource.isAccessible())
+ selections.add(currentResource);
+ }
+ if (selections.isEmpty())
+ return; // setup not needed anymore
+
+ int selectedResourceCount = selections.size();
+ if (selectedResourceCount == 1) {
+ IResource resource = (IResource) selections.get(0);
+ if (resource instanceof IProject && EarUtilities.isEARProject((IProject)resource)) {
+ resourceNameCombo.setText(resource.getName().toString());
+ }
+ }
+ }
+
+ /**
+ * Populates the resource name field based upon the currently-selected resources.
+ */
+ protected boolean setupBasedOnRefObjectSelection() {
+
+ if (currentResourceSelection.size() != 1)
+ return false;
+
+ Object o = currentResourceSelection.getFirstElement();
+ if (!isMetaTypeSupported(o))
+ return false;
+
+ EObject ref = (EObject) o;
+ IResource resource = ProjectUtilities.getProject(ref);
+ if (resource != null)
+ resourceNameCombo.setText(resource.getName().toString());
+ return true;
+ }
+
+ protected boolean isMetaTypeSupported(Object o) {
+ return o instanceof EARFile || o instanceof Application;
+ }
+
+ protected void enableProjectOptions(boolean enabled) {
+ overrideProjectRootCheckbox.setEnabled(enabled);
+
+ if (overrideProjectRootCheckbox.getSelection() && enabled)
+ projectRootLocationText.setEnabled(true);
+ else
+ projectRootLocationText.setEnabled(false);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ return model.validateProperty(IJ2EEUtilityJarListImportDataModelProperties.EAR_PROJECT_NAME).isOK();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java
new file mode 100644
index 0000000..0047efc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEUtilityJarImportWizardNew.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.wizard;
+
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarListImportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+
+
+/**
+ * <p>
+ * Used to import Utility Jars into several Eclipse workbench configurations. These can be extracted
+ * as editable projects, binary projects, linked resources in the EAR module or actual resources in
+ * the EAR module.
+ * </p>
+ */
+public final class J2EEUtilityJarImportWizardNew extends J2EEArtifactImportWizard{
+
+ /**
+ * <p>
+ * Constant used to identify the key of the page of the Wizard which allows users to define the
+ * type of import they would like to carry out.
+ * </p>
+ */
+ private static final String IMPORT_TYPE = "IMPORT_TYPE"; //$NON-NLS-1$
+
+ /**
+ * <p>
+ * Constant used to identify the key of the page of the Wizard that allows users to select jar
+ * files for import
+ * </p>
+ */
+ private static final String SELECT_JARS = "SELECT_JARS"; //$NON-NLS-1$
+
+
+ /**
+ * <p>
+ * The default constructor. Creates a wizard with no selection, no model instance, and no
+ * operation instance. The model and operation will be created as needed.
+ * </p>
+ */
+ public J2EEUtilityJarImportWizardNew() {
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * The model is used to prepopulate the wizard controls and interface with the operation.
+ * </p>
+ *
+ * @param model
+ * The model parameter is used to pre-populate wizard controls and interface with the
+ * operation
+ */
+ public J2EEUtilityJarImportWizardNew(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString("38")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p>
+ * Adds the following pages:
+ * <ul>
+ * <li>{@link J2EEUtilityJarImportTypePageNew}as the main wizard page ({@link #IMPORT_TYPE})
+ * <li>{@link J2EEUtilityJarImportPageNew}as the main wizard page ({@link #SELECT_JARS})
+ * </ul>
+ * </p>
+ */
+ @Override
+ public void doAddPages() {
+ this.addPage(new J2EEUtilityJarImportTypePageNew(getDataModel(), IMPORT_TYPE, getSelection()));
+ this.addPage(new J2EEUtilityJarImportPageNew(getDataModel(), SELECT_JARS));
+ }
+
+ @Override
+ protected IDataModelProvider getDefaultProvider() {
+ return new J2EEUtilityJarListImportDataModelProvider();
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_UTILITY);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEWizardNLS.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEWizardNLS.java
new file mode 100644
index 0000000..84af015
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/J2EEWizardNLS.java
@@ -0,0 +1,14 @@
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class J2EEWizardNLS extends NLS {
+
+ public static final String BUNDLE_NAME = "org.eclipse.jst.j2ee.internal.wizard.messages"; //$NON-NLS-1$
+ public static String J2EEExportPage_Optimize_for_a_specific_server_runt_;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, J2EEWizardNLS.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
new file mode 100644
index 0000000..accebf1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJ2EEComponentSelectionPage.java
@@ -0,0 +1,530 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+/*
+ * Created on Mar 23, 2005
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
+import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleManager;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IPluginContribution;
+import org.eclipse.ui.activities.WorkbenchActivityHelper;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+import org.eclipse.ui.wizards.IWizardRegistry;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.common.frameworks.internal.ui.GenericWizardNode;
+import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
+
+public class NewJ2EEComponentSelectionPage extends DataModelWizardPage implements IDefaultJ2EEComponentCreationDataModelProperties {
+ private Button defaultModulesButton;
+
+ private Composite defaultModulesComposite;
+
+ private Composite newModulesComposite;
+
+ private Button appClientRadioButton;
+
+ private Button ejbRadioButton;
+
+ private Button webRadioButton;
+
+ private Button connectorRadioButton;
+
+ private GenericWizardNode appClientNode;
+
+ private GenericWizardNode ejbNode;
+
+ private GenericWizardNode webNode;
+
+ private GenericWizardNode connectorNode;
+
+ private GenericWizardNode selectedNode;
+
+ private StackLayout stackLayout;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ protected NewJ2EEComponentSelectionPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_DESC));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#getValidationPropertyNames()
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[] { CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME, CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME, CREATE_EJB, EJB_COMPONENT_NAME, CREATE_WEB, WEB_COMPONENT_NAME, MODULE_NAME_COLLISIONS_VALIDATION, ENABLED };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setInfopopID(IJ2EEUIContextIds.EAR_NEW_MODULE_PROJECTS_PAGE);
+ createDefaultCheckBox(composite);
+ Composite forStackComposite = new Composite(composite, SWT.NULL);
+ layout = new GridLayout();
+ forStackComposite.setLayout(layout);
+ forStackComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Composite stackComposite = createStackLayoutComposite(forStackComposite);
+ createDefaultModulesComposite(stackComposite);
+ createModuleSelectionComposite(stackComposite);
+ stackLayout.topControl = defaultModulesComposite;
+ setButtonEnablement();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ protected Composite createStackLayoutComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ stackLayout = new StackLayout();
+ composite.setLayout(stackLayout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return composite;
+ }
+
+ private void createDefaultModulesComposite(Composite parent) {
+ defaultModulesComposite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ defaultModulesComposite.setLayout(layout);
+ defaultModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // Default Module Controls creation
+ createAppClientDefaultModuleControl();
+ if (J2EEPlugin.isEJBSupportAvailable())
+ createEJBDefaultModuleControl();
+ createWebDefaultModuleControl();
+ if (J2EEPlugin.isEJBSupportAvailable())
+ createConnectorDefaultModuleControl();
+ }
+
+ /**
+ * @param parent
+ */
+ private void createModuleSelectionComposite(Composite parent) {
+ newModulesComposite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ newModulesComposite.setLayout(layout);
+ newModulesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ appClientRadioButton = new Button(newModulesComposite, SWT.RADIO);
+
+ appClientRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.appClient")); //$NON-NLS-1$
+ appClientRadioButton.addListener(SWT.Selection, this);
+ if (EarModuleManager.getEJBModuleExtension() != null) {
+ ejbRadioButton = new Button(newModulesComposite, SWT.RADIO);
+ ejbRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.ejb")); //$NON-NLS-1$
+ ejbRadioButton.addListener(SWT.Selection, this);
+ }
+ if (EarModuleManager.getWebModuleExtension() != null) {
+ webRadioButton = new Button(newModulesComposite, SWT.RADIO);
+ webRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.web")); //$NON-NLS-1$
+ webRadioButton.addListener(SWT.Selection, this);
+ }
+ if (EarModuleManager.getJCAModuleExtension() != null) {
+ connectorRadioButton = new Button(newModulesComposite, SWT.RADIO);
+ connectorRadioButton.setText(J2EEUIMessages.getResourceString("NewModuleSelectionPage.jca")); //$NON-NLS-1$
+ connectorRadioButton.addListener(SWT.Selection, this);
+ }
+ }
+
+ /**
+ *
+ */
+ private void createConnectorDefaultModuleControl() {
+ if (EarModuleManager.getJCAModuleExtension() != null) {
+ String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_JCA_MODULE_LBL);
+ createJ2EEComponentControl(label, CREATE_CONNECTOR, CONNECTOR_COMPONENT_NAME);
+ }
+ }
+
+ /**
+ *
+ */
+ private void createWebDefaultModuleControl() {
+ if (EarModuleManager.getWebModuleExtension() != null) {
+ String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_WEB_MODULE_LBL);
+ createJ2EEComponentControl(label, CREATE_WEB, WEB_COMPONENT_NAME);
+ }
+ }
+
+ /**
+ *
+ */
+ private void createEJBDefaultModuleControl() {
+ if (EarModuleManager.getEJBModuleExtension() != null) {
+ String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_EJB_MODULE_LBL);
+ createJ2EEComponentControl(label, CREATE_EJB, EJB_COMPONENT_NAME);
+ }
+ }
+
+ private void createAppClientDefaultModuleControl() {
+ String label = J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_APPCLIENT_MODULE_LBL);
+ createJ2EEComponentControl(label, CREATE_APPCLIENT, APPCLIENT_COMPONENT_NAME);
+ }
+
+ private void createJ2EEComponentControl(String label, String createProperty, String projectProperty) {
+ final Button checkBox = new Button(defaultModulesComposite, SWT.CHECK);
+ checkBox.setSelection(true);
+ checkBox.setText(label);
+
+ final Text textField = new Text(defaultModulesComposite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ textField.setLayoutData(data);
+ synchHelper.synchCheckbox(checkBox, createProperty, null);
+ synchHelper.synchText(textField, projectProperty, null);
+ }
+
+ private void createDefaultCheckBox(Composite composite) {
+ Composite checkBoxComposite = new Composite(composite, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ checkBoxComposite.setLayout(layout);
+ checkBoxComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ defaultModulesButton = new Button(checkBoxComposite, SWT.CHECK);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ data.horizontalIndent = 0;
+ defaultModulesButton.setLayoutData(data);
+ defaultModulesButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_PAGE_NEW_MOD_SEL_PG_DEF_BTN));
+ defaultModulesButton.setSelection(true);
+ defaultModulesButton.addListener(SWT.Selection, this);
+ synchHelper.synchCheckbox(defaultModulesButton, ENABLED, null);
+ createControlsSeparatorLine(checkBoxComposite);
+ }
+
+ protected void createControlsSeparatorLine(Composite parent) {
+ // add a horizontal line
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ separator.setLayoutData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
+ */
+ @Override
+ public void handleEvent(Event evt) {
+ if (evt.widget == defaultModulesButton)
+ handleDefaultModulesButtonPressed();
+ else if (!defaultModulesButton.getSelection()) {
+ if (evt.widget == appClientRadioButton && appClientRadioButton.getSelection())
+ setSelectedNode(getAppClientNode());
+ else if (evt.widget == ejbRadioButton && ejbRadioButton.getSelection())
+ setSelectedNode(getEjbNode());
+ else if (evt.widget == webRadioButton && webRadioButton.getSelection())
+ setSelectedNode(getWebNode());
+ else if (evt.widget == connectorRadioButton && connectorRadioButton.getSelection())
+ setSelectedNode(getConnectorNode());
+ validatePage();
+ }
+ super.handleEvent(evt);
+ }
+
+ /**
+ *
+ */
+ private void handleDefaultModulesButtonPressed() {
+ if (defaultModulesButton.getSelection()) {
+ setSelectedNode(null);
+ showDefaultModulesComposite();
+ setDefaultModulesSelection(true);
+ } else {
+ setDefaultModulesSelection(false);
+ showNewModulesCompsite();
+ }
+ setButtonEnablement();
+ validatePage();
+ }
+
+ private void setDefaultModulesSelection(boolean selection) {
+ getDataModel().setBooleanProperty(CREATE_APPCLIENT, selection);
+ getDataModel().setBooleanProperty(CREATE_CONNECTOR, selection);
+ getDataModel().setBooleanProperty(CREATE_EJB, selection);
+ getDataModel().setBooleanProperty(CREATE_WEB, selection);
+ }
+
+ private void showDefaultModulesComposite() {
+ defaultModulesComposite.setVisible(true);
+ newModulesComposite.setVisible(false);
+ stackLayout.topControl = defaultModulesComposite;
+ }
+
+ /**
+ * This is done based on the J2EE version. We need to disable Connectors if
+ * not j2ee 1.3 or higher.
+ */
+ private void setButtonEnablement() {
+ if (!defaultModulesButton.getSelection() && connectorRadioButton != null) {
+ int version = getDataModel().getIntProperty(J2EE_VERSION);
+ connectorRadioButton.setEnabled(version > J2EEVersionConstants.J2EE_1_2_ID);
+ }
+ }
+
+ /**
+ *
+ */
+ private void showNewModulesCompsite() {
+ defaultModulesComposite.setVisible(false);
+ newModulesComposite.setVisible(true);
+ if (!isAnyModuleRadioSelected())
+ appClientRadioButton.setSelection(true);
+ setSelectedNode(getWizardNodeFromSelection());
+ stackLayout.topControl = newModulesComposite;
+ }
+
+ /**
+ * @return
+ */
+ private GenericWizardNode getWizardNodeFromSelection() {
+ if (appClientRadioButton.getSelection())
+ return getAppClientNode();
+ if (connectorRadioButton != null && connectorRadioButton.getSelection())
+ return getConnectorNode();
+ if (ejbRadioButton != null && ejbRadioButton.getSelection())
+ return getEjbNode();
+ if (webRadioButton != null && webRadioButton.getSelection())
+ return getWebNode();
+ return null;
+ }
+
+ /**
+ * @return
+ */
+ private boolean isAnyModuleRadioSelected() {
+ return appClientRadioButton.getSelection() || (connectorRadioButton != null && connectorRadioButton.getSelection()) || (ejbRadioButton != null && ejbRadioButton.getSelection()) || (webRadioButton != null && webRadioButton.getSelection());
+ }
+
+ /**
+ * @return Returns the appClientNode.
+ */
+ private GenericWizardNode getAppClientNode() {
+ if (appClientNode == null) {
+ appClientNode = new GenericWizardNode() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
+ */
+ @Override
+ protected IWizard createWizard() {
+ return createChildWizard("org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientProjectWizard", NESTED_MODEL_CLIENT); //$NON-NLS-1$
+ }
+ };
+ }
+ return appClientNode;
+ }
+
+ /**
+ * @return Returns the connectorNode.
+ */
+ private GenericWizardNode getConnectorNode() {
+ if (connectorNode == null) {
+ connectorNode = new GenericWizardNode() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
+ */
+ @Override
+ protected IWizard createWizard() {
+ return createChildWizard("org.eclipse.jst.j2ee.jca.ui.internal.wizard.ConnectorProjectWizard", NESTED_MODEL_JCA); //$NON-NLS-1$
+ }
+ };
+ }
+ return connectorNode;
+ }
+
+ /**
+ * @return Returns the ejbNode.
+ */
+ private GenericWizardNode getEjbNode() {
+ if (ejbNode == null) {
+ ejbNode = new GenericWizardNode() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
+ */
+ @Override
+ protected IWizard createWizard() {
+ return createChildWizard("org.eclipse.jst.ejb.ui.project.facet.EjbProjectWizard", NESTED_MODEL_EJB); //$NON-NLS-1$
+ }
+ };
+ }
+ return ejbNode;
+ }
+
+ /**
+ * @return Returns the webNode.
+ */
+ private GenericWizardNode getWebNode() {
+ if (webNode == null) {
+ webNode = new GenericWizardNode() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.GenericWizardNode#createWizard()
+ */
+ @Override
+ protected IWizard createWizard() {
+ return createChildWizard("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard", NESTED_MODEL_WEB); //$NON-NLS-1$
+ }
+ };
+ }
+ return webNode;
+ }
+
+ private IWizard createChildWizard(String id, String parentWizModelName) {
+ NewProjectDataModelFacetWizard wizard = null;
+ IWizardRegistry newWizardRegistry = WorkbenchPlugin.getDefault().getNewWizardRegistry();
+ IWizardDescriptor wizardDescriptor = newWizardRegistry.findWizard(id);
+ try {
+ // retrieve the model of the parent wizard
+ IDataModel parentWizModel = getDataModel().getNestedModel(parentWizModelName);
+
+ // create the child wizard and retrieve its model
+ wizard = (NewProjectDataModelFacetWizard) wizardDescriptor.createWizard();
+ IDataModel childWizModel = wizard.getDataModel();
+
+ // copy the properties of the parent wizard's model to the child wizard's model
+ Iterator props = parentWizModel.getBaseProperties().iterator();
+ while (props.hasNext()) {
+ String prop = (String) props.next();
+ if(!prop.equals(IFacetProjectCreationDataModelProperties.FACETED_PROJECT_WORKING_COPY)){
+ childWizModel.setProperty(prop, parentWizModel.getProperty(prop));
+ }
+ }
+ } catch (CoreException ce) {
+ Logger.getLogger().log(ce);
+ }
+ return wizard;
+ }
+
+ /**
+ * @param selectedNode
+ * The selectedNode to set.
+ */
+ private void setSelectedNode(GenericWizardNode selectedNode) {
+ this.selectedNode = selectedNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
+ */
+ @Override
+ public boolean canFlipToNextPage() {
+ if (!defaultModulesButton.getSelection())
+ return selectedNode != null;
+ return false;
+ }
+
+ /**
+ * The <code>WizardSelectionPage</code> implementation of this
+ * <code>IWizardPage</code> method returns the first page of the currently
+ * selected wizard if there is one.
+ */
+ @Override
+ public IWizardPage getNextPage() {
+ if (selectedNode == null)
+ return null;
+ IPluginContribution pluginContribution = new IPluginContribution() {
+ public String getLocalId() {
+ String id = null;
+ if (selectedNode == appClientNode) {
+ id = "org.eclipse.jst.j2ee.internal.internal.internal.appclientProjectWizard"; //$NON-NLS-1$
+ } else if (selectedNode == ejbNode) {
+ id = "org.eclipse.jst.j2ee.internal.internal.internal.ejb.ui.util.ejbProjectWizard"; //$NON-NLS-1$
+ } else if (selectedNode == connectorNode) {
+ id = "org.eclipse.jst.j2ee.internal.internal.internal.jcaProjectWizard"; //$NON-NLS-1$
+ } else if (selectedNode == webNode) {
+ id = "org.eclipse.jst.j2ee.internal.internal.internal.webProjectWizard"; //$NON-NLS-1$
+ }
+ return id;
+ }
+
+ public String getPluginId() {
+ return "org.eclipse.jst.j2ee.internal.internal.internal.ui"; //$NON-NLS-1$
+ }
+ };
+
+ if (!WorkbenchActivityHelper.allowUseOf(null,pluginContribution)) {
+ return null;
+ }
+
+ boolean isCreated = selectedNode.isContentCreated();
+ IWizard wizard = selectedNode.getWizard();
+ if (wizard == null) {
+ setSelectedNode(null);
+ return null;
+ }
+ if (!isCreated) // Allow the wizard to create its pages
+ wizard.addPages();
+
+ return wizard.getStartingPage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#validatePage()
+ */
+ @Override
+ protected void validatePage() {
+ if (!defaultModulesButton.getSelection()) {
+ setPageComplete(false);
+ setErrorMessage(null);
+ } else
+ super.validatePage();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java
new file mode 100644
index 0000000..c64ddd4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassOptionsWizardPage.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
+import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+/**
+ * @author jialin
+ *
+ * To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Generation - Code and Comments
+ */
+public class NewJavaClassOptionsWizardPage extends DataModelWizardPage {
+
+ protected Button publicButton;
+ protected Button abstractButton;
+ protected Button finalButton;
+ protected TableViewer interfaceViewer;
+ protected Button addButton;
+ protected Button removeButton;
+ protected Button inheritButton;
+ protected Button constructorButton;
+ protected Button mainMethodButton;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public NewJavaClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
+ super(model, pageName);
+ setDescription(pageDesc);
+ this.setTitle(pageTitle);
+ setInfopopID(IJ2EEUIContextIds.NEW_JAVA_CLASS_OPTION_WIZARD_P1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#getValidationPropertyNames()
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{INewJavaClassDataModelProperties.MODIFIER_ABSTRACT, INewJavaClassDataModelProperties.MODIFIER_FINAL};
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ createModifierControls(composite);
+ createInterfaceControls(composite);
+
+ // Separator label
+ Label seperator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ seperator.setLayoutData(data);
+
+ createStubsComposite(composite);
+
+ publicButton.setFocus();
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * Create controls for the modifiers
+ */
+ protected void createModifierControls(Composite parent) {
+ Label modifiersLabel = new Label(parent, SWT.NONE);
+ modifiersLabel.setText(J2EEUIMessages.JAVA_CLASS_MODIFIERS_LABEL);
+ modifiersLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.makeColumnsEqualWidth = true;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ publicButton = new Button(composite, SWT.CHECK);
+ publicButton.setText(J2EEUIMessages.JAVA_CLASS_PUBLIC_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(publicButton, INewJavaClassDataModelProperties.MODIFIER_PUBLIC, null);
+
+ abstractButton = new Button(composite, SWT.CHECK);
+ abstractButton.setText(J2EEUIMessages.JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(abstractButton, INewJavaClassDataModelProperties.MODIFIER_ABSTRACT, null);
+
+ finalButton = new Button(composite, SWT.CHECK);
+ finalButton.setText(J2EEUIMessages.JAVA_CLASS_FINAL_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(finalButton, INewJavaClassDataModelProperties.MODIFIER_FINAL, null);
+ }
+
+ protected void createInterfaceControls(Composite parent) {
+ Label interfaceLabel = new Label(parent, SWT.NONE);
+ interfaceLabel.setText(J2EEUIMessages.JAVA_CLASS_INTERFACES_LABEL);
+ interfaceLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ interfaceViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI);
+ interfaceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ interfaceViewer.setContentProvider(getInterfaceContentProvider());
+ interfaceViewer.setLabelProvider(getInterfaceLabelProvider());
+ interfaceViewer.getControl().addKeyListener(getInterfaceKeyListener());
+ interfaceViewer.setInput(model.getProperty(INewJavaClassDataModelProperties.INTERFACES));
+
+ Composite buttonCompo = new Composite(composite, SWT.NULL);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ buttonCompo.setLayout(layout);
+ buttonCompo.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ addButton = new Button(buttonCompo, SWT.PUSH);
+ addButton.setText(J2EEUIMessages.ADD_BUTTON_LABEL);
+ addButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
+ addButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ handleInterfaceAddButtonSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ //Do nothing
+ }
+ });
+
+ removeButton = new Button(buttonCompo, SWT.PUSH);
+ removeButton.setText(J2EEUIMessages.REMOVE_BUTTON);
+ removeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
+ removeButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ handleInterfaceRemoveButtonSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ //Do nothing
+ }
+ });
+ removeButton.setEnabled(false);
+
+ interfaceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ removeButton.setEnabled(!selection.isEmpty());
+ }
+ });
+
+ }
+
+ /**
+ * Create the composite with all the stubs
+ */
+ protected void createStubsComposite(Composite parent) {
+ Label stubLabel = new Label(parent, SWT.NONE);
+ stubLabel.setText(J2EEUIMessages.JAVA_CLASS_METHOD_STUBS_LABEL);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ stubLabel.setLayoutData(data);
+
+ Composite buttonCompo = new Composite(parent, SWT.NULL);
+ buttonCompo.setLayout(new GridLayout());
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ data.horizontalIndent = 15;
+ buttonCompo.setLayoutData(data);
+
+ mainMethodButton = new Button(buttonCompo, SWT.CHECK);
+ mainMethodButton.setText(J2EEUIMessages.JAVA_CLASS_MAIN_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(mainMethodButton, INewJavaClassDataModelProperties.MAIN_METHOD, null);
+
+ inheritButton = new Button(buttonCompo, SWT.CHECK);
+ inheritButton.setText(J2EEUIMessages.JAVA_CLASS_INHERIT_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(inheritButton, INewJavaClassDataModelProperties.ABSTRACT_METHODS, null);
+
+ constructorButton = new Button(buttonCompo, SWT.CHECK);
+ constructorButton.setText(J2EEUIMessages.JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL);
+ synchHelper.synchCheckbox(constructorButton, INewJavaClassDataModelProperties.CONSTRUCTOR, null);
+ }
+
+ @Override
+ protected void enter() {
+ super.enter();
+ //set the intefaces on every page enter (not only on viewer creation)
+ interfaceViewer.setInput(model.getProperty(INewJavaClassDataModelProperties.INTERFACES));
+ }
+
+ /**
+ * @see IStatefulWizardPage#saveWidgetValues()
+ */
+ // public void saveWidgetValues() {
+ // // TODO: do we want to do this here or in the concrete subclasses???
+ // IDialogSettings store = getDialogSettings();
+ // if (store != null)
+ // store.put(getUniqueKey(""), getUniqueKey("")); //$NON-NLS-1$
+ // //$NON-NLS-2$
+ // DialogSettingsHelper.saveButton(inheritButton,
+ // getUniqueKey(idInheritedAbstractButton), store);
+ // DialogSettingsHelper.saveButton(constructorButton,
+ // getUniqueKey(idSuperClassConstructorsButton), store);
+ // DialogSettingsHelper.saveButton(publicButton,
+ // getUniqueKey(idPublicButton), store);
+ // DialogSettingsHelper.saveButton(abstractButton,
+ // getUniqueKey(idAbstractButton), store);
+ // DialogSettingsHelper.saveButton(finalButton, getUniqueKey(idFinalButton),
+ // store);
+ //
+ // }
+ /**
+ * @see IStatefulWizardPage#restoreWidgetValues()
+ */
+ // public void restoreWidgetValues() {
+ // IDialogSettings store = super.getDialogSettings();
+ // if (store != null && store.get(getUniqueKey("")) != null) { //$NON-NLS-1$
+ // DialogSettingsHelper.restoreButton(inheritButton,
+ // getUniqueKey(idInheritedAbstractButton), store);
+ // DialogSettingsHelper.restoreButton(constructorButton,
+ // getUniqueKey(idSuperClassConstructorsButton), store);
+ // DialogSettingsHelper.restoreButton(publicButton,
+ // getUniqueKey(idPublicButton), store);
+ // DialogSettingsHelper.restoreButton(abstractButton,
+ // getUniqueKey(idAbstractButton), store);
+ // DialogSettingsHelper.restoreButton(finalButton,
+ // getUniqueKey(idFinalButton), store);
+ // }
+ // }
+ /**
+ * Returns the Super Interface Content Provider
+ */
+ protected IStructuredContentProvider getInterfaceContentProvider() {
+ return new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ Object[] ret = new Object[0];
+ if (inputElement instanceof List) {
+ ret = ((List) inputElement).toArray();
+ }
+ return ret;
+ }
+ public void dispose() {
+ //Do nothing
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ //Default is nothing
+ }
+ };
+ }
+
+ /**
+ * Returns the Super Interface Label Provider
+ */
+ protected ILabelProvider getInterfaceLabelProvider() {
+ return new ILabelProvider() {
+ public Image getImage(Object element) {
+ return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE);
+ }
+
+ public String getText(Object element) {
+ String ret = J2EEUIMessages.EMPTY_STRING;
+ if (element instanceof String)
+ ret = (String) element;
+ return ret;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ //Do nothing
+ }
+ public void dispose() {
+ //Do nothing
+ }
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+ public void removeListener(ILabelProviderListener listener) {
+ //Do nothing
+ }
+ };
+ }
+
+ protected KeyListener getInterfaceKeyListener() {
+ return new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.DEL) {
+ handleInterfaceRemoveButtonSelected();
+ }
+ }
+
+ };
+ }
+
+ /**
+ * Browse for a new Super Interface Class
+ */
+ protected void handleInterfaceAddButtonSelected() {
+ IProject project = (IProject) model.getProperty(INewJavaClassDataModelProperties.PROJECT);
+ IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
+ // this eliminates the non-exported classpath entries
+ final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(javaProject, true, true);
+ FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(),false, context, scope,IJavaSearchConstants.INTERFACE);
+ dialog.setTitle(J2EEUIMessages.INTERFACE_SELECTION_DIALOG_TITLE);
+ if (dialog.open() == Window.OK) {
+ IType type = (IType) dialog.getFirstResult();
+ String newInterface = ""; //$NON-NLS-1$
+ if (type != null) {
+ newInterface = type.getFullyQualifiedName();
+ List valueList = getInterfaceViewerItems();
+ if (!valueList.contains(newInterface)) {
+ interfaceViewer.add(newInterface);
+ model.setProperty(INewJavaClassDataModelProperties.INTERFACES, getInterfaceViewerItems());
+ }
+ }
+ }
+ }
+
+ /**
+ * Remove an interface from the SuperInterface List
+ */
+ protected void handleInterfaceRemoveButtonSelected() {
+ IStructuredSelection selection = (IStructuredSelection) interfaceViewer.getSelection();
+ List items = selection.toList();
+ if (!items.isEmpty()) {
+ List valueList = getInterfaceViewerItems();
+ for (int i = 0; i < items.size(); i++) {
+ valueList.remove(items.get(i));
+ }
+ interfaceViewer.setInput(valueList);
+ model.setProperty(INewJavaClassDataModelProperties.INTERFACES, valueList);
+ }
+ }
+
+ private List getInterfaceViewerItems() {
+ ArrayList<String> list = new ArrayList<String>();
+ TableItem[] items = interfaceViewer.getTable().getItems();
+ for (TableItem item : items) {
+ list.add(item.getText());
+ }
+ return list;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
new file mode 100644
index 0000000..2365c92
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/NewJavaClassWizardPage.java
@@ -0,0 +1,748 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
+import org.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
+import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+
+/**
+ *
+ */
+public class NewJavaClassWizardPage extends DataModelWizardPage {
+
+ private Text folderText;
+ private Button folderButton;
+ protected Text packageText;
+ protected Button packageButton;
+ protected Label packageLabel;
+ protected Text classText;
+ protected Label classLabel;
+ protected Text superText;
+ protected Button superButton;
+ protected Label superLabel;
+ protected Label projectNameLabel;
+ private Combo projectNameCombo;
+ protected String projectType;
+ private String projectName;
+
+ /**
+ * @param model
+ * @param pageName
+ */
+ public NewJavaClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle,
+ String moduleType) {
+ super(model, pageName);
+ setDescription(pageDesc);
+ this.setTitle(pageTitle);
+ setPageComplete(false);
+ this.projectType = moduleType;
+ this.projectName = null;
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{IArtifactEditOperationDataModelProperties.PROJECT_NAME,
+ IArtifactEditOperationDataModelProperties.COMPONENT_NAME,
+ INewJavaClassDataModelProperties.SOURCE_FOLDER,
+ INewJavaClassDataModelProperties.JAVA_PACKAGE,
+ INewJavaClassDataModelProperties.CLASS_NAME,
+ INewJavaClassDataModelProperties.SUPERCLASS};
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ addProjectNameGroup(composite);
+ addFolderGroup(composite);
+ addSeperator(composite, 3);
+ addPackageGroup(composite);
+ addClassnameGroup(composite);
+ addSuperclassGroup(composite);
+
+ // set the cursor focus
+ // - to the "Java package" if it is empty
+ // - to the "Class name" - otherwise
+ if (packageText.getText().trim().length() == 0) {
+ packageText.setFocus();
+ } else {
+ classText.setFocus();
+ }
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getInfopopID());
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * Add project group
+ */
+ private void addProjectNameGroup(Composite parent) {
+ // set up project name label
+ projectNameLabel = new Label(parent, SWT.NONE);
+ projectNameLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.MODULES_DEPENDENCY_PAGE_TABLE_PROJECT));
+ GridData data = new GridData();
+ projectNameLabel.setLayoutData(data);
+ // set up project name entry field
+ projectNameCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 300;
+ data.horizontalSpan = 1;
+ projectNameCombo.setLayoutData(data);
+ projectNameCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ IProject project = ProjectUtilities.getProject(projectNameCombo.getText());
+ validateProjectRequirements(project);
+ }
+ });
+ synchHelper.synchCombo(projectNameCombo, IArtifactEditOperationDataModelProperties.PROJECT_NAME, null);
+ initializeProjectList();
+ new Label(parent, SWT.NONE);
+ }
+
+ /**
+ *
+ **/
+ private IFolder getDefaultJavaSourceFolder(IProject project) {
+
+ if (project == null)
+ return null;
+ IPackageFragmentRoot[] sources = J2EEProjectUtilities.getSourceContainers(project);
+ // Try and return the first source folder
+ if (sources.length > 0) {
+ try {
+ return (IFolder) sources[0].getCorrespondingResource();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This method is used by the project list initializer. The method checks
+ * if the specified project is valid to include it in the project list.
+ *
+ * <p>Subclasses of this wizard page should override this method to
+ * adjust filtering of the projects to their needs. </p>
+ *
+ * @param project reference to the project to be checked
+ *
+ * @return <code>true</code> if the project is valid to be included in
+ * the project list, <code>false</code> - otherwise.
+ */
+ protected boolean isProjectValid(IProject project) {
+ boolean result;
+ try {
+ result = project.isAccessible() &&
+ project.hasNature(IModuleConstants.MODULE_NATURE_ID) &&
+ JavaEEProjectUtilities.getJ2EEProjectType(project).equals(projectType);
+ } catch (CoreException ce) {
+ result = false;
+ }
+ return result;
+ }
+
+ /**
+ *
+ */
+ private void initializeProjectList() {
+ IProject[] workspaceProjects = ProjectUtilities.getAllProjects();
+ List items = new ArrayList();
+ for (int i = 0; i < workspaceProjects.length; i++) {
+ IProject project = workspaceProjects[i];
+ if (isProjectValid(project))
+ items.add(project.getName());
+ }
+ if (items.isEmpty()) return;
+ String[] names = new String[items.size()];
+ for (int i = 0; i < items.size(); i++) {
+ names[i] = (String) items.get(i);
+ }
+ projectNameCombo.setItems(names);
+ IProject selectedProject = null;
+ try {
+ if (model !=null) {
+ String projectNameFromModel = model.getStringProperty(IArtifactEditOperationDataModelProperties.COMPONENT_NAME);
+ if (projectNameFromModel!=null && projectNameFromModel.length()>0)
+ selectedProject = ProjectUtilities.getProject(projectNameFromModel);
+ }
+ } catch (Exception e) {}
+ try {
+ if (selectedProject == null)
+ selectedProject = getSelectedProject();
+ if (selectedProject != null && selectedProject.isAccessible()
+ && selectedProject.hasNature(IModuleConstants.MODULE_NATURE_ID)) {
+ projectNameCombo.setText(selectedProject.getName());
+ validateProjectRequirements(selectedProject);
+ model.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, selectedProject.getName());
+ }
+ } catch (CoreException ce) {
+ // Ignore
+ }
+ if (projectName == null && names.length > 0)
+ projectName = names[0];
+
+ if ((projectNameCombo.getText() == null || projectNameCombo.getText().length() == 0) && projectName != null) {
+ projectNameCombo.setText(projectName);
+ validateProjectRequirements(ProjectUtilities.getProject(projectName));
+ model.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, projectName);
+ }
+
+ }
+
+ /**
+ * Add folder group to composite
+ */
+ private void addFolderGroup(Composite composite) {
+ // folder
+ Label folderLabel = new Label(composite, SWT.LEFT);
+ folderLabel.setText(J2EEUIMessages.FOLDER_LABEL);
+ folderLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ folderText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ folderText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ synchHelper.synchText(folderText, INewJavaClassDataModelProperties.SOURCE_FOLDER, null);
+
+ IPackageFragmentRoot root = getSelectedPackageFragmentRoot();
+ String projectName = model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME);
+ if (projectName != null && projectName.length() > 0) {
+ IProject targetProject = ProjectUtilities.getProject(projectName);
+ if (root == null || !root.getJavaProject().getProject().equals(targetProject)) {
+ IFolder folder = getDefaultJavaSourceFolder(targetProject);
+ if (folder != null)
+ folderText.setText(folder.getFullPath().toOSString());
+ } else {
+ folderText.setText(root.getPath().toString());
+ }
+ }
+
+ folderButton = new Button(composite, SWT.PUSH);
+ folderButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL_O);
+ folderButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ folderButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleFolderButtonPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Do nothing
+ }
+ });
+ }
+
+ /**
+ * Add package group to composite
+ */
+ private void addPackageGroup(Composite composite) {
+ // package
+ packageLabel = new Label(composite, SWT.LEFT);
+ packageLabel.setText(J2EEUIMessages.JAVA_PACKAGE_LABEL);
+ packageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ packageText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ packageText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ synchHelper.synchText(packageText, INewJavaClassDataModelProperties.JAVA_PACKAGE, null);
+
+ IPackageFragment packageFragment = getSelectedPackageFragment();
+ String targetProject = model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME);
+ if (packageFragment != null && packageFragment.exists() &&
+ packageFragment.getJavaProject().getElementName().equals(targetProject)) {
+ IPackageFragmentRoot root = getPackageFragmentRoot(packageFragment);
+ if (root != null)
+ folderText.setText(root.getPath().toString());
+ model.setProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE, packageFragment.getElementName());
+ }
+
+ packageButton = new Button(composite, SWT.PUSH);
+ packageButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL_W);
+ packageButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ packageButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handlePackageButtonPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Do nothing
+ }
+ });
+ }
+
+ protected IPackageFragmentRoot getPackageFragmentRoot(IPackageFragment packageFragment) {
+ if (packageFragment == null)
+ return null;
+ else if (packageFragment.getParent() instanceof IPackageFragment)
+ return getPackageFragmentRoot((IPackageFragment) packageFragment.getParent());
+ else if (packageFragment.getParent() instanceof IPackageFragmentRoot)
+ return (IPackageFragmentRoot) packageFragment.getParent();
+ else
+ return null;
+ }
+
+ /**
+ * Add classname group to composite
+ */
+ private void addClassnameGroup(Composite composite) {
+ // class name
+ classLabel = new Label(composite, SWT.LEFT);
+ classLabel.setText(J2EEUIMessages.CLASS_NAME_LABEL);
+ classLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ classText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ classText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ synchHelper.synchText(classText, INewJavaClassDataModelProperties.CLASS_NAME, null);
+
+ new Label(composite, SWT.LEFT);
+ }
+
+ /**
+ * Add seperator to composite
+ */
+ protected void addSeperator(Composite composite, int horSpan) {
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ // Separator label
+ Label seperator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = horSpan;
+ seperator.setLayoutData(data);
+ }
+
+ /**
+ * Add superclass group to the composite
+ */
+ private void addSuperclassGroup(Composite composite) {
+ // superclass
+ superLabel = new Label(composite, SWT.LEFT);
+ superLabel.setText(J2EEUIMessages.SUPERCLASS_LABEL);
+ superLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ superText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ superText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ synchHelper.synchText(superText, INewJavaClassDataModelProperties.SUPERCLASS, null);
+
+ superButton = new Button(composite, SWT.PUSH);
+ superButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL_E);
+ superButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ superButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleSuperButtonPressed();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Do nothing
+ }
+ });
+ }
+
+ /**
+ * Browse for a new Destination Folder
+ */
+ protected void handleFolderButtonPressed() {
+ ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
+ ViewerFilter filter = getContainerDialogViewerFilter();
+ ITreeContentProvider contentProvider = new WorkbenchContentProvider();
+ ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
+ .getDecoratorManager().getLabelDecorator());
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
+ dialog.setValidator(validator);
+ dialog.setTitle(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
+ dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
+ dialog.addFilter(filter);
+ String projectName = model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME);
+ if (projectName==null || projectName.length()==0)
+ return;
+ IProject project = ProjectUtilities.getProject(projectName);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+
+ if (project != null)
+ dialog.setInitialSelection(project);
+ if (dialog.open() == Window.OK) {
+ Object element = dialog.getFirstResult();
+ try {
+ if (element instanceof IContainer) {
+ IContainer container = (IContainer) element;
+ folderText.setText(container.getFullPath().toString());
+ // dealWithSelectedContainerResource(container);
+ }
+ } catch (Exception ex) {
+ // Do nothing
+ }
+
+ }
+ }
+
+ protected void handlePackageButtonPressed() {
+ IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model.getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT);
+ if (packRoot == null)
+ return;
+ IJavaElement[] packages = null;
+ try {
+ packages = packRoot.getChildren();
+ } catch (JavaModelException e) {
+ // Do nothing
+ }
+ if (packages == null)
+ packages = new IJavaElement[0];
+
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(
+ JavaElementLabelProvider.SHOW_DEFAULT));
+ dialog.setTitle(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_TITLE);
+ dialog.setMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_DESC);
+ dialog.setEmptyListMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_MSG_NONE);
+ dialog.setElements(packages);
+ if (dialog.open() == Window.OK) {
+ IPackageFragment fragment = (IPackageFragment) dialog.getFirstResult();
+ if (fragment != null) {
+ packageText.setText(fragment.getElementName());
+ } else {
+ packageText.setText(J2EEUIMessages.EMPTY_STRING);
+ }
+ }
+ }
+
+ protected void handleSuperButtonPressed() {
+ getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
+ IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model.getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT);
+ if (packRoot == null)
+ return;
+
+ // this eliminates the non-exported classpath entries
+ final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(packRoot.getJavaProject(), true, true);
+
+ // This includes all entries on the classpath. This behavior is
+ // identical
+ // to the Super Class Browse Button on the Create new Java Class Wizard
+ // final IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new
+ // IJavaElement[] {root.getJavaProject()} );
+ FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(),false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS);
+ dialog.setTitle(J2EEUIMessages.SUPERCLASS_SELECTION_DIALOG_TITLE);
+ dialog.setMessage(J2EEUIMessages.SUPERCLASS_SELECTION_DIALOG_DESC);
+
+ if (dialog.open() == Window.OK) {
+ IType type = (IType) dialog.getFirstResult();
+ String superclassFullPath = J2EEUIMessages.EMPTY_STRING;
+ if (type != null) {
+ superclassFullPath = type.getFullyQualifiedName();
+ }
+ superText.setText(superclassFullPath);
+ getControl().setCursor(null);
+ return;
+ }
+ getControl().setCursor(null);
+ }
+
+ /**
+ * Returns a new instance of the Selection validator for the Container
+ * Selection Dialog This method can be extended by subclasses, as it does
+ * some basic validation.
+ */
+ protected ISelectionStatusValidator getContainerDialogSelectionValidator() {
+ return new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection) {
+ if (selection != null && selection[0] != null && !(selection[0] instanceof IProject))
+ return WTPCommonPlugin.OK_STATUS;
+ return WTPCommonPlugin.createErrorStatus(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG);
+ }
+ };
+ }
+
+ /**
+ * Returns a new instance of the Selection Listner for the Container
+ * Selection Dialog
+ */
+ protected ViewerFilter getContainerDialogViewerFilter() {
+ return new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parent, Object element) {
+ if (element instanceof IProject) {
+ IProject project = (IProject) element;
+ return project.getName().equals(model.getProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME));
+ } else if (element instanceof IFolder) {
+ IFolder folder = (IFolder) element;
+ // only show source folders
+ IProject project = ProjectUtilities.getProject(model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME));
+ IPackageFragmentRoot[] sourceFolders = J2EEProjectUtilities.getSourceContainers(project);
+ for (int i = 0; i < sourceFolders.length; i++) {
+ if (sourceFolders[i].getResource()!= null && sourceFolders[i].getResource().equals(folder))
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+
+
+ /**
+ * @return
+ */
+ private IProject getSelectedProject() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection == null)
+ return null;
+ if (!(selection instanceof IStructuredSelection))
+ return null;
+ IJavaElement element = getInitialJavaElement(selection);
+ if (element != null && element.getJavaProject() != null)
+ return element.getJavaProject().getProject();
+ IStructuredSelection stucturedSelection = (IStructuredSelection) selection;
+ if (stucturedSelection.getFirstElement() instanceof EObject)
+ return ProjectUtilities.getProject(stucturedSelection.getFirstElement());
+ IProject project = getExtendedSelectedProject(stucturedSelection.getFirstElement());
+ if(project != null) {
+ return project;
+ }
+ if(selection instanceof TreeSelection && (((TreeSelection)selection).getPaths().length > 0)){
+ TreePath path = (((TreeSelection)selection).getPaths()[0]);
+ if(path.getSegmentCount() > 0 && path.getSegment(0) instanceof IProject) {
+ return (IProject) path.getSegment(0);
+ }
+ }
+ return null;
+ }
+
+ protected IProject getExtendedSelectedProject(Object selection) {
+ return null;
+ }
+
+ /**
+ * @return
+ */
+ private IPackageFragment getSelectedPackageFragment() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection == null)
+ return null;
+ IJavaElement element = getInitialJavaElement(selection);
+ if (element != null) {
+ if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ return (IPackageFragment) element;
+ } else if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ IJavaElement parent = ((ICompilationUnit) element).getParent();
+ if (parent.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ return (IPackageFragment) parent;
+ }
+ } else if (element.getElementType() == IJavaElement.TYPE) {
+ return ((IType) element).getPackageFragment();
+ }
+ }
+ return null;
+ }
+
+ private IPackageFragmentRoot getSelectedPackageFragmentRoot() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection == null)
+ return null;
+ // StructuredSelection stucturedSelection = (StructuredSelection)
+ // selection;
+ IJavaElement element = getInitialJavaElement(selection);
+ if (element != null) {
+ if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT)
+ return (IPackageFragmentRoot) element;
+ }
+ return null;
+ }
+
+ /**
+ * Utility method to inspect a selection to find a Java element.
+ *
+ * @param selection
+ * the selection to be inspected
+ * @return a Java element to be used as the initial selection, or
+ * <code>null</code>, if no Java element exists in the given
+ * selection
+ */
+ protected IJavaElement getInitialJavaElement(ISelection selection) {
+ IJavaElement jelem = null;
+ if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ jelem = getJavaElement(selectedElement);
+ if (jelem == null) {
+ IResource resource = getResource(selectedElement);
+ if (resource != null && resource.getType() != IResource.ROOT) {
+ while (jelem == null && resource.getType() != IResource.PROJECT) {
+ resource = resource.getParent();
+ jelem = (IJavaElement) resource.getAdapter(IJavaElement.class);
+ }
+ if (jelem == null) {
+ jelem = JavaCore.create(resource); // java project
+ }
+ }
+ }
+ }
+ if (jelem == null) {
+ IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+ IWorkbenchPart part = window.getActivePage().getActivePart();
+ if (part instanceof ContentOutline) {
+ part = window.getActivePage().getActiveEditor();
+ }
+
+ if (part instanceof IViewPartInputProvider) {
+ Object elem = ((IViewPartInputProvider) part).getViewPartInput();
+ if (elem instanceof IJavaElement) {
+ jelem = (IJavaElement) elem;
+ }
+ }
+ }
+
+ if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) {
+ try {
+ IJavaProject[] projects = JavaCore.create(getWorkspaceRoot()).getJavaProjects();
+ if (projects.length == 1) {
+ jelem = projects[0];
+ }
+ } catch (JavaModelException e) {
+ JavaPlugin.log(e);
+ }
+ }
+ return jelem;
+ }
+
+ protected IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ protected void validateProjectRequirements(IProject project)
+ {
+ // nothing to do in most cases
+ }
+
+ protected IJavaElement getJavaElement(Object obj) {
+ if (obj == null)
+ return null;
+
+ if (obj instanceof IJavaElement)
+ return (IJavaElement) obj;
+
+ if (obj instanceof IAdaptable)
+ return (IJavaElement) ((IAdaptable) obj).getAdapter(IJavaElement.class);
+
+ return (IJavaElement) Platform.getAdapterManager().getAdapter(obj, IJavaElement.class);
+ }
+
+ protected IResource getResource(Object obj) {
+ if (obj == null)
+ return null;
+
+ if (obj instanceof IResource)
+ return (IResource) obj;
+
+ if (obj instanceof IAdaptable)
+ return (IResource) ((IAdaptable) obj).getAdapter(IResource.class);
+
+ return (IResource) Platform.getAdapterManager().getAdapter(obj, IResource.class);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java
new file mode 100644
index 0000000..d0e6af5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetComboHelper.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Aug 27, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code
+ * and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.List;
+
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.internal.ResourceManager;
+
+
+public class ServerTargetComboHelper {
+ private List targets;
+ public String[] items;
+ public static final String defaultId = "com.ibm.etools.websphere.serverTarget.base.v51"; //$NON-NLS-1$
+ public static final String defaultExpressId = "com.ibm.etools.websphere.serverTarget.express.v51"; //$NON-NLS-1$
+
+ ServerTargetComboHelper(List targets, String[] items) {
+ this.targets = targets;
+ this.items = items;
+ }
+
+ public IRuntime getSelectedTarget(int itemIndex) {
+ return (IRuntime) targets.get(itemIndex);
+ }
+
+ /**
+ * @param target
+ * @return
+ */
+ public boolean isCompatible(IRuntime target) {
+ return targets.contains(target);
+ }
+
+ public int getDefaultServerTargetIndex() {
+ IRuntime v51TargetServer = null;
+ if (J2EEPlugin.isEJBSupportAvailable())
+ v51TargetServer = ResourceManager.getInstance().getRuntime(defaultId);
+ else
+ v51TargetServer = ResourceManager.getInstance().getRuntime(defaultExpressId);
+ if (v51TargetServer != null && targets.contains(v51TargetServer))
+ return targets.indexOf(v51TargetServer) + 1;
+ return -1;
+ }
+
+ public int getServerTargetIndexFromItems(IRuntime serverTarget) {
+ if (items != null && items.length > 0) {
+ String serverTargetLabel = serverTarget.getName() + " (" + serverTarget.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < items.length; i++) {
+ String label = items[i];
+ if (label.equals(serverTargetLabel)) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public List getValidTargets() {
+ return targets;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java
new file mode 100644
index 0000000..bef30d4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/ServerTargetUIHelper.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Aug 17, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerUtil;
+
+/**
+ * @author vijayb
+ *
+ * To change the template for this generated type comment go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+public class ServerTargetUIHelper {
+ /**
+ *
+ */
+ public ServerTargetUIHelper() {
+ super();
+ }
+
+ public static String getSelectedServerTargetString(Combo serverTargetCombo) {
+ if (serverTargetCombo.getSelectionIndex() != -1)
+ return serverTargetCombo.getItem(serverTargetCombo.getSelectionIndex());
+ return null;
+ }
+
+ /**
+ * @return
+ */
+ public static int getSelectedServerTargetStringIndex(Combo serverTargetCombo) {
+ return serverTargetCombo.getSelectionIndex();
+ }
+
+// private static void setServerTargetForProject(Shell shell, IProject project, IRuntime runtime) {
+// //ServerTargetHelper.cleanUpNonServerTargetClasspath(project);
+// setServerTarget(shell, project, runtime, null);
+// }
+
+ /**
+ * @param earProject
+ * @param moduleProject
+ * @return
+ */
+ public static boolean setModuleServerTargetIfNecessary(IProject earProject, IProject moduleProject, Shell shell) {
+ return true;
+ }
+
+ // private static String getEARJ2EELevel(IProject earProject) {
+ // EARNatureRuntime nature = EARNatureRuntime.getRuntime(earProject);
+ // String j2eeLevel = null;
+ // int natureID = nature.getJ2EEVersion();
+ // switch (natureID) {
+ // case (J2EEVersionConstants.J2EE_1_2_ID) :
+ // j2eeLevel = J2EEVersionConstants.VERSION_1_2_TEXT;
+ // break;
+ // case (J2EEVersionConstants.J2EE_1_3_ID) :
+ // j2eeLevel = J2EEVersionConstants.VERSION_1_3_TEXT;
+ // break;
+ // case (J2EEVersionConstants.J2EE_1_4_ID) :
+ // j2eeLevel = J2EEVersionConstants.VERSION_1_4_TEXT;
+ // break;
+ // default :
+ // j2eeLevel = J2EEVersionConstants.VERSION_1_4_TEXT;
+ // break;
+ // }
+ // return j2eeLevel;
+ // }
+
+ public static void setServerTarget(Shell shell, IProject project, IRuntime runtime, IProgressMonitor monitor) {
+// try {
+// ServerCore.getProjectProperties(project).setRuntimeTarget(runtime, monitor);
+// } catch (CoreException e) {
+// Logger.getLogger().logError(e);
+// }
+ }
+
+
+ public static ServerTargetComboHelper getValidServerTargetComboItems(String j2eeType, String selectedVersion) {
+ IRuntime[] validServerTargets = ServerUtil.getRuntimes(j2eeType, selectedVersion);
+ String[] serverTargetList = null;
+ if (validServerTargets.length>0) {
+ int serverTargetListSize = validServerTargets.length;
+ serverTargetList = new String[serverTargetListSize];
+ for (int i = 0; i < validServerTargets.length; i++) {
+ IRuntime runtime = validServerTargets[i];
+ serverTargetList[i] = runtime.getName() + " (" + runtime.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return new ServerTargetComboHelper(Arrays.asList(validServerTargets), serverTargetList);
+ }
+
+ /**
+ * @param project
+ */
+ public static void runEarValidation(IProject project) {
+ try {
+ IRunnableWithProgress runnable = EARValidationHelper.createValidationRunnable(project);
+ runnable.run(null);
+ } catch (InterruptedException ie) {
+ Logger.getLogger().logError(ie);
+ } catch (InvocationTargetException ite) {
+ Logger.getLogger().logError(ite);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
new file mode 100644
index 0000000..a124c90
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
@@ -0,0 +1,548 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.wizard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author jialin
+ *
+ * To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Generation - Code and Comments
+ */
+public class StringArrayTableWizardSection extends Composite {
+
+ protected class StringArrayListContentProvider implements IStructuredContentProvider {
+ public boolean isDeleted(Object element) {
+ return false;
+ }
+ public Object[] getElements(Object element) {
+ if (element instanceof List) {
+ return ((List) element).toArray();
+ }
+ return new Object[0];
+ }
+ public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
+ //Default nothing
+ }
+ public void dispose() {
+ //Default nothing
+ }
+ }
+
+ protected class StringArrayListLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return labelProviderImage;
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ String[] array = (String[]) element;
+ return array[columnIndex];
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return labelProviderImage;
+ }
+
+ @Override
+ public String getText(Object element) {
+ String[] array = (String[]) element;
+ if (array.length > 0) {
+ return array[0];
+ }
+ return super.getText(element);
+ }
+ }
+
+ protected class AddStringArrayDialog extends Dialog implements ModifyListener {
+ protected String windowTitle;
+ protected String[] labelsForTextField;
+ protected Text[] texts;
+ protected String[] stringArray;
+ /**
+ * CMPFieldDialog constructor comment.
+ */
+ public AddStringArrayDialog(Shell shell, String windowTitle, String[] labelsForTextField) {
+ super(shell);
+ this.windowTitle = windowTitle;
+ this.labelsForTextField = labelsForTextField;
+ }
+ /**
+ * CMPFieldDialog constructor comment.
+ */
+ @Override
+ public Control createDialogArea(Composite parent) {
+
+ Composite composite = (Composite) super.createDialogArea(parent);
+ getShell().setText(windowTitle);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ int n = labelsForTextField.length;
+ texts = new Text[n];
+ for (int i = 0; i < n; i++) {
+ Label label = new Label(composite, SWT.LEFT);
+ label.setText(labelsForTextField[i]);
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ texts[i] = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 100;
+ texts[i].setLayoutData(data);
+ }
+
+ // set focus
+ texts[0].setFocus();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = (Composite) super.createContents(parent);
+
+ for (int i = 0; i < texts.length; i++) {
+ texts[i].addModifyListener(this);
+ }
+
+ updateOKButton();
+
+ return composite;
+ }
+
+ @Override
+ protected void okPressed() {
+ stringArray = callback.retrieveResultStrings(texts);
+ super.okPressed();
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void modifyText(ModifyEvent e) {
+ updateOKButton();
+ }
+
+ private void updateOKButton() {
+ getButton(IDialogConstants.OK_ID).setEnabled(callback.validate(texts));
+ }
+ }
+
+ protected class EditStringArrayDialog extends AddStringArrayDialog {
+ protected String[] valuesForTextField;
+ /**
+ * CMPFieldDialog constructor comment.
+ */
+ public EditStringArrayDialog(Shell shell, String windowTitle, String[] labelsForTextField, String[] valuesForTextField) {
+ super(shell, windowTitle, labelsForTextField);
+ this.valuesForTextField = valuesForTextField;
+ }
+ /**
+ * CMPFieldDialog constructor comment.
+ */
+ @Override
+ public Control createDialogArea(Composite parent) {
+
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ int n = valuesForTextField.length;
+ for (int i = 0; i < n; i++) {
+ texts[i].setText(valuesForTextField[i]);
+ }
+
+ return composite;
+ }
+ }
+
+ /**
+ * Callback interface used by the Add/Edit-StringArrayDialog classes.
+ */
+ public interface StringArrayDialogCallback {
+
+ /**
+ * Validates the text fields.
+ * <p>Used to decide wheather to enable the OK button of the dialog.
+ * If the method returns <code>true</code> the OK button is enabled,
+ * otherwise the OK button is disabled.</p>
+ *
+ * @param reference to the text fields in the dialog
+ *
+ * @return <code>true</code> if the values in the text fields are
+ * valid, <code>false</code> otherwise.
+ */
+ public boolean validate(Text[] texts);
+
+ /**
+ * Retrieves the strings from the text fields of the dialog.
+ * <p>Implementers of the callback can use these method to do some
+ * preprocessing (like trimming) of the data in the text fields before
+ * using it. The returned values will be the actual data that will be
+ * put in the table viewer.</p>
+ *
+ * @param texts reference to the text fields in the dialog
+ *
+ * @return the values retreived from the text fields
+ */
+ public String[] retrieveResultStrings(Text[] texts);
+
+ }
+
+ /**
+ * Default adapter with basic implementation of the
+ * <code>StringArrayDialogCallback</code> interface.
+ */
+ protected class StringArrayDialogCallbackAdapter implements StringArrayDialogCallback {
+
+ /**
+ * Returns always <code>true</code>.
+ */
+ public boolean validate(Text[] texts) {
+ return true;
+ }
+
+ /**
+ * Just retreives the unmodified values of the text fields as a
+ * string array.
+ */
+ public String[] retrieveResultStrings(Text[] texts) {
+ int n = texts.length;
+ String[] result = new String[n];
+ for (int i = 0; i < n; i++) {
+ result[i] = texts[i].getText();
+ }
+ return result;
+ }
+
+ }
+
+ private TableViewer viewer;
+ private Button addButton;
+ private Button editButton;
+ private Button removeButton;
+ private String dialogTitle;
+ private String[] fieldLabels;
+ private IDataModel model;
+ private String propertyName;
+ private Image labelProviderImage;
+ private StringArrayDialogCallback callback;
+
+ public StringArrayTableWizardSection(Composite parent, String title, String addButtonLabel, String removeButtonLabel,
+ String[] labelsForText, Image labelProviderImage, IDataModel model, String propertyName) {
+ this(parent, title, addButtonLabel, null, removeButtonLabel, labelsForText, labelProviderImage, model, propertyName);
+ }
+
+ public StringArrayTableWizardSection(Composite parent, String title, String addButtonLabel, String editButtonLabel, String removeButtonLabel,
+ String[] labelsForText, Image labelProviderImage, IDataModel model, String propertyName) {
+ this(parent, title, title, addButtonLabel, editButtonLabel, removeButtonLabel, labelsForText, labelsForText, labelProviderImage, model, propertyName);
+ }
+
+ public StringArrayTableWizardSection(Composite parent, String componentLabel, String dialogTitle, String addButtonLabel, String editButtonLabel, String removeButtonLabel,
+ String[] columnTitles, String[] fieldLabels, Image labelProviderImage, IDataModel model, String propertyName) {
+ super(parent, SWT.NONE);
+ this.dialogTitle = dialogTitle;
+ this.fieldLabels = fieldLabels;
+ this.labelProviderImage = labelProviderImage;
+ this.model = model;
+ this.propertyName = propertyName;
+
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 4;
+ layout.marginWidth = 0;
+ this.setLayout(layout);
+ this.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label titleLabel = new Label(this, SWT.LEFT);
+ titleLabel.setText(componentLabel);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ titleLabel.setLayoutData(data);
+
+ Table table = new Table(this, SWT.FULL_SELECTION | SWT.BORDER);
+ viewer = new TableViewer(table);
+ table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ viewer.setContentProvider(new StringArrayListContentProvider());
+ viewer.setLabelProvider(new StringArrayListLabelProvider());
+
+ final Composite buttonCompo = new Composite(this, SWT.NULL);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ buttonCompo.setLayout(layout);
+ buttonCompo.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ addButton = new Button(buttonCompo, SWT.PUSH);
+ addButton.setText(addButtonLabel);
+ addButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
+ addButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ handleAddButtonSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ //Do nothing
+ }
+ });
+
+ if (editButtonLabel != null) {
+ editButton = new Button(buttonCompo, SWT.PUSH);
+ editButton.setText(editButtonLabel);
+ editButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
+ editButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ handleEditButtonSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ //Do nothing
+ }
+ });
+ editButton.setEnabled(false);
+ }
+
+ removeButton = new Button(buttonCompo, SWT.PUSH);
+ removeButton.setText(removeButtonLabel);
+ removeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
+ removeButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ handleRemoveButtonSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ //Do nothing
+ }
+ });
+ removeButton.setEnabled(false);
+
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (editButton != null) {
+ boolean enabled = ((IStructuredSelection) selection).size() == 1;
+ editButton.setEnabled(enabled);
+ }
+ removeButton.setEnabled(!selection.isEmpty());
+ }
+ });
+
+ if (editButton != null) {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ handleEditButtonSelected();
+ }
+ });
+ }
+
+ if (columnTitles.length > 1) {
+ for (int i = 0; i < columnTitles.length; i++) {
+ TableColumn tableColumn = new TableColumn(table, SWT.NONE);
+ tableColumn.setText(columnTitles[i]);
+ }
+ table.setHeaderVisible(true);
+ this.addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ Table table = viewer.getTable();
+ TableColumn[] columns = table.getColumns();
+ Point buttonArea = buttonCompo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle area = table.getParent().getClientArea();
+ Point preferredSize = viewer.getTable().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int width = area.width - 2 * table.getBorderWidth() - buttonArea.x - columns.length * 2;
+ if (preferredSize.y > area.height + table.getHeaderHeight()) {
+ // Subtract the scrollbar width from the total column width
+ // if a vertical scrollbar will be required
+ Point vBarSize = table.getVerticalBar().getSize();
+ width -= vBarSize.x;
+ }
+ Point oldSize = table.getSize();
+ int consumeWidth = 0;
+ for (int i = 0; i < columns.length; i++) {
+ if (oldSize.x > area.width) {
+ // table is getting smaller so make the columns
+ // smaller first and then resize the table to
+ // match the client area width
+ consumeWidth = setColumntWidth(width, columns, consumeWidth, i);
+ table.setSize(area.width - buttonArea.x - columns.length * 2, area.height);
+ } else {
+ // table is getting bigger so make the table
+ // bigger first and then make the columns wider
+ // to match the client area width
+ table.setSize(area.width - buttonArea.x - columns.length * 2, area.height);
+ consumeWidth = setColumntWidth(width, columns, consumeWidth, i);
+ }
+ }
+ }
+
+ private int setColumntWidth(int width, TableColumn[] columns, int consumeWidth, int i) {
+ int localConsumeWidth = consumeWidth;
+ if (i < columns.length - 1) {
+ columns[i].setWidth(width / columns.length);
+ localConsumeWidth += columns[i].getWidth();
+ } else {
+ columns[i].setWidth(width - localConsumeWidth);
+ }
+ return localConsumeWidth;
+ }
+ });
+ }
+
+ callback = new StringArrayDialogCallbackAdapter();
+ }
+
+ private void handleAddButtonSelected() {
+ AddStringArrayDialog dialog = new AddStringArrayDialog(getShell(), dialogTitle, fieldLabels);
+ dialog.open();
+ String[] stringArray = dialog.getStringArray();
+ addStringArray(stringArray);
+ }
+
+ private void handleEditButtonSelected() {
+ ISelection s = viewer.getSelection();
+ if (!(s instanceof IStructuredSelection))
+ return;
+ IStructuredSelection selection = (IStructuredSelection) s;
+ if (selection.size() != 1)
+ return;
+
+ Object selectedObj = selection.getFirstElement();
+ String[] valuesForText = (String[]) selectedObj;
+
+ EditStringArrayDialog dialog = new EditStringArrayDialog(getShell(), dialogTitle, fieldLabels, valuesForText);
+ dialog.open();
+ String[] stringArray = dialog.getStringArray();
+ editStringArray(valuesForText, stringArray);
+ }
+
+ private void handleRemoveButtonSelected() {
+ ISelection selection = viewer.getSelection();
+ if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
+ return;
+ List selectedObj = ((IStructuredSelection) selection).toList();
+ removeStringArrays(selectedObj);
+ }
+
+ public void addStringArray(String[] stringArray) {
+ if (stringArray == null)
+ return;
+ List valueList = (List) viewer.getInput();
+ if (valueList == null)
+ valueList = new ArrayList();
+ valueList.add(stringArray);
+ setInput(valueList);
+ }
+
+ public void editStringArray(String[] oldStringArray, String[] newStringArray) {
+ if (newStringArray == null)
+ return;
+
+ List valueList = (List) viewer.getInput();
+ if (valueList == null)
+ valueList = new ArrayList();
+
+ int index = valueList.indexOf(oldStringArray);
+ if (index == -1) {
+ valueList.add(newStringArray);
+ } else {
+ valueList.set(index, newStringArray);
+ }
+
+ setInput(valueList);
+ }
+
+ public void removeStringArray(Object selectedStringArray) {
+ List valueList = (List) viewer.getInput();
+ valueList.remove(selectedStringArray);
+ setInput(valueList);
+ }
+
+ public void removeStringArrays(Collection selectedStringArrays) {
+ List valueList = (List) viewer.getInput();
+ valueList.removeAll(selectedStringArrays);
+ setInput(valueList);
+ }
+
+ public void setInput(List input) {
+ viewer.setInput(input);
+ // Create a new list to trigger property change
+ List newInput = new ArrayList();
+ newInput.addAll(input);
+ model.setProperty(propertyName, newInput);
+ }
+
+ public TableViewer getTableViewer() {
+ return viewer;
+ }
+
+ public Button getAddButton() {
+ return addButton;
+ }
+
+ public Button getEditButton() {
+ return editButton;
+ }
+
+ public Button getRemoveButton() {
+ return removeButton;
+ }
+
+ /**
+ * Set callback for customizing the preprocessing of the user input.
+ *
+ * @param callback an implementation of the callback interface.
+ */
+ public void setCallback(StringArrayDialogCallback callback) {
+ this.callback = callback;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java
new file mode 100644
index 0000000..c480d0b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/TableObjects.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.wizard;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Insert the type's description here. Creation date: (3/19/2001 5:10:14 PM)
+ *
+ * @author: Administrator
+ */
+public class TableObjects {
+ public List tableObjectsList;
+
+ /**
+ * EJBs constructor comment.
+ */
+ public TableObjects() {
+ super();
+ tableObjectsList = new ArrayList();
+ }
+
+ public List getTableObjects() {
+ return tableObjectsList;
+ }
+
+ protected void initList() {
+ if (tableObjectsList == null)
+ tableObjectsList = new ArrayList();
+
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties
new file mode 100644
index 0000000..b815ca6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/earlibraries.properties
@@ -0,0 +1,2 @@
+EARLibrariesContainerPage_0=EAR Libraries
+EARLibrariesContainerPage_1=The EAR Libraries classpath container dynamically computes the Java EE project's module classpath dependencies using the META-INF/MANIFEST.MF Class-Path entries.
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/messages.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/messages.properties
new file mode 100644
index 0000000..1ed5a8b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/messages.properties
@@ -0,0 +1 @@
+J2EEExportPage_Optimize_for_a_specific_server_runt_=Optimi&ze for a specific server runtime
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java
new file mode 100644
index 0000000..5a89717
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/IArchiveExportParticipantPanelFactory.java
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * Copyright (c) 2005, 2007 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.archive;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * Used in conjunction with the <code>org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels</code>
+ * extension point in order to extend the UI of the base module archive export wizard.
+ *
+ * @since 3.0
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public interface IArchiveExportParticipantPanelFactory
+{
+ /**
+ * Creates a composite containing the UI elements appropriate for the export participant
+ * that this panel factory is registered with.
+ *
+ * @param parent the parent composite
+ * @param dataModel the data model of the export participant
+ * @return the created composite
+ */
+
+ Composite createPanel( Composite parent,
+ IDataModel dataModel );
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java
new file mode 100644
index 0000000..38b1307
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/archive/internal/ArchiveExportParticipantPanelsExtensionPoint.java
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * Copyright (c) 2005, 2007 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.archive.internal;
+
+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.findExtensions;
+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.findRequiredAttribute;
+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.getTopLevelElements;
+import static org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.instantiate;
+import static org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin.PLUGIN_ID;
+import static org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin.log;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveExportParticipantsExtensionPoint.PluginUtil.InvalidExtensionException;
+import org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory;
+
+/**
+ * Contains the logic for processing the <code>org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels</code>
+ * extension point.
+ *
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class ArchiveExportParticipantPanelsExtensionPoint
+{
+ public static final String EXTENSION_POINT_ID = "archiveExportParticipantPanels"; //$NON-NLS-1$
+
+ private static final String EL_PANEL_FACTORY = "panel-factory"; //$NON-NLS-1$
+ private static final String ATTR_ARCHIVE_EXPORT_PARTICIPANT_ID = "archiveExportParticipantId"; //$NON-NLS-1$
+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
+
+ private static Map<String,PanelFactoryInfo> extensions = null;
+
+ public static class PanelFactoryInfo
+ {
+ private String archiveExportParticipantId;
+ private String pluginId = null;
+ private String className = null;
+
+ public String getArchiveExportExtensionId()
+ {
+ return this.archiveExportParticipantId;
+ }
+
+ public IArchiveExportParticipantPanelFactory loadPanelFactory()
+ {
+ try
+ {
+ return instantiate( this.pluginId, this.className,
+ IArchiveExportParticipantPanelFactory.class );
+ }
+ catch( CoreException e )
+ {
+ log( e.getStatus() );
+ return null;
+ }
+ }
+ }
+
+ public static PanelFactoryInfo getExtension( final String archiveExportParticipantId )
+ {
+ readExtensions();
+
+ return extensions.get( archiveExportParticipantId );
+ }
+
+ private static synchronized void readExtensions()
+ {
+ if( extensions != null )
+ {
+ return;
+ }
+
+ extensions = new HashMap<String,PanelFactoryInfo>();
+
+ for( IConfigurationElement element
+ : getTopLevelElements( findExtensions( PLUGIN_ID, EXTENSION_POINT_ID ) ) )
+ {
+ if( element.getName().equals( EL_PANEL_FACTORY ) )
+ {
+ try
+ {
+ readExtension( element );
+ }
+ catch( InvalidExtensionException e )
+ {
+ // Continue. The problem has been reported to the user via the log.
+ }
+ }
+ }
+ }
+
+ private static void readExtension( final IConfigurationElement config )
+
+ throws InvalidExtensionException
+
+ {
+ final PanelFactoryInfo ext = new PanelFactoryInfo();
+
+ ext.archiveExportParticipantId = findRequiredAttribute( config, ATTR_ARCHIVE_EXPORT_PARTICIPANT_ID );
+ ext.pluginId = config.getContributor().getName();
+ ext.className = findRequiredAttribute( config, ATTR_CLASS );
+
+ extensions.put( ext.archiveExportParticipantId, ext );
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.java
new file mode 100644
index 0000000..326dd76
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.java
@@ -0,0 +1,428 @@
+/******************************************************************************
+ * Copyright (c) 2005, 2009 BEA Systems, Inc. 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:
+ * Konstantin Komissarchik - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ * Milen Manov, milen.manov@sap.com - bugs 248623
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.project.facet;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.earcreation.IEarFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.internal.AvailableJ2EEComponentsForEARContentProvider;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.earcreation.DefaultJ2EEComponentCreationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.jst.j2ee.internal.wizard.DefaultJ2EEComponentCreationWizard;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentLabelProvider;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleFacetInstallPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public class EarFacetInstallPage extends J2EEModuleFacetInstallPage implements IEarFacetInstallDataModelProperties {
+
+ private Button selectAllButton;
+ private Button deselectAllButton;
+ private Button newModuleButton;
+
+ private Label moduleProjectsLabel;
+ private CheckboxTableViewer moduleProjectsViewer;
+
+ private boolean ignoreCheckedState = false;
+
+ private Label contentDirLabel;
+ private Text contentDir;
+
+ public EarFacetInstallPage() {
+ super("ear.facet.install.page"); //$NON-NLS-1$
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_SECOND_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_SECOND_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_WIZ_BANNER));
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{CONTENT_DIR, J2EE_PROJECTS_LIST};
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ setInfopopID(IJ2EEUIContextIds.NEW_EAR_ADD_MODULES_PAGE);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(gdhfill());
+
+ createModuleProjectOptions(composite);
+ createContentDirGroup(composite);
+
+ createGenerateDescriptorControl(composite, J2EEConstants.APPLICATION_DD_SHORT_NAME);
+ registerFacetVersionChangeListener();
+
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ protected int getJ2EEVersion() {
+ IProjectFacetVersion version = (IProjectFacetVersion)getDataModel().getProperty(FACET_VERSION);
+ return J2EEVersionUtil.convertVersionStringToInt(version.getVersionString());
+ }
+
+ /**
+ * @param parent
+ */
+ private void createModuleProjectOptions(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ moduleProjectsLabel = new Label(composite, SWT.NONE);
+ moduleProjectsLabel.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_MODULE_DEPENDENCIES_LABEL));
+ GridData gd = gdhfill();
+ gd.horizontalSpan = 2;
+ moduleProjectsLabel.setLayoutData(gd);
+
+ moduleProjectsViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.widthHint = 200;
+ gData.heightHint = 80;
+ moduleProjectsViewer.getControl().setLayoutData(gData);
+ int j2eeVersion = getJ2EEVersion();
+ ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+ AvailableJ2EEComponentsForEARContentProvider provider = new AvailableJ2EEComponentsForEARContentProvider(null, j2eeVersion, decorator);
+ moduleProjectsViewer.setContentProvider(provider);
+ final J2EEComponentLabelProvider labelProvider = new J2EEComponentLabelProvider(provider);
+ decorator.addListener(new ILabelProviderListener(){
+
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ if(!moduleProjectsViewer.getTable().isDisposed()){
+ moduleProjectsViewer.refresh(true);
+ }
+ }
+ });
+ moduleProjectsViewer.setLabelProvider(labelProvider);
+ setCheckedItemsFromModel();
+
+ moduleProjectsViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (!ignoreCheckedState) {
+ getDataModel().setProperty(J2EE_PROJECTS_LIST, getCheckedJ2EEElementsAsList());
+ getDataModel().setProperty(JAVA_PROJECT_LIST, getCheckedJavaProjectsAsList());
+ }
+ }
+ });
+ TableLayout tableLayout = new TableLayout();
+ moduleProjectsViewer.getTable().setLayout(tableLayout);
+ moduleProjectsViewer.getTable().setHeaderVisible(false);
+ moduleProjectsViewer.getTable().setLinesVisible(false);
+ moduleProjectsViewer.setSorter(null);
+ this.moduleProjectsViewer.getTable().getAccessible().addAccessibleListener(
+ new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = J2EEUIMessages.getResourceString(J2EEUIMessages.J2EE_MODULE_DEPENDENCIES_LABEL_ACCESSIBILITY);
+ }});
+
+ createButtonsGroup(composite);
+ }
+
+ /**
+ *
+ */
+ private void setCheckedItemsFromModel() {
+ List components = (List) getDataModel().getProperty(J2EE_PROJECTS_LIST);
+
+ TableItem [] items = moduleProjectsViewer.getTable().getItems();
+
+ List list = new ArrayList();
+
+ for( int i=0; i< items.length; i++ ){
+ Object element = items[i].getData();
+ if( element instanceof IVirtualComponent){
+ IVirtualComponent comp = (IVirtualComponent)element;
+ Iterator it = components.iterator();
+ while( it.hasNext() ){
+ IProject project = (IProject)it.next();
+ if( comp.getProject().getName().equals(project.getName()) ){
+ list.add(comp);
+ }
+ }
+ }
+ }
+ moduleProjectsViewer.setCheckedElements(list.toArray());
+ }
+
+ private void refreshModules() {
+ moduleProjectsViewer.refresh();
+ setCheckedItemsFromModel();
+ }
+
+ protected List getCheckedJ2EEElementsAsList() {
+ Object[] elements = moduleProjectsViewer.getCheckedElements();
+ List list;
+ if (elements == null || elements.length == 0)
+ list = Collections.EMPTY_LIST;
+ else{
+ list = new ArrayList();
+ for( int i=0; i< elements.length; i++){
+ if( elements[i] instanceof IVirtualComponent ) {
+ list.add(((IVirtualComponent)elements[i]).getProject());
+ }
+ }
+ }
+ return list;
+ }
+
+ protected List getCheckedJavaProjectsAsList() {
+ Object[] elements = moduleProjectsViewer.getCheckedElements();
+ List list;
+ if (elements == null || elements.length == 0)
+ list = Collections.EMPTY_LIST;
+ else{
+ list = new ArrayList();
+ for( int i=0; i< elements.length; i++){
+ if( elements[i] instanceof IProject ) {
+ list.add(elements[i]);
+ }
+ }
+ }
+ return list;
+ }
+
+
+ protected void createButtonsGroup(Composite parent) {
+ Composite buttonGroup = new Composite(parent, SWT.NONE);
+ buttonGroup.setLayout(new GridLayout());
+ buttonGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+
+ selectAllButton = new Button(buttonGroup, SWT.PUSH);
+ selectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_PROJECT_MODULES_PG_SELECT));
+ selectAllButton.addListener(SWT.Selection, this);
+ GridDataFactory.defaultsFor( selectAllButton ).applyTo( selectAllButton );
+
+ deselectAllButton = new Button(buttonGroup, SWT.PUSH);
+ deselectAllButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_PROJECT_MODULES_PG_DESELECT));
+ deselectAllButton.addListener(SWT.Selection, this);
+ GridDataFactory.defaultsFor( deselectAllButton ).applyTo( deselectAllButton );
+
+ new Label(buttonGroup, SWT.NONE); // pad
+
+ newModuleButton = new Button(buttonGroup, SWT.PUSH);
+ newModuleButton.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_PROJECT_MODULES_PG_NEW));
+ newModuleButton.addListener(SWT.Selection, this);
+ GridDataFactory.defaultsFor( newModuleButton ).applyTo( newModuleButton );
+ }
+
+ private void createContentDirGroup(Composite modulesGroup) {
+ final Composite composite = new Composite(modulesGroup, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ composite.setLayoutData(gdhfill());
+
+ this.contentDirLabel = new Label(composite, SWT.NONE);
+ this.contentDirLabel.setText(Resources.contentDirLabel);
+ this.contentDirLabel.setLayoutData(new GridData());
+
+ this.contentDir = new Text(composite, SWT.BORDER);
+ this.contentDir.setLayoutData(gdhfill());
+
+ synchHelper.synchText(contentDir, CONTENT_DIR, null);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(Event)
+ */
+ @Override
+ public void handleEvent(Event evt) {
+ if (evt.widget == selectAllButton)
+ handleSelectAllButtonPressed();
+ else if (evt.widget == deselectAllButton)
+ handleDeselectAllButtonPressed();
+ else if (evt.widget == newModuleButton)
+ handleNewModuleButtonPressed();
+ else
+ super.handleEvent(evt);
+ }
+
+ @Override
+ protected void handleFacetVersionChangedEvent()
+ {
+ String fv = model.getStringProperty(FACET_VERSION_STR);
+ boolean isEAR50OrGreater = J2EEVersionUtil.convertVersionStringToInt(fv) >= J2EEVersionConstants.VERSION_5_0;
+ this.addDD.setVisible(isEAR50OrGreater);
+ }
+
+ /**
+ *
+ */
+ private void handleNewModuleButtonPressed() {
+ IDataModel aModel = createNewModuleModel();
+ DefaultJ2EEComponentCreationWizard wizard = new DefaultJ2EEComponentCreationWizard(aModel);
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ dialog.create();
+ if (dialog.open() != IDialogConstants.CANCEL_ID) {
+ IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
+ moduleProjectsViewer.setInput(input);
+ setNewModules(aModel);
+ refreshModules();
+ }
+ }
+ /**
+ * @param model
+ */
+ private void setNewModules(IDataModel defaultModel) {
+ List newComponents = new ArrayList();
+ collectNewComponents(defaultModel, newComponents);
+ List oldComponents = (List) getDataModel().getProperty(J2EE_PROJECTS_LIST);
+ newComponents.addAll(oldComponents);
+ getDataModel().setProperty(J2EE_PROJECTS_LIST, newComponents);
+ }
+
+ private void collectNewComponents(IDataModel defaultModel, List newProjects) {
+ collectComponents(defaultModel.getNestedModel(IDefaultJ2EEComponentCreationDataModelProperties.NESTED_MODEL_EJB), newProjects);
+ collectComponents(defaultModel.getNestedModel(IDefaultJ2EEComponentCreationDataModelProperties.NESTED_MODEL_WEB), newProjects);
+ collectComponents(defaultModel.getNestedModel(IDefaultJ2EEComponentCreationDataModelProperties.NESTED_MODEL_CLIENT), newProjects);
+ collectComponents(defaultModel.getNestedModel(IDefaultJ2EEComponentCreationDataModelProperties.NESTED_MODEL_JCA), newProjects);
+ }
+ private void collectComponents(IDataModel compDM, List newProjects) {
+ if (compDM != null) {
+ String projectName = compDM.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
+ if(projectName == null) return;
+ IProject project = ProjectUtilities.getProject(projectName);
+ if (project != null && project.exists())
+ newProjects.add(project);
+ }
+ }
+
+ private IDataModel createNewModuleModel() {
+ IDataModel defaultModel = DataModelFactory.createDataModel(new DefaultJ2EEComponentCreationDataModelProvider());
+ // transfer properties, project name
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME);
+ defaultModel.setProperty(IDefaultJ2EEComponentCreationDataModelProperties.PROJECT_NAME, projectName);
+ // ear component name
+ String earName = model.getStringProperty(FACET_PROJECT_NAME);
+ defaultModel.setProperty(IDefaultJ2EEComponentCreationDataModelProperties.EAR_COMPONENT_NAME, earName);
+ // ear j2ee version
+ int j2eeVersion = getJ2EEVersion();
+ defaultModel.setProperty(IDefaultJ2EEComponentCreationDataModelProperties.J2EE_VERSION, new Integer(j2eeVersion));
+
+ FacetedProjectWorkingCopy fpwc = (FacetedProjectWorkingCopy)model.getProperty(FACETED_PROJECT_WORKING_COPY);
+ IRuntime rt = fpwc.getPrimaryRuntime();
+ defaultModel.setProperty(IDefaultJ2EEComponentCreationDataModelProperties.FACET_RUNTIME, rt);
+
+ return defaultModel;
+ }
+
+ /**
+ *
+ */
+ private void handleDeselectAllButtonPressed() {
+ ignoreCheckedState = true;
+ try {
+ moduleProjectsViewer.setAllChecked(false);
+ //getDataModel().setProperty(J2EE_COMPONENT_LIST, null);
+ //IDataModel nestedModel = (IDataModel)getDataModel().getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
+ //(nestedModel).setProperty(AddComponentToEnterpriseApplicationDataModelProvider., getCheckedJ2EEElementsAsList());
+ getDataModel().setProperty(J2EE_PROJECTS_LIST, null);
+ getDataModel().setProperty(JAVA_PROJECT_LIST, null);
+ } finally {
+ ignoreCheckedState = false;
+ }
+ }
+
+ /**
+ *
+ */
+ private void handleSelectAllButtonPressed() {
+ ignoreCheckedState = true;
+ try {
+ moduleProjectsViewer.setAllChecked(true);
+ //getDataModel().setProperty(J2EE_COMPONENT_LIST, getCheckedElementsAsList());
+ //IDataModel nestedModel = (IDataModel)getDataModel().getProperty(NESTED_ADD_COMPONENT_TO_EAR_DM);
+ //(nestedModel).setProperty(AddComponentToEnterpriseApplicationDataModelProvider., getCheckedJ2EEElementsAsList());
+
+ getDataModel().setProperty(J2EE_PROJECTS_LIST, getCheckedJ2EEElementsAsList());
+ getDataModel().setProperty(JAVA_PROJECT_LIST, getCheckedJavaProjectsAsList());
+
+ } finally {
+ ignoreCheckedState = false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.J2EEWizardPage#enter()
+ */
+ @Override
+ protected void enter() {
+ IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
+ moduleProjectsViewer.setInput(input);
+ super.enter();
+ }
+
+
+ private static final class Resources
+
+ extends NLS
+ {
+ public static String contentDirLabel;
+
+ static {
+ initializeMessages(EarFacetInstallPage.class.getName(), Resources.class);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.properties
new file mode 100644
index 0000000..2b4b77c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarFacetInstallPage.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# 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 Corporation - initial API and implementation
+###############################################################################
+contentDirLabel = &Content directory:
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectFirstPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectFirstPage.java
new file mode 100644
index 0000000..1c8ba60
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectFirstPage.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.ui.project.facet;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage;
+
+public class EarProjectFirstPage extends DataModelFacetCreationWizardPage {
+
+ public EarProjectFirstPage(IDataModel dataModel, String pageName) {
+ super(dataModel, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.EAR_WIZ_BANNER));
+ setInfopopID(IJ2EEUIContextIds.NEW_EAR_WIZARD_P1);
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return J2EEUIPlugin.getDefault().getDialogSettings();
+ }
+
+ @Override
+ protected String getModuleTypeID() {
+ return IModuleConstants.JST_EAR_MODULE;
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ final Composite top = super.createTopLevelComposite(parent);
+ createWorkingSetGroupPanel(top, new String[] { RESOURCE_WORKING_SET });
+ return top;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectWizard.java
new file mode 100644
index 0000000..ae391d1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarProjectWizard.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.ui.project.facet;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
+import org.osgi.framework.Bundle;
+
+public class EarProjectWizard extends NewProjectDataModelFacetWizard {
+
+ public EarProjectWizard(IDataModel model){
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_WIZ_TITLE));
+ }
+
+ public EarProjectWizard(){
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.EAR_COMPONENT_WIZ_TITLE));
+ }
+
+ @Override
+ protected IDataModel createDataModel() {
+ return DataModelFactory.createDataModel(new EARFacetProjectCreationDataModelProvider());
+ }
+
+ public void setRuntimeInDataModel(IRuntime runtime){
+ model.setProperty(FACET_RUNTIME, runtime);
+ }
+
+ @Override
+ protected ImageDescriptor getDefaultPageImageDescriptor() {
+ final Bundle bundle = Platform.getBundle("org.eclipse.jst.j2ee.ui"); //$NON-NLS-1$
+ final URL url = bundle.getEntry("icons/ear-wiz-banner.gif"); //$NON-NLS-1$
+
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ @Override
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate("template.jst.ear"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IWizardPage createFirstPage() {
+ return new EarProjectFirstPage(model, "first.page"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_EAR);
+ }
+
+ public void setEARName( String earName ){
+ model.setProperty(FACET_PROJECT_NAME, earName);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.java
new file mode 100644
index 0000000..1ece7b3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.java
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * Copyright (c) 2005, 2009 BEA Systems, Inc. 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:
+ * Konstantin Komissarchik - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.project.facet;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class EarSelectionPanel implements IWebFacetInstallDataModelProperties
+
+{
+ private final Button addToEar;
+ private final Combo combo;
+ private final Button newButton;
+ private final Label label;
+
+ private final IDataModel model;
+ private DataModelSynchHelper synchhelper;
+
+ public EarSelectionPanel( final IDataModel model, final Composite parent)
+ {
+ this.model = model;
+ this.synchhelper = new DataModelSynchHelper(model);
+
+ final Group group = new Group( parent, SWT.NONE );
+ group.setLayoutData( gdhfill() );
+ group.setLayout( new GridLayout( 3, false ) );
+ group.setText( Resources.earMemberShip );
+
+ this.addToEar = new Button( group, SWT.CHECK );
+ this.addToEar.setText( Resources.addToEarLabel );
+ GridDataFactory.defaultsFor(this.addToEar).span(3, 1).applyTo(this.addToEar);
+ synchhelper.synchCheckbox(addToEar, ADD_TO_EAR, null);
+
+ label = new Label(group, SWT.NULL);
+ label.setText(Resources.earProjectLabel);
+ this.combo = new Combo(group, SWT.NONE);
+ this.combo.setLayoutData( gdhfill() );
+
+ this.newButton = new Button( group, SWT.PUSH );
+ this.newButton.setText( Resources.newButtonLabel );
+ GridDataFactory.defaultsFor(this.newButton).applyTo(this.newButton);
+
+ this.newButton.addSelectionListener( new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected( final SelectionEvent event )
+ {
+ handleAddButton();
+ }
+ } );
+
+ synchhelper.synchCombo(combo, EAR_PROJECT_NAME, new Control[]{label, newButton});
+ Dialog.applyDialogFont(parent);
+ }
+
+ private void handleAddButton()
+ {
+ final EarProjectWizard wizard = new EarProjectWizard();
+
+ final WizardDialog dialog
+ = new WizardDialog( newButton.getShell(), wizard );
+
+ IRuntime runtime = (IRuntime)model.getProperty(FACET_RUNTIME);
+ wizard.setRuntimeInDataModel(runtime);
+
+ if( dialog.open() != Window.CANCEL )
+ {
+ model.notifyPropertyChange(EAR_PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
+ final String earproj = wizard.getProjectName();
+ model.setProperty(EAR_PROJECT_NAME, earproj);
+ }
+ }
+
+ private static GridData gdhfill()
+ {
+ return new GridData( GridData.FILL_HORIZONTAL );
+ }
+
+ public static final GridData gdhspan( final GridData gd,
+ final int span )
+ {
+ gd.horizontalSpan = span;
+ return gd;
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String addToEarLabel;
+ public static String newButtonLabel;
+ public static String earProjectLabel;
+ public static String earMemberShip;
+
+ static
+ {
+ initializeMessages( EarSelectionPanel.class.getName(),
+ Resources.class );
+ }
+ }
+
+ public void dispose() {
+ if(synchhelper != null){
+ synchhelper.dispose();
+ synchhelper = null;
+ }
+ }
+
+ public String getComboText(){
+ return combo.getText();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.properties
new file mode 100644
index 0000000..f7ab193
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/EarSelectionPanel.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# 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
+# SAP AG - adding keyboard shortcuts
+###############################################################################
+addToEarLabel = &Add project to an EAR
+newButtonLabel = New &Project...
+earProjectLabel=&EAR project name:
+earMemberShip=EAR membership
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.java
new file mode 100644
index 0000000..bcc777d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.java
@@ -0,0 +1,185 @@
+/******************************************************************************
+ * Copyright (c) 2005-2007 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.project.facet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class RuntimeMismatchMarkerResolutions
+
+ implements IMarkerResolutionGenerator
+
+{
+ private static final String ATTR_RUNTIME1 = "runtime1"; //$NON-NLS-1$
+ private static final String ATTR_RUNTIME2 = "runtime2"; //$NON-NLS-1$
+ private static final String ATTR_MODULE_PROJECT = "moduleProject"; //$NON-NLS-1$
+
+ public IMarkerResolution[] getResolutions( final IMarker marker )
+ {
+ final List resolutions = new ArrayList( 2 );
+
+ try
+ {
+ final IProject earProject = marker.getResource().getProject();
+ final IFacetedProject earFacetedProject = ProjectFacetsManager.create( earProject );
+ final IProject modProject = getModuleProject( marker );
+ final IFacetedProject modFacetedProject = ProjectFacetsManager.create( modProject );
+
+ for( Iterator itr = getRuntimes( marker ).iterator(); itr.hasNext(); )
+ {
+ final IRuntime runtime = (IRuntime) itr.next();
+
+ if( earFacetedProject.isTargetable( runtime ) &&
+ modFacetedProject.isTargetable( runtime ) )
+ {
+ final Resolution resolution
+ = new Resolution( earFacetedProject, modFacetedProject, runtime );
+
+ resolutions.add( resolution );
+ }
+ }
+ }
+ catch( CoreException e )
+ {
+ J2EEUIPlugin.logError( -1, null, e );
+ }
+
+ IMarkerResolution[] array = new IMarkerResolution[ resolutions.size() ];
+ resolutions.toArray( array );
+
+ return array;
+ }
+
+ private static IProject getModuleProject( final IMarker marker )
+ {
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final String moduleProjectName = marker.getAttribute( ATTR_MODULE_PROJECT, null );
+ return ws.getRoot().getProject( moduleProjectName );
+ }
+
+ private static List getRuntimes( final IMarker marker )
+ {
+ final List runtimes = new ArrayList();
+
+ IRuntime r = getRuntimeByName( marker.getAttribute( ATTR_RUNTIME1, null ) );
+ if( r != null ) runtimes.add( r );
+
+ r = getRuntimeByName( marker.getAttribute( ATTR_RUNTIME2, null ) );
+ if( r != null ) runtimes.add( r );
+
+ return runtimes;
+ }
+
+ private static IRuntime getRuntimeByName( final String name )
+ {
+ if( RuntimeManager.isRuntimeDefined( name ) )
+ {
+ return RuntimeManager.getRuntime( name );
+ }
+ return null;
+ }
+
+ private static final class Resolution
+
+ implements IMarkerResolution
+
+ {
+ private final IFacetedProject earProject;
+ private final IFacetedProject moduleProject;
+ private final IRuntime runtime;
+
+ public Resolution( final IFacetedProject earProject,
+ final IFacetedProject moduleProject,
+ final IRuntime runtime )
+ {
+ this.earProject = earProject;
+ this.moduleProject = moduleProject;
+ this.runtime = runtime;
+ }
+
+ public String getLabel()
+ {
+ return NLS.bind( Resources.useSameRuntime, this.runtime.getLocalizedName() );
+ }
+
+ public void run( final IMarker marker )
+ {
+ try
+ {
+ setRuntime( this.earProject, this.runtime );
+ setRuntime( this.moduleProject, this.runtime );
+ }
+ catch( CoreException e )
+ {
+ ErrorDialog.openError( null, Resources.errorDialogTitle,
+ Resources.errorDialogMessage, e.getStatus() );
+ }
+ }
+
+ private void setRuntime( final IFacetedProject fproj,
+ final IRuntime runtime )
+
+ throws CoreException
+
+ {
+ final IRuntime currentPrimaryRuntime = fproj.getPrimaryRuntime();
+
+ if( currentPrimaryRuntime != null &&
+ ! currentPrimaryRuntime.getName().equals( runtime.getName() ) )
+ {
+ if( ! fproj.isTargeted( runtime ) )
+ {
+ fproj.addTargetedRuntime( runtime, null );
+ }
+
+ fproj.setPrimaryRuntime( runtime, null );
+ }
+ }
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String useSameRuntime;
+ public static String errorDialogTitle;
+ public static String errorDialogMessage;
+
+ static
+ {
+ initializeMessages( RuntimeMismatchMarkerResolutions.class.getName(),
+ Resources.class );
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.properties
new file mode 100644
index 0000000..f8b03d6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/RuntimeMismatchMarkerResolutions.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2005, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+useSameRuntime = Switch both projects to {0}
+errorDialogTitle = Error
+errorDialogMessage = Failed while applying the quick fix.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.java
new file mode 100644
index 0000000..29bbeb7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.ui.project.facet;
+
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class UtilityProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
+
+ public UtilityProjectFirstPage(IDataModel dataModel, String pageName) {
+ super(dataModel, pageName);
+ setTitle(Resources.pageTitle);
+ setDescription(Resources.pageDescription);
+ setInfopopID(IJ2EEUIContextIds.NEW_UTILITY_WIZARD_P1);
+ }
+
+ private static final class Resources extends NLS {
+ public static String pageTitle;
+ public static String pageDescription;
+
+ static {
+ initializeMessages(UtilityProjectFirstPage.class.getName(), Resources.class);
+ }
+ }
+
+ @Override
+ protected String getModuleFacetID() {
+ return J2EEProjectUtilities.UTILITY;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.properties b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.properties
new file mode 100644
index 0000000..0a6de07
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectFirstPage.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# 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 Corporation - initial API and implementation
+###############################################################################
+pageTitle = Utility Module
+pageDescription = Configure utility module settings.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectWizard.java
new file mode 100644
index 0000000..f801445
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/UtilityProjectWizard.java
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.ui.project.facet;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.project.facet.UtilityProjectCreationDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public class UtilityProjectWizard extends NewProjectDataModelFacetWizard {
+
+ public UtilityProjectWizard(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVAUTIL_COMPONENT_WIZ_TITLE));
+ }
+
+ public UtilityProjectWizard(){
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVAUTIL_COMPONENT_WIZ_TITLE));
+ }
+
+ @Override
+ protected IDataModel createDataModel() {
+ return DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
+ }
+
+ @Override
+ protected ImageDescriptor getDefaultPageImageDescriptor() {
+ final Bundle bundle = Platform.getBundle("org.eclipse.jst.j2ee.ui"); //$NON-NLS-1$
+ final URL url = bundle.getEntry("icons/util-wiz-banner.gif"); //$NON-NLS-1$
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ @Override
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate("template.jst.utility"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IWizardPage createFirstPage() {
+ return new UtilityProjectFirstPage(model, "first.page"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_UTILITY);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientFacetInstallPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientFacetInstallPage.java
new file mode 100644
index 0000000..9ecebbb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientFacetInstallPage.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.ui.project.facet.appclient;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleFacetInstallPage;
+import org.eclipse.jst.j2ee.project.facet.IAppClientFacetInstallDataModelProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class AppClientFacetInstallPage extends J2EEModuleFacetInstallPage implements IAppClientFacetInstallDataModelProperties {
+
+ private Button createMainClass;
+
+ public AppClientFacetInstallPage() {
+ super("appclient.facet.install.page"); //$NON-NLS-1$
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJECT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_SETTINGS));
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return new String[]{EAR_PROJECT_NAME, CONFIG_FOLDER, CREATE_DEFAULT_MAIN_CLASS};
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ setInfopopID(IJ2EEUIContextIds.NEW_APPCLIENT_WIZARD_P3);
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ createMainClass = new Button(composite, SWT.CHECK);
+ createMainClass.setText(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_CREATE_MAIN));
+ synchHelper.synchCheckbox(createMainClass, CREATE_DEFAULT_MAIN_CLASS, null);
+
+ createGenerateDescriptorControl(composite, J2EEConstants.APP_CLIENT_DD_SHORT_NAME);
+ registerFacetVersionChangeListener();
+
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ @Override
+ protected void handleFacetVersionChangedEvent()
+ {
+ final IProjectFacetVersion fv = (IProjectFacetVersion) this.model.getProperty( FACET_VERSION );
+ boolean isJEE5OrGreater = J2EEVersionUtil.convertVersionStringToInt(fv.getVersionString()) >= J2EEVersionConstants.JEE_5_0_ID;
+ this.addDD.setVisible(isJEE5OrGreater);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectFirstPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectFirstPage.java
new file mode 100644
index 0000000..b9d0fe4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectFirstPage.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.jst.j2ee.ui.project.facet.appclient;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.internal.actions.IJ2EEUIContextIds;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public class AppClientProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
+
+ public AppClientProjectFirstPage(IDataModel dataModel, String pageName) {
+ super(dataModel, pageName);
+ setTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJECT_MAIN_PG_TITLE));
+ setDescription(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJECT_MAIN_PG_DESC));
+ setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.APP_CLIENT_PROJECT_WIZARD_BANNER));
+ setInfopopID(IJ2EEUIContextIds.NEW_APPCLIENT_WIZARD_P1);
+ }
+
+ @Override
+ protected String getModuleFacetID() {
+ return J2EEProjectUtilities.APPLICATION_CLIENT;
+ }
+
+ @Override
+ protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
+ {
+ IRuntime runtime = (IRuntime)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( 2 );
+
+ if(runtime != null) {
+ facets.addAll(super.getFacetConfiguration(primaryFacetVersion));
+ }
+ else {
+ facets.add( primaryFacetVersion );
+
+ if( primaryFacetVersion == IJ2EEFacetConstants.APPLICATION_CLIENT_60)
+ {
+ facets.add( JavaFacetUtils.JAVA_60 );
+ }
+ else if(primaryFacetVersion == IJ2EEFacetConstants.APPLICATION_CLIENT_50)
+ {
+ facets.add( JavaFacetUtils.JAVA_50 );
+ }
+ else if( primaryFacetVersion == IJ2EEFacetConstants.APPLICATION_CLIENT_14)
+ {
+ facets.add( JavaFacetUtils.JAVA_14 );
+ }
+ else if( primaryFacetVersion == IJ2EEFacetConstants.APPLICATION_CLIENT_13 ||
+ primaryFacetVersion == IJ2EEFacetConstants.APPLICATION_CLIENT_12 )
+ {
+ facets.add( JavaFacetUtils.JAVA_13 );
+ }
+ }
+ return Collections.unmodifiableSet( facets );
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectWizard.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectWizard.java
new file mode 100644
index 0000000..3bd07a0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/ui/project/facet/appclient/AppClientProjectWizard.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.jst.j2ee.ui.project.facet.appclient;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientFacetProjectCreationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
+import org.osgi.framework.Bundle;
+
+public class AppClientProjectWizard extends NewProjectDataModelFacetWizard {
+
+ public AppClientProjectWizard(IDataModel model) {
+ super(model);
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJECT_WIZ_TITLE));
+ }
+
+ public AppClientProjectWizard() {
+ super();
+ setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.APP_CLIENT_PROJECT_WIZ_TITLE));
+ }
+
+ @Override
+ protected IDataModel createDataModel() {
+ return DataModelFactory.createDataModel(new AppClientFacetProjectCreationDataModelProvider());
+ }
+
+ @Override
+ protected ImageDescriptor getDefaultPageImageDescriptor() {
+ final Bundle bundle = Platform.getBundle(J2EEUIPlugin.PLUGIN_ID);
+ final URL url = bundle.getEntry("icons/full/wizban/appclient_wiz.gif"); //$NON-NLS-1$
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ @Override
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate("template.jst.appclient"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IWizardPage createFirstPage() {
+ return new AppClientProjectFirstPage(model, "first.page"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getFinalPerspectiveID() {
+ return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_APPCLIENT);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/javadoc.xml b/plugins/org.eclipse.jst.j2ee.ui/javadoc.xml
new file mode 100644
index 0000000..633a03e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/javadoc.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="javadoc">
+ <target name="javadoc">
+ <javadoc access="protected" author="false" classpath="../org.eclipse.jst.j2ee.web/bin;../org.eclipse.jst.common.frameworks/bin;../org.eclipse.jst.common.navigator.java/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\core.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.common.uriresolver_1.0.0\uriresolver.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.edit.ui_2.1.0\runtime\edit.ui.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.wsdl_1.0.0\wsdl.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui.editors_3.1.0\editors.jar;D:\Development\targets\wtp_target\eclipse\plugins\com.ibm.wtp.common.util_1.0.1\util.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.ecore.edit_2.1.0\runtime\ecore.edit.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.xml.uriresolver_1.0.0\xmlcatalog.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui.workbench_3.1.0\workbench.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.core.runtime.compatibility_3.0.0\compatibility.jar;D:\Development\targets\wtp_target\eclipse\plugins\com.ibm.wtp.emf.workbench_1.0.1.1\emfworkbench.jar;../org.eclipse.jst.j2ee.jca.ui/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.edit_2.1.0\runtime\edit.jar;../org.eclipse.wst.common.emfworkbench.integration/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jem.workbench_1.0.1.1\workbench.jar;../org.eclipse.wst.validation/bin;../org.eclipse.wst.web/bin;../org.eclipse.jst.ejb.ui/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jdt.core_3.1.0\jdtcore.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\osgi.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.common.ui_2.0.1\runtime\common.ui.jar;../org.eclipse.jst.common.annotations.controller/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.codegen_2.1.0\runtime\codegen.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui.ide_3.1.0\ide.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jdt.ui_3.1.0\jdt.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jem_1.0.1\javainst.jar;../org.eclipse.jst.j2ee.ejb/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\defaultAdaptor.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.swt.win32_3.1.0\ws\win32\swt.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\resolver.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.wsdl_1.0.0\jars\wsdl4j.jar;../org.eclipse.jst.j2ee.jca/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.xsd_2.1.0\runtime\xsd.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jface.text_3.1.0\jfacetext.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui.workbench.texteditor_3.1.0\texteditor.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui.views_3.1.0\views.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.core.resources_3.1.0\resources.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.common.contentmodel_1.0.0\contentmodel.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.text_3.1.0\text.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.ws.parser_1.0.0\parser.jar;../org.eclipse.jst.j2ee/bin;../org.eclipse.jst.common.annotations.core/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\eclipseAdaptor.jar;../org.eclipse.jst.j2ee.core/runtime/j2ee.jar;../org.eclipse.wst.sse.core/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.core.filebuffers_3.1.0\filebuffers.jar;../org.eclipse.wst.common.navigator.workbench/bin;../org.eclipse.wst.common.migration/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.webbrowser_1.0.0\webbrowser.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jem_1.0.1\mofjava.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.server.core_3.0.0\servercore.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.common_2.1.0\runtime\common.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.server.ui_3.0.0\serverui.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jdt.launching_3.1.0\launching.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.wsdl_1.0.0\jars\qname.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ui_3.1.0\ui.jar;../org.eclipse.wst.common.frameworks/bin;../org.eclipse.jst.j2ee.core/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.codegen.ecore_2.1.0\runtime\codegen.ecore.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.ltk.core.refactoring_3.1.0\refcore.jar;../org.eclipse.jst.servlet.ui/bin;bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.core.runtime_3.1.0\runtime.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.osgi_3.1.0\console.jar;../org.eclipse.wst.common.emf/bin;../org.eclipse.wst.common.navigator.views/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.update.configurator_3.0.0\configurator.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.ecore.xmi_2.1.0\runtime\ecore.xmi.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jface_3.1.0\jface.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.emf.ecore_2.1.0\runtime\ecore.jar;../org.eclipse.wst.common.frameworks.ui/bin;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.jst.server.core_3.0.0\sjavacore.jar;D:\Development\targets\wtp_target\eclipse\plugins\org.eclipse.wst.common.encoding_1.0.0\encodingresource.jar" destdir="D:\Development\wtp_api_docs" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="org.eclipse.jst.j2ee.jca.ui,org.eclipse.jst.servlet.ui,org.eclipse.jst.j2ee.ui,org.eclipse.jst.ejb.ui" sourcepath="j2ee_ui;../org.eclipse.jst.ejb.ui/property_files;../org.eclipse.jst.servlet.ui/property_files;property_files;../org.eclipse.jst.servlet.ui/servlet_ui;../org.eclipse.jst.ejb.ui/ejb_ui;../org.eclipse.jst.j2ee.jca.ui/property_files;../org.eclipse.jst.j2ee.jca.ui/jca_ui" splitindex="true" use="true" version="true"/>
+ </target>
+</project>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/plugin.properties b/plugins/org.eclipse.jst.j2ee.ui/plugin.properties
new file mode 100644
index 0000000..9824ea7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/plugin.properties
@@ -0,0 +1,43 @@
+###############################################################################
+# Copyright (c) 2003, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+j2ee=Java EE
+client.jar.file_ui_=App Client JAR file
+client.import.description_ui_=Import an external Application Client JAR file into an Application Client project
+client.export.description_ui_=Export an Application Client project into an Application Client JAR file
+ear.file_ui_=EAR file
+ear.import.description_ui_=Import an external EAR file into an Enterprise Application project
+
+ear.export.description_ui_=Export an Enterprise Application project into an EAR file
+j2ee.category_ui_=Java EE
+j2ee.actions.description_ui_=Actions for Java EE Development
+create.enterprise.application_ui_=Create an Enterprise Application
+create.client.module_ui_=Create an Application Client project
+ejb.export.action.description_ui_=Export EJB JAR File...
+utility_jar_import_wizard=Java EE Utility Jar
+ear_component_ui_=Enterprise Application Project
+new.ear.component.description_ui_=Create a Java EE EAR project
+appclient_component_ui_=Application Client Project
+new.appclient.component.description_ui_=Create a Java EE application client project
+J2EEDependenciesPage.name = Java EE Module Dependencies
+util-project-wizard-name = Utility Project
+util-project-wizard-description = Create a Utility project
+utility.import.description_ui_=Import one or more external *.jar files as Java EE Utility Projects or *.jars.
+Web_Project_Settings=Web Project Settings
+update-ear-libraries=Update EAR Libraries
+update-ear-libraries-tooltip=Recompute the contents of the EAR Libraries classpath container.
+earLibrariesContainerName=EAR Libraries
+
+Bundle-Name.0 = WTP J2EE UI Plug-in
+Bundle-Vendor.0 = Eclipse Web Tools Platform
+javaee.ui.popupMenu=Java EE Tools
+
+Project=Project
+AddJavaBuildPathEntriesWizardFragment-Name = Java Build Path Entries
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/plugin.xml b/plugins/org.eclipse.jst.j2ee.ui/plugin.xml
new file mode 100644
index 0000000..434a90c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/plugin.xml
@@ -0,0 +1,856 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension-point
+ id="archiveExportParticipantPanels"
+ name="Archive Export Participant Panels Extension Point"
+ schema="schema/archiveExportParticipantPanels.exsd"/>
+
+ <extension-point id="JavaEEPreferencePageExtender"
+ name="JavaEEPreferencePage"
+ schema="schema/JavaEEPreferencePageExtender.exsd"/>
+
+<!--================================-->
+<!-- Project Wizard Contributions -->
+<!--================================-->
+ <extension
+ id="J2EEUIProjectWizards"
+ point="org.eclipse.ui.newWizards">
+ <category
+ name="%j2ee.category_ui_"
+ id="org.eclipse.jst.j2ee.internal">
+ </category>
+<!-- Flexible Project Wizard
+ <wizard
+ name="%flexible.project_ui_"
+ icon="icons/full/ctool16/newear_wiz.gif"
+ category="org.eclipse.jdt.ui.java"
+ class="org.eclipse.jst.j2ee.internal.wizard.FlexibleProjectCreationWizard"
+ project="true"
+ finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
+ id="org.eclipse.jst.j2ee.ui.FlexibleProjectCreationWizard"
+ >
+ <description>
+ %new.flexible.project.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>-->
+<!-- EAR Component Wizard -->
+ <wizard
+ name="%ear_component_ui_"
+ icon="icons/full/ctool16/newear_wiz.gif"
+ category="org.eclipse.jst.j2ee.internal"
+ project="true"
+ finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
+ id="org.eclipse.jst.j2ee.ui.project.facet.EarProjectWizard">
+ <class class="org.eclipse.jst.j2ee.ui.project.facet.EarProjectWizard">
+ <parameter name="javaeeproject" value="true" />
+ <parameter name="menuIndex" value="30" />
+ </class>
+ <description>
+ %new.ear.component.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource" />
+ </wizard>
+<!-- Application Client Component Wizard -->
+ <wizard
+ name="%appclient_component_ui_"
+ icon="icons/full/ctool16/newappclient_wiz.gif"
+ category="org.eclipse.jst.j2ee.internal"
+ project="true"
+ finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
+ id="org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientProjectWizard">
+ <class class="org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientProjectWizard">
+ <parameter name="javaeeproject" value="true"/>
+ <parameter name="menuIndex" value="40" />
+ </class>
+ <description>
+ %new.appclient.component.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource" />
+ </wizard>
+<!-- Utility Component Wizard -->
+ <wizard
+ name="%util-project-wizard-name"
+ icon="icons/util-wiz-icon.gif"
+ category="org.eclipse.jst.j2ee.internal"
+ project="true"
+ finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
+ id="org.eclipse.jst.j2ee.ui.project.facet.UtilityProjectWizard">
+ <class class="org.eclipse.jst.j2ee.ui.project.facet.UtilityProjectWizard">
+ <parameter name="javaeeproject" value="true"/>
+ <parameter name="menuIndex" value="60" />
+ </class>
+ <description>
+ %util-project-wizard-description
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource" />
+ </wizard>
+
+ </extension>
+
+<!--================================-->
+<!-- Import Wizard Contributions -->
+<!--================================-->
+ <extension
+ point="org.eclipse.ui.importWizards">
+ <wizard
+ category="org.eclipse.jst.j2ee.internal"
+ class="org.eclipse.jst.j2ee.internal.wizard.AppClientComponentImportWizard"
+ icon="icons/full/ctool16/appclient_import_wiz.gif"
+ id="org.eclipse.jst.j2ee.internal.wizard.AppClientComponentImportWizard"
+ name="%client.jar.file_ui_">
+ <description>
+ %client.import.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <wizard
+ category="org.eclipse.jst.j2ee.internal"
+ class="org.eclipse.jst.j2ee.internal.wizard.EARComponentImportWizard"
+ icon="icons/full/ctool16/import_ear.gif"
+ id="org.eclipse.jst.j2ee.internal.wizard.EARComponentImportWizard"
+ name="%ear.file_ui_">
+ <description>
+ %ear.import.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <wizard
+ category="org.eclipse.jst.j2ee.internal"
+ class="org.eclipse.jst.j2ee.internal.wizard.J2EEUtilityJarImportWizardNew"
+ icon="icons/util-wiz-icon.gif"
+ id="org.eclipse.jst.j2ee.internal.wizard.J2EEUtilityJarImportWizardNew"
+ name="%utility_jar_import_wizard">
+ <description>
+ %utility.import.description_ui_
+ </description>
+ <selection class="org.eclipse.core.resources.IResource"/>
+ </wizard>
+ <category
+ id="org.eclipse.jst.j2ee.internal"
+ name="%j2ee.category_ui_"/>
+ </extension>
+
+ <!-- <wizard
+ class="org.eclipse.jst.j2ee.internal.wizard.J2EEUtilityJarImportWizard"
+ icon="icons/jar_obj.gif"
+ name="%utility_jar_import_wizard"
+ id="org.eclipse.jst.j2ee.ui.J2EEUtilityJarImportWizard">
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <wizard
+ name="%Import_Classes"
+ icon=""
+ class="org.eclipse.jst.j2ee.internal.wizard.ClassesImportWizard"
+ id="org.eclipse.jst.j2ee.internal.wizard.ClassesImportWizard">
+
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ </extension> -->
+<!--================================-->
+<!-- Export Wizard Contributions -->
+<!--================================-->
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <wizard
+ category="org.eclipse.jst.j2ee.internal"
+ class="org.eclipse.jst.j2ee.internal.wizard.AppClientComponentExportWizard"
+ icon="icons/full/ctool16/appclient_export.gif"
+ id="org.eclipse.jst.j2ee.internal.wizard.AppClientComponentExportWizard"
+ name="%client.jar.file_ui_">
+ <description>
+ %client.export.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <wizard
+ category="org.eclipse.jst.j2ee.internal"
+ class="org.eclipse.jst.j2ee.internal.wizard.EARComponentExportWizard"
+ icon="icons/full/ctool16/export_ear.gif"
+ id="org.eclipse.jst.j2ee.internal.wizard.EARComponentExportWizard"
+ name="%ear.file_ui_">
+ <description>
+ %ear.export.description_ui_
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <category
+ id="org.eclipse.jst.j2ee.internal"
+ name="%j2ee.category_ui_"/>
+ </extension>
+<!-- ====================================================== -->
+<!-- Extension point: org.eclipse.ui.projectNatureImages -->
+<!-- Purpose: Attach icon overlays for J2EE project natures -->
+<!-- ====================================================== -->
+ <extension
+ point="org.eclipse.ui.ide.projectNatureImages">
+ <image
+ icon="icons/full/ovr16/ejb_module_ovr.gif"
+ natureId="org.eclipse.jst.j2ee.ejb.EJBNature"
+ id="org.eclipse.ui.ejbProjectNatureImage">
+ </image>
+ <image
+ icon="icons/full/ovr16/enterprise_app_ovr.gif"
+ natureId="org.eclipse.jst.j2ee.EARNature"
+ id="org.eclipse.ui.earProjectNatureImage">
+ </image>
+ <image
+ icon="icons/full/ovr16/client_app_ovr.gif"
+ natureId="org.eclipse.jst.j2ee.ApplicationClientNature"
+ id="org.eclipse.ui.appClientModProjectNatureImage">
+ </image>
+ <image
+ icon="icons/full/ovr16/connector_ovr.gif"
+ natureId="org.eclipse.jst.j2ee.jca.ConnectorNature"
+ id="org.eclipse.ui.ConnectorModProjectNatureImage">
+ </image>
+ <image
+ icon="icons/full/ovr16/web_module_ovr.gif"
+ natureId="org.eclipse.jst.j2ee.web.WebNature"
+ id="org.eclipse.ui.webProjectNatureImage">
+ </image>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.frameworks.ui.wtpuiAction">
+ <masterOperation
+ description="Delete the dependent J2EE modules"
+ extendedGenericId="org.eclipse.wst.common.generic.Delete"
+ populatorClass="org.eclipse.jst.j2ee.internal.ui.actions.J2EEDeleteModuleActionPopulator"
+ operationClass="org.eclipse.wst.common.frameworks.internal.operation.extension.ui.IActionWTPOperation"
+ name="Delete J2EE Dependent Modules"
+ alwaysExecute="true"
+ overrideId="org.eclipse.wst.common.actions.Java.delete">
+ <selectionEnablement>
+ <or>
+ <and>
+ <objectClass name="org.eclipse.core.resources.IProject"
+ adaptable="true" />
+ <or>
+ <objectState
+ value="org.eclipse.jst.j2ee.EARNature"
+ name="projectNature" />
+ <objectState
+ value="org.eclipse.jst.j2ee.ApplicationClientNature"
+ name="projectNature" />
+ <objectState
+ value="org.eclipse.jst.j2ee.jca.ConnectorNature"
+ name="projectNature" />
+ <objectState
+ value="org.eclipse.jst.j2ee.ejb.EJBNature"
+ name="projectNature" />
+ <objectState
+ value="org.eclipse.jst.j2ee.web.WebNature"
+ name="projectNature" />
+ </or>
+ </and>
+ <objectClass
+ name="org.eclipse.jst.j2ee.internal.application.Application">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.internal.client.ApplicationClient">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.internal.jca.Connector">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.internal.ejb.EJBJar">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.internal.webapplication.WebApp">
+ </objectClass>
+ </or>
+ </selectionEnablement>
+ </masterOperation>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.emfworkbench.integration.adapterFactory">
+ <adapterFactory
+ className="org.eclipse.jst.j2ee.internal.ejb.provider.J2EEEjbItemProviderAdapterFactory"
+ packageURI="ejb.xmi"
+ id="org.eclipse.jst.j2ee.internal.ejb.provider.J2EEEjbItemProviderAdapterFactory">
+ <view
+ id="org.eclipse.ui.navigator.ProjectExplorer">
+ </view>
+ </adapterFactory>
+ <adapterFactory
+ className="org.eclipse.jst.j2ee.internal.war.ui.util.J2EEWebItemProviderAdapterFactory"
+ packageURI="webapplication.xmi"
+ id="org.eclipse.jst.j2ee.internal.war.ui.util.J2EEWebItemProviderAdapterFactory">
+ <view
+ id="org.eclipse.ui.navigator.ProjectExplorer">
+ </view>
+ </adapterFactory>
+ <adapterFactory
+ className="org.eclipse.jst.j2ee.internal.provider.J2EEApplicationItemProviderAdapterFactory"
+ packageURI="application.xmi"
+ id="org.eclipse.jst.j2ee.internal.provider.J2EEApplicationItemProviderAdapterFactory">
+ <view
+ id="org.eclipse.ui.navigator.ProjectExplorer">
+ </view>
+ </adapterFactory>
+ </extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution objectClass="org.eclipse.core.resources.IProject" adaptable="true" id="org.eclipse.jst.j2ee.ui.popupMenu">
+ <menu label="%javaee.ui.popupMenu" id="javeeUIPopupMenuCategory">
+ <separator name="slot1"/> <!-- New/featured Java EE actions -->
+ <separator name="slot2"/> <!-- Create files category -->
+ <separator name="slot3"/> <!-- Project creation(clients) -->
+ <separator name="slot4"/> <!-- Legacy(J2EE) actions -->
+ </menu>
+ </objectContribution>
+ <!-- additional object contribution -->
+ <objectContribution objectClass="org.eclipse.jdt.core.IJavaElement" adaptable="true" id="org.eclipse.jst.j2ee.ui.javaElement.popupMenu">
+ <menu label="%javaee.ui.popupMenu" id="javeeUIPopupMenuCategory.javaElement">
+ <separator name="slot1"/>
+ <separator name="slot2"/>
+ <separator name="slot3"/>
+ <separator name="slot4"/>
+ </menu>
+ </objectContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true"
+ id="org.eclipse.jst.j2ee.internal.actions.ForceClasspathUpdateAction">
+ <action
+ label="%update-ear-libraries"
+ tooltip="%update-ear-libraries-tooltip"
+ class="org.eclipse.jst.j2ee.internal.actions.ForceClasspathUpdateAction"
+ menubarPath="javeeUIPopupMenuCategory/slot1"
+ enablesFor="+"
+ icon="icons/full/obj16/library_obj.gif"
+ id="org.eclipse.jst.j2ee.internal.actions.ForceClasspathUpdateAction">
+ </action>
+ <enablement>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <and>
+
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.frameworks.actions.show"
+ args="org.eclipse.jst.j2ee.internal.actions.ForceClasspathUpdateAction"/>
+
+
+ <or>
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.web" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.ejb" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.utility" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.ear" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.appclient" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.connector" />
+ </or>
+ </and>
+ </adapt>
+ </enablement>
+ </objectContribution>
+ </extension>
+
+<!-- Navigator Object Contributions -->
+<!-- EAR Group Contributions
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.wst.common.navigator.internal.groups.NavigatorGroup"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.earProjectActions">
+ <action
+ label="%ear.file_ui_"
+ icon="icons/full/ctool16/import_ear.gif"
+ class="org.eclipse.jst.j2ee.internal.ear.actions.ImportEARAction"
+ menubarPath="org.eclipse.wst.common.frameworks.internal.navigator.import.menu/additions"
+ enablesFor="1"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.importEARAction">
+ </action>
+ <action
+ label="%ear.file_ui_"
+ icon="icons/full/ctool16/export_ear.gif"
+ class="org.eclipse.jst.j2ee.internal.ear.actions.ExportEARAction"
+ menubarPath="org.eclipse.wst.common.frameworks.internal.navigator.export.menu/additions"
+ enablesFor="1"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.exportEARAction">
+ </action>
+ <visibility>
+ <objectState
+ name="projectNature"
+ value="org.eclipse.jst.j2ee.EARNature">
+ </objectState>
+ </visibility>
+ </objectContribution>
+ </extension>
+ -->
+<!-- Navigator Object Contributions -->
+<!-- Application Client Group Contributions
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.wst.common.navigator.internal.groups.NavigatorGroup"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.appClientProjectActions">
+ <action
+ label="%client.jar.file_ui_"
+ icon="icons/full/ctool16/appclient_import_wiz.gif"
+ class="org.eclipse.jst.j2ee.internal.client.actions.ImportApplicationClientAction"
+ menubarPath="org.eclipse.wst.common.frameworks.internal.navigator.import.menu/additions"
+ enablesFor="1"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.importAppClientAction">
+ </action>
+ <action
+ label="%client.jar.file_ui_"
+ icon="icons/full/ctool16/appclient_export.gif"
+ class="org.eclipse.jst.j2ee.internal.client.actions.ExportApplicationClientAction"
+ menubarPath="org.eclipse.wst.common.frameworks.internal.navigator.export.menu/additions"
+ enablesFor="1"
+ id="org.eclipse.jst.j2ee.internal.ui.navigator.exportAppClientAction">
+ </action>
+ <visibility>
+ <objectState
+ name="projectNature"
+ value="org.eclipse.jst.j2ee.ApplicationClientNature">
+ </objectState>
+ </visibility>
+ </objectContribution>
+ </extension>
+ -->
+<!-- Navigator Object Contributions -->
+<!-- ================================================== -->
+<!-- DEPLOY EXTENSIONS -->
+<!-- ================================================== -->
+<!-- <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="java.lang.Object"
+ nameFilter="*"
+ id="org.eclipse.jst.j2ee.internal.ui.deploy">
+ <action
+ label="%deploy_ui_"
+ icon="icons/full/ctool16/re_execute.gif"
+ class="org.eclipse.jst.j2ee.internal.actions.J2EEDeployAction"
+ menubarPath="additions"
+ id="deployAction">
+ </action>
+ <visibility>
+ <or>
+ <objectClass
+ name="org.eclipse.jst.j2ee.ejb.EJBJar">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.ejb.EnterpriseBean">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.webapplication.WebApp">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.jca.Connector">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.application.Application">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jst.j2ee.client.ApplicationClient">
+ </objectClass>
+
+ <objectState
+ name="projectNature"
+ value="org.eclipse.wst.common.componentcore.ModuleCoreNature">
+ </objectState>
+
+ </or>
+ </visibility>
+ </objectContribution>
+ </extension> -->
+<!-- Navigator Object Contributions -->
+
+
+
+
+<!-- =========== org.eclipse.jst.j2ee.internal.J2EEDependencyPage ============ -->
+
+ <extension point="org.eclipse.ui.propertyPages">
+ <page
+ adaptable="true"
+ objectClass="org.eclipse.core.resources.IProject"
+ name="%Web_Project_Settings"
+ class="org.eclipse.jst.j2ee.internal.ui.J2EEPropertiesPage"
+ id="J2EEPropertiesPage">
+ <enabledWhen>
+ <and>
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ <or>
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.web" />
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="wst.web" />
+ </or>
+ </adapt>
+ </and>
+ </enabledWhen>
+ </page>
+
+ </extension>
+
+<!--
+ <extension point="org.eclipse.ltk.core.refactoring.renameParticipants">
+
+ <renameParticipant
+ class="org.eclipse.jst.j2ee.internal.actions.J2EERenameParticipant"
+ id="org.eclipse.jst.j2ee.internal.actions.J2EERenameParticipant"
+ name="%J2EE_Rename_Participant">
+ <enablement>
+ <with variable="affectedNatures">
+ <iterate operator="or">
+ <equals value="org.eclipse.wst.common.modulecore.ModuleCoreNature" />
+
+ </iterate>
+ </with>
+ <with variable="element">
+ <instanceof value="org.eclipse.core.resources.IProject" />
+
+ </with>
+ </enablement>
+ </renameParticipant>
+ </extension>
+
+ <extension point="org.eclipse.ltk.core.refactoring.renameParticipants">
+
+ <renameParticipant
+ class="org.eclipse.jst.j2ee.internal.actions.J2EEComponentRenameParticipant"
+ id="org.eclipse.jst.j2ee.internal.actions.J2EEComponentRenameParticipant"
+ name="J2EE Rename Participant">
+ <enablement>
+ <with variable="affectedNatures">
+ <iterate operator="or">
+ <equals value="org.eclipse.wst.common.modulecore.ModuleCoreNature" />
+ </iterate>
+ </with>
+ <with
+ variable="element">
+ <instanceof
+ value="org.eclipse.wst.common.componentcore.resources.IVirtualComponent">
+ </instanceof>
+ </with>
+ </enablement>
+ </renameParticipant>
+ </extension> -->
+
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ name="%j2ee"
+ icon="icons/full/cview16/j2ee_perspective.gif"
+ class="org.eclipse.jst.j2ee.internal.perspective.J2EEPerspective"
+ id="org.eclipse.jst.j2ee.J2EEPerspective">
+ </perspective>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.eclipse.jst.j2ee.J2EEPerspective">
+ <perspectiveShortcut id="org.eclipse.debug.ui.DebugPerspective"/>
+ <perspectiveShortcut id="org.eclipse.jdt.ui.JavaPerspective"/>
+ <perspectiveShortcut id="org.eclipse.ui.resourcePerspective"/>
+ <perspectiveShortcut id="org.eclipse.wst.web.ui.webDevPerspective"/>
+
+ <newWizardShortcut id="org.eclipse.jst.j2ee.ui.project.facet.EarProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.ejb.ui.project.facet.EjbProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.j2ee.jca.ui.internal.wizard.ConnectorProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.wst.web.ui.internal.wizards.SimpleWebProjectWizard"/>
+ <newWizardShortcut id="org.eclipse.jpt.ui.wizard.newJpaProject"/>
+ <newWizardShortcut id="org.eclipse.jst.servlet.ui.internal.wizard.AddServletWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.ejb.ui.internal.wizard.AddSessionBeanWizard"/>
+ <newWizardShortcut id="org.eclipse.jst.ejb.ui.internal.wizard.AddMessageDrivenBeanWizard"/>
+ <newWizardShortcut id="org.eclipse.jpt.ui.wizard.newEntity"/>
+ <newWizardShortcut id="org.eclipse.jst.ws.creation.ui.wizard.serverwizard"/>
+ <newWizardShortcut id="org.eclipse.ui.wizards.new.folder"/>
+ <newWizardShortcut id="org.eclipse.ui.wizards.new.file"/>
+ <actionSet id="org.eclipse.wst.server.ui.internal.webbrowser.actionSet"/>
+ <actionSet id="org.eclipse.debug.ui.breakpointActionSet"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.ui.resourcePerspective">
+ <perspectiveShortcut id="org.eclipse.jst.j2ee.J2EEPerspective"/>
+ </perspectiveExtension>
+ <perspectiveExtension targetID="org.eclipse.wst.web.ui.webDevPerspective">
+ <perspectiveShortcut id="org.eclipse.jst.j2ee.J2EEPerspective"/>
+ </perspectiveExtension>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <DataModelProvider
+ class="org.eclipse.jst.j2ee.internal.earcreation.EarComponentCreationDataModelProvider"
+ id="org.eclipse.jst.j2ee.internal.earcreation.IEarComponentCreationDataModelProperties"/>
+ </extension>
+
+ <extension
+ id="context.Sensitive.Class.workingCopyManager"
+ name="Working Copy Manager - UI Context Class"
+ point="org.eclipse.jem.util.uiContextSensitiveClass">
+ <uiContextSensitiveClass
+ context="UI"
+ key="workingCopyManager"
+ className="org.eclipse.jst.common.jdt.internal.integration.ui.WTPUIWorkingCopyManager">
+ </uiContextSensitiveClass>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory"
+ adaptableType="org.eclipse.core.resources.IProject">
+ <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory"
+ adaptableType="org.eclipse.jst.j2ee.application.Application">
+ <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory"
+ adaptableType="org.eclipse.core.resources.IFile">
+ <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper"
+ class="org.eclipse.jst.j2ee.internal.ClassHelperAdapterFactory">
+ <adapter type="org.eclipse.core.resources.IFile"/>
+ <adapter type="org.eclipse.core.resources.IResource"/>
+ </factory>
+
+ <!--
+ <factory
+ class="org.eclipse.jst.j2ee.internal.plugin.FacetedProjectAdapterFactory"
+ adaptableType="org.eclipse.core.resources.IProject" >
+ <adapter type="org.eclipse.ui.IActionFilter"/>
+ </factory>
+ -->
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.server.core.moduleArtifactAdapters">
+ <moduleArtifactAdapter
+ id="org.eclipse.jst.j2ee.server.ear1"
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.jst.j2ee.application.Application"/>
+ </with>
+ </enablement>
+ </moduleArtifactAdapter>
+
+ <moduleArtifactAdapter
+ id="org.eclipse.jst.j2ee.server.ear2"
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.ear:1.4]" />
+ </adapt>
+
+ </with>
+ </enablement>
+ </moduleArtifactAdapter>
+
+ <moduleArtifactAdapter
+ id="org.eclipse.jst.j2ee.server.ear3"
+ class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseDeployableArtifactAdapterFactory">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.core.resources.IFile">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.ear:1.4]" />
+ </adapt>
+ </with>
+ </enablement>
+ </moduleArtifactAdapter>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages action="jst.ear.install">
+ <page class="org.eclipse.jst.j2ee.ui.project.facet.EarFacetInstallPage"/>
+ </wizard-pages>
+ <wizard-pages action="jst.appclient.install">
+ <page class="org.eclipse.jst.j2ee.ui.project.facet.appclient.AppClientFacetInstallPage"/>
+ </wizard-pages>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.eclipse.jst.j2ee.differentRuntimesDetected"
+ class="org.eclipse.jst.j2ee.ui.project.facet.RuntimeMismatchMarkerResolutions">
+ </markerResolutionGenerator>
+ </extension>
+
+ <extension
+ point="org.eclipse.jem.util.uiContextSensitiveClass">
+ <uiContextSensitiveClass
+ key="ValidateEditContext"
+ className="org.eclipse.jst.j2ee.internal.listeners.ValidateEditListener"
+ context="UI"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.ui.classpathAttributeConfiguration">
+ <classpathAttributeConfiguration
+ attributeName="org.eclipse.jst.component.dependency"
+ class="org.eclipse.jst.j2ee.internal.classpathdep.ui.ClasspathDependencyAttributeConfiguration">
+ </classpathAttributeConfiguration>
+ </extension>
+
+ <extension point="org.eclipse.jdt.ui.classpathAttributeConfiguration">
+ <classpathAttributeConfiguration
+ attributeName="org.eclipse.jst.component.nondependency"
+ class="org.eclipse.jst.j2ee.internal.classpathdep.ui.ClasspathNonDependencyAttributeConfiguration">
+ </classpathAttributeConfiguration>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.eclipse.jst.j2ee.ClasspathDependencyValidatorMarker"
+ class="org.eclipse.jst.j2ee.internal.classpathdep.ui.ClasspathDependencyValidatorMarkerResolutions">
+ </markerResolutionGenerator>
+ </extension>
+
+ <extension
+ point="org.eclipse.jdt.ui.classpathContainerPage">
+ <classpathContainerPage
+ name="%earLibrariesContainerName"
+ class="org.eclipse.jst.j2ee.internal.wizard.EARLibrariesContainerPage"
+ id="org.eclipse.jst.j2ee.internal.module.container">
+ </classpathContainerPage>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.jst.j2ee.internal.ui.preferences.JavaEEPreferencePage"
+ id="org.eclipse.jst.j2ee.ui.preferencePages.JavaEE"
+ name="%j2ee">
+ </page>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.ui.moduleDependencyPropertyPage">
+ <dependencyPage
+ class="org.eclipse.jst.j2ee.internal.ui.preferences.EarModuleDependencyPageProvider"
+ id="org.eclipse.jst.j2ee.internal.ui.preferences.EarModuleDependencyPageProvider">
+ </dependencyPage>
+ </extension>
+
+
+ <!--
+ *****************************
+ * WTP User Library Provider *
+ *****************************
+ -->
+
+ <extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels">
+ <panel
+ provider="wtp-user-library-provider"
+ class="org.eclipse.jst.j2ee.internal.ui.WtpUserLibraryProviderInstallPanel"/>
+ </extension>
+
+ <!--
+ *************************************
+ * WTP OSGi Bundles Library Provider *
+ *************************************
+ -->
+
+ <extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels">
+ <panel
+ provider="wtp-osgi-bundles-library-provider"
+ class="org.eclipse.jst.j2ee.internal.ui.WtpOsgiBundlesLibraryProviderInstallPanel"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.ui.moduleDependencyPropertyPage">
+ <dependencyPage
+ class="org.eclipse.jst.j2ee.internal.ui.J2EEDependencyPageProvider"
+ id="org.eclipse.jst.j2ee.internal.ui.J2EEDependencyPageProvider">
+ </dependencyPage>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.modulecore.ui.virtualComponentLabelProvider">
+ <provider
+ class="org.eclipse.jst.j2ee.internal.ui.preferences.ClasspathDependencyComponentLabelProvider"
+ weight="5">
+ </provider>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.ui.referenceWizardFragment">
+ <referenceFragment
+ class="org.eclipse.jst.j2ee.internal.ui.preferences.CustomEARProjectReferenceWizardFragment"
+ hidden="true"
+ icon="icons/prj_obj.gif"
+ id="org.eclipse.jst.j2ee.internal.ui.preferences.CustomEARProjectReferenceWizardFragment"
+ name="%Project">
+ </referenceFragment>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.modulecore.ui.referenceWizardFragment">
+ <referenceFragment
+ class="org.eclipse.jst.j2ee.internal.ui.AddJavaBuildPathEntriesWizardFragment"
+ icon="icons/util-wiz-icon.gif"
+ id="org.eclipse.jst.j2ee.internal.ui.AddJavaBuildPathEntriesWizardFragment"
+ name="%AddJavaBuildPathEntriesWizardFragment-Name">
+ <enablement>
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="java" forcePluginActivation="true"/>
+ </enablement>
+ </referenceFragment>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.modulecore.ui.deploymentAssemblyVerifier">
+ <verifier
+ class="org.eclipse.wst.common.componentcore.ui.internal.propertypage.verifier.DefaultDeploymentAssemblyVerifier">
+ <runtime runtime_server_id="org.eclipse.wst.common.modulecore.ui.deploymentAssemblyVerifier.anyruntime"/>
+ <component component_type="jst.ear"/>
+ <component component_type="jst.ejb"/>
+ <component component_type="jst.web"/>
+ <component component_type="jst.webfragment"/>
+ <component component_type="jst.connector"/>
+ <component component_type="jst.appclient"/>
+ <component component_type="jst.utility"/>
+ </verifier>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/prepareforpii.xml b/plugins/org.eclipse.jst.j2ee.ui/prepareforpii.xml
new file mode 100644
index 0000000..d3bfda0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/prepareforpii.xml
@@ -0,0 +1,38 @@
+<project name="PrepareForPII" default="main" basedir=".">
+
+ <!-- Setup temp variables -->
+ <target name="init">
+ <property name="nlsDir" value="d:/NLS/Corona/0526"/>
+ <property name="plugin" value="com.ibm.wtp.j2ee.ui"/>
+ <property name="plugindir" value="d:/workspaceCorona/${plugin}"/>
+ <property name="outputDir" value="${nlsDir}/${plugin}"/>
+
+
+ </target>
+
+ <!-- Create the destination dir -->
+ <target name="nlsDir" depends="init">
+ <mkdir dir="${nlsDir}"/>
+ </target>
+
+ <!-- Create the destination dir -->
+ <target name="plugindir" depends="nlsDir">
+ <delete dir="${outputDir}"/>
+ <mkdir dir="${outputDir}"/>
+ </target>
+
+ <!-- Move the files to the correct locations in the workspace. -->
+ <target name="main" depends="plugindir">
+
+ <messageIdGen folderPath = "${plugindir}" componentId = "E" />
+
+ <copy todir = "${outputDir}/property_files" >
+ <fileset dir="${plugindir}/property_files">
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+
+ <copy file="${plugindir}/plugin.properties" todir="${outputDir}"/>
+
+ </target>
+</project>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/UtilityFacetInstallPage.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/UtilityFacetInstallPage.properties
new file mode 100644
index 0000000..0a6de07
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/UtilityFacetInstallPage.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# 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 Corporation - initial API and implementation
+###############################################################################
+pageTitle = Utility Module
+pageDescription = Configure utility module settings.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_figures.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_figures.properties
new file mode 100644
index 0000000..0ada374
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_figures.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+RelationshipPolyLine_UI_0=Navigation
+RelationshipPolyLine_UI_1=Navigation
+RelationshipPolyLine_UI_2=Cmr Field / Foreign Key
+RelationshipPolyLine_UI_3=Cmr Field / Foreign Key
+RelationshipPolyLine_UI_4=Edit left end
+RelationshipPolyLine_UI_5=Edit right
+RelationshipPolyLine_UI_6=Edit left end
+RelationshipPolyLine_UI_7=Edit right end
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_ui.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_ui.properties
new file mode 100644
index 0000000..7733593
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/ejb_ui.properties
@@ -0,0 +1,47 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+KEY_0=Failed to find the image "{0}".
+KEY_1=New EJB Project
+KEY_2=EJB version:
+KEY_3=EJB Project
+KEY_4=Create an EJB project and add it to a new or existing Enterprise Application.
+KEY_5=Import an EJB jar from the file system
+KEY_6=EJB Jar Import
+KEY_7=EJB Jar file:
+KEY_8=EJB Project:
+KEY_9=EJB Jar Export
+KEY_10=Export EJB project to the local file system.
+KEY_11=EJB client JAR Creation
+KEY_12=Use this wizard to create an EJB client JAR from your existing EJB
+KEY_13=Client JAR URI:
+KEY_14=Project name:
+KEY_15=Project location:
+KEY_16=EJB Project:
+KEY_17=Delete Bean Only
+KEY_18=Delete Bean Classes
+KEY_19=Delete Access Bean
+KEY_20=Delete Deployed Code
+KEY_21=Select All
+KEY_22=Deselect All
+KEY_23=The selected enterprise bean cannot be deleted because it is involved in\nrelationships with other enterprise beans. You must first delete these\nrelationships before deleting the bean.
+KEY_24=Delete...
+KEY_25=Cannot delete Enterprise Bean
+KEY_26=Cannot delete the bean named "{0}" because it is in a binary project.
+KEY_27=Delete Enterprise Bean(s)
+KEY_28=What options would you like when deleting the selected\nEnterprise Bean(s)?
+GroupedEJBJarItemProvider_UI_0=Session
+GroupedEJBJarItemProvider_UI_1=Entity
+GroupedEJBJarItemProvider_UI_2=Message
+NewEJBProjectAction_UI_0=EJB Project
+NewEJBModuleAction_UI_0=EJB Project
+pageTitle=Ejb Module
+pageDescription=Configure ejb module settings.
+configFolderLabel=Config Folder:
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ejb_ui.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ejb_ui.properties
new file mode 100644
index 0000000..fc3565e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ejb_ui.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2003, 2004 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
+###############################################################################
+
+GroupedEJBJarItemProvider_UI_0=Session
+GroupedEJBJarItemProvider_UI_1=Entity
+GroupedEJBJarItemProvider_UI_2=Message
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ui.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ui.properties
new file mode 100644
index 0000000..7e16333
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/j2ee_ui.properties
@@ -0,0 +1,362 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+1=Project location:
+2=&Target runtime:
+3=J2EE version:
+4=Failed to find the image "{0}".
+5=New Enterprise Application Project
+6=Enterprise Application Project
+7=Create an Enterprise Application project containing one or more module projects.
+8=EAR Module Projects
+9=Select the module projects to add to the new EAR project from the list. \nSelect New Module button to create a new module project.
+10=&Select All
+11=&Deselect All
+12=New &Module...
+13=EAR &project:
+14=N&ew...
+14a=Ne&w...
+15=Add module to an EAR application.
+16=New Module Project
+17=Create a new module project for the selected module type
+18=New Module Project
+19=Create default module projects.
+20=Application Client &project:
+21=EJB pro&ject:
+22=Web project:
+23=Connector &project:
+24=New Application Client Project
+25=Application Client module
+26=Create an Application Client project and add it to a new or existing Enterprise Application project
+27=Module Dependencies
+28=Select dependent JARs for the module within the Enterprise Application project.
+29=Available dependent JARs:
+30=Manifest Class-Path:
+31=JAR/Module
+32=&Project:
+33=New
+34=Import an Application Client project from the file System
+35=Application Client Import
+36=Application Client fi&le:
+37=Application Client pro&ject:
+38=Import
+39=Import an Enterprise Application project based on selected resources.
+40=Enterprise Application Import
+41=EAR fi&le:
+42=Overwrite existing resources without warning.
+43=Project import
+44=Optimized: make binary projects for EJB, client, and utility JARs
+45=Expanded: extract project contents for development
+46=Import for partial EAR development
+47=&Select All
+48=&Deselect All
+49=Utility JARs and web libraries
+50=Select the utility JARs from the list to be imported as utility projects. Unselected JARs will be imported as \nutility JARs in the EAR.
+51=Enter the new project name that will be created for the imported module file by selecting the second column of the table for edit. Unselected modules will be imported as JARs in the EAR.
+52=EAR Module and Utility JAR Projects
+53=Project locations
+54=This is the parent directory for all referenced projects. A subdirectory will be created for each project.
+55=&Module root location:
+
+57=Select the location directory
+58=Modules in EAR
+59=New Project Name
+60=filenames
+61=projectnames
+62=&Destination:
+63=Over&write existing file
+64=Export &source files
+65=Application Client Export
+66=Export Application Client project to the local file system.
+67=Export
+68=EAR Export
+69=Export Enterprise Application project to the local file system.
+70=Include project build paths and meta-data files
+71=If you select this option, the exported EAR maintains project names and external classpath dependencies, which are useful for later importing the EAR into binary projects. If you select this option and later import the EAR, only binary projects are created.
+72=Include
+74=Allow nested projects overwrites (module and utility projects)
+75=Delete project on overwrite
+76=EAR pro&ject:
+
+#migration strings
+77=Error
+78=An internal error occurred performing the selected action.
+79=Binary Project
+80=The action cannot be performed on the selection, which is part of a binary project.
+81=Information
+82=The chosen operation is not currently available.
+
+90=&Create an EJB Client JAR module to hold the client interfaces and classes
+91=Generate an annotated bean class
+92=Add support for annotated Java classes
+93=Br&owse...
+94=Na&me:
+95=&Create a default Main class
+96=Create a default stateless session bean
+98=&Generate a XDoclet annotated class
+
+97=Select the utility JARs from the &list to be imported as utility projects or jars:
+99=Project Name:
+100=Module Version:
+101=Configure Application Client module settings.
+102=Content Folder:
+103=&Target runtime
+Entity_UI_=Entity Beans (1.x-2.x)
+Message_Driven_Beans_UI_=Message-Driven Beans
+Session_Beans_UI_=Session Beans
+EJB_Class_UI_=EJB Class: {0}
+Home_Interface_UI_=Home Interface: {0}
+Service_Endpoint_Interface_UI_=Service Endpoint Interface: {0}
+Primary_Key_Class_UI_=Primary Key Class: {0}
+RefactoringNoInit=Refactoring not initialized properly
+Remote_Interface_UI_=Remote Interface: {0}
+Local_Interface_UI_=Local Interface: {0}
+Local_Home_Interface_UI_=Local Home Interface: {0}
+Delete_UI_=Delete...
+Project_should_not_be_null_1_EXC_=IWAE0021E Project should not be null
+Non-project_in_selection_2_EXC_=IWAE0022E Non-project in selection
+Problems_Opening_Editor_ERROR_=IWAE0052E Problems Opening Editor.
+Utility_JARs_UI_=Utility JARs
+Delete_1=Delete...
+Delete_selected_project(s)_2=Delete selected project(s)
+Remove_module(s)_from_all_Enterprise_Applications_3=Remove module(s) from all Enterprise Applications
+Remove_module(s)_from_all_other_Enterprise_Applications_4=Remove module(s) from all other Enterprise Applications
+Remove_module_dependencies_referencing_selected_project(s)_5=Remove module dependencies referencing selected project(s)
+Delete_Module_Options_6=Delete Module Options
+Delete_Enterprise_Application_Options_7=Delete Enterprise Application Options
+Delete_could_not_be_completed_8=Delete could not be completed
+Delete_error_9=Delete error
+What_would_you_like_to_delete__10=What would you like to delete?
+Delete_selected_Enterprise_Application_project(s)_only_11=Delete selected Enterprise Application project(s) only
+Also_delete_module_and_utility_Java_projects_12=Also delete module and utility Java projects
+Delete_selected_project(s)_only_13=Delete selected project(s) only
+Also_delete_references_to_selected_project(s)_14=Also delete references to selected project(s)
+CUSTOM_DELETE_MIX_MATCH_UI_=The custom Java EE delete options are not available for the selected Java EE projects. The standard delete options will be used.
+DEPLOY_DIALOG_TITLE=J2EE Deployment
+DEPLOY_ERROR_TEXT=IWAE0001E Error:
+DEPLOY_WARNING_TEXT=Warning:
+DEPLOY_INFO_TEXT=IWAE0002I Info:
+DEPLOY_OK_TEXT=Ok:
+DEPLOYMENT_IN_PROGRESS=Deployment operation in progress...
+DEPLOY_SUCCESS_REPORT=Deployment finished successfully.
+DEPLOY_WARNINGS_REPORT=Deployment finished with warnings; see log files for details.
+DEPLOY_ERRORS_REPORT=Deployment finished with errors; see log files for details.
+DEPLOY_PROJECT_NOT_FOUND=Cannot get handle to the project.
+DEPLOY_RUNTIME_NOT_FOUND=Target runtime not configured for project {0}.
+DEPLOY_RUNTIME_CONFIGURED=Target runtime configured successfully for project {0}.
+DEPLOY_PROJECT_NOT_SUPPORTED=Project {0} cannot be deployed with configured runtime or installed facets.
+
+NewModuleSelectionPage.appClient=&Application Client
+NewModuleSelectionPage.ejb=&Enterprise Java Bean
+NewModuleSelectionPage.web=&Web
+NewModuleSelectionPage.jca=&Connector
+
+NewApplClientModuleAction_UI_0=Application Client Module
+NewContextRoot=New context root:
+NewEARModuleAction_UI_0=EAR Module
+J2EEProjectCreationPage_UI_0=Hide &Advanced <<
+J2EEProjectCreationPage_UI_1=Show &Advanced >>
+J2EEUtilityJarImportPage_UI_0=Utility Jar Import
+J2EEUtilityJarImportPage_UI_1=Import dependent Utility Jars for Java EE Enterprise Applications
+J2EEUtilityJarImportPage_UI_2=Available utility JARs directory
+J2EEUtilityJarImportPage_UI_3=&External JAR directory:
+J2EEUtilityJarImportPage_UI_4=Linked path variable
+J2EEUtilityJarImportPage_UI_5=Make these imported files team-shareable by creating or re-using a linked path variable (LPV). Select an existing LPV or type a new name to create one to the directory above. Other teammates should define this value through Window > Preferences | Workbench > Linked Resources. This option is only available for linked imports.
+J2EEUtilityJarImportPage_UI_6=Over&write existing resources (projects and archives)
+J2EEUtilityJarImportPage_UI_7=Select Utility Jar:
+J2EEUtilityJarImportPage.0=Use Existing Linked Path Variable
+J2EEUtilityJarImportPage.1=Linked Path Variable:
+EARImportProjectsPage_UI_0=include
+EARImportProjectsPage_UI_1=file
+EARImportProjectsPage_UI_2=project
+EARImportProjectsPage_UI_3=Select New
+
+J2EEUtilityJarImportTypePage_UI_0=Utility Jar Import
+J2EEUtilityJarImportTypePage_UI_1=Import dependent Utility Jars for Java EE Enterprise Applications
+J2EEUtilityJarImportTypePage_UI_2=Select import type
+J2EEUtilityJarImportTypePage_UI_3=Create &Java projects from utility JARs
+J2EEUtilityJarImportTypePage_UI_4=Create &linked Java projects from utility JARs
+J2EEUtilityJarImportTypePage_UI_5=Cop&y utility JARs into an existing EAR from an external location
+J2EEUtilityJarImportTypePage_UI_6=&Create linked utility JARs in an existing EAR from an external location
+J2EEUtilityJarImportTypePage_UI_7=Project import options
+J2EEUtilityJarImportTypePage_UI_8=Select EAR project
+J2EEUtilityJarImportTypePage_UI_9=EAR &project:
+J2EEUtilityJarImportTypePage_UI_10=Create Binary Projects
+J2EEUtilityJarImportTypePage_UI_11=Override project &root (specify location below)
+
+Deployment_Descriptor_UI_=Deployment Descriptor
+
+Rename_1=Rename
+RenameDotDotDot=Rename...
+Rename_selected_project_2=Rename selected project
+Rename_module_in_all_Enterprise_Applications_3=Rename module in all Enterprise Applications
+Rename_module_in_all_other_Enterprise_Applications_4=Rename module in all other Enterprise Applications
+Rename_module_dependencies_referencing_selected_project_5=Rename module dependencies referencing selected project
+Rename_Module_Options_6=Rename Module Options
+Rename_Enterprise_Application_Options_7=Rename Enterprise Application Options
+Rename_could_not_be_completed_8=Rename could not be completed
+Rename_error_9=Rename error
+What_would_you_like_to_rename_this_to__10=What would you like to rename this to?
+Context_Root__11=Context root:
+Rename_selected_Enterprise_Application_project_only_12=Rename selected Enterprise Application project only
+RenameContextRoot=Rename Context Root
+RenameContextRootFromXtoY=Rename context root from "{0}" to "{1}"
+Also_rename_module_and_utility_Java_projects_13=Also rename module and utility Java projects
+Project_already_exists.=Project {0} already exists.
+Non-project_in_selection_2_ERROR_=IWAE0024E Non-project in selection
+
+
+ERROR_OCCURRED_TITLE=Error
+ERROR_OCCURRED_MESSAGE=An internal error occurred performing the selected action.
+
+Import_Class_Files_UI=Import
+FileImport.selectSource=Select a directory to import from.
+Import_Classes=Import Class Files...
+ClassesImport.fromDir=Import from Directory
+ClassesImport.fromZip=Import from Zip or Jar
+DataTransfer.browse=Browse...
+DataTransfer.directory=Source:
+DataTransfer.fileSystemTitle=Import Class Files
+FileImport.importFileSystem=Import class files from the local file system.
+FileImport.sourceEmpty=Source must not be empty.
+FileImport.overwriteExisting=Overwrite existing resources without warning
+DataTransfer.selectAll=Select All
+DataTransfer.deselectAll=Deselect All
+Inconsistent_Files_3=Inconsistent Files
+The_following_workspace_files_are_inconsistent_with_the_editor_4=The following workspace files are inconsistent with the editor: \n
+Update_the_editor_with_the_workspace_contents__5=Update the editor with the workspace contents?
+Error_checking_out_files_10=Error checking out files
+Inconsistent_files_detected_11=Inconsistent files detected
+Modules_UI_=Modules
+Utility_Java_Projects_UI_=Project Utility JARs
+The_following_files_are_inconsistent_with_the_file_system._Do_you_want_to_save_and_overwrite_these_files_on_the_file_system__12_WARN_=IWAE0020W The following files are inconsistent with the file system.\nDo you want to save and overwrite these files on the file system?
+J2EE_Level=J2EE Level:
+J2EE_12=1.2
+J2EE_13=1.3
+J2EE_14=1.4
+J2EE_12_DESCRIPTION=J2EE 1.2 includes Servlet Specification level 2.2, JSP Specification level 1.1, and EJB Specification level 1.1.
+J2EE_13_DESCRIPTION=J2EE 1.3 includes Connector Architecture Specification level 1.0, Servlet Specification level 2.3, JSP Specification level 1.2, and EJB Specification level 2.0.
+J2EE_14_DESCRIPTION=J2EE 1.4 includes Connector Architecture Specification level 1.5, Servlet Specification level 2.4, JSP Specification level 1.3, and EJB Specification level 2.1.
+EJB_LEVEL=EJB Level:
+EJB_11=1.1
+EJB_20=2.0
+EJB_21=2.1
+EJB_11_DESCRIPTION=EJB 1.1 includes Session Beans, BMP Beans and CMP 1.1 Beans. EJB 1.1 modules may be included in either Java EE 1.2 or Java EE 1.3 Enterprise Applications.
+EJB_20_DESCRIPTION=EJB 2.0 includes Message-Driven Beans, BMP Beans, and CMP 1.1 and CMP 2.0 Beans. EJB 2.0 modules may only be included in Java EE 1.3 Enterprise Applications.
+EJB_21_DESCRIPTION=EJB 2.1 includes Message-Driven Beans, BMP Beans, and CMP 1.1 and CMP 2.0 Beans. EJB 2.1 modules may only be included in Java EE 1.4 Enterprise Applications.
+WEB_LEVEL=Web Level:
+WEB_22=2.2
+WEB_23=2.3
+WEB_24=2.4
+WEB_22_DESCRIPTION=Web 2.2 includes Servlet specification 2.2 and JSP specification 1.1.
+WEB_23_DESCRIPTION=Web 2.3 includes Servlet specification 2.3 and JSP specification 1.2.
+WEB_24_DESCRIPTION=Web 2.4 includes Servlet specification 2.4 and JSP specification 2.0.
+APP_CLIENT_LEVEL=Application Client Level:
+APP_CLIENT_12_DESCRIPTION=Application 1.2 includes the Applciation client specification level 1.2.
+APP_CLIENT_13_DESCRIPTION=Application 1.3 includes the Applciation client specification level 1.3.
+APP_CLIENT_14_DESCRIPTION=Application 1.4 includes the Applciation client specification level 1.4.
+CONNECTOR_LEVEL=Connector Architecture Level:
+CONNECTOR_10=1.0
+CONNECTOR_15=1.5
+CONNECTOR_10_DESCRIPTION=Connector Architecture 1.0 modules may only be included in Java EE 1.3 Enterprise Applications.
+CONNECTOR_15_DESCRIPTION=Connector Architecture 1.5 modules may only be included in Java EE 1.4 Enterprise Applications.
+DESCRIPTION=Description:
+WEB_CONTEXT_ROOT=Context root:
+WEB_CONTENT_FOLDER_NAME=Web content folder name:
+FileImport.invalidSource = Source directory is not valid or has not been specified.
+FileImport.importProblems = Import Problems
+DataTransfer.information = Information
+FileImport.noneSelected = There are no resources currently selected for import.
+File_Selection_UI_=File Selection
+Select_a_file__UI_=Select a file:
+Flexible_Structure=Use flexible project structure
+FlexibleProjectCreationWizard.mainPage.title=J2EE Project
+FlexibleProjectCreationWizard.mainPage.desc=Create a Java EE project.
+FlexibleProjectCreationWizard.title=J2EE Project
+EARComponentCreationWizard.title=New EAR Application Project
+EARComponentCreationWizard.mainPage.title=EAR Application Project
+EARComponentCreationWizard.mainPage.desc=Create a EAR application.
+EARComponentCreationWizard.secondPage.title=Enterprise Application
+EARComponentCreationWizard.secondPage.desc=Configure enterprise application settings.
+J2EEModuleDependencies.label=&Java EE module dependencies:
+J2EEModuleDependencies.label_accessibility=Java EE module dependencies
+AppClientComponentCreationWizard.title=New Application Client Project
+AppClientComponentCreationWizard.mainPage.title=Application Client Project
+AppClientComponentCreationWizard.mainPage.desc=Create a Application Client.
+DefaultJ2EEComponentCreationWizard.title=Create default Java EE modules.
+DefaultJ2EEComponentCreationWizard.page.title=New Java EE Module
+DefaultJ2EEComponentCreationWizard.page.desc=Create a new Java EE module for the selected module type
+DefaultJ2EEComponentCreationWizard.page.label.ejb=&EJB module
+DefaultJ2EEComponentCreationWizard.page.label.web=&Web module
+DefaultJ2EEComponentCreationWizard.page.label.jca=&Connector module
+DefaultJ2EEComponentCreationWizard.page.label.appclient=&Application client module
+DefaultJ2EEComponentCreationWizard.page.button.select=Create &default modules
+
+FOLDER_LABEL=Source fol&der:
+BROWSE_BUTTON_LABEL=Browse...
+BROWSE_BUTTON_LABEL_O=Br&owse...
+BROWSE_BUTTON_LABEL_W=Bro&wse...
+BROWSE_BUTTON_LABEL_E=Brows&e...
+JAVA_PACKAGE_LABEL=Java pac&kage:
+CLASS_NAME_LABEL=Class na&me:
+SUPERCLASS_LABEL=&Superclass:
+CONTAINER_SELECTION_DIALOG_TITLE=Container Selection
+CONTAINER_SELECTION_DIALOG_DESC=Choose a Container:
+CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG=Choose a valid java source folder for the selected module.
+PACKAGE_SELECTION_DIALOG_TITLE=Package Selection
+PACKAGE_SELECTION_DIALOG_DESC=Choose a package:
+PACKAGE_SELECTION_DIALOG_MSG_NONE=No packages to choose from
+SUPERCLASS_SELECTION_DIALOG_TITLE=Superclass Selection
+SUPERCLASS_SELECTION_DIALOG_DESC=Choose a superclass:
+JAVA_CLASS_MODIFIERS_LABEL=Modifiers:
+JAVA_CLASS_PUBLIC_CHECKBOX_LABEL=&public
+JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL=abs&tract
+JAVA_CLASS_FINAL_CHECKBOX_LABEL=fina&l
+JAVA_CLASS_INTERFACES_LABEL=&Interfaces:
+JAVA_CLASS_METHOD_STUBS_LABEL=Which method stubs would you like to create?
+JAVA_CLASS_MAIN_CHECKBOX_LABEL=public static void &main(String[] args)
+JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL=&Constructors from superclass
+JAVA_CLASS_INHERIT_CHECKBOX_LABEL=In&herited abstract methods
+ADD_BUTTON_LABEL=&Add...
+REMOVE_BUTTON=&Remove
+YES_BUTTON=Yes
+NO_BUTTON=No
+OK_BUTTON=OK
+OpenJ2EEResourceAction.0=Open
+CANCEL_BUTTON=Cancel
+BINARY=Binary
+INTERFACE_SELECTION_DIALOG_TITLE=Interface Selection
+JAVAUTILITY_MAIN_PG_TITLE=Java Component
+JAVAUTILITY_MAIN_PG_DESC=Create a Java Component
+JAVAUTIL_COMPONENT_WIZ_TITLE=New Java Utility Module
+JAVA_EE_PREFERENCE_PAGE_NAME=General settings for Java EE development:
+JAVA_EE_PREFERENCE_PAGE_JET_TEMPLATE=JET templates
+JAVA_EE_PREFERENCE_PAGE_DYN_TRANSLATION_BTN_NAME=Use dynamic translation of JET templates
+AVAILABLE_J2EE_COMPONENTS= Available Java EE modules
+EXTERNAL_JAR=Add External JARs...
+PROJECT_JAR=Add JARs...
+ADDVARIABLE=Add Variable...
+CHANGE_LIB_DIR=Change &Library Directory...
+NO_DD_MSG_TITLE=No Deployment Descriptor
+GEN_DD_QUESTION=Changing the library directory must be reflected in the deployment descriptor. This EAR has no deployment descriptor yet and one will be generated now. Do you want to proceed?
+CHANGE_LIB_DIR_HEAD=Change Library Directory
+NEW_LIB_DIR_PROPMPT=New library directory location:
+BLANK_LIB_DIR=Blank Library Directory
+BLANK_LIB_DIR_CONFIRM=You've entered a blank library directory. In result, all the libraries will be packed in the root directory. In order to be able to pack any libraries in the library directory you must enter a non-blank library directory. Do you really want the library directory to be blank?
+BLANK_LIB_DIR_WARN_QUESTION=The specified library directory is blank. In result, all the libraries will be packed in the root directory. Are you sure you want this? (If you want to leave the bundled libraries directory blank, click 'Yes'. If you want to change it, click 'No')
+INVALID_PATH=Invalid Path
+INVALID_PATH_MSG=The entered path is invalid for a library directory. Please enter a valid path, different from root!
+DEPENDENCY_CONFLICT_TITLE=Dependencies Conflict
+DEPENDENCY_CONFLICT_MSG_1=This JAR is a bundled library of an EAR project and is supposed to be packed in the EAR's library directory. It conflicts with the manifest class path dependency you are trying to create. If you create this dependency, the JAR will be packed in the root (not library) directory of the EAR. Are you sure you want to proceed?
+DEPENDENCY_CONFLICT_MSG_2=This JAR is also a manifest class path dependency of a module in this EAR. It conflicts with packing the JAR in the library directory. If you want this JAR packed in the library directory, then it will be removed as a manifest class path dependency from all modules in this EAR. Are you sure you want to proceed?
+DO_NOT_SHOW_WARNING_AGAIN=Do not show this warning again
+SUPPORTMULTIPLEMODULES=Support Multiple Modules per project
+SOURCEFOLDER=Source Folder:
+HOVER_HELP_FOR_DISABLED_LIBS=This library has been added to the project by using the project tree or\nthe file system. If you want to move/remove it, use the same approach.
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/jca_ui.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/jca_ui.properties
new file mode 100644
index 0000000..f8ff5fa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/jca_ui.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+_0=Failed to find the image "{0}".
+_1=New Connector Project
+_2=J2C version:
+_3=Connector Project
+_4=Create a standalone Connector module or add it to a new or existing Enterprise Application project.
+_5=Import a Connector module from the file system
+_6=Connector Import
+_7=Connector file:
+_8=Connector module:
+_9=Connector Export
+_10=Export Connector module to the local file system.
+_11=Configure Connector module settings.
+connector_export_action_label_ui_=Export RAR File...
diff --git a/plugins/org.eclipse.jst.j2ee.ui/property_files/manifest_ui.properties b/plugins/org.eclipse.jst.j2ee.ui/property_files/manifest_ui.properties
new file mode 100644
index 0000000..806d5f8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/property_files/manifest_ui.properties
@@ -0,0 +1,47 @@
+###############################################################################
+# Copyright (c) 2005, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+Up_1=&Up
+Down_2=&Down
+Select_All_3=Select &All
+Deselect_All_4=D&eselect All
+ERROR_READING_MANIFEST_DIALOG_TITLE=Error Reading Manifest
+SAVE_MANIFEST_WITH_ERROR=The manifest file contains errors and can not be parsed. The file will be saved but the Java build path will not be updated. Following are common limitations which can cause problems:
+ERROR_READING_MANIFEST_DIALOG_MESSAGE_EDITOR=The manifest file contains errors and can not be parsed. Other pages cannot be used until these errors are corrected. Following are common limitations which can cause problems:
+ERROR_READING_MANIFEST_DIALOG_MESSAGE_PROP_PAGE=The manifest file contains errors and can not be parsed. Following are common limitations which can cause problems:
+MANIFEST_PROBLEM_1=* Lines in the file must be no greater than 72 bytes. Continuation of long lines is indicated by a new line and a space.
+MANIFEST_PROBLEM_2=* The last line in the file must end with a new line or it will not be parsed.
+MANIFEST_PROBLEM_3=* Blank lines with extra white space may cause parse to fail.
+MANIFEST_PROBLEM_4=* The attributes must be formatted correctly. Refer to the manifest and JAR file specification for more information.
+An_internal_error_occurred_ERROR_=IWAE0010E An internal error occurred:
+Project_name__UI_=Project name:
+EAR_Project_Name__UI__UI_=Enterprise application project name:
+Available_dependent_JARs__UI_=Available dependent JARs:
+Manifest_Class_Path__UI_=Manifest Class-Path (does not include contributions from classpath entries):
+JAR_Module_UI_=JAR/Module
+Packed_In_Lib_UI_=In Lib Dir
+Project_UI_=Project
+EAR_Modules=EAR Modules:
+EAR_Modules_Desc=This property page lets you setup the module dependencies in an Enterprise Application.
+J2EE_Modules=J2EE Modules
+J2EE_Modules_Desc=This property page lets you add Manifest classpath dependencies to other Java EE modules or JARs contained within the same Enterprise Application. It also supports the selection of class folders whose contents will be added to the root of this module.
+Web_Libraries=Web Libraries
+Web_Libraries_Desc=This property page lets you add a Web Library dependency to utility projects, JAR files or classpath entries. Archive dependencies will be resolved into the WEB-INF/lib folder of the web module at deployment time. Class folder dependencies will be resolved into the WEB-INF/classes folder.
+Web_Ref_Desc=This property page lets you specify module dependencies on classpath entries. Entries that reference archives will be bundled, along with the project, into the WEB-INF/lib folder of referencing web modules. The contents of class folder entries will be added to the root of this module.
+EAR_Module_Dep_Error=J2EE Modules is not valid for EAR modules.
+Unreferenced_Module_Error=Selected module is not referenced by any EAR or Dynamic Web modules.
+Jar_Dep_One_Module_Error=Java Jar Dependencies is valid only for one module per flexible project.
+Web_Lib_Error=Web library settings are only valid for Web modules.
+REDIRECT_TEXT_EDITOR_UI_=REDIRECT_TEXT_EDITOR_UI_
+Error_Checking_Project_Facets=Error checking project facets.
+WEB_LIB_LIST_DESCRIPTION=Select the utility project, JAR or classpath entry to add as a Web Library dependency
+Dynamic_Web_Error=This property page is not valid for dynamic web projects.
+No_Web_Reference_Error=Selected project must be referenced by at least one dynamic web project.
+
diff --git a/plugins/org.eclipse.jst.j2ee.ui/schema/JavaEEPreferencePageExtender.exsd b/plugins/org.eclipse.jst.j2ee.ui/schema/JavaEEPreferencePageExtender.exsd
new file mode 100644
index 0000000..deb3487
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/schema/JavaEEPreferencePageExtender.exsd
@@ -0,0 +1,83 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.j2ee.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.j2ee.ui" id="JavaEEPreferencePageExtender" name="JavaEEPreferencePageExtender"/>
+ </appInfo>
+ <documentation>
+ Defines extension point for extending Java EE preference page.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="javaeepageextender"/>
+ </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>
+ Optional name for the extension point
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="javaeepageextender">
+ <complexType>
+ <attribute name="className" type="string" use="required">
+ <annotation>
+ <documentation>
+ The className is an implementation of interface IJavaEEPreferencePageExtender
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2009 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.jst.j2ee.ui/schema/archiveExportParticipantPanels.exsd b/plugins/org.eclipse.jst.j2ee.ui/schema/archiveExportParticipantPanels.exsd
new file mode 100644
index 0000000..3ab16a1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.ui/schema/archiveExportParticipantPanels.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.j2ee.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.j2ee.ui" id="archiveExportParticipantPanels" name="Archive Export Participant Panels Extension Point"/>
+ </appInfo>
+ <documentation>
+ Used for supplying UI for the archive export participants registered via the <code>org.eclipse.jst.j2ee.archiveExportParticipants</code> extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="panel-factory" minOccurs="1" maxOccurs="unbounded"/>
+ </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="panel-factory">
+ <annotation>
+ <documentation>
+ Registers a single archive export participant.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="archiveExportParticipantId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The id of the archive export participant that this panel factory should be registered with. Has to include plugin id.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The factory implementation class.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.j2ee.ui.archive.IArchiveExportParticipantPanelFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <pre>
+<extension point="org.eclipse.jst.j2ee.ui.archiveExportParticipantPanels">
+ <panel-factory
+ archiveExportParticipantId="com.somecorp.MyExportParticipant"
+ class="com.somecorp.MyPanelFactory"/>
+</extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2005, 2007 BEA Systems, Inc. and others.<br>
+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 <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.jst.j2ee.web/.classpath b/plugins/org.eclipse.jst.j2ee.web/.classpath
new file mode 100644
index 0000000..ee4f412
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="web/"/>
+ <classpathentry kind="src" path="war-validation/"/>
+ <classpathentry kind="src" path="webedit/"/>
+ <classpathentry kind="src" path="webproject/"/>
+ <classpathentry kind="src" path="property_files/"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.jst.j2ee.web/.cvsignore b/plugins/org.eclipse.jst.j2ee.web/.cvsignore
new file mode 100644
index 0000000..9b9b366
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.cvsignore
@@ -0,0 +1,7 @@
+bin
+build.xml
+runtime
+temp.folder
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.jst.j2ee.web/.externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch b/plugins/org.eclipse.jst.j2ee.web/.externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch
new file mode 100644
index 0000000..7111afb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.emf.codegen.JETBuilder"/>
+<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
diff --git a/plugins/org.eclipse.jst.j2ee.web/.jetproperties b/plugins/org.eclipse.jst.j2ee.web/.jetproperties
new file mode 100644
index 0000000..6116937
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.jetproperties
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<jet-settings>
+ <template-container>templates</template-container> <source-container>web</source-container>
+</jet-settings>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/.project b/plugins/org.eclipse.jst.j2ee.web/.project
new file mode 100644
index 0000000..93eec33
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.project
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.j2ee.web</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <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.emf.codegen.jet.IJETNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8337c9e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,99 @@
+#Mon Feb 22 11:50:31 EET 2010
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..9bdbea6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,6 @@
+#Mon Feb 22 11:50:31 EET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
diff --git a/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a0750e0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF
@@ -0,0 +1,51 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Web Plug-in
+Bundle-SymbolicName: org.eclipse.jst.j2ee.web; singleton:=true
+Bundle-Version: 1.1.405.qualifier
+Bundle-Activator: org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin
+Bundle-Vendor: Eclipse.org
+Bundle-Localization: plugin
+Export-Package: org.eclipse.jst.j2ee.internal.web.archive.operations;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.classpath;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.deployables;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.jfaces.extension;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.operations;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.plugin;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.providers;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.util;x-internal:=true,
+ org.eclipse.jst.j2ee.internal.web.validation;x-internal:=true,
+ org.eclipse.jst.j2ee.web,
+ org.eclipse.jst.j2ee.web.componentcore.util,
+ org.eclipse.jst.j2ee.web.datamodel.properties,
+ org.eclipse.jst.j2ee.web.project.facet,
+ org.eclipse.jst.j2ee.web.validation
+Require-Bundle: org.eclipse.jst.j2ee;bundle-version="[1.1.406,1.2.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jem.workbench;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.wst.common.emf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.emf.edit;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.emf.codegen;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.wst.web;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.common.annotations.controller;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.7,2.0.0)",
+ org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
+ org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
+ com.ibm.icu;bundle-version="3.8.1",
+ org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.jst.jee;bundle-version="[1.0.100,1.1.0)",
+ org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)"
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.jst.servlet.ui/about.html b/plugins/org.eclipse.jst.j2ee.web/about.html
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/about.html
copy to plugins/org.eclipse.jst.j2ee.web/about.html
diff --git a/plugins/org.eclipse.jst.j2ee.web/build.properties b/plugins/org.eclipse.jst.j2ee.web/build.properties
new file mode 100644
index 0000000..a6a23c6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+bin.includes = plugin.xml,\
+ icons/,\
+ plugin.properties,\
+ templates/,\
+ .,\
+ META-INF/,\
+ about.html,\
+ schema/
+jars.compile.order = .
+source.. = web/,\
+ war-validation/,\
+ webedit/,\
+ webproject/,\
+ property_files/
+output.. = bin/
+src.includes = component.xml
diff --git a/plugins/org.eclipse.jst.j2ee.web/component.xml b/plugins/org.eclipse.jst.j2ee.web/component.xml
new file mode 100644
index 0000000..e08c4bd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/component.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jst.j2ee.web"><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jst.j2ee.web" fragment="false"/><plugin id="org.eclipse.jst.servlet.ui" fragment="false"/></component>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif b/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif
new file mode 100644
index 0000000..e12289b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/ServletCreateInitParam.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif b/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif
new file mode 100644
index 0000000..8450a6f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/WebAppCreateContextParam.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif
new file mode 100644
index 0000000..9f75eb0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/WebResourceCollectionCreateURLPatternType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif
new file mode 100644
index 0000000..5b64c4d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/authority_constraint.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif b/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif
new file mode 100644
index 0000000..119dccc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/error_co.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif b/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif
new file mode 100644
index 0000000..811b21b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/error_page.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif b/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif
new file mode 100644
index 0000000..811b21b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/errorcode_errorpage.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif b/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif
new file mode 100644
index 0000000..1845563
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/exception_type_errorpage.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif
new file mode 100644
index 0000000..3c8a0ba
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/export_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/field.gif b/plugins/org.eclipse.jst.j2ee.web/icons/field.gif
new file mode 100644
index 0000000..06d38f5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/field.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif b/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif
new file mode 100644
index 0000000..0712d1e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/filter.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif
new file mode 100644
index 0000000..8f2e36b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/filter_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif b/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif
new file mode 100644
index 0000000..aebc0b2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/form_banner.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif b/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif
new file mode 100644
index 0000000..e3fcbb1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/form_login_config.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif
new file mode 100644
index 0000000..5f2f2d9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowDown.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif
new file mode 100644
index 0000000..7a479e8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/ArrowUp.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif
new file mode 100644
index 0000000..225e813
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_Description.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif
new file mode 100644
index 0000000..45ca182
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_descriptions_DescriptionType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif
new file mode 100644
index 0000000..346fc49
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayName.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif
new file mode 100644
index 0000000..1df6f5f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_displayNames_DisplayNameType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif
new file mode 100644
index 0000000..5181241
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateDescriptionGroup_icons_IconType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif
new file mode 100644
index 0000000..5397c66
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_propertyGroups_JSPPropertyGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif
new file mode 100644
index 0000000..34229a7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/CreateJSPConfig_tagLibs_TagLibRefType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif
new file mode 100644
index 0000000..256e5a0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/add_column.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif
new file mode 100644
index 0000000..e8efe69
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/connection.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif
new file mode 100644
index 0000000..3d75cb5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/convertlinks_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif
new file mode 100644
index 0000000..52bac36
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/default.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif
new file mode 100644
index 0000000..fc66e9e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportftp_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/exportwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportwar_wiz.gif
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/exportwar_wiz.gif
copy to plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/exportwar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif
new file mode 100644
index 0000000..400e049
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importftp_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif
new file mode 100644
index 0000000..4176871
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importhttp_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/importwar_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importwar_wiz.gif
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/importwar_wiz.gif
copy to plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/importwar_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif
new file mode 100644
index 0000000..e336513
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/method.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif
new file mode 100644
index 0000000..d528595
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/methodreturn.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif
new file mode 100644
index 0000000..43e86db
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebex_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif
new file mode 100644
index 0000000..8956b3d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/newwebprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/war.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/warFile_obj.gif
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/icons/war.gif
copy to plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/warFile_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif
new file mode 100644
index 0000000..09f609d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_application.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif
new file mode 100644
index 0000000..e0dd2d8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/ctool16/web_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif
new file mode 100644
index 0000000..23f12fa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/linksview16/mailto_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif
new file mode 100644
index 0000000..30f0c48
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPConfig.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif
new file mode 100644
index 0000000..5915591
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/JSPPropertyGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif
new file mode 100644
index 0000000..53500da
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/TagLibRefType.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif
new file mode 100644
index 0000000..ef30288
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/ascii.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif
new file mode 100644
index 0000000..17633ae
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/binary.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif
new file mode 100644
index 0000000..bf043f9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/environment_entity.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif
new file mode 100644
index 0000000..4c54bf1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/jarproject_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif
new file mode 100644
index 0000000..49873f4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/java_properties.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif
new file mode 100644
index 0000000..d528595
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/method_return.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif
new file mode 100644
index 0000000..6912def
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/projlib_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif
new file mode 100644
index 0000000..fc1bece
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/servlet.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif
new file mode 100644
index 0000000..f507742
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web12_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif
new file mode 100644
index 0000000..e3539d4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/web13_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif
new file mode 100644
index 0000000..80531e3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/obj16/webstatic_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/folder.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/sample16/folder.gif
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/icons/folder.gif
copy to plugins/org.eclipse.jst.j2ee.web/icons/full/sample16/folder.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif
new file mode 100644
index 0000000..ef30288
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFile.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/folder.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFolder.gif
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/icons/folder.gif
copy to plugins/org.eclipse.jst.j2ee.web/icons/full/thumbnail16/defaultFolder.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif
new file mode 100644
index 0000000..3764249
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/colourpal_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif
new file mode 100644
index 0000000..9f779e4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/gallery_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif
new file mode 100644
index 0000000..5fd9c94
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/links_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif
new file mode 100644
index 0000000..bda81f7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/sample.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif
new file mode 100644
index 0000000..ababbca
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/view16/thumbnail_view.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpexport_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpexport_wiz.png
new file mode 100644
index 0000000..cfe87a0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpexport_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif
new file mode 100644
index 0000000..56c8c3b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.png
new file mode 100644
index 0000000..4713206
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftpimport_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif
new file mode 100644
index 0000000..efb2bd4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.png
new file mode 100644
index 0000000..e980375
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/ftppub_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif
new file mode 100644
index 0000000..71c8182
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.png
new file mode 100644
index 0000000..67483ec
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/httpimport_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newjprj_wiz_32.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newjprj_wiz_32.png
new file mode 100644
index 0000000..62cbd96
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newjprj_wiz_32.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif
new file mode 100644
index 0000000..ff7c242
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.png
new file mode 100644
index 0000000..939a3ce
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwebex_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/web-wiz-banner.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/web-wiz-banner.gif
rename to plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.png
new file mode 100644
index 0000000..1edd090
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/newwprj_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif
new file mode 100644
index 0000000..d251242
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.png
new file mode 100644
index 0000000..244dbb0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warexport_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif
new file mode 100644
index 0000000..0bbebe9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.png b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.png
new file mode 100644
index 0000000..adcf488
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/full/wizban/warimport_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF b/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF
new file mode 100644
index 0000000..6331e65
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/getstart_a.GIF
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif
new file mode 100644
index 0000000..162a578
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif
new file mode 100644
index 0000000..162a578
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/initializ_parameter_context.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif
new file mode 100644
index 0000000..997b50c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_library_reference.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif
new file mode 100644
index 0000000..8a63675
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/jsp_type.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/key.gif b/plugins/org.eclipse.jst.j2ee.web/icons/key.gif
new file mode 100644
index 0000000..03af38b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/key.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif b/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif
new file mode 100644
index 0000000..3070440
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/key_interf_ov.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif
new file mode 100644
index 0000000..c3e27cd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/methElement_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif
new file mode 100644
index 0000000..b647758
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif
new file mode 100644
index 0000000..6d137cd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif
new file mode 100644
index 0000000..8435ec7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/newjprj_wiz_32.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newservlet_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newservlet_wiz.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newservlet_wiz.gif
rename to plugins/org.eclipse.jst.j2ee.web/icons/newservlet_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif b/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif
new file mode 100644
index 0000000..8956b3d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/newwprj_wiz.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif
new file mode 100644
index 0000000..d155408
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/security_constraint.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif
new file mode 100644
index 0000000..b5e8b3f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/server_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif
new file mode 100644
index 0000000..fc1bece
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/servlet.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif
new file mode 100644
index 0000000..c495ac8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif
new file mode 100644
index 0000000..c4a9d21
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/servlet_type.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif
new file mode 100644
index 0000000..0bc6068
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/showerr_tsk.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif
new file mode 100644
index 0000000..14009e9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/showwarn_tsk.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/url_mapping.gif b/plugins/org.eclipse.jst.j2ee.web/icons/url_mapping.gif
new file mode 100644
index 0000000..5b5f008
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/url_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif
new file mode 100644
index 0000000..b26c71d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/url_type.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif b/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif
new file mode 100644
index 0000000..25dc9c8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/user_data_constraint.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif b/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif
new file mode 100644
index 0000000..b8797f3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/user_ovr.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/war.gif b/plugins/org.eclipse.jst.j2ee.web/icons/war.gif
similarity index 100%
rename from plugins/org.eclipse.jst.servlet.ui/icons/war.gif
rename to plugins/org.eclipse.jst.j2ee.web/icons/war.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif b/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif
new file mode 100644
index 0000000..e2b751d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/warn_tsk.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif b/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif
new file mode 100644
index 0000000..acba7cb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/web_resource_collection.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif b/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif
new file mode 100644
index 0000000..09f609d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/web_type.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif
new file mode 100644
index 0000000..7646c44
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_12.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif
new file mode 100644
index 0000000..fec24d6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_13.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif
new file mode 100644
index 0000000..83f9165
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_14.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif
new file mode 100644
index 0000000..71bf43c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_22.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif
new file mode 100644
index 0000000..9fbce05
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_23.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif
new file mode 100644
index 0000000..a9045c1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webapp_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif b/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif
new file mode 100644
index 0000000..274d361
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/webgroup_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif
new file mode 100644
index 0000000..d7dab83
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_file.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif
new file mode 100644
index 0000000..f4c7132
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/welcome_list.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif b/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif
new file mode 100644
index 0000000..1496cba
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/icons/xml_image.gif
Binary files differ
diff --git a/plugins/org.eclipse.jst.j2ee.web/plugin.properties b/plugins/org.eclipse.jst.j2ee.web/plugin.properties
new file mode 100644
index 0000000..ce1444e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/plugin.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2003, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+war_validator_UI_=Web (2.2-2.4) Validator
+WEB_FACET_LABEL=Dynamic Web Module
+WEB_FACET_DESCRIPTION=Adds support for the Java Servlet API, for generation of dynamic Web page content.
+WEB_FACET_TEMPLATE_LABEL=Dynamic Web Project
+WEBFRAGMENT_FACET_TEMPLATE_LABEL=Web Fragment Project
+WEBFRAGMENT_FACET_LABEL=Web Fragment Module
+WEBFRAGMENT_FACET_DESCRIPTION=Adds support for the Web Fragments, which are used in conjunction with Dynamic Web Projects for generation of dynamic Web page content.
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/plugin.xml b/plugins/org.eclipse.jst.j2ee.web/plugin.xml
new file mode 100644
index 0000000..f940841
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/plugin.xml
@@ -0,0 +1,507 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+
+<!--============================-->
+<!-- Web JSFaces File URL extension -->
+<!--============================-->
+
+ <extension-point id="fileURL" name="FileURL" schema="schema/fileURL.exsd"/>
+
+
+<!--============================-->
+<!-- Web Validator -->
+<!--============================-->
+ <extension
+ id="WarValidator"
+ name="%war_validator_UI_"
+ point="org.eclipse.wst.validation.validator">
+ <validator>
+ <enablement>
+ <and>
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.web"/>
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.web:2.4]"/>
+ </and>
+ </enablement>
+ <contentTypeBinding
+ contentTypeId="org.eclipse.jst.j2ee.webDD">
+ </contentTypeBinding>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jar">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter=".websettings">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="org.eclipse.wst.common.component">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter=".classpath">
+ </filter>
+ <helper
+ class="org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper">
+ </helper>
+ <dependentValidator
+ depValValue="true">
+ </dependentValidator>
+ <run
+ class="org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator">
+ </run>
+ <runStrategy
+ project="true">
+ </runStrategy>
+ </validator>
+ </extension>
+
+ <extension
+ id="WebModuleExtension"
+ name="WebModuleExtension"
+ point="org.eclipse.jst.j2ee.EARModuleExtension">
+ <earModuleExtension
+ extensionClass="org.eclipse.jst.j2ee.internal.web.plugin.WebModuleExtensionImpl">
+ </earModuleExtension>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.emfworkbench.integration.adapterFactory">
+ <adapterFactory
+ functionGroupID="org.eclipse.jst.j2ee"
+ className="org.eclipse.jst.j2ee.internal.web.providers.WebapplicationItemProviderAdapterFactory"
+ packageURI="webapplication.xmi"
+ id="org.eclipse.jst.j2ee.webapplication.provider.WebapplicationItemProviderAdapterFactory">
+ </adapterFactory>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.emfworkbench.integration.adapterFactory">
+ <adapterFactory
+ functionGroupID="org.eclipse.jst.j2ee"
+ className="org.eclipse.jst.j2ee.internal.web.providers.JspItemProviderAdapterFactory"
+ packageURI="jsp.xmi"
+ id="org.eclipse.jst.j2ee.internal.jsp.provider.JspItemProviderAdapterFactory">
+ </adapterFactory>
+ </extension>
+
+<!-- =========================================================== -->
+<!-- Web Tag set definitions for XDoclet -->
+<!-- =========================================================== -->
+
+ <extension
+ id="WebTagSets"
+ point="org.eclipse.jst.common.annotations.controller.AnnotationTagSet">
+ <AnnotationTagSet
+ name="web">
+ </AnnotationTagSet>
+ </extension>
+
+ <extension
+ id="WebAnnotationInfo"
+ point="org.eclipse.jst.common.annotations.controller.AnnotationTagInfo">
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="filter"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ <attrib
+ name="display-name">
+ </attrib>
+ <attrib
+ name="small-icon">
+ </attrib>
+ <attrib
+ name="large-icon">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="filter-init-param"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ name="value">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="filter-mapping"
+ scope="type">
+ <attrib
+ name="url-pattern">
+ </attrib>
+ <attrib
+ name="servlet-name">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="servlet"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ name="display-name">
+ </attrib>
+ <attrib
+ name="icon">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ <attrib
+ name="load-on-startup">
+ </attrib>
+ <attrib
+ name="run-as">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="servlet-init-param"
+ multiplicity="*"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ name="value">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="servlet-mapping"
+ multiplicity="*"
+ scope="type">
+ <attrib
+ use="required"
+ name="url-pattern">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="listener"
+ scope="type">
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="security-role-ref"
+ scope="type">
+ <attrib
+ use="required"
+ name="role-name">
+ </attrib>
+ <attrib
+ use="required"
+ name="role-link">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="resource-env-ref"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ use="required"
+ name="type">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="resource-ref"
+ scope="type">
+ <attrib
+ use="required"
+ name="name">
+ </attrib>
+ <attrib
+ use="required"
+ name="type">
+ </attrib>
+ <attrib
+ use="required"
+ name="auth">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ <attrib
+ name="scope">
+ </attrib>
+ <attrib
+ name="jndi-name">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="security-role"
+ scope="type">
+ <attrib
+ use="required"
+ name="role-name">
+ </attrib>
+ <attrib
+ name="description">
+ </attrib>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="env-entry"
+ scope="type">
+ <attrib name="name" use="required">
+ </attrib>
+ <attrib name="description"/>
+ <attrib name="type" type="enum">
+ <enumValues value="java.lang.Boolean"/>
+ <enumValues value="java.lang.Byte"/>
+ <enumValues value="java.lang.Character"/>
+ <enumValues value="java.lang.String"/>
+ <enumValues value="java.lang.Short"/>
+ <enumValues value="java.lang.Integer"/>
+ <enumValues value="java.lang.Long"/>
+ <enumValues value="java.lang.Float"/>
+ <enumValues value="java.lang.Double"/>
+ </attrib>
+ <attrib name="value"/>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="ejb-ref"
+ scope="type">
+ <attrib name="name" use="required"/>
+ <attrib name="type" type="enum" use="required">
+ <enumValues value="Entity"/>
+ <enumValues value="Session"/>
+ </attrib>
+ <attrib name="home" use="required"/>
+ <attrib name="remote" use="required"/>
+ <attrib name="link"/>
+ <attrib name="description"/>
+ </AnnotationTagInfo>
+ <AnnotationTagInfo
+ tagSet="web"
+ tagName="ejb-local-ref"
+ scope="type">
+ <attrib name="name" use="required"/>
+ <attrib name="type" type="enum" use="required">
+ <enumValues value="Entity"/>
+ <enumValues value="Session"/>
+ </attrib>
+ <attrib name="home" use="required"/>
+ <attrib name="local" use="required"/>
+ <attrib name="link"/>
+ <attrib name="description"/>
+ </AnnotationTagInfo>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.common.emfworkbench.integration.editModel">
+ <editModel
+ editModelID="jst.web"
+ factoryClass="org.eclipse.jst.common.jdt.internal.integration.JavaArtifactEditModelFactory">
+ <editModelResource
+ autoload="false"
+ URI="WEB-INF/web.xml"/>
+ </editModel>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.modulecore.artifactedit">
+ <artifactedit
+ typeID="jst.web"
+ class="org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit">
+ </artifactedit>
+ </extension>
+
+ <!--============================-->
+ <!-- Builder Provider registrations-->
+ <!--============================-->
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <ProviderDefinesType
+ providerType="jst.web.builder"
+ providerID="org.eclipse.jst.j2ee.internal.deployables.JavaComponentBuilderDataModelProvider"/>
+ <DataModelProvider
+ class="org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider"
+ id="org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <ProviderDefinesType
+ providerType="jst.webfragment.builder"
+ providerID="org.eclipse.jst.j2ee.internal.deployables.JavaComponentBuilderDataModelProvider"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <DataModelProvider
+ class="org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider"
+ id="org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider">
+ </DataModelProvider>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <DataModelProvider
+ class="org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider"
+ id="org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider">
+ </DataModelProvider>
+ </extension>
+
+ <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ class="org.eclipse.jst.j2ee.internal.web.classpath.WebAppLibrariesContainerInitializer"
+ id="org.eclipse.jst.j2ee.internal.web.container"/>
+ </extension>
+
+ <!-- Project Facets -->
+
+ <extension point="org.eclipse.wst.common.project.facet.core.facets">
+
+ <project-facet id="jst.web">
+ <label>%WEB_FACET_LABEL</label>
+ <description>%WEB_FACET_DESCRIPTION</description>
+ <default-version version="3.0"/>
+ </project-facet>
+
+ <project-facet-version facet="jst.web" version="2.2">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[1.3"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <project-facet-version facet="jst.web" version="2.3">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[1.3"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <project-facet-version facet="jst.web" version="2.4">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[1.3"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <project-facet-version facet="jst.web" version="2.5">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[5.0"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <project-facet-version facet="jst.web" version="3.0">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[6.0"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <action facet="jst.web" version="[2.2-3.0]" type="INSTALL" id="jst.web.install">
+ <delegate class="org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDelegate"/>
+ <config-factory class="org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider"/>
+ </action>
+
+ <event-handler facet="jst.web" version="[2.2-3.0]" type="RUNTIME_CHANGED">
+ <delegate class="org.eclipse.jst.j2ee.project.facet.J2EEFacetRuntimeChangedDelegate"/>
+ </event-handler>
+
+ <event-handler type="POST_INSTALL" facet="jst.web" version="[2.2-3.0]">
+ <delegate class="org.eclipse.jst.j2ee.web.project.facet.WebFacetPostInstallDelegate"/>
+ </event-handler>
+
+ <template id="template.jst.web">
+ <label>%WEB_FACET_TEMPLATE_LABEL</label>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.web"/>
+ </template>
+
+ <project-facet id="jst.webfragment">
+ <label>%WEBFRAGMENT_FACET_LABEL</label>
+ <description>%WEBFRAGMENT_FACET_DESCRIPTION</description>
+ <default-version version="3.0"/>
+ <property name="hide.version" value="true"/>
+ </project-facet>
+
+ <project-facet-version facet="jst.webfragment" version="3.0">
+ <constraint>
+ <and>
+ <requires facet="jst.java" version="[6.0"/>
+ <conflicts group="modules"/>
+ </and>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <action facet="jst.webfragment" version="3.0" type="INSTALL" id="jst.webfragment.install">
+ <delegate class="org.eclipse.jst.j2ee.web.project.facet.WebFragmentFacetInstallDelegate"/>
+ <config-factory class="org.eclipse.jst.j2ee.web.project.facet.WebFragmentFacetInstallDataModelProvider"/>
+ </action>
+
+ <event-handler facet="jst.webfragment" version="3.0" type="RUNTIME_CHANGED">
+ <delegate class="org.eclipse.jst.j2ee.project.facet.J2EEFacetRuntimeChangedDelegate"/>
+ </event-handler>
+
+ <event-handler type="POST_INSTALL" facet="jst.webfragment" version="3.0">
+ <delegate class="org.eclipse.jst.j2ee.web.project.facet.WebFragmentFacetPostInstallDelegate"/>
+ </event-handler>
+
+ <template id="template.jst.webfragment">
+ <label>%WEBFRAGMENT_FACET_TEMPLATE_LABEL</label>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.webfragment"/>
+ </template>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.jst.j2ee.J2EEModelProvider">
+ <provider>
+ <modelProvider factoryClass="org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit"/>
+ <facet id="jst.web" versions="2.2,2.3,2.4"/>
+ </provider>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml b/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml
new file mode 100644
index 0000000..4978da7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/prepareforpii.xml
@@ -0,0 +1,38 @@
+<project name="PrepareForPII" default="main" basedir=".">
+
+ <!-- Setup temp variables -->
+ <target name="init">
+ <property name="nlsDir" value="d:/NLS/Corona/0526"/>
+ <property name="plugin" value="com.ibm.wtp.web"/>
+ <property name="plugindir" value="d:/workspaceCorona/${plugin}"/>
+ <property name="outputDir" value="${nlsDir}/${plugin}"/>
+
+
+ </target>
+
+ <!-- Create the destination dir -->
+ <target name="nlsDir" depends="init">
+ <mkdir dir="${nlsDir}"/>
+ </target>
+
+ <!-- Create the destination dir -->
+ <target name="plugindir" depends="nlsDir">
+ <delete dir="${outputDir}"/>
+ <mkdir dir="${outputDir}"/>
+ </target>
+
+ <!-- Move the files to the correct locations in the workspace. -->
+ <target name="main" depends="plugindir">
+
+ <messageIdGen folderPath = "${plugindir}" componentId = "E" />
+
+ <copy todir = "${outputDir}/property_files" >
+ <fileset dir="${plugindir}/property_files">
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+
+ <copy file="${plugindir}/plugin.properties" todir="${outputDir}"/>
+
+ </target>
+</project>
diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties
new file mode 100644
index 0000000..3ba015f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/property_files/web.properties
@@ -0,0 +1,94 @@
+###############################################################################
+# Copyright (c) 2003, 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
+###############################################################################
+ERR_JAR_NAME_EMPTY=The JAR name cannot be empty.
+ERR_JAR_NAME_EXIST=The JAR name already exists.
+ERR_JAVA_PROJECT_NAME_EMPTY=The Java project name cannot be empty.
+ERR_JAVA_PROJECT_NAME_EXIST=The Java project name already exists.
+ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY=The servlet mapping url pattern cannot be empty.
+
+KEY_3=The filter mapping url pattern cannot be empty.
+KEY_4=The filter mapping url pattern "{0}" already exists.
+KEY_5=The filter mapping servlet cannot be empty.
+KEY_6=The filter init param name cannot be empty.
+ERR_FILTER_PARAMETER_NAME_EXIST=The filter initialization parameter name already exists.
+ERR_FILTER_MAPPING_SERVLET_EXIST=The filter mapping servlet "{0}" already exists.
+ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY=The dispatcher types cannot be empty.
+ERR_DISPLAY_NAME_EMPTY=The name cannot be empty.
+ERR_SERVLET_NAME_EXIST=The servlet name already exists.
+ERR_SERVLET_DISPLAY_NAME_EXIST=The servlet display name already exists.
+ERR_SERVLET_CLASS_NAME_USED=The class is already associated with other servlet.
+ERR_SERVLET_JAVA_CLASS_NAME_INVALID=Cannot use Servlet as the servlet class name.
+ERR_SERVLET_MAPPING_URL_PATTERN_EXIST=The servlet URL mapping pattern already exists.
+ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST=The servlet does not exist.
+ERR_SERVLET_PARAMETER_NAME_EMPTY=The servlet initialization parameter name cannot be empty.
+ERR_SERVLET_PARAMETER_NAME_EXIST=The servlet initialization parameter name already exists.
+ERR_SERVLET_PARAMETER_VALUE_EMPTY=The servlet initialization parameter value cannot be empty.
+ERR_SERVLET_PARAMETER_VALUE_EXIST=The servlet initialization parameter value already exists.
+
+ERR_FILTER_DISPLAY_NAME_EXIST=The filter name already exists.
+ERR_FILTER_NAME_EXIST=The filter name already exists.
+ERR_FILTER_CLASS_NAME_USED=The class is already associated with other filter.
+ERR_FILTER_CLASS_NAME_INVALID=Cannot use Filter as the filter class name.
+
+ERR_LISTENER_DISPLAY_NAME_EXIST=The listener name already exists.
+ERR_LISTENER_CLASS_NAME_USED=The class is already associated with other listener.
+ERR_LISTENER_CLASS_NAME_INVALID=Cannot use Listener as the listener class name.
+
+ERR_DUPLICATED_INIT_PARAMETER=Duplicated initialization parameters.
+ERR_DUPLICATED_URL_MAPPING=Duplicated URL mappings.
+
+ERR_URL_MAPPING_LIST_EMPTY=The URL Mappings list cannot be empty.
+ERR_URL_PATTERN_INVALID="{0}" is unresolvable URL pattern. URL patterns should start with "/" or "*.".
+ERR_FILTER_MAPPING_EMPTY=The Filter Mappings list cannot be empty.
+
+ERR_SERVLET_ROLE_REF_NAME_EMPTY=The servlet security role reference name cannot be empty.
+ERR_SERVLET_ROLE_REF_NAME_EXIST=The servlet security role reference name already exists.
+ERR_SERVLET_ROLE_LINK_EMPTY=The servlet security role reference link cannot be empty.
+ERR_SERVLET_INTERFACE=The Servlet class or its superclass must implement the javax.servlet.Servlet interface.
+
+ERR_PAGE_ENCODING_EMPTY=The page encoding cannot be empty.
+ERR_PAGE_ENCODING_EXIST=The page encoding already exists.
+ERR_URL_PATTERN_EXIST=The URL pattern exists.
+ERR_INCLUDE_PRELUDES_EXIST=The include preludes exists.
+ERR_INCLUDE_CODAS_EXIST=The include Codas exists.
+ERR_SECURITY_CONSTRAINT_NAME_EMPTY=The security constraint name cannot be empty.
+ERR_SECURITY_CONSTRAINT_NAME_EXIST=The security constraint name already exists.
+ERR_CONTEXT_PARAMETER_NAME_EMPTY=The context parameter name cannot be empty.
+ERR_CONTEXT_PARAMETER_NAME_EXIST=The context parameter name already exists.
+ERR_RESOURCE_NAME_EMPTY=The web resource name cannot be empty.
+ERR_RESOURCE_NAME_EXIST=The web resource name already exists.
+ERR_URL_PATTERNS_EMPTY=The URL patterns cannot be empty.
+ERR_MIME_MAPPING_EXTENSION_EMPTY=The Mime mapping extension cannot be empty.
+ERR_MIME_MAPPING_EXTENSION_EXIST=The Mime mapping extension already exists.
+ERR_WELCOME_PAGE_EMPTY=The Welcome file name cannot be empty.
+ERR_WELCOME_PAGE_EXIST=The Welcome file name already exists in Welcome File List.
+ERR_ENV_ENTRY_NAME_EMPTY=The environment entry name cannot be empty.
+ERR_ENV_ENTRY_NAME_EXIST=The environment entry name already exists.
+ERR_ERROR_CODE_EMPTY=The error code cannot be empty.
+ERR_ERROR_CODE_MUST_BE_3_DIGITS=The error code must be three digits.
+ERR_ERROR_PAGE_LOCATION_EMPTY=The error page location cannot be empty.
+ERR_ERROR_PAGE_LOCATION_EXIST=The error page location already exists.
+ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH=The error page location must start with /.
+ERR_EXCEPTION_TYPE_EMPTY=The exception type cannot be empty.
+ERR_EXCEPTION_SECURITY_ID_NO_BEANS=The bean selection can not be empty.
+ERR_EXCEPTION_ROLE_NAME_EMPTY=The role name can not be empty.
+ERR_LOCALE_NAME_EMPTY=The locale cannot be empty.
+ERR_LOCALE_NAME_EXIST=The locale already exists.
+ERR_TAGLIBREF_URL_EMPTY=The tag lib ref URL cannot be empty.
+ERR_TAGLIBREF_URL_EXIST=The tag lib ref URL already exists.
+ERR_MESSAGE_DESTINATION_NAME_EMPTY=The message destination name cannot be empty.
+ERR_MESSAGE_DESTINATION_NAME_EXIST=The message destination name already exists.
+ERR_EXCEPTION_METHOD_ELEMENT_EMPTY=The method elements cannot be empty.
+ERR_EXCEPTION_METHOD_TRANSACTION_ATTRIBUTES_EMPTY=The method transaction attributes can not be empty.
+ERR_SERVLET_LIST_EMPTY=The list of servlets to be removed cannot be empty.
+ERR_FILTER_LIST_EMPTY=The list of filters to be removed cannot be empty.
+ERR_LISTENER_LIST_EMPTY=The list of listeners to be removed cannot be empty.
+ERR_NO_LISTENER_SELECTED=At least one of the application lifecycle listeners must be selected.
diff --git a/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties b/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties
new file mode 100644
index 0000000..03d5767
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/property_files/webedit.properties
@@ -0,0 +1,948 @@
+###############################################################################
+# Copyright (c) 2003, 2004 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
+###############################################################################
+Add_Filter_Mapping_Title_UI_=Add Filter Mapping
+Edit_Filter_Mapping_Title_UI_=Edit Filter Mapping
+FILTER_MAPPING=Filter Mapping
+DISPATCHER_R=R
+DISPATCHER_F=F
+DISPATCHER_I=I
+DISPATCHER_E=E
+LISTENER=Listener
+Select_Dispatchers_UI_=Select dispatchers
+Container_Selection_UI_=Folder Selection
+Choose_a_Container__UI_=Choose a Folder:
+Container__UI_=Folder:
+Browse..._UI_=Browse...
+Superclass_selection_UI_=Superclass selection
+Choose_a_superclass_UI_=Choose a superclass
+Add..._UI_=Add...
+Remove_UI_=Remove
+No_packages_to_choose_from_UI_=No packages to choose from.
+Error_EXC_=IWAE0015E Error
+Specify_a_name_and_package_UI_=Create a new Servlet class.
+Which_method_stubs_would_y_UI_=Which method stubs would you like to create?
+__Add_to_web.xml?_UI_=Add to web.xml?
+__Add...___UI_=Add
+__Delete___UI_=Delete
+Cancel_UI_=Cancel
+New_UI_=New
+None_UI_=None
+Create_the_Servlet_Class_UI_=Create the Servlet Class
+Define_the_Servlet_in_the__UI_=Define the Servlet in the Deployment Descriptor (web.xml) File
+Identify_any_information_t_UI_=Identify any information that should be inserted into the Deployment Descriptor (web.xml) file for the servlet.
+Create_Two_Children_UI_=Create Two Children
+Create_Child_UI_=Create Child
+Description_UI_=Description
+2concat_UI_=Create a new child for the selected {0}.
+4concat_UI_=Create a child of type {0} for the selected {1}.
+6concat_UI_=Create {0}
+7concat_UI_=Create two new children for the selected {0}.
+8concat_UI_=Create two new children of type {0} for the selected {1}.
+9concat_UI_=Create Two {0}s
+11concat_UI_=AuthConstraint {0}
+12concat_UI_=ContextParam {0}
+13concat_UI_=ErrorPage {0}
+14concat_UI_=Error Code: {0}
+15concat_UI_=Exception: {0}
+52concat_UI_=FormLoginConfig {0}
+16concat_UI_=FormLoginConfig {0}
+17concat_UI_=HTTPMethodType {0}
+18concat_UI_={0} = {1}
+21concat_UI_=LoginConfig {0}
+22concat_UI_=MimeMapping {0}
+23concat_UI_=RoleNameType {0}
+24concat=Create a child of type WebResourceCollection for the selected {0}.
+26concat_UI_=Create a child of type InitParam for the selected {0}.
+28concat_UI_={0} -> {1}
+31concat_UI_=SessionConfig {0}
+32concat_UI_=TagLibRef {0}
+33concat_UI_=URLPatternType {0}
+34concat_UI_=UserDataConstraint {0}
+35concat_UI_=Create a child of type ContextParam for the selected {0}.
+37concat_UI_=Create a child of type URLPatternType for the selected {0}.
+38concat_UI_=WebResourceCollection {0}
+40concat_UI_=JSPType {0}
+41concat_UI_=ServletType {0}
+42concat_UI_=Create a child of type WelcomeFile for the selected {0}.
+45concat_ERROR_=IWAE0016E Error writing to web.xml:{0}
+50concat_UI_={0} Change
+New_param_UI_=New param
+value_UI_=value
+New_init_param_UI_=New init param
+(New_Security_Role)_UI_=(New Security Role)
+New_security_role_UI_=New security role
+(New_Servlet)_UI_=(New Servlet)
+packagename.classname_UI_=packagename.classname
+New_servlet_UI_=New servlet
+/url/*_UI_=/url/*
+New_servlet_mapping_UI_=New servlet mapping
+(New_filename)_UI_=(New filename)
+New_welcome_file_UI_=New welcome file
+New_welcome_file_list_UI_=New welcome file list
+Problems_Opening_Editor_ERROR_=IWAE0017E Problems Opening Editor
+Large_Icon_Chooser_Dialog_UI_=Large Icon Chooser Dialog
+Small_Icon_Chooser_Dialog_UI_=Small Icon Chooser Dialog
+Browse..._UI__UI_=Browse...
+Value__UI_=Value:
+Description_UI__UI_=Description
+Error_EXC__ERROR_=IWAE0018E Error
+root_undef_ERROR_=IWAE0019E root undef
+Package__UI_=Package:
+(default)_UI_=(default)
+Servlet_Name__UI_=Servlet Name:
+Superclass__UI_=Superclass:
+Interfaces__UI_=Interfaces:
+Modifiers__UI_=Modifiers:
+Use_Single_Thread_Model_UI_=Use Single Thread Model
+Options__UI_=Options:
+Package_Selection_UI_=Package Selection
+Choose_a_package__UI_=Choose a package:
+Superinterfaces_Selection_UI_=Superinterfaces Selection
+Choose_interfaces_UI_=Choose interfaces
+Create_the_Servlet_Class_UI__UI_=Create the Servlet Class
+Inherited_abstract_methods_UI_=Inherited abstract methods
+Constructors_from_supercla_UI_=Constructors from superclass
+Mappings__UI_=Mappings:
+URL_UI_=URL
+URL__UI_=URL:
+Add_Mapping_UI_=Add Mapping
+Display_Name__UI_=Display name:
+Init_Parameters__UI_=Init Parameters:
+Initialization_parameter_UI_=Initialization parameter
+Value_UI_=Value
+Parameter_Name__UI_=Parameter Name:
+Parameter_Value__UI_=Parameter Value:
+Add_Initialization_Paramet_UI_=Add Initialization Parameter
+OK_UI_=OK
+(default_package)_UI_=(default package)
+Authorized_Roles_UI_=Authorized roles
+Edit..._UI_=Edit...
+(New_web_resource_collecti_UI_=(New web resource collection)
+New_web_resource_collectio_UI_=New web resource collection
+Delete_web_resource_collec_UI_=Delete web resource collection
+Web_Resource_Collection_UI_=Web resource collection
+Web_Resource_Collections_UI_=Web Resource Collections
+New_UI__UI_=Add
+Delete_UI_=Remove
+User_Data_Constraint_UI_=User data constraint
+New_security_constraint_UI_=New security constraint
+Transport_guarentee_change_UI_=Transport guarentee change
+Delete_security_constraint_UI_=Delete security constraint
+Security_constraints_UI_=Security constraints
+Name_UI_=Name
+(New_Web_Resource_Collecti_UI_=(New Web Resource Collection)
+Choose_a_JSP_UI_=Choose a JSP
+Select_a_JSP_file_UI_=Select a JSP file
+Choose_a_servlet_UI_=Choose a servlet
+Select_a_servlet_class_UI_=Select a servlet class
+(New_URL)_UI_=(New URL)
+Icon_change_UI_=Icon change
+Authorized_Roles__UI_=Authorized roles:
+Delete_servlet_mappings_UI_=Delete servlet mappings
+Type__UI_=Type:
+Servlet_class_UI_=Servlet class
+JSP_file_UI_=JSP file
+Display_name__UI_=Display name:
+Description__UI_=Description:
+Initialization__UI_=Initialization...
+Icons__UI_=Icons...
+Display_name_change_UI_=Display name change
+Description_change_UI_=Description change
+Web_type_change_UI_=Web type change
+URL_Mappings__UI_=URL mappings:
+New..._UI_=New...
+Add_UI_=Add
+Delete_servlets_UI_=Delete servlets
+Servlets_UI_=Servlets
+(New_URI)_UI_=(New URI)
+/WEB-INF/tlds/(taglib.tld)_UI_=/WEB-INF/tlds/(taglib.tld)
+New_taglib_UI_=New taglib
+Delete_taglibs_UI_=Delete taglibs
+URI_UI_=URI
+Location_UI_=Location
+(New_ContextParameter)_UI_=(New ContextParameter)
+New_context_parameter_UI_=New context parameter
+Context_parameters__UI_=Context parameters:
+Context_Parameter_Name_UI_=Context Parameter Name
+(New_Extension)_UI_=(New Extension)
+New_mime_mapping_UI_=New mime mapping
+Delete_mime_mappings_UI_=Delete mime mappings
+Session_time_out__UI_=Session time out:
+Distributable_UI_=Distributable
+Display_Name_UI_=Display Name
+Session_Config_UI_=Session Config
+Session_Timeout_UI_=Session Timeout
+Mime_mappings__UI_=Mime mappings:
+File_Extension_UI_=File Extension
+Mime_Type_UI_=Mime Type
+Delete_context_parameters_UI_=Delete context parameters
+Welcome_file_name_change_UI_=Welcome file name change
+(New_Welcome_File)_UI_=(New Welcome File)
+Choose_an_Error_Page_UI_=Choose an Error Page
+Select_an_Error_Page_UI_=Select an Error Page
+Delete_welcome_files_UI_=Delete welcome files
+Delete_error_pages_UI_=Delete error pages
+Welcome_files_UI_=Welcome files
+Choose_a_Login_Page_UI_=Choose a Login Page
+Select_a_Login_Page_UI_=Select a Login Page
+Error_mapping__UI_=Error mapping:
+Error/Exception_UI_=Error/Exception
+Login_UI_=Login
+Realm_name__UI_=Realm name:
+Authentication_method__UI_=Authentication method:
+Login_page__UI_=Login page:
+Error_page__UI_=Error page:
+New_login_config_UI_=New login config
+New_auth_method_ERROR_=IWAE0020E New auth method
+New_auth_method_UI_=New auth method
+New_realm_name_UI_=New realm name
+New_form_login_config_UI_=New form login config
+New_form_error_page_UI_=New form error page
+(New_Error_Code)_UI_=(New Error Code)
+New_error_page_UI_=New error page
+Role_Name_UI_=Role Name
+Select_all_UI_=Select all
+Deselect_all_UI_=Deselect all
+Authority_constraint_chang_UI_=Authority constraint change
+Select_Auth_Constraints_UI_=Select Auth Constraints
+Load_on_startup_UI_=Load on startup
+Load_order__UI_=Load order:
+New_parameter_UI_=New parameter
+Initialization_Parameter_UI_=Initialization Parameter
+Load_on_startup_change_UI_=Load on startup change
+Delete_parameter_UI_=Delete parameter
+Initialization_Parameters_UI_=Initialization Parameters
+Security_role_changes_UI_=Security role changes
+New_security_role_referenc_UI_=New security role reference
+remove_security_role_refer_UI_=remove security role reference
+Select_Authorized_Roles_UI_=Select Authorized Roles
+Name__UI_=Name:
+Delete_URL_Patterns_UI_=Delete URL Patterns
+URL_Patterns_UI_=URL Patterns
+HTTP_Methods_UI_=HTTP Methods
+(New_URL_pattern)_UI_=(New URL pattern)
+New_URL_pattern_UI_=New URL pattern
+Web_resource_collection_na_UI_=Web resource collection name change
+Web_resource_collection_de_UI_=Web resource collection description change
+Add_http_method_type_UI_=Add http method type
+Remove_http_method_type_UI_=Remove http method type
+EJB_references_UI_=EJB references
+Resource_factory_reference_UI_=Resource references
+JSP_tag_libraries_UI_=JSP tag libraries
+References_UI_=References
+Environment_UI_=Environment
+Source_UI_=Source
+Error_creating_nested_text_ERROR_=IWAE0021E Error creating nested text editor
+Pages_UI_=Pages
+Security_UI_=Security
+General_UI_=General
+The_description_property_UI_=The description property
+Roles_UI_=Roles
+The_roles_property_UI_=The roles property
+SecConstraint_UI_=SecConstraint
+The_secConstraint_property_UI_=The secConstraint property
+ParamName_UI_=ParamName
+The_paramName_property_UI_=The paramName property
+ParamValue_UI_=ParamValue
+The_paramValue_property_UI_=The paramValue property
+WebApp_UI_=WebApp
+The_webApp_property_UI_=The webApp property
+The_location_property_UI_=The location property
+ErrorCode_UI_=ErrorCode
+The_errorCode_property_UI_=The errorCode property
+ExceptionType_UI_=ExceptionType
+The_exceptionType_property_UI_=The exceptionType property
+FormLoginPage_UI_=FormLoginPage
+The_formLoginPage_property_UI_=The formLoginPage property
+FormErrorPage_UI_=FormErrorPage
+The_formErrorPage_property_UI_=The formErrorPage property
+LoginConfig_UI_=LoginConfig
+The_loginConfig_property_UI_=The loginConfig property
+HttpMethod_UI_=HttpMethod
+The_httpMethod_property_UI_=The httpMethod property
+ResCollection_UI_=ResCollection
+The_resCollection_property_UI_=The resCollection property
+AuthMethod_UI_=AuthMethod
+The_authMethod_property_UI_=The authMethod property
+RealmName_UI_=RealmName
+The_realmName_property_UI_=The realmName property
+FormLoginConfig_UI_=FormLoginConfig
+The_formLoginConfig_proper_UI_=The formLoginConfig property
+Extension_UI_=Extension
+The_extension_property_UI_=The extension property
+MimeType_UI_=MimeType
+The_mimeType_property_UI_=The mimeType property
+RoleName_UI_=RoleName
+The_roleName_property_UI_=The roleName property
+AuthConstraint_UI_=AuthConstraint
+The_authConstraint_propert_UI_=The authConstraint property
+UserDataConstraint_UI_=UserDataConstraint
+The_userDataConstraint_pro_UI_=The userDataConstraint property
+Create_WebResourceCollecti_UI_=Create WebResourceCollection
+SecurityConstraint_UI_=SecurityConstraint
+SmallIcon_UI_=SmallIcon
+Small_Icon_UI_=Small Icon
+LargeIcon_UI_=LargeIcon
+Large_Icon_UI_=Large Icon
+ServletName_UI_=ServletName
+The_servletName_property_UI_=The servletName property
+DisplayName_UI_=DisplayName
+The_displayName_property_UI_=The displayName property
+LoadOnStartup_UI_=LoadOnStartup
+The_loadOnStartup_property_UI_=The loadOnStartup property
+Create_InitParam_UI_=Create InitParam
+<servlet>_UI_=<servlet>
+UrlPattern_UI_=UrlPattern
+The_urlPattern_property_UI_=The urlPattern property
+Servlet_UI_=&Servlet
+JSP_UI_=&JSP
+The_servlet_property_UI_=The servlet property
+URL_pattern_UI_=&URL pattern
+?_UI_=?
+SessionTimeout_UI_=SessionTimeout
+The_sessionTimeout_propert_UI_=The sessionTimeout property
+TaglibURI_UI_=TaglibURI
+The_taglibURI_property_UI_=The taglibURI property
+TaglibLocation_UI_=TaglibLocation
+The_taglibLocation_propert_UI_=The taglibLocation property
+TransportGuarantee_UI_=TransportGuarantee
+The_transportGuarantee_pro_UI_=The transportGuarantee property
+The_distributable_property_UI_=The distributable property
+FileList_UI_=FileList
+The_fileList_property_UI_=The fileList property
+Create_ContextParam_UI_=Create ContextParam
+<web_app>_UI_=<web app>
+WebResourceName_UI_=WebResourceName
+The_webResourceName_proper_UI_=The webResourceName property
+Create_URLPatternType_UI_=Create URLPatternType
+WebType_UI_=WebType
+JspFile_UI_=JspFile
+The_jspFile_property_UI_=The jspFile property
+ClassName_UI_=ClassName
+The_className_property_UI_=The className property
+WelcomeFile_UI_=WelcomeFile
+The_welcomeFile_property_UI_=The welcomeFile property
+<welcome-file>_UI_=<welcome-file>
+Create_WelcomeFile_UI_=Create WelcomeFile
+Welcome_File_List_UI_=Welcome File List
+Error_Message_No_WRC_Entries_UI_=At least one web resource collection is required for a security constraint. If you want to delete this web resource collection, you must delete the entire security constraint.
+Error_Title_No_WRC_Entries_UI_=Web resource collection
+required1concat=Create a child of type #CHILD_CLASS_NAME# for the selected {0}.
+(New_URL)_UI__UI_=(New URL)
+New_param_UI__UI_=New param
+value_UI__UI_=value
+Select_Servlet_or_JSP_UI_=Select Servlet or JSP
+Select_JSP_UI_=Select JSP
+Add_Servlet_or_JSP_UI_=Add Servlet or JSP
+Add_JSP_UI_=Add JSP
+New_ErrorPage_UI_=New ErrorPage
+New_ExceptionType_UI_=New ExceptionType
+Add_Servlet_UI_=Add Servlet
+Web_Nature_Runtime_does_no_EXC_=IWAE0022E Web Nature Runtime does not exist.
+Editor_Redirection_UI_=Editor Redirection
+The_selected_web.xml_file__ERROR_=IWAE0023E The selected web.xml file is not contained within a WAR Project. Therefore, this web.xml file is not a Deployment Descriptor for a Web Archive, hence the XML editor will be opened.
+Problems_Opening_Editor_UI_=Problems Opening Editor
+Create_#CHILD_CLASS_NAME#_UI_=Create #CHILD_CLASS_NAME#
+Move_Welcome_Files_Down_UI_=Move Welcome Files Down
+Move_Welcome_Files_Up_UI_=Move Welcome Files Up
+Error_occurred_getting_web=Error occurred getting web.xml: {0}
+Select_Class_UI_=Select Class
+Could_not_uniquely_map_the_ERROR_=IWAE0024E Could not uniquely map the class name to a class.
+Information_UI_=Information
+The_chosen_operation_is_no_INFO_=IWAE0025I The chosen operation is not currently available.
+JNDI_Name_UI_=JNDI Name
+New_Servlet_UI_=New Servlet
+
+
+(New_Filter)_1=(New Filter)
+New_filter_2=New filter
+New_filter_mapping_1=New filter mapping
+New_listener_1=New listener
+The_name_property_2=The name property
+The_value_property_4=The value property
+The_target_property_2=The target property
+The_type_property_4=The type property
+The_ExternalCacheGroups_property_2=The ExternalCacheGroups property
+The_IdGenerator_property_4=The IdGenerator property
+The_InvalidateOnly_property_6=The InvalidateOnly property
+The_MetadataGenerator_property_8=The MetadataGenerator property
+The_Priority_property_10=The Priority property
+The_PropertiesGroupName_property_12=The PropertiesGroupName property
+The_Timeout_property_14=The Timeout property
+Small__1=Small:
+Large__3=Large:
+Choose_Small_Icon_5=Choose Small Icon
+Select_the_Small_Icon_6=Select the Small Icon
+Choose_Large_Icon_7=Choose Large Icon
+Select_the_Large_Icon_8=Select the Large Icon
+Caching_group_name__1=Caching group name:
+Priority__2=Priority:
+Timeout__3=Timeout:
+second(s)_4=second(s)
+Invalidate_only_5=Invalidate only
+Caching_group_members__6=Caching group members:
+_Servlet/JSP_7=\ Servlet/JSP
+Remove_9=Remove
+Use_URIs_for_cache_ID_building_1=Use URIs for cache ID building
+Use_specified_string__2=Use specified string:
+Variables__3=Variables:
+_ID_4=\ ID
+_Type_5=\ Type
+_Required_6=\ Required
+External_Cache_groups__1=External Cache groups:
+_Group_Name_2=\ Group Name
+ID_generator__3=ID generator:
+Meta_data_generator__4=Meta data generator:
+Remove_6=Remove
+Add_Servlet_Caching_Configuration_1=Add Servlet Caching Configuration
+Edit_Servlet_Caching_Configuration_2=Edit Servlet Caching Configuration
+Add_1=Add
+Remove_2=Remove
+UP_5=UP
+DOWN_6=DOWN
+Add_or_Remove_Servlet_or_JSP_1=Add or Remove Servlet or JSP
+Add_or_Remove_Security_Role_2=Add or Remove Security Role
+Add_or_Remove_Security_Constraint_3=Add or Remove Security Constraint
+Add_or_Remove_Environment_Variable_4=Add or Remove Environment Variable
+Add_or_Remove_EJB_Reference_5=Add or Remove EJB Reference
+Add_or_Remove_Resource_Reference_6=Add or Remove Resource Reference
+Add_or_Remove_JSP_Tag_Library_7=Add or Remove JSP Tag Library
+Add_or_Remove_Error_Page_8=Add or Remove Error Page
+Add_or_Remove_Exception_Page_9=Add or Remove Exception Page
+Add_or_Remove_Welcome_Page_10=Add or Remove Welcome Page
+Add_or_Remove_Context_Parameter_11=Add or Remove Context Parameter
+Add_or_Remove_Mime_Mapping_12=Add or Remove Mime Mapping
+Add_or_Remove_Filter_13=Add or Remove Filter
+Add_or_Remove_Listener_14=Add or Remove Listener
+Add_or_Remove_Mime_Filter_15=Add or Remove Mime Filter
+Add_or_Remove_File_Serving_Attribute_16=Add or Remove File Serving Attribute
+Add_or_Remove_Invoker_Attribute_17=Add or Remove Invoker Attribute
+Add_or_Remove_JSP_Attribute_18=Add or Remove JSP Attribute
+Add_or_Remove_Servlet_Caching_Configuration_19=Add or Remove Servlet Caching Configuration
+Filter_Mappings_1=Filter Mappings
+Read_Only_22=Read Only
+Writable_23=Writable
+Read_only_files____25=Read only files:
+Web_Deployment_Descriptor_28=Web Deployment Descriptor
+Environment_1=Environment
+Environment_Variables_2=Environment Variables
+Extensions_1=Extensions
+Filters_1=Filters
+Listeners_1=Listeners
+Mime_1=Mime
+Mime_Mappings_2=Mime Mappings
+Overview_1=Overview
+Pages_1=Pages
+Parameters_1=Parameters
+Context_Parameters_2=Context Parameters
+References_1=References
+References_2=References
+EJB_references_3=EJB references
+Resource_references_4=Resource references
+JSP_tag_libraries_5=JSP tag libraries
+Security_1=Security roles
+Security_Roles_3=Security Roles
+Security_Constraints_4=Security Constraints
+Servlets_1=Servlets
+Servlets_and_JSPs_2=Servlets and JSPs
+Details_1=Details
+Details_of_the_selected_environment_variable__2=Details of the selected environment variable:
+Type__3=Type:
+Value__13=Value:
+Mime_Type_change_14=Mime Type change
+Variables_1=Variables
+The_following_environment_variables_are_relevant_to_this_web_application__2=The following environment variables are relevant to this web application:
+(New_Variable)_3=(New Variable)
+File_Serving_Attributes_1=File Serving Attributes
+_Name_2=\ Name
+_Value_3=\ Value
+(name)_4=(name)
+(value)_5=(value)
+General_1=General
+Reloading_enabled_2=Reloading enabled
+Reload_interval__3=Reload interval:
+Default_error_page__5=Default error page:
+Additional_class_path__7=Additional class path:
+File_serving_enabled_9=File serving enabled
+Directory_browsing_enabled_10=Directory browsing enabled
+Serve_servlets_by_classname_11=Serve servlets by classname
+Precompile_JSPs_12=Precompile JSPs
+Automatic_Request_Encoding_enabled_13=Automatic Request Encoding enabled
+Automatic_Response_Encoding_enabled_14=Automatic Response Encoding enabled
+Choose_a_Default_Error_Page_15=Choose a Default Error Page
+Reload_Enabled_Changed_16=Reload Enabled Changed
+File_Serving_Enabled_Changed_17=File Serving Enabled Changed
+Directory_Browsing_Enabled_Changed_18=Directory Browsing Enabled Changed
+Serve_Servlets_by_classname_Enabled_Changed_19=Serve Servlets by classname Enabled Changed
+Precompile_JSPs_Enabled_Changed_20=Precompile JSPs Enabled Changed
+Automatic_Request_Encoding_Enabled_Changed_21=Automatic Request Encoding Enabled Changed
+Automatic_Response_Encoding_Enabled_Changed_22=Automatic Response Encoding Enabled Changed
+Reload_Interval_25=Reload Interval
+Default_Error_Page_26=Default Error Page
+Additional_Classpath_27=Additional Classpath
+Invoker_Attributes_1=Invoker Attributes
+JSP_Attributes_1=JSP Attributes
+MIME_Filters__1=MIME Filters
+_Target_2=\ Target
+_Type_3=\ Type
+(target)_4=(target)
+(type)_5=(type)
+Servlet_Caching_Configurations_1=Servlet Caching Configurations
+Details_of_the_selected_filter_2=Details of the selected filter
+Filter_class__3=Filter class:
+Display_name__5=Display name:
+Filter_Type_Selection_7=Filter Type Selection
+FilterItemProvider_UI_0=FilterName
+Choose_a_Filter_Type_8=Choose a Filter Type
+The_following_Filters_are_included_in_this_web_application__2=The following Filters are included in this web application:
+Icons_1=Icons
+The_following_icons_represent_the_selected_filter__2=The following icons represent the selected filter:
+Initialization_1=Initialization
+The_following_Filters_will_be_started_when_the_web_application_is_started__2=The following Filters will be started when the web application is started:
+_Name_3=\ Name
+_Value_4=\ Value
+Delete_Filter_Init_Param_5=Delete Filter Init Param
+(name)_6=(name)
+(value)_7=(value)
+New_Initialization_Parameter_8=New Initialization Parameter
+Servlet_Mappings_2=Servlet Mappings
+The_following_servlets_are_mapped_to_this_filter__3=The following servlets are mapped to this filter:
+Delete_filter_mappings_4=Delete filter mappings
+New_filter_mapping_5=New filter mapping
+URL_Mappings_1=URL Mappings
+The_following_URLs_are_mapped_to_this_filter__2=The following URLs are mapped to this filter:
+Delete_filter_mappings_3=Delete filter mappings
+New_filter_mapping_4=New filter mapping
+Details_of_the_selected_listener_2=Details of the selected listener
+Package__3=Package:
+(default_package)_5=(default package)
+Listeners_5=Listeners
+The_following_Listeners_are_included_in_this_web_application__6=The following Listeners are included in this web application:
+Listener_Type_Selection_10=Listener Type Selection
+Choose_a_Listener_Type_11=Choose a Listener Type
+Details_of_the_selected_file_extension__2=Details of the selected file extension:
+Mime_type__3=Mime type:
+Mime_Type_change_4=Mime Type change
+File_Extensions_1=File Extensions
+The_following_file_extensions_are_mapped_to_Mime_types__2=The following file extensions are mapped to Mime types:
+Context_Parameters_1=Context Parameters
+The_following_context_initialization_parameters_apply_to_all_servlets_in_this_web_application__2=The following context initialization parameters apply to all servlets in this web application:
+Environment_Variables_1=Environment Variables
+The_following_filters_are_used_in_this_application__2=The following filters are used in this application:
+General_Information_1=General Information
+Display_name__2=Display name:
+Description__3=Description:
+Session_time_out__4=Session time out:
+Distributable_5=Distributable
+Display_Name_6=Display Name
+Description_7=Description
+Icons_2=Icons
+The_following_icons_represent_this_web_application__3=The following icons represent this web application:
+The_following_listeners_are_used_in_this_application__2=The following listeners are used in this application:
+Mime_Type_1=Mime Type
+The_following_file_extensions_are_mapped_to_mime_types__2=The following file extensions are mapped to mime types:
+This_web_application_uses_the_following_welcome_and_error_pages__2=This web application uses the following welcome and error pages:
+This_web_application_references_the_following_resources__2=This web application references the following resources:
+The_following_security_roles_and_constraints_are_defined_for_this_web_application__2=The following security roles and constraints are defined for this web application:
+Servlets_and_JSPs_1=Servlets and JSPs
+The_following_servlets_and_JSPs_are_used_in_this_application__2=The following servlets and JSPs are used in this application:
+Usage_1=Usage
+The_following_Enterprise_Applications_use_this_web_module__2=The following Enterprise Applications use this web module:
+Error_Pages_1=Error Pages
+Resources_in_the_following_URLs_will_be_accessed_in_response_to_HTTP_error_codes__2=Resources in the following URLs will be accessed in response to HTTP error codes:
+_Error_Code_3=\ Error Code
+_URL_4=\ URL
+Java_Exception_Types_2=Java Exception Types
+Resources_in_the_following_URLs_will_be_accessed_in_response_to_Java_exception_types__3=Resources in the following URLs will be accessed in response to Java exception types:
+_Exception_Type_4=\ Exception Type
+_URL_5=\ URL
+Exception_Type_Selection_9=Exception Type Selection
+Choose_an_Exception_Type_10=Choose an Exception Type
+Login_1=Login
+The_following_Login_configuration_values_are_used_for_this_web_application__2=The following Login configuration values are used for this web application:
+Realm_name__3=Realm name:
+Authentication_method__4=Authentication method:
+Login_page__5=Login page:
+Error_page__8=Error page:
+Welcome_Pages_1=Welcome Pages
+The_server_will_search_for_the_following_pages,_in_this_order,_when_the_web_application_is_referenced__2=The server will search for the following pages, in this order, when the web application is referenced:
+The_following_context_parameters_are_included_in_this_web_application__2=The following context parameters are included in this web application:
+Details_of_the_selected_context_parameter__2=Details of the selected context parameter:
+Value__3=Value:
+Context_Param_Value_change_4=Context Param Value change
+WebSphere_Bindings_1=WebSphere Bindings
+JNDI_Name__2=JNDI Name:
+Ejb_Ref_JNDI_Name_change_3=Ejb Ref JNDI Name change
+Details_of_the_selected_EJB_reference_2=Details of the selected EJB reference
+Home__6=Home:
+Remote__7=Remote:
+Ejb_Ref_Home_change_8=Ejb Ref Home change
+Ejb_Ref_Remote_change_9=Ejb Ref Remote change
+EJB_Reference_Type_change_10=EJB Reference Type change
+EJB_References_1=EJB References
+The_following_EJB_references_are_used_in_this_web_application__2=The following EJB references are used in this web application:
+JNDI_Name_3=JNDI Name
+Details_of_the_selected_JSP_tag_library_2=Details of the selected JSP tag library
+URI__3=URI:
+Location__4=Location:
+JSP_tag_library_location_change_5=JSP tag library location change
+JSP_tag_library_URI_change_6=JSP tag library URI change
+JSP_tag_libraries_1=JSP tag libraries
+The_following_JSP_tag_libraries_are_used_in_this_web_application__2=The following JSP tag libraries are used in this web application:
+Resource_Ref_JNDI_Name_change_3=Resource Ref JNDI Name change
+Details_of_the_selected_resource_reference_2=Details of the selected resource reference
+Authentication__4=Authentication:
+Resource_Reference_Type_change_7=Resource Reference Type change
+Resource_Reference_Authentication_change_10=Resource Reference Authentication change
+Resource_References_1=Resource References
+The_following_resource_references_are_used_in_this_web_application__2=The following resource references are used in this web application:
+(New_ResourceRef)_3=(New ResourceRef)
+JNDI_Name_4=JNDI Name
+Authorized_Roles_2=Authorized Roles
+The_following_roles_are_authorized_to_access_the_web_resource_collections_in_this_security_constraint__3=The following roles are authorized to access the web resource collections in this security constraint:
+Security_Constraints_1=Security Constraints
+These_constraints_prescribe_access_policies_for_specific_web_resources_2=These constraints prescribe access policies for specific web resources
+User_Data_Constraint_1=User Data Constraint
+The_following_are_the_transport_guarantees_required_between_client_and_server_for_the_security_constraint__2=The following are the transport guarantees required between client and server for the security constraint:
+Web_Resource_Collections_1=Web Resource Collections
+The_following_define_web_resources_and_their_HTTP_method_for_this_web_application__2=The following define web resources and their HTTP method for this web application:
+Details_of_the_selected_security_role__2=Details of the selected security role:
+Security_Roles_Description_change_5=Security Roles Description change
+Security_Roles_1=Security Roles
+The_following_security_roles_are_defined_for_this_web_application__2=The following security roles are defined for this web application:
+Authorized_roles_2=Authorized roles
+The_following_roles_are_authorized_to_access_this_servlet__3=The following roles are authorized to access this servlet:
+Details_of_the_selected_servlet_or_JSP_2=Details of the selected servlet or JSP
+Servlet_class__3=Servlet class:
+WebSphere_Extensions_3=WebSphere Extensions
+Optional_WebSphere_specific_extensions_to_the_Web_Deployment_Descriptor_4=Optional WebSphere specific extensions to the Web Deployment Descriptor
+Unresolved_action__5=Unresolved action:
+Servlet_Extension_Change_6=Servlet Extension Change
+The_following_icons_represent_the_selected_servlet_or_JSP__3=The following icons represent the selected servlet or JSP:
+The_following_URLs_are_mapped_to_this_servlet__2=The following URLs are mapped to this servlet:
+The_following_servlets_and_JSPs_are_included_in_this_web_application__2=The following servlets and JSPs are included in this web application:
+The_filterName_property_3=The filterName property
+The_filter_property_2=The filter property
+The_ListenerClass_property_2=The ListenerClass property
+Details...=Details...
+Load_on_startup_5=Load on startup
+Load_order__6=Load order:
+Delete_Servlet_Init_Param_7=Delete Servlet Init Param
+(name)_8=(name)
+(value)_9=(value)
+New_Initialization_Parameter_10=New Initialization Parameter
+Filter_mapping___1=Filter mapping:
+SecurityConstraint_1=SecurityConstraint
+The_following_initialization_parameters_are_configured_for_this_servlet__1=The following initialization parameters are configured for this servlet:
+Filter_mapping_text={0} -> {1}
+Add_or_Remove_Resource_Environment_Reference_1=Add or Remove Resource Environment Reference
+MIME_1=MIME
+MIME_Mappings_2=MIME Mappings
+Resource_Environment_1=Resource Environment
+Automatic_Filter_Loading_enabled_1=Automatic Filter Loading enabled
+Automatic_Filter_Loading_Enabled_Changed_4=Automatic Filter Loading Enabled Changed
+The_following_servlets_have_this_filter_mapped_to_them_1=The following servlets have this filter mapped to them
+The_following_URLs_have_this_filter_mapped_to_them_1=The following URLs have this filter mapped to them
+MIME_type__1=MIME type:
+MIME_Type_change_2=MIME Type change
+The_following_file_extensions_are_mapped_to_MIME_types_1=The following file extensions are mapped to MIME types
+Location_1=\ Location
+Link__1=Link:
+Ejb_Ref_Link_change_2=Ejb Ref Link change
+Resource_Env_Ref_JNDI_Name_change_1=Resource Env Ref JNDI Name change
+Details_of_the_selected_resource_environment_reference_1=Details of the selected resource environment reference
+Type_Selection_2=Type Selection
+Choose_a_type_3=Choose a type
+Resource_Environment_References_1=Resource Environment References
+The_following_resource_environment_references_are_used_in_this_web_application_2=The following resource environment references are used in this web application
+New_ResourceEnvRef_3=New ResourceEnvRef
+Add_Servlet_Extension_1=Add Servlet Extension
+_ERROR_Problems_opening_editor_3=IWAE0026E Problems opening editor
+_ERROR_JSP_file_does_not_exist_4=IWAE0027E JSP file does not exist
+_ERROR_Problems_opening_editor_5=IWAE0028E Problems opening editor
+_ERROR_Could_not_find_type_within_project_6=IWAE0029E Could not find type within project
+_ERROR_Problems_opening_editor_7=IWAE0030E Problems opening editor
+_ERROR_Problems_opening_editor_8=IWAE0031E Problems opening editor
+Add_Variable_1=Add Variable
+Edit_Variable_2=Edit Variable
+Define_a_new_variable_in_this_servlet_caching_configuration_1=Define a new variable in this servlet caching configuration
+Variable_2=Variable
+ID__3=ID:
+Type__4=Type:
+Method__5=Method:
+Data_ID__6=Data ID:
+Invalid_ID__7=Invalid ID:
+Required_8=Required
+Add_External_Cache_Group_1=Add External Cache Group
+Add_an_external_cache_group_to_this_servlet_caching_configuration_1=Add an external cache group to this servlet caching configuration
+External_Cache_Group_2=External Cache Group
+Group_Name__3=Group Name:
+Group_Name_is_empty_5=Group Name is empty
+Caching_group_name_is_empty_2=Caching group name is empty
+Priority_must_be_an_integer_3=Priority must be an integer
+Timeout_must_be_an_integer_4=Timeout must be an integer
+Define_a_new_servlet_caching_configuration_1=Define a new servlet caching configuration
+Servlet_Caching_Configuration_2=Servlet Caching Configuration
+The_DefaultPage_property_2=The DefaultPage property
+The_ErrorPage_property_4=The ErrorPage property
+The_MimeType_property_6=The MimeType property
+The_Name_property_8=The Name property
+The_Pages_property_10=The Pages property
+The_ExtendedServlet_property_2=The ExtendedServlet property
+The_LocalTransaction_property_4=The LocalTransaction property
+The_MarkupLanguage_property_6=The MarkupLanguage property
+Define_Authorization_Constraint_1=Define Authorization Constraint
+Choose_a_servlet__1=&Choose a servlet:
+Choose_a_servlet__2=Choose a Servlet:
+Matching_servlets__2=&Matching servlets:
+Choose_a_filter__1=&Choose a filter:
+Matching_filters__2=&Matching filters:
+Qualifier__3=&Qualifier:
+Add_or_Remove_EJB_Local_Reference_1=Add or Remove EJB Local Reference
+Add_or_Remove_Markup_Language_2=Add or Remove Markup Language
+Close_editor_3=Close editor
+File_has_been_deleted_from_the_file_system._nWhat_would_you_like_to_do__4=File has been deleted from the file system.\nWhat would you like to do?
+Save_and_close_editor_5=Save and close editor
+Close_editor_6=Close editor
+This_web.xml_file_is_not_a_valid_Deployment_Descriptor_for_a_Web_Archive,_hence_the_XML_editor_will_be_opened_7=This web.xml file is not a valid Deployment Descriptor for a Web Archive, hence the XML editor will be opened.
+EJB_1=EJB
+EJB_Local_2=EJB Local
+Resource_3=Resource
+Resource_Environment_1_4=Resource_Environment_1
+JSP_tag_libraries_5_5=JSP_tag_libraries_5
+Choose_a_listener__1=Choose a listener:
+Matching_listener__2=Matching listener:
+Problems_opening_editor_2=Problems opening editor
+application.xml_does_not_exist_3=application.xml does not exist
+Refresh_4=Refresh
+Details_of_the_selected_EJB_Local_reference_1=Details of the selected EJB Local reference
+Local_home__2=Local home:
+Local__3=Local:
+EJB_Local_References_1=EJB Local References
+The_following_EJB_local_references_are_used_in_this_web_application_2=The following EJB local references are used in this web application
+(New_EJB_Local_Ref)_3=(New EJB Local Ref)
+(New_ResourceEnvRef)_1=(New ResourceEnvRef)
+Description__2=Description:
+Description_change_3=Description change
+Details_of_the_Servlet_Extension_of_the_selected_servlet_1=Details of the Servlet Extension of the selected servlet
+Markup_Languages_2=Markup Languages
+Local_Transaction_3=Local Transaction
+Delete_Filter_Mapping_1=Delete Filter Mapping
+Add_Filter_Mappings_2=Add Filter Mappings
+Choose_a_JSP__1=Choose a JSP:
+Name__2=Name:
+MIME_type__3=MIME type:
+Error_page__4=Error page:
+Browse_5=Browse
+Default_page__6=Default page:
+Browse_7=Browse
+Pages__8=Pages:
+_Name_9=\ Name
+_URI_10=\ URI
+(Name)_11=(Name)
+(URI)_12=(URI)
+Name_is_empty_13=Name is empty
+MIME_is_empty_14=MIME is empty
+Define_a_new_markup_language_entry_1=Define a new markup language entry
+Markup_Language_2=Markup Language
+Choose_a_Page_1=Choose a Page
+Description__1=Description:
+Environment_variable_value_change_1=Environment variable value change
+Environment_variable_description_change_2=Environment variable description change
+Description_name_change_2=Description name change
+Context_Param_Description_change_1=Context Param Description change
+Ejb_Ref_Description_change_1=Ejb Ref Description change
+Resource_Environment_Ref_Description_change_1=Resource Environment Ref Description change
+Resource_Ref_Description_change_1=Resource Ref Description change
+Details_of_the_selected_security_constraint_1=Details of the selected security constraint
+Display_Name__2=Display Name:
+Security_Constraint_DisplayName_change_3=Security Constraint DisplayName change
+Empty_List_2=Empty List
+_UI_Select_a_tag_library_to_add_to_the_deployment_descriptor_1=Select a tag library to add to the deployment descriptor
+_UI_Add_a_Tag_Library_2=Add a Tag Library
+_UI_Tag_Libraries__3=Tag Libraries:
+_UI_Available_Custom_Tags__4=Available Custom Tags:
+_UI__Tag_5=\ Tag
+_UI__Description_6=\ Description
+_UI_URI__7=URI:
+_UI_Select_a_Tag_Library_8=Select a Tag Library
+_UI_URI_cannot_be_empty_10=URI cannot be empty
+Browse..._1=Browse...
+Browse..._3=Browse...
+Browse..._4=Browse...
+Remove_Link_7=Remove Link
+Home_interface_selection_8=Home interface selection
+Local_interface_selection_13=Local interface selection
+Choose_an_interface_16=Choose an interface
+Matching_interfaces__17=Matching interfaces:
+Set_EJB_Local_Ref_Link_18=Set EJB Local Ref Link
+Remove_EJB_Local_Ref_Link_19=Remove EJB Local Ref Link
+EJB_selection_3=EJB selection
+Choose_an_EJB_4=Choose an EJB
+Matching_EJBs__5=Matching EJBs:
+Location__6=Location:
+Empty_List_11=Empty List
+Set_EJB_Ref_Link_8=Set EJB Ref Link
+Remove_EJB_Ref_Link_9=Remove EJB Ref Link
+Home_interface_selection_11=Home interface selection
+Remote_interface_selection_14=Remote interface selection
+Choose_an_interface_17=Choose an interface
+Matching_interfaces__18=Matching interfaces:
+Specify_an_Error_Code_and_Location_1=Specify an Error Code and Location
+Specify_an_Exception_Type_and_Location_2=Specify an Exception Type and Location
+Add_an_Error_Page_3=Add an Error Page
+Error_Code__4=Error Code:
+Exception_Type__5=Exception Type:
+Select..._6=Select...
+Browse..._7=Browse...
+Location__8=Location:
+Browse..._9=Browse...
+Error_Code_is_empty_13=Error Code is empty
+Exception_Type_is_empty_14=Exception Type is empty
+Location_is_empty_16=Location is empty
+Location_18=Location
+Select_a_Page_19=Select a Page
+Add_a_page_to_this_markup_language_1=Add a page to this markup language
+Page_2=Page
+Name__3=Name:
+URI__4=URI:
+Name_is_empty_8=Name is empty
+URI_is_empty_10=URI is empty
+Details_of_the_Servlet_Extension_for_the_selected_servlet_1=Details of the Servlet Extension for the selected servlet
+Delete_Markup_Language_7=Delete Markup Language
+Add_Markup_Language_entry_8=Add Markup Language entry
+Edit_Markup_Language_entry_9=Edit Markup Language entry
+The_name_property_1=The name property
+The_URI_property_2=The URI property
+Empty_List_1=Empty List
+Web_Library_Projects_1=Web Library Projects
+The_following_JARs_are_mapped_to_Java_projects__2=The following JARs are mapped to Java projects:
+_JAR_Name_3=\ JAR Name
+_Java_Project_4=\ Java Project
+Error_5=Error
+Add_Page_1=Add Page
+Up_1=Up
+Down_2=Down
+Resource_Reference_Shareable_change_3=Resource Reference Shareable change
+Environment_variable_type_change_1=Environment variable type change
+WebSphere_Extensions_1=WebSphere Extensions
+Browse..._2=Browse...
+Remove_Page_3=Remove Page
+Tag_Library_1=Tag Library
+Create_Page_1=Create Page
+Create_MarkupLanguage_1=Create MarkupLanguage
+Add_or_Remove_Servlet_Extension_1=Add or Remove Servlet Extension
+_INFO_No_security_roles_exist._1=IWAE0032I No security roles exist.
+_INFO_No_Enterprise_Beans_which_implement_the_remote_interface_exist._1=IWAE0033I No Enterprise Beans which implement the remote interface exist.
+_INFO_No_Enterprise_Beans_which_implement_the_local_interface_exist._2=IWAE0034I No Enterprise Beans which implement the local interface exist.
+_INFO_No_servlets_exist_to_add._1=IWAE0035I No servlets exist to add.
+_INFO_No_classes_which_implement_javax.servlet.Filter_exist._1=IWAE0037I No classes which implement javax.servlet.Filter exist.
+_INFO_No_filters_exist_to_add._1=IWAE0038I No filters exist to add.
+_INFO_No_listeners_exist_to_add._1=IWAE0039I No listeners exist to add.
+_ERROR_Error_updating_Web_Properties_1=IWAE0040E Error updating Web Properties
+_INFO_No_home_interfaces_exist._1=IWAE0041I No home interfaces exist.
+_INFO_No_local_interfaces_exist._2=IWAE0042I No local interfaces exist.
+_INFO_No_remote_interfaces_exist._2=IWAE0043I No remote interfaces exist.
+_INFO_No_tag_libraries_exist_to_add._1=IWAE0044I No tag libraries exist to add.
+_INFO_No_exceptions_exist_to_add._1=IWAE0045I No exceptions exist to add.
+Add_Resource_Reference_Extension_3=Add Resource Reference Extension
+Virtual_Host_Name__1=Virtual Host Name:
+Connection_management__1=Connection management:
+Isolation_level__2=Isolation level:
+_Markup_Language_1=\ Markup Language
+_Mime_Type_2=\ Mime Type
+Boundary__3=Boundary:
+Resolver__4=Resolver:
+Unresolved_Action__5=Unresolved Action:
+Select_an_Error_Code_1=Select an Error Code
+Code_2=Code
+Description_3=Description
+*_denotes_error_code_new_to_HTTP_1.1_4=* denotes error code new to HTTP 1.1
+Continue*_6=Continue*
+Switching_Protocols*_8=Switching Protocols*
+OK_10=OK
+Created_12=Created
+Accepted_14=Accepted
+Non-Authoritative_Information*_16=Non-Authoritative Information*
+No_Content_18=No Content
+Reset_Content*_20=Reset Content*
+Partial_Content*_22=Partial Content*
+Multiple_Choices_24=Multiple Choices
+Moved_Permanently_26=Moved Permanently
+Found_28=Found
+See_Other*_30=See Other*
+Not_Modified_32=Not Modified
+Use_Proxy*_34=Use Proxy*
+Temporary_Redirect*_36=Temporary Redirect*
+Bad_Request_38=Bad Request
+Unauthorized_40=Unauthorized
+Forbidden_42=Forbidden
+Not_Found_44=Not Found
+Method_Not_Allowed*_46=Method Not Allowed*
+Not_Acceptable*_48=Not Acceptable*
+Proxy_Authentication_Required*_50=Proxy Authentication Required*
+Request_Timeout*_52=Request Timeout*
+Conflict*_54=Conflict*
+Gone*_56=Gone*
+Length_Required*_58=Length Required*
+Precondition_Failed*_60=Precondition Failed*
+Request_Entity_Too_Large*_62=Request Entity Too Large*
+Request_URI_Too_Long*_64=Request URI Too Long*
+Unsupported_Media_Type*_66=Unsupported Media Type*
+Requested_Range_Not_Satisfiable*_68=Requested Range Not Satisfiable*
+Expectation_Failed*_70=Expectation Failed*
+Internal_Server_Error_72=Internal Server Error
+Not_Implemented_74=Not Implemented
+Bad_Gateway_76=Bad Gateway
+Service_Unavailable_78=Service Unavailable
+Gateway_Timeout*_80=Gateway Timeout*
+HTTP_Version_Not_Supported*_82=HTTP Version Not Supported*
+Choose_a_Servlet_1=Choose a Servlet
+Unspecified_1=Unspecified
+Sharing__1=Sharing:
+Error_Page_1=Error Page
+New_EJB_Ref=(New EJB Ref)
+selectSR=Select a Security Role
+Role_name=Role name
+NoSR=No Security Roles exist.
+RemoveUDC=Remove User Data Constraint
+UDC_desc_change=User Data Constraint description changed
+Run_As=Run As
+detRunAs=Details of the selected servlet's run-as element
+SR=Security role:
+Select=Select...
+Remove=Remove
+RemoveRA=Remove run-as
+SetRA=Set run-as
+SetRN=Set role-name
+SecurityRoleRefDialog.Security_Role_Ref=Security Role Ref
+SecurityRoleRefDialog.Role_name=Role name:
+SecurityRoleRefDialog.Role_link=Role link:
+SecurityRoleRefDialog.Description=Description:
+WebapplicationEditor.Add_or_Remove_Security_Role_Ref=Add or Remove Security Role Ref
+Ser_AuthSection._Link=\ Link
+Ser_AuthSection.Edit_Security_Role_Ref=Edit Security Role Ref
+srr_header=Security Role References
+srr_description=The following security role references are defined for this servlet:
+Local_encoding_mapping_list_UI_=Locale Encoding Mapping List
+local_encoding_mapping_UI_=Locale Encoding Mapping
+_UI_JSPConfig_type=JSP Config
+_UI_TagLibRefType_type=TagLibRefType
+_UI_JSPPropertyGroup_type=JSPPropertyGroup
+_UI_JSPPropertyGroup_urlPattern_feature=URL Pattern
+_UI_JSPPropertyGroup_elIgnored_feature=El Ignored
+_UI_JSPPropertyGroup_pageEncoding_feature=Page Encoding
+_UI_JSPPropertyGroup_scriptingInvalid_feature=Scripting Invalid
+_UI_JSPPropertyGroup_isXML_feature=Is XML
+_UI_JSPPropertyGroup_includePreludes_feature=Include Preludes
+_UI_JSPPropertyGroup_includeCodas_feature=Include Codas
+
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/schema/fileURL.exsd b/plugins/org.eclipse.jst.j2ee.web/schema/fileURL.exsd
new file mode 100644
index 0000000..252f46a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/schema/fileURL.exsd
@@ -0,0 +1,118 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.j2ee.web">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.j2ee.web" id="fileURL" name="File URL"/>
+ </appInfo>
+ <documentation>
+ This is for the Web JSFaces File URL extension.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="fileURL"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="fileURL">
+ <complexType>
+ <sequence>
+ <element ref="run"/>
+ </sequence>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier for this extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="run">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the qualified name of the class to run
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ <b>This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.</b>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2005 IBM Corporation and others.<br>
+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 <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_class.template b/plugins/org.eclipse.jst.j2ee.web/templates/_class.template
new file mode 100644
index 0000000..17fc58a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_class.template
@@ -0,0 +1,40 @@
+<%
+ if (model.isPublic()) {
+%>
+public
+<%
+ }
+
+ if (model.isAbstract()) {
+%>abstract
+<%
+ }
+
+ if (model.isFinal()) {
+%>final
+<%
+ }
+%>class <%= model.getClassName() %>
+<%
+ String superClass = model.getSuperclassName();
+ if (superClass != null && superClass.length() > 0) {
+%> extends <%= superClass %>
+<%
+ }
+
+ List<String> interfaces = model.getInterfaces();
+ if ( interfaces.size() > 0) {
+%> implements
+<%
+ }
+
+ for (int i = 0; i < interfaces.size(); i++) {
+ String INTERFACE = interfaces.get(i);
+ if (i > 0) {
+%>,
+<%
+ }
+%><%= INTERFACE %>
+<%
+ }
+%> {
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_constructors.template b/plugins/org.eclipse.jst.j2ee.web/templates/_constructors.template
new file mode 100644
index 0000000..1b938b9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_constructors.template
@@ -0,0 +1,31 @@
+<%
+ if (!model.hasEmptySuperclassConstructor()) {
+%>
+
+ /**
+ * Default constructor.
+ */
+ public <%= model.getClassName() %>() {
+ // TODO Auto-generated constructor stub
+ }
+<%
+ }
+
+ if (model.shouldGenSuperclassConstructors()) {
+ List<Constructor> constructors = model.getConstructors();
+ for (Constructor constructor : constructors) {
+ if (constructor.isPublic() || constructor.isProtected()) {
+%>
+
+ /**
+ * @see <%= model.getSuperclassName() %>#<%= model.getSuperclassName() %>(<%= constructor.getParamsForJavadoc() %>)
+ */
+ public <%= model.getClassName() %>(<%= constructor.getParamsForDeclaration() %>) {
+ super(<%= constructor.getParamsForCall() %>);
+ // TODO Auto-generated constructor stub
+ }
+<%
+ }
+ }
+ }
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_flags.template b/plugins/org.eclipse.jst.j2ee.web/templates/_flags.template
new file mode 100644
index 0000000..7e6afd4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_flags.template
@@ -0,0 +1,3 @@
+<%
+ model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_imports.template b/plugins/org.eclipse.jst.j2ee.web/templates/_imports.template
new file mode 100644
index 0000000..fde7b4b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_imports.template
@@ -0,0 +1,9 @@
+<%
+ Collection<String> imports = model.getImports();
+ for (String anImport : imports) {
+%>
+import <%= anImport %>;
+<%
+ }
+%>
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_methods.template b/plugins/org.eclipse.jst.j2ee.web/templates/_methods.template
new file mode 100644
index 0000000..5fe3d10
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_methods.template
@@ -0,0 +1,23 @@
+<%
+ if (model.shouldImplementAbstractMethods()) {
+ for (Method method : model.getUnimplementedMethods()) {
+%>
+
+ /**
+ * @see <%= method.getContainingJavaClass() %>#<%= method.getName() %>(<%= method.getParamsForJavadoc() %>)
+ */
+ public <%= method.getReturnType() %> <%= method.getName() %>(<%= method.getParamsForDeclaration() %>) {
+ // TODO Auto-generated method stub
+<%
+ String defaultReturnValue = method.getDefaultReturnValue();
+ if (defaultReturnValue != null) {
+%>
+ return <%= defaultReturnValue %>;
+<%
+ }
+%>
+ }
+<%
+ }
+ }
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/_package.template b/plugins/org.eclipse.jst.j2ee.web/templates/_package.template
new file mode 100644
index 0000000..f279df7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/_package.template
@@ -0,0 +1,8 @@
+<%
+ if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
+%>
+package <%= model.getJavaPackageName() %>;
+<%
+ }
+%>
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/filter.javajet b/plugins/org.eclipse.jst.j2ee.web/templates/filter.javajet
new file mode 100644
index 0000000..881fb0b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/filter.javajet
@@ -0,0 +1,45 @@
+<%@ jet package="org.eclipse.jst.j2ee.internal.web.operations"
+ imports="java.util.* org.eclipse.jst.j2ee.internal.common.operations.*"
+ class="FilterTemplate"
+%>
+<% CreateFilterTemplateModel model = (CreateFilterTemplateModel) argument; %>
+<%@ include file="_flags.template" %>
+<%@ include file="_package.template" %>
+<%@ include file="_imports.template" %>
+<%@ include file="filter_classHeader.template" %>
+<%@ include file="_class.template" %>
+<%@ include file="_constructors.template" %>
+<%@ include file="_methods.template" %>
+<% if (model.shouldGenDestroy()) { %>
+
+ /**
+ * @see Filter#destroy()
+ */
+ public void destroy() {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoFilter()) { %>
+
+ /**
+ * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
+ */
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ // TODO Auto-generated method stub
+ // place your code here
+
+ // pass the request along the filter chain
+ chain.doFilter(request, response);
+ }
+<% } %>
+<% if (model.shouldGenInit()) { %>
+
+ /**
+ * @see Filter#init(FilterConfig)
+ */
+ public void init(FilterConfig fConfig) throws ServletException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template
new file mode 100644
index 0000000..f006a5e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/filter_classHeader.template
@@ -0,0 +1,249 @@
+/**
+ * Servlet Filter implementation class <%= model.getClassName() %>
+<%
+ if (model.isAnnotated()) {
+%>
+ *
+ * @web.filter
+ * name="<%= model.getFilterName() %>"
+ * display-name="<%= model.getFilterName() %>"
+<%
+ if (model.getDescription() != null && model.getDescription().length() > 0) {
+%>
+ * description="<%= model.getDescription() %>"
+<%
+ }
+
+ List<IFilterMappingItem> mappings = model.getFilterMappings();
+ for (IFilterMappingItem mapping : mappings) {
+%>
+ *
+ * @web.filter-mapping
+<%
+ if (mapping.isUrlPatternType()) {
+%>
+ * url-pattern="<%= mapping.getName() %>"
+<%
+ } else if (mapping.isServletNameType()) {
+%>
+ * servlet-name="<%= mapping.getName() %>"
+<%
+ }
+
+ String dispatcher = model.getDispatcherList(mapping);
+ if (dispatcher.length() > 0) {
+%>
+ * dispatcher="<%= dispatcher %>"
+<%
+ }
+ }
+
+ List<String[]> initParams = model.getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ for (int i = 0; i < initParams.size(); i++) {
+ String name = model.getInitParam(i, CreateFilterTemplateModel.NAME);
+ String value = model.getInitParam(i, CreateFilterTemplateModel.VALUE);
+ String description = model.getInitParam(i, CreateFilterTemplateModel.DESCRIPTION);
+%>
+ *
+ * @web.filter-init-param
+ * name="<%= name %>"
+ * value="<%= value %>"
+<%
+ if (description != null && description.length() > 0) {
+%>
+ * description="<%= description %>"
+<%
+ }
+ }
+ }
+ }
+%>
+ */
+ <%
+ if ("3.0".equals(model.getJavaEEVersion())) {
+%>
+@WebFilter
+<%
+ Map<String, Object> params = model.getClassAnnotationParams();
+ if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+ List<String> mappings = (List<String>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
+ if (mappings.size() == 1) {
+ String value = mappings.get(0);
+%>("<%= value %>")
+<%
+ } else {
+%>({
+<%
+ boolean needComma = false;
+ for (String mapping : mappings) {
+ if (needComma) {
+%>,
+<%
+ }
+%>"<%= mapping %>"
+<%
+ needComma = true;
+ }
+%> })
+<%
+ }
+ } else if (!params.isEmpty()) {
+%>(
+<%
+ Set<String> keys = params.keySet();
+ boolean needNewLine = keys.contains(CreateFilterTemplateModel.ATT_INIT_PARAMS) ||
+ (keys.contains(CreateFilterTemplateModel.ATT_URL_PATTERNS) &&
+ ((List<String>) params.get(CreateFilterTemplateModel.ATT_URL_PATTERNS)).size() > 1) ||
+ (keys.contains(CreateFilterTemplateModel.ATT_SERVLET_NAMES) &&
+ ((List<String>) params.get(CreateFilterTemplateModel.ATT_SERVLET_NAMES)).size() > 1);
+ boolean needComma = false;
+ for (String key : keys) {
+ if (needComma) {
+%>,
+<%
+ }
+
+ if (needNewLine) {
+%>
+
+<%
+ }
+
+ if (key.equals(CreateFilterTemplateModel.ATT_FILTER_NAME) || key.equals(CreateFilterTemplateModel.ATT_DESCRIPTION)) {
+ String value = (String) params.get(key);
+%><%= key %> = "<%= value %>"
+<%
+ } else if (key.equals(CreateFilterTemplateModel.ATT_URL_PATTERNS)) {
+%><%= key %> = {
+<%
+ List<String> mappings = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = mappings.size() > 1;
+ for (String mapping : mappings) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ }
+%>"<%= mapping %>"
+<%
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ } else {
+%>
+<%
+ }
+%>}
+<%
+ } else if (key.equals(CreateFilterTemplateModel.ATT_SERVLET_NAMES)) {
+%><%= key %> = {
+<%
+ List<String> servletNames = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = servletNames.size() > 1;
+ for (String servletName : servletNames) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ }
+%>"<%= servletName %>"
+<%
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ } else {
+%>
+<%
+ }
+%>}
+<%
+ } else if (key.equals(CreateFilterTemplateModel.ATT_INIT_PARAMS)) {
+%><%= key %> = {
+<%
+ List<String[]> initParams = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ for (String[] initParam : initParams) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ String name = initParam[CreateFilterTemplateModel.NAME];
+ String value = initParam[CreateFilterTemplateModel.VALUE];
+ String description = initParam[CreateFilterTemplateModel.DESCRIPTION];
+%>
+ @WebInitParam(name = "<%= name %>", value = "<%= value %>"
+<%
+ if (description != null && description.length() > 0) {
+%>, description = "<%= description %>"
+<%
+ }
+%>)
+<%
+ needComma2 = true;
+ }
+%>
+ }
+<%
+ } else if (key.equals(CreateFilterTemplateModel.ATT_DISPATCHER_TYPES)) {
+ List<String> dispatcherTypes = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = dispatcherTypes.size() > 1;
+ if (dispatcherTypes.size()>0){
+ %><%= key %> = {<%
+ }
+ for (String dispType : dispatcherTypes) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ }
+%><%= dispType %>
+<%
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ } else {
+%>
+<%
+ }
+ %>}
+ <%
+ }
+ needComma = true;
+ }
+%>)
+<%
+ }
+ }
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/listener.javajet b/plugins/org.eclipse.jst.j2ee.web/templates/listener.javajet
new file mode 100644
index 0000000..1cc8510
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/listener.javajet
@@ -0,0 +1,14 @@
+<%@ jet package="org.eclipse.jst.j2ee.internal.web.operations"
+ imports="java.util.* org.eclipse.jst.j2ee.internal.common.operations.*"
+ class="ListenerTemplate"
+%>
+<% CreateListenerTemplateModel model = (CreateListenerTemplateModel) argument; %>
+<%@ include file="_flags.template" %>
+<%@ include file="_package.template" %>
+<%@ include file="_imports.template" %>
+<%@ include file="listener_classHeader.template" %>
+<%@ include file="_class.template" %>
+<%@ include file="_constructors.template" %>
+<%@ include file="_methods.template" %>
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/listener_classHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/listener_classHeader.template
new file mode 100644
index 0000000..73ff422
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/listener_classHeader.template
@@ -0,0 +1,18 @@
+/**
+ * Application Lifecycle Listener implementation class <%= model.getClassName() %>
+ *
+<%
+ if (model.isAnnotated()) {
+%>
+ * @web.listener
+<%
+ }
+%>
+ */
+ <%
+ if ("3.0".equals(model.getJavaEEVersion())) {
+%>
+@WebListener
+<%
+}
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/servlet.javajet b/plugins/org.eclipse.jst.j2ee.web/templates/servlet.javajet
new file mode 100644
index 0000000..3f8f6f5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/servlet.javajet
@@ -0,0 +1,140 @@
+<%@ jet package="org.eclipse.jst.j2ee.internal.web.operations"
+ imports="java.util.* org.eclipse.jst.j2ee.internal.common.operations.*"
+ class="ServletTemplate"
+%>
+<% CreateServletTemplateModel model = (CreateServletTemplateModel) argument; %>
+<%@ include file="_flags.template" %>
+<%@ include file="_package.template" %>
+<%@ include file="_imports.template" %>
+<%@ include file="servlet_classHeader.template" %>
+<%@ include file="_class.template" %>
+<%
+ if (model.isGenericServletSuperclass()) {
+%>
+ private static final long serialVersionUID = 1L;
+<%
+ }
+%>
+<%@ include file="_constructors.template" %>
+<%@ include file="_methods.template" %>
+<% if (model.shouldGenInit()) { %>
+
+ /**
+ * @see Servlet#init(ServletConfig)
+ */
+ public void init(ServletConfig config) throws ServletException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDestroy()) { %>
+
+ /**
+ * @see Servlet#destroy()
+ */
+ public void destroy() {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenGetServletConfig()) { %>
+
+ /**
+ * @see Servlet#getServletConfig()
+ */
+ public ServletConfig getServletConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+<% } %>
+<% if (model.shouldGenGetServletInfo()) { %>
+
+ /**
+ * @see Servlet#getServletInfo()
+ */
+ public String getServletInfo() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+<% } %>
+<% if (model.shouldGenService() && !model.isHttpServletSuperclass()) { %>
+
+ /**
+ * @see Servlet#service(ServletRequest request, ServletResponse response)
+ */
+ public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenService() && model.isHttpServletSuperclass()) { %>
+
+ /**
+ * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoGet()) { %>
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoPost()) { %>
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoPut()) { %>
+
+ /**
+ * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)
+ */
+ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoDelete()) { %>
+
+ /**
+ * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)
+ */
+ protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoHead()) { %>
+
+ /**
+ * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)
+ */
+ protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoOptions()) { %>
+
+ /**
+ * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)
+ */
+ protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+<% if (model.shouldGenDoTrace()) { %>
+
+ /**
+ * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)
+ */
+ protected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+<% } %>
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template b/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template
new file mode 100644
index 0000000..936eab4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/templates/servlet_classHeader.template
@@ -0,0 +1,169 @@
+/**
+ * Servlet implementation class <%= model.getClassName() %>
+<%
+ if (model.isAnnotated()) {
+%>
+ *
+ * @web.servlet
+ * name="<%= model.getServletName() %>"
+ * display-name="<%= model.getServletName() %>"
+<%
+ if (model.getDescription() != null && model.getDescription().length() > 0) {
+%>
+ * description="<%= model.getDescription() %>"
+<%
+ }
+
+ List<String[]> mappings = model.getServletMappings();
+ if (mappings != null && mappings.size() > 0) {
+ for (int i = 0; i < mappings.size(); i++) {
+ String map = model.getServletMapping(i); %>
+ *
+ * @web.servlet-mapping
+ * url-pattern="<%= map %>"
+<%
+ }
+ }
+ List<String[]> initParams = model.getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ for (int i = 0; i < initParams.size(); i++) {
+ String name = model.getInitParam(i, CreateServletTemplateModel.NAME);
+ String value = model.getInitParam(i, CreateServletTemplateModel.VALUE);
+ String description = model.getInitParam(i, CreateServletTemplateModel.DESCRIPTION);
+%>
+ *
+ * @web.servlet-init-param
+ * name="<%= name %>"
+ * value="<%= value %>"
+<%
+ if (description != null && description.length() > 0) {
+%>
+ * description="<%= description %>"
+<%
+ }
+ }
+ }
+ }
+%>
+ */
+<%
+ if ("3.0".equals(model.getJavaEEVersion())) {
+%>
+@WebServlet
+<%
+ Map<String, Object> params = model.getClassAnnotationParams();
+ if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+ List<String[]> mappings = (List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
+ if (mappings.size() == 1) {
+ String value = mappings.get(0)[0];
+%>("<%= value %>")
+<%
+ } else {
+%>({
+<%
+ boolean needComma = false;
+ for (String[] mapping : mappings) {
+ if (needComma) {
+%>,
+<%
+ }
+%>"<%= mapping[0] %>"
+<%
+ needComma = true;
+ }
+%> })
+<%
+ }
+ } else if (!params.isEmpty()) {
+%>(
+<%
+ Set<String> keys = params.keySet();
+ boolean needNewLine = keys.contains(CreateServletTemplateModel.ATT_INIT_PARAMS) ||
+ (keys.contains(CreateServletTemplateModel.ATT_URL_PATTERNS) &&
+ ((List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS)).size() > 1);
+ boolean needComma = false;
+ for (String key : keys) {
+ if (needComma) {
+%>,
+<%
+ }
+
+ if (needNewLine) {
+%>
+
+<%
+ }
+
+ if (key.equals(CreateServletTemplateModel.ATT_NAME) || key.equals(CreateServletTemplateModel.ATT_DESCRIPTION)) {
+ String value = (String) params.get(key);
+%><%= key %> = "<%= value %>"
+<%
+ } else if (key.equals(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+%><%= key %> = {
+<%
+ List<String[]> mappings = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = mappings.size() > 1;
+ for (String[] mapping : mappings) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ }
+%>"<%= mapping[0] %>"
+<%
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+%>
+
+<%
+ } else {
+%>
+<%
+ }
+%>}
+<%
+ } else if (key.equals(CreateServletTemplateModel.ATT_INIT_PARAMS)) {
+%><%= key %> = {
+<%
+ List<String[]> initParams = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ for (String[] initParam : initParams) {
+ if (needComma2) {
+%>,
+<%
+ }
+
+ String name = initParam[CreateServletTemplateModel.NAME];
+ String value = initParam[CreateServletTemplateModel.VALUE];
+ String description = initParam[CreateServletTemplateModel.DESCRIPTION];
+%>
+ @WebInitParam(name = "<%= name %>", value = "<%= value %>"
+<%
+ if (description != null && description.length() > 0) {
+%>, description = "<%= description %>"
+<%
+ }
+%>)
+<%
+ needComma2 = true;
+ }
+%>
+ }
+<%
+ }
+
+ needComma = true;
+ }
+%>)
+<%
+ }
+ }
+%>
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java
new file mode 100644
index 0000000..e533818
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarHelper.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.validation;
+
+/**
+ * Insert the type's description here. Creation date: (10/2/2001 7:06:43 PM)
+ *
+ * @author: Administrator
+ */
+public class UIWarHelper extends WarHelper {
+
+ /**
+ * UIWarHelper constructor comment.
+ */
+ public UIWarHelper() {
+ super();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java
new file mode 100644
index 0000000..d66db9f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/UIWarValidator.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.validation;
+
+
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.model.internal.validation.WarValidator;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.WebUtilities;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+
+
+/**
+ * Insert the type's description here. Creation date: (10/2/2001 6:46:56 PM)
+ *
+ * @author: Administrator
+ */
+public class UIWarValidator extends WarValidator {
+
+ protected org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper warHelper;
+
+
+
+
+ /**
+ * UIWarValidator constructor comment.
+ */
+ public UIWarValidator() {
+ super();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (10/2/2001 8:01:45 PM)
+ *
+ * @return org.eclipse.wst.validation.internal.core.core.war.workbenchimpl.UIWarHelper
+ */
+ public org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper getWarHelper() {
+ return warHelper;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (10/2/2001 8:01:45 PM)
+ *
+ * @param newWarHelper
+ * org.eclipse.wst.validation.internal.core.core.war.workbenchimpl.UIWarHelper
+ */
+ public void setWarHelper(org.eclipse.jst.j2ee.internal.web.validation.UIWarHelper newWarHelper) {
+ warHelper = newWarHelper;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM)
+ */
+ @Override
+ public void validate() throws ValidationException {
+ // First remove all previous msg. for this project
+ // _reporter.removeAllMessages(this,null);
+ super.validate();
+ validateEARForContextRoot();
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM)
+ */
+ @Override
+ public IStatus validateInJob(IValidationContext inHelper, IReporter inReporter)
+ throws org.eclipse.wst.validation.internal.core.ValidationException {
+
+ setWarHelper((UIWarHelper) inHelper);
+ IProject proj = ((IWorkbenchContext) warHelper).getProject();
+ IVirtualComponent wbModule = ComponentCore.createComponent(proj);
+ if( wbModule != null && JavaEEProjectUtilities.isDynamicWebProject(proj)) {
+ IVirtualFile webFile = wbModule.getRootFolder().getFile(J2EEConstants.WEBAPP_DD_URI);
+ if( webFile.exists()) {
+ status = super.validateInJob(inHelper, inReporter);
+ validateWebInfLibs(wbModule);
+ }
+ }
+ return status;
+ }
+
+ /*
+ * For web projects, need to validate that the classpath component dependencies (both
+ * from this project's classpath and from the exported classpath entries of referenced
+ * utility projects) do not conflict.
+ */
+ private void validateWebInfLibs(final IVirtualComponent component) {
+
+ final Set webLibMappings = new HashSet();
+
+ // get the libs currently in the WEB-INF/lib folder
+ final IVirtualFolder folder = component.getRootFolder().getFolder(WebArtifactEdit.WEBLIB);
+ try {
+ IVirtualResource[] resources = folder.members();
+ for (int i = 0; i < resources.length; i++) {
+ if (resources[i] instanceof IVirtualFile) {
+ IResource[] underlyingResources = resources[i].getUnderlyingResources();
+ for (int j = 0; j < underlyingResources.length; j++) {
+ webLibMappings.add(underlyingResources[j].getName());
+ }
+ }
+ }
+ } catch (CoreException ce) {
+ // swallow
+ }
+ final Map archiveToPath = new HashMap();
+ final IVirtualReference[] webLibs = WebUtilities.getLibModules(component);
+ for (int i = 0; i < webLibs.length; i++) {
+ IVirtualComponent comp = webLibs[i].getReferencedComponent();
+ String name = null;
+ if (comp.isBinary()) {
+ java.io.File diskFile = (java.io.File)comp.getAdapter(java.io.File.class);
+ checkLibName(diskFile.getName(), null, webLibMappings, true);
+ } else {
+ String archiveName = webLibs[i].getArchiveName();
+ if (archiveName != null && archiveName.length() > 0) {
+ name = archiveName;
+ } else {
+ name = comp.getName() + IJ2EEModuleConstants.JAR_EXT;
+ }
+ checkLibName(name, comp.getProject(), webLibMappings, true);
+ if (comp instanceof J2EEModuleVirtualComponent) {
+ final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) comp).getJavaClasspathReferences();
+ for (int j = 0; j < cpRefs.length; j++) {
+ final IVirtualReference ref = cpRefs[j];
+ if (ref.getReferencedComponent() instanceof VirtualArchiveComponent) {
+ final String cpCompName = ref.getArchiveName();
+ checkLibName(cpCompName, comp.getProject(), webLibMappings, false);
+ IPath cpEntryPath= ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(ref);
+ if (cpEntryPath != null) {
+ IPath existingPath = (IPath) archiveToPath.get(cpCompName);
+ if (existingPath != null && !existingPath.equals(cpEntryPath)) {
+ _reporter.addMessage(this, new Message(getBaseName(), IMessage.HIGH_SEVERITY, ERROR_DUPLICATE_CLASSPATH_COMPONENT_URI, new String[]{cpCompName, comp.getProject().getName()}));
+ } else {
+ archiveToPath.put(cpCompName, cpEntryPath);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void checkLibName(final String name, final IProject project, final Set webLibNames, final boolean addName) {
+ if (webLibNames.contains(name)) {
+ if (project != null) {
+ //ignore this because of WAR import brings in the lib jars along with projects
+ //_reporter.addMessage(this, new Message(getBaseName(), IMessage.HIGH_SEVERITY, ERROR_DUPLICATE_WEB_INF_LIB_OTHER_PROJECT, new String[]{name, project.getName()}));
+ } else {
+ _reporter.addMessage(this, new Message(getBaseName(), IMessage.HIGH_SEVERITY, ERROR_DUPLICATE_WEB_INF_LIB, new String[]{name}));
+ }
+ } else if (addName) {
+ webLibNames.add(name);
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (10/2/2001 6:49:26 PM)
+ */
+ public void validateEARForContextRoot() {
+
+// IProject project = getWarHelper().getProject();
+// J2EEWebNatureRuntime webNature = J2EEWebNatureRuntime.getRuntime(project);
+// String contextRoot = webNature.getContextRoot();
+//
+// if (webNature == null)
+// return;
+//
+// EARNatureRuntime earRuntimeNature[] = webNature.getReferencingEARProjects();
+
+// for (int i = 0; i < earRuntimeNature.length; i++) {
+// // for each Ear Project that contains this web project update the context root.
+// // hold the model and validate the context root & release the model
+// org.eclipse.jst.j2ee.internal.earcreation.EAREditModel editModel = null;
+// try {
+// editModel = earRuntimeNature[i].getEarEditModelForRead(this);
+// if (editModel != null) {
+// Module module = null;
+// if ((module = earRuntimeNature[i].getModule(project)) != null) {
+// String webModcontextRoot = ((WebModule) module).getContextRoot();
+// if (webModcontextRoot != null && !webModcontextRoot.equals(contextRoot)) {
+// String[] params = new String[3];
+// params[0] = project.getName();
+// params[1] = ((WebModule) module).getContextRoot();
+// params[2] = earRuntimeNature[i].getProject().getName();
+// addError(WAR_CATEGORY, ERROR_EAR_INVALID_CONTEXT_ROOT, params);
+// }
+// }
+// }
+// } finally {
+// if (editModel != null) {
+// editModel.releaseAccess(this);
+// editModel = null;
+// }
+// }
+//
+// }
+
+ }
+
+ /**
+ * Method validateLibModules.
+ *
+ *
+ */
+
+ //TODO create validation for modules
+/* protected void validateLibModules(J2EEWebNatureRuntime webNature) {
+ if (webNature != null) {
+ ILibModule[] libModules = webNature.getLibModules();
+ IProject project = webNature.getProject();
+
+ for (int i = 0; i < libModules.length; i++) {
+ ILibModule lib = libModules[i];
+ IProject tProject = lib.getProject();
+ if (tProject != null) { // Project could be null if JavaProject is deleted, for
+ // example
+ if (!tProject.exists() || !tProject.isOpen()) {
+ addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_MISSING_WLP_PROJECT, new String[]{tProject.getName()}, webNature.getProject());
+ }
+ }
+
+ String jarName = lib.getJarName();
+ IPath jarPath = webNature.getLibraryFolder().getFullPath().append(jarName);
+ if (((Resource) project).findExistingResourceVariant(jarPath) != null)
+ addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_CONFLICTING_WLP_PROJECT, new String[]{jarName}, webNature.getProject());
+ }
+ }
+ }*/
+
+ @Override
+ public ISchedulingRule getSchedulingRule(IValidationContext helper) {
+
+ IProject project = ((IWorkbenchContext) helper).getProject();
+ IVirtualComponent comp = ComponentCore.createComponent( project );
+ IFile webDeploymentDescriptor = null;
+ if( comp != null ){
+ IVirtualFile vf = comp.getRootFolder().getFile(new Path(J2EEConstants.WEBAPP_DD_URI));
+ if( vf!= null ){
+ webDeploymentDescriptor = vf.getUnderlyingFile();
+ }
+ }
+ return webDeploymentDescriptor;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java
new file mode 100644
index 0000000..e3e8fbc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/war-validation/org/eclipse/jst/j2ee/internal/web/validation/WarHelper.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.validation;
+
+
+
+import java.util.Hashtable;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.validation.J2EEValidationHelper;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.model.internal.validation.WARMessageConstants;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
+
+
+
+public class WarHelper extends J2EEValidationHelper {
+ Hashtable warFileMap = new Hashtable();
+ ArtifactEdit edit = null;
+ WARFile warFile = null;
+ final static String HelperID = "org.eclipse.wst.validation.internal.core.war.workbenchimpl.WarHelper"; //$NON-NLS-1$
+
+
+ /**
+ * WarHelper constructor comment.
+ */
+
+ public WarHelper() {
+ super();
+
+ registerModel(WARMessageConstants.WAR_MODEL_NAME, "loadWarFile"); //$NON-NLS-1$
+ }
+
+ /**
+ * This method will be invoked indirectly from the WarValidator (via. the WorkbenchReporter). It
+ * will expect the coming object to be a EObject for the node who generated this message. Note:
+ * This methods may need to be implemented higher up in the class stack.
+ */
+ @Override
+ public int getLineNo(Object object) {
+
+
+ if (object instanceof Integer) { // Error discovered using the XML parser
+ return ((Integer) object).intValue();
+ }
+
+ return super.getLineNo(object);
+ }
+
+ /**
+ * Given a resource, return its non-eclipse-specific location. If this resource, or type of
+ * resource, isn't handled by this helper, return null.
+ */
+ @Override
+ public String getPortableName(IResource resource) {
+ if (!(resource instanceof IFile)) {
+ return null;
+ }
+
+ IPath resourcePath = resource.getFullPath();
+ if (resourcePath != null)
+ return resourcePath.toString();
+
+ return null;
+ }
+
+ /**
+ * Similar to the getFile() method, we know that we are talking about web.xml, but need a unique
+ * ID.
+ *
+ * @return java.lang.String
+ * @param object
+ * Object
+ */
+ @Override
+ public String getTargetObjectName(Object object) {
+
+ if( object != null && object instanceof WARFile ){
+ return J2EEConstants.WEBAPP_ID;
+ }
+ return null;
+// String ret = null;
+// if (object != null) {
+// IFile warFile = (IFile) warFileMap.get(getProject().toString());// validator framework
+// // will call getFile()
+// // first.
+// if (warFile != null) {
+// ret = (warFile.toString() + HelperID);
+// }
+// }
+// return ret;
+ }
+
+
+ public EObject loadWarFile() {
+ IVirtualComponent comp = ComponentCore.createComponent(getProject());
+ edit = ComponentUtilities.getArtifactEditForRead(comp);
+
+ if (edit != null)
+ {
+ try {
+ warFile = (WARFile)((WebArtifactEdit) edit).asArchive(false, true, true);
+ return warFile;
+ } catch (OpenFailureException e1) {
+ WebPlugin.logError(e1);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void cleanup(WorkbenchReporter reporter) {
+ if (edit != null) {
+ edit.dispose();
+ edit = null;
+ }
+ if(warFile != null){
+ warFile.close();
+ warFile = null;
+ }
+ super.cleanup(reporter);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java
new file mode 100644
index 0000000..4dc14e2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/ModuleAdapter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Feb 8, 2005
+ */
+package org.eclipse.jst.j2ee.internal.web.deployables;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
+
+/**
+ * @author blancett
+ */
+public class ModuleAdapter extends AdapterImpl {
+
+ J2EEFlexProjDeployable delegate;
+
+ public void setModuleDelegate(J2EEFlexProjDeployable moduleDelegate) {
+ delegate = moduleDelegate;
+ }
+
+ public J2EEFlexProjDeployable getDelegate() {
+ return delegate;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java
new file mode 100644
index 0000000..1646bc1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebDeployableArtifactUtil.java
@@ -0,0 +1,367 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.deployables;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURL;
+import org.eclipse.jst.j2ee.internal.web.jfaces.extension.FileURLExtensionReader;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.webapplication.JSPType;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.ServletMapping;
+import org.eclipse.jst.j2ee.webapplication.ServletType;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebType;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.util.WebResource;
+
+/**
+ * @version 1.0
+ * @author
+ */
+public class WebDeployableArtifactUtil {
+
+ private final static String GENERIC_SERVLET_CLASS_TYPE = "javax.servlet.GenericServlet"; //$NON-NLS-1$
+ private final static String CACTUS_SERVLET_CLASS_TYPE = "org.apache.cactus.server.ServletTestRedirector"; //$NON-NLS-1$
+
+ public WebDeployableArtifactUtil() {
+ super();
+ }
+
+ public static IModuleArtifact getModuleObject(Object obj) {
+ IResource resource = null;
+ if (obj instanceof IResource)
+ resource = (IResource) obj;
+ if (obj instanceof IModuleArtifact)
+ resource = ((IModuleArtifact) obj).getModule().getProject();
+ else if (obj instanceof IAdaptable)
+ resource = (IResource) ((IAdaptable) obj).getAdapter(IResource.class);
+ else if (obj instanceof EObject) {
+ resource = ProjectUtilities.getProject((EObject) obj);
+ if (obj instanceof Servlet) {
+ Servlet servlet = ((Servlet) obj);
+ Resource servResource = servlet.eResource();
+ IVirtualResource[] resources = null;
+ try {
+ IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(servResource);
+ resources = ComponentCore.createResources(eclipeServResoruce);
+ } catch (Exception e) {
+ WebPlugin.logError(e);
+ }
+ IVirtualComponent component = null;
+ if (resources != null && resources[0] != null)
+ component = resources[0].getComponent();
+ String mapping = null;
+ java.util.List mappings = ((Servlet) obj).getMappings();
+ if (mappings != null && !mappings.isEmpty()) {
+ ServletMapping map = (ServletMapping) mappings.get(0);
+ mapping = map.getUrlPattern();
+ }
+ if (mapping != null) {
+ return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
+ }
+ WebType webType = ((Servlet) obj).getWebType();
+ if (webType == null) {
+ return null;
+ } else if (webType.isJspType()) {
+ if (component != null) {
+ IPath jspFilePath = new Path(((JSPType) webType).getJspFile());
+ resource = component.getRootFolder().getUnderlyingFolder().getFile(jspFilePath);
+ }
+ } else if (webType.isServletType()) {
+ return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + ((ServletType) webType).getClassName())); //$NON-NLS-1$
+ }
+ }
+ }
+ if (resource == null)
+ return null;
+
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ if (hasInterestedComponents(project))
+ return new WebResource(getModule(project, null), project.getProjectRelativePath());
+ }
+
+ if (!hasInterestedComponents(resource.getProject()))
+ return null;
+ if (isCactusJunitTest(resource))
+ return null;
+
+ IPath resourcePath = resource.getFullPath();
+ IVirtualResource[] resources = ComponentCore.createResources(resource);
+ IVirtualComponent component = null;
+ if (resources.length <= 0 || resources[0] == null )
+ return null;
+ component = resources[0].getComponent();
+ String className = getServletClassName(resource);
+ if (className != null && component != null) {
+ String mapping = getServletMapping(resource, true, className, component.getName());
+ if (mapping != null) {
+ return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
+ }
+ // if there is no servlet mapping, provide direct access to the servlet
+ // through the fully qualified class name
+ return new WebResource(getModule(resource.getProject(), component), new Path("servlet/" + className)); //$NON-NLS-1$
+
+ }
+ if (className == null && component != null) {
+ WebArtifactEdit webEdit = null;
+ try {
+ webEdit = WebArtifactEdit.getWebArtifactEditForRead(component);
+ List servlets = webEdit.getWebApp().getServlets();
+ for (int i=0; i<servlets.size(); i++) {
+ Servlet servlet = (Servlet) servlets.get(i);
+ WebType type = servlet.getWebType();
+ if (type.isJspType()) {
+ JSPType jsp = (JSPType)type;
+ IPath rootPath = component.getRootFolder().getProjectRelativePath();
+ IPath jspPath = resource.getProjectRelativePath().removeFirstSegments(rootPath.segmentCount());
+ if (jsp.getJspFile().equals(jspPath.makeAbsolute().toString())) {
+ List mappings = servlet.getMappings();
+ String mapping = null;
+ if (mappings != null && !mappings.isEmpty()) {
+ ServletMapping map = (ServletMapping) mappings.get(0);
+ mapping = map.getUrlPattern();
+ if (mapping != null)
+ return new WebResource(getModule(resource.getProject(), component), new Path(mapping));
+ }
+ }
+ }
+ }
+ } finally {
+ if (webEdit != null)
+ webEdit.dispose();
+ }
+ }
+ resourcePath = resources[0].getRuntimePath();
+
+ // Extension read to get the correct URL for Java Server Faces file if
+ // the jsp is of type jsfaces.
+ FileURL jspURL = FileURLExtensionReader.getInstance().getFilesURL();
+ if (jspURL != null) {
+ IPath correctJSPPath = jspURL.getFileURL(resource, resourcePath);
+ if (correctJSPPath != null && correctJSPPath.toString().length() > 0)
+ return new WebResource(getModule(resource.getProject(), component), correctJSPPath);
+ }
+ // return Web resource type
+
+ return new WebResource(getModule(resource.getProject(), component), resourcePath);
+ }
+
+ protected static IModule getModule(IProject project, IVirtualComponent component) {
+ String componentName = null;
+ if (component != null)
+ componentName = component.getName();
+
+ // check for jst.web modules first
+ IModule[] modules = ServerUtil.getModules(IJ2EEFacetConstants.DYNAMIC_WEB);
+ for (IModule module : modules) {
+ if ((project == null || project.equals(module.getProject()))
+ && (componentName == null || componentName.equals(module.getName())))
+ return module;
+ }
+
+ // otherwise fall back to other types of web modules on the project
+ if (project != null) {
+ modules = ServerUtil.getModules(project);
+ for (IModule module : modules) {
+ if (componentName == null || componentName.equals(module.getName()))
+ return module;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated - see getModule() for better logic for finding a project's IModule
+ */
+ protected static IModule getModuleProject(IProject project, Iterator iterator) {
+ IModule deployable = null;
+ while (iterator.hasNext()) {
+ Object next = iterator.next();
+ if (next instanceof IModule) {
+ deployable = (IModule) next;
+ if (deployable.getProject().equals(project))
+ return deployable;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * Very temporary api - TODO - rip this out by 1.0
+ */
+ private static boolean isCactusJunitTest(IResource resource) {
+ return getClassNameForType(resource, CACTUS_SERVLET_CLASS_TYPE) != null;
+ }
+
+
+
+ private static IType[] getTypes(IJavaElement element) {
+ try {
+ if (element.getElementType() != IJavaElement.COMPILATION_UNIT)
+ return null;
+
+ return ((ICompilationUnit) element).getAllTypes();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static String getServletClassName(IResource resource) {
+ return getClassNameForType(resource, GENERIC_SERVLET_CLASS_TYPE);
+ }
+
+ public static String getClassNameForType(IResource resource, String superType) {
+ if (resource == null)
+ return null;
+
+ try {
+ IProject project = resource.getProject();
+ IPath path = resource.getFullPath();
+ if (!project.hasNature(JavaCore.NATURE_ID) || path == null)
+ return null;
+
+ IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
+ if (!javaProject.isOpen())
+ javaProject.open(new NullProgressMonitor());
+
+ // output location may not be on classpath
+ IPath outputPath = javaProject.getOutputLocation();
+ if (outputPath != null && "class".equals(path.getFileExtension()) && outputPath.isPrefixOf(path)) { //$NON-NLS-1$
+ int count = outputPath.segmentCount();
+ path = path.removeFirstSegments(count);
+ }
+
+ // remove initial part of classpath
+ IClasspathEntry[] classPathEntry = javaProject.getResolvedClasspath(true);
+ if (classPathEntry != null) {
+ int size = classPathEntry.length;
+ for (int i = 0; i < size; i++) {
+ IPath classPath = classPathEntry[i].getPath();
+ if (classPath.isPrefixOf(path)) {
+ int count = classPath.segmentCount();
+ path = path.removeFirstSegments(count);
+ i += size;
+ }
+ }
+ }
+
+ // get java element
+ IJavaElement javaElement = javaProject.findElement(path);
+
+ IType[] types = getTypes(javaElement);
+ if (types != null) {
+ int size2 = types.length;
+ for (int i = 0; i < size2; i++) {
+ if (hasSuperclass(types[i], superType))
+ return types[i].getFullyQualifiedName();
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static boolean hasSuperclass(IType type, String superClassName) {
+ try {
+ ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null);
+ IType[] superClasses = hierarchy.getAllSuperclasses(type);
+
+ int size = superClasses.length;
+ for (int i = 0; i < size; i++) {
+ if (superClassName.equals(superClasses[i].getFullyQualifiedName()))
+ return true;
+ }
+ return false;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ public static String getServletMapping(IResource resource, boolean isServlet, String typeName, String componentName) {
+ if (typeName == null || typeName.equals("")) //$NON-NLS-1$
+ return null;
+
+ IProject project = resource.getProject();
+ WebArtifactEdit edit = null;
+ WebApp webApp = null;
+ try {
+ edit = WebArtifactEdit.getWebArtifactEditForRead(project);
+ edit.getDeploymentDescriptorRoot();
+ webApp = edit.getWebApp();
+ if (webApp == null)
+ return null;
+ Iterator iterator = webApp.getServlets().iterator();
+ while (iterator.hasNext()) {
+ Servlet servlet = (Servlet) iterator.next();
+ boolean valid = false;
+
+ WebType webType = servlet.getWebType();
+ if (webType.isServletType() && isServlet) {
+ ServletType type = (ServletType) webType;
+ if (typeName.equals(type.getClassName()))
+ valid = true;
+ } else if (webType.isJspType() && !isServlet) {
+ JSPType type = (JSPType) webType;
+ if (typeName.equals(type.getJspFile()))
+ valid = true;
+ }
+ if (valid) {
+ java.util.List mappings = servlet.getMappings();
+ if (mappings != null && !mappings.isEmpty()) {
+ ServletMapping map = (ServletMapping) mappings.get(0);
+ return map.getUrlPattern();
+ }
+ }
+ }
+ return null;
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ protected static boolean hasInterestedComponents(IProject project) {
+ return JavaEEProjectUtilities.isDynamicWebProject(project);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java
new file mode 100644
index 0000000..80d9381
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/deployables/WebModuleArtifact.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Feb 21, 2005
+ */
+package org.eclipse.jst.j2ee.internal.web.deployables;
+
+/**
+ * Key Class for adapter manager
+ */
+public class WebModuleArtifact {
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java
new file mode 100644
index 0000000..325dcb7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURL.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Jun 13, 2004
+ */
+package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+
+/**
+ * @author vijayb
+ */
+public interface FileURL {
+
+ /**
+ * @return The existingURL if no suitable extender is found, else the
+ * path corresponding to the passed in resource.
+ */
+ public IPath getFileURL(IResource resource, IPath existingURL);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java
new file mode 100644
index 0000000..05575af
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtension.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Jun 13, 2004
+ */
+package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+/**
+ * @author vijayb
+ */
+public class FileURLExtension {
+ private String id = null;
+ private FileURL instance;
+ private boolean errorCondition = false;
+ private IConfigurationElement element;
+ public static final String FILE_URL_EXTENSION = "fileURL"; //$NON-NLS-1$
+ public static final String RUN = "run"; //$NON-NLS-1$
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+
+
+ /**
+ *
+ */
+ public FileURLExtension() {
+ super();
+ }
+
+ public FileURL getInstance() {
+ try {
+ if (this.instance == null && !this.errorCondition)
+ this.instance = (FileURL) this.element.createExecutableExtension("run"); //$NON-NLS-1$
+ } catch (Throwable e) {
+ WebPlugin.logError(e);
+ this.errorCondition = true;
+ }
+ return this.instance;
+ }
+
+ public FileURLExtension(IConfigurationElement element) {
+ if (!FILE_URL_EXTENSION.equals(element.getName()))
+ throw new IllegalArgumentException("Extensions must be of the type \"" + FILE_URL_EXTENSION + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
+ this.element = element;
+ init();
+ }
+
+ private void init() {
+ this.id = this.element.getAttribute(ATT_ID);
+
+ }
+
+ /**
+ * @return Returns the id.
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * @param id
+ * The id to set.
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java
new file mode 100644
index 0000000..ac29b3b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/jfaces/extension/FileURLExtensionReader.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Jun 13, 2004
+ */
+package org.eclipse.jst.j2ee.internal.web.jfaces.extension;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.common.core.util.RegistryReader;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+/**
+ * @author vijayb
+ *
+ * This class loads all the extensions that define the correct URL string for the Java Server Faces
+ * file
+ *
+ *
+ */
+public class FileURLExtensionReader extends RegistryReader {
+ static FileURLExtensionReader instance = null;
+ protected List fileURLExtensions;
+
+ /**
+ * @param registry
+ * @param pluginID
+ * @param extensionPoint
+ */
+ public FileURLExtensionReader() {
+ super(WebPlugin.PLUGIN_ID, "fileURL"); //$NON-NLS-1$
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ @Override
+ public boolean readElement(IConfigurationElement element) {
+ if (FileURLExtension.FILE_URL_EXTENSION.equals(element.getName())) {
+ addExtension(element);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Sets the extension point.
+ *
+ * @param extensions
+ * The extensions to set
+ */
+ protected void addExtension(IConfigurationElement newExtension) {
+ getFileURLExtensions().add(new FileURLExtension(newExtension));
+ }
+
+ /**
+ * Sets the extension point.
+ *
+ * @param extensions
+ * The extensions to set
+ */
+ protected void addExtensionPoint(FileURLExtensionReader newExtension) {
+ if (this.fileURLExtensions == null)
+ this.fileURLExtensions = new ArrayList();
+ this.fileURLExtensions.add(newExtension);
+ }
+
+ /**
+ * @return the appropriate handler for the project based on priorities of those which are
+ * available and enabled
+ */
+ public FileURL getFilesURL() {
+ FileURLExtension fileURLExt;
+ ArrayList<FileURL> fileUrlList = new ArrayList<FileURL>();
+ FileURL currentURL = null;
+ for (Iterator fileURLExtItr = getFileURLExtensions().iterator(); fileURLExtItr.hasNext();) {
+ fileURLExt = (FileURLExtension) fileURLExtItr.next();
+ currentURL = fileURLExt.getInstance();
+ if (currentURL != null)
+ fileUrlList.add(currentURL);
+ }
+ if (fileUrlList.size() == 1)
+ return fileUrlList.get(0);
+ return new FileURLWrapper(fileUrlList);
+ }
+
+
+
+ private class FileURLWrapper implements FileURL {
+ ArrayList<FileURL> myUrlList = new ArrayList<FileURL>();
+ public FileURLWrapper(ArrayList<FileURL> newUrlList)
+ {
+ myUrlList = newUrlList;
+ }
+ public IPath getFileURL(IResource resource, IPath existingURL) {
+ IPath retVal = existingURL;
+ for (FileURL fileUrl: myUrlList){
+ retVal = fileUrl.getFileURL(resource, existingURL);
+ if (retVal != existingURL && retVal != null)
+ {
+ return retVal;
+ }
+ }
+ return retVal;
+ }
+ }
+
+
+ /**
+ * Gets the instance.
+ *
+ * @return Returns a FileURLExtensionReader
+ */
+ public static FileURLExtensionReader getInstance() {
+ if (instance == null) {
+ instance = new FileURLExtensionReader();
+ instance.readRegistry();
+ }
+ return instance;
+ }
+
+ /**
+ * @return Returns the handlerExtensions.
+ */
+ protected List getFileURLExtensions() {
+ if (this.fileURLExtensions == null)
+ this.fileURLExtensions = new ArrayList();
+ return this.fileURLExtensions;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java
new file mode 100644
index 0000000..6f1cce4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AbstractSupertypesValidator.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class AbstractSupertypesValidator {
+
+ private static ITypeHierarchy typeHierarchyCache = null;
+
+ protected static String getSuperclass(IDataModel dataModel) {
+ return dataModel.getStringProperty(SUPERCLASS);
+ }
+
+ protected static List getInterfaces(IDataModel dataModel) {
+ return (List) dataModel.getProperty(INTERFACES);
+ }
+
+ protected static IJavaProject getJavaProject(IDataModel dataModel) {
+ return JavaCore.create((IProject) dataModel.getProperty(PROJECT));
+ }
+
+ protected static boolean hasSuperclass(IDataModel dataModel,
+ String typeName, String superTypeName) {
+ try {
+ IType type = getJavaProject(dataModel).findType(typeName);
+ if (type != null) {
+ ITypeHierarchy typeHierarchy = getTypeHierarchy(type);
+ for (IType superType : typeHierarchy.getAllSuperclasses(type)) {
+ if (superTypeName.equals(superType.getFullyQualifiedName()))
+ return true;
+ }
+ }
+ } catch (JavaModelException e) {
+ WebPlugin.log(e);
+ }
+
+ return false;
+ }
+
+ protected static boolean hasSuperInterface(IDataModel dataModel,
+ String typeName, String superTypeName) {
+ try {
+ IType type = getJavaProject(dataModel).findType(typeName);
+ if (type != null) {
+ ITypeHierarchy typeHierarchy = getTypeHierarchy(type);
+ for (IType superType : typeHierarchy.getAllSuperInterfaces(type)) {
+ if (superTypeName.equals(superType.getFullyQualifiedName()))
+ return true;
+ }
+ }
+ } catch (JavaModelException e) {
+ WebPlugin.log(e);
+ }
+
+ return false;
+ }
+
+ private static ITypeHierarchy getTypeHierarchy(IType type) throws JavaModelException {
+ if (typeHierarchyCache == null || !type.equals(typeHierarchyCache.getType())) {
+ typeHierarchyCache = type.newTypeHierarchy(null);
+ }
+ return typeHierarchyCache;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java
new file mode 100644
index 0000000..331dae4
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddFilterOperation.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.Description;
+import org.eclipse.jst.j2ee.common.ParamValue;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
+import org.eclipse.jst.j2ee.webapplication.DispatcherType;
+import org.eclipse.jst.j2ee.webapplication.Filter;
+import org.eclipse.jst.j2ee.webapplication.FilterMapping;
+import org.eclipse.jst.j2ee.webapplication.InitParam;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.javaee.core.DisplayName;
+import org.eclipse.jst.javaee.core.JavaeeFactory;
+import org.eclipse.jst.javaee.core.UrlPatternType;
+import org.eclipse.jst.javaee.web.WebFactory;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * This class, AddFilter Operation is a IDataModelOperation following the
+ * IDataModel wizard and operation framework.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * This operation subclasses the ArtifactEditProviderOperation so the changes
+ * made to the deployment descriptor models are saved to the artifact edit
+ * model.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * It is the operation which should be used when adding a new filter to a web
+ * app. This uses the NewFilterClassDataModelProvider to retrieve properties set by the
+ * user in order to create the custom filter.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider
+ *
+ * This operation will add the metadata necessary into the web deployment descriptor.
+ * To actually create the java class for the filter, the operation uses the NewFilterClassOperation.
+ * The NewFilterClassOperation shares the same data model provider.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassOperation
+ *
+ * Clients may subclass this operation to provide their own behavior on filter
+ * creation. The execute method can be extended to do so. Also,
+ * generateFilterMetaData and creteFilterClass are exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class AddFilterOperation extends AddWebClassOperation {
+
+ /**
+ * This is the constructor which should be used when creating the operation.
+ * It will not accept null parameter. It will not return null.
+ *
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ *
+ * @param dataModel
+ * @return AddFilterOperation
+ */
+ public AddFilterOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ @Override
+ protected NewJavaEEArtifactClassOperation getNewClassOperation() {
+ return new NewFilterClassOperation(getDataModel());
+ }
+
+ /**
+ * Subclasses may extend this method to add their own generation steps for
+ * the creation of the metadata for the web deployment descriptor. This
+ * implementation uses the J2EE models to create the Filter model instance,
+ * any init params specified, and any filter mappings. It then adds these
+ * to the web application model. This will then be written out to the
+ * deployment descriptor file. This method does not accept null parameters.
+ *
+ * @see Filter
+ * @see AddFilterOperation#createFilter(String)
+ * @see AddFilterOperation#setUpInitParams(List, Filter)
+ * @see AddFilterOperation#setUpURLMappings(List, Filter)
+ *
+ * @param aModel
+ * @param qualifiedClassName
+ */
+ @Override
+ protected void generateMetaData(IDataModel aModel, String qualifiedClassName) {
+ // Set up the filter modelled object
+ Object filter = createFilter(qualifiedClassName);
+
+ // Set up the InitParams if any
+ List initParamList =
+ (List) aModel.getProperty(INIT_PARAM);
+ if (initParamList != null)
+ setUpInitParams(initParamList, filter);
+
+ // Set up the filter mappings if any
+ List filterMappingsList =
+ (List) aModel.getProperty(FILTER_MAPPINGS);
+
+ if (filterMappingsList != null && !filterMappingsList.isEmpty())
+ setUpMappings(filterMappingsList, filter);
+ }
+
+ /**
+ * This method is intended for private use only. This method is used to
+ * create the filter modeled object, to set any parameters specified in
+ * the data model, and then to add the filter instance to the web
+ * application model. This method does not accept null parameters. It will
+ * not return null.
+ *
+ * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
+ * String)
+ * @see WebapplicationFactory#createFilter()
+ * @see Filter
+ *
+ * @param qualifiedClassName
+ * @return Filter instance
+ */
+ /**
+ * @param qualifiedClassName
+ * @return
+ */
+ private Object createFilter(String qualifiedClassName) {
+ // Get values from data model
+ String displayName =
+ model.getStringProperty(DISPLAY_NAME);
+ String description =
+ model.getStringProperty(DESCRIPTION);
+
+ // Create the filter instance and set up the parameters from data model
+ Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
+ filter.setName(displayName);
+ filter.setDisplayName(displayName);
+ filter.setDescription(description);
+ filter.setFilterClassName(qualifiedClassName);
+
+ // Add the filter to the web application model
+ WebApp webApp = (WebApp) modelObject;
+ webApp.getFilters().add(filter);
+ return filter;
+ } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
+ org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
+ org.eclipse.jst.javaee.web.Filter filter = WebFactory.eINSTANCE.createFilter();
+ DisplayName displayNameObj = JavaeeFactory.eINSTANCE.createDisplayName();
+ displayNameObj.setValue(displayName);
+ filter.getDisplayNames().add(displayNameObj);
+ filter.setFilterName(displayName);
+ filter.setFilterClass(qualifiedClassName);
+ webApp.getFilters().add(filter);
+ // Should be return Filter's instance
+ return filter;
+ }
+ // Return the filter instance
+ return null;
+ }
+
+ /**
+ * This method is intended for internal use only. This is used to create any
+ * init params for the new filter metadata. It will not accept null
+ * parameters. The init params are set on the filter modeled object.
+ *
+ * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
+ * String)
+ * @see WebapplicationFactory#createInitParam()
+ *
+ * @param initParamList
+ * @param filter
+ */
+ private void setUpInitParams(List initParamList, Object filterObj) {
+ // Get the web app instance from the data model
+ Object modelObject = provider.getModelObject();
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ WebApp webApp = (WebApp) modelObject;
+ Filter filter = (Filter) filterObj;
+
+ // If J2EE 1.4, add the param value and description info instances
+ // to the filter init params
+ if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create 1.4 common param value
+ ParamValue param = CommonFactory.eINSTANCE.createParamValue();
+ param.setName(stringArray[0]);
+ param.setValue(stringArray[1]);
+ // Create 1.4 common descripton value
+ Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
+ descriptionObj.setValue(stringArray[2]);
+ // Set the description on the param
+ param.getDescriptions().add(descriptionObj);
+ param.setDescription(stringArray[2]);
+ // Set the param to the filter model list of init params
+ filter.getInitParamValues().add(param);
+ }
+ }
+ // If J2EE 1.2 or 1.3, use the filter specific init param instances
+ else {
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create the web init param
+ InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam();
+ // Set the param name
+ ip.setParamName(stringArray[0]);
+ // Set the param value
+ ip.setParamValue(stringArray[1]);
+ // Set the param description
+ ip.setDescription(stringArray[2]);
+ // Add the init param to the filter model list of params
+ filter.getInitParams().add(ip);
+ }
+ }
+ } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
+ org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj;
+
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create 1.4 common param value
+ org.eclipse.jst.javaee.core.ParamValue param =
+ JavaeeFactory.eINSTANCE.createParamValue();
+ param.setParamName(stringArray[0]);
+ param.setParamValue(stringArray[1]);
+
+ org.eclipse.jst.javaee.core.Description descriptionObj =
+ JavaeeFactory.eINSTANCE.createDescription();
+ descriptionObj.setValue(stringArray[2]);
+ // Set the description on the param
+ param.getDescriptions().add(descriptionObj);
+ // Add the param to the filter model list of init params
+ filter.getInitParams().add(param);
+ }
+ }
+ }
+
+ /**
+ * This method is intended for internal use only. This method is used to
+ * create the filter mapping modelled objects so the metadata for the
+ * filter mappings is store in the web deployment descriptor. This method
+ * will not accept null parameters. The filter mappings are added to the
+ * web application modeled object.
+ *
+ * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
+ * String)
+ * @see WebapplicationFactory#createFilterMapping()
+ *
+ * @param urlMappingList
+ * @param filter
+ */
+ private void setUpMappings(List filterMappingsList, Object filterObj) {
+ // Get the web app modelled object from the data model
+ // WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
+ Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
+
+ // Create the filter mappings if any
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ WebApp webApp = (WebApp) modelObject;
+ Filter filter = (Filter) filterObj;
+ if (filterMappingsList != null)
+ for (int iM = 0; iM < filterMappingsList.size(); iM++) {
+ IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(iM);
+ // Create the filter mapping instance from the web factory
+ FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
+ // Set the filter
+ mapping.setFilter(filter);
+ if (filterMapping.isUrlPatternType()) {
+ // Set the URL pattern to map the filter to
+ mapping.setUrlPattern(filterMapping.getName());
+ } else {
+ // Set the Servlet Name to map the filter to
+ Servlet servlet = webApp.getServletNamed(filterMapping.getName());
+ mapping.setServlet(servlet);
+ }
+ //Set dispatcher options for the filter mapping if any.
+ int dispatchers = filterMapping.getDispatchers();
+ EList dispatcherTypes = mapping.getDispatcherType();
+ if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
+ dispatcherTypes.add(DispatcherType.REQUEST_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
+ dispatcherTypes.add(DispatcherType.FORWARD_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
+ dispatcherTypes.add(DispatcherType.INCLUDE_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
+ dispatcherTypes.add(DispatcherType.ERROR_LITERAL);
+ }
+ // Add the filter mapping to the web application modelled list
+ webApp.getFilterMappings().add(mapping);
+ }
+ } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon) {
+ org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
+ org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) filterObj;
+
+ // Create the filter mapping instance from the web factory
+ org.eclipse.jst.javaee.web.FilterMapping mapping = null;
+ // Create the filter mappings if any
+ if (filterMappingsList != null) {
+ for (int i = 0; i < filterMappingsList.size(); i++) {
+ mapping = WebFactory.eINSTANCE.createFilterMapping();
+ mapping.setFilterName(filter.getFilterName());
+ IFilterMappingItem filterMapping = (IFilterMappingItem) filterMappingsList.get(i);
+ if (filterMapping.getMappingType() == IFilterMappingItem.URL_PATTERN) {
+ // Set the URL pattern to map the filter to
+ UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
+ url.setValue(filterMapping.getName());
+ mapping.getUrlPatterns().add(url);
+ } else {
+ mapping.getServletNames().add(filterMapping.getName());
+ }
+ //Set dispatcher options for the filter mapping if any.
+ int dispatchers = filterMapping.getDispatchers();
+ if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
+ mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.REQUEST_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
+ mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.FORWARD_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
+ mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.INCLUDE_LITERAL);
+ }
+ if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
+ mapping.getDispatchers().add(org.eclipse.jst.javaee.web.DispatcherType.ERROR_LITERAL);
+ }
+ // Add the filter mapping to the web application model list
+ webApp.getFilterMappings().add(mapping);
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java
new file mode 100644
index 0000000..98afadf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddListenerOperation.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.Listener;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.javaee.core.JavaeeFactory;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * This class, AddListenerOperation is a IDataModelOperation following the IDataModel wizard and
+ * operation framework.
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * This operation subclasses the ArtifactEditProviderOperation so the changes made to the deployment descriptor
+ * models are saved to the artifact edit model.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * It is the operation which should be used when adding a new application lifecycle listener to
+ * a web app, whether that be an annotated listener or a non annotated listener. This uses the
+ * NewListenerClassDataModelProvider to retrieve properties set by the user in order to create the custom
+ * listener class.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider
+ *
+ * In the non annotated case, this operation will add the metadata necessary into the web deployment
+ * descriptor. In the annotated case, it will not, it will leave this up to the parsing of the
+ * annotations to build the deployment descriptor artifacts. To actually create the java class for
+ * the listener, the operation uses the NewListenerClassOperation. The NewListenerClassOperation
+ * shares the same data model provider.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassOperation
+ *
+ * Clients may subclass this operation to provide their own behavior on listener creation. The execute
+ * method can be extended to do so. Also, generateListenerMetaData and creteListenerClass are exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class AddListenerOperation extends AddWebClassOperation {
+
+ /**
+ * This is the constructor which should be used when creating the operation.
+ * It will not accept null parameter. It will not return null.
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ *
+ * @param dataModel
+ * @return AddListenerOperation
+ */
+ public AddListenerOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ @Override
+ protected NewJavaEEArtifactClassOperation getNewClassOperation() {
+ return new NewListenerClassOperation(getDataModel());
+ }
+
+ /**
+ * Subclasses may extend this method to add their own generation steps for the creation of the
+ * metadata for the web deployment descriptor. This implementation uses the J2EE models to create
+ * the Listener model instance. It then adds these to the web application model. This will then be
+ * written out to the deployment descriptor file. This method does not accept null parameters.
+ * @see Listener
+ * @see AddListenerOperation#createListener(String)
+ *
+ * @param aModel
+ * @param qualifiedClassName
+ */
+ @Override
+ protected void generateMetaData(IDataModel aModel, String qualifiedClassName) {
+ // Set up the listener modeled object
+ createListener(qualifiedClassName);
+ }
+
+ /**
+ * This method is intended for private use only. This method is used to create the listener
+ * modeled object, to set any parameters specified in the data model, and then to add the
+ * listener instance to the web application model. This method does not accept null parameters.
+ * It will not return null.
+ * @see AddListenerOperation#generateListenerMetaData(IDataModel, String)
+ * @see CommonFactory#createListener()
+ * @see Listener
+ *
+ * @param qualifiedClassName
+ * @return Listener instance
+ */
+ private Object createListener(String qualifiedClassName) {
+ Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp ){
+ // Create the listener instance and set up the parameters from data model
+ Listener listener = CommonFactory.eINSTANCE.createListener();
+ listener.setListenerClassName(qualifiedClassName);
+
+ // Add the listener to the web application model
+ WebApp webApp = (WebApp) modelObject;
+ webApp.getListeners().add(listener);
+ return listener;
+ } else if (modelObject instanceof org.eclipse.jst.javaee.web.IWebCommon ){
+ // Create the listener instance and set up the parameters from data model
+ org.eclipse.jst.javaee.core.Listener listener = JavaeeFactory.eINSTANCE.createListener();
+ listener.setListenerClass(qualifiedClassName);
+
+ // Add the listener to the web application model
+ org.eclipse.jst.javaee.web.IWebCommon webApp = (org.eclipse.jst.javaee.web.IWebCommon) modelObject;
+ webApp.getListeners().add(listener);
+ return listener;
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java
new file mode 100644
index 0000000..d41b140
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddServletOperation.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kaloyan Raev, kaloyan.raev@sap.com
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+
+import java.util.List;
+
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.Description;
+import org.eclipse.jst.j2ee.common.ParamValue;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
+import org.eclipse.jst.j2ee.webapplication.InitParam;
+import org.eclipse.jst.j2ee.webapplication.JSPType;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.ServletMapping;
+import org.eclipse.jst.j2ee.webapplication.ServletType;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.javaee.core.DisplayName;
+import org.eclipse.jst.javaee.core.JavaeeFactory;
+import org.eclipse.jst.javaee.core.UrlPatternType;
+import org.eclipse.jst.javaee.web.IWebCommon;
+import org.eclipse.jst.javaee.web.WebFactory;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * This class, AddServlet Operation is a IDataModelOperation following the IDataModel wizard and
+ * operation framework.
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * This operation subclasses the ArtifactEditProviderOperation so the changes made to the deployment descriptor
+ * models are saved to the artifact edit model.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * It is the operation which should be used when adding a new servlet to
+ * a web app, whether that be an annotated servlet or a non annotated servlet. This uses the
+ * NewServletClassDataModelProvider to retrieve properties set by the user in order to create the custom
+ * servet.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider
+ *
+ * In the non annotated case, this operation will add the metadata necessary into the web deployment
+ * descriptor. In the annotated case, it will not, it will leave this up to the parsing of the
+ * annotations to build the deployment descriptor artifacts. To actually create the java class for
+ * the servlet, the operation uses the NewServletClassOperation. The NewServletClassOperation
+ * shares the same data model provider.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation
+ *
+ * Clients may subclass this operation to provide their own behaviour on servlet creation. The execute
+ * method can be extended to do so. Also, generateServletMetaData and creteServletClass are exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class AddServletOperation extends AddWebClassOperation {
+
+ /**
+ * This is the constructor which should be used when creating the operation.
+ * It will not accept null parameter. It will not return null.
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ *
+ * @param dataModel
+ * @return AddServletOperation
+ */
+
+
+ public AddServletOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ @Override
+ protected NewJavaEEArtifactClassOperation getNewClassOperation() {
+ return new NewServletClassOperation(getDataModel());
+ }
+
+ @Override
+ protected void generateMetaData(IDataModel model, String qualifiedClassName) {
+ boolean isServletType = model.getBooleanProperty(IS_SERVLET_TYPE);
+ generateMetaData(model, qualifiedClassName, isServletType);
+ }
+
+ /**
+ * Subclasses may extend this method to add their own generation steps for the creation of the
+ * metadata for the web deployment descriptor. This implementation uses the J2EE models to create
+ * the Servlet model instance, any init params specified, and any servlet mappings. It then adds
+ * these to the web application model. This will then be written out to the deployment descriptor
+ * file. This method does not accept null parameters.
+ * @see Servlet
+ * @see AddServletOperation#createServlet(String, boolean)
+ * @see AddServletOperation#setUpInitParams(List, Servlet)
+ * @see AddServletOperation#setUpURLMappings(List, Servlet)
+ *
+ * @param aModel
+ * @param qualifiedClassName
+ * @param isServletType
+ */
+ protected void generateMetaData(IDataModel aModel, String qualifiedClassName, boolean isServletType) {
+ // Set up the servlet modelled object
+ Object servlet = createServlet(qualifiedClassName, isServletType);
+
+ // Set up the InitParams if any
+ List initParamList = (List) aModel.getProperty(INIT_PARAM);
+ if (initParamList != null)
+ setUpInitParams(initParamList, servlet);
+
+ // Set up the servlet URL mappings if any
+ List urlMappingList = (List) aModel.getProperty(URL_MAPPINGS);
+ if (urlMappingList != null)
+ setUpURLMappings(urlMappingList, servlet);
+ }
+
+ /**
+ * This method is intended for private use only. This method is used to create the servlet
+ * modelled object, to set any parameters specified in the data model, and then to add the
+ * servlet instance to the web application model. This method does not accpet null parameters.
+ * It will not return null.
+ * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
+ * @see WebapplicationFactory#createServlet()
+ * @see Servlet
+ *
+ * @param qualifiedClassName
+ * @param isServletType
+ * @return Servlet instance
+ */
+ private Object createServlet(String qualifiedClassName, boolean isServletType) {
+ // Get values from data model
+ String displayName = model.getStringProperty(DISPLAY_NAME);
+ String description = model.getStringProperty(DESCRIPTION);
+
+ // Create the servlet instance and set up the parameters from data model
+ Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+
+ Servlet servlet = WebapplicationFactory.eINSTANCE.createServlet();
+ servlet.setDisplayName(displayName);
+ servlet.setServletName(displayName);
+ servlet.setDescription(description);
+ // Handle servlet case
+ if (isServletType) {
+ ServletType servletType = WebapplicationFactory.eINSTANCE.createServletType();
+ servletType.setClassName(qualifiedClassName);
+ servlet.setWebType(servletType);
+ }
+ // Handle JSP case
+ else {
+ JSPType jspType = WebapplicationFactory.eINSTANCE.createJSPType();
+ jspType.setJspFile(qualifiedClassName);
+ servlet.setWebType(jspType);
+ }
+ // Add the servlet to the web application model
+
+ //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
+ WebApp webApp = (WebApp) modelObject;
+ webApp.getServlets().add(servlet);
+ return servlet;
+ } else if (modelObject instanceof IWebCommon) {
+
+ org.eclipse.jst.javaee.web.Servlet servlet = WebFactory.eINSTANCE.createServlet();
+
+ DisplayName displayNameObj = JavaeeFactory.eINSTANCE.createDisplayName();
+ displayNameObj.setValue(displayName);
+ servlet.getDisplayNames().add(displayNameObj);
+
+ servlet.setServletName(displayName);
+
+ org.eclipse.jst.javaee.core.Description descriptionObj = JavaeeFactory.eINSTANCE.createDescription();
+ descriptionObj.setValue(description);
+ servlet.getDescriptions().add(descriptionObj);
+
+ // Handle servlet case
+ if (isServletType) {
+ servlet.setServletClass(qualifiedClassName);
+ }
+ // Handle JSP case
+ else {
+ servlet.setJspFile(qualifiedClassName);
+ }
+ // Add the servlet to the web application model
+
+ //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
+ IWebCommon webApp = (IWebCommon) modelObject;
+ webApp.getServlets().add(servlet);
+ return servlet;
+ }
+ // Return the servlet instance
+ return null;
+ }
+
+ /**
+ * This method is intended for internal use only. This is used to create any init params
+ * for the new servlet metadata. It will not accept null parameters. The init params are
+ * set on the servlet modelled object.
+ * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
+ * @see WebapplicationFactory#createInitParam()
+ *
+ * @param initParamList
+ * @param servlet
+ */
+ private void setUpInitParams(List initParamList, Object servletObj) {
+ // Get the web app instance from the data model
+ Object modelObject = provider.getModelObject();
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ WebApp webApp = (WebApp) modelObject;
+ Servlet servlet = (Servlet) servletObj;
+
+ // If J2EE 1.4, add the param value and description info instances to the servlet init params
+ if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create 1.4 common param value
+ ParamValue param = CommonFactory.eINSTANCE.createParamValue();
+ param.setName(stringArray[0]);
+ param.setValue(stringArray[1]);
+ // Create 1.4 common descripton value
+ Description descriptionObj = CommonFactory.eINSTANCE.createDescription();
+ descriptionObj.setValue(stringArray[2]);
+ // Set the description on the param
+ param.getDescriptions().add(descriptionObj);
+ param.setDescription(stringArray[2]);
+ // Add the param to the servlet model list of init params
+ servlet.getInitParams().add(param);
+ }
+ }
+ // If J2EE 1.2 or 1.3, use the servlet specific init param instances
+ else {
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create the web init param
+ InitParam ip = WebapplicationFactory.eINSTANCE.createInitParam();
+ // Set the param name
+ ip.setParamName(stringArray[0]);
+ // Set the param value
+ ip.setParamValue(stringArray[1]);
+ // Set the param description
+ ip.setDescription(stringArray[2]);
+ // Add the init param to the servlet model list of params
+ servlet.getParams().add(ip);
+ }
+ }
+ } else if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) {
+ org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) servletObj;
+
+ for (int iP = 0; iP < initParamList.size(); iP++) {
+ String[] stringArray = (String[]) initParamList.get(iP);
+ // Create 1.4 common param value
+ org.eclipse.jst.javaee.core.ParamValue param= JavaeeFactory.eINSTANCE.createParamValue();
+ param.setParamName(stringArray[0]);
+ param.setParamValue(stringArray[1]);
+
+ org.eclipse.jst.javaee.core.Description descriptionObj = JavaeeFactory.eINSTANCE.createDescription();
+ descriptionObj.setValue(stringArray[2]);
+ // Set the description on the param
+ param.getDescriptions().add(descriptionObj);
+ // Add the param to the servlet model list of init params
+ servlet.getInitParams().add(param);
+ }
+ }
+ }
+
+ /**
+ * This method is intended for internal use only. This method is used to create the servlet
+ * mapping modelled objects so the metadata for the servlet mappings is store in the web
+ * deployment descriptor. This method will not accept null parameters. The servlet mappings
+ * are added to the web application modelled object.
+ * @see AddServletOperation#generateServletMetaData(NewServletClassDataModel, String, boolean)
+ * @see WebapplicationFactory#createServletMapping()
+ *
+ * @param urlMappingList
+ * @param servlet
+ */
+ private void setUpURLMappings(List urlMappingList, Object servletObj) {
+ // Get the web app modelled object from the data model
+ //WebApp webApp = (WebApp) artifactEdit.getContentModelRoot();
+ Object modelObject = provider.getModelObject(WEB_APP_XML_PATH);
+ // Create the servlet mappings if any
+ if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ WebApp webApp = (WebApp) modelObject;
+ Servlet servlet = (Servlet) servletObj;
+ for (int iM = 0; iM < urlMappingList.size(); iM++) {
+ String[] stringArray = (String[]) urlMappingList.get(iM);
+ // Create the servlet mapping instance from the web factory
+ ServletMapping mapping = WebapplicationFactory.eINSTANCE.createServletMapping();
+ // Set the servlet and servlet name
+ mapping.setServlet(servlet);
+ mapping.setName(servlet.getServletName());
+ // Set the URL pattern to map the servlet to
+ mapping.setUrlPattern(stringArray[0]);
+ // Add the servlet mapping to the web application modelled list
+ webApp.getServletMappings().add(mapping);
+ }
+ } else if (modelObject instanceof IWebCommon) {
+ IWebCommon webApp = (IWebCommon) modelObject;
+ org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) servletObj;
+
+ // Create the servlet mappings if any
+ if (urlMappingList.size() > 0) {
+ // Create the servlet mapping instance from the web factory
+ org.eclipse.jst.javaee.web.ServletMapping mapping = WebFactory.eINSTANCE.createServletMapping();
+
+ mapping.setServletName(servlet.getServletName());
+ for (int i = 0; i < urlMappingList.size(); i++) {
+ String[] stringArray = (String[]) urlMappingList.get(i);
+ // Set the URL pattern to map the servlet to
+ UrlPatternType url = JavaeeFactory.eINSTANCE.createUrlPatternType();
+ url.setValue(stringArray[0]);
+ mapping.getUrlPatterns().add(url);
+ }
+ // Add the servlet mapping to the web application model list
+ webApp.getServletMappings().add(mapping);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java
new file mode 100644
index 0000000..eecc6c3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.GENERATE_DD;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.common.operations.AddJavaEEArtifactOperation;
+import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties;
+import org.eclipse.jst.jee.project.facet.IWebCreateDeploymentFilesDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public abstract class AddWebClassOperation extends AddJavaEEArtifactOperation {
+ protected Path WEB_APP_XML_PATH = new Path(J2EEConstants.WEBAPP_DD_URI);
+ public AddWebClassOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ /**
+ * Subclasses may extend this method to add their own actions during
+ * execution. The implementation of the execute method drives the running of
+ * the operation. This implementation will create the filter class, and
+ * then it will create the filter metadata for the web deployment descriptor.
+ * This method will accept null as a parameter.
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ * @see AddFilterOperation#createFilterClass()
+ * @see AddFilterOperation#generateFilterMetaData(NewFilterClassDataModel,
+ * String)
+ *
+ * @param monitor
+ * IProgressMonitor
+ * @param info
+ * IAdaptable
+ * @throws CoreException
+ * @throws InterruptedException
+ * @throws InvocationTargetException
+ */
+ @Override
+ public IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ boolean useExisting = model.getBooleanProperty(USE_EXISTING_CLASS);
+ String qualifiedClassName = model.getStringProperty(CLASS_NAME);
+
+ // create the java class
+ if (!useExisting)
+ qualifiedClassName = createClass();
+
+ // If the filter is not annotated, generate the filter metadata for the DD
+ if (useExisting || (!model.getBooleanProperty(USE_ANNOTATIONS) && model.getBooleanProperty(REGISTER_IN_WEB_XML)))
+ {
+ if (model.getBooleanProperty(GENERATE_DD))
+ {
+ IDataModel ddModel = DataModelFactory.createDataModel(IWebCreateDeploymentFilesDataModelProperties.class);
+ ddModel.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, getTargetProject());
+ ddModel.getDefaultOperation().execute(monitor, info);
+ }
+ generateMetaData(model, qualifiedClassName);
+ }
+
+ return OK_STATUS;
+ }
+
+ protected abstract void generateMetaData(IDataModel aModel, String qualifiedClassName);
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java
new file mode 100644
index 0000000..4116152
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java
@@ -0,0 +1,269 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DESTROY;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DO_FILTER;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_FILTER_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.FILTER_INIT_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_FILTER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CHAIN;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CONFIG;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_FILTER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_DISPATCHER_TYPE;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jst.j2ee.internal.common.operations.Method;
+import org.eclipse.jst.j2ee.webapplication.DispatcherType;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class CreateFilterTemplateModel extends CreateWebClassTemplateModel {
+
+ public static final String ATT_FILTER_NAME = "filterName"; //$NON-NLS-1$
+ public static final String ATT_SERVLET_NAMES = "servletNames"; //$NON-NLS-1$
+ public static final String ATT_DISPATCHER_TYPES= "dispatcherTypes"; //$NON-NLS-1$
+
+ public static final int NAME = 0;
+ public static final int VALUE = 1;
+ public static final int DESCRIPTION = 2;
+
+ public CreateFilterTemplateModel(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ @Override
+ public Collection<String> getImports() {
+ Collection<String> collection = super.getImports();
+
+ if (shouldGenInit()) {
+ collection.add(QUALIFIED_FILTER_CONFIG);
+ collection.add(QUALIFIED_SERVLET_EXCEPTION);
+ }
+
+ if (shouldGenDoFilter()) {
+ collection.add(QUALIFIED_SERVLET_REQUEST);
+ collection.add(QUALIFIED_SERVLET_RESPONSE);
+ collection.add(QUALIFIED_FILTER_CHAIN);
+ collection.add(QUALIFIED_IO_EXCEPTION);
+ collection.add(QUALIFIED_SERVLET_EXCEPTION);
+ }
+ if (SERVLET_3.equals(getJavaEEVersion())){
+ collection.add(QUALIFIED_WEB_FILTER);
+ if (getInitParams()!= null && getInitParams().size()>0){
+ collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
+ }
+ if (hasDispatchers()){
+ collection.add(QUALIFIED_ANNOTATION_DISPATCHER_TYPE);
+ }
+ }
+
+ return collection;
+ }
+
+ public String getFilterName() {
+ return super.getDisplayName();
+ }
+
+ public boolean shouldGenInit() {
+ return implementImplementedMethod(METHOD_INIT);
+ }
+
+ public boolean shouldGenDoFilter() {
+ return implementImplementedMethod(METHOD_DO_FILTER);
+ }
+
+ public boolean shouldGenDestroy() {
+ return implementImplementedMethod(METHOD_DESTROY);
+ }
+
+ public List<String[]> getInitParams() {
+ return (List) dataModel.getProperty(INIT_PARAM);
+ }
+
+ public String getInitParam(int index, int type) {
+ List<String[]> params = getInitParams();
+ if (index < params.size()) {
+ String[] stringArray = params.get(index);
+ return stringArray[type];
+ }
+ return null;
+ }
+
+ public List<IFilterMappingItem> getFilterMappings() {
+ return (List<IFilterMappingItem>) dataModel.getProperty(FILTER_MAPPINGS);
+ }
+
+ public IFilterMappingItem getFilterMapping(int index) {
+ List<IFilterMappingItem> mappings = getFilterMappings();
+ if (index < mappings.size()) {
+ return mappings.get(index);
+ }
+ return null;
+ }
+
+ public String getDispatcherList(IFilterMappingItem mapping) {
+ List<String> list = new ArrayList<String>();
+
+ int dispatchers = mapping.getDispatchers();
+ if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
+ list.add(DispatcherType.REQUEST_LITERAL.getLiteral());
+ }
+ if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
+ list.add(DispatcherType.FORWARD_LITERAL.getLiteral());
+ }
+ if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
+ list.add(DispatcherType.INCLUDE_LITERAL.getLiteral());
+ }
+ if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
+ list.add(DispatcherType.ERROR_LITERAL.getLiteral());
+ }
+
+ StringBuilder builder = new StringBuilder();
+ Iterator<String> iterator = list.iterator();
+ while (iterator.hasNext()) {
+ builder.append(iterator.next());
+ if (iterator.hasNext()) {
+ builder.append(","); //$NON-NLS-1$
+ }
+ }
+
+ return builder.toString();
+ }
+
+ public List<String> getDispatcherListWeb3(IFilterMappingItem mapping) {
+ List<String> list = new ArrayList<String>();
+
+ int dispatchers = mapping.getDispatchers();
+ if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
+ list.add("DispatcherType.REQUEST"); //$NON-NLS-1$
+ }
+ if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
+ list.add("DispatcherType.FORWARD"); //$NON-NLS-1$
+ }
+ if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
+ list.add("DispatcherType.INCLUDE"); //$NON-NLS-1$
+ }
+ if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
+ list.add("DispatcherType.ERROR"); //$NON-NLS-1$
+ }
+
+ return list;
+ }
+
+ protected boolean implementImplementedMethod(String methodName) {
+ if (dataModel.getBooleanProperty(ABSTRACT_METHODS)) {
+ if (methodName.equals(METHOD_INIT))
+ return dataModel.getBooleanProperty(INIT);
+ else if (methodName.equals(METHOD_DO_FILTER))
+ return dataModel.getBooleanProperty(DO_FILTER);
+ else if (methodName.equals(METHOD_DESTROY))
+ return dataModel.getBooleanProperty(DESTROY);
+ }
+ return false;
+ }
+
+ @Override
+ public Collection<Method> getUnimplementedMethods() {
+ Collection<Method> unimplementedMethods = super.getUnimplementedMethods();
+ Iterator<Method> iterator = unimplementedMethods.iterator();
+
+ while (iterator.hasNext()) {
+ Method method = iterator.next();
+ if ((METHOD_INIT.equals(method.getName()) && FILTER_INIT_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DESTROY.equals(method.getName()) && DESTROY_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_FILTER.equals(method.getName()) && DO_FILTER_SIGNATURE.equals(method.getSignature()))) {
+ iterator.remove();
+ }
+ }
+
+ return unimplementedMethods;
+ }
+
+ public boolean hasDispatchers(){
+ List<IFilterMappingItem> filterMappings = getFilterMappings();
+ for (IFilterMappingItem filterMapping : filterMappings) {
+ if (filterMapping.getDispatchersAsString().length()>0){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Map<String, Object> getClassAnnotationParams() {
+ Map<String, Object> result = new Hashtable<String, Object>();
+
+ String dispName = getFilterName().trim();
+ if (!dispName.equals(getClassName()) && (dispName.length() > 0))
+ result.put(ATT_FILTER_NAME, dispName);
+
+ String description = getDescription().trim();
+ if (description.length() > 0)
+ result.put(ATT_DESCRIPTION, description);
+
+ List<IFilterMappingItem> filterMappings = getFilterMappings();
+ List<String> urlMappings = new ArrayList<String>();
+ List<String> servletNames = new ArrayList<String>();
+ List<String> dispatcherTypes = new ArrayList<String>();
+ for (IFilterMappingItem filterMapping : filterMappings) {
+ List<String> dispatcherList = getDispatcherListWeb3(filterMapping);
+ if (dispatcherList != null && dispatcherList.size()>0){
+ for (String disp : dispatcherList) {
+ if (!dispatcherTypes.contains(disp)){
+ dispatcherTypes.add(disp);
+ }
+ }
+
+ }
+ if (filterMapping.isUrlPatternType()) {
+ urlMappings.add(filterMapping.getName());
+ } else if (filterMapping.isServletNameType()) {
+ servletNames.add(filterMapping.getName());
+ }
+ }
+ if (urlMappings.size() > 0) {
+ result.put(ATT_URL_PATTERNS, urlMappings);
+ }
+ if (dispatcherTypes.size() > 0) {
+ result.put(ATT_DISPATCHER_TYPES, dispatcherTypes);
+ }
+ if (servletNames.size() > 0) {
+ result.put(ATT_SERVLET_NAMES, servletNames);
+ }
+
+
+ List<String[]> initParams = getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ result.put(ATT_INIT_PARAMS, initParams);
+ }
+
+ return result;
+ }
+
+}
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java
new file mode 100644
index 0000000..0bad932
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_EVENT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_LISTENER;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class CreateListenerTemplateModel extends CreateWebClassTemplateModel {
+
+ @Override
+ public Collection<String> getImports() {
+ Collection<String> collection = super.getImports();
+
+ if (implementServletContextListener()) {
+ collection.add(QUALIFIED_SERVLET_CONTEXT_LISTENER);
+ collection.add(QUALIFIED_SERVLET_CONTEXT_EVENT);
+ }
+
+ if (implementServletContextAttributeListener()) {
+ collection.add(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER);
+ collection.add(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT);
+ }
+
+ if (implementHttpSessionListener()) {
+ collection.add(QUALIFIED_HTTP_SESSION_LISTENER);
+ collection.add(QUALIFIED_HTTP_SESSION_EVENT);
+ }
+
+ if (implementHttpSessionAttributeListener()) {
+ collection.add(QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER);
+ collection.add(QUALIFIED_HTTP_SESSION_BINDING_EVENT);
+ }
+
+ if (implementHttpSessionActivationListener()) {
+ collection.add(QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER);
+ collection.add(QUALIFIED_HTTP_SESSION_EVENT);
+ }
+
+ if (implementHttpSessionBindingListener()) {
+ collection.add(QUALIFIED_HTTP_SESSION_BINDING_LISTENER);
+ collection.add(QUALIFIED_HTTP_SESSION_BINDING_EVENT);
+ }
+
+ if (implementServletRequestListener()) {
+ collection.add(QUALIFIED_SERVLET_REQUEST_LISTENER);
+ collection.add(QUALIFIED_SERVLET_REQUEST_EVENT);
+ }
+
+ if (implementServletRequestAttributeListener()) {
+ collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER);
+ collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT);
+ }
+
+ if (SERVLET_3.equals(getJavaEEVersion())){
+ collection.add(QUALIFIED_WEB_LISTENER);
+ }
+
+ return collection;
+ }
+
+ public CreateListenerTemplateModel(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ public boolean implementServletContextListener() {
+ return implementInterface(QUALIFIED_SERVLET_CONTEXT_LISTENER);
+ }
+
+ public boolean implementServletContextAttributeListener() {
+ return implementInterface(QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER);
+ }
+
+ public boolean implementHttpSessionListener() {
+ return implementInterface(QUALIFIED_HTTP_SESSION_LISTENER);
+ }
+
+ public boolean implementHttpSessionAttributeListener() {
+ return implementInterface(QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER);
+ }
+
+ public boolean implementHttpSessionActivationListener() {
+ return implementInterface(QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER);
+ }
+
+ public boolean implementHttpSessionBindingListener() {
+ return implementInterface(QUALIFIED_HTTP_SESSION_BINDING_LISTENER);
+ }
+
+ public boolean implementServletRequestListener() {
+ return implementInterface(QUALIFIED_SERVLET_REQUEST_LISTENER);
+ }
+
+ public boolean implementServletRequestAttributeListener() {
+ return implementInterface(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER);
+ }
+
+ private boolean implementInterface(String iface) {
+ List<String> interfaces = getQualifiedInterfaces();
+ if (interfaces != null) {
+ return interfaces.contains(iface);
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java
new file mode 100644
index 0000000..4f6a59d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kiril Mitov, k.mitov@sap.com - bug 204160
+ * Kaloyan Raev, kaloyan.raev@sap.com
+ *******************************************************************************/
+/*
+ * Created on Aug 6, 2004
+ */
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DESTROY;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_DELETE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_GET;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_HEAD;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_OPTIONS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_POST;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_PUT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_TRACE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_CONFIG;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_INFO;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.SERVICE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DESTROY_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_DELETE_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_GET_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_HEAD_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_POST_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_PUT_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.DO_TRACE_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.GET_SERVLET_CONFIG_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.GET_SERVLET_INFO_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.HTTP_SERVICE_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_DELETE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_GET;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_HEAD;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_OPTIONS;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_POST;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_PUT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_TRACE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_GET_SERVLET_CONFIG;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_GET_SERVLET_INFO;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_SERVICE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_TO_STRING;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET_REQUEST;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET_RESPONSE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONFIG;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_SERVLET;
+import static org.eclipse.jst.j2ee.web.IServletConstants.SERVICE_SIGNATURE;
+import static org.eclipse.jst.j2ee.web.IServletConstants.SERVLET_INIT_SIGNATURE;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jst.j2ee.internal.common.operations.Method;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @author jlanuti
+ */
+public class CreateServletTemplateModel extends CreateWebClassTemplateModel {
+
+ public static final int NAME = 0;
+ public static final int VALUE = 1;
+ public static final int DESCRIPTION = 2;
+
+ public CreateServletTemplateModel(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ @Override
+ public Collection<String> getImports() {
+ Collection<String> collection = super.getImports();
+
+ if (shouldGenInit()) {
+ collection.add(QUALIFIED_SERVLET_CONFIG);
+ collection.add(QUALIFIED_SERVLET_EXCEPTION);
+ }
+
+ if (shouldGenGetServletConfig()) {
+ collection.add(QUALIFIED_SERVLET_CONFIG);
+ }
+
+ if (shouldGenService()) {
+ if (isHttpServletSuperclass()) {
+ collection.add(QUALIFIED_HTTP_SERVLET_REQUEST);
+ collection.add(QUALIFIED_HTTP_SERVLET_RESPONSE);
+ } else {
+ collection.add(QUALIFIED_SERVLET_REQUEST);
+ collection.add(QUALIFIED_SERVLET_RESPONSE);
+ }
+
+ collection.add(QUALIFIED_SERVLET_EXCEPTION);
+ collection.add(QUALIFIED_IO_EXCEPTION);
+ }
+
+ if (shouldGenDoGet() || shouldGenDoPost() || shouldGenDoPut() ||
+ shouldGenDoDelete() || shouldGenDoHead() ||
+ shouldGenDoOptions() || shouldGenDoTrace()) {
+ collection.add(QUALIFIED_HTTP_SERVLET_REQUEST);
+ collection.add(QUALIFIED_HTTP_SERVLET_RESPONSE);
+ collection.add(QUALIFIED_SERVLET_EXCEPTION);
+ collection.add(QUALIFIED_IO_EXCEPTION);
+ }
+
+ if (SERVLET_3.equals(getJavaEEVersion())){
+ collection.add(QUALIFIED_WEB_SERVLET);
+ if (getInitParams()!= null && getInitParams().size()>0){
+ collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
+ }
+
+
+
+ }
+
+ return collection;
+ }
+
+ public String getServletName() {
+ return super.getDisplayName();
+ }
+
+ /**
+ * @deprecated Use {@link #getClassName()} instead. Will be removed post WTP
+ * 3.0.
+ *
+ * @see CreateWebClassTemplateModel#getClassName()
+ */
+ public String getServletClassName() {
+ return super.getClassName();
+ }
+
+ public boolean shouldGenInit() {
+ return implementImplementedMethod(METHOD_INIT);
+ }
+
+ public boolean shouldGenDestroy() {
+ return implementImplementedMethod(METHOD_DESTROY);
+ }
+
+ public boolean shouldGenGetServletConfig() {
+ return implementImplementedMethod(METHOD_GET_SERVLET_CONFIG);
+ }
+
+ public boolean shouldGenGetServletInfo() {
+ return implementImplementedMethod(METHOD_GET_SERVLET_INFO);
+ }
+
+ public boolean shouldGenService() {
+ return implementImplementedMethod(METHOD_SERVICE);
+ }
+
+ public boolean shouldGenDoGet() {
+ return implementImplementedMethod(METHOD_DO_GET);
+ }
+
+ public boolean shouldGenDoPost() {
+ return implementImplementedMethod(METHOD_DO_POST);
+ }
+
+ public boolean shouldGenDoPut() {
+ return implementImplementedMethod(METHOD_DO_PUT);
+ }
+
+ public boolean shouldGenDoDelete() {
+ return implementImplementedMethod(METHOD_DO_DELETE);
+ }
+
+ public boolean shouldGenDoHead() {
+ return implementImplementedMethod(METHOD_DO_HEAD);
+ }
+
+ public boolean shouldGenDoOptions() {
+ return implementImplementedMethod(METHOD_DO_OPTIONS);
+ }
+
+ public boolean shouldGenDoTrace() {
+ return implementImplementedMethod(METHOD_DO_TRACE);
+ }
+
+ public boolean shouldGenToString() {
+ return implementImplementedMethod(METHOD_TO_STRING);
+ }
+
+ public boolean isGenericServletSuperclass() {
+ return ServletSupertypesValidator.isGenericServletSuperclass(dataModel);
+ }
+
+ public boolean isHttpServletSuperclass() {
+ return ServletSupertypesValidator.isHttpServletSuperclass(dataModel);
+ }
+
+ public List<String[]> getInitParams() {
+ return (List) dataModel.getProperty(INIT_PARAM);
+ }
+
+ public String getInitParam(int index, int type) {
+ List<String[]> params = getInitParams();
+ if (index < params.size()) {
+ String[] stringArray = params.get(index);
+ return stringArray[type];
+ }
+ return null;
+ }
+
+ public List<String[]> getServletMappings() {
+ return (List) dataModel.getProperty(URL_MAPPINGS);
+ }
+
+ public String getServletMapping(int index) {
+ List<String[]> mappings = getServletMappings();
+ if (index < mappings.size()) {
+ String[] map = mappings.get(index);
+ return map[0];
+ }
+ return null;
+ }
+
+ /**
+ * @deprecated Use {@link #getDescription()} instead. Will be removed post
+ * WTP 3.0.
+ *
+ * @see CreateWebClassTemplateModel#getDescription()
+ */
+ public String getServletDescription() {
+ return super.getDescription();
+ }
+
+ protected boolean implementImplementedMethod(String methodName) {
+ if (dataModel.getBooleanProperty(ABSTRACT_METHODS)) {
+ if (methodName.equals(METHOD_INIT))
+ return dataModel.getBooleanProperty(INIT);
+ else if (methodName.equals(METHOD_DESTROY))
+ return dataModel.getBooleanProperty(DESTROY);
+ else if (methodName.equals(METHOD_GET_SERVLET_CONFIG))
+ return dataModel.getBooleanProperty(GET_SERVLET_CONFIG);
+ else if (methodName.equals(METHOD_GET_SERVLET_INFO))
+ return dataModel.getBooleanProperty(GET_SERVLET_INFO);
+ else if (methodName.equals(METHOD_SERVICE))
+ return dataModel.getBooleanProperty(SERVICE);
+ else if (methodName.equals(METHOD_DO_GET))
+ return dataModel.getBooleanProperty(DO_GET);
+ else if (methodName.equals(METHOD_DO_POST))
+ return dataModel.getBooleanProperty(DO_POST);
+ else if (methodName.equals(METHOD_DO_PUT))
+ return dataModel.getBooleanProperty(DO_PUT);
+ else if (methodName.equals(METHOD_DO_DELETE))
+ return dataModel.getBooleanProperty(DO_DELETE);
+ else if (methodName.equals(METHOD_DO_HEAD))
+ return dataModel.getBooleanProperty(DO_HEAD);
+ else if (methodName.equals(METHOD_DO_OPTIONS))
+ return dataModel.getBooleanProperty(DO_OPTIONS);
+ else if (methodName.equals(METHOD_DO_TRACE))
+ return dataModel.getBooleanProperty(DO_TRACE);
+ }
+ return false;
+ }
+
+ @Override
+ public Collection<Method> getUnimplementedMethods() {
+ Collection<Method> unimplementedMethods = super.getUnimplementedMethods();
+ Iterator<Method> iterator = unimplementedMethods.iterator();
+
+ while (iterator.hasNext()) {
+ Method method = iterator.next();
+ if ((METHOD_INIT.equals(method.getName()) && SERVLET_INIT_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DESTROY.equals(method.getName()) && DESTROY_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_GET_SERVLET_CONFIG.equals(method.getName()) && GET_SERVLET_CONFIG_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_GET_SERVLET_INFO.equals(method.getName()) && GET_SERVLET_INFO_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_SERVICE.equals(method.getName()) && SERVICE_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_SERVICE.equals(method.getName()) && HTTP_SERVICE_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_GET.equals(method.getName()) && DO_GET_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_POST.equals(method.getName()) && DO_POST_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_PUT.equals(method.getName()) && DO_PUT_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_DELETE.equals(method.getName()) && DO_DELETE_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_HEAD.equals(method.getName()) && DO_HEAD_SIGNATURE.equals(method.getSignature())) ||
+ (METHOD_DO_OPTIONS.equals(method.getName()) && METHOD_DO_OPTIONS.equals(method.getSignature())) ||
+ (METHOD_DO_TRACE.equals(method.getName()) && DO_TRACE_SIGNATURE.equals(method.getSignature()))) {
+ iterator.remove();
+ }
+ }
+
+ return unimplementedMethods;
+ }
+
+ public Map<String, Object> getClassAnnotationParams() {
+ Map<String, Object> result = new Hashtable<String, Object>();
+
+ String dispName = getServletName().trim();
+ if (!dispName.equals(getClassName()) && (dispName.length() > 0))
+ result.put(ATT_NAME, dispName);
+
+ String description = getDescription().trim();
+ if (description.length() > 0)
+ result.put(ATT_DESCRIPTION, description);
+
+ List<String[]> servletMappings = getServletMappings();
+ if (servletMappings != null && servletMappings.size() > 0) {
+ result.put(ATT_URL_PATTERNS, servletMappings);
+ }
+
+ List<String[]> initParams = getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ result.put(ATT_INIT_PARAMS, initParams);
+ }
+
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java
new file mode 100644
index 0000000..809662a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ * Carl Anderson, ccc@us.ibm.com - handle null superclass (no runtime) (bug 214950)
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
+
+import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class CreateWebClassTemplateModel extends
+ CreateJavaEEArtifactTemplateModel {
+
+ public static final String ATT_URL_PATTERNS = "urlPatterns"; //$NON-NLS-1$
+ public static final String ATT_INIT_PARAMS = "initParams"; //$NON-NLS-1$
+
+ public static final String SERVLET_3 = "3.0"; //$NON-NLS-1$
+
+ public CreateWebClassTemplateModel(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ public String getDisplayName() {
+ return dataModel.getStringProperty(DISPLAY_NAME);
+ }
+
+ public String getDescription() {
+ return dataModel.getStringProperty(DESCRIPTION);
+ }
+
+ public boolean isAnnotated() {
+ return dataModel.getBooleanProperty(USE_ANNOTATIONS);
+ }
+
+ public String getJavaEEVersion() {
+ return dataModel.getStringProperty(JAVA_EE_VERSION);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java
new file mode 100644
index 0000000..59394f2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterMappingItem.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
+
+public class FilterMappingItem implements IFilterMappingItem {
+
+ private int mappingType;
+ private int dispatchers;
+ private String mapping;
+
+ public FilterMappingItem(int type, String mapping) {
+ mappingType = type;
+ this.mapping = mapping;
+ }
+
+ public FilterMappingItem(int type, String mapping, int dispatchers) {
+ this(type, mapping);
+ this.dispatchers = dispatchers;
+ }
+
+ public int getMappingType() {
+ return mappingType;
+ }
+
+ public boolean isUrlPatternType() {
+ return mappingType == IFilterMappingItem.URL_PATTERN;
+ }
+
+ public boolean isServletNameType() {
+ return mappingType == IFilterMappingItem.SERVLET_NAME;
+ }
+
+ public int getDispatchers() {
+ return dispatchers;
+ }
+
+ public String getDispatchersAsString() {
+ String result = ""; //$NON-NLS-1$
+ if ((dispatchers & REQUEST) > 0) {
+ result += WebAppEditResourceHandler.getString("DISPATCHER_R") + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if ((dispatchers & FORWARD) > 0) {
+ result += WebAppEditResourceHandler.getString("DISPATCHER_F") + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if ((dispatchers & INCLUDE) > 0) {
+ result += WebAppEditResourceHandler.getString("DISPATCHER_I") + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if ((dispatchers & ERROR) > 0) {
+ result += WebAppEditResourceHandler.getString("DISPATCHER_E") + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result.trim();
+ }
+
+ public String getName() {
+ return mapping;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java
new file mode 100644
index 0000000..fb7c510
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterSupertypesValidator.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class FilterSupertypesValidator extends AbstractSupertypesValidator {
+
+ public static boolean isFilterSuperclass(IDataModel dataModel) {
+ if (hasSuperInterface(dataModel, getSuperclass(dataModel), QUALIFIED_FILTER))
+ return true;
+
+ for (Object iface : getInterfaces(dataModel)) {
+ if (hasSuperInterface(dataModel, (String) iface, QUALIFIED_FILTER))
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java
new file mode 100644
index 0000000..ccce1a0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java
@@ -0,0 +1,588 @@
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.*;
+import org.eclipse.jst.j2ee.internal.common.operations.*;
+
+public class FilterTemplate
+{
+ protected static String nl;
+ public static synchronized FilterTemplate create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ FilterTemplate result = new FilterTemplate();
+ nl = null;
+ return result;
+ }
+
+ public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
+ protected final String TEXT_1 = "package "; //$NON-NLS-1$
+ protected final String TEXT_2 = ";"; //$NON-NLS-1$
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
+ protected final String TEXT_5 = ";"; //$NON-NLS-1$
+ protected final String TEXT_6 = NL;
+ protected final String TEXT_7 = NL;
+ protected final String TEXT_8 = "/**" + NL + " * Servlet Filter implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_9 = NL + " *" + NL + " * @web.filter" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_10 = "\"" + NL + " * display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_11 = "\""; //$NON-NLS-1$
+ protected final String TEXT_12 = NL + " * description=\""; //$NON-NLS-1$
+ protected final String TEXT_13 = "\""; //$NON-NLS-1$
+ protected final String TEXT_14 = NL + " *" + NL + " * @web.filter-mapping"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_15 = NL + " * url-pattern=\""; //$NON-NLS-1$
+ protected final String TEXT_16 = "\""; //$NON-NLS-1$
+ protected final String TEXT_17 = NL + " * servlet-name=\""; //$NON-NLS-1$
+ protected final String TEXT_18 = "\""; //$NON-NLS-1$
+ protected final String TEXT_19 = NL + " * dispatcher=\""; //$NON-NLS-1$
+ protected final String TEXT_20 = "\""; //$NON-NLS-1$
+ protected final String TEXT_21 = NL + " *" + NL + " * @web.filter-init-param" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_22 = "\"" + NL + " * value=\""; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_23 = "\""; //$NON-NLS-1$
+ protected final String TEXT_24 = NL + " * description=\""; //$NON-NLS-1$
+ protected final String TEXT_25 = "\""; //$NON-NLS-1$
+ protected final String TEXT_26 = NL + " */"; //$NON-NLS-1$
+ protected final String TEXT_27 = NL + "@WebFilter"; //$NON-NLS-1$
+ protected final String TEXT_28 = "(\""; //$NON-NLS-1$
+ protected final String TEXT_29 = "\")"; //$NON-NLS-1$
+ protected final String TEXT_30 = "({ "; //$NON-NLS-1$
+ protected final String TEXT_31 = ", "; //$NON-NLS-1$
+ protected final String TEXT_32 = "\""; //$NON-NLS-1$
+ protected final String TEXT_33 = "\""; //$NON-NLS-1$
+ protected final String TEXT_34 = " })"; //$NON-NLS-1$
+ protected final String TEXT_35 = "("; //$NON-NLS-1$
+ protected final String TEXT_36 = ", "; //$NON-NLS-1$
+ protected final String TEXT_37 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_38 = " = \""; //$NON-NLS-1$
+ protected final String TEXT_39 = "\""; //$NON-NLS-1$
+ protected final String TEXT_40 = " = { "; //$NON-NLS-1$
+ protected final String TEXT_41 = ", "; //$NON-NLS-1$
+ protected final String TEXT_42 = NL + "\t\t\t\t"; //$NON-NLS-1$
+ protected final String TEXT_43 = "\""; //$NON-NLS-1$
+ protected final String TEXT_44 = "\""; //$NON-NLS-1$
+ protected final String TEXT_45 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_46 = " "; //$NON-NLS-1$
+ protected final String TEXT_47 = "}"; //$NON-NLS-1$
+ protected final String TEXT_48 = " = { "; //$NON-NLS-1$
+ protected final String TEXT_49 = ", "; //$NON-NLS-1$
+ protected final String TEXT_50 = NL + "\t\t\t\t"; //$NON-NLS-1$
+ protected final String TEXT_51 = "\""; //$NON-NLS-1$
+ protected final String TEXT_52 = "\""; //$NON-NLS-1$
+ protected final String TEXT_53 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_54 = " "; //$NON-NLS-1$
+ protected final String TEXT_55 = "}"; //$NON-NLS-1$
+ protected final String TEXT_56 = " = { "; //$NON-NLS-1$
+ protected final String TEXT_57 = ", "; //$NON-NLS-1$
+ protected final String TEXT_58 = NL + "\t\t\t\t@WebInitParam(name = \""; //$NON-NLS-1$
+ protected final String TEXT_59 = "\", value = \""; //$NON-NLS-1$
+ protected final String TEXT_60 = "\""; //$NON-NLS-1$
+ protected final String TEXT_61 = ", description = \""; //$NON-NLS-1$
+ protected final String TEXT_62 = "\""; //$NON-NLS-1$
+ protected final String TEXT_63 = ")"; //$NON-NLS-1$
+ protected final String TEXT_64 = NL + "\t\t}"; //$NON-NLS-1$
+ protected final String TEXT_65 = " = {"; //$NON-NLS-1$
+ protected final String TEXT_66 = ", "; //$NON-NLS-1$
+ protected final String TEXT_67 = NL + "\t\t\t\t"; //$NON-NLS-1$
+ protected final String TEXT_68 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_69 = " "; //$NON-NLS-1$
+ protected final String TEXT_70 = "}" + NL + "\t\t\t\t\t"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_71 = ")"; //$NON-NLS-1$
+ protected final String TEXT_72 = NL + "public "; //$NON-NLS-1$
+ protected final String TEXT_73 = "abstract "; //$NON-NLS-1$
+ protected final String TEXT_74 = "final "; //$NON-NLS-1$
+ protected final String TEXT_75 = "class "; //$NON-NLS-1$
+ protected final String TEXT_76 = " extends "; //$NON-NLS-1$
+ protected final String TEXT_77 = " implements "; //$NON-NLS-1$
+ protected final String TEXT_78 = ", "; //$NON-NLS-1$
+ protected final String TEXT_79 = " {"; //$NON-NLS-1$
+ protected final String TEXT_80 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ protected final String TEXT_81 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_82 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_83 = "#"; //$NON-NLS-1$
+ protected final String TEXT_84 = "("; //$NON-NLS-1$
+ protected final String TEXT_85 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_86 = "("; //$NON-NLS-1$
+ protected final String TEXT_87 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_88 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_89 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_90 = "#"; //$NON-NLS-1$
+ protected final String TEXT_91 = "("; //$NON-NLS-1$
+ protected final String TEXT_92 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_93 = " "; //$NON-NLS-1$
+ protected final String TEXT_94 = "("; //$NON-NLS-1$
+ protected final String TEXT_95 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_96 = NL + "\t\t\treturn "; //$NON-NLS-1$
+ protected final String TEXT_97 = ";"; //$NON-NLS-1$
+ protected final String TEXT_98 = NL + " }"; //$NON-NLS-1$
+ protected final String TEXT_99 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_100 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
+ protected final String TEXT_101 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_102 = NL + NL + "}"; //$NON-NLS-1$
+ protected final String TEXT_103 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ CreateFilterTemplateModel model = (CreateFilterTemplateModel) argument;
+
+ model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
+
+
+ if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
+
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append( model.getJavaPackageName() );
+ stringBuffer.append(TEXT_2);
+
+ }
+
+ stringBuffer.append(TEXT_3);
+
+ Collection<String> imports = model.getImports();
+ for (String anImport : imports) {
+
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append( anImport );
+ stringBuffer.append(TEXT_5);
+
+ }
+
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append( model.getClassName() );
+
+ if (model.isAnnotated()) {
+
+ stringBuffer.append(TEXT_9);
+ stringBuffer.append( model.getFilterName() );
+ stringBuffer.append(TEXT_10);
+ stringBuffer.append( model.getFilterName() );
+ stringBuffer.append(TEXT_11);
+
+ if (model.getDescription() != null && model.getDescription().length() > 0) {
+
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append( model.getDescription() );
+ stringBuffer.append(TEXT_13);
+
+ }
+
+ List<IFilterMappingItem> mappings = model.getFilterMappings();
+ for (IFilterMappingItem mapping : mappings) {
+
+ stringBuffer.append(TEXT_14);
+
+ if (mapping.isUrlPatternType()) {
+
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append( mapping.getName() );
+ stringBuffer.append(TEXT_16);
+
+ } else if (mapping.isServletNameType()) {
+
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append( mapping.getName() );
+ stringBuffer.append(TEXT_18);
+
+ }
+
+ String dispatcher = model.getDispatcherList(mapping);
+ if (dispatcher.length() > 0) {
+
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append( dispatcher );
+ stringBuffer.append(TEXT_20);
+
+ }
+ }
+
+ List<String[]> initParams = model.getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ for (int i = 0; i < initParams.size(); i++) {
+ String name = model.getInitParam(i, CreateFilterTemplateModel.NAME);
+ String value = model.getInitParam(i, CreateFilterTemplateModel.VALUE);
+ String description = model.getInitParam(i, CreateFilterTemplateModel.DESCRIPTION);
+
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append( name );
+ stringBuffer.append(TEXT_22);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_23);
+
+ if (description != null && description.length() > 0) {
+
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append( description );
+ stringBuffer.append(TEXT_25);
+
+ }
+ }
+ }
+ }
+
+ stringBuffer.append(TEXT_26);
+
+ if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
+
+ stringBuffer.append(TEXT_27);
+
+ Map<String, Object> params = model.getClassAnnotationParams();
+ if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+ List<String> mappings = (List<String>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
+ if (mappings.size() == 1) {
+ String value = mappings.get(0);
+
+ stringBuffer.append(TEXT_28);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_29);
+
+ } else {
+
+ stringBuffer.append(TEXT_30);
+
+ boolean needComma = false;
+ for (String mapping : mappings) {
+ if (needComma) {
+
+ stringBuffer.append(TEXT_31);
+
+ }
+
+ stringBuffer.append(TEXT_32);
+ stringBuffer.append( mapping );
+ stringBuffer.append(TEXT_33);
+
+ needComma = true;
+ }
+
+ stringBuffer.append(TEXT_34);
+
+ }
+ } else if (!params.isEmpty()) {
+
+ stringBuffer.append(TEXT_35);
+
+ Set<String> keys = params.keySet();
+ boolean needNewLine = keys.contains(CreateFilterTemplateModel.ATT_INIT_PARAMS) ||
+ (keys.contains(CreateFilterTemplateModel.ATT_URL_PATTERNS) &&
+ ((List<String>) params.get(CreateFilterTemplateModel.ATT_URL_PATTERNS)).size() > 1) ||
+ (keys.contains(CreateFilterTemplateModel.ATT_SERVLET_NAMES) &&
+ ((List<String>) params.get(CreateFilterTemplateModel.ATT_SERVLET_NAMES)).size() > 1);
+ boolean needComma = false;
+ for (String key : keys) {
+ if (needComma) {
+
+ stringBuffer.append(TEXT_36);
+
+ }
+
+ if (needNewLine) {
+
+ stringBuffer.append(TEXT_37);
+
+ }
+
+ if (key.equals(CreateFilterTemplateModel.ATT_FILTER_NAME) || key.equals(CreateFilterTemplateModel.ATT_DESCRIPTION)) {
+ String value = (String) params.get(key);
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_38);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_39);
+
+ } else if (key.equals(CreateFilterTemplateModel.ATT_URL_PATTERNS)) {
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_40);
+
+ List<String> mappings = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = mappings.size() > 1;
+ for (String mapping : mappings) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_41);
+
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_42);
+
+ }
+
+ stringBuffer.append(TEXT_43);
+ stringBuffer.append( mapping );
+ stringBuffer.append(TEXT_44);
+
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_45);
+
+ } else {
+
+ stringBuffer.append(TEXT_46);
+
+ }
+
+ stringBuffer.append(TEXT_47);
+
+ } else if (key.equals(CreateFilterTemplateModel.ATT_SERVLET_NAMES)) {
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_48);
+
+ List<String> servletNames = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = servletNames.size() > 1;
+ for (String servletName : servletNames) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_49);
+
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_50);
+
+ }
+
+ stringBuffer.append(TEXT_51);
+ stringBuffer.append( servletName );
+ stringBuffer.append(TEXT_52);
+
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_53);
+
+ } else {
+
+ stringBuffer.append(TEXT_54);
+
+ }
+
+ stringBuffer.append(TEXT_55);
+
+ } else if (key.equals(CreateFilterTemplateModel.ATT_INIT_PARAMS)) {
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_56);
+
+ List<String[]> initParams = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ for (String[] initParam : initParams) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_57);
+
+ }
+
+ String name = initParam[CreateFilterTemplateModel.NAME];
+ String value = initParam[CreateFilterTemplateModel.VALUE];
+ String description = initParam[CreateFilterTemplateModel.DESCRIPTION];
+
+ stringBuffer.append(TEXT_58);
+ stringBuffer.append( name );
+ stringBuffer.append(TEXT_59);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_60);
+
+ if (description != null && description.length() > 0) {
+
+ stringBuffer.append(TEXT_61);
+ stringBuffer.append( description );
+ stringBuffer.append(TEXT_62);
+
+ }
+
+ stringBuffer.append(TEXT_63);
+
+ needComma2 = true;
+ }
+
+ stringBuffer.append(TEXT_64);
+
+ } else if (key.equals(CreateFilterTemplateModel.ATT_DISPATCHER_TYPES)) {
+ List<String> dispatcherTypes = (List<String>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = dispatcherTypes.size() > 1;
+ if (dispatcherTypes.size()>0){
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_65);
+
+ }
+ for (String dispType : dispatcherTypes) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_66);
+
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_67);
+
+ }
+
+ stringBuffer.append( dispType );
+
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_68);
+
+ } else {
+
+ stringBuffer.append(TEXT_69);
+
+ }
+
+ stringBuffer.append(TEXT_70);
+
+ }
+ needComma = true;
+ }
+
+ stringBuffer.append(TEXT_71);
+
+ }
+ }
+
+
+ if (model.isPublic()) {
+
+ stringBuffer.append(TEXT_72);
+
+ }
+
+ if (model.isAbstract()) {
+
+ stringBuffer.append(TEXT_73);
+
+ }
+
+ if (model.isFinal()) {
+
+ stringBuffer.append(TEXT_74);
+
+ }
+
+ stringBuffer.append(TEXT_75);
+ stringBuffer.append( model.getClassName() );
+
+ String superClass = model.getSuperclassName();
+ if (superClass != null && superClass.length() > 0) {
+
+ stringBuffer.append(TEXT_76);
+ stringBuffer.append( superClass );
+
+ }
+
+ List<String> interfaces = model.getInterfaces();
+ if ( interfaces.size() > 0) {
+
+ stringBuffer.append(TEXT_77);
+
+ }
+
+ for (int i = 0; i < interfaces.size(); i++) {
+ String INTERFACE = interfaces.get(i);
+ if (i > 0) {
+
+ stringBuffer.append(TEXT_78);
+
+ }
+
+ stringBuffer.append( INTERFACE );
+
+ }
+
+ stringBuffer.append(TEXT_79);
+
+ if (!model.hasEmptySuperclassConstructor()) {
+
+ stringBuffer.append(TEXT_80);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_81);
+
+ }
+
+ if (model.shouldGenSuperclassConstructors()) {
+ List<Constructor> constructors = model.getConstructors();
+ for (Constructor constructor : constructors) {
+ if (constructor.isPublic() || constructor.isProtected()) {
+
+ stringBuffer.append(TEXT_82);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_83);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_84);
+ stringBuffer.append( constructor.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_85);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_86);
+ stringBuffer.append( constructor.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_87);
+ stringBuffer.append( constructor.getParamsForCall() );
+ stringBuffer.append(TEXT_88);
+
+ }
+ }
+ }
+
+
+ if (model.shouldImplementAbstractMethods()) {
+ for (Method method : model.getUnimplementedMethods()) {
+
+ stringBuffer.append(TEXT_89);
+ stringBuffer.append( method.getContainingJavaClass() );
+ stringBuffer.append(TEXT_90);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_91);
+ stringBuffer.append( method.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_92);
+ stringBuffer.append( method.getReturnType() );
+ stringBuffer.append(TEXT_93);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_94);
+ stringBuffer.append( method.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_95);
+
+ String defaultReturnValue = method.getDefaultReturnValue();
+ if (defaultReturnValue != null) {
+
+ stringBuffer.append(TEXT_96);
+ stringBuffer.append( defaultReturnValue );
+ stringBuffer.append(TEXT_97);
+
+ }
+
+ stringBuffer.append(TEXT_98);
+
+ }
+ }
+
+ if (model.shouldGenDestroy()) {
+ stringBuffer.append(TEXT_99);
+ }
+ if (model.shouldGenDoFilter()) {
+ stringBuffer.append(TEXT_100);
+ }
+ if (model.shouldGenInit()) {
+ stringBuffer.append(TEXT_101);
+ }
+ stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_103);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java
new file mode 100644
index 0000000..4fd6f92
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/IFilterMappingItem.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+public interface IFilterMappingItem {
+
+ public static int URL_PATTERN = 0;
+ public static int SERVLET_NAME = 1;
+
+ public static int REQUEST = 1 << 1;
+ public static int FORWARD = 1 << 2;
+ public static int INCLUDE = 1 << 3;
+ public static int ERROR = 1 << 4;
+
+ public String getName();
+ public int getMappingType();
+ public boolean isUrlPatternType();
+ public boolean isServletNameType();
+ public int getDispatchers();
+ public String getDispatchersAsString();
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java
new file mode 100644
index 0000000..029c7c5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewFilterClassDataModelProperties.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+public interface INewFilterClassDataModelProperties extends INewWebClassDataModelProperties {
+
+ /**
+ * Optional, boolean property used to specify whether to generate the init method.
+ * The default is false.
+ */
+ public static final String INIT = "NewFilterClassDataModel.INIT"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the destroy method.
+ * The default is false.
+ */
+ public static final String DESTROY = "NewFilterClassDataModel.DESTROY"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doFilter method.
+ * The default is true.
+ */
+ public static final String DO_FILTER = "NewFilterClassDataModel.DO_FILTER"; //$NON-NLS-1$
+
+ /**
+ * Optional, List property used to cache all the init params defined on the filter.
+ */
+ public static final String INIT_PARAM = "NewFilterClassDataModel.INIT_PARAM"; //$NON-NLS-1$
+
+ /**
+ * Optional, List propety used to cache all the filter mappings for this filter on the web application.
+ */
+ public static final String FILTER_MAPPINGS = "NewFilterClassDataModel.FILTER_MAPPINGS"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java
new file mode 100644
index 0000000..d408e9c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewListenerClassDataModelProperties.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+public interface INewListenerClassDataModelProperties extends INewWebClassDataModelProperties {
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java
new file mode 100644
index 0000000..583f9a5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewServletClassDataModelProperties.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kiril Mitov, k.mitov@sap.com - bug 204160
+ * Kaloyan Raev, kaloyan.raev@sap.com
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+public interface INewServletClassDataModelProperties extends INewWebClassDataModelProperties {
+ /**
+ * Optional, boolean property used to specify whether to generate the init method.
+ * The default is false.
+ */
+ public static final String INIT = "NewServletClassDataModel.INIT"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the destroy method. The default is false.
+ */
+ public static final String DESTROY = "NewServletClassDataModel.DESTROY"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the getServletInfo method. The default is false.
+ */
+ public static final String GET_SERVLET_INFO = "NewServletClassDataModel.GET_SERVLET_INFO"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the getServletConfig method. The default is false.
+ */
+ public static final String GET_SERVLET_CONFIG = "NewServletClassDataModel.GET_SERVLET_CONFIG"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the service method. The default is false.
+ */
+ public static final String SERVICE = "NewServletClassDataModel.SERVICE"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doGet method. The default is true.
+ */
+ public static final String DO_GET = "NewServletClassDataModel.DO_GET"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doPost method.
+ * The default is true.
+ */
+ public static final String DO_POST = "NewServletClassDataModel.DO_POST"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doPut method. The default is false.
+ */
+ public static final String DO_PUT = "NewServletClassDataModel.DO_PUT"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doDelete method. The default is false.
+ */
+ public static final String DO_DELETE = "NewServletClassDataModel.DO_DELETE"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doHead method. The default is false.
+ */
+ public static final String DO_HEAD = "NewServletClassDataModel.DO_HEAD"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doOptions method. The default is false.
+ */
+ public static final String DO_OPTIONS = "NewServletClassDataModel.DO_OPTIONS"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doTrace method. The default is false.
+ */
+ public static final String DO_TRACE = "NewServletClassDataModel.DO_TRACE"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether to generate the doTrace method. The default is false.
+ */
+ public static final String TO_STRING = "NewServletClassDataModel.TO_STRING"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to determine if building JSP or servlet.
+ * The default is true.
+ */
+ public static final String IS_SERVLET_TYPE = "NewServletClassDataModel.IS_SERVLET_TYPE"; //$NON-NLS-1$
+
+ /**
+ * Optional, List property used to cache all the init params defined on the servlet.
+ */
+ public static final String INIT_PARAM = "NewServletClassDataModel.INIT_PARAM"; //$NON-NLS-1$
+
+ /**
+ * Optional, List propety used to cache all the servlet mappings for this servlet on the web application.
+ */
+ public static final String URL_MAPPINGS = "NewServletClassDataModel.URL_MAPPINGS"; //$NON-NLS-1$
+
+ /**
+ * Do not set! The javajet template file used in creating the annotated servlet template class
+ */
+ public static final String TEMPLATE_FILE = "NewServletClassDataModel.TEMPLATE_FILE"; //$NON-NLS-1$
+
+ /**
+ * Do not set! The javajet template file used in creating the non-annotated servlet template class
+ */
+ public static final String NON_ANNOTATED_TEMPLATE_FILE = "NewServletClassDataModel.NON_ANNOTATED_TEMPLATE_FILE"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java
new file mode 100644
index 0000000..5650d41
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
+import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
+
+public interface INewWebClassDataModelProperties extends INewJavaClassDataModelProperties, IAnnotationsDataModel {
+
+ /**
+ * Required, String property of the display name for the filter
+ */
+ public static final String DISPLAY_NAME = "NewServletClassDataModel.DISPLAY_NAME"; //$NON-NLS-1$
+
+ /**
+ * Optional, String property of the description info for the filter
+ */
+ public static final String DESCRIPTION = "NewServletClassDataModel.DESCRIPTION"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether or not to generate a new java class.
+ * The default is false.
+ */
+ public static final String USE_EXISTING_CLASS = "NewServletClassDataModel.USE_EXISTING_CLASS"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
+ */
+ public static final String REGISTER_IN_WEB_XML = "NewServletClassDataModel.REGISTER_IN_WEB_XML"; //$NON-NLS-1$
+
+ /**
+ * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
+ */
+ public static final String JAVA_EE_VERSION = "NewServletClassDataModel.JAVA_EE_VERSION"; //$NON-NLS-1$
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java
new file mode 100644
index 0000000..0ad2ccc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java
@@ -0,0 +1,225 @@
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.*;
+import org.eclipse.jst.j2ee.internal.common.operations.*;
+
+public class ListenerTemplate
+{
+ protected static String nl;
+ public static synchronized ListenerTemplate create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ ListenerTemplate result = new ListenerTemplate();
+ nl = null;
+ return result;
+ }
+
+ public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
+ protected final String TEXT_1 = "package "; //$NON-NLS-1$
+ protected final String TEXT_2 = ";"; //$NON-NLS-1$
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
+ protected final String TEXT_5 = ";"; //$NON-NLS-1$
+ protected final String TEXT_6 = NL;
+ protected final String TEXT_7 = NL;
+ protected final String TEXT_8 = "/**" + NL + " * Application Lifecycle Listener implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_9 = NL + " *"; //$NON-NLS-1$
+ protected final String TEXT_10 = NL + " * @web.listener"; //$NON-NLS-1$
+ protected final String TEXT_11 = NL + " */"; //$NON-NLS-1$
+ protected final String TEXT_12 = NL + "@WebListener"; //$NON-NLS-1$
+ protected final String TEXT_13 = NL + "public "; //$NON-NLS-1$
+ protected final String TEXT_14 = "abstract "; //$NON-NLS-1$
+ protected final String TEXT_15 = "final "; //$NON-NLS-1$
+ protected final String TEXT_16 = "class "; //$NON-NLS-1$
+ protected final String TEXT_17 = " extends "; //$NON-NLS-1$
+ protected final String TEXT_18 = " implements "; //$NON-NLS-1$
+ protected final String TEXT_19 = ", "; //$NON-NLS-1$
+ protected final String TEXT_20 = " {"; //$NON-NLS-1$
+ protected final String TEXT_21 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ protected final String TEXT_22 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_23 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_24 = "#"; //$NON-NLS-1$
+ protected final String TEXT_25 = "("; //$NON-NLS-1$
+ protected final String TEXT_26 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_27 = "("; //$NON-NLS-1$
+ protected final String TEXT_28 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_29 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_30 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_31 = "#"; //$NON-NLS-1$
+ protected final String TEXT_32 = "("; //$NON-NLS-1$
+ protected final String TEXT_33 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_34 = " "; //$NON-NLS-1$
+ protected final String TEXT_35 = "("; //$NON-NLS-1$
+ protected final String TEXT_36 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_37 = NL + "\t\t\treturn "; //$NON-NLS-1$
+ protected final String TEXT_38 = ";"; //$NON-NLS-1$
+ protected final String TEXT_39 = NL + " }"; //$NON-NLS-1$
+ protected final String TEXT_40 = NL + "\t" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_41 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ CreateListenerTemplateModel model = (CreateListenerTemplateModel) argument;
+
+ model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
+
+
+ if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
+
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append( model.getJavaPackageName() );
+ stringBuffer.append(TEXT_2);
+
+ }
+
+ stringBuffer.append(TEXT_3);
+
+ Collection<String> imports = model.getImports();
+ for (String anImport : imports) {
+
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append( anImport );
+ stringBuffer.append(TEXT_5);
+
+ }
+
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_9);
+
+ if (model.isAnnotated()) {
+
+ stringBuffer.append(TEXT_10);
+
+ }
+
+ stringBuffer.append(TEXT_11);
+
+ if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
+
+ stringBuffer.append(TEXT_12);
+
+}
+
+
+ if (model.isPublic()) {
+
+ stringBuffer.append(TEXT_13);
+
+ }
+
+ if (model.isAbstract()) {
+
+ stringBuffer.append(TEXT_14);
+
+ }
+
+ if (model.isFinal()) {
+
+ stringBuffer.append(TEXT_15);
+
+ }
+
+ stringBuffer.append(TEXT_16);
+ stringBuffer.append( model.getClassName() );
+
+ String superClass = model.getSuperclassName();
+ if (superClass != null && superClass.length() > 0) {
+
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append( superClass );
+
+ }
+
+ List<String> interfaces = model.getInterfaces();
+ if ( interfaces.size() > 0) {
+
+ stringBuffer.append(TEXT_18);
+
+ }
+
+ for (int i = 0; i < interfaces.size(); i++) {
+ String INTERFACE = interfaces.get(i);
+ if (i > 0) {
+
+ stringBuffer.append(TEXT_19);
+
+ }
+
+ stringBuffer.append( INTERFACE );
+
+ }
+
+ stringBuffer.append(TEXT_20);
+
+ if (!model.hasEmptySuperclassConstructor()) {
+
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_22);
+
+ }
+
+ if (model.shouldGenSuperclassConstructors()) {
+ List<Constructor> constructors = model.getConstructors();
+ for (Constructor constructor : constructors) {
+ if (constructor.isPublic() || constructor.isProtected()) {
+
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append( constructor.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_27);
+ stringBuffer.append( constructor.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_28);
+ stringBuffer.append( constructor.getParamsForCall() );
+ stringBuffer.append(TEXT_29);
+
+ }
+ }
+ }
+
+
+ if (model.shouldImplementAbstractMethods()) {
+ for (Method method : model.getUnimplementedMethods()) {
+
+ stringBuffer.append(TEXT_30);
+ stringBuffer.append( method.getContainingJavaClass() );
+ stringBuffer.append(TEXT_31);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_32);
+ stringBuffer.append( method.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_33);
+ stringBuffer.append( method.getReturnType() );
+ stringBuffer.append(TEXT_34);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_35);
+ stringBuffer.append( method.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_36);
+
+ String defaultReturnValue = method.getDefaultReturnValue();
+ if (defaultReturnValue != null) {
+
+ stringBuffer.append(TEXT_37);
+ stringBuffer.append( defaultReturnValue );
+ stringBuffer.append(TEXT_38);
+
+ }
+
+ stringBuffer.append(TEXT_39);
+
+ }
+ }
+
+ stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_41);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java
new file mode 100644
index 0000000..c928ef9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassDataModelProvider.java
@@ -0,0 +1,371 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DESTROY;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DO_FILTER;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.web.validation.UrlPattern;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+
+public class NewFilterClassDataModelProvider extends
+ NewWebClassDataModelProvider {
+
+ /**
+ * String array of the default, minimum required fully qualified Filter
+ * interfaces
+ */
+ private final static String[] FILTER_INTERFACES = { QUALIFIED_FILTER };
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (ABSTRACT_METHODS.equals(propertyName)) {
+ return false;
+ } else if (INIT.equals(propertyName)) {
+ return false;
+ } else if (DESTROY.equals(propertyName)) {
+ return false;
+ } else if (DO_FILTER.equals(propertyName)) {
+ return false;
+ }
+ // Otherwise return super implementation
+ return super.isPropertyEnabled(propertyName);
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own default operation
+ * for this data model provider. This implementation uses the
+ * AddFilterOperation to drive the filter creation. It will not return null.
+ *
+ * @see IDataModel#getDefaultOperation()
+ *
+ * @return IDataModelOperation AddFilterOperation
+ */
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new AddFilterOperation(getDataModel());
+ }
+
+ /**
+ * Subclasses may extend this method to add their own data model's
+ * properties as valid base properties.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
+ */
+ @Override
+ public Set getPropertyNames() {
+ // Add filter specific properties defined in this data model
+ Set propertyNames = super.getPropertyNames();
+
+ propertyNames.add(INIT);
+ propertyNames.add(DESTROY);
+ propertyNames.add(DO_FILTER);
+ propertyNames.add(INIT_PARAM);
+ propertyNames.add(FILTER_MAPPINGS);
+
+ return propertyNames;
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own default values for
+ * any of the properties in the data model hierarchy. This method does not
+ * accept a null parameter. It may return null. This implementation sets
+ * annotation use to be true, and to generate a filter with doFilter.
+ *
+ * @see NewJavaClassDataModelProvider#getDefaultProperty(String)
+ * @see IDataModelProvider#getDefaultProperty(String)
+ *
+ * @param propertyName
+ * @return Object default value of property
+ */
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(DESTROY))
+ return Boolean.TRUE;
+ else if (propertyName.equals(DO_FILTER))
+ return Boolean.TRUE;
+ else if (propertyName.equals(INIT))
+ return Boolean.TRUE;
+ else if (propertyName.equals(FILTER_MAPPINGS))
+ return getDefaultFilterMapping();
+ else if (propertyName.equals(INTERFACES))
+ return getFilterInterfaces();
+
+ // Otherwise check super for default value for property
+ return super.getDefaultProperty(propertyName);
+ }
+
+ /**
+ * Returns the default Url Mapping depending upon the display name of the
+ * Filter
+ *
+ * @return List containting the default Url Mapping
+ */
+ private Object getDefaultFilterMapping() {
+ List filterMappings = null;
+ String text = (String) getProperty(DISPLAY_NAME);
+ if (text != null) {
+ filterMappings = new ArrayList();
+ filterMappings.add(new FilterMappingItem(FilterMappingItem.URL_PATTERN, "/" + text)); //$NON-NLS-1$
+ }
+ return filterMappings;
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own validation on any
+ * of the valid data model properties in the hierarchy. This implementation
+ * adds validation for the init params, filter mappings, display name, and
+ * existing class fields specific to the filter java class creation. It does
+ * not accept a null parameter. This method will not return null.
+ *
+ * @see NewJavaClassDataModelProvider#validate(String)
+ *
+ * @param propertyName
+ * @return IStatus is property value valid?
+ */
+ @Override
+ public IStatus validate(String propertyName) {
+ // If our default is the superclass, we know it is ok
+ if (propertyName.equals(SUPERCLASS) && "".equals(getStringProperty(propertyName))) //$NON-NLS-1$
+ return WTPCommonPlugin.OK_STATUS;
+ // Validate init params
+ if (propertyName.equals(INIT_PARAM))
+ return validateInitParamList((List) getProperty(propertyName));
+ // Validate url pattern and servlet name mappings
+ if (propertyName.equals(FILTER_MAPPINGS))
+ return validateFilterMappingList((List) getProperty(FILTER_MAPPINGS));
+ // Validate the filter name in DD
+ if (propertyName.equals(DISPLAY_NAME))
+ return validateDisplayName(getStringProperty(propertyName));
+
+ // Otherwise defer to super to validate the property
+ return super.validate(propertyName);
+ }
+
+ /**
+ * This method is intended for internal use only. It will be used to
+ * validate the init params list to ensure there are not any duplicates.
+ * This method will accept a null paramter. It will not return null.
+ *
+ * @see NewFilterClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is init params list valid?
+ */
+ private IStatus validateInitParamList(List prop) {
+ if (prop != null && !prop.isEmpty()) {
+ // Ensure there are not duplicate entries in the list
+ boolean dup = hasDuplicatesInStringArrayList(prop);
+ if (dup) {
+ String msg = WebMessages.ERR_DUPLICATED_INIT_PARAMETER;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ }
+ // Return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ /**
+ * This method is intended for internal use only. This will validate the
+ * filter mappings list and ensure there are not duplicate entries. It will
+ * accept a null parameter. It will not return null.
+ *
+ * @see NewFilterClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is filter mapping list valid?
+ */
+ private IStatus validateFilterMappingList(List prop) {
+ if (prop != null && !prop.isEmpty()) {
+ // Ensure there are not duplicates in the mapping list
+ boolean dup = hasDuplicatesInFilterMappingItemList(prop);
+ if (dup) {
+ String msg = WebMessages.ERR_DUPLICATED_URL_MAPPING;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ String isValidValue = validateValue(prop);
+ if (isValidValue != null && isValidValue.length() > 0) {
+ NLS.bind(WebMessages.ERR_URL_PATTERN_INVALID, isValidValue);
+ String resourceString = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERN_INVALID, new String[]{isValidValue});
+ return WTPCommonPlugin.createErrorStatus(resourceString);
+ }
+ } else {
+ String msg = WebMessages.ERR_FILTER_MAPPING_EMPTY;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ // Return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ private boolean hasDuplicatesInFilterMappingItemList(List<IFilterMappingItem> input) {
+ // If list is null or empty return false
+ if (input == null) return false;
+ int n = input.size();
+ boolean dup = false;
+ // nested for loops to check each element to see if other elements are the same
+ for (int i = 0; i < n; i++) {
+ IFilterMappingItem item = input.get(i);
+ for (int j = i + 1; j < n; j++) {
+ IFilterMappingItem item2 = input.get(j);
+ if (item.getName().equals(item2.getName()) &&
+ item.getMappingType() == item2.getMappingType()) {
+ dup = true;
+ break;
+ }
+ }
+ if (dup) break;
+ }
+ // Return boolean status for duplicates
+ return dup;
+ }
+
+ /**
+ * This method is intended for internal use only. It provides a simple
+ * algorithm for detecting if there are invalid pattern's value in a list.
+ * It will accept a null parameter.
+ *
+ * @see NewFilterClassDataModelProvider#validateFilterMappingList(List)
+ *
+ * @param input
+ * @return String first invalid pattern's value
+ */
+ private String validateValue(List prop) {
+ if (prop == null) {
+ return ""; //$NON-NLS-1$
+ }
+ int size = prop.size();
+ for (int i = 0; i < size; i++) {
+ IFilterMappingItem filterMappingValue = (IFilterMappingItem) prop.get(i);
+ if (filterMappingValue.isUrlPatternType() &&
+ !UrlPattern.isValid(filterMappingValue.getName()))
+ return filterMappingValue.getName();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * This method will return the list of filter interfaces to be implemented
+ * for the new servlet java class. It will intialize the list using lazy
+ * initialization to the minimum interfaces required by the data model
+ * FILTER_INTERFACES. This method will not return null.
+ *
+ * @see #FILTER_INTERFACES
+ *
+ * @return List of servlet interfaces to be implemented
+ */
+ private List getFilterInterfaces() {
+ if (interfaceList == null) {
+ interfaceList = new ArrayList();
+ // Add minimum required list of servlet interfaces to be implemented
+ for (int i = 0; i < FILTER_INTERFACES.length; i++) {
+ interfaceList.add(FILTER_INTERFACES[i]);
+ }
+ }
+ // Return interface list
+ return interfaceList;
+ }
+
+ /**
+ * This method is intended for internal use only. This will validate whether
+ * the display name selected is a valid display name for the filter in the
+ * specified web application. It will make sure the name is not empty and
+ * that it doesn't already exist in the web app. This method will accept
+ * null as a parameter. It will not return null.
+ *
+ * @see NewFilterClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is filter display name valid?
+ */
+ private IStatus validateDisplayName(String prop) {
+ // Ensure the filter display name is not null or empty
+ if (prop == null || prop.trim().length() == 0) {
+ String msg = WebMessages.ERR_DISPLAY_NAME_EMPTY;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ if (getTargetProject() == null || getTargetComponent() == null)
+ return WTPCommonPlugin.OK_STATUS;
+
+ IModelProvider provider = ModelProviderManager.getModelProvider(getTargetProject());
+ Object mObj = provider.getModelObject();
+ if (mObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) mObj;
+
+ List filters = webApp.getFilters();
+ boolean exists = false;
+ // Ensure the display does not already exist in the web application
+ if (filters != null && !filters.isEmpty()) {
+ for (int i = 0; i < filters.size(); i++) {
+ String name = ((org.eclipse.jst.j2ee.webapplication.Filter) filters.get(i)).getName();
+ if (prop.equals(name))
+ exists = true;
+ }
+ }
+ // If the filter name already exists, throw an error
+ if (exists) {
+ String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_NAME_EXIST, new String[]{prop});
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ } else if (mObj instanceof org.eclipse.jst.javaee.web.WebApp) {
+ org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) mObj;
+
+ List filters = webApp.getFilters();
+ boolean exists = false;
+ // Ensure the display does not already exist in the web application
+ if (filters != null && !filters.isEmpty()) {
+ for (int i = 0; i < filters.size(); i++) {
+ String name = ((org.eclipse.jst.javaee.web.Filter) filters.get(i)).getFilterName();
+ if (prop.equals(name))
+ exists = true;
+ }
+ }
+ // If the filter name already exists, throw an error
+ if (exists) {
+ String msg = WebMessages.getResourceString(WebMessages.ERR_FILTER_NAME_EXIST, new String[] {prop});
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ }
+
+ // Otherwise, return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if (DISPLAY_NAME.equals(propertyName) || CLASS_NAME.equals(propertyName)) {
+ model.notifyPropertyChange(FILTER_MAPPINGS, IDataModel.DEFAULT_CHG);
+ }
+
+ return super.propertySet(propertyName, propertyValue);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java
new file mode 100644
index 0000000..a9675d0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewFilterClassOperation.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * The NewFilterClassOperation is an IDataModelOperation following the
+ * IDataModel wizard and operation framework.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * It extends ArtifactEditProviderOperation to provide filter specific java
+ * class generation.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * This operation is used by the AddFilterOperation to generate an
+ * non annotated java class for an added filter. It shares the
+ * NewFilterClassDataModelProvider with the AddFilterOperation to store the
+ * appropriate properties required to generate the new filter.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.AddFilterOperation
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider
+ *
+ * A WTPJetEmitter filter template is used to create the class with the filter template.
+ * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
+ * @see org.eclipse.jst.j2ee.internal.web.operations.CreateFilterTemplateModel
+ *
+ * Subclasses may extend this operation to provide their own specific filter
+ * java class generation. The execute method may be extended to do so. Also,
+ * generateUsingTemplates is exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class NewFilterClassOperation extends NewWebClassOperation {
+
+ /**
+ * folder location of the filter creation templates diretory
+ */
+ protected static final String TEMPLATE_FILE = "/templates/filter.javajet"; //$NON-NLS-1$
+
+ /**
+ * This is the constructor which should be used when creating a
+ * NewFilterClassOperation. An instance of the NewFilterClassDataModel
+ * should be passed in. This does not accept null parameter. It will not
+ * return null.
+ *
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ * @see NewFilterClassDataModel
+ *
+ * @param dataModel
+ * @return NewFilterClassOperation
+ */
+ public NewFilterClassOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ /**
+ * This method will create an instance of the CreateFilterTemplate model to
+ * be used in conjunction with the WTPJETEmitter. This method will not
+ * return null.
+ *
+ * @see CreateFilterTemplateModel
+ * @see NewFilterClassOperation#generateUsingTemplates(IProgressMonitor,
+ * IPackageFragment)
+ *
+ * @return CreateFilterTemplateModel
+ */
+ @Override
+ protected CreateFilterTemplateModel createTemplateModel() {
+ return new CreateFilterTemplateModel(model);
+ }
+
+ @Override
+ protected String getTemplateFile() {
+ return TEMPLATE_FILE;
+ }
+
+ @Override
+ protected FilterTemplate getTemplateImplementation() {
+ return FilterTemplate.create(null);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java
new file mode 100644
index 0000000..e509fd0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassDataModelProvider.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+
+/**
+ * The NewListenerClassDataModelProvider is a subclass of
+ * NewWebClassDataModelProvider and follows the IDataModel Operation and Wizard
+ * frameworks.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ *
+ * This data model provider is a subclass of the NewWebClassDataModelProvider,
+ * which stores base properties necessary in the creation of a default java
+ * class.
+ * @see org.eclipse.jst.j2ee.internal.common.operations.NewWebClassDataModelProvider
+ *
+ * The NewListenerClassDataModelProvider provides more specific properties for
+ * java class creation that are required in creating a listener java class. The
+ * data model provider is used to store these values for the
+ * NewListenerClassOperation.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.INewListenerClassDataModelProperties
+ * That operation will create the listener java class based on the settings
+ * defined here in the data model.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassOperation
+ *
+ * This data model properties implements the IAnnotationsDataModel to get the
+ * USE_ANNOTATIONS property for determining whether or not to generate an
+ * annotated java class.
+ * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
+ *
+ * Clients can subclass this data model provider to cache and provide their own
+ * specific attributes. They should also provide their own validation methods,
+ * properties interface, and default values for the properties they add.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class NewListenerClassDataModelProvider extends
+ NewWebClassDataModelProvider {
+
+ public static final String[] LISTENER_INTERFACES = {
+ QUALIFIED_SERVLET_CONTEXT_LISTENER,
+ QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER,
+ QUALIFIED_HTTP_SESSION_LISTENER,
+ QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER,
+ QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER,
+ QUALIFIED_HTTP_SESSION_BINDING_LISTENER,
+ QUALIFIED_SERVLET_REQUEST_LISTENER,
+ QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER
+ };
+
+ /**
+ * Subclasses may extend this method to provide their own default operation
+ * for this data model provider. This implementation uses the
+ * AddListenerOperation to drive the listener creation. It will not return
+ * null.
+ *
+ * @see IDataModel#getDefaultOperation()
+ *
+ * @return IDataModelOperation AddListenerOperation
+ */
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new AddListenerOperation(getDataModel());
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own validation on any
+ * of the valid data model properties in the hierarchy. It does not accept a
+ * null parameter. This method will not return null.
+ *
+ * @see NewJavaClassDataModelProvider#validate(String)
+ *
+ * @param propertyName
+ * @return IStatus is property value valid?
+ */
+ @Override
+ public IStatus validate(String propertyName) {
+ if (propertyName.equals(INTERFACES)){
+ if (!getBooleanProperty(USE_EXISTING_CLASS)) {
+ return validateListeners();
+ }
+ }
+ // Otherwise defer to super to validate the property
+ return super.validate(propertyName);
+ }
+
+
+ /**
+ * Checks if at least one of the application lifecycle listeners is
+ * selected.
+ */
+ private IStatus validateListeners() {
+ boolean atLeastOneSelected = false;
+ Object value = model.getProperty(INTERFACES);
+ if (value != null && (value instanceof List)) {
+ List interfaces = (List) value;
+ for (String iface : LISTENER_INTERFACES) {
+ if (interfaces.contains(iface)) {
+ atLeastOneSelected = true;
+ break;
+ }
+ }
+ }
+
+ if (atLeastOneSelected) {
+ return WTPCommonPlugin.OK_STATUS;
+ }
+ String msg = WebMessages.ERR_NO_LISTENER_SELECTED;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java
new file mode 100644
index 0000000..41c2d37
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewListenerClassOperation.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * The NewListenerClassOperation is an IDataModelOperation following the
+ * IDataModel wizard and operation framework.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * It extends ArtifactEditProviderOperation to provide listener specific java
+ * class generation.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * This operation is used by the AddListenerOperation to generate either an
+ * annotated or non annotated java class for an added application lifecycle listener.
+ * It shares the NewListenerClassDataModelProvider with the AddListenerOperation to
+ * store the appropriate properties required to generate the new listener.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.AddListenerOperation
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider
+ *
+ * In the annotated case, a WTPJetEmitter listener template is created and used
+ * to generate the listener java class with the embedded annotated tags.
+ * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
+ * @see org.eclipse.jst.j2ee.internal.web.operations.CreateListenerTemplateModel
+ *
+ * In the non annotated case, the same emitter is used to create the class with
+ * the non annotated listener template so the annotated tags are omitted.
+ *
+ * Subclasses may extend this operation to provide their own specific listener
+ * java class generation. The execute method may be extended to do so. Also,
+ * generateUsingTemplates is exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class NewListenerClassOperation extends NewWebClassOperation {
+
+ /**
+ * folder location of the listener creation templates directory
+ */
+ protected static final String TEMPLATE_FILE = "/templates/listener.javajet"; //$NON-NLS-1$
+
+ /**
+ * This is the constructor which should be used when creating a
+ * NewListenerClassOperation. An instance of the NewListenerClassDataModel
+ * should be passed in. This does not accept null parameter. It will not
+ * return null.
+ *
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ * @see NewListenerClassDataModel
+ *
+ * @param dataModel
+ * @return NewListenerClassOperation
+ */
+ public NewListenerClassOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ /**
+ * This method will create an instance of the CreateListenerTemplateModel to
+ * be used in conjunction with the WTPJETEmitter. This method will not
+ * return null.
+ *
+ * @see CreateListenerTemplateModel
+ * @see NewListenerClassOperation#generateUsingTemplates(IProgressMonitor,
+ * IPackageFragment)
+ *
+ * @return CreateListenerTemplateModel
+ */
+ @Override
+ protected CreateListenerTemplateModel createTemplateModel() {
+ return new CreateListenerTemplateModel(model);
+ }
+
+ @Override
+ protected String getTemplateFile() {
+ return TEMPLATE_FILE;
+ }
+
+ @Override
+ protected ListenerTemplate getTemplateImplementation() {
+ return ListenerTemplate.create(null);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java
new file mode 100644
index 0000000..9792723
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassDataModelProvider.java
@@ -0,0 +1,553 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kiril Mitov, k.mitov@sap.com - bug 204160
+ * Kaloyan Raev, kaloyan.raev@sap.com
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DESTROY;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_DELETE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_GET;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_HEAD;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_OPTIONS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_POST;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_PUT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.DO_TRACE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_CONFIG;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.GET_SERVLET_INFO;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.NON_ANNOTATED_TEMPLATE_FILE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.SERVICE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TEMPLATE_FILE;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.TO_STRING;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.J2EEFileUtil;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.web.validation.UrlPattern;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+
+/**
+ * The NewServletClassDataModelProvider is a subclass of
+ * NewWebClassDataModelProvider and follows the IDataModel Operation and Wizard
+ * frameworks.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ *
+ * This data model provider is a subclass of the NewWebClassDataModelProvider,
+ * which stores base properties necessary in the creation of a web artifact
+ * class.
+ *
+ * @see NewWebClassDataModelProvider
+ *
+ * The NewServletClassDataModelProvider provides more specific properties for
+ * java class creation that are required in creating a servlet java class. The
+ * data model provider is used to store these values for the
+ * NewServletClassOperation.
+ *
+ * @see INewServletClassDataModelProperties
+ *
+ * That operation will create the servlet java class based on the settings
+ * defined here in the data model.
+ *
+ * @see NewServletClassOperation
+ *
+ * This data model properties implements the IAnnotationsDataModel to get the
+ * USE_ANNOTATIONS property for determining whether or not to generate an
+ * annotated java class.
+ *
+ * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
+ *
+ * Clients can subclass this data model provider to cache and provide their own
+ * specific attributes. They should also provide their own validation methods,
+ * properties interface, and default values for the properties they add.
+ */
+public class NewServletClassDataModelProvider extends
+ NewWebClassDataModelProvider {
+
+ /**
+ * The fully qualified default servlet superclass: HttpServlet.
+ */
+ private final static String SERVLET_SUPERCLASS = QUALIFIED_HTTP_SERVLET;
+
+ /**
+ * String array of the default, minimum required fully qualified Servlet
+ * interfaces
+ */
+ private final static String[] SERVLET_INTERFACES = { QUALIFIED_SERVLET };
+
+ private final static String ANNOTATED_TEMPLATE_DEFAULT = "servlet.javajet"; //$NON-NLS-1$
+
+ private final static String NON_ANNOTATED_TEMPLATE_DEFAULT = "servlet.javajet"; //$NON-NLS-1$
+
+ /**
+ * Subclasses may extend this method to provide their own default operation
+ * for this data model provider. This implementation uses the
+ * AddServletOperation to drive the servlet creation. It will not return
+ * null.
+ *
+ * @see IDataModel#getDefaultOperation()
+ *
+ * @return IDataModelOperation AddServletOperation
+ */
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new AddServletOperation(model);
+ }
+
+ /**
+ * Subclasses may extend this method to add their own data model's
+ * properties as valid base properties.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
+ */
+ @Override
+ public Set getPropertyNames() {
+ // Add servlet specific properties defined in this data model
+ Set propertyNames = super.getPropertyNames();
+
+ propertyNames.add(INIT);
+ propertyNames.add(DESTROY);
+ propertyNames.add(GET_SERVLET_CONFIG);
+ propertyNames.add(GET_SERVLET_INFO);
+ propertyNames.add(SERVICE);
+ propertyNames.add(DO_GET);
+ propertyNames.add(DO_POST);
+ propertyNames.add(DO_PUT);
+ propertyNames.add(DO_DELETE);
+ propertyNames.add(DO_HEAD);
+ propertyNames.add(DO_OPTIONS);
+ propertyNames.add(DO_TRACE);
+ propertyNames.add(TO_STRING);
+ propertyNames.add(IS_SERVLET_TYPE);
+ propertyNames.add(INIT_PARAM);
+ propertyNames.add(URL_MAPPINGS);
+ propertyNames.add(NON_ANNOTATED_TEMPLATE_FILE);
+ propertyNames.add(TEMPLATE_FILE);
+
+ return propertyNames;
+ }
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (ABSTRACT_METHODS.equals(propertyName)) {
+ return ServletSupertypesValidator.isGenericServletSuperclass(model);
+ } else if (INIT.equals(propertyName) ||
+ DESTROY.equals(propertyName) ||
+ GET_SERVLET_CONFIG.equals(propertyName) ||
+ GET_SERVLET_INFO.equals(propertyName) ||
+ SERVICE.equals(propertyName)) {
+ boolean genericServlet = ServletSupertypesValidator.isGenericServletSuperclass(model);
+ boolean inherit = model.getBooleanProperty(ABSTRACT_METHODS);
+ return genericServlet && inherit;
+ } else if (DO_GET.equals(propertyName) ||
+ DO_POST.equals(propertyName) ||
+ DO_PUT.equals(propertyName) ||
+ DO_DELETE.equals(propertyName) ||
+ DO_HEAD.equals(propertyName) ||
+ DO_OPTIONS.equals(propertyName) ||
+ DO_TRACE.equals(propertyName)) {
+ boolean httpServlet = ServletSupertypesValidator.isHttpServletSuperclass(model);
+ boolean inherit = model.getBooleanProperty(ABSTRACT_METHODS);
+ return httpServlet && inherit;
+ }
+
+ // Otherwise return super implementation
+ return super.isPropertyEnabled(propertyName);
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own default values for
+ * any of the properties in the data model hierarchy. This method does not
+ * accept a null parameter. It may return null. This implementation sets
+ * annotation use to be true, and to generate a servlet with doGet and
+ * doPost.
+ *
+ * @see NewWebClassDataModelProvider#getDefaultProperty(String)
+ * @see IDataModelProvider#getDefaultProperty(String)
+ *
+ * @param propertyName
+ * @return Object default value of property
+ */
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ // Generate a doPost and doGet methods by default only if a class
+ // extending HttpServlet is selected
+ if (propertyName.equals(DO_POST) || propertyName.equals(DO_GET)) {
+ if (ServletSupertypesValidator.isHttpServletSuperclass(model))
+ return Boolean.TRUE;
+ }
+
+ // Generate a service method by default only if a class
+ // not extending HttpServlet is selected
+ if (propertyName.equals(SERVICE)) {
+ if (!ServletSupertypesValidator.isHttpServletSuperclass(model))
+ return Boolean.TRUE;
+ }
+
+ if (propertyName.equals(INIT) || propertyName.equals(DESTROY) ||
+ propertyName.equals(GET_SERVLET_CONFIG) || propertyName.equals(GET_SERVLET_INFO)) {
+ if (!ServletSupertypesValidator.isGenericServletSuperclass(model))
+ return Boolean.TRUE;
+ }
+
+ // Use servlet by default
+ else if (propertyName.equals(IS_SERVLET_TYPE))
+ return Boolean.TRUE;
+ else if (propertyName.equals(DISPLAY_NAME)) {
+ String className = getStringProperty(CLASS_NAME);
+ if (className.endsWith(J2EEFileUtil.DOT_JSP)) {
+ int index = className.lastIndexOf("/"); //$NON-NLS-1$
+ className = className.substring(index+1,className.length()-4);
+ } else {
+ className = Signature.getSimpleName(className);
+ }
+ return className;
+ }
+ else if (propertyName.equals(URL_MAPPINGS))
+ return getDefaultUrlMapping();
+ else if (propertyName.equals(INTERFACES))
+ return getServletInterfaces();
+ else if (propertyName.equals(SUPERCLASS))
+ return SERVLET_SUPERCLASS;
+ else if (propertyName.equals(TEMPLATE_FILE))
+ return ANNOTATED_TEMPLATE_DEFAULT;
+ else if (propertyName.equals(NON_ANNOTATED_TEMPLATE_FILE))
+ return NON_ANNOTATED_TEMPLATE_DEFAULT;
+
+ // Otherwise check super for default value for property
+ return super.getDefaultProperty(propertyName);
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own validation on any
+ * of the valid data model properties in the hierarchy. This implementation
+ * adds validation for the init params, servlet mappings, display name, and
+ * existing class fields specific to the servlet java class creation. It
+ * does not accept a null parameter. This method will not return null.
+ *
+ * @see NewWebClassDataModelProvider#validate(String)
+ *
+ * @param propertyName
+ * @return IStatus is property value valid?
+ */
+ @Override
+ public IStatus validate(String propertyName) {
+ // Validate super class
+ if (propertyName.equals(SUPERCLASS))
+ return validateSuperClassName(getStringProperty(propertyName));
+ // Validate init params
+ if (propertyName.equals(INIT_PARAM))
+ return validateInitParamList((List) getProperty(propertyName));
+ // Validate servlet mappings
+ if (propertyName.equals(URL_MAPPINGS))
+ return validateURLMappingList((List) getProperty(propertyName));
+ // Validate the servlet name in DD
+ if (propertyName.equals(DISPLAY_NAME))
+ return validateDisplayName(getStringProperty(propertyName));
+
+ // Otherwise defer to super to validate the property
+ return super.validate(propertyName);
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ boolean result = false;
+
+ if (SUPERCLASS.equals(propertyName)) {
+ model.notifyPropertyChange(ABSTRACT_METHODS, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(INIT, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DESTROY, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(GET_SERVLET_CONFIG, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(GET_SERVLET_INFO, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(SERVICE, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_GET, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_POST, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_PUT, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_DELETE, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_HEAD, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_OPTIONS, IDataModel.ENABLE_CHG);
+ model.notifyPropertyChange(DO_TRACE, IDataModel.ENABLE_CHG);
+
+ if (!hasSuperClass()) {
+ model.setProperty(ABSTRACT_METHODS, null);
+ model.setProperty(INIT, null);
+ model.setProperty(DESTROY, null);
+ model.setProperty(GET_SERVLET_CONFIG, null);
+ model.setProperty(GET_SERVLET_INFO, null);
+ model.setProperty(SERVICE, null);
+ model.setProperty(DO_GET, null);
+ model.setProperty(DO_POST, null);
+ model.setProperty(DO_PUT, null);
+ model.setProperty(DO_DELETE, null);
+ model.setProperty(DO_HEAD, null);
+ model.setProperty(DO_OPTIONS, null);
+ model.setProperty(DO_TRACE, null);
+ }
+
+ model.notifyPropertyChange(ABSTRACT_METHODS, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(INIT, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DESTROY, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(GET_SERVLET_CONFIG, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(GET_SERVLET_INFO, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(SERVICE, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_GET, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_POST, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_PUT, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_DELETE, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_HEAD, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_OPTIONS, IDataModel.DEFAULT_CHG);
+ model.notifyPropertyChange(DO_TRACE, IDataModel.DEFAULT_CHG);
+
+ if (!ServletSupertypesValidator.isServletSuperclass(model)) {
+ List ifaces = (List) model.getProperty(INTERFACES);
+ ifaces.add(QUALIFIED_SERVLET);
+ }
+ }
+
+ return result || super.propertySet(propertyName, propertyValue);
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own validation of the specified java
+ * classname. This implementation will ensure the class name is not set to Servlet and then will
+ * forward on to the NewJavaClassDataModel to validate the class name as valid java. This method
+ * does not accept null as a parameter. It will not return null.
+ * It will check if the super class extends the javax.servlet.Servlet interface also.
+ *
+ * @param className
+ * @return IStatus is java classname valid?
+ */
+ protected IStatus validateSuperClassName(String superclassName) {
+ //If the servlet implements javax.servlet.Servlet, we do not need a super class
+ if (ServletSupertypesValidator.isGenericServletSuperclass(model))
+ return WTPCommonPlugin.OK_STATUS;
+
+ // Check the super class as a java class
+ IStatus status = null;
+ if (superclassName.trim().length() > 0) {
+ status = super.validate(SUPERCLASS);
+ if (status.getSeverity() == IStatus.ERROR)
+ return status;
+ }
+
+ if (!ServletSupertypesValidator.isServletSuperclass(model))
+ return WTPCommonPlugin.createErrorStatus(WebMessages.ERR_SERVLET_INTERFACE);
+
+ return status;
+ }
+
+ /**
+ * Returns the default Url Mapping depending upon the display name of the Servlet
+ *
+ * @return List containting the default Url Mapping
+ */
+ private Object getDefaultUrlMapping() {
+ List urlMappings = null;
+ String text = (String) getProperty(DISPLAY_NAME);
+ if (text != null) {
+ urlMappings = new ArrayList();
+ urlMappings.add(new String[] {"/" + text}); //$NON-NLS-1$
+ }
+ return urlMappings;
+ }
+
+ /**
+ * This method is intended for internal use only. It will be used to
+ * validate the init params list to ensure there are not any duplicates.
+ * This method will accept a null paramter. It will not return null.
+ *
+ * @see NewServletClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is init params list valid?
+ */
+ private IStatus validateInitParamList(List prop) {
+ if (prop != null && !prop.isEmpty()) {
+ // Ensure there are not duplicate entries in the list
+ boolean dup = hasDuplicatesInStringArrayList(prop);
+ if (dup) {
+ String msg = WebMessages.ERR_DUPLICATED_INIT_PARAMETER;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ }
+ // Return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ /**
+ * This method is intended for internal use only. This will validate the
+ * servlet mappings list and ensure there are not duplicate entries. It will
+ * accept a null parameter. It will not return null.
+ *
+ * @see NewServletClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is servlet mapping list valid?
+ */
+ private IStatus validateURLMappingList(List prop) {
+ if (prop != null && !prop.isEmpty()) {
+ // Ensure there are not duplicates in the mapping list
+ boolean dup = hasDuplicatesInStringArrayList(prop);
+ if (dup) {
+ String msg = WebMessages.ERR_DUPLICATED_URL_MAPPING;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ String isValidValue = validateValue(prop);
+ if (isValidValue != null && isValidValue.length() > 0) {
+ NLS.bind(WebMessages.ERR_URL_PATTERN_INVALID, isValidValue);
+ String resourceString = WebMessages.getResourceString(WebMessages.ERR_URL_PATTERN_INVALID, new String[]{isValidValue});
+ return WTPCommonPlugin.createErrorStatus(resourceString);
+ }
+ } else {
+ String msg = WebMessages.ERR_URL_MAPPING_LIST_EMPTY;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ // Return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ /**
+ * This method is intended for internal use only. It provides a simple
+ * algorithm for detecting if there are invalid pattern's value in a list.
+ * It will accept a null parameter.
+ *
+ * @see NewServletClassDataModelProvider#validateURLMappingList(List)
+ *
+ * @param input
+ * @return String first invalid pattern's value?
+ */
+ private String validateValue(List prop) {
+ if (prop == null) {
+ return ""; //$NON-NLS-1$
+ }
+ int size = prop.size();
+ for (int i = 0; i < size; i++) {
+ String urlMappingValue = ((String[]) prop.get(i))[0];
+ if (!UrlPattern.isValid(urlMappingValue))
+ return urlMappingValue;
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * This method will return the list of servlet interfaces to be implemented
+ * for the new servlet java class. It will intialize the list using lazy
+ * initialization to the minimum interfaces required by the data model
+ * SERVLET_INTERFACES. This method will not return null.
+ *
+ * @see #SERVLET_INTERFACES
+ *
+ * @return List of servlet interfaces to be implemented
+ */
+ private List getServletInterfaces() {
+ if (interfaceList == null) {
+ interfaceList = new ArrayList();
+ // Add minimum required list of servlet interfaces to be implemented
+ for (int i = 0; i < SERVLET_INTERFACES.length; i++) {
+ interfaceList.add(SERVLET_INTERFACES[i]);
+ }
+ // Remove the javax.servlet.Servlet interface from the list if the
+ // superclass already implements it
+ if (ServletSupertypesValidator.isServletSuperclass(model)) {
+ interfaceList.remove(QUALIFIED_SERVLET);
+ }
+ }
+ // Return interface list
+ return interfaceList;
+ }
+
+ /**
+ * This method is intended for internal use only. This will validate whether
+ * the display name selected is a valid display name for the servlet in the
+ * specified web application. It will make sure the name is not empty and
+ * that it doesn't already exist in the web app. This method will accept
+ * null as a parameter. It will not return null.
+ *
+ * @see NewServletClassDataModelProvider#validate(String)
+ *
+ * @param prop
+ * @return IStatus is servlet display name valid?
+ */
+ private IStatus validateDisplayName(String prop) {
+ // Ensure the servlet display name is not null or empty
+ if (prop == null || prop.trim().length() == 0) {
+ String msg = WebMessages.ERR_DISPLAY_NAME_EMPTY;
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ if (getTargetProject() == null || getTargetComponent() == null)
+ return WTPCommonPlugin.OK_STATUS;
+
+ IModelProvider provider = ModelProviderManager.getModelProvider(getTargetProject());
+ Object mObj = provider.getModelObject();
+ if (mObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
+ org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) mObj;
+
+ List servlets = webApp.getServlets();
+ boolean exists = false;
+ // Ensure the display does not already exist in the web application
+ if (servlets != null && !servlets.isEmpty()) {
+ for (int i = 0; i < servlets.size(); i++) {
+ String name = ((org.eclipse.jst.j2ee.webapplication.Servlet) servlets.get(i)).getServletName();
+ if (prop.equals(name))
+ exists = true;
+ }
+ }
+ // If the servlet name already exists, throw an error
+ if (exists) {
+ String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_NAME_EXIST, new String[]{prop});
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ } else if (mObj instanceof org.eclipse.jst.javaee.web.WebApp) {
+ org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) mObj;
+
+ List servlets = webApp.getServlets();
+ boolean exists = false;
+ // Ensure the display does not already exist in the web application
+ if (servlets != null && !servlets.isEmpty()) {
+ for (int i = 0; i < servlets.size(); i++) {
+ String name = ((org.eclipse.jst.javaee.web.Servlet) servlets.get(i)).getServletName();
+ if (prop.equals(name))
+ exists = true;
+ }
+ }
+ // If the servlet name already exists, throw an error
+ if (exists) {
+ String msg = WebMessages.getResourceString(WebMessages.ERR_SERVLET_NAME_EXIST, new String[]{prop});
+ return WTPCommonPlugin.createErrorStatus(msg);
+ }
+ }
+
+ // Otherwise, return OK
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java
new file mode 100644
index 0000000..72b1809
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewServletClassOperation.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kaloyan Raev, kaloyan.raev@sap.com
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * The NewServletClassOperation is an IDataModelOperation following the
+ * IDataModel wizard and operation framework.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * It extends ArtifactEditProviderOperation to provide servlet specific java
+ * class generation.
+ * @see org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation
+ *
+ * This operation is used by the AddServletOperation to generate either an
+ * annotated or non annotated java class for an added servlet. It shares the
+ * NewServletClassDataModelProvider with the AddServletOperation to store the
+ * appropriate properties required to generate the new servlet.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation
+ * @see org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider
+ *
+ * In the annotated case, a WTPJetEmitter servlet template is created and used
+ * to generate the servlet java class with the embedded annotated tags.
+ * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
+ * @see org.eclipse.jst.j2ee.internal.web.operations.CreateServletTemplateModel
+ *
+ * In the non annotated case, the same emitter is used to create the class with
+ * the non annotated servlet template so the annotated tags are omitted.
+ *
+ * Subclasses may extend this operation to provide their own specific servlet
+ * java class generation. The execute method may be extended to do so. Also,
+ * generateUsingTemplates is exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public class NewServletClassOperation extends NewWebClassOperation {
+
+ /**
+ * folder location of the servlet creation templates diretory
+ */
+ protected static final String TEMPLATE_DIR = "/templates/"; //$NON-NLS-1$
+
+ /**
+ * location of the servlet creation template file
+ */
+ protected static final String TEMPLATE_FILE = "/templates/servlet.javajet"; //$NON-NLS-1$
+
+ /**
+ * This is the constructor which should be used when creating a
+ * NewServletClassOperation. An instance of the NewServletClassDataModel
+ * should be passed in. This does not accept null parameter. It will not
+ * return null.
+ *
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ * @see NewServletClassDataModel
+ *
+ * @param dataModel
+ * @return NewServletClassOperation
+ */
+ public NewServletClassOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ /**
+ * This method will create an instance of the CreateServletTemplate model to
+ * be used in conjunction with the WTPJETEmitter. This method will not
+ * return null.
+ *
+ * @see CreateServletTemplateModel
+ * @see NewServletClassOperation#generateUsingTemplates(IProgressMonitor,
+ * IPackageFragment)
+ *
+ * @return CreateServletTemplateModel
+ */
+ @Override
+ protected CreateServletTemplateModel createTemplateModel() {
+ return new CreateServletTemplateModel(model);
+ }
+
+ @Override
+ protected String getTemplateFile() {
+ return TEMPLATE_FILE;
+ }
+
+ @Override
+ protected ServletTemplate getTemplateImplementation() {
+ return ServletTemplate.create(null);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
new file mode 100644
index 0000000..54e84c0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CONSTRUCTOR;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.MODIFIER_ABSTRACT;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.MODIFIER_PUBLIC;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SOURCE_FOLDER;
+import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
+import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
+
+import java.io.File;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import org.eclipse.wst.common.componentcore.internal.util.FacetedProjectUtilities;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+
+/**
+ * The NewWebClassDataModelProvider is a subclass of
+ * NewJavaClassDataModelProvider and follows the IDataModel Operation and Wizard
+ * frameworks.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ *
+ * This data model provider is a subclass of the NewJavaClassDataModelProvider,
+ * which stores base properties necessary in the creation of a default java
+ * class.
+ * @see org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider
+ *
+ * The NewWebClassDataModelProvider provides more specific properties for java
+ * class creation that are required in creating a web artifact java class. The
+ * data model provider is used to store these values for the
+ * AddWebClassOperation.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties
+ * That operation will create the web artifact java class based on the
+ * settings defined here in the data model.
+ * @see org.eclipse.jst.j2ee.internal.web.operations.AddWebClassOperation
+ *
+ * This data model properties implements the IAnnotationsDataModel to get the
+ * USE_ANNOTATIONS property for determining whether or not to generate an
+ * annotated java class.
+ * @see org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel
+ *
+ * Clients can subclass this data model provider to cache and provide their own
+ * specific attributes. They should also provide their own validation methods,
+ * properties interface, and default values for the properties they add.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public abstract class NewWebClassDataModelProvider extends NewJavaClassDataModelProvider {
+
+ /**
+ * The fully qualified default superclass.
+ */
+ private final static String DEFAULT_SUPERCLASS = ""; //$NON-NLS-1$
+
+ /**
+ * The cache of all the interfaces the web artifact java class will
+ * implement.
+ */
+ protected List interfaceList;
+
+ private String classNameCache = ""; //$NON-NLS-1$
+ private String existingClassNameCache = ""; //$NON-NLS-1$
+
+ private static boolean useAnnotations = false;
+
+ /**
+ * Subclasses may extend this method to provide their own determination of
+ * whether or not certain properties should be disabled or enabled. This
+ * method does not accept null parameter. It will not return null. This
+ * implementation makes sure annotation support is only allowed on web
+ * projects of J2EE version 1.3 or higher.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#isPropertyEnabled(String)
+ * @see IAnnotationsDataModel#USE_ANNOTATIONS
+ *
+ * @param propertyName
+ * @return boolean should property be enabled?
+ */
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ // Annotations should only be enabled on a valid j2ee project of version 1.3 or higher
+ if (USE_ANNOTATIONS.equals(propertyName)) {
+ return !getBooleanProperty(USE_EXISTING_CLASS) && isAnnotationsSupported();
+ } else if (MODIFIER_PUBLIC.equals(propertyName)) {
+ return false;
+ } else if (MODIFIER_ABSTRACT.equals(propertyName)) {
+ return false;
+ } else if (CONSTRUCTOR.equals(propertyName)) {
+ return hasSuperClass();
+ }
+ // Otherwise return super implementation
+ return super.isPropertyEnabled(propertyName);
+ }
+
+ /**
+ * Subclasses may extend this method to add their own data model's
+ * properties as valid base properties.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames()
+ */
+ @Override
+ public Set getPropertyNames() {
+ // Add web artifact specific properties defined in this data model
+ Set propertyNames = super.getPropertyNames();
+ propertyNames.add(REGISTER_IN_WEB_XML);
+ propertyNames.add(DISPLAY_NAME);
+ propertyNames.add(DESCRIPTION);
+ propertyNames.add(USE_EXISTING_CLASS);
+ propertyNames.add(USE_ANNOTATIONS);
+ propertyNames.add(JAVA_EE_VERSION);
+
+ return propertyNames;
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own default values for
+ * any of the properties in the data model hierarchy. This method does not
+ * accept a null parameter. It may return null. This implementation sets
+ * annotation use to be true.
+ *
+ * @see NewJavaClassDataModelProvider#getDefaultProperty(String)
+ * @see IDataModelProvider#getDefaultProperty(String)
+ *
+ * @param propertyName
+ * @return Object default value of property
+ */
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(DISPLAY_NAME))
+ return Signature.getSimpleName(getStringProperty(CLASS_NAME));
+ else if (propertyName.equals(USE_ANNOTATIONS))
+ return shouldDefaultAnnotations();
+ else if (propertyName.equals(SUPERCLASS))
+ return DEFAULT_SUPERCLASS;
+ else if (propertyName.equals(USE_EXISTING_CLASS))
+ return Boolean.FALSE;
+ else if (propertyName.equals(CONSTRUCTOR))
+ return hasSuperClass();
+ else if (propertyName.equals(REGISTER_IN_WEB_XML)){
+ return !isJavaEE6Project();
+ } else if (JAVA_EE_VERSION.equals(propertyName)){
+ return getJavaEEVersion();
+ }
+ // Otherwise check super for default value for property
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @SuppressWarnings("restriction")
+ public boolean isJavaEE6Project() {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
+ if (project != null && project.isAccessible()){
+ try {
+ return (FacetedProjectFramework.hasProjectFacet(project, WebFacetUtils.WEB_FACET.getId(), WebFacetUtils.WEB_30.getVersionString())
+ || FacetedProjectFramework.hasProjectFacet(project, WebFacetUtils.WEBFRAGMENT_FACET.getId(), WebFacetUtils.WEBFRAGMENT_30.getVersionString()));
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("restriction")
+ public String getJavaEEVersion() {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
+ String id = null;
+ if(JavaEEProjectUtilities.isDynamicWebProject(project)){
+ id = WebFacetUtils.WEB_FACET.getId();
+ }else {
+ id = WebFacetUtils.WEBFRAGMENT_FACET.getId();
+ }
+ return FacetedProjectUtilities.getProjectFacetVersion(project, id).getVersionString();
+ }
+
+ /**
+ * Subclasses may extend this method to add their own specific behavior when
+ * a certain property in the data model hierarchy is set. this method does
+ * not accept null for the property name, but it will for propertyValue. It
+ * will not return null. It will return false if the set fails. This
+ * implementation verifies the display name is set to the class name, that
+ * the annotations is disabled/enabled properly, and that the target project
+ * name is determined from the source folder setting.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#propertySet(String,
+ * Object)
+ *
+ * @param propertyName
+ * @param propertyValue
+ * @return boolean was property set?
+ */
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ // If annotations is changed, notify an enablement change
+ if (propertyName.equals(USE_ANNOTATIONS)) {
+ useAnnotations = ((Boolean) propertyValue).booleanValue();
+ if (useAnnotations && !isAnnotationsSupported())
+ return true;
+ model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
+ }
+ // If the source folder is changed, ensure we have the correct project name
+ if (propertyName.equals(SOURCE_FOLDER)) {
+ // Get the project name from the source folder name
+ String sourceFolder = (String) propertyValue;
+ int index = sourceFolder.indexOf(File.separator);
+ String projectName = sourceFolder;
+ if (index == 0)
+ projectName = sourceFolder.substring(1);
+ index = projectName.indexOf(File.separator);
+ if (index != -1) {
+ projectName = projectName.substring(0, index);
+ setProperty(PROJECT_NAME, projectName);
+ }
+ }
+ // Call super to set the property on the data model
+ boolean result = super.propertySet(propertyName, propertyValue);
+ // If class name is changed, update the display name to be the same
+ if (propertyName.equals(CLASS_NAME) && !model.isPropertySet(DISPLAY_NAME)) {
+ model.notifyPropertyChange(DISPLAY_NAME, IDataModel.DEFAULT_CHG);
+ }
+ // After the property is set, if project changed, update the nature and the annotations
+ // enablement
+ if (propertyName.equals(COMPONENT_NAME)) {
+ model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
+ }
+ // After property is set, if annotations is set to true, update its value based on the new
+ // level of the project
+ if (getBooleanProperty(USE_ANNOTATIONS)) {
+ if (!isAnnotationsSupported())
+ setBooleanProperty(USE_ANNOTATIONS, false);
+ }
+ if (propertyName.equals(USE_EXISTING_CLASS)) {
+ model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
+
+ if (((Boolean) propertyValue).booleanValue()) {
+ classNameCache = getStringProperty(CLASS_NAME);
+ setProperty(CLASS_NAME, existingClassNameCache);
+ } else {
+ existingClassNameCache = getStringProperty(CLASS_NAME);
+ setProperty(CLASS_NAME, classNameCache);
+ }
+ }
+ // if super class is changed, notify the constructor checkbox to update
+ // its enabled state
+ if (SUPERCLASS.equals(propertyName)) {
+ model.notifyPropertyChange(CONSTRUCTOR, IDataModel.ENABLE_CHG);
+ if (!hasSuperClass()) {
+ model.setProperty(CONSTRUCTOR, null);
+ }
+ model.notifyPropertyChange(CONSTRUCTOR, IDataModel.DEFAULT_CHG);
+ }
+
+ // Return whether property was set
+ return result;
+ }
+
+ /**
+ * This method is used to determine if annotations should try to enable
+ * based on workspace settings
+ *
+ * @return does any valid annotation provider or xdoclet handler exist
+ */
+ //TODO add this method back in for defect 146696
+// protected boolean isAnnotationProviderDefined() {
+// boolean isControllerEnabled = AnnotationsControllerManager.INSTANCE.isAnyAnnotationsSupported();
+// final String preferred = AnnotationPreferenceStore.getProperty(AnnotationPreferenceStore.ANNOTATIONPROVIDER);
+// IAnnotationProvider annotationProvider = null;
+// boolean isProviderEnabled = false;
+// if (preferred != null) {
+// try {
+// annotationProvider = AnnotationUtilities.findAnnotationProviderByName(preferred);
+// } catch (Exception ex) {
+// //Default
+// }
+// if (annotationProvider != null && annotationProvider.isValid())
+// isProviderEnabled = true;
+// }
+// return isControllerEnabled || isProviderEnabled;
+// }
+
+ /**
+ * This method checks to see if valid annotation providers exist and if
+ * valid project version levels exist.
+ *
+ * @return should annotations be supported for this project in this
+ * workspace
+ */
+ protected boolean isAnnotationsSupported() {
+ //TODO add this check back in for defect 146696
+// if (!isAnnotationProviderDefined())
+// return false;
+ if (!model.isPropertySet(PROJECT_NAME))
+ return true;
+ if (getStringProperty(PROJECT_NAME).equals("")) //$NON-NLS-1$
+ return true;
+ IProject project = ProjectUtilities.getProject(getStringProperty(PROJECT_NAME));
+ String moduleName = getStringProperty(COMPONENT_NAME);
+ if (project == null || moduleName == null || moduleName.equals(""))return true; //$NON-NLS-1$
+ int j2eeVersion = J2EEVersionUtil.convertVersionStringToInt(J2EEProjectUtilities.getJ2EEProjectVersion(project));
+
+ return j2eeVersion > J2EEVersionConstants.VERSION_1_2;
+
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own validation on any
+ * of the valid data model properties in the hierarchy. It does not accept a
+ * null parameter. This method will not return null.
+ *
+ * @see NewJavaClassDataModelProvider#validate(String)
+ *
+ * @param propertyName
+ * @return IStatus is property value valid?
+ */
+ @Override
+ public IStatus validate(String propertyName) {
+ if (propertyName.equals(SUPERCLASS)) {
+ // If our default is the superclass, we know it is ok
+ if (getStringProperty(propertyName).equals(DEFAULT_SUPERCLASS))
+ return WTPCommonPlugin.OK_STATUS;
+ }
+
+ if (propertyName.equals(CLASS_NAME)) {
+ if (getStringProperty(propertyName).length() !=0 && getBooleanProperty(USE_EXISTING_CLASS)) {
+ return WTPCommonPlugin.OK_STATUS;
+ }
+ }
+
+ // Otherwise defer to super to validate the property
+ return super.validate(propertyName);
+ }
+
+ /**
+ * This method is intended for internal use only. It provides a simple
+ * algorithm for detecting if there are duplicate entries in a list. It will
+ * accept a null parameter. It will not return null.
+ *
+ * @see NewWebClassDataModelProvider#validateInitParamList(List)
+ * @see NewWebClassDataModelProvider#validateURLMappingList(List)
+ *
+ * @param input
+ * @return boolean are there dups in the list?
+ */
+ protected boolean hasDuplicatesInStringArrayList(List input) {
+ // If list is null or empty return false
+ if (input == null)
+ return false;
+ int n = input.size();
+ boolean dup = false;
+ // nested for loops to check each element to see if other elements are the same
+ for (int i = 0; i < n; i++) {
+ String[] sArray1 = (String[]) input.get(i);
+ for (int j = i + 1; j < n; j++) {
+ String[] sArray2 = (String[]) input.get(j);
+ if (isTwoStringArraysEqual(sArray1, sArray2)) {
+ dup = true;
+ break;
+ }
+ }
+ if (dup)
+ break;
+ }
+ // Return boolean status for duplicates
+ return dup;
+ }
+
+ /**
+ * This method is intended for internal use only. This checks to see if the
+ * two string arrays are equal. If either of the arrays are null or empty,
+ * it returns false.
+ *
+ * @see NewWebClassDataModelProvider#hasDuplicatesInStringArrayList(List)
+ *
+ * @param sArray1
+ * @param sArray2
+ * @return boolean are Arrays equal?
+ */
+ protected boolean isTwoStringArraysEqual(String[] sArray1, String[] sArray2) {
+ // If either array is null, return false
+ if (sArray1 == null || sArray2 == null)
+ return false;
+ int n1 = sArray1.length;
+ int n2 = sArray1.length;
+ // If either array is empty, return false
+ if (n1 == 0 || n2 == 0)
+ return false;
+ // If they don't have the same length, return false
+ if (n1 != n2)
+ return false;
+ // If their first elements do not match, return false
+ if (!sArray1[0].equals(sArray2[0]))
+ return false;
+ // Otherwise return true
+ return true;
+ }
+
+ protected boolean hasSuperClass() {
+ String superClass = model.getStringProperty(SUPERCLASS);
+ return (superClass == null) ? false : superClass.trim().length() > 0;
+ }
+
+ /**
+ * @return boolean should the default annotations be true?
+ */
+ private static Boolean shouldDefaultAnnotations() {
+ if (useAnnotations)
+ return Boolean.TRUE;
+ return Boolean.FALSE;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java
new file mode 100644
index 0000000..0cb28f7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassOperation.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
+
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsController;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager;
+import org.eclipse.jst.common.internal.annotations.controller.AnnotationsControllerManager.Descriptor;
+import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.componentcore.internal.operation.ArtifactEditProviderOperation;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * The NewWebClassOperation is an IDataModelOperation following the IDataModel
+ * wizard and operation framework.
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ *
+ * It extends AbstractDataModelOperation to provide web artifact specific java
+ * class generation.
+ * @see AbstractDataModelOperation
+ *
+ * This operation is used by the AddWebClassOperation to generate either an
+ * annotated or non annotated java class for an added web artifact. It shares
+ * the NewWebClassDataModelProvider with the AddWebClassOperation to store the
+ * appropriate properties required to generate the new web artifact.
+ *
+ * @see AddWebClassOperation
+ * @see NewWebClassDataModelProvider
+ *
+ * In the annotated case, a WTPJetEmitter listener template is created and used
+ * to generate the listener java class with the embedded annotated tags.
+ * @see org.eclipse.jst.j2ee.internal.project.WTPJETEmitter
+ * @see CreateWebClassTemplateModel
+ *
+ * In the non annotated case, the same emitter is used to create the class with
+ * the non annotated web artifact template so the annotated tags are omitted.
+ *
+ * Subclasses may extend this operation to provide their own specific web
+ * artifact java class generation. The execute method may be extended to do so.
+ * Also, generateUsingTemplates is exposed.
+ *
+ * The use of this class is EXPERIMENTAL and is subject to substantial changes.
+ */
+public abstract class NewWebClassOperation extends NewJavaEEArtifactClassOperation {
+
+ /**
+ * XDoclet facet constants
+ */
+ private static final String JST_WEB_XDOCLET_VERSION = "1.2.3"; //$NON-NLS-1$
+
+ /**
+ * variable for the web plugin
+ */
+ protected static final String WEB_PLUGIN = "WEB_PLUGIN"; //$NON-NLS-1$
+
+ /**
+ * This is the constructor which should be used when creating a
+ * NewWebClassOperation. An instance of the NewWebClassDataModel should be
+ * passed in. This does not accept null parameter. It will not return null.
+ *
+ * @see ArtifactEditProviderOperation#ArtifactEditProviderOperation(IDataModel)
+ * @see NewListenerClassDataModel
+ *
+ * @param dataModel
+ * @return NewListenerClassOperation
+ */
+ public NewWebClassOperation(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ /**
+ * Subclasses may extend this method to provide their own template based
+ * creation of an annotated web artifact java class file. This implementation
+ * uses the creation of a CreateWebClassTemplateModel and the WTPJetEmitter
+ * to create the java class with the annotated tags. This method accepts
+ * null for monitor, it does not accept null for fragment. If annotations
+ * are not being used the tags will be omitted from the class.
+ *
+ * @see CreateWebClassTemplateModel
+ * @see #generateTemplateSource(CreateWebClassTemplateModel, IProgressMonitor)
+ *
+ * @param monitor
+ * @param fragment
+ * @throws CoreException
+ * @throws WFTWrappedException
+ */
+ @Override
+ protected void generateUsingTemplates(IProgressMonitor monitor, IPackageFragment fragment) throws WFTWrappedException, CoreException {
+ // Create the web artifact template model
+ CreateWebClassTemplateModel tempModel = createTemplateModel();
+ IProject project = getTargetProject();
+ String source;
+ try {
+ // generate the java source based on the template model
+ source = generateTemplateSource(WebPlugin.getPlugin(), tempModel, getTemplateFile(), getTemplateImplementation(), monitor);
+ } catch (Exception e) {
+ throw new WFTWrappedException(e);
+ }
+ if (fragment != null) {
+ // Create the java file
+ String javaFileName = tempModel.getClassName() + DOT_JAVA;
+ ICompilationUnit cu = fragment.getCompilationUnit(javaFileName);
+ // Add the compilation unit to the java file
+ if (cu == null || !cu.exists())
+ cu = fragment.createCompilationUnit(javaFileName, source, true, monitor);
+ IFile aFile = (IFile) cu.getResource();
+ // Let the annotations controller process the annotated resource
+ AnnotationsController controller = AnnotationsControllerManager.INSTANCE.getAnnotationsController(project);
+ if (controller != null)
+ controller.process(aFile);
+ }
+
+ // Add the xdoclet facet, if necessary, for xdoclet listener creation
+ try {
+ installXDocletFacetIfNecessary(monitor, project);
+ } catch (Exception e) {
+ throw new WFTWrappedException(e);
+ }
+ }
+
+ /**
+ * This method is intended for internal use only. This will add an webdoclet facet to the project.
+ *
+ * @throws CoreException
+ * @throws ExecutionException
+ */
+ private void installXDocletFacet(IProgressMonitor monitor, IProject project) throws CoreException, ExecutionException {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ Set fixedFacets = facetedProject.getFixedProjectFacets();
+ IDataModel dm = DataModelFactory.createDataModel(new FacetInstallDataModelProvider());
+ dm.setProperty(IFacetDataModelProperties.FACET_ID, IJ2EEFacetConstants.DYNAMIC_WEB_XDOCLET);
+ dm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, project.getName());
+ dm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JST_WEB_XDOCLET_VERSION);
+ IDataModel fdm = DataModelFactory.createDataModel(new FacetProjectCreationDataModelProvider());
+ fdm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, project.getName());
+
+ FacetDataModelMap map = (FacetDataModelMap) fdm.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ map.add(dm);
+
+ fdm.getDefaultOperation().execute(monitor, null);
+ facetedProject.setFixedProjectFacets(fixedFacets);
+ }
+
+ /**
+ * This method is intended for internal use only. This will check to see if it needs to add an
+ * webdoclet facet to the project.
+ *
+ * @throws CoreException
+ * @throws ExecutionException
+ */
+ private void installXDocletFacetIfNecessary(IProgressMonitor monitor, IProject project) throws CoreException, ExecutionException {
+
+ // If not using annotations, ignore the xdoclet facet
+ if (!model.getBooleanProperty(USE_ANNOTATIONS))
+ return;
+
+ // If an extended annotations processor is added, ignore the default xdoclet one
+ Descriptor descriptor = AnnotationsControllerManager.INSTANCE.getDescriptor(getTargetComponent().getProject());
+ if (descriptor != null)
+ return;
+
+ // Otherwise check and see if the xdoclet facet is on the project yet
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if (!facetedProject.hasProjectFacet(WebFacetUtils.WEB_XDOCLET_FACET))
+ return;
+
+ // Install xdoclet facet
+ installXDocletFacet(monitor, project);
+ }
+
+ /**
+ * This method will create an instance of the CreateWebClassTemplateModel to
+ * be used in conjunction with the WTPJETEmitter. This method will not
+ * return null.
+ *
+ * @see CreateWebClassTemplateModel
+ * @see NewWebClassOperation#generateUsingTemplates(IProgressMonitor,
+ * IPackageFragment)
+ *
+ * @return CreateWebClassTemplateModel
+ */
+ protected abstract CreateWebClassTemplateModel createTemplateModel();
+
+ /**
+ * This method will return the location of the template file that will be
+ * passed to the WTPJETEmitter to generate the template implementation
+ * class.
+ *
+ * @return path to the template file.
+ */
+ protected abstract String getTemplateFile();
+
+ /**
+ * This method will return an instance of the template implementation class
+ * that is statically compiled in the plugin. This instance can be used to
+ * generate the artifact's code without using the WTPJETEmitter.
+ *
+ * @return an instance of the template implementation class.
+ */
+ protected abstract Object getTemplateImplementation();
+
+ private IVirtualComponent getTargetComponent() {
+ return ComponentCore.createComponent(getTargetProject());
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java
new file mode 100644
index 0000000..a911a6f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletSupertypesValidator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_GENERIC_SERVLET;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SERVLET;
+import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class ServletSupertypesValidator extends AbstractSupertypesValidator {
+
+ public static boolean isHttpServletSuperclass(IDataModel dataModel) {
+ if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
+ return true;
+
+ if (hasSuperclass(dataModel, getSuperclass(dataModel), QUALIFIED_HTTP_SERVLET))
+ return true;
+
+ return false;
+ }
+
+ public static boolean isGenericServletSuperclass(IDataModel dataModel) {
+ if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
+ return true;
+
+ if (QUALIFIED_GENERIC_SERVLET.equals(getSuperclass(dataModel)))
+ return true;
+
+ if (hasSuperclass(dataModel, getSuperclass(dataModel), QUALIFIED_GENERIC_SERVLET))
+ return true;
+
+ return false;
+ }
+
+ public static boolean isServletSuperclass(IDataModel dataModel) {
+ if (QUALIFIED_HTTP_SERVLET.equals(getSuperclass(dataModel)))
+ return true;
+
+ if (QUALIFIED_GENERIC_SERVLET.equals(getSuperclass(dataModel)))
+ return true;
+
+ if (getInterfaces(dataModel).contains(QUALIFIED_SERVLET))
+ return true;
+
+ if (hasSuperInterface(dataModel, getSuperclass(dataModel), QUALIFIED_SERVLET))
+ return true;
+
+ for (Object iface : getInterfaces(dataModel)) {
+ if (hasSuperInterface(dataModel, (String) iface, QUALIFIED_SERVLET))
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java
new file mode 100644
index 0000000..3411010
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java
@@ -0,0 +1,517 @@
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.*;
+import org.eclipse.jst.j2ee.internal.common.operations.*;
+
+public class ServletTemplate
+{
+ protected static String nl;
+ public static synchronized ServletTemplate create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ ServletTemplate result = new ServletTemplate();
+ nl = null;
+ return result;
+ }
+
+ public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
+ protected final String TEXT_1 = "package "; //$NON-NLS-1$
+ protected final String TEXT_2 = ";"; //$NON-NLS-1$
+ protected final String TEXT_3 = NL;
+ protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
+ protected final String TEXT_5 = ";"; //$NON-NLS-1$
+ protected final String TEXT_6 = NL;
+ protected final String TEXT_7 = NL;
+ protected final String TEXT_8 = "/**" + NL + " * Servlet implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_9 = NL + " *" + NL + " * @web.servlet" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_10 = "\"" + NL + " * display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_11 = "\""; //$NON-NLS-1$
+ protected final String TEXT_12 = NL + " * description=\""; //$NON-NLS-1$
+ protected final String TEXT_13 = "\""; //$NON-NLS-1$
+ protected final String TEXT_14 = NL + " *" + NL + " * @web.servlet-mapping" + NL + " * url-pattern=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_15 = "\""; //$NON-NLS-1$
+ protected final String TEXT_16 = NL + " *" + NL + " * @web.servlet-init-param" + NL + " * name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_17 = "\"" + NL + " * value=\""; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_18 = "\""; //$NON-NLS-1$
+ protected final String TEXT_19 = NL + " * description=\""; //$NON-NLS-1$
+ protected final String TEXT_20 = "\""; //$NON-NLS-1$
+ protected final String TEXT_21 = NL + " */"; //$NON-NLS-1$
+ protected final String TEXT_22 = NL + "@WebServlet"; //$NON-NLS-1$
+ protected final String TEXT_23 = "(\""; //$NON-NLS-1$
+ protected final String TEXT_24 = "\")"; //$NON-NLS-1$
+ protected final String TEXT_25 = "({ "; //$NON-NLS-1$
+ protected final String TEXT_26 = ", "; //$NON-NLS-1$
+ protected final String TEXT_27 = "\""; //$NON-NLS-1$
+ protected final String TEXT_28 = "\""; //$NON-NLS-1$
+ protected final String TEXT_29 = " })"; //$NON-NLS-1$
+ protected final String TEXT_30 = "("; //$NON-NLS-1$
+ protected final String TEXT_31 = ", "; //$NON-NLS-1$
+ protected final String TEXT_32 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_33 = " = \""; //$NON-NLS-1$
+ protected final String TEXT_34 = "\""; //$NON-NLS-1$
+ protected final String TEXT_35 = " = { "; //$NON-NLS-1$
+ protected final String TEXT_36 = ", "; //$NON-NLS-1$
+ protected final String TEXT_37 = NL + "\t\t\t\t"; //$NON-NLS-1$
+ protected final String TEXT_38 = "\""; //$NON-NLS-1$
+ protected final String TEXT_39 = "\""; //$NON-NLS-1$
+ protected final String TEXT_40 = NL + "\t\t"; //$NON-NLS-1$
+ protected final String TEXT_41 = " "; //$NON-NLS-1$
+ protected final String TEXT_42 = "}"; //$NON-NLS-1$
+ protected final String TEXT_43 = " = { "; //$NON-NLS-1$
+ protected final String TEXT_44 = ", "; //$NON-NLS-1$
+ protected final String TEXT_45 = NL + "\t\t\t\t@WebInitParam(name = \""; //$NON-NLS-1$
+ protected final String TEXT_46 = "\", value = \""; //$NON-NLS-1$
+ protected final String TEXT_47 = "\""; //$NON-NLS-1$
+ protected final String TEXT_48 = ", description = \""; //$NON-NLS-1$
+ protected final String TEXT_49 = "\""; //$NON-NLS-1$
+ protected final String TEXT_50 = ")"; //$NON-NLS-1$
+ protected final String TEXT_51 = NL + "\t\t}"; //$NON-NLS-1$
+ protected final String TEXT_52 = ")"; //$NON-NLS-1$
+ protected final String TEXT_53 = NL + "public "; //$NON-NLS-1$
+ protected final String TEXT_54 = "abstract "; //$NON-NLS-1$
+ protected final String TEXT_55 = "final "; //$NON-NLS-1$
+ protected final String TEXT_56 = "class "; //$NON-NLS-1$
+ protected final String TEXT_57 = " extends "; //$NON-NLS-1$
+ protected final String TEXT_58 = " implements "; //$NON-NLS-1$
+ protected final String TEXT_59 = ", "; //$NON-NLS-1$
+ protected final String TEXT_60 = " {"; //$NON-NLS-1$
+ protected final String TEXT_61 = NL + "\tprivate static final long serialVersionUID = 1L;"; //$NON-NLS-1$
+ protected final String TEXT_62 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ protected final String TEXT_63 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_64 = NL + " " + NL + " /**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_65 = "#"; //$NON-NLS-1$
+ protected final String TEXT_66 = "("; //$NON-NLS-1$
+ protected final String TEXT_67 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_68 = "("; //$NON-NLS-1$
+ protected final String TEXT_69 = ") {" + NL + " super("; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_70 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_71 = NL + NL + "\t/**" + NL + " * @see "; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_72 = "#"; //$NON-NLS-1$
+ protected final String TEXT_73 = "("; //$NON-NLS-1$
+ protected final String TEXT_74 = ")" + NL + " */" + NL + " public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ protected final String TEXT_75 = " "; //$NON-NLS-1$
+ protected final String TEXT_76 = "("; //$NON-NLS-1$
+ protected final String TEXT_77 = ") {" + NL + " // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
+ protected final String TEXT_78 = NL + "\t\t\treturn "; //$NON-NLS-1$
+ protected final String TEXT_79 = ";"; //$NON-NLS-1$
+ protected final String TEXT_80 = NL + " }"; //$NON-NLS-1$
+ protected final String TEXT_81 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_82 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_83 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ protected final String TEXT_84 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ protected final String TEXT_85 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_86 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_87 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_88 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_89 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_90 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_91 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_92 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_93 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ protected final String TEXT_94 = NL + NL + "}"; //$NON-NLS-1$
+ protected final String TEXT_95 = NL;
+
+ public String generate(Object argument)
+ {
+ final StringBuffer stringBuffer = new StringBuffer();
+ CreateServletTemplateModel model = (CreateServletTemplateModel) argument;
+
+ model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME);
+
+
+ if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) {
+
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append( model.getJavaPackageName() );
+ stringBuffer.append(TEXT_2);
+
+ }
+
+ stringBuffer.append(TEXT_3);
+
+ Collection<String> imports = model.getImports();
+ for (String anImport : imports) {
+
+ stringBuffer.append(TEXT_4);
+ stringBuffer.append( anImport );
+ stringBuffer.append(TEXT_5);
+
+ }
+
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append( model.getClassName() );
+
+ if (model.isAnnotated()) {
+
+ stringBuffer.append(TEXT_9);
+ stringBuffer.append( model.getServletName() );
+ stringBuffer.append(TEXT_10);
+ stringBuffer.append( model.getServletName() );
+ stringBuffer.append(TEXT_11);
+
+ if (model.getDescription() != null && model.getDescription().length() > 0) {
+
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append( model.getDescription() );
+ stringBuffer.append(TEXT_13);
+
+ }
+
+ List<String[]> mappings = model.getServletMappings();
+ if (mappings != null && mappings.size() > 0) {
+ for (int i = 0; i < mappings.size(); i++) {
+ String map = model.getServletMapping(i);
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append( map );
+ stringBuffer.append(TEXT_15);
+
+ }
+ }
+ List<String[]> initParams = model.getInitParams();
+ if (initParams != null && initParams.size() > 0) {
+ for (int i = 0; i < initParams.size(); i++) {
+ String name = model.getInitParam(i, CreateServletTemplateModel.NAME);
+ String value = model.getInitParam(i, CreateServletTemplateModel.VALUE);
+ String description = model.getInitParam(i, CreateServletTemplateModel.DESCRIPTION);
+
+ stringBuffer.append(TEXT_16);
+ stringBuffer.append( name );
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_18);
+
+ if (description != null && description.length() > 0) {
+
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append( description );
+ stringBuffer.append(TEXT_20);
+
+ }
+ }
+ }
+ }
+
+ stringBuffer.append(TEXT_21);
+
+ if ("3.0".equals(model.getJavaEEVersion())) { //$NON-NLS-1$
+
+ stringBuffer.append(TEXT_22);
+
+ Map<String, Object> params = model.getClassAnnotationParams();
+ if (params.size() == 1 && params.containsKey(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+ List<String[]> mappings = (List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS);
+ if (mappings.size() == 1) {
+ String value = mappings.get(0)[0];
+
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_24);
+
+ } else {
+
+ stringBuffer.append(TEXT_25);
+
+ boolean needComma = false;
+ for (String[] mapping : mappings) {
+ if (needComma) {
+
+ stringBuffer.append(TEXT_26);
+
+ }
+
+ stringBuffer.append(TEXT_27);
+ stringBuffer.append( mapping[0] );
+ stringBuffer.append(TEXT_28);
+
+ needComma = true;
+ }
+
+ stringBuffer.append(TEXT_29);
+
+ }
+ } else if (!params.isEmpty()) {
+
+ stringBuffer.append(TEXT_30);
+
+ Set<String> keys = params.keySet();
+ boolean needNewLine = keys.contains(CreateServletTemplateModel.ATT_INIT_PARAMS) ||
+ (keys.contains(CreateServletTemplateModel.ATT_URL_PATTERNS) &&
+ ((List<String[]>) params.get(CreateServletTemplateModel.ATT_URL_PATTERNS)).size() > 1);
+ boolean needComma = false;
+ for (String key : keys) {
+ if (needComma) {
+
+ stringBuffer.append(TEXT_31);
+
+ }
+
+ if (needNewLine) {
+
+ stringBuffer.append(TEXT_32);
+
+ }
+
+ if (key.equals(CreateServletTemplateModel.ATT_NAME) || key.equals(CreateServletTemplateModel.ATT_DESCRIPTION)) {
+ String value = (String) params.get(key);
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_33);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_34);
+
+ } else if (key.equals(CreateServletTemplateModel.ATT_URL_PATTERNS)) {
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_35);
+
+ List<String[]> mappings = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ boolean needNewLine2 = mappings.size() > 1;
+ for (String[] mapping : mappings) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_36);
+
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_37);
+
+ }
+
+ stringBuffer.append(TEXT_38);
+ stringBuffer.append( mapping[0] );
+ stringBuffer.append(TEXT_39);
+
+ needComma2 = true;
+ }
+
+ if (needNewLine2) {
+
+ stringBuffer.append(TEXT_40);
+
+ } else {
+
+ stringBuffer.append(TEXT_41);
+
+ }
+
+ stringBuffer.append(TEXT_42);
+
+ } else if (key.equals(CreateServletTemplateModel.ATT_INIT_PARAMS)) {
+
+ stringBuffer.append( key );
+ stringBuffer.append(TEXT_43);
+
+ List<String[]> initParams = (List<String[]>) params.get(key);
+ boolean needComma2 = false;
+ for (String[] initParam : initParams) {
+ if (needComma2) {
+
+ stringBuffer.append(TEXT_44);
+
+ }
+
+ String name = initParam[CreateServletTemplateModel.NAME];
+ String value = initParam[CreateServletTemplateModel.VALUE];
+ String description = initParam[CreateServletTemplateModel.DESCRIPTION];
+
+ stringBuffer.append(TEXT_45);
+ stringBuffer.append( name );
+ stringBuffer.append(TEXT_46);
+ stringBuffer.append( value );
+ stringBuffer.append(TEXT_47);
+
+ if (description != null && description.length() > 0) {
+
+ stringBuffer.append(TEXT_48);
+ stringBuffer.append( description );
+ stringBuffer.append(TEXT_49);
+
+ }
+
+ stringBuffer.append(TEXT_50);
+
+ needComma2 = true;
+ }
+
+ stringBuffer.append(TEXT_51);
+
+ }
+
+ needComma = true;
+ }
+
+ stringBuffer.append(TEXT_52);
+
+ }
+ }
+
+
+ if (model.isPublic()) {
+
+ stringBuffer.append(TEXT_53);
+
+ }
+
+ if (model.isAbstract()) {
+
+ stringBuffer.append(TEXT_54);
+
+ }
+
+ if (model.isFinal()) {
+
+ stringBuffer.append(TEXT_55);
+
+ }
+
+ stringBuffer.append(TEXT_56);
+ stringBuffer.append( model.getClassName() );
+
+ String superClass = model.getSuperclassName();
+ if (superClass != null && superClass.length() > 0) {
+
+ stringBuffer.append(TEXT_57);
+ stringBuffer.append( superClass );
+
+ }
+
+ List<String> interfaces = model.getInterfaces();
+ if ( interfaces.size() > 0) {
+
+ stringBuffer.append(TEXT_58);
+
+ }
+
+ for (int i = 0; i < interfaces.size(); i++) {
+ String INTERFACE = interfaces.get(i);
+ if (i > 0) {
+
+ stringBuffer.append(TEXT_59);
+
+ }
+
+ stringBuffer.append( INTERFACE );
+
+ }
+
+ stringBuffer.append(TEXT_60);
+
+ if (model.isGenericServletSuperclass()) {
+
+ stringBuffer.append(TEXT_61);
+
+ }
+
+
+ if (!model.hasEmptySuperclassConstructor()) {
+
+ stringBuffer.append(TEXT_62);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_63);
+
+ }
+
+ if (model.shouldGenSuperclassConstructors()) {
+ List<Constructor> constructors = model.getConstructors();
+ for (Constructor constructor : constructors) {
+ if (constructor.isPublic() || constructor.isProtected()) {
+
+ stringBuffer.append(TEXT_64);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_65);
+ stringBuffer.append( model.getSuperclassName() );
+ stringBuffer.append(TEXT_66);
+ stringBuffer.append( constructor.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_67);
+ stringBuffer.append( model.getClassName() );
+ stringBuffer.append(TEXT_68);
+ stringBuffer.append( constructor.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_69);
+ stringBuffer.append( constructor.getParamsForCall() );
+ stringBuffer.append(TEXT_70);
+
+ }
+ }
+ }
+
+
+ if (model.shouldImplementAbstractMethods()) {
+ for (Method method : model.getUnimplementedMethods()) {
+
+ stringBuffer.append(TEXT_71);
+ stringBuffer.append( method.getContainingJavaClass() );
+ stringBuffer.append(TEXT_72);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_73);
+ stringBuffer.append( method.getParamsForJavadoc() );
+ stringBuffer.append(TEXT_74);
+ stringBuffer.append( method.getReturnType() );
+ stringBuffer.append(TEXT_75);
+ stringBuffer.append( method.getName() );
+ stringBuffer.append(TEXT_76);
+ stringBuffer.append( method.getParamsForDeclaration() );
+ stringBuffer.append(TEXT_77);
+
+ String defaultReturnValue = method.getDefaultReturnValue();
+ if (defaultReturnValue != null) {
+
+ stringBuffer.append(TEXT_78);
+ stringBuffer.append( defaultReturnValue );
+ stringBuffer.append(TEXT_79);
+
+ }
+
+ stringBuffer.append(TEXT_80);
+
+ }
+ }
+
+ if (model.shouldGenInit()) {
+ stringBuffer.append(TEXT_81);
+ }
+ if (model.shouldGenDestroy()) {
+ stringBuffer.append(TEXT_82);
+ }
+ if (model.shouldGenGetServletConfig()) {
+ stringBuffer.append(TEXT_83);
+ }
+ if (model.shouldGenGetServletInfo()) {
+ stringBuffer.append(TEXT_84);
+ }
+ if (model.shouldGenService() && !model.isHttpServletSuperclass()) {
+ stringBuffer.append(TEXT_85);
+ }
+ if (model.shouldGenService() && model.isHttpServletSuperclass()) {
+ stringBuffer.append(TEXT_86);
+ }
+ if (model.shouldGenDoGet()) {
+ stringBuffer.append(TEXT_87);
+ }
+ if (model.shouldGenDoPost()) {
+ stringBuffer.append(TEXT_88);
+ }
+ if (model.shouldGenDoPut()) {
+ stringBuffer.append(TEXT_89);
+ }
+ if (model.shouldGenDoDelete()) {
+ stringBuffer.append(TEXT_90);
+ }
+ if (model.shouldGenDoHead()) {
+ stringBuffer.append(TEXT_91);
+ }
+ if (model.shouldGenDoOptions()) {
+ stringBuffer.append(TEXT_92);
+ }
+ if (model.shouldGenDoTrace()) {
+ stringBuffer.append(TEXT_93);
+ }
+ stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_95);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java
new file mode 100644
index 0000000..47dd11a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/operations/WebMessages.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Jan 13, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * @author jialin
+ *
+ * To change the template for this generated type comment go to Window - Preferences - Java - Code
+ * Generation - Code and Comments
+ */
+public class WebMessages extends NLS {
+ private static final String BUNDLE_NAME = "web";//$NON-NLS-1$
+
+ private WebMessages() {
+ // Do not instantiate
+ }
+
+ public static String ERR_JAR_NAME_EMPTY;
+ public static String ERR_JAR_NAME_EXIST;
+ public static String ERR_JAVA_PROJECT_NAME_EMPTY;
+ public static String ERR_JAVA_PROJECT_NAME_EXIST;
+ public static String ERR_DUPLICATED_INIT_PARAMETER;
+ public static String ERR_DUPLICATED_URL_MAPPING;
+
+ public static String ERR_SERVLET_MAPPING_URL_PATTERN_EXIST;
+ public static String KEY_3;
+ public static String KEY_4;
+ public static String KEY_5;
+ public static String KEY_6;
+ public static String ERR_FILTER_PARAMETER_NAME_EXIST;
+ public static String ERR_FILTER_MAPPING_SERVLET_EXIST;
+ public static String ERR_FILTER_MAPPING_SERVLET_DISPATCHER_TYPES_EMPTY;
+ public static String ERR_SERVLET_MAPPING_URL_PATTERN_EMPTY;
+ public static String ERR_URL_MAPPING_LIST_EMPTY;
+ public static String ERR_URL_PATTERN_INVALID;
+ public static String ERR_FILTER_MAPPING_EMPTY;
+ public static String ERR_DISPLAY_NAME_EMPTY;
+ public static String ERR_SERVLET_CLASS_NAME_USED;
+ public static String ERR_SERVLET_JAVA_CLASS_NAME_INVALID;
+ public static String ERR_SERVLET_MAPPING_SERVLET_NOT_EXIST;
+ public static String ERR_SERVLET_NAME_EXIST;
+ public static String ERR_SERVLET_DISPLAY_NAME_EXIST;
+ public static String ERR_SERVLET_PARAMETER_NAME_EMPTY;
+ public static String ERR_SERVLET_PARAMETER_NAME_EXIST;
+ public static String ERR_SERVLET_PARAMETER_VALUE_EMPTY;
+ public static String ERR_SERVLET_PARAMETER_VALUE_EXIST;
+ public static String ERR_SERVLET_ROLE_REF_NAME_EMPTY;
+ public static String ERR_SERVLET_ROLE_REF_NAME_EXIST;
+ public static String ERR_SERVLET_ROLE_LINK_EMPTY;
+ public static String ERR_SERVLET_INTERFACE;
+
+ public static String ERR_FILTER_DISPLAY_NAME_EXIST;
+ public static String ERR_FILTER_NAME_EXIST;
+ public static String ERR_FILTER_CLASS_NAME_USED;
+ public static String ERR_FILTER_CLASS_NAME_INVALID;
+ public static String ERR_LISTENER_DISPLAY_NAME_EXIST;
+ public static String ERR_LISTENER_CLASS_NAME_USED;
+ public static String ERR_LISTENER_CLASS_NAME_INVALID;
+
+ public static String ERR_PAGE_ENCODING_EMPTY;
+ public static String ERR_PAGE_ENCODING_EXIST;
+ public static String ERR_URL_PATTERN_EXIST;
+ public static String ERR_INCLUDE_PRELUDES_EXIST;
+ public static String ERR_INCLUDE_CODAS_EXIST;
+ public static String ERR_SECURITY_CONSTRAINT_NAME_EMPTY;
+ public static String ERR_SECURITY_CONSTRAINT_NAME_EXIST;
+ public static String ERR_CONTEXT_PARAMETER_NAME_EMPTY;
+ public static String ERR_CONTEXT_PARAMETER_NAME_EXIST;
+ public static String ERR_RESOURCE_NAME_EMPTY;
+ public static String ERR_RESOURCE_NAME_EXIST;
+ public static String ERR_URL_PATTERNS_EMPTY;
+ public static String ERR_MIME_MAPPING_EXTENSION_EMPTY;
+ public static String ERR_MIME_MAPPING_EXTENSION_EXIST;
+ public static String ERR_WELCOME_PAGE_EMPTY;
+ public static String ERR_WELCOME_PAGE_EXIST;
+ public static String ERR_ENV_ENTRY_NAME_EMPTY;
+ public static String ERR_ENV_ENTRY_NAME_EXIST;
+ public static String ERR_ERROR_CODE_EMPTY;
+ public static String ERR_ERROR_CODE_MUST_BE_3_DIGITS;
+ public static String ERR_ERROR_PAGE_LOCATION_EMPTY;
+ public static String ERR_ERROR_PAGE_LOCATION_EXIST;
+ public static String ERR_ERROR_PAGE_LOCATION_MUST_START_WITH_SLASH;
+ public static String ERR_EXCEPTION_TYPE_EMPTY;
+ public static String ERR_EXCEPTION_SECURITY_ID_NO_BEANS;
+ public static String ERR_EXCEPTION_ROLE_NAME_EMPTY;
+ public static String ERR_LOCALE_NAME_EMPTY;
+ public static String ERR_LOCALE_NAME_EXIST;
+ public static String ERR_TAGLIBREF_URL_EMPTY;
+ public static String ERR_TAGLIBREF_URL_EXIST;
+ public static String ERR_MESSAGE_DESTINATION_NAME_EMPTY;
+ public static String ERR_MESSAGE_DESTINATION_NAME_EXIST;
+ public static String ERR_EXCEPTION_METHOD_ELEMENT_EMPTY;
+ public static String ERR_EXCEPTION_METHOD_TRANSACTION_ATTRIBUTES_EMPTY;
+ public static String ERR_SERVLET_LIST_EMPTY;
+ public static String ERR_FILTER_LIST_EMPTY;
+ public static String ERR_LISTENER_LIST_EMPTY;
+ public static String ERR_NO_LISTENER_SELECTED;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, WebMessages.class);
+ }
+
+ public static String getResourceString(String key, Object[] args) {
+ return NLS.bind(key, args);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java
new file mode 100644
index 0000000..ffc41ce
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebModuleExtensionImpl.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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
+ *******************************************************************************/
+/*
+ * Created on Sep 29, 2003
+ *
+ * To change the template for this generated file go to Window>Preferences>Java>Code
+ * Generation>Code and Comments
+ */
+package org.eclipse.jst.j2ee.internal.web.plugin;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.j2ee.application.Module;
+import org.eclipse.jst.j2ee.application.WebModule;
+import org.eclipse.jst.j2ee.internal.moduleextension.EarModuleExtensionImpl;
+import org.eclipse.jst.j2ee.internal.moduleextension.WebModuleExtension;
+import org.eclipse.jst.j2ee.internal.project.J2EEJavaProjectInfo;
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+
+
+public class WebModuleExtensionImpl extends EarModuleExtensionImpl implements WebModuleExtension {
+
+ /**
+ *
+ */
+ public WebModuleExtensionImpl() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#createProjectInfo()
+ */
+ public J2EEJavaProjectInfo createProjectInfo() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#addWLPProjects(org.eclipse.core.resources.IProject,
+ * java.util.Set)
+ */
+ public void addWLPProjects(IProject aProject, Set projectsToBuild) {
+ // J2EEWebNatureRuntime nature = J2EEWebNatureRuntime.getRuntime(aProject);
+ // if (nature == null)
+ // return;
+ // ILibModule[] libModules = nature.getLibModules();
+ // for (int i = 0; i < libModules.length; i++) {
+ // IProject p = libModules[i].getProject();
+ // if (p.isAccessible())
+ // projectsToBuild.add(libModules[i].getProject());
+ // }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#setContextRootForModuleMapping(org.eclipse.jst.j2ee.internal.internal.application.WebModule,
+ * org.eclipse.core.resources.IProject)
+ */
+ public void setContextRootForModuleMapping(WebModule webModule, IProject nestedProject) throws CoreException {
+ // TODO migrate to flex project
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#hasRuntime(org.eclipse.core.resources.IProject)
+ */
+ public boolean hasRuntime(IProject project) {
+ // return J2EEWebNatureRuntimeUtilities.hasJ2EERuntime(project);
+ // To do: work based on module
+ return false;
+ }
+
+ // public J2EEImportOperationOLD createImportOperation(IProject
+ // nestedProject, WARFile warFile, EARImportConfiguration importConfig){
+ // WarImportOperation op = new WarImportOperation(nestedProject, warFile);
+ // //op.setServerTarget(info.getServerTarget());
+ // HashMap opMap = importConfig.createProjectOption;
+ // if(opMap != null && !opMap.isEmpty())
+ // op.createWLProjectOptions = opMap;
+ // return op;
+ // }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#getContentFolder(org.eclipse.core.resources.IProject,
+ * org.eclipse.jst.j2ee.internal.internal.commonarchivecore.File)
+ */
+
+ public String getContentFolder(IProject project, IFile webSettingsFile) {
+ return null;
+ // To do: Needs work here, no content folder exists now
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.WebModuleExtension#compareWebContextRoot(org.eclipse.jst.j2ee.internal.internal.application.Module,
+ * org.eclipse.core.resources.IProject)
+ */
+ public boolean compareWebContextRoot(Module module, IProject project) throws CoreException {
+ String contextRoot = ((WebModule) module).getContextRoot();
+ if (contextRoot != null)
+ return ((contextRoot).equals(getServerContextRoot(project)));
+ return false;
+ }
+
+ protected String getServerContextRoot(IProject project) {
+ // TODO migrate to flex project
+ return ""; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createProjectDataModel()
+ */
+ public IDataModel createProjectDataModel() {
+ return DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jst.j2ee.internal.internal.moduleextension.EarModuleExtension#createImportDataModel()
+ */
+ public IDataModel createImportDataModel() {
+ return DataModelFactory.createDataModel(new WebComponentImportDataModelProvider());
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
new file mode 100644
index 0000000..5761790
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/internal/web/plugin/WebPlugin.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.plugin;
+
+import java.io.IOException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterManager;
+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.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.util.WebEditAdapterFactory;
+import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
+import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import java.lang.Throwable;
+
+
+/**
+ * This is a top-level class of the j2ee plugin.
+ *
+ */
+
+public class WebPlugin extends WTPPlugin implements ResourceLocator {
+ // Default instance of the receiver
+ private static WebPlugin inst;
+ protected final IPath iconsFolder = new Path(Platform.getBundle(PLUGIN_ID).getEntry("icons").getPath()); //$NON-NLS-1$
+ // Links View part of the plugin
+ //public static final String LINKS_BUILDER_ID =
+ // "com.ibm.etools.links.management.linksbuilder";//$NON-NLS-1$
+ public static final String LINKS_BUILDER_ID = "com.ibm.etools.webtools.additions.linksbuilder"; //$NON-NLS-1$
+ // LibDir Change Listener
+ public static final String LIBDIRCHANGE_BUILDER_ID = "com.ibm.etools.webtools.LibDirBuilder"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.jst.j2ee.web"; //$NON-NLS-1$
+ // LibCopy builder ID
+ public static final String LIBCOPY_BUILDER_ID = "org.eclipse.jst.j2ee.LibCopyBuilder"; //$NON-NLS-1$
+ // Validation part of the plugin
+ //Global ResourceSet (somewhat global)
+ private static IPath location;
+ public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$
+ "icons/full/cview16", //$NON-NLS-1$
+ "icons/full/ctool16", //$NON-NLS-1$
+ "icons/full/clcl16", //$NON-NLS-1$
+ "icons/full/ovr16", //$NON-NLS-1$
+ "icons/full/extra", //$NON-NLS-1$
+ "icons/full/wizban", //$NON-NLS-1$
+ "icons", //$NON-NLS-1$
+ ""}; //$NON-NLS-1$
+
+ /**
+ * Create the J2EE plugin and cache its default instance
+ */
+ public WebPlugin() {
+ super();
+ if (inst == null)
+ inst = this;
+ }
+
+ /**
+ * Get the plugin singleton.
+ */
+ static public WebPlugin getDefault() {
+ return inst;
+ }
+
+ /*
+ * Javadoc copied from interface.
+ */
+ public URL getBaseURL() {
+ return getBundle().getEntry("/"); //$NON-NLS-1$
+ }
+
+ public Object[] getJ2EEWebProjectMigrationExtensions() {
+
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint pct = registry.getExtensionPoint(getBundle().getSymbolicName(), "J2EEWebProjectMigrationExtension"); //$NON-NLS-1$
+
+ IExtension[] extension = pct.getExtensions();
+ List ret = new Vector();
+ for (int l = 0; l < extension.length; ++l) {
+ IExtension config = extension[l];
+
+ IConfigurationElement[] cElems = config.getConfigurationElements();
+ for (int i = 0; i < cElems.length; i++) {
+ IConfigurationElement d = cElems[i];
+ if (d.getName().equals("migration")) { //$NON-NLS-1$
+ try {
+ Object me = d.createExecutableExtension("run"); //$NON-NLS-1$
+
+ ret.add(me);
+ } catch (Exception ex) {
+ // ignore this extension, keep going
+ }
+ }
+ }
+ }
+
+ return ret.toArray();
+ }
+
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public Object getImage(String key) {
+ return J2EEPlugin.getImageURL(key, getBundle());
+ }
+
+ // ISSUE: this method is never used in WTP. Seems no need to be API
+ public static IPath getInstallLocation() {
+ if (location == null) {
+ String installLocation = getDefault().getBundle().getLocation();
+ location = new Path(installLocation);
+ }
+ return location;
+ }
+
+ public static URL getInstallURL() {
+ return getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the singleton instance.
+ */
+ public static WebPlugin getPlugin() {
+ return inst;
+ }
+
+ /**
+ * Return the plugin directory location- the directory that all the plugins are located in (i.e.
+ * d:\installdir\plugin)
+ */
+ public static IPath getPluginLocation(String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ if (bundle != null) {
+ try {
+ IPath installPath = new Path(bundle.getEntry("/").toExternalForm()).removeTrailingSeparator(); //$NON-NLS-1$
+ String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile();
+ return new Path(installStr);
+ } catch (IOException e) {
+ //Do nothing
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the Servlets Jar file path preference.
+ *
+ * @return String the file path to the servlets jar, or null if never specified.
+ * @deprecated - the preference store is no longer on this plugin because of the UI dependency.
+ */
+ public String getPreferenceServletsJar() {
+ // return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_SERVLET_JAR);
+ return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$
+ }
+
+ /**
+ * Return the Servlets Jar file path preference.
+ *
+ * @return String the file path to the servlets jar, or null if never specified.
+ * @deprecated - the preference store is no longer on this plugin because of the UI dependency.
+ */
+ public String getPreferenceWebASJar() {
+ //return getPreferenceStore().getString(IWebToolingCoreConstants.PROP_WEBAS_JAR);
+ return "THIS IS THE WRONG PATH - NEED TO CHANGE IMPLEMENTATION!!!!!"; //$NON-NLS-1$
+ }
+
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * If this is called from an operation, in response to some other exception that was caught,
+ * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
+ * otherwise this can still be used to signal some other error condition within the operation,
+ * or to throw a core exception in a context other than executing an operation
+ *
+ * Create a new IStatus of type ERROR using the J2EEPlugin ID. aCode is just an internal code.
+ */
+ public static IStatus newErrorStatus(int aCode, String aMessage, Throwable exception) {
+ return newStatus(IStatus.ERROR, aCode, aMessage, exception);
+ }
+
+ /**
+ * If this is called from an operation, in response to some other exception that was caught,
+ * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
+ * otherwise this can still be used to signal some other error condition within the operation,
+ * or to throw a core exception in a context other than executing an operation
+ *
+ * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
+ */
+ public static IStatus newErrorStatus(String aMessage, Throwable exception) {
+ return newErrorStatus(0, aMessage, exception);
+ }
+
+ /**
+ * If this is called from an operation, in response to some other exception that was caught,
+ * then the client code should throw {@link com.ibm.etools.wft.util.WFTWrappedException};
+ * otherwise this can still be used to signal some other error condition within the operation.
+ *
+ * Create a new IStatus of type ERROR, code OPERATION_FAILED, using the J2EEPlugin ID
+ */
+ public static IStatus newOperationFailedStatus(String aMessage, Throwable exception) {
+ return newStatus(IStatus.ERROR, IResourceStatus.OPERATION_FAILED, aMessage, exception);
+ }
+
+ /**
+ * Create a new IStatus with a severity using the J2EEPlugin ID. aCode is just an internal code.
+ */
+ public static IStatus newStatus(int severity, int aCode, String aMessage, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, aCode, aMessage, exception);
+ }
+
+ /*
+ * Javadoc copied from interface.
+ */
+ public String getString(String key) {
+ return Platform.getResourceString(getBundle(), key);
+ }
+
+ /*
+ * Javadoc copied from interface.
+ */
+ public String getString(String key, Object[] substitutions) {
+ return MessageFormat.format(getString(key), substitutions);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ //WebAppResourceFactory.register(WTPResourceFactoryRegistry.INSTANCE);
+ IAdapterManager manager = Platform.getAdapterManager();
+ manager.registerAdapters(new WebEditAdapterFactory(), ArtifactEditModel.class);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.common.frameworks.internal.WTPPlugin#getPluginID()
+ */
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+
+ public static void log( final Exception e )
+ {
+ logError(e);
+ }
+ public String getString(String key, boolean translate) {
+ // TODO For now... translate not supported
+ return getString(key);
+ }
+
+ public String getString(String key, Object[] substitutions, boolean translate) {
+ // TODO For now... translate not supported
+ return getString(key,substitutions);
+ }
+
+ public static IStatus createStatus(int severity, String message, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, message, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message) {
+ return createStatus(severity, message, null);
+ }
+
+ public static void logError(Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
+ }
+
+ public static void logError(CoreException exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
+ }
+
+ public static void logError(String message) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message));
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java
new file mode 100644
index 0000000..07dd594
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/IServletConstants.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2008 SAP AG 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:
+ * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.web;
+
+public interface IServletConstants {
+
+ public static final String QUALIFIED_IO_EXCEPTION = "java.io.IOException"; //$NON-NLS-1$
+
+ public static final String QUALIFIED_SERVLET = "javax.servlet.Servlet"; //$NON-NLS-1$
+ public static final String QUALIFIED_GENERIC_SERVLET = "javax.servlet.GenericServlet"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SERVLET = "javax.servlet.http.HttpServlet"; //$NON-NLS-1$
+
+ public static final String QUALIFIED_WEB_SERVLET = "javax.servlet.annotation.WebServlet"; //$NON-NLS-1$
+ public static final String QUALIFIED_WEB_LISTENER = "javax.servlet.annotation.WebListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_WEB_FILTER = "javax.servlet.annotation.WebFilter"; //$NON-NLS-1$
+ public static final String QUALIFIED_ANNOTATION_INIT_PARAM = "javax.servlet.annotation.WebInitParam"; //$NON-NLS-1$
+ public static final String QUALIFIED_ANNOTATION_DISPATCHER_TYPE = "javax.servlet.DispatcherType"; //$NON-NLS-1$
+
+
+ public static final String QUALIFIED_SERVLET_EXCEPTION = "javax.servlet.ServletException"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_CONFIG = "javax.servlet.ServletConfig"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_REQUEST = "javax.servlet.ServletRequest"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_RESPONSE = "javax.servlet.ServletResponse"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SERVLET_REQUEST = "javax.servlet.http.HttpServletRequest"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SERVLET_RESPONSE = "javax.servlet.http.HttpServletResponse"; //$NON-NLS-1$
+
+ public static final String QUALIFIED_FILTER = "javax.servlet.Filter"; //$NON-NLS-1$
+ public static final String QUALIFIED_FILTER_CONFIG = "javax.servlet.FilterConfig"; //$NON-NLS-1$
+ public static final String QUALIFIED_FILTER_CHAIN = "javax.servlet.FilterChain"; //$NON-NLS-1$
+
+ public static final String QUALIFIED_SERVLET_CONTEXT_LISTENER = "javax.servlet.ServletContextListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_CONTEXT_EVENT = "javax.servlet.ServletContextEvent"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER = "javax.servlet.ServletContextAttributeListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_EVENT = "javax.servlet.ServletContextAttributeEvent"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_LISTENER = "javax.servlet.http.HttpSessionListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_EVENT = "javax.servlet.http.HttpSessionEvent"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER = "javax.servlet.http.HttpSessionAttributeListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_BINDING_EVENT = "javax.servlet.http.HttpSessionBindingEvent"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER = "javax.servlet.http.HttpSessionActivationListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_HTTP_SESSION_BINDING_LISTENER = "javax.servlet.http.HttpSessionBindingListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_REQUEST_LISTENER = "javax.servlet.ServletRequestListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_REQUEST_EVENT = "javax.servlet.ServletRequestEvent"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER = "javax.servlet.ServletRequestAttributeListener"; //$NON-NLS-1$
+ public static final String QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT = "javax.servlet.ServletRequestAttributeEvent"; //$NON-NLS-1$
+
+ public static final String METHOD_INIT = "init"; //$NON-NLS-1$
+ public static final String METHOD_DESTROY = "destroy"; //$NON-NLS-1$
+ public static final String METHOD_GET_SERVLET_CONFIG = "getServletConfig"; //$NON-NLS-1$
+ public static final String METHOD_GET_SERVLET_INFO = "getServletInfo"; //$NON-NLS-1$
+ public static final String METHOD_SERVICE = "service"; //$NON-NLS-1$
+ public static final String METHOD_DO_GET = "doGet"; //$NON-NLS-1$
+ public static final String METHOD_DO_POST = "doPost"; //$NON-NLS-1$
+ public static final String METHOD_DO_PUT = "doPut"; //$NON-NLS-1$
+ public static final String METHOD_DO_DELETE = "doDelete"; //$NON-NLS-1$
+ public static final String METHOD_DO_HEAD = "doHead"; //$NON-NLS-1$
+ public static final String METHOD_DO_OPTIONS = "doOptions"; //$NON-NLS-1$
+ public static final String METHOD_DO_TRACE = "doTrace"; //$NON-NLS-1$
+ public static final String METHOD_TO_STRING = "toString"; //$NON-NLS-1$
+ public static final String METHOD_DO_FILTER = "doFilter"; //$NON-NLS-1$
+
+ public static final String SERVLET_INIT_SIGNATURE = "(Ljavax/servlet/ServletConfig;)V"; //$NON-NLS-1$
+ public static final String DESTROY_SIGNATURE = "()V"; //$NON-NLS-1$
+ public static final String GET_SERVLET_CONFIG_SIGNATURE = "()Ljavax/servlet/ServletConfig;"; //$NON-NLS-1$
+ public static final String GET_SERVLET_INFO_SIGNATURE = "()Ljava/lang/String;"; //$NON-NLS-1$
+ public static final String SERVICE_SIGNATURE = "(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V"; //$NON-NLS-1$
+ public static final String HTTP_SERVICE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_GET_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_POST_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_PUT_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_DELETE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_HEAD_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_OPTIONS_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String DO_TRACE_SIGNATURE = "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V"; //$NON-NLS-1$
+ public static final String FILTER_INIT_SIGNATURE = "(Ljavax/servlet/FilterConfig;)V"; //$NON-NLS-1$
+ public static final String DO_FILTER_SIGNATURE = "(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChain;)V"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java
new file mode 100644
index 0000000..f7192f6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/web/org/eclipse/jst/j2ee/web/validation/UrlPattern.java
@@ -0,0 +1,58 @@
+package org.eclipse.jst.j2ee.web.validation;
+
+/**
+ * Utility method for URL patterns.
+ *
+ * <p>
+ * Could be used by components dealing with URL patterns like: Servlet and
+ * Filter wizards, web.xml validators, etc.
+ * </p>
+ *
+ * @author kraev
+ */
+public class UrlPattern {
+
+ /**
+ * Validates an URL pattern.
+ *
+ * @param urlPattern
+ * the string representation of the URL pattern to validate
+ *
+ * @return <code>true</code> if the given pattern is a valid one,
+ * <code>false</code> - otherwise.
+ */
+ public static boolean isValid(String urlPattern) {
+ // URL Pattern must not be empty string
+ if (urlPattern.length() == 0)
+ return false;
+
+ // URL Pattern must not contain Carriage Return characters
+ if (urlPattern.indexOf('\r') != -1)
+ return false;
+
+ // URL Pattern must not contain New Line characters
+ if (urlPattern.indexOf('\n') != -1)
+ return false;
+
+ // Path Mappings must not contain "*." character sequences
+ if (urlPattern.startsWith("/")) { //$NON-NLS-1$
+ if (urlPattern.indexOf("*.") == -1) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+ // Extension Mappings must not contain '/' characters
+ if (urlPattern.startsWith("*.")) { //$NON-NLS-1$
+ if (urlPattern.indexOf('/') == -1) {
+ return true;
+ }
+ return false;
+ }
+
+ // The URL Pattern is neither a Path Mapping, nor Extension Mapping
+ // Therefore, it is invalid
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java
new file mode 100644
index 0000000..3717d2d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/AuthConstraintItemProvider.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.Description;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.AuthConstraint;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory;
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint}
+ * object.
+ */
+public class AuthConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public AuthConstraintItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns authority_constraint.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("authority_constraint");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the secConstraint of the AuthConstraint.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((AuthConstraint) object).getSecConstraint();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ // This is for the description feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property"
+ pkg.getAuthConstraint_Description()));
+ // This is for the roles feature.
+ //
+ WebToolingItemPropertyDescriptor propertyDescriptor = new WebToolingItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Roles_UI_"), //$NON-NLS-1$ = "Roles"
+ WebAppEditResourceHandler.getString("The_roles_property_UI_"), //$NON-NLS-1$ = "The roles property"
+ pkg.getAuthConstraint_Roles(), WebToolingItemPropertyDescriptor.AUTH_CONSTRAINT_ROLES_EDITOR);
+ itemPropertyDescriptors.add(propertyDescriptor);
+ // This is for the secConstraint feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint"
+ WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property"
+ pkg.getAuthConstraint_SecConstraint()));
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_AuthConstraint_description_feature"), getString( //$NON-NLS-1$
+ "_UI_PropertyDescriptor_description", "_UI_AuthConstraint_description_feature", //$NON-NLS-1$ //$NON-NLS-2$
+ "_UI_AuthConstraint_type"), WebapplicationPackage.eINSTANCE.getAuthConstraint_Description(), true, //$NON-NLS-1$
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Roles feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addRolesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_AuthConstraint_roles_feature"), getString( //$NON-NLS-1$
+ "_UI_PropertyDescriptor_description", "_UI_AuthConstraint_roles_feature", "_UI_AuthConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getAuthConstraint_Roles(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and
+ * {@link org.eclipse.emf.edit.command.AddCommand}and
+ * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ if (childrenReferences == null) {
+ super.getChildrenReferences(object);
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions());
+ }
+ return childrenReferences;
+ }
+
+ @Override
+ public String getText(Object object) {
+ String description = ((AuthConstraint) object).getDescription();
+ if (description == null) {
+ List descList = ((AuthConstraint) object).getDescriptions();
+ if (descList != null && descList.size() > 0)
+ description = ((Description) descList.get(0)).getValue();
+ }
+ if (description == null)
+ description = ""; //$NON-NLS-1$
+ // return WebAppEditResourceHandler.getString("11concat_UI_", (new
+ // Object[]{description})); //$NON-NLS-1$ = "AuthConstraint {0}"
+ return description;
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(AuthConstraint.class)) {
+ case WebapplicationPackage.AUTH_CONSTRAINT__DESCRIPTION :
+ case WebapplicationPackage.AUTH_CONSTRAINT__ROLES :
+ case WebapplicationPackage.AUTH_CONSTRAINT__DESCRIPTIONS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions(), CommonFactory.eINSTANCE.createDescription()));
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getAuthConstraint_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object,
+ * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class,
+ * org.eclipse.emf.edit.command.CommandParameter)
+ */
+ @Override
+ public Command createCommand(Object object, EditingDomain editingDomain, Class commandClass, CommandParameter commandParameter) {
+ EStructuralFeature sf = commandParameter.getEReference();
+ if (sf == null) {
+ sf = commandParameter.getEAttribute();
+ if (sf != null && !sf.isMany())
+ sf = null;
+ }
+ if (sf != null) {
+ EObject owner = commandParameter.getEOwner();
+ Collection collection = commandParameter.getCollection();
+ if (commandClass == AddCommand.class) {
+ return createAddCommand(editingDomain, owner, sf, collection, commandParameter.getIndex());
+ } else if (commandClass == RemoveCommand.class) {
+ return createRemoveCommand(editingDomain, owner, sf, collection);
+ }
+ }
+ return super.createCommand(object, editingDomain, commandClass, commandParameter);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java
new file mode 100644
index 0000000..5841516
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ContextParamItemProvider.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.ContextParam;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam}
+ * object.
+ */
+public class ContextParamItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ContextParamItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns initializ_parameter_context.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("initializ_parameter_context");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the ContextParam.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((ContextParam) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the paramName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamName_UI_"), //$NON-NLS-1$ = "ParamName"
+ WebAppEditResourceHandler.getString("The_paramName_property_UI_"), //$NON-NLS-1$ = "The paramName property"
+ pkg.getContextParam_ParamName()));
+
+ // This is for the paramValue feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamValue_UI_"), //$NON-NLS-1$ = "ParamValue"
+ WebAppEditResourceHandler.getString("The_paramValue_property_UI_"), //$NON-NLS-1$ = "The paramValue property"
+ pkg.getContextParam_ParamValue()));
+
+ // This is for the description feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property"
+ pkg.getContextParam_Description()));
+
+ // This is for the webApp feature.
+ //
+ /*
+ * itemPropertyDescriptors.add (new ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The
+ * webApp property" pkg.getContextParam_WebApp()));
+ */
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Param Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addParamNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_paramName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_paramName_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getContextParam_ParamName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Param Value feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addParamValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_paramValue_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_paramValue_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getContextParam_ParamValue(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ContextParam_description_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ContextParam_description_feature", "_UI_ContextParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getContextParam_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("12concat_UI_", (new Object[]{((ContextParam) object).getParamName()})); //$NON-NLS-1$ = "ContextParam {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(ContextParam.class)) {
+ case WebapplicationPackage.CONTEXT_PARAM__PARAM_NAME :
+ case WebapplicationPackage.CONTEXT_PARAM__PARAM_VALUE :
+ case WebapplicationPackage.CONTEXT_PARAM__DESCRIPTION : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java
new file mode 100644
index 0000000..e86a94e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorCodeErrorPageItemProvider.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.ErrorCodeErrorPage;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage}
+ * object.
+ */
+public class ErrorCodeErrorPageItemProvider extends ErrorPageItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ErrorCodeErrorPageItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns errorcode_errorpage.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("errorcode_errorpage"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the errorCode feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ErrorCode_UI_"), //$NON-NLS-1$ = "ErrorCode"
+ WebAppEditResourceHandler.getString("The_errorCode_property_UI_"), //$NON-NLS-1$ = "The errorCode property"
+ pkg.getErrorCodeErrorPage_ErrorCode()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Error Code feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addErrorCodePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ErrorCodeErrorPage_errorCode_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ErrorCodeErrorPage_errorCode_feature", "_UI_ErrorCodeErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getErrorCodeErrorPage_ErrorCode(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return ((ErrorCodeErrorPage) object).getErrorCode() + " -> " + ((ErrorCodeErrorPage) object).getLocation(); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(ErrorCodeErrorPage.class)) {
+ case WebapplicationPackage.ERROR_CODE_ERROR_PAGE__ERROR_CODE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java
new file mode 100644
index 0000000..f20bd78
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ErrorPageItemProvider.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.ErrorPage;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}object.
+ */
+public class ErrorPageItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ErrorPageItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns error_page.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("error_page"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the ErrorPage.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((ErrorPage) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the location feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ = "Location"
+ WebAppEditResourceHandler.getString("The_location_property_UI_"), //$NON-NLS-1$ = "The location property"
+ pkg.getErrorPage_Location()));
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Location feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addLocationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ErrorPage_location_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ErrorPage_location_feature", "_UI_ErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getErrorPage_Location(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("13concat_UI_", (new Object[]{((ErrorPage) object).getLocation()})); //$NON-NLS-1$ = "ErrorPage {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(ErrorPage.class)) {
+ case WebapplicationPackage.ERROR_PAGE__LOCATION : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java
new file mode 100644
index 0000000..687e1e7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ExceptionTypeErrorPageItemProvider.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.ExceptionTypeErrorPage;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}object.
+ */
+public class ExceptionTypeErrorPageItemProvider extends ErrorPageItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ExceptionTypeErrorPageItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns exception_type_errorpage.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("exception_type_errorpage"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the exceptionType feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ExceptionType_UI_"), //$NON-NLS-1$ = "ExceptionType"
+ WebAppEditResourceHandler.getString("The_exceptionType_property_UI_"), //$NON-NLS-1$ = "The exceptionType property"
+ pkg.getExceptionTypeErrorPage_ExceptionType()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Exception Type feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addExceptionTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ExceptionTypeErrorPage_exceptionType_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ExceptionTypeErrorPage_exceptionType_feature", "_UI_ExceptionTypeErrorPage_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getExceptionTypeErrorPage_ExceptionType(), true));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ String typeName = ((ExceptionTypeErrorPage) object).getExceptionTypeName();
+ if (typeName != null) {
+ typeName = typeName.substring(typeName.lastIndexOf('.')+1);
+ }
+ return typeName + " -> " + ((ExceptionTypeErrorPage) object).getLocation(); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java
new file mode 100644
index 0000000..be6fcd6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterItemProvider.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.Filter;
+import org.eclipse.jst.j2ee.webapplication.InitParam;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+public class FilterItemProvider extends CompatibilityDescriptionGroupItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public FilterItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ InitParam child = WebapplicationFactory.eINSTANCE.createInitParam();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ Collection result = new ArrayList();
+ WebApp webApp = (WebApp) ((Filter) object).eContainer();
+ if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID)
+ result.add(pkg.getFilter_InitParamValues());
+ else
+ result.add(pkg.getFilter_InitParams());
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateInitParam"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildText(Object object) {
+ return "Create InitParam"; //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("26concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type InitParam for the selected {0}."
+ }
+
+ /**
+ * This returns Filter.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("filter"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the Filter.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return WebapplicationPackage.eINSTANCE.getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+ WebapplicationPackage wap = WebapplicationPackage.eINSTANCE;
+
+ // This is for the filterName feature.
+
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FilterItemProvider_UI_0"), //$NON-NLS-1$
+ WebAppEditResourceHandler.getString("The_filterName_property_3"), wap.getFilter_Name())); //$NON-NLS-1$
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Filter_name_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Filter_name_feature", "_UI_Filter_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilter_Name(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Filter Class feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addFilterClassPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Filter_filterClass_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Filter_filterClass_feature", "_UI_Filter_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilter_FilterClass(), true));
+ }
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public Object getPropertyValue(Object object, String property) {
+ Object ret = null;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object);
+ } else
+ ret = super.getPropertyValue(object, property);
+ return ret;
+ }
+
+ @Override
+ public String getText(Object object) {
+ Filter filter = (Filter) object;
+ String name = filter.getName();
+ if (name == null)
+ name = "<filter>"; //$NON-NLS-1$
+ return name;
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(Filter.class)) {
+ case WebapplicationPackage.FILTER__NAME :
+ case WebapplicationPackage.FILTER__INIT_PARAMS :
+ case WebapplicationPackage.FILTER__INIT_PARAM_VALUES : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getFilter_InitParams(), WebapplicationFactory.eINSTANCE.createInitParam()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getFilter_InitParamValues(), CommonFactory.eINSTANCE.createParamValue()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet}
+ * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public boolean isPropertySet(Object object, String property) {
+ boolean ret = false;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object);
+ } else
+ ret = super.isPropertySet(object, property);
+ return ret;
+ }
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public void setPropertyValue(Object object, String property, Object value) {
+
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value);
+ } else
+ super.setPropertyValue(object, property, value);
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java
new file mode 100644
index 0000000..82fdc4f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FilterMappingItemProvider.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.Filter;
+import org.eclipse.jst.j2ee.webapplication.FilterMapping;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping}
+ * object.
+ */
+public class FilterMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public FilterMappingItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns filter_mapping.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("filter_mapping"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the FilterMapping.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return WebapplicationPackage.eINSTANCE.getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+ WebapplicationPackage wap = WebapplicationPackage.eINSTANCE;
+
+ // This is for the urlPattern feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern"
+ WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property"
+ wap.getFilterMapping_UrlPattern()));
+
+ // This is for the filter feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), "Filter", WebAppEditResourceHandler.getString("The_filter_property_2"), wap.getFilterMapping_Filter(), false)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addUrlPatternPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_urlPattern_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_urlPattern_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilterMapping_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Dispatcher Type feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDispatcherTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_dispatcherType_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_dispatcherType_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilterMapping_DispatcherType(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Filter feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addFilterPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_filter_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_filter_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilterMapping_Filter(), true));
+ }
+
+ /**
+ * This adds a property descriptor for the Servlet feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addServletPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FilterMapping_servlet_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FilterMapping_servlet_feature", "_UI_FilterMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFilterMapping_Servlet(), true));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ FilterMapping filterMapping = (FilterMapping) object;
+ Filter filter = filterMapping.getFilter();
+ String filterStr = (filter == null) ? WebAppEditResourceHandler.getString("?_UI_") : filter.getName(); //$NON-NLS-1$ = "?"
+
+ String mapText = ((FilterMapping) object).getUrlPattern();
+ if (mapText == null) {
+ Servlet servlet = filterMapping.getServlet();
+ if (servlet != null)
+ mapText = servlet.getServletName();
+ }
+ if (mapText == null)
+ mapText = "?"; //$NON-NLS-1$
+ return WebAppEditResourceHandler.getString("Filter_mapping_text", new Object[]{mapText, filterStr}); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(FilterMapping.class)) {
+ case WebapplicationPackage.FILTER_MAPPING__URL_PATTERN :
+ case WebapplicationPackage.FILTER_MAPPING__FILTER :
+ case WebapplicationPackage.FILTER_MAPPING__SERVLET :
+ case WebapplicationPackage.FILTER_MAPPING__DISPATCHER_TYPE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java
new file mode 100644
index 0000000..cae4065
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/FormLoginConfigItemProvider.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.FormLoginConfig;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig}
+ * object.
+ */
+public class FormLoginConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public FormLoginConfigItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns form_login_config.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("form_login_config");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns form_login_config.gif.
+ */
+ //TODO Removing the UI dependency by commenting out this method
+ /*
+ * public Image getLabelImage(Object object) { return (Image)
+ * WEBUIPlugin.getDefault().getImageFromRegistry("form_login_config");//$NON-NLS-1$ }
+ */
+ public String getLabelText(Object object) {
+ return WebAppEditResourceHandler.getString("52concat_UI_", (new Object[]{((FormLoginConfig) object).getFormLoginPage()})); //$NON-NLS-1$ = "FormLoginConfig {0}"
+ }
+
+ /**
+ * This returns the loginConfig of the FormLoginConfig.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((FormLoginConfig) object).getLoginConfig();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the formLoginPage feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormLoginPage_UI_"), //$NON-NLS-1$ = "FormLoginPage"
+ WebAppEditResourceHandler.getString("The_formLoginPage_property_UI_"), //$NON-NLS-1$ = "The formLoginPage property"
+ pkg.getFormLoginConfig_FormLoginPage()));
+
+ // This is for the formErrorPage feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormErrorPage_UI_"), //$NON-NLS-1$ = "FormErrorPage"
+ WebAppEditResourceHandler.getString("The_formErrorPage_property_UI_"), //$NON-NLS-1$ = "The formErrorPage property"
+ pkg.getFormLoginConfig_FormErrorPage()));
+
+ // This is for the loginConfig feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("LoginConfig_UI_"), //$NON-NLS-1$ = "LoginConfig"
+ WebAppEditResourceHandler.getString("The_loginConfig_property_UI_"), //$NON-NLS-1$ = "The loginConfig property"
+ pkg.getFormLoginConfig_LoginConfig()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Form Login Page feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addFormLoginPagePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FormLoginConfig_formLoginPage_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FormLoginConfig_formLoginPage_feature", "_UI_FormLoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFormLoginConfig_FormLoginPage(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Form Error Page feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addFormErrorPagePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_FormLoginConfig_formErrorPage_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_FormLoginConfig_formErrorPage_feature", "_UI_FormLoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getFormLoginConfig_FormErrorPage(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("16concat_UI_", (new Object[]{((FormLoginConfig) object).getFormLoginPage()})); //$NON-NLS-1$ = "FormLoginConfig {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(FormLoginConfig.class)) {
+ case WebapplicationPackage.FORM_LOGIN_CONFIG__FORM_LOGIN_PAGE :
+ case WebapplicationPackage.FORM_LOGIN_CONFIG__FORM_ERROR_PAGE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java
new file mode 100644
index 0000000..634e0e3
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/HTTPMethodTypeItemProvider.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.HTTPMethodType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}
+ * object.
+ */
+public class HTTPMethodTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public HTTPMethodTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns http_type.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("http_type");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the resCollection of the HTTPMethodType.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((HTTPMethodType) object).getHttpMethod();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the httpMethod feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("HttpMethod_UI_"), //$NON-NLS-1$ = "HttpMethod"
+ WebAppEditResourceHandler.getString("The_httpMethod_property_UI_"), //$NON-NLS-1$ = "The httpMethod property"
+ pkg.getHTTPMethodType_HttpMethod()));
+
+ // This is for the resCollection feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ResCollection_UI_"), //$NON-NLS-1$ = "ResCollection"
+ WebAppEditResourceHandler.getString("The_resCollection_property_UI_"), //$NON-NLS-1$ = "The resCollection property"
+ pkg.getHTTPMethodType_HttpMethod()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Http Method feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addHttpMethodPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_HTTPMethodType_httpMethod_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_HTTPMethodType_httpMethod_feature", "_UI_HTTPMethodType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getHTTPMethodType_HttpMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("17concat_UI_", (new Object[]{((HTTPMethodType) object).getHttpMethod()})); //$NON-NLS-1$ = "HTTPMethodType {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(HTTPMethodType.class)) {
+ case WebapplicationPackage.HTTP_METHOD_TYPE__HTTP_METHOD : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java
new file mode 100644
index 0000000..d2d105b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/InitParamItemProvider.java
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.InitParam;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}object.
+ */
+public class InitParamItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public InitParamItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns initializ_parameter.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("initializ_parameter"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the servlet of the InitParam.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((InitParam) object).eContainer();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the paramName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamName_UI_"), //$NON-NLS-1$ = "ParamName"
+ WebAppEditResourceHandler.getString("The_paramName_property_UI_"), //$NON-NLS-1$ = "The paramName property"
+ pkg.getInitParam_ParamName()));
+
+ // This is for the paramValue feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ParamValue_UI_"), //$NON-NLS-1$ = "ParamValue"
+ WebAppEditResourceHandler.getString("The_paramValue_property_UI_"), //$NON-NLS-1$ = "The paramValue property"
+ pkg.getInitParam_ParamValue()));
+
+ // This is for the description feature.
+ //
+ WebToolingItemPropertyDescriptor propertyDescriptor = new WebToolingItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ pkg.getInitParam_Description(), WebToolingItemPropertyDescriptor.MULTILINE_TEXT_EDITOR);
+ itemPropertyDescriptors.add(propertyDescriptor);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Param Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addParamNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_paramName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InitParam_paramName_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getInitParam_ParamName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Param Value feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addParamValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_paramValue_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InitParam_paramValue_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getInitParam_ParamValue(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_InitParam_description_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InitParam_description_feature", "_UI_InitParam_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getInitParam_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public Object getPropertyValue(Object object, String property) {
+ Object ret = null;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object);
+ } else
+ ret = super.getPropertyValue(object, property);
+ return ret;
+ }
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("18concat_UI_", (new Object[]{((InitParam) object).getParamName(), ((InitParam) object).getParamValue()})); //$NON-NLS-1$ = "{0} = {1}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(InitParam.class)) {
+ case WebapplicationPackage.INIT_PARAM__PARAM_NAME :
+ case WebapplicationPackage.INIT_PARAM__PARAM_VALUE :
+ case WebapplicationPackage.INIT_PARAM__DESCRIPTION : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+ /**
+ * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet}
+ * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public boolean isPropertySet(Object object, String property) {
+ boolean ret = false;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object);
+ } else
+ ret = super.isPropertySet(object, property);
+ return ret;
+ }
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public void setPropertyValue(Object object, String property, Object value) {
+
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value);
+ } else
+ super.setPropertyValue(object, property, value);
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java
new file mode 100644
index 0000000..ac3a14d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ItemHolder.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.Vector;
+
+import org.eclipse.emf.edit.provider.ItemProvider;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+
+/**
+ * Insert the type's description here. Creation date: (6/18/2001 5:53:02 PM)
+ *
+ * @author: Administrator
+ */
+public class ItemHolder extends ItemProvider {
+ protected WebApp webApp;
+ protected WebArtifactEdit webArtifactEdit;
+
+ public ItemHolder() {
+ super();
+ }
+
+ /**
+ * Jarholder constructor comment.
+ */
+ public ItemHolder(WebApp webApp) {
+ super();
+ setWebApp(webApp);
+ }
+ public ItemHolder(WebArtifactEdit webArtifactEdit) {
+ super();
+ setWebArtifactEdit(webArtifactEdit);
+ }
+
+ @Override
+ public Collection getChildren(Object element) {
+ WebApp testElement;
+ Vector v = new Vector();
+ if (element instanceof ItemHolder) {
+ testElement = ((ItemHolder) element).getWebApp();
+ v.add(testElement);
+ }
+ return v;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/18/2001 6:00:43 PM)
+ *
+ * @return org.eclipse.jst.j2ee.internal.internal.ejb.EJBJar
+ */
+ public WebApp getWebApp() {
+ return webApp;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/18/2001 6:00:43 PM)
+ *
+ * @param newJar
+ * org.eclipse.jst.j2ee.internal.internal.ejb.EJBJar
+ */
+ public void setWebApp(WebApp aWebApp) {
+ webApp = aWebApp;
+ }
+
+ public WebArtifactEdit getWebArtifactEdit() {
+ return webArtifactEdit;
+ }
+
+ public void setWebArtifactEdit(WebArtifactEdit webArtifactEdit) {
+ this.webArtifactEdit = webArtifactEdit;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java
new file mode 100644
index 0000000..b14dacb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPConfigItemProvider.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.jsp.JSPConfig;
+import org.eclipse.jst.j2ee.jsp.JspFactory;
+import org.eclipse.jst.j2ee.jsp.JspPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link com.ibm.etools.jsp.JSPConfig}object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class JSPConfigItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public JSPConfigItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and
+ * {@link org.eclipse.emf.edit.command.AddCommand}and
+ * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ if (childrenReferences == null) {
+ super.getChildrenReferences(object);
+ childrenReferences.add(JspPackage.eINSTANCE.getJSPConfig_TagLibs());
+ childrenReferences.add(JspPackage.eINSTANCE.getJSPConfig_PropertyGroups());
+ }
+ return childrenReferences;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns JSPConfig.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("full/obj16/JSPConfig"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("_UI_JSPConfig_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(JSPConfig.class)) {
+ case JspPackage.JSP_CONFIG__TAG_LIBS :
+ case JspPackage.JSP_CONFIG__PROPERTY_GROUPS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(JspPackage.eINSTANCE.getJSPConfig_TagLibs(), JspFactory.eINSTANCE.createTagLibRefType()));
+
+ newChildDescriptors.add(createChildParameter(JspPackage.eINSTANCE.getJSPConfig_PropertyGroups(), JspFactory.eINSTANCE.createJSPPropertyGroup()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java
new file mode 100644
index 0000000..bd0a2df
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPPropertyGroupItemProvider.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.jsp.JSPPropertyGroup;
+import org.eclipse.jst.j2ee.jsp.JspPackage;
+
+/**
+ * This is the item provider adpater for a {@link com.ibm.etools.jsp.JSPPropertyGroup}object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class JSPPropertyGroupItemProvider extends CompatibilityDescriptionGroupItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public JSPPropertyGroupItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addUrlPatternPropertyDescriptor(object);
+ addElIgnoredPropertyDescriptor(object);
+ addPageEncodingPropertyDescriptor(object);
+ addScriptingInvalidPropertyDescriptor(object);
+ addIsXMLPropertyDescriptor(object);
+ addIncludePreludesPropertyDescriptor(object);
+ addIncludeCodasPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addUrlPatternPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_urlPattern_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_urlPattern_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the El Ignored feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addElIgnoredPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_elIgnored_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_elIgnored_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_ElIgnored(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Page Encoding feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addPageEncodingPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_pageEncoding_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_pageEncoding_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_PageEncoding(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Scripting Invalid feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addScriptingInvalidPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_scriptingInvalid_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_scriptingInvalid_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_ScriptingInvalid(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Is XML feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addIsXMLPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_isXML_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_isXML_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_IsXML(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Include Preludes feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addIncludePreludesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_includePreludes_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_includePreludes_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_IncludePreludes(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Include Codas feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addIncludeCodasPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPPropertyGroup_includeCodas_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPPropertyGroup_includeCodas_feature", "_UI_JSPPropertyGroup_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JspPackage.eINSTANCE.getJSPPropertyGroup_IncludeCodas(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ /**
+ * This returns JSPPropertyGroup.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("full/obj16/JSPPropertyGroup"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((JSPPropertyGroup) object).getDisplayName();
+ return label == null || label.length() == 0 ? getString("_UI_JSPPropertyGroup_type") : //$NON-NLS-1$
+ getString("_UI_JSPPropertyGroup_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(JSPPropertyGroup.class)) {
+ case JspPackage.JSP_PROPERTY_GROUP__URL_PATTERN :
+ case JspPackage.JSP_PROPERTY_GROUP__EL_IGNORED :
+ case JspPackage.JSP_PROPERTY_GROUP__PAGE_ENCODING :
+ case JspPackage.JSP_PROPERTY_GROUP__SCRIPTING_INVALID :
+ case JspPackage.JSP_PROPERTY_GROUP__IS_XML :
+ case JspPackage.JSP_PROPERTY_GROUP__INCLUDE_PRELUDES :
+ case JspPackage.JSP_PROPERTY_GROUP__INCLUDE_CODAS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ // return J2EEPlugin.getDefault();
+ return WebAppEditResourceHandler.RESOURCE_LOCATOR;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java
new file mode 100644
index 0000000..0e28021
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JSPTypeItemProvider.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.JSPType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}object.
+ */
+public class JSPTypeItemProvider extends WebTypeItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public JSPTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns jsp_type.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("jsp_type");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the jspFile feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("JspFile_UI_"), //$NON-NLS-1$ = "JspFile"
+ WebAppEditResourceHandler.getString("The_jspFile_property_UI_"), //$NON-NLS-1$ = "The jspFile property"
+ pkg.getJSPType_JspFile()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Jsp File feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addJspFilePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_JSPType_jspFile_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_JSPType_jspFile_feature", "_UI_JSPType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getJSPType_JspFile(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("40concat_UI_", (new Object[]{((JSPType) object).getJspFile()})); //$NON-NLS-1$ = "JSPType {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(JSPType.class)) {
+ case WebapplicationPackage.JSP_TYPE__JSP_FILE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java
new file mode 100644
index 0000000..3c66df7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/JspItemProviderAdapterFactory.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.jst.j2ee.jsp.internal.util.JspAdapterFactory;
+
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers. The
+ * adapters generated by this factory convert EMF adapter notifications into calls to
+ * {@link #fireNotifyChanged fireNotifyChanged}. The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+public class JspItemProviderAdapterFactory extends JspAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by
+ * {@link #isFactoryForType isFactoryForType}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection supportedTypes = new ArrayList();
+
+ /**
+ * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public JspItemProviderAdapterFactory() {
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.JSPConfig}
+ * instances. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected JSPConfigItemProvider jspConfigItemProvider;
+
+ /**
+ * This creates an adapter for a {@link com.ibm.etools.jsp.JSPConfig}. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createJSPConfigAdapter() {
+ if (jspConfigItemProvider == null) {
+ jspConfigItemProvider = new JSPConfigItemProvider(this);
+ }
+
+ return jspConfigItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.JSPPropertyGroup}
+ * instances. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected JSPPropertyGroupItemProvider jspPropertyGroupItemProvider;
+
+ /**
+ * This creates an adapter for a {@link com.ibm.etools.jsp.JSPPropertyGroup}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createJSPPropertyGroupAdapter() {
+ if (jspPropertyGroupItemProvider == null) {
+ jspPropertyGroupItemProvider = new JSPPropertyGroupItemProvider(this);
+ }
+
+ return jspPropertyGroupItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link com.ibm.etools.jsp.TagLibRefType}
+ * instances. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TagLibRefTypeItemProvider tagLibRefTypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link com.ibm.etools.jsp.TagLibRefType}. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createTagLibRefTypeAdapter() {
+ if (tagLibRefTypeItemProvider == null) {
+ tagLibRefTypeItemProvider = new TagLibRefTypeItemProvider(this);
+ }
+
+ return tagLibRefTypeItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier}and to {@link #parentAdapterFactory}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java
new file mode 100644
index 0000000..d77fdff
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingItemProvider.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.LocalEncodingMapping;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}object. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+public class LocalEncodingMappingItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public LocalEncodingMappingItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addLocalePropertyDescriptor(object);
+ addEncodingPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Locale feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addLocalePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LocalEncodingMapping_locale_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_LocalEncodingMapping_locale_feature", "_UI_LocalEncodingMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getLocalEncodingMapping_Locale(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Encoding feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addEncodingPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LocalEncodingMapping_encoding_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_LocalEncodingMapping_encoding_feature", "_UI_LocalEncodingMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getLocalEncodingMapping_Encoding(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ /**
+ * This returns LocalEncodingMapping.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ */
+ @Override
+ public Object getImage(Object object) {
+ // return getResourceLocator().getImage("full/obj16/LocalEncodingMapping");
+ return WebPlugin.getDefault().getImage("local_encoding_mapping");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ */
+ @Override
+ public String getText(Object object) {
+ String lem = WebAppEditResourceHandler.getString("local_encoding_mapping_UI_"); //$NON-NLS-1$
+ String label = ((LocalEncodingMapping) object).getLocale();
+ return label == null || label.length() == 0 ? lem : lem + " " + label; //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(LocalEncodingMapping.class)) {
+ case WebapplicationPackage.LOCAL_ENCODING_MAPPING__LOCALE :
+ case WebapplicationPackage.LOCAL_ENCODING_MAPPING__ENCODING : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java
new file mode 100644
index 0000000..18a9f93
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LocalEncodingMappingListItemProvider.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.LocalEncodingMappingList;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class LocalEncodingMappingListItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public LocalEncodingMappingListItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and
+ * {@link org.eclipse.emf.edit.command.AddCommand}and
+ * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ if (childrenReferences == null) {
+ super.getChildrenReferences(object);
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getLocalEncodingMappingList_LocalEncodingMappings());
+ }
+ return childrenReferences;
+ }
+
+
+ /**
+ * This returns LocalEncodingMappingList.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ */
+ @Override
+ public Object getImage(Object object) {
+ // return getResourceLocator().getImage("full/obj16/LocalEncodingMappingList");
+ return WebPlugin.getDefault().getImage("local_encoding_mapping_list");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ */
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Local_encoding_mapping_list_UI_"); //$NON-NLS-1$ = "Welcome File List"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(LocalEncodingMappingList.class)) {
+ case WebapplicationPackage.LOCAL_ENCODING_MAPPING_LIST__LOCAL_ENCODING_MAPPINGS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getLocalEncodingMappingList_LocalEncodingMappings(), WebapplicationFactory.eINSTANCE.createLocalEncodingMapping()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java
new file mode 100644
index 0000000..064cd44
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/LoginConfigItemProvider.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.LoginConfig;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}object.
+ */
+public class LoginConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public LoginConfigItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object createChild(Object object) {
+ // TODO: create some child object.
+ return null;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ Collection result = new ArrayList();
+ result.add(pkg.getLoginConfig_FormLoginConfig());
+ return result;
+ }
+
+ //TODO Removing UI dependency by commenting out method
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ /*
+ * public ImageDescriptor getCreateChildImageDescriptor(Object object) { EObject refObject =
+ * (EObject)object; return
+ * WEBUIPlugin.getDefault().getImageDescriptor(refObject.eClass().getName() +
+ * "Create#CHILD_CLASS_NAME#");//$NON-NLS-1$ }
+ */
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_#CHILD_CLASS_NAME#_UI_"); //$NON-NLS-1$ = "Create #CHILD_CLASS_NAME#"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("1concat", (new Object[]{refObject.eClass().getName()}));//$NON-NLS-1$ = "Create a child of type #CHILD_CLASS_NAME# for the selected {0}."
+ }
+
+ /**
+ * This returns form_login_config.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("form_login_config");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the LoginConfig.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((LoginConfig) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the authMethod feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("AuthMethod_UI_"), //$NON-NLS-1$ = "AuthMethod"
+ WebAppEditResourceHandler.getString("The_authMethod_property_UI_"), //$NON-NLS-1$ = "The authMethod property"
+ pkg.getLoginConfig_AuthMethod()));
+
+ // This is for the realmName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("RealmName_UI_"), //$NON-NLS-1$ = "RealmName"
+ WebAppEditResourceHandler.getString("The_realmName_property_UI_"), //$NON-NLS-1$ = "The realmName property"
+ pkg.getLoginConfig_RealmName()));
+
+ // This is for the webApp feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The webApp property"
+ pkg.getLoginConfig_WebApp()));
+
+ // This is for the formLoginConfig feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FormLoginConfig_UI_"), //$NON-NLS-1$ = "FormLoginConfig"
+ WebAppEditResourceHandler.getString("The_formLoginConfig_proper_UI_"), //$NON-NLS-1$ = "The formLoginConfig property"
+ pkg.getLoginConfig_FormLoginConfig()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Auth Method feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addAuthMethodPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_authMethod_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_authMethod_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getLoginConfig_AuthMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Realm Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addRealmNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_realmName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_realmName_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getLoginConfig_RealmName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Authorization Method feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addAuthorizationMethodPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_LoginConfig_authorizationMethod_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_LoginConfig_authorizationMethod_feature", "_UI_LoginConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getLoginConfig_AuthorizationMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("21concat_UI_", (new Object[]{((LoginConfig) object).getRealmName()})); //$NON-NLS-1$ = "LoginConfig {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(LoginConfig.class)) {
+ case WebapplicationPackage.LOGIN_CONFIG__AUTH_METHOD :
+ case WebapplicationPackage.LOGIN_CONFIG__REALM_NAME :
+ case WebapplicationPackage.LOGIN_CONFIG__AUTHORIZATION_METHOD :
+ case WebapplicationPackage.LOGIN_CONFIG__FORM_LOGIN_CONFIG : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getLoginConfig_FormLoginConfig(), WebapplicationFactory.eINSTANCE.createFormLoginConfig()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java
new file mode 100644
index 0000000..e216e4f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/MimeMappingItemProvider.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.MimeMapping;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}object.
+ */
+public class MimeMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public MimeMappingItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns mime_mapping.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("mime_mapping");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the MimeMapping.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((MimeMapping) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the extension feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Extension_UI_"), //$NON-NLS-1$ = "Extension"
+ WebAppEditResourceHandler.getString("The_extension_property_UI_"), //$NON-NLS-1$ = "The extension property"
+ pkg.getMimeMapping_Extension()));
+
+ // This is for the mimeType feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("MimeType_UI_"), //$NON-NLS-1$ = "MimeType"
+ WebAppEditResourceHandler.getString("The_mimeType_property_UI_"), //$NON-NLS-1$ = "The mimeType property"
+ pkg.getMimeMapping_MimeType()));
+
+ // This is for the webApp feature.
+ //
+ /*
+ * itemPropertyDescriptors.add (new ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The
+ * webApp property" pkg.getMimeMapping_WebApp()));
+ */
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Extension feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addExtensionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_MimeMapping_extension_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_MimeMapping_extension_feature", "_UI_MimeMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getMimeMapping_Extension(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Mime Type feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addMimeTypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_MimeMapping_mimeType_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_MimeMapping_mimeType_feature", "_UI_MimeMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getMimeMapping_MimeType(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("22concat_UI_", (new Object[]{((MimeMapping) object).getExtension()})); //$NON-NLS-1$ = "MimeMapping {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(MimeMapping.class)) {
+ case WebapplicationPackage.MIME_MAPPING__EXTENSION :
+ case WebapplicationPackage.MIME_MAPPING__MIME_TYPE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java
new file mode 100644
index 0000000..32528bd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/RoleNameTypeItemProvider.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.RoleNameType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType}
+ * object.
+ */
+public class RoleNameTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public RoleNameTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns security_role_nametype.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("security_role_nametype");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the roleName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("RoleName_UI_"), //$NON-NLS-1$ = "RoleName"
+ WebAppEditResourceHandler.getString("The_roleName_property_UI_"), //$NON-NLS-1$ = "The roleName property"
+ pkg.getRoleNameType_RoleName()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Role Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addRoleNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_RoleNameType_roleName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_RoleNameType_roleName_feature", "_UI_RoleNameType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getRoleNameType_RoleName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("23concat_UI_", (new Object[]{((RoleNameType) object).getRoleName()})); //$NON-NLS-1$ = "RoleNameType {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(RoleNameType.class)) {
+ case WebapplicationPackage.ROLE_NAME_TYPE__ROLE_NAME : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java
new file mode 100644
index 0000000..08a2e4d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SecurityConstraintItemProvider.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.DisplayName;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.SecurityConstraint;
+import org.eclipse.jst.j2ee.webapplication.WebResourceCollection;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory;
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint}
+ * object.
+ */
+public class SecurityConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public SecurityConstraintItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ WebResourceCollection child = WebapplicationFactory.eINSTANCE.createWebResourceCollection();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ Collection result = new ArrayList();
+ result.add(pkg.getSecurityConstraint_WebResourceCollections());
+ result.add(pkg.getSecurityConstraint_AuthConstraint());
+ result.add(pkg.getSecurityConstraint_UserDataConstraint());
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateWebResourceCollection"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_WebResourceCollecti_UI_"); //$NON-NLS-1$ = "Create WebResourceCollection"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("24concat", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type WebResourceCollection for the selected {0}."
+ }
+
+ /**
+ * This returns security_constraint.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("security_constraint"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the SecurityConstraint.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((SecurityConstraint) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the webApp feature.
+ //
+ /*
+ * itemPropertyDescriptors.add (new ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The
+ * webApp property" pkg.getSecurityConstraint_WebApp()));
+ */
+
+ // This is for the displayName feature.
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("DisplayName_UI_"), //$NON-NLS-1$ = "DisplayName"
+ WebAppEditResourceHandler.getString("The_displayName_property_UI_"), //$NON-NLS-1$ = "The displayName property"
+ pkg.getSecurityConstraint_DisplayName()));
+
+ // This is for the authConstraint feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("AuthConstraint_UI_"), //$NON-NLS-1$ = "AuthConstraint"
+ WebAppEditResourceHandler.getString("The_authConstraint_propert_UI_"), //$NON-NLS-1$ = "The authConstraint property"
+ pkg.getSecurityConstraint_AuthConstraint()));
+
+ // This is for the userDataConstraint feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UserDataConstraint_UI_"), //$NON-NLS-1$ = "UserDataConstraint"
+ WebAppEditResourceHandler.getString("The_userDataConstraint_pro_UI_"), //$NON-NLS-1$ = "The userDataConstraint property"
+ pkg.getSecurityConstraint_UserDataConstraint()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Display Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDisplayNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_SecurityConstraint_displayName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_SecurityConstraint_displayName_feature", "_UI_SecurityConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ @Override
+ public String getText(Object object) {
+ String displayName = ((SecurityConstraint) object).getDisplayName();
+ if (displayName == null) {
+ List displayNameList = ((SecurityConstraint) object).getDisplayNames();
+ if (displayNameList != null && displayNameList.size() > 0)
+ displayName = ((DisplayName) displayNameList.get(0)).getValue();
+ }
+ if (displayName == null)
+ displayName = ""; //$NON-NLS-1$
+ return " " + displayName; //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(SecurityConstraint.class)) {
+ case WebapplicationPackage.SECURITY_CONSTRAINT__DISPLAY_NAME :
+ case WebapplicationPackage.SECURITY_CONSTRAINT__WEB_RESOURCE_COLLECTIONS :
+ case WebapplicationPackage.SECURITY_CONSTRAINT__AUTH_CONSTRAINT :
+ case WebapplicationPackage.SECURITY_CONSTRAINT__USER_DATA_CONSTRAINT :
+ case WebapplicationPackage.SECURITY_CONSTRAINT__DISPLAY_NAMES : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_WebResourceCollections(), WebapplicationFactory.eINSTANCE.createWebResourceCollection()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_AuthConstraint(), WebapplicationFactory.eINSTANCE.createAuthConstraint()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_UserDataConstraint(), WebapplicationFactory.eINSTANCE.createUserDataConstraint()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayNames(), CommonFactory.eINSTANCE.createDisplayName()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getSecurityConstraint_DisplayNames(), WscommonFactory.eINSTANCE.createDisplayNameType()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java
new file mode 100644
index 0000000..82a76b5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletItemProvider.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.internal.provider.CompatibilityDescriptionGroupItemProvider;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.InitParam;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+public class ServletItemProvider extends CompatibilityDescriptionGroupItemProvider {
+
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ServletItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ InitParam child = WebapplicationFactory.eINSTANCE.createInitParam();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ Collection result = new ArrayList();
+ //result.add(pkg.getServlet_WebType());
+ WebApp webApp = (WebApp) ((Servlet) object).eContainer();
+ if (webApp == null)
+ return result;
+ if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID)
+ result.add(pkg.getServlet_InitParams());
+ else
+ result.add(pkg.getServlet_Params());
+ result.add(pkg.getServlet_SecurityRoleRefs());
+ result.add(pkg.getServlet_RunAs());
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateInitParam"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_InitParam_UI_"); //$NON-NLS-1$ = "Create InitParam"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("26concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type InitParam for the selected {0}."
+ }
+
+ /**
+ * This returns Servlet.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ WebType wt = ((Servlet) object).getWebType();
+ if (wt != null && wt.isJspType())
+ return WebPlugin.getDefault().getImage("jsp_type"); //$NON-NLS-1$
+
+ return WebPlugin.getDefault().getImage("servlet"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the Servlet.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((Servlet) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the servletName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ServletName_UI_"), //$NON-NLS-1$
+ //$NON-NLS-1$ = "ServletName"
+ WebAppEditResourceHandler.getString("The_servletName_property_UI_"), //$NON-NLS-1$ = "The servletName property"
+ pkg.getServlet_ServletName()));
+
+
+ // This is for the loadOnStartup feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("LoadOnStartup_UI_"), //$NON-NLS-1$
+ //$NON-NLS-1$ = "LoadOnStartup"
+ WebAppEditResourceHandler.getString("The_loadOnStartup_property_UI_"), //$NON-NLS-1$ = "The loadOnStartup property"
+ pkg.getServlet_LoadOnStartup(), false));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Servlet Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addServletNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Servlet_servletName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Servlet_servletName_feature", "_UI_Servlet_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServlet_ServletName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Load On Startup feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addLoadOnStartupPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_Servlet_loadOnStartup_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Servlet_loadOnStartup_feature", "_UI_Servlet_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServlet_LoadOnStartup(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#getPropertyValue IItemPropertySource.getPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public Object getPropertyValue(Object object, String property) {
+ Object ret = null;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).getPropertyValue(object);
+ } else
+ ret = super.getPropertyValue(object, property);
+ return ret;
+ }
+
+ @Override
+ public String getText(Object object) {
+ Servlet servlet = (Servlet) object;
+ String name = servlet.getServletName();
+ if (name == null)
+ name = WebAppEditResourceHandler.getString("<servlet>_UI_"); //$NON-NLS-1$ = "<servlet>"
+ return name;
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(Servlet.class)) {
+ case WebapplicationPackage.SERVLET__SERVLET_NAME :
+ case WebapplicationPackage.SERVLET__LOAD_ON_STARTUP :
+ case WebapplicationPackage.SERVLET__WEB_TYPE :
+ case WebapplicationPackage.SERVLET__PARAMS :
+ case WebapplicationPackage.SERVLET__SECURITY_ROLE_REFS :
+ case WebapplicationPackage.SERVLET__RUN_AS :
+ case WebapplicationPackage.SERVLET__INIT_PARAMS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_WebType(), WebapplicationFactory.eINSTANCE.createServletType()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_WebType(), WebapplicationFactory.eINSTANCE.createJSPType()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_Params(), WebapplicationFactory.eINSTANCE.createInitParam()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_SecurityRoleRefs(), CommonFactory.eINSTANCE.createSecurityRoleRef()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_RunAs(), CommonFactory.eINSTANCE.createRunAsSpecifiedIdentity()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getServlet_InitParams(), CommonFactory.eINSTANCE.createParamValue()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This implements {@link IItemPropertySource#isPropertySet IItemPropertySource.isPropertySet}
+ * by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public boolean isPropertySet(Object object, String property) {
+ boolean ret = false;
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ret = ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).isPropertySet(object);
+ } else
+ ret = super.isPropertySet(object, property);
+ return ret;
+ }
+
+
+ /**
+ * This implements
+ * {@link IItemPropertySource#setPropertyValue IItemPropertySource.setPropertyValue}by
+ * delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor
+ * interface
+ */
+ @Override
+ public void setPropertyValue(Object object, String property, Object value) {
+
+ if (getPropertyDescriptor(object, property) instanceof WebToolingItemPropertyDescriptor) {
+ ((WebToolingItemPropertyDescriptor) getPropertyDescriptor(object, property)).setPropertyValue(object, value);
+ } else
+ super.setPropertyValue(object, property, value);
+
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java
new file mode 100644
index 0000000..1c9463b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletMappingItemProvider.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.ServletMapping;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping}
+ * object.
+ */
+public class ServletMappingItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ServletMappingItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns servlet_mapping.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("servlet_mapping");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the ServletMapping.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((ServletMapping) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the urlPattern feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern"
+ WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property"
+ pkg.getServletMapping_UrlPattern()));
+
+
+ // This is for the servlet feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Servlet_UI_"), //$NON-NLS-1$ = "Servlet"
+ WebAppEditResourceHandler.getString("The_servlet_property_UI_"), //$NON-NLS-1$ = "The servlet property"
+ pkg.getServletMapping_Servlet(), false));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addUrlPatternPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_urlPattern_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_urlPattern_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServletMapping_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_name_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_name_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServletMapping_Name(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Servlet feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addServletPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletMapping_servlet_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ServletMapping_servlet_feature", "_UI_ServletMapping_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServletMapping_Servlet(), false));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ String urlStr = ((ServletMapping) object).getUrlPattern();
+ Servlet servlet = ((ServletMapping) object).getServlet();
+ String servletStr = (servlet == null) ? WebAppEditResourceHandler.getString("?_UI_") : servlet.getServletName(); //$NON-NLS-1$ = "?"
+ return WebAppEditResourceHandler.getString("28concat_UI_", (new Object[]{urlStr, servletStr})); //$NON-NLS-1$ = "Servlet mapping ({0} -> {1})"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(ServletMapping.class)) {
+ case WebapplicationPackage.SERVLET_MAPPING__URL_PATTERN :
+ case WebapplicationPackage.SERVLET_MAPPING__NAME :
+ case WebapplicationPackage.SERVLET_MAPPING__SERVLET : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java
new file mode 100644
index 0000000..688873d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/ServletTypeItemProvider.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.ServletType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}object.
+ */
+public class ServletTypeItemProvider extends WebTypeItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public ServletTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns servlet_type.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("servlet_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the className feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ClassName_UI_"), //$NON-NLS-1$ = "ClassName"
+ WebAppEditResourceHandler.getString("The_className_property_UI_"), //$NON-NLS-1$ = "The className property"
+ pkg.getServletType_ClassName()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Class Name feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addClassNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_ServletType_className_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_ServletType_className_feature", "_UI_ServletType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getServletType_ClassName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("41concat_UI_", (new Object[]{((ServletType) object).getClassName()})); //$NON-NLS-1$ = "ServletType {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(ServletType.class)) {
+ case WebapplicationPackage.SERVLET_TYPE__CLASS_NAME : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java
new file mode 100644
index 0000000..8c5120c
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/SessionConfigItemProvider.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.SessionConfig;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig}
+ * object.
+ */
+public class SessionConfigItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public SessionConfigItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns session_config.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("session_config");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the SessionConfig.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((SessionConfig) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the sessionTimeout feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SessionTimeout_UI_"), //$NON-NLS-1$ = "SessionTimeout"
+ WebAppEditResourceHandler.getString("The_sessionTimeout_propert_UI_"), //$NON-NLS-1$ = "The sessionTimeout property"
+ pkg.getSessionConfig_SessionTimeout()));
+
+ // This is for the webApp feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The webApp property"
+ pkg.getSessionConfig_WebApp()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Session Timeout feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addSessionTimeoutPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_SessionConfig_sessionTimeout_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_SessionConfig_sessionTimeout_feature", "_UI_SessionConfig_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getSessionConfig_SessionTimeout(), true, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("31concat_UI_", (new Object[]{new Integer(((SessionConfig) object).getSessionTimeout())})); //$NON-NLS-1$ = "SessionConfig {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(SessionConfig.class)) {
+ case WebapplicationPackage.SESSION_CONFIG__SESSION_TIMEOUT : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java
new file mode 100644
index 0000000..11f328f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefItemProvider.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.TagLibRef;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}object.
+ */
+public class TagLibRefItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public TagLibRefItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns jsp_library_reference.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("jsp_library_reference");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the TagLibRef.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((TagLibRef) object).getWebApp();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the taglibURI feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$ = "TaglibURI"
+ WebAppEditResourceHandler.getString("The_taglibURI_property_UI_"), //$NON-NLS-1$ = "The taglibURI property"
+ pkg.getTagLibRef_TaglibURI()));
+
+ // This is for the taglibLocation feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$ = "TaglibLocation"
+ WebAppEditResourceHandler.getString("The_taglibLocation_propert_UI_"), //$NON-NLS-1$ = "The taglibLocation property"
+ pkg.getTagLibRef_TaglibLocation()));
+
+ // This is for the webApp feature.
+ //
+ /*
+ * itemPropertyDescriptors.add (new ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ * WebAppEditResourceHandler.getString("WebApp_UI_"), //$NON-NLS-1$ = "WebApp"
+ * WebAppEditResourceHandler.getString("The_webApp_property_UI_"), //$NON-NLS-1$ = "The
+ * webApp property" pkg.getTagLibRef_WebApp()));
+ */
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Taglib URI feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addTaglibURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_TagLibRef_taglibURI_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_TagLibRef_taglibURI_feature", "_UI_TagLibRef_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getTagLibRef_TaglibURI(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Taglib Location feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addTaglibLocationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_TagLibRef_taglibLocation_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_TagLibRef_taglibLocation_feature", "_UI_TagLibRef_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getTagLibRef_TaglibLocation(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("32concat_UI_", (new Object[]{((TagLibRef) object).getTaglibURI()})); //$NON-NLS-1$ = "TagLibRef {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(TagLibRef.class)) {
+ case WebapplicationPackage.TAG_LIB_REF__TAGLIB_URI :
+ case WebapplicationPackage.TAG_LIB_REF__TAGLIB_LOCATION : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java
new file mode 100644
index 0000000..9cbd7be
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/TagLibRefTypeItemProvider.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.jsp.JspPackage;
+import org.eclipse.jst.j2ee.jsp.TagLibRefType;
+
+/**
+ * This is the item provider adpater for a {@link com.ibm.etools.jsp.TagLibRefType}object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class TagLibRefTypeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public TagLibRefTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addTaglibURIPropertyDescriptor(object);
+ addTaglibLocationPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Taglib URI feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addTaglibURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$
+ WebAppEditResourceHandler.getString("URI_UI_"), //$NON-NLS-1$
+ JspPackage.eINSTANCE.getTagLibRefType_TaglibURI(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Taglib Location feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addTaglibLocationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$
+ WebAppEditResourceHandler.getString("Location_UI_"), //$NON-NLS-1$
+ JspPackage.eINSTANCE.getTagLibRefType_TaglibLocation(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ /**
+ * This returns TagLibRefType.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("full/obj16/TagLibRefType"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((TagLibRefType) object).getTaglibURI();
+ String tlrt = WebAppEditResourceHandler.getString("_UI_TagLibRefType_type"); //$NON-NLS-1$
+ return label == null || label.length() == 0 ? tlrt : tlrt + " " + label; //$NON-NLS-1$
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(TagLibRefType.class)) {
+ case JspPackage.TAG_LIB_REF_TYPE__TAGLIB_URI :
+ case JspPackage.TAG_LIB_REF_TYPE__TAGLIB_LOCATION : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java
new file mode 100644
index 0000000..ecfb955
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/URLPatternTypeItemProvider.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.URLPatternType;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}
+ * object.
+ */
+public class URLPatternTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public URLPatternTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns url_type.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("url_type");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the resCollection of the URLPatternType.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((URLPatternType) object).getResCollection();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the urlPattern feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("UrlPattern_UI_"), //$NON-NLS-1$ = "UrlPattern"
+ WebAppEditResourceHandler.getString("The_urlPattern_property_UI_"), //$NON-NLS-1$ = "The urlPattern property"
+ pkg.getURLPatternType_UrlPattern()));
+
+ // This is for the resCollection feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("ResCollection_UI_"), //$NON-NLS-1$ = "ResCollection"
+ WebAppEditResourceHandler.getString("The_resCollection_property_UI_"), //$NON-NLS-1$ = "The resCollection property"
+ pkg.getURLPatternType_ResCollection()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addUrlPatternPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_URLPatternType_urlPattern_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_URLPatternType_urlPattern_feature", "_UI_URLPatternType_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getURLPatternType_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("33concat_UI_", (new Object[]{((URLPatternType) object).getUrlPattern()})); //$NON-NLS-1$ = "URLPatternType {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(URLPatternType.class)) {
+ case WebapplicationPackage.URL_PATTERN_TYPE__URL_PATTERN : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java
new file mode 100644
index 0000000..5ed05b7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/UserDataConstraintItemProvider.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.UserDataConstraint;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory;
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint}
+ * object.
+ */
+public class UserDataConstraintItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public UserDataConstraintItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns user_data_constraint.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("user_data_constraint"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the secConstraint of the UserDataConstraint.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((UserDataConstraint) object).getSecConstraint();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the description feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property"
+ pkg.getUserDataConstraint_Description()));
+
+ // This is for the transportGuarantee feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("TransportGuarantee_UI_"), //$NON-NLS-1$ = "TransportGuarantee"
+ WebAppEditResourceHandler.getString("The_transportGuarantee_pro_UI_"), //$NON-NLS-1$ = "The transportGuarantee property"
+ pkg.getUserDataConstraint_TransportGuarantee()));
+
+ // This is for the secConstraint feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint"
+ WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property"
+ pkg.getUserDataConstraint_SecConstraint()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_UserDataConstraint_description_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_UserDataConstraint_description_feature", "_UI_UserDataConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getUserDataConstraint_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Transport Guarantee feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addTransportGuaranteePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_UserDataConstraint_transportGuarantee_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_UserDataConstraint_transportGuarantee_feature", "_UI_UserDataConstraint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getUserDataConstraint_TransportGuarantee(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and
+ * {@link org.eclipse.emf.edit.command.AddCommand}and
+ * {@link org.eclipse.emf.edit.command.RemoveCommand}support in {@link #createCommand}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ if (childrenReferences == null) {
+ super.getChildrenReferences(object);
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions());
+ }
+ return childrenReferences;
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("34concat_UI_", (new Object[]{((UserDataConstraint) object).getTransportGuarantee().getName()})); //$NON-NLS-1$ = "UserDataConstraint {0}"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(UserDataConstraint.class)) {
+ case WebapplicationPackage.USER_DATA_CONSTRAINT__DESCRIPTION :
+ case WebapplicationPackage.USER_DATA_CONSTRAINT__TRANSPORT_GUARANTEE :
+ case WebapplicationPackage.USER_DATA_CONSTRAINT__DESCRIPTIONS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions(), CommonFactory.eINSTANCE.createDescription()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getUserDataConstraint_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java
new file mode 100644
index 0000000..8e82792
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppEditResourceHandler.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+
+public class WebAppEditResourceHandler {
+
+ private static ResourceBundle fgResourceBundle;
+
+ public static ResourceLocator RESOURCE_LOCATOR = new ResourceLocator() {
+ public URL getBaseURL() {
+ return null;
+ }
+
+ public Object getImage(String arg0) {
+ return WebPlugin.getDefault().getImage(arg0);
+ }
+
+ public String getString(String arg0) {
+ return WebAppEditResourceHandler.getString(arg0);
+ }
+
+ public String getString(String arg0, Object[] arg1) {
+ return WebAppEditResourceHandler.getString(arg0, arg1);
+ }
+ public String getString(String key, boolean translate) {
+ // TODO For now... translate not supported
+ return getString(key);
+ }
+
+ public String getString(String key, Object[] substitutions, boolean translate) {
+ // TODO For now... translate not supported
+ return getString(key,substitutions);
+ }
+ };
+
+ /**
+ * Returns the resource bundle used by all classes in this Project
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("webedit");//$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ // does nothing - this method will return null and
+ // getString(String) will return the key
+ // it was called with
+ }
+ return null;
+ }
+
+ public static String getString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle = getResourceBundle();
+ }
+
+ if (fgResourceBundle != null) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$
+
+ }
+
+ public static String getString(String key, Object[] args) {
+
+ try {
+ return MessageFormat.format(getString(key), args);
+ } catch (IllegalArgumentException e) {
+ return getString(key);
+ }
+
+ }
+
+ public static String getString(String key, Object[] args, int x) {
+
+ return getString(key);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java
new file mode 100644
index 0000000..3361daa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebAppItemProvider.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.common.CommonPackage;
+import org.eclipse.jst.j2ee.common.internal.provider.JNDIEnvRefsGroupItemProvider;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceExtManager;
+import org.eclipse.jst.j2ee.internal.webservices.WSDLServiceHelper;
+import org.eclipse.jst.j2ee.jsp.JspFactory;
+import org.eclipse.jst.j2ee.webapplication.ContextParam;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp}object.
+ */
+public class WebAppItemProvider extends JNDIEnvRefsGroupItemProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public WebAppItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ ContextParam child = WebapplicationFactory.eINSTANCE.createContextParam();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(java.lang.Object)
+ */
+ @Override
+ public Collection getChildren(Object object) {
+ WebApp webApp = (WebApp) object;
+ Collection myChildren = super.getChildren(object);
+ if (webApp.getVersionID() <= J2EEVersionConstants.WEB_2_3_ID) {
+ WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
+ myChildren.addAll(serviceHelper.get13ServiceRefs(webApp));
+ }
+ return myChildren;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+
+
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ if (childrenReferences == null) {
+ super.getChildrenReferences(object);
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Contexts());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_FileList());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_TagLibs());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Constraints());
+ //childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_LoginConfig());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_MimeMappings());
+ //childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_SessionConfig());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Servlets());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Filters());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_Listeners());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_ContextParams());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations());
+ childrenReferences.add(WebapplicationPackage.eINSTANCE.getWebApp_LocalEncodingMappingList());
+ }
+ return childrenReferences;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateContextParam"); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_ContextParam_UI_"); //$NON-NLS-1$ = "Create ContextParam"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("35concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type ContextParam for the selected {0}."
+ }
+
+ @Override
+ public Object getImage(Object object) {
+ String key = null;
+ if (((WebApp) object).eResource() == null)
+ return J2EEPlugin.getPlugin().getImage("web_application"); //$NON-NLS-1$
+ switch (((WebApp) object).getVersionID()) {
+ case J2EEVersionConstants.WEB_2_2_ID :
+ key = "webapp_22"; //$NON-NLS-1$
+ break;
+
+ case J2EEVersionConstants.WEB_2_3_ID :
+ key = "webapp_23"; //$NON-NLS-1$
+ break;
+
+ case J2EEVersionConstants.WEB_2_4_ID :
+ default :
+ key = "webapp_24"; //$NON-NLS-1$
+ break;
+ }
+ return WebPlugin.getDefault().getImage(key);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the distributable feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Distributable_UI_"), //$NON-NLS-1$
+ //$NON-NLS-1$ = "Distributable"
+ WebAppEditResourceHandler.getString("The_distributable_property_UI_"), //$NON-NLS-1$ = "The distributable property"
+ pkg.getWebApp_Distributable()));
+
+
+ // This is for the fileList feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("FileList_UI_"), //$NON-NLS-1$ = "FileList"
+ WebAppEditResourceHandler.getString("The_fileList_property_UI_"), //$NON-NLS-1$ = "The fileList property"
+ pkg.getWebApp_FileList()));
+
+ /*
+ * // ccc - for usability reasons, these descriptors are removed from the property
+ * sheet. // This is for the loginConfig feature. // itemPropertyDescriptors.add (new
+ * ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), "LoginConfig",
+ * "The loginConfig property", pkg.getWebApp_LoginConfig()));
+ * // This is for the sessionConfig feature. // itemPropertyDescriptors.add (new
+ * ItemPropertyDescriptor
+ * (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ * "SessionConfig", "The sessionConfig property", pkg.getWebApp_SessionConfig()));
+ */
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Distributable feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDistributablePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebApp_distributable_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebApp_distributable_feature", "_UI_WebApp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebApp_Distributable(), true, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Version feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addVersionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebApp_version_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebApp_version_feature", "_UI_WebApp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebApp_Version(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ @Override
+ public String getText(Object object) {
+ WebApp webApp = (WebApp) object;
+ String name = webApp.getDisplayName();
+ if (name == null)
+ name = WebAppEditResourceHandler.getString("<web_app>_UI_"); //$NON-NLS-1$ = "<web app>"
+ return name;
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(WebApp.class)) {
+ case WebapplicationPackage.WEB_APP__DISTRIBUTABLE :
+ case WebapplicationPackage.WEB_APP__VERSION :
+ case WebapplicationPackage.WEB_APP__CONTEXTS :
+ case WebapplicationPackage.WEB_APP__ERROR_PAGES :
+ case WebapplicationPackage.WEB_APP__FILE_LIST :
+ case WebapplicationPackage.WEB_APP__TAG_LIBS :
+ case WebapplicationPackage.WEB_APP__CONSTRAINTS :
+ case WebapplicationPackage.WEB_APP__LOGIN_CONFIG :
+ case WebapplicationPackage.WEB_APP__MIME_MAPPINGS :
+ case WebapplicationPackage.WEB_APP__SESSION_CONFIG :
+ case WebapplicationPackage.WEB_APP__SERVLET_MAPPINGS :
+ case WebapplicationPackage.WEB_APP__SERVLETS :
+ case WebapplicationPackage.WEB_APP__SECURITY_ROLES :
+ case WebapplicationPackage.WEB_APP__FILTERS :
+ case WebapplicationPackage.WEB_APP__FILTER_MAPPINGS :
+ case WebapplicationPackage.WEB_APP__LISTENERS :
+ case WebapplicationPackage.WEB_APP__CONTEXT_PARAMS :
+ case WebapplicationPackage.WEB_APP__JSP_CONFIG :
+ case WebapplicationPackage.WEB_APP__MESSAGE_DESTINATIONS :
+ case WebapplicationPackage.WEB_APP__LOCAL_ENCODING_MAPPING_LIST : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Contexts(), WebapplicationFactory.eINSTANCE.createContextParam()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createErrorPage()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createExceptionTypeErrorPage()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ErrorPages(), WebapplicationFactory.eINSTANCE.createErrorCodeErrorPage()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_FileList(), WebapplicationFactory.eINSTANCE.createWelcomeFileList()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_TagLibs(), WebapplicationFactory.eINSTANCE.createTagLibRef()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Constraints(), WebapplicationFactory.eINSTANCE.createSecurityConstraint()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_LoginConfig(), WebapplicationFactory.eINSTANCE.createLoginConfig()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_MimeMappings(), WebapplicationFactory.eINSTANCE.createMimeMapping()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_SessionConfig(), WebapplicationFactory.eINSTANCE.createSessionConfig()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ServletMappings(), WebapplicationFactory.eINSTANCE.createServletMapping()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Servlets(), WebapplicationFactory.eINSTANCE.createServlet()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_SecurityRoles(), CommonFactory.eINSTANCE.createSecurityRole()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Filters(), WebapplicationFactory.eINSTANCE.createFilter()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_FilterMappings(), WebapplicationFactory.eINSTANCE.createFilterMapping()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_Listeners(), CommonFactory.eINSTANCE.createListener()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_ContextParams(), CommonFactory.eINSTANCE.createParamValue()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_JspConfig(), JspFactory.eINSTANCE.createJSPConfig()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_MessageDestinations(), CommonFactory.eINSTANCE.createMessageDestination()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebApp_LocalEncodingMappingList(), WebapplicationFactory.eINSTANCE.createLocalEncodingMappingList()));
+ }
+
+ /**
+ * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getCreateChildText(Object owner, Object feature, Object child, Collection selection) {
+ boolean qualify = feature == CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbRefs() || feature == CommonPackage.eINSTANCE.getJNDIEnvRefsGroup_EjbLocalRefs();
+ return getString(qualify ? "_UI_CreateChild_text2" : "_UI_CreateChild_text", //$NON-NLS-1$ //$NON-NLS-2$
+ new Object[]{getTypeText(child), getFeatureText(feature), getTypeText(owner)});
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java
new file mode 100644
index 0000000..f72bd2b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebResourceCollectionItemProvider.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.common.CommonFactory;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.URLPatternType;
+import org.eclipse.jst.j2ee.webapplication.WebResourceCollection;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory;
+
+/**
+ * This is the item provider adpater for a
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}object.
+ */
+public class WebResourceCollectionItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public WebResourceCollectionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ URLPatternType child = WebapplicationFactory.eINSTANCE.createURLPatternType();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+ Collection result = new ArrayList();
+ result.add(pkg.getWebResourceCollection_UrlPattern());
+ result.add(pkg.getWebResourceCollection_HttpMethod());
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EReference getChildReference(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildReference(object, child);
+ }
+
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateURLPatternType");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_URLPatternType_UI_"); //$NON-NLS-1$ = "Create URLPatternType"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("37concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type URLPatternType for the selected {0}."
+ }
+
+ /**
+ * This returns web_resource_collection.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("web_resource_collection");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the secConstraint of the WebResourceCollection.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((WebResourceCollection) object).getSecConstraint();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the webResourceName feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WebResourceName_UI_"), //$NON-NLS-1$ = "WebResourceName"
+ WebAppEditResourceHandler.getString("The_webResourceName_proper_UI_"), //$NON-NLS-1$ = "The webResourceName property"
+ pkg.getWebResourceCollection_WebResourceName()));
+
+ // This is for the description feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("Description_UI__UI_"), //$NON-NLS-1$ = "Description"
+ WebAppEditResourceHandler.getString("The_description_property_UI_"), //$NON-NLS-1$ = "The description property"
+ pkg.getWebResourceCollection_Description()));
+
+ // This is for the secConstraint feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("SecConstraint_UI_"), //$NON-NLS-1$ = "SecConstraint"
+ WebAppEditResourceHandler.getString("The_secConstraint_property_UI_"), //$NON-NLS-1$ = "The secConstraint property"
+ pkg.getWebResourceCollection_SecConstraint()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Web Resource Name feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addWebResourceNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_webResourceName_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_webResourceName_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebResourceCollection_WebResourceName(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_description_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_description_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebResourceCollection_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Url Pattern feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addUrlPatternPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_urlPattern_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_urlPattern_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebResourceCollection_UrlPattern(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ /**
+ * This adds a property descriptor for the Http Method feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addHttpMethodPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WebResourceCollection_httpMethod_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WebResourceCollection_httpMethod_feature", "_UI_WebResourceCollection_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWebResourceCollection_HttpMethod(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+ @Override
+ public String getText(Object object) {
+ // return WebAppEditResourceHandler.getString("38concat_UI_", (new Object[] {
+ // ((WebResourceCollection)object).getWebResourceName() })); //$NON-NLS-1$ =
+ // "WebResourceCollection {0}"
+ return ((WebResourceCollection) object).getWebResourceName();
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(WebResourceCollection.class)) {
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__WEB_RESOURCE_NAME :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__DESCRIPTION :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__URL_PATTERN :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__HTTP_METHOD :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__UR_LS :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__DESCRIPTIONS :
+ case WebapplicationPackage.WEB_RESOURCE_COLLECTION__HTT_PS : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(((WebResourceCollection) WebapplicationPackage.eINSTANCE.getWebResourceCollection()).getURLs(), WebapplicationFactory.eINSTANCE.createURLPatternType()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebResourceCollection_Descriptions(), CommonFactory.eINSTANCE.createDescription()));
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWebResourceCollection_Descriptions(), WscommonFactory.eINSTANCE.createDescriptionType()));
+
+ newChildDescriptors.add(createChildParameter(((WebResourceCollection) WebapplicationPackage.eINSTANCE.getWebResourceCollection()).getHttpMethod(), WebapplicationFactory.eINSTANCE.createHTTPMethodType()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.provider.IEditingDomainItemProvider#createCommand(java.lang.Object,
+ * org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class,
+ * org.eclipse.emf.edit.command.CommandParameter)
+ */
+ @Override
+ public Command createCommand(Object object, EditingDomain editingDomain, Class commandClass, CommandParameter commandParameter) {
+ EStructuralFeature sf = commandParameter.getEReference();
+ if (sf == null) {
+ sf = commandParameter.getEAttribute();
+ if (sf != null && !sf.isMany())
+ sf = null;
+ }
+ if (sf != null) {
+ EObject owner = commandParameter.getEOwner();
+ Collection collection = commandParameter.getCollection();
+ if (commandClass == AddCommand.class) {
+ return createAddCommand(editingDomain, owner, sf, collection, commandParameter.getIndex());
+ } else if (commandClass == RemoveCommand.class) {
+ return createRemoveCommand(editingDomain, owner, sf, collection);
+ }
+ }
+ return super.createCommand(object, editingDomain, commandClass, commandParameter);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java
new file mode 100644
index 0000000..9662a20
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebToolingItemPropertyDescriptor.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.providers;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+
+/**
+ * Insert the type's description here. Creation date: (12/11/2000 5:54:28 PM)
+ *
+ * @author: Administrator
+ */
+public class WebToolingItemPropertyDescriptor extends ItemPropertyDescriptor {
+
+ protected int cellEditorType = -1;
+ public final static int SMALL_ICON_EDITOR = 1;
+ public final static int LARGE_ICON_EDITOR = 2;
+ public final static int MULTILINE_TEXT_EDITOR = 3;
+ public final static int AUTH_CONSTRAINT_ROLES_EDITOR = 4;
+
+ /**
+ * This creates an instance where the category and filter flags are empty and the cell editor is
+ * determined for the references.
+ */
+ public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EReference[] parentReferences) {
+ super(adapterFactory, displayName, description, parentReferences);
+ }
+
+ /**
+ * This creates an instance where the category is filter flags are empty and the cell editor is
+ * determined from the type of the structural feature>
+ */
+ public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EStructuralFeature feature) {
+ super(adapterFactory, displayName, description, feature);
+ }
+
+ /**
+ * This creates an instance where the category is filter flags are empty and the cell editor is
+ * determined from the type of the structural feature>
+ */
+ public WebToolingItemPropertyDescriptor(AdapterFactory adapterFactory, String displayName, String description, EStructuralFeature feature, int newCellEditorType) {
+ super(adapterFactory, displayName, description, feature);
+ cellEditorType = newCellEditorType;
+ }
+
+ protected void executeCommand(EditingDomain editingDomain, Command command) {
+ //TODO We need to use the CommandStack from the WebEditModel.
+ // if (editingDomain instanceof StructuredTextEditingDomain)
+ // ((StructuredTextEditingDomain) editingDomain).execute(command);
+ // else
+ // editingDomain.getCommandStack().execute(command);
+
+ }
+
+ /**
+ * Returns the editor type.
+ */
+ public int getCellEditorType() {
+ return cellEditorType;
+ }
+
+ /**
+ * This does the delegated job of setting the property to the given value. It is implemented in
+ * a generic way using the structural feature.
+ */
+ @Override
+ public void setPropertyValue(Object object, Object value) {
+ EObject refObject = (EObject) object;
+ EditingDomain editingDomain = getEditingDomain(object);
+
+ if (parentReferences != null) {
+ EObject refValue = (EObject) value;
+ Command removeCommand = null;
+ for (int i = 0; i < parentReferences.length; ++i) {
+ Object oldValue = refObject.eGet(parentReferences[i]);
+ if (oldValue != null) {
+ final EReference parentReference = parentReferences[i];
+ if (oldValue == value) {
+ return;
+ }
+ // else if (refValue.refIsInstanceOf(parentReference.getEType(), true))
+ else if (refValue.eClass() == parentReference.getEType() || refValue.eClass().getEAllSuperTypes().contains(parentReference.getEType())) {
+ if (editingDomain == null) {
+ refObject.eSet(parentReference, value);
+ } else {
+ Command setCommand = SetCommand.create(editingDomain, refObject, parentReference, value);
+ executeCommand(editingDomain, setCommand);
+ }
+ return;
+ } else {
+ if (editingDomain == null) {
+ refObject.eSet(parentReference, null);
+ } else {
+ removeCommand = SetCommand.create(editingDomain, refObject, parentReference, null);
+ }
+ break;
+ }
+ }
+ }
+
+ for (int i = 0; i < parentReferences.length; ++i) {
+ final EReference parentReference = parentReferences[i];
+ //if (refValue.refIsInstanceOf(parentReference.getEType(), true))
+ if (refValue.eClass() == parentReference.getEType() || refValue.eClass().getEAllSuperTypes().contains(parentReference.getEType())) {
+ if (editingDomain == null) {
+ refObject.eSet(parentReferences[i], value);
+ } else {
+ if (removeCommand != null) {
+ final CompoundCommand compoundCommand = new CompoundCommand(CompoundCommand.LAST_COMMAND_ALL);
+ compoundCommand.append(removeCommand);
+ compoundCommand.append(SetCommand.create(editingDomain, refObject, parentReference, value));
+ executeCommand(editingDomain, compoundCommand);
+ } else {
+ executeCommand(editingDomain, SetCommand.create(editingDomain, refObject, parentReference, value));
+ }
+ }
+ break;
+ }
+ }
+ } else {
+ if (editingDomain == null) {
+ refObject.eSet(feature, value);
+ } else {
+ executeCommand(editingDomain, SetCommand.create(editingDomain, refObject, feature, value));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java
new file mode 100644
index 0000000..2d67ec1
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebTypeItemProvider.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}object.
+ */
+public class WebTypeItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public WebTypeItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns web_type.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("web_type");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ //WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;;
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("WebType_UI_"); //$NON-NLS-1$ = "WebType"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java
new file mode 100644
index 0000000..fa80205
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapter.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+
+/**
+ * This extended item provider supports two addition features, (@link CreateChildCommand} and
+ * {@link CreateChildrenCommand}. These two actions are implemented uniformly on all our item
+ * adapters using this common base class.
+ */
+public class WebapplicationItemProviderAdapter extends org.eclipse.emf.edit.provider.ItemProviderAdapter {
+
+ /**
+ * This creates and instance from an adapter factory and a domain notifier.
+ */
+ protected WebapplicationItemProviderAdapter(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This implements the default behavior for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.command.CreateChildCommand}.
+ */
+ public Object createChild(Object object) {
+ return null;
+ }
+
+ /**
+ * This creates the default new children for {@link CreateChildrenCommand}.
+ */
+ public Collection createChildren(Object object) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * This returns the default create child image.
+ */
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ Collection achildrenReferences = getChildrenReferences(object);
+ if (achildrenReferences.size() != 1) {
+ return WebPlugin.getDefault().getImage("create_child"); //$NON-NLS-1$
+ }
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "Create" + //$NON-NLS-1$
+ ((EReference) achildrenReferences.iterator().next()).getEType().getName());
+
+ }
+
+ /**
+ * This returns the default create children label.
+ */
+ public String getCreateChildrenText(Object object) {
+ //EObject refObject = (EObject) object;
+ Collection achildrenReferences = getChildrenReferences(object);
+ if (achildrenReferences.size() != 1) {
+ return WebAppEditResourceHandler.getString("Create_Two_Children_UI_"); //$NON-NLS-1$ = "Create Two Children"
+ }
+ return WebAppEditResourceHandler.getString("9concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName()})); //$NON-NLS-1$ = "Create Two {0}s"
+
+ }
+
+ /**
+ * This returns the default create children help text.
+ */
+ public String getCreateChildrenToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ Collection achildrenReferences = getChildrenReferences(object);
+ if (achildrenReferences.size() != 1) {
+ return WebAppEditResourceHandler.getString("7concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create two new children for the selected {0}."
+ }
+ return WebAppEditResourceHandler.getString("8concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName(), refObject.eClass().getName()})); //$NON-NLS-1$
+ //$NON-NLS-1$ = "Create two new children of type {0} for the selected {1}."
+
+ }
+
+ /**
+ * This returns the default create child label.
+ */
+ public String getCreateChildText(Object object) {
+ //EObject refObject = (EObject) object;
+ Collection achildrenReferences = getChildrenReferences(object);
+ if (achildrenReferences.size() != 1) {
+ return WebAppEditResourceHandler.getString("Create_Child_UI_"); //$NON-NLS-1$ = "Create Child"
+ }
+ return WebAppEditResourceHandler.getString("6concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName()})); //$NON-NLS-1$ = "Create {0}"
+
+ }
+
+ /**
+ * This returns the default create child help text.
+ */
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ Collection achildrenReferences = getChildrenReferences(object);
+ if (achildrenReferences.size() != 1) {
+ return WebAppEditResourceHandler.getString("2concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a new child for the selected {0}."
+ }
+ return WebAppEditResourceHandler.getString("4concat_UI_", (new Object[]{((EReference) achildrenReferences.iterator().next()).getEType().getName(), refObject.eClass().getName()})); //$NON-NLS-1$
+ //$NON-NLS-1$ = "Create a child of type {0} for the selected {1}."
+
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java
new file mode 100644
index 0000000..583d3fc
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WebapplicationItemProviderAdapterFactory.java
@@ -0,0 +1,721 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.Disposable;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.jst.j2ee.common.internal.provider.ListenerItemProvider;
+import org.eclipse.jst.j2ee.webapplication.internal.util.WebapplicationAdapterFactory;
+
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support
+ * {@link org.eclipse.jface.viewer.ContentViewer}s. The adapters generated by this factory convert
+ * MOF adapter notificiations into {@link org.eclipse.jface.DomainEvent}s. The adapters also
+ * support property sheets, see {@link com.ibm.itp.ui.api.propertysheet}.
+ */
+public class WebapplicationItemProviderAdapterFactory extends WebapplicationAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by
+ * {@link #isFactoryForType isFactoryForType}.
+ */
+ protected Collection supportedTypes = new ArrayList();
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp}
+ * instances.
+ */
+ protected WebAppItemProvider webAppItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam}instances.
+ */
+ protected ContextParamItemProvider contextParamItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}instances.
+ */
+ protected ErrorPageItemProvider errorPageItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}instances.
+ */
+ protected ExceptionTypeErrorPageItemProvider exceptionTypeErrorPageItemProvider;
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Filter}
+ * instances.
+ */
+ protected FilterItemProvider filterItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping}instances.
+ */
+ protected FilterMappingItemProvider filterMappingItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage}instances.
+ */
+ protected ErrorCodeErrorPageItemProvider errorCodeErrorPageItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList}instances.
+ */
+ protected WelcomeFileListItemProvider welcomeFileListItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}instances.
+ */
+ protected WelcomeFileItemProvider welcomeFileItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}instances.
+ */
+ protected TagLibRefItemProvider tagLibRefItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRefType}instances.
+ */
+ protected TagLibRefTypeItemProvider tagLibRefTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint}instances.
+ */
+ protected SecurityConstraintItemProvider securityConstraintItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}instances.
+ */
+ protected WebResourceCollectionItemProvider webResourceCollectionItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}instances.
+ */
+ protected URLPatternTypeItemProvider uRLPatternTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}instances.
+ */
+ protected HTTPMethodTypeItemProvider hTTPMethodTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint}instances.
+ */
+ protected AuthConstraintItemProvider authConstraintItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint}instances.
+ */
+ protected UserDataConstraintItemProvider userDataConstraintItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}instances.
+ */
+ protected LoginConfigItemProvider loginConfigItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig}instances.
+ */
+ protected FormLoginConfigItemProvider formLoginConfigItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}instances.
+ */
+ protected MimeMappingItemProvider mimeMappingItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig}instances.
+ */
+ protected SessionConfigItemProvider sessionConfigItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping}instances.
+ */
+ protected ServletMappingItemProvider servletMappingItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Servlet}instances.
+ */
+ protected ServletItemProvider servletItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}instances.
+ */
+ protected WebTypeItemProvider webTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}instances.
+ */
+ protected ServletTypeItemProvider servletTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}instances.
+ */
+ protected JSPTypeItemProvider jSPTypeItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}instances.
+ */
+ protected InitParamItemProvider initParamItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Listener}instances.
+ */
+ protected ListenerItemProvider listenerItemProvider;
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType}instances.
+ */
+ protected RoleNameTypeItemProvider roleNameTypeItemProvider;
+ protected Disposable disposable = new Disposable();
+
+ /**
+ * This constructs an instance from a domain notifier.
+ */
+ public WebapplicationItemProviderAdapterFactory() {
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(ITableItemLabelProvider.class);
+ }
+
+ @Override
+ public Adapter adapt(Notifier target, Object adapterKey) {
+ return super.adapt(target, this);
+ }
+
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class) || (((Class) type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public Adapter adaptNew(Notifier target, Object adapterType) {
+ Adapter adapter = super.adaptNew(target, adapterType);
+ disposable.add(adapter);
+ return adapter;
+ }
+
+ /**
+ * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.AuthConstraint}.
+ */
+ @Override
+ public Adapter createAuthConstraintAdapter() {
+ if (authConstraintItemProvider == null) {
+ authConstraintItemProvider = new AuthConstraintItemProvider(this);
+ }
+
+ return authConstraintItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ContextParam}.
+ */
+ @Override
+ public Adapter createContextParamAdapter() {
+ if (contextParamItemProvider == null) {
+ contextParamItemProvider = new ContextParamItemProvider(this);
+ }
+
+ return contextParamItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorCodeErrorPage}.
+ */
+ @Override
+ public Adapter createErrorCodeErrorPageAdapter() {
+ if (errorCodeErrorPageItemProvider == null) {
+ errorCodeErrorPageItemProvider = new ErrorCodeErrorPageItemProvider(this);
+ }
+
+ return errorCodeErrorPageItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ErrorPage}.
+ */
+ @Override
+ public Adapter createErrorPageAdapter() {
+ if (errorPageItemProvider == null) {
+ errorPageItemProvider = new ErrorPageItemProvider(this);
+ }
+
+ return errorPageItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ExceptionTypeErrorPage}.
+ */
+ @Override
+ public Adapter createExceptionTypeErrorPageAdapter() {
+ if (exceptionTypeErrorPageItemProvider == null) {
+ exceptionTypeErrorPageItemProvider = new ExceptionTypeErrorPageItemProvider(this);
+ }
+
+ return exceptionTypeErrorPageItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Filter}.
+ */
+ @Override
+ public Adapter createFilterAdapter() {
+ if (filterItemProvider == null) {
+ filterItemProvider = new FilterItemProvider(this);
+ }
+
+ return filterItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}instances. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected LocalEncodingMappingListItemProvider localEncodingMappingListItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMappingList}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createLocalEncodingMappingListAdapter() {
+ if (localEncodingMappingListItemProvider == null) {
+ localEncodingMappingListItemProvider = new LocalEncodingMappingListItemProvider(this);
+ }
+
+ return localEncodingMappingListItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}instances. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected LocalEncodingMappingItemProvider localEncodingMappingItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LocalEncodingMapping}.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createLocalEncodingMappingAdapter() {
+ if (localEncodingMappingItemProvider == null) {
+ localEncodingMappingItemProvider = new LocalEncodingMappingItemProvider(this);
+ }
+
+ return localEncodingMappingItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FilterMapping}.
+ */
+ @Override
+ public Adapter createFilterMappingAdapter() {
+ if (filterMappingItemProvider == null) {
+ filterMappingItemProvider = new FilterMappingItemProvider(this);
+ }
+
+ return filterMappingItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.FormLoginConfig}.
+ */
+ @Override
+ public Adapter createFormLoginConfigAdapter() {
+ if (formLoginConfigItemProvider == null) {
+ formLoginConfigItemProvider = new FormLoginConfigItemProvider(this);
+ }
+
+ return formLoginConfigItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}.
+ */
+ @Override
+ public Adapter createHTTPMethodTypeAdapter() {
+ if (hTTPMethodTypeItemProvider == null) {
+ hTTPMethodTypeItemProvider = new HTTPMethodTypeItemProvider(this);
+ }
+
+ return hTTPMethodTypeItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.InitParam}.
+ */
+ @Override
+ public Adapter createInitParamAdapter() {
+ if (initParamItemProvider == null) {
+ initParamItemProvider = new InitParamItemProvider(this);
+ }
+
+ return initParamItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Listener}.
+ */
+ @Override
+ public Adapter createListenerAdapter() {
+ if (listenerItemProvider == null) {
+ listenerItemProvider = new ListenerItemProvider(this);
+ }
+
+ return listenerItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}.
+ */
+ @Override
+ public Adapter createJSPTypeAdapter() {
+ if (jSPTypeItemProvider == null) {
+ jSPTypeItemProvider = new JSPTypeItemProvider(this);
+ }
+
+ return jSPTypeItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}instances. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected URLPatternTypeItemProvider urlPatternTypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.LoginConfig}.
+ */
+ @Override
+ public Adapter createLoginConfigAdapter() {
+ if (loginConfigItemProvider == null) {
+ loginConfigItemProvider = new LoginConfigItemProvider(this);
+ }
+
+ return loginConfigItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.MimeMapping}.
+ */
+ @Override
+ public Adapter createMimeMappingAdapter() {
+ if (mimeMappingItemProvider == null) {
+ mimeMappingItemProvider = new MimeMappingItemProvider(this);
+ }
+
+ return mimeMappingItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.RoleNameType}.
+ */
+ @Override
+ public Adapter createRoleNameTypeAdapter() {
+ if (roleNameTypeItemProvider == null) {
+ roleNameTypeItemProvider = new RoleNameTypeItemProvider(this);
+ }
+
+ return roleNameTypeItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SecurityConstraint}.
+ */
+ @Override
+ public Adapter createSecurityConstraintAdapter() {
+ if (securityConstraintItemProvider == null) {
+ securityConstraintItemProvider = new SecurityConstraintItemProvider(this);
+ }
+
+ return securityConstraintItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.Servlet}.
+ */
+ @Override
+ public Adapter createServletAdapter() {
+ if (servletItemProvider == null) {
+ servletItemProvider = new ServletItemProvider(this);
+ }
+
+ return servletItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletMapping}.
+ */
+ @Override
+ public Adapter createServletMappingAdapter() {
+ if (servletMappingItemProvider == null) {
+ servletMappingItemProvider = new ServletMappingItemProvider(this);
+ }
+
+ return servletMappingItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.ServletType}.
+ */
+ @Override
+ public Adapter createServletTypeAdapter() {
+ if (servletTypeItemProvider == null) {
+ servletTypeItemProvider = new ServletTypeItemProvider(this);
+ }
+
+ return servletTypeItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.JSPType}instances. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected JSPTypeItemProvider jspTypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.SessionConfig}.
+ */
+ @Override
+ public Adapter createSessionConfigAdapter() {
+ if (sessionConfigItemProvider == null) {
+ sessionConfigItemProvider = new SessionConfigItemProvider(this);
+ }
+
+ return sessionConfigItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}.
+ */
+ @Override
+ public Adapter createTagLibRefAdapter() {
+ if (tagLibRefItemProvider == null) {
+ tagLibRefItemProvider = new TagLibRefItemProvider(this);
+ }
+
+ return tagLibRefItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.TagLibRef}.
+ */
+ @Override
+ public Adapter createTagLibRefTypeAdapter() {
+ if (tagLibRefTypeItemProvider == null) {
+ tagLibRefTypeItemProvider = new TagLibRefTypeItemProvider(this);
+ }
+
+ return tagLibRefTypeItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.URLPatternType}.
+ */
+ @Override
+ public Adapter createURLPatternTypeAdapter() {
+ if (uRLPatternTypeItemProvider == null) {
+ uRLPatternTypeItemProvider = new URLPatternTypeItemProvider(this);
+ }
+
+ return uRLPatternTypeItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.HTTPMethodType}instances. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected HTTPMethodTypeItemProvider httpMethodTypeItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.UserDataConstraint}.
+ */
+ @Override
+ public Adapter createUserDataConstraintAdapter() {
+ if (userDataConstraintItemProvider == null) {
+ userDataConstraintItemProvider = new UserDataConstraintItemProvider(this);
+ }
+
+ return userDataConstraintItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebApp}.
+ */
+ @Override
+ public Adapter createWebAppAdapter() {
+ if (webAppItemProvider == null) {
+ webAppItemProvider = new WebAppItemProvider(this);
+ }
+
+ return webAppItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebResourceCollection}.
+ */
+ @Override
+ public Adapter createWebResourceCollectionAdapter() {
+ if (webResourceCollectionItemProvider == null) {
+ webResourceCollectionItemProvider = new WebResourceCollectionItemProvider(this);
+ }
+
+ return webResourceCollectionItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WebType}.
+ */
+ @Override
+ public Adapter createWebTypeAdapter() {
+ if (webTypeItemProvider == null) {
+ webTypeItemProvider = new WebTypeItemProvider(this);
+ }
+
+ return webTypeItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}.
+ */
+ @Override
+ public Adapter createWelcomeFileAdapter() {
+ if (welcomeFileItemProvider == null) {
+ welcomeFileItemProvider = new WelcomeFileItemProvider(this);
+ }
+
+ return welcomeFileItemProvider;
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList}.
+ */
+ @Override
+ public Adapter createWelcomeFileListAdapter() {
+ if (welcomeFileListItemProvider == null) {
+ welcomeFileListItemProvider = new WelcomeFileListItemProvider(this);
+ }
+
+ return welcomeFileListItemProvider;
+ }
+
+ public void dispose() {
+ disposable.dispose();
+ }
+
+ /**
+ * This returns the root adapter factory that contains the factory.
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return (parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory());
+ }
+
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return super.isFactoryForType(type) || supportedTypes.contains(type);
+ }
+
+ /**
+ * This removes a listener.
+ *
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier}and to {@link #parentAdapterFactory}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This sets the composed adapter factory that contains the factory.
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java
new file mode 100644
index 0000000..bd1fefd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileItemProvider.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFile;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFile}object.
+ */
+public class WelcomeFileItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public WelcomeFileItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns welcome_file.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("welcome_file");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the fileList of the WelcomeFile.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((WelcomeFile) object).getFileList();
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ WebapplicationPackage pkg = WebapplicationPackage.eINSTANCE;
+
+ // This is for the welcomeFile feature.
+ //
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), WebAppEditResourceHandler.getString("WelcomeFile_UI_"), //$NON-NLS-1$ = "WelcomeFile"
+ WebAppEditResourceHandler.getString("The_welcomeFile_property_UI_"), //$NON-NLS-1$ = "The welcomeFile property"
+ pkg.getWelcomeFile_WelcomeFile()));
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Welcome File feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addWelcomeFilePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getString("_UI_WelcomeFile_welcomeFile_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_WelcomeFile_welcomeFile_feature", "_UI_WelcomeFile_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ WebapplicationPackage.eINSTANCE.getWelcomeFile_WelcomeFile(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
+ }
+
+
+ @Override
+ public String getText(Object object) {
+ WelcomeFile welcomeFile = (WelcomeFile) object;
+ String name = welcomeFile.getWelcomeFile();
+ if (name == null)
+ name = WebAppEditResourceHandler.getString("<welcome-file>_UI_"); //$NON-NLS-1$ = "<welcome-file>"
+ return name;
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(WelcomeFile.class)) {
+ case WebapplicationPackage.WELCOME_FILE__WELCOME_FILE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+
+ /**
+ * This always returns false. The base class has already implemented
+ * {@link org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren ItemProviderAdapter.getChildren}
+ * to return the empty enumeration, and this to check that enumeration, but we know there can't
+ * be any children, so this is faster.
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java
new file mode 100644
index 0000000..1486fa0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webedit/org/eclipse/jst/j2ee/internal/web/providers/WelcomeFileListItemProvider.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.providers;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationPackage;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFile;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFileList;
+
+
+/**
+ * This is the item provider adpater for a {@link org.eclipse.jst.j2ee.internal.internal.webapplication.WelcomeFileList}
+ * object.
+ */
+public class WelcomeFileListItemProvider extends WebapplicationItemProviderAdapter implements IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, ITreeItemContentProvider {
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ */
+ public WelcomeFileListItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This creates a new child for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object createChild(Object object) {
+ // TODO: check that this is what you want.
+ WelcomeFile child = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+
+ // TODO: initialize child here...
+
+ return child;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren}and {@link AddCommand}and
+ * {@link RemoveCommand}support in {@link #createCommand}.
+ */
+ @Override
+ public Collection getChildrenReferences(Object object) {
+ return Collections.singleton(WebapplicationPackage.eINSTANCE.getWelcomeFileList_File());
+ }
+
+ /**
+ * This returns the image for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public Object getCreateChildImage(Object object) {
+ EObject refObject = (EObject) object;
+ return WebPlugin.getDefault().getImage(refObject.eClass().getName() + "CreateWelcomeFile");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label for {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildText(Object object) {
+ return WebAppEditResourceHandler.getString("Create_WelcomeFile_UI_"); //$NON-NLS-1$ = "Create WelcomeFile"
+ }
+
+ /**
+ * This returns the help text for
+ * {@link org.eclipse.jst.j2ee.internal.internal.webapplication.commandCreateChildCommand}.
+ */
+ @Override
+ public String getCreateChildToolTipText(Object object) {
+ EObject refObject = (EObject) object;
+ return WebAppEditResourceHandler.getString("42concat_UI_", (new Object[]{refObject.eClass().getName()})); //$NON-NLS-1$ = "Create a child of type WelcomeFile for the selected {0}."
+ }
+
+ /**
+ * This returns welcome_list.gif.
+ */
+ @Override
+ public Object getImage(Object object) {
+ return WebPlugin.getDefault().getImage("welcome_list");//$NON-NLS-1$
+ }
+
+ /**
+ * This returns the webApp of the WelcomeFileList.
+ */
+ @Override
+ public Object getParent(Object object) {
+ return ((WelcomeFileList) object).getWebApp();
+ }
+
+ @Override
+ public String getText(Object object) {
+ return WebAppEditResourceHandler.getString("Welcome_File_List_UI_"); //$NON-NLS-1$ = "Welcome File List"
+ }
+
+ /**
+ * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(WelcomeFileList.class)) {
+ case WebapplicationPackage.WELCOME_FILE_LIST__FILE : {
+ fireNotifyChanged(notification);
+ return;
+ }
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing all of the children that can be created under this object. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(WebapplicationPackage.eINSTANCE.getWelcomeFileList_File(), WebapplicationFactory.eINSTANCE.createWelcomeFile()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return J2EEPlugin.getDefault();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java
new file mode 100644
index 0000000..34c0477
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectStrategyUtils.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.archive.operations;
+
+
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+
+
+public class WTProjectStrategyUtils {
+ public static File findSourceFile(Archive archive, String file) {
+ if (isClassFile(file))
+ return findSourceFileForClass(archive, file);
+
+ // Look in the CLASSES directory
+ try {
+ if (!isOutputFile(file))
+ return archive.getFile(file);
+ } catch (java.io.FileNotFoundException ex) {
+ //Do nothing
+ }
+ return null;
+ }
+
+ public static File findSourceFileForClass(Archive archive, String classFile) {
+ // Look in the CLASSES directory
+ IPath classFilePath = new Path(classFile);
+ IPath sourceFilePath = classFilePath.removeFileExtension().addFileExtension("java");//$NON-NLS-1$
+ try {
+ File file = archive.getFile(sourceFilePath.toString());
+ if (file != null)
+ return file;
+ } catch (java.io.FileNotFoundException ex) {
+ //Do nothing
+ }
+
+ // Look in the LIB directory
+ sourceFilePath = new Path(ArchiveConstants.WEBAPP_LIB_URI).append(sourceFilePath);
+ try {
+ File file = archive.getFile(sourceFilePath.toString());
+ if (file != null)
+ return file;
+ } catch (java.io.FileNotFoundException ex) {
+ //Do nothing
+ }
+ return null;
+
+ }
+
+ public static boolean isClassFile(String uri) {
+ return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI) && uri.endsWith(".class");//$NON-NLS-1$
+ }
+
+ public static boolean isOutputFile(String uri) {
+ return uri.startsWith(ArchiveConstants.WEBAPP_CLASSES_URI);
+ }
+
+ public static boolean isSourceFile(String uri) {
+ // A file is considered a java source file if it is in the
+ // WEB_INF directory and it does not end with .class.
+ if (uri.startsWith(J2EEConstants.WEB_INF + "/") && //$NON-NLS-1$
+ uri.endsWith(".java"))//$NON-NLS-1$
+ return true;
+ return false;
+
+ }
+
+ public static String makeRelative(String pathString, String relToPathString) {
+ IPath relToPath = new Path(relToPathString);
+ IPath path = new Path(pathString);
+
+ if (path.matchingFirstSegments(relToPath) == relToPath.segmentCount())
+ path = path.removeFirstSegments(relToPath.segmentCount());
+
+ return path.toString();
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java
new file mode 100644
index 0000000..85228c2
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportDataModelProvider.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.archive.operations;
+
+import java.util.Set;
+
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
+import org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation;
+import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentExportDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+public class WebComponentExportDataModelProvider extends J2EEComponentExportDataModelProvider implements IWebComponentExportDataModelProperties {
+
+ public WebComponentExportDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new JavaEEComponentExportOperation(model);
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ Set propertyNames = super.getPropertyNames();
+ propertyNames.add(EXCLUDE_COMPILE_JSP);
+ return propertyNames;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (EXCLUDE_COMPILE_JSP.equals(propertyName)) {
+ return Boolean.FALSE;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ protected String getProjectType() {
+ return J2EEProjectUtilities.DYNAMIC_WEB;
+ }
+
+ @Override
+ protected String getWrongComponentTypeString(String projectName) {
+ return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_A_WAR, new Object[]{projectName});
+ }
+
+ @Override
+ protected String getModuleExtension() {
+ return IJ2EEModuleConstants.WAR_EXT;
+ }
+ /**
+ * Exports the specified Web Module project to the specified WAR file.
+ *
+ * @param webProjectName
+ * The name of the Web Module project to export.
+ * @param warFileName
+ * The fully qualified WAR file location to export the specified Web Module project.
+ * @param overwriteExisting
+ * If this is <code>true</code> then an existing file at the location specified by
+ * <code>earFileName</code> will be overwritten.
+ * @param exportSource
+ * If this is <code>true</code> then all source files in the specified Web Module
+ * will be included in the resulting WAR file.
+ * @plannedfor WTP 1.0
+ */
+ // TODO: determine plan for new DM Provider
+ // public static void exportProject(String webProjectName, String warFileName, boolean
+ // overwriteExisting, boolean exportSource) {
+ // WebModuleExportDataModel dataModel = new WebModuleExportDataModel();
+ // dataModel.setProperty(PROJECT_NAME, webProjectName);
+ // dataModel.setBooleanProperty(OVERWRITE_EXISTING, overwriteExisting);
+ // dataModel.setProperty(ARCHIVE_DESTINATION, warFileName);
+ // dataModel.setBooleanProperty(EXPORT_SOURCE_FILES, exportSource);
+ // try {
+ // dataModel.getDefaultOperation().run(null);
+ // } catch (InvocationTargetException e) {
+ // Logger.getLogger().logError(e);
+ // } catch (InterruptedException e) {
+ // Logger.getLogger().logError(e);
+ // }
+ // }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
new file mode 100644
index 0000000..cc77e84
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.archive.operations;
+
+import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * @deprecated use org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation instead
+ */
+public class WebComponentExportOperation extends J2EEArtifactExportOperation {
+
+ public WebComponentExportOperation() {
+ super();
+ }
+
+ public WebComponentExportOperation(IDataModel model) {
+ super(model);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java
new file mode 100644
index 0000000..f19d41b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportDataModelProvider.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.archive.operations;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEArtifactImportDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentImportDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportOperationNew;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.common.XMLResource;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetProjectCreationDataModelProperties;
+import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.web.project.facet.WebFragmentFacetProjectCreationDataModelProvider;
+import org.eclipse.jst.jee.util.internal.JavaEEQuickPeek;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+
+/**
+ * This dataModel is used for to import Web Modules (from WAR files) into the workspace.
+ *
+ * This class (and all its fields and methods) is likely to change during the WTP 1.0 milestones as
+ * the new project structures are adopted. Use at your own risk.
+ *
+ * @plannedfor WTP 1.0
+ */
+public final class WebComponentImportDataModelProvider extends J2EEComponentImportDataModelProvider implements IWebComponentImportDataModelProperties {
+
+ @Override
+ public Set getPropertyNames() {
+ Set propertyNames = super.getPropertyNames();
+ propertyNames.add(WEB_LIB_MODELS);
+ propertyNames.add(WEB_LIB_ARCHIVES_SELECTED);
+ propertyNames.add(CONTEXT_ROOT);
+ return propertyNames;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(WEB_LIB_MODELS) || propertyName.equals(WEB_LIB_ARCHIVES_SELECTED)) {
+ return Collections.EMPTY_LIST;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ protected int getType() {
+ return XMLResource.WEB_APP_TYPE;
+ }
+
+ @Override
+ protected void handleUnknownType(JavaEEQuickPeek jqp) {
+ jqp.setType(J2EEVersionConstants.WEB_TYPE);
+ jqp.setVersion(J2EEVersionConstants.WEB_3_0_ID);
+ jqp.setJavaEEVersion(J2EEVersionConstants.JEE_6_0_ID);
+ }
+
+
+ protected IStatus validateModuleType() {
+ if (getArchiveWrapper().getJavaEEQuickPeek().getType() == J2EEConstants.WEB_TYPE)
+ return OK_STATUS;
+
+ // TODO: STRING MOVE
+ return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString("Temp String for none WARFile")); //$NON-NLS-1$);
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ super.propertySet(propertyName, propertyValue);
+ if (propertyName.equals(ARCHIVE_WRAPPER)) {
+ if (getArchiveWrapper() != null) {
+ refreshInterpretedSpecVersion();
+ model.notifyPropertyChange(PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
+ }
+
+ ArchiveWrapper archiveWrapper = (ArchiveWrapper) propertyValue;
+ if (null != archiveWrapper) {
+ List <ArchiveWrapper> libs = archiveWrapper.getWebLibs();
+ List nestedModels = new ArrayList();
+ for (ArchiveWrapper libWrapper : libs) {
+ IDataModel localModel = null;
+ JavaEEQuickPeek jqp = libWrapper.getJavaEEQuickPeek();
+ if(jqp.getType() == JavaEEQuickPeek.WEBFRAGMENT_TYPE){
+ localModel = DataModelFactory.createDataModel(new J2EEArtifactImportDataModelProvider(){
+
+ @Override
+ protected IDataModel createJ2EEComponentCreationDataModel() {
+ return DataModelFactory.createDataModel(new WebFragmentFacetProjectCreationDataModelProvider());
+ }
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new J2EEUtilityJarImportOperationNew(model);
+ }
+
+ @Override
+ protected int getType() {
+ return 0;
+ }
+
+ });
+ } else {
+ localModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
+ }
+ localModel.setProperty(ARCHIVE_WRAPPER, libWrapper);
+ localModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME));
+ IDataModel facetDataModel = localModel.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION);
+ facetDataModel.setBooleanProperty(IJ2EEFacetProjectCreationDataModelProperties.ADD_TO_EAR, false);
+ nestedModels.add(localModel);
+ }
+ setProperty(WEB_LIB_MODELS, nestedModels);
+ }
+ }else if(propertyName.equals(CONTEXT_ROOT)){
+ IDataModel creationModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
+ FacetDataModelMap map = (FacetDataModelMap) creationModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel webFacetDataModel = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
+ webFacetDataModel.setStringProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT, (String)propertyValue);
+ }else if(propertyName.equals(WEB_LIB_ARCHIVES_SELECTED)) {
+ validateLibModelRuntimes();
+ }
+ return true;
+ }
+
+ @Override
+ protected void refreshInterpretedSpecVersion() {
+ IDataModel moduleDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
+ FacetDataModelMap map = (FacetDataModelMap) moduleDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel webFacetDataModel = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
+ int version = getInterpretedSpecVersion(getArchiveWrapper()).getVersion();
+ String versionText = J2EEVersionUtil.getServletTextVersion( version );
+ webFacetDataModel.setStringProperty(IFacetDataModelProperties.FACET_VERSION_STR, versionText);
+ updateWorkingCopyFacetVersion(moduleDM, webFacetDataModel);
+ updateJavaFacetVersion();
+ }
+
+ @Override
+ public IStatus validate(String propertyName) {
+ if(FACET_RUNTIME.equals(propertyName)){
+ super.validate(propertyName);
+ return validateLibModelRuntimes();
+ }
+ return super.validate(propertyName);
+ }
+
+ private IStatus validateLibModelRuntimes() {
+ List libArchives = (List)getProperty(WEB_LIB_ARCHIVES_SELECTED);
+ List libModels = (List)getProperty(WEB_LIB_MODELS);
+ IStatus status = OK_STATUS;
+ for (int i=0; i < libModels.size(); i++) {
+ IDataModel libModel = (IDataModel)libModels.get(i);
+ if (libArchives.contains(libModel.getProperty(ARCHIVE_WRAPPER))){
+ status = libModel.validateProperty(FACET_RUNTIME);
+ }
+ if(!status.isOK()){
+ return status;
+ }
+ }
+ return status;
+ }
+
+ @Override
+ protected IDataModel createJ2EEComponentCreationDataModel() {
+ return DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
+ }
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new WebComponentImportOperation(model);
+ }
+
+ @Override
+ public void init() {
+ super.init();
+ IDataModel componentCreationDM = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
+ FacetDataModelMap map = (FacetDataModelMap) componentCreationDM.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel webFacet = map.getFacetDataModel( IJ2EEFacetConstants.DYNAMIC_WEB );
+ webFacet.setBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD, false);
+ }
+
+ @Override
+ public void propertyChanged(DataModelEvent event) {
+ super.propertyChanged(event);
+ if (event.getPropertyName().equals(IFacetProjectCreationDataModelProperties.FACET_RUNTIME) && event.getDataModel() == model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION)) {
+ Object propertyValue = event.getProperty();
+ IDataModel nestedModel = null;
+ List projectModels = (List) getProperty(WEB_LIB_MODELS);
+ for (int i = 0; i < projectModels.size(); i++) {
+ nestedModel = (IDataModel) projectModels.get(i);
+ nestedModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
new file mode 100644
index 0000000..49df067
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.archive.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
+import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
+import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
+import org.eclipse.jst.j2ee.internal.archive.WebComponentArchiveSaveAdapter;
+import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class WebComponentImportOperation extends J2EEArtifactImportOperation {
+ /**
+ * @param model
+ */
+ public WebComponentImportOperation(IDataModel model) {
+ super(model);
+ }
+
+ protected final int LINK_COMPONENTS_WORK = 10;
+ protected final int LIB_FOLDER_WORK = 2;
+
+ @Override
+ protected int computeTotalWork() {
+ int baseWork = super.computeTotalWork() + LIB_FOLDER_WORK;
+ List selectedLibs = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
+ List libProjects = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
+ IDataModel importModel = null;
+ ArchiveWrapper libArchive = null;
+ for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
+ importModel = (IDataModel) libProjects.get(i);
+ libArchive = (ArchiveWrapper) importModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
+ if (selectedLibs.contains(libArchive)) {
+ baseWork += LINK_COMPONENTS_WORK + PROJECT_CREATION_WORK + libArchive.getSize();
+ }
+ }
+
+ return baseWork;
+ }
+
+ @Override
+ protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
+ super.doExecute(monitor);
+ IVirtualFolder libFolder = virtualComponent.getRootFolder().getFolder(WebArtifactEdit.WEBLIB);
+ if (!libFolder.exists()) {
+ try {
+ libFolder.create(IResource.FORCE, new SubProgressMonitor(monitor, LIB_FOLDER_WORK));
+ } catch (CoreException e) {
+ WebPlugin.logError(e);
+ }
+ } else {
+ monitor.worked(LIB_FOLDER_WORK);
+ }
+ try {
+ importWebLibraryProjects(monitor);
+ } catch (InvocationTargetException e) {
+ WebPlugin.logError(e);
+ } catch (InterruptedException e) {
+ WebPlugin.logError(e);
+ }
+ }
+
+ private void importWebLibraryProjects(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException, ExecutionException {
+ List <ArchiveWrapper> selectedLibs = (List<ArchiveWrapper>) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
+ List <Object> selectedLibsUnderlyingArchives = new ArrayList();
+ for(ArchiveWrapper lib: selectedLibs){
+ selectedLibsUnderlyingArchives.add(lib.getUnderLyingArchive());
+ }
+ List <IDataModel> libProjects = (List <IDataModel>) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
+ IDataModel importModel = null;
+ IVirtualComponent nestedComponent = null;
+ ArchiveWrapper libArchive = null;
+ List targetComponents = new ArrayList();
+ Map compToURIMap = new HashMap();
+ for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
+ importModel = libProjects.get(i);
+ libArchive = (ArchiveWrapper) importModel.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
+ if (selectedLibsUnderlyingArchives.contains(libArchive.getUnderLyingArchive())) {
+ importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, PROJECT_CREATION_WORK + libArchive.getSize()) , info);
+ nestedComponent = (IVirtualComponent) importModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
+ targetComponents.add(nestedComponent);
+ String archiveURI = libArchive.getPath().lastSegment();
+ compToURIMap.put(nestedComponent, archiveURI);
+ }
+ }
+ /**
+ * The J2EEComponentClasspathContainr will handle adding these to the classpath, so they
+ * don't need to be added here.
+ */
+ if (targetComponents.size() > 0) {
+ IDataModel createRefComponentsModel = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
+ createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent);
+ createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, "/WEB-INF/lib/"); //$NON-NLS-1$
+ createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetComponents);
+ createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, compToURIMap);
+ createRefComponentsModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK * targetComponents.size()), info);
+ }
+ }
+
+ @Override
+ protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(
+ IVirtualComponent virtualComponent) {
+ return new WebComponentArchiveSaveAdapter(virtualComponent);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
new file mode 100644
index 0000000..a0adfda
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentLoadStrategyImpl.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.archive.operations;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.project.WebUtilities;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+public class WebComponentLoadStrategyImpl extends ComponentLoadStrategyImpl {
+
+ public WebComponentLoadStrategyImpl(IVirtualComponent vComponent) {
+ super(vComponent);
+ }
+
+ public WebComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents) {
+ super(vComponent, includeClasspathComponents);
+ }
+
+ @Override
+ public List getFiles() {
+ super.getFiles();
+ addLooseLibJARsToFiles();
+ if (includeClasspathComponents) {
+ addMappedClassFolders(IClasspathDependencyConstants.WEB_INF_CLASSES_PATH);
+ }
+ return filesHolder.getFiles();
+ }
+
+ public IVirtualReference[] getLibModules() {
+ return WebUtilities.getLibModules(getComponent());
+ }
+
+ public void addLooseLibJARsToFiles() {
+ IVirtualReference[] libModules = getLibModules();
+ for (int i = 0; i < libModules.length; i++) {
+ IVirtualReference iLibModule = libModules[i];
+ IVirtualComponent looseComponent = iLibModule.getReferencedComponent();
+ if (looseComponent.isBinary()) {
+ java.io.File diskFile = (java.io.File)looseComponent.getAdapter(java.io.File.class);
+ String uri = iLibModule.getRuntimePath().makeRelative().toString() + "/" + diskFile.getName(); //$NON-NLS-1$
+ addExternalFile(uri, diskFile);
+ } else {
+ String name = null;
+ String archiveName = iLibModule.getArchiveName();
+ if (archiveName != null && archiveName.length() > 0) {
+ name = archiveName;
+ } else {
+ name = looseComponent.getName() + IJ2EEModuleConstants.JAR_EXT;
+ }
+ String prefix = iLibModule.getRuntimePath().makeRelative().toString();
+ if (prefix.length() > 0 && prefix.charAt(prefix.length() - 1)!= '/') {
+ prefix += "/"; //$NON-NLS-1$
+ }
+
+ addClasspathComponentDependencies(looseComponent);
+
+ String uri = prefix + name;
+ try {
+ Archive utilJAR = J2EEProjectUtilities.asArchive(uri, looseComponent.getProject(), isExportSource());
+ if (utilJAR == null)
+ continue;
+ filesHolder.addFile(utilJAR);
+ } catch (OpenFailureException oe) {
+ String message = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.UNABLE_TO_LOAD_MODULE_ERROR_, new Object[]{uri, getComponent().getProject().getName(), oe.getConcatenatedMessages()});
+ WebPlugin.logError(message);
+ }
+ }
+ }
+ }
+ @Override
+ protected synchronized ArtifactEdit getArtifactEditForRead() {
+ if(artifactEdit == null){
+ artifactEdit = WebArtifactEdit.getWebArtifactEditForRead(vComponent);
+ }
+ return artifactEdit;
+ }
+
+ private void addClasspathComponentDependencies(final IVirtualComponent referencedComponent) {
+ // retrieve all Java classpath component dependencies
+ if (includeClasspathComponents && referencedComponent instanceof J2EEModuleVirtualComponent) {
+ final IVirtualReference[] cpRefs = ((J2EEModuleVirtualComponent) referencedComponent).getJavaClasspathReferences();
+ for (int j = 0; j < cpRefs.length; j++) {
+ final IVirtualReference ref = cpRefs[j];
+ final IPath runtimePath = ref.getRuntimePath();
+
+ // only process ../ mappings
+ if (ref.getReferencedComponent().isBinary()
+ && runtimePath.equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
+ File cpEntryFile = (java.io.File)ref.getReferencedComponent().getAdapter(java.io.File.class);
+ addExternalFile("WEB-INF/lib/" + ref.getArchiveName(), cpEntryFile); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
new file mode 100644
index 0000000..fc144d0
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.archive.operations;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
+import org.eclipse.jst.j2ee.internal.archive.operations.J2EEComponentSaveStrategyImpl;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+
+/**
+ * @deprecated this will be deleted post WTP 3.2. This code is no longer
+ * called because the IArchive API is used to handle imports.
+ *
+ * @author jsholl
+ */
+public class WebComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
+
+ public WebComponentSaveStrategyImpl(IVirtualComponent vComponent) {
+ super(vComponent);
+ }
+
+ /**
+ * DoNotUseMeThisWillBeDeletedPost15
+ *
+ * @deprecated
+ * @param archive
+ * @return
+ */
+ protected boolean operationHandlesNested(Archive archive) {
+ return !shouldLinkAsComponentRef(archive);
+ }
+
+ @Override
+ protected boolean shouldAddImportedClassesToClasspath() {
+ return false; // never add to classpath because the web app container will pick this up.
+ }
+
+ @Override
+ protected String getImportedClassesURI(File aFile) {
+ String uri = aFile.getURI();
+ return WTProjectStrategyUtils.makeRelative(uri, ArchiveConstants.WEBAPP_CLASSES_URI);
+ }
+
+ @Override
+ protected IPath getImportedClassesRuntimePath() {
+ return new Path("/" + ArchiveConstants.WEBAPP_CLASSES_URI); //$NON-NLS-1$
+ }
+
+ @Override
+ protected IPath getOutputPathForFile(File aFile) {
+ if (null != nonStandardSourceFiles && nonStandardSourceFiles.containsKey(aFile)) {
+ IVirtualFolder rootFolder = vComponent.getRootFolder();
+ IVirtualFile vFile = rootFolder.getFile((String) nonStandardSourceFiles.get(aFile));
+ IFile iFile = vFile.getUnderlyingFile();
+ return iFile.getProjectRelativePath();
+ }
+ return super.getOutputPathForFile(aFile);
+ }
+
+ /**
+ * This map handles the case when a java source file is not in the same place as the .class
+ * file. For example if all the source files were contained in WEB-INF/source
+ */
+ protected Map nonStandardSourceFiles;
+
+ @Override
+ protected boolean isClassWithoutSource(File aFile) {
+ String javaUri = ArchiveUtil.classUriToJavaUri(aFile.getURI());
+ if (javaUri == null)
+ return false;
+ if (archive.containsFile(javaUri)) {
+ return false;
+ }
+ // see if it is a JSP
+ String jspUri = javaUri.substring(0, javaUri.indexOf(ArchiveUtil.DOT_JAVA));
+ int lastSlash = jspUri.lastIndexOf('/');
+ int _index = lastSlash == -1 ? ArchiveConstants.WEBAPP_CLASSES_URI.length() : lastSlash + 1;
+ if (jspUri.charAt(_index) == '_') {
+ jspUri = jspUri.substring(ArchiveConstants.WEBAPP_CLASSES_URI.length(), _index) + jspUri.substring(_index + 1) + ArchiveUtil.DOT_JSP;
+ if (archive.containsFile(jspUri)) {
+ return false;
+ }
+ }
+
+ // see if the source is in another directory
+ File sourceFile = ((WARFile) archive).getSourceFile(aFile);
+ if (null == sourceFile) {
+ return true;
+ }
+ if (nonStandardSourceFiles == null) {
+ nonStandardSourceFiles = new HashMap();
+ }
+ if (!nonStandardSourceFiles.containsKey(sourceFile)) {
+ nonStandardSourceFiles.put(sourceFile, javaUri);
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
new file mode 100644
index 0000000..741a7f8
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.archive.operations;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences.Keys;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.J2EEFacetProjectCreationDataModelProvider;
+import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+
+public class WebFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
+
+ public WebFacetProjectCreationDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
+ requiredFacets.add(JavaFacetUtils.JAVA_FACET);
+ requiredFacets.add(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
+
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel javaFacet = map.getFacetDataModel( JavaFacetUtils.JAVA_FACET.getId() );
+ IDataModel webFacet = map.getFacetDataModel( IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getId() );
+ //String webRoot = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
+ String webSrc = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, webSrc);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
+ J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.DYN_WEB_OUTPUT_FOLDER) );
+
+ webFacet.addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
+ if (isPropertySet(EAR_PROJECT_NAME))
+ setProperty(EAR_PROJECT_NAME, event.getProperty());
+ else
+ model.notifyPropertyChange(EAR_PROJECT_NAME, IDataModel.DEFAULT_CHG);
+ }else if (IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR.equals(event.getPropertyName())) {
+ setProperty(ADD_TO_EAR, event.getProperty());
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if( propertyName.equals( MODULE_URI )){
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel webFacet = map.getFacetDataModel( J2EEProjectUtilities.DYNAMIC_WEB );
+ webFacet.setProperty( IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI, propertyValue );
+ }
+ return super.propertySet(propertyName, propertyValue);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java
new file mode 100644
index 0000000..e499cfd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.java
@@ -0,0 +1,246 @@
+/******************************************************************************
+ * Copyright (c) 2005-2006 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.web.classpath;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.common.internal.modulecore.ClasspathContainerVirtualComponent;
+import org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainer;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.internal.builder.IDependencyGraph;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class WebAppLibrariesContainer
+
+ extends FlexibleProjectContainer
+
+{
+ private WebAppLibrariesStore.RestoreState restoreState;
+
+ private static final IPath[] paths
+ = new IPath[] { new Path( "WEB-INF/lib" ), //$NON-NLS-1$
+ new Path( "WEB-INF/classes" ) }; //$NON-NLS-1$
+
+ private static final PathType[] types
+ = new PathType[] { PathType.LIB_DIRECTORY, PathType.CLASSES_DIRECTORY };
+
+ public static final String CONTAINER_ID
+ = "org.eclipse.jst.j2ee.internal.web.container"; //$NON-NLS-1$
+
+ public WebAppLibrariesContainer( final IPath path,
+ final IJavaProject jproject )
+ {
+ super( path, jproject, getProject( path, jproject), paths, types );
+ boolean needToVerify = false;
+ if(null != restoreState){
+ synchronized (restoreState) {
+ needToVerify = restoreState.needToVerify;
+ restoreState.needToVerify = false;
+ }
+ }
+ if(needToVerify){
+ Job verifyJob = new Job(Resources.verify){
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ WebAppLibrariesContainer.this.refresh(false);
+ return Status.OK_STATUS;
+ }
+ };
+ verifyJob.setSystem(true);
+ verifyJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ verifyJob.schedule();
+ }
+ }
+
+ public String getDescription()
+ {
+ if( this.owner.getProject() != this.project )
+ {
+ return NLS.bind( Resources.labelWithProject, this.project.getName() );
+ }
+ return Resources.label;
+ }
+
+ public void install()
+ {
+ final IJavaProject[] projects = new IJavaProject[] { this.owner };
+ final IClasspathContainer[] conts = new IClasspathContainer[] { this };
+
+ try
+ {
+ JavaCore.setClasspathContainer( path, projects, conts, null );
+ }
+ catch( JavaModelException e )
+ {
+ WebPlugin.log( e );
+ }
+ }
+
+ @Override
+ public boolean isOutOfDate() {
+ if(IDependencyGraph.INSTANCE.isStale()){
+ //avoid deadlock https://bugs.eclipse.org/bugs/show_bug.cgi?id=334050
+ //if the data is stale, return true and attempt to update again in the near future
+ J2EEComponentClasspathUpdater.getInstance().queueUpdate(owner.getProject());
+ return true;
+ }
+
+ final List currentEntries = computeClasspathEntries(false);
+ boolean outOfDate = ! this.entries.equals( currentEntries );
+ if(outOfDate){
+ WebAppLibrariesStore.flush(project.getName());
+ }
+ return outOfDate;
+ }
+
+ @Override
+ public void refresh(boolean forceUpdate){
+ if(IDependencyGraph.INSTANCE.isStale()){
+ //avoid deadlock https://bugs.eclipse.org/bugs/show_bug.cgi?id=334050
+ //if the data is stale abort and attempt to update again in the near future
+ J2EEComponentClasspathUpdater.getInstance().queueUpdate(owner.getProject());
+ return;
+ }
+
+ if(forceUpdate || isOutOfDate()){
+ refresh();
+ }
+ }
+
+ @Override
+ public void refresh()
+ {
+ if(IDependencyGraph.INSTANCE.isStale()){
+ //avoid deadlock https://bugs.eclipse.org/bugs/show_bug.cgi?id=335645
+ //if the data is stale abort and attempt to update again in the near future
+ J2EEComponentClasspathUpdater.getInstance().queueUpdate(owner.getProject());
+ return;
+ }
+
+ ( new WebAppLibrariesContainer( this.path, this.owner ) ).install();
+ }
+
+ private static Map<String, Object> referenceOptions = new HashMap<String, Object>();
+ static {
+ referenceOptions.put("GET_JAVA_REFS", Boolean.FALSE); //$NON-NLS-1$
+ }
+
+ protected List <IVirtualReference>consumedReferences;
+
+ @Override
+ protected IVirtualReference[] computeReferences(IVirtualComponent vc) {
+ IVirtualReference [] baseRefs = ((VirtualComponent)vc).getReferences(referenceOptions);
+ List <IVirtualReference> refs = new ArrayList <IVirtualReference>();
+ for(IVirtualReference ref: baseRefs){
+ if(ref.getDependencyType() == IVirtualReference.DEPENDENCY_TYPE_USES){
+ refs.add(ref);
+ } else {
+ if (ref.getRuntimePath().equals(paths[0].makeAbsolute())){
+ if(consumedReferences == null){
+ consumedReferences = new ArrayList<IVirtualReference>();
+ }
+ consumedReferences.add(ref);
+ }
+ }
+ }
+ return refs.toArray(new IVirtualReference[refs.size()]);
+ }
+
+ @Override
+ protected List computeClasspathEntries() {
+ return computeClasspathEntries(true);
+ }
+
+ protected List computeClasspathEntries(boolean useRestoreState) {
+ if(useRestoreState){
+ restoreState = WebAppLibrariesStore.getRestoreState(project.getName());
+ if(restoreState != null){
+ return restoreState.paths;
+ }
+ }
+
+ List <IPath>entries = super.computeClasspathEntries();
+ if(consumedReferences != null){
+ for(IVirtualReference ref:consumedReferences){
+ if(ref.getReferencedComponent() instanceof ClasspathContainerVirtualComponent){
+ ClasspathContainerVirtualComponent cpvc = (ClasspathContainerVirtualComponent)ref.getReferencedComponent();
+ if(cpvc != null){
+ IClasspathContainer container = cpvc.getClasspathContainer();
+ if(container != null){
+ IClasspathEntry [] newEntries = container.getClasspathEntries();
+ for(IClasspathEntry entry:newEntries){
+ IPath entryPath = entry.getPath();
+ if(!entries.contains(entryPath)){
+ entries.add(entryPath);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ WebAppLibrariesStore.saveState(project.getName(), entries);
+ return entries;
+ }
+
+ private static final IProject getProject( final IPath path,
+ final IJavaProject jproject )
+ {
+ if( path.segmentCount() == 1 )
+ {
+ return jproject.getProject();
+ }
+ final String name = path.segment( 1 );
+ return ResourcesPlugin.getWorkspace().getRoot().getProject( name );
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String label;
+ public static String labelWithProject;
+ public static String verify;
+
+ static
+ {
+ initializeMessages( WebAppLibrariesContainer.class.getName(),
+ Resources.class );
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties
new file mode 100644
index 0000000..5768a0e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainer.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# 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
+###############################################################################
+label = Web App Libraries
+labelWithProject = Web App Libraries [{0}]
+verify = Verify Web App Libraries
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java
new file mode 100644
index 0000000..7b0f04a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesContainerInitializer.java
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * Copyright (c) 2005-2006 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.internal.web.classpath;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainerInitializer;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class WebAppLibrariesContainerInitializer
+
+ extends FlexibleProjectContainerInitializer
+
+{
+ @Override
+ public void initialize( final IPath path,
+ final IJavaProject jproj )
+
+ throws CoreException
+
+ {
+ ( new WebAppLibrariesContainer( path, jproj ) ).install();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesStore.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesStore.java
new file mode 100644
index 0000000..316f919
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/classpath/WebAppLibrariesStore.java
@@ -0,0 +1,245 @@
+package org.eclipse.jst.j2ee.internal.web.classpath;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+public class WebAppLibrariesStore {
+
+ private static final String WEB_LIBRARIES_CACHE = "webLibrariesCache.index"; //$NON-NLS-1$
+ private static Map<String, RestoreState> restoreStateMap;
+ private static Map<String, RestoreState> saveStateMap = new HashMap<String, RestoreState>();
+
+ static class RestoreState implements Serializable {
+ private static final long serialVersionUID = 5565856269776724522L;
+ transient boolean needToVerify;
+ List<String> pathStrings;
+ transient List<IPath> paths;
+
+ private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+ pathStrings = new ArrayList<String>(paths.size());
+ for (IPath p : paths) {
+ pathStrings.add(p.toString());
+ }
+ out.defaultWriteObject();
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ needToVerify = true;
+ paths = new ArrayList<IPath>(pathStrings.size());
+ for (String s : pathStrings) {
+ paths.add(new Path(s));
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ } else if (o == null) {
+ return false;
+ } else if (o instanceof RestoreState) {
+ RestoreState other = (RestoreState) o;
+ if (paths == null) {
+ return other.paths == null;
+ }
+ return paths.equals(other.paths);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ if (paths == null) {
+ return 11;
+ }
+ return paths.hashCode();
+ }
+ }
+
+ static {
+ IPath stateLocation = WebPlugin.getDefault().getStateLocation();
+ java.io.File file = stateLocation.append(WEB_LIBRARIES_CACHE).toFile();
+ try{
+ if (file.exists()) {
+ FileInputStream fIn = null;
+ boolean deleteCache = true;
+ try {
+ fIn = new FileInputStream(file);
+ BufferedInputStream bIn = new BufferedInputStream(fIn);
+ ObjectInputStream oIn = new ObjectInputStream(bIn);
+ restoreStateMap = (HashMap<String, RestoreState>) oIn.readObject();
+ oIn.close();
+
+ //it is unfortunate this is necessary, but without iterating over the map
+ //and explicitly testing each value, class cast exceptions may occur later
+ //best to check them all now and recover
+ Iterator<Entry<String, RestoreState>> iterator = restoreStateMap.entrySet().iterator();
+ while(iterator.hasNext()){
+ Entry<String, RestoreState> next = iterator.next();
+ String s = next.getKey();
+ RestoreState rs = next.getValue();
+ if(s == null || rs == null){
+ //may throw ClassCastException
+ }
+ }
+ deleteCache = false;
+ } catch (FileNotFoundException e) {
+ WebPlugin.logError(e);
+ } catch (IOException e) {
+ WebPlugin.logError(e);
+ } catch (ClassNotFoundException e) {
+ WebPlugin.logError(e);
+ } catch (ClassCastException e) {
+ WebPlugin.logError(e);
+ } finally {
+ if (fIn != null) {
+ try {
+ fIn.close();
+ } catch (IOException e) {
+ WebPlugin.logError(e);
+ }
+ }
+ if (deleteCache) {
+ restoreStateMap = new HashMap<String, RestoreState>();
+ file.delete();
+ }
+ }
+ }
+ } catch (Throwable e){
+ try{
+ WebPlugin.logError(e);
+ file.delete();
+ } catch (Exception e2){
+ //eat it
+ }
+ restoreStateMap = new HashMap<String, RestoreState>();
+ } finally {
+ if(restoreStateMap == null) {
+ restoreStateMap = new HashMap<String, RestoreState>();
+ }
+ }
+
+ }
+
+ public static RestoreState getRestoreState(String projectName) {
+ RestoreState restoreState = null;
+ synchronized (restoreStateMap) {
+ restoreState = restoreStateMap.get(projectName);
+ }
+ if (restoreState != null) {
+ synchronized (saveStateMap) {
+ saveStateMap.put(projectName, restoreState);
+ }
+ }
+ return restoreState;
+ }
+
+ static void flush(String projectName) {
+ synchronized (restoreStateMap) {
+ restoreStateMap.remove(projectName);
+ }
+ synchronized (saveStateMap) {
+ saveStateMap.remove(projectName);
+ }
+ }
+
+ private static class PersistJob extends Job {
+
+ public PersistJob() {
+ super("Persist Web App Libraries State"); //$NON-NLS-1$
+ setSystem(true);
+ setRule(null);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ SafeRunner.run(new ISafeRunnable() {
+ public void run() throws Exception {
+ persist();
+ }
+
+ public void handleException(Throwable exception) {
+ WebPlugin.logError(exception);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }
+
+ private static int persistDelay = 60000; // 1 minute
+ private static PersistJob persistJob = new PersistJob();
+
+ static void saveState(String projectName, List<IPath> paths) {
+ RestoreState toSave = new RestoreState();
+ toSave.paths = paths;
+
+ boolean scheduleJob = false;
+
+ synchronized (saveStateMap) {
+ RestoreState previous = saveStateMap.get(projectName);
+ if (null == previous || !previous.equals(toSave)) {
+ saveStateMap.put(projectName, toSave);
+ scheduleJob = true;
+ }
+ }
+ if (scheduleJob) {
+ synchronized (restoreStateMap) {
+ // if it changed, do not load it from the cache again
+ restoreStateMap.remove(projectName);
+ }
+ persistJob.schedule(persistDelay);
+ }
+ }
+
+ private static void persist() {
+ synchronized (saveStateMap) {
+ IPath stateLocation = WebPlugin.getDefault().getStateLocation();
+ java.io.File file = stateLocation.append(WEB_LIBRARIES_CACHE).toFile();
+ FileOutputStream fOut = null;
+ try {
+ fOut = new FileOutputStream(file);
+ BufferedOutputStream bOut = new BufferedOutputStream(fOut);
+ ObjectOutputStream oOut = new ObjectOutputStream(bOut);
+ oOut.writeObject(saveStateMap);
+ oOut.close();
+ } catch (FileNotFoundException e) {
+ WebPlugin.logError(e);
+ } catch (IOException e) {
+ WebPlugin.logError(e);
+ } finally {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException e) {
+ WebPlugin.logError(e);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
new file mode 100644
index 0000000..aaae1b7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ClasspathUtilities.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.operations;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.core.IClasspathEntry;
+
+public class ClasspathUtilities {
+
+ static public IClasspathEntry[] addClasspathEntries(IClasspathEntry[] entries1, IClasspathEntry[] entries2) {
+ List list = new ArrayList(entries1.length + entries2.length);
+ list.addAll(Arrays.asList(entries1));
+
+ for (int i = 0; i < entries2.length; i++) {
+ IClasspathEntry iClasspathEntry = entries2[i];
+ if (!list.contains(iClasspathEntry))
+ list.add(iClasspathEntry);
+ }
+
+ IClasspathEntry[] ret = new IClasspathEntry[list.size()];
+ return (IClasspathEntry[]) list.toArray(ret);
+ }
+
+ static protected boolean entryExists(IClasspathEntry entry, IClasspathEntry[] col) {
+ for (int i = 0; i < col.length; i++) {
+ IClasspathEntry otherEntry = col[i];
+ if (entry.getContentKind() != otherEntry.getContentKind())
+ continue;
+
+ if (entry.getEntryKind() != otherEntry.getEntryKind())
+ continue;
+
+ if (entry.isExported() != otherEntry.isExported())
+ continue;
+
+ if (!entry.getPath().equals(otherEntry.getPath()))
+ continue;
+ return true;
+ }
+ return false;
+ }
+
+ static public IClasspathEntry[] removeClasspathEntries(IClasspathEntry[] removeFromCol, IClasspathEntry[] removeCol) {
+ List list = new ArrayList(removeFromCol.length);
+ // list.addAll(Arrays.asList(removeFromCol));
+
+ for (int i = 0; i < removeFromCol.length; i++) {
+ IClasspathEntry iClasspathEntry = removeFromCol[i];
+ if (!entryExists(iClasspathEntry, removeCol))
+ list.add(iClasspathEntry);
+ }
+
+ IClasspathEntry[] ret = new IClasspathEntry[list.size()];
+ return (IClasspathEntry[]) list.toArray(ret);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java
new file mode 100644
index 0000000..7360e3a
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicDataModelProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jst.j2ee.web.datamodel.properties.IConvertStaticWebToDyamnicDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+public class ConvertStaticWebToDyamnicDataModelProvider extends AbstractDataModelProvider implements IConvertStaticWebToDyamnicDataModelProperties {
+
+
+ public ConvertStaticWebToDyamnicDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new ConvertStaticWebToDyamnicOperation(model);
+ }
+
+
+ @Override
+ public Set getPropertyNames() {
+ Set propertyNames = new HashSet();
+ propertyNames.add(PROJECT);
+ propertyNames.add(CONVERT_TO_WEB_VERSION);
+ return propertyNames;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java
new file mode 100644
index 0000000..5b21b57
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ConvertStaticWebToDyamnicOperation.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.web.datamodel.properties.IConvertStaticWebToDyamnicDataModelProperties;
+import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
+
+public class ConvertStaticWebToDyamnicOperation extends AbstractDataModelOperation {
+
+ public ConvertStaticWebToDyamnicOperation() {
+ super();
+ }
+
+ public ConvertStaticWebToDyamnicOperation(IDataModel dm) {
+ super(dm);
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ try {
+ doConvert();
+ } catch (Exception e) {
+ WebPlugin.log(e);
+ }
+
+
+ return OK_STATUS;
+ }
+
+ protected void doConvert() throws Exception {
+
+
+ String selectedVersion = model.getStringProperty(IConvertStaticWebToDyamnicDataModelProperties.CONVERT_TO_WEB_VERSION);
+ IProject project = (IProject) model.getProperty(IConvertStaticWebToDyamnicDataModelProperties.PROJECT);
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ Set fixedFacets = new HashSet();
+ fixedFacets.addAll(facetedProject.getFixedProjectFacets());
+ IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE);
+ fixedFacets.remove(webFacet);
+ fixedFacets.add(WebFacetUtils.WEB_FACET);
+ fixedFacets.add(JavaFacetUtils.JAVA_FACET);
+ facetedProject.setFixedProjectFacets(fixedFacets);
+ IProjectFacetVersion webFv = WebFacetUtils.WEB_FACET.getVersion(selectedVersion);
+ IProjectFacetVersion javaFv = JavaFacetUtils.compilerLevelToFacet(JavaFacetUtils.getCompilerLevel(project));
+ IFacetedProject.Action uninstall = new IFacetedProject.Action(IFacetedProject.Action.Type.UNINSTALL, facetedProject.getInstalledVersion(webFacet), null);
+ IDataModel webModelCfg = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
+ webModelCfg.setBooleanProperty(IWebFacetInstallDataModelProperties.ADD_TO_EAR, false);
+ // Get the default web root folder name (just in case the .component file doesn't exist for some reason)
+ String webRoot = webModelCfg.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
+
+ IVirtualComponent c = ComponentCore.createComponent(project);
+ c.create(0, null);
+ if (c.exists()) {
+ // Get the web root folder from the .component file
+ IVirtualFolder root = c.getRootFolder();
+ webRoot = root.getUnderlyingFolder().getName();
+ // Store the name into the properties for use during facet instal
+ webModelCfg.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, webRoot);
+ }
+
+ IDataModel javaModelCfg = null;
+ if (ProductManager.shouldUseSingleRootStructure()){
+ javaModelCfg = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
+ javaModelCfg.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
+ webRoot+"/"+ J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
+ }
+
+ IFacetedProject.Action install = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL,webFv,webModelCfg);
+ IFacetedProject.Action javaInstall = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, javaFv, javaModelCfg);
+ Set set = new HashSet();
+ set.add(uninstall);
+ set.add(install);
+ set.add(javaInstall);
+ facetedProject.modify(set, new NullProgressMonitor());
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
new file mode 100644
index 0000000..e8de100
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebProjectWizardInfo.java
@@ -0,0 +1,63 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+import org.eclipse.jdt.core.IClasspathEntry;
+
+public interface IWebProjectWizardInfo {
+ /**
+ * Adds entries to the class path for this project
+ */
+ public void addToClasspathEntries(IClasspathEntry[] entries);
+
+ /**
+ * Get the name of the specified project Creation date: (11/09/00 10:05:24 AM)
+ *
+ * @return java.lang.String
+ */
+ public String getProjectName();
+
+ /**
+ * Get the Enterprise Application Project
+ */
+ public String getEARProjectName();
+
+ /**
+ * Get the name of the web content folder. If not set then return the current default.
+ */
+ public String getWebContentName();
+
+ /**
+ * Set the name of the web content folder
+ */
+ public void setWebContentName(String name);
+
+ /**
+ * Get the name of the Java source folder If not set then return the current default.
+ */
+ public String getJavaSourceName();
+
+ /**
+ * Set the name of the Java source folder
+ */
+ public void setJavaSourceName(String name);
+
+ /**
+ * Return an Object for the assocated properties or null
+ */
+ public Object getProperty(String propertyName);
+
+ /**
+ * Set an Object for the assocated properties or null
+ */
+ public void setProperty(String propertyName, Object value);
+
+
+}
+
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
new file mode 100644
index 0000000..9c50530
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingConstants.java
@@ -0,0 +1,34 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+
+
+/*
+ * The IConfigurationConstants are the list of tags that are usuable for specifying a web
+ * application parameters via XML
+ *
+ * @see WebApplicationSpecification for the full DTD
+ */
+
+public interface IWebToolingConstants {
+
+ public String TRUE = "true"; //$NON-NLS-1$
+ public String FALSE = "false"; //$NON-NLS-1$
+
+ public String HTTP_PATH_PREFIX = "http://"; //$NON-NLS-1$
+ public String INDEX_FILE = "index.html"; //$NON-NLS-1$
+ public String HTTP_PARAMETER_SEPARATOR = "?"; //$NON-NLS-1$
+ public String CONTENT_LENGTH_HEADER_KEY = "Content-Length"; //$NON-NLS-1$
+
+ public String SENTENCE_TERMINATOR = "."; //$NON-NLS-1$
+
+ public String POST_COMMAND = "POST"; //$NON-NLS-1$
+ public String GET_COMMAND = "GET"; //$NON-NLS-1$
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
new file mode 100644
index 0000000..1d9eaaa
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/IWebToolingCoreConstants.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+/**
+ * The IWebToolingCoreConstants are the constants required by the ITP core
+ */
+public interface IWebToolingCoreConstants {
+ public String PLUG_IN_ID = "com.ibm.etools.webtools"; //$NON-NLS-1$
+ public String PROP_SERVLET_JAR = "com.ibm.etools.webtools.servletjar"; //$NON-NLS-1$
+ public String PROP_WEBAS_JAR = "com.ibm.etools.webtools.webasjar"; //$NON-NLS-1$
+ public String PROP_CLIENT_NAME = "com.ibm.etools.webtools.clientname"; //$NON-NLS-1$
+ public String PROP_LINK_STYLE = "com.ibm.etools.webtools.linkstyle"; //$NON-NLS-1$
+ public String PROP_MODIFY_LINK_PROMPT = "com.ibm.etools.webtools.modifyprompt"; //$NON-NLS-1$
+ public String PROP_AUTO_MODIFY_LINK = "com.ibm.etools.webtools.automodify"; //$NON-NLS-1$
+ public String JDT_IDENTIFIER = "org.eclipse.jdt.ui"; //$NON-NLS-1$
+ public String RUNTIME_IDENTIFIER = "WebNatureRuntime"; //$NON-NLS-1$
+ public String DOC_RELATIVE = "DOC_RELATIVE"; //$NON-NLS-1$
+ public String DOC_ROOT_RELATIVE = "DOC_ROOT_RELATIVE"; //$NON-NLS-1$
+ public String ICON_PATH = "icons"; //$NON-NLS-1$
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java
new file mode 100644
index 0000000..f17c1b7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/MasterCSS.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+
+
+/**
+ * Code generation class compiled from template file MasterCSS.tpl
+ */
+public class MasterCSS implements WebToolingTemplate {
+ private static final String TEXT_1 = "BODY\r\n{\r\n BACKGROUND-COLOR: #FFE4B5;\r\n COLOR: black;\r\n FONT-FAMILY: 'Times New Roman'\r\n}\r\nH1\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: x-large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH2\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: bolder;\r\n TEXT-TRANSFORM: capitalize\r\n}\r\nH3\r\n{\r\n COLOR: navy;\r\n FONT-FAMILY: 'Times New Roman';\r\n FONT-SIZE: large;\r\n FONT-WEIGHT: lighter;\r\n TEXT-TRANSFORM: capitalize\r\n}";//$NON-NLS-1$
+ private static final String TEXT_2 = "\r\n";//$NON-NLS-1$
+
+ /**
+ * Code generation method
+ *
+ * @return String
+ */
+ public String generate(TemplateData data) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(TEXT_1);
+ sb.append(TEXT_2);
+ return sb.toString();
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java
new file mode 100644
index 0000000..b40f7bb
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/RelationData.java
@@ -0,0 +1,995 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.operations;
+
+
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import com.ibm.icu.util.StringTokenizer;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+
+
+/**
+ * This class stores the relationship between two files. In particular, this is an inLink and the
+ * files which reference it.
+ */
+public class RelationData {
+ public class Link implements Cloneable {
+
+ private String url;
+ private int occurrences = 0;
+
+ public Link(String newUrl, int occ) {
+ url = newUrl;
+ occurrences = occ;
+ }
+
+ /**
+ * Returns an exact copy of this object.
+ *
+ * @return Created clone object
+ */
+ @Override
+ public Object clone() {
+ return new Link(url, occurrences);
+ }
+
+ /**
+ * Returns the url of the file that references this inLink
+ *
+ * @return String
+ */
+ public String getURL() {
+ return url;
+ }
+
+ /**
+ * Returns the number of times this file references the inLink
+ *
+ * @return int
+ */
+ public int getOccurrences() {
+ return occurrences;
+ }
+
+ private int addOccurrence(int add) {
+ occurrences = occurrences + add;
+ return occurrences;
+ }
+
+ @Override
+ public String toString() {
+ return url;
+ }
+ }
+
+ // our relationship table. Key is a string which is the path of the inLink,
+ // value is a vector of files that reference the inLink.
+ protected Hashtable inLinksTable = null;
+ protected Hashtable anchorsTable = null;
+ private static final int INIT_HASH_TABLE_SIZE = 100;
+ private static final int INIT_ANCHORS_HASH_TABLE_SIZE = 10;
+ private boolean fileOk = false;
+ private static final String LINK_STATE_FILE_NAME = "link_table_states.txt";//$NON-NLS-1$
+ private static final String LINK_SERVERCONTEXTROOT_FILE_NAME = "link_scr_states.txt";//$NON-NLS-1$
+ public static final String LINK_MISSING_FILE = "-";//$NON-NLS-1$
+ public static final String LINK_INDEX_SEPARATOR = "+";//$NON-NLS-1$
+ public static final String ANCHOR_INDEX_SEPARATOR = "#";//$NON-NLS-1$
+ public static final String LINK_OCCURENCE_SEPARATOR = "/";//$NON-NLS-1$
+ public static final String ANCHOR_SEPARATOR = "#### ANCHORS ####";//$NON-NLS-1$
+
+ /**
+ * RelationData constructor comment.
+ */
+ public RelationData() {
+ super();
+ inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
+ anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
+ }
+
+ public Link addInLink(String file_path, String parent_path, int occurence) {
+ Vector in_links = (Vector) inLinksTable.get(file_path);
+ if (in_links == null) {
+ return null;
+ }
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ //
+ // Increment the occurence and return
+ //
+
+ if (url.compareTo(parent_path) == 0) {
+ inlnk.addOccurrence(occurence);
+ return inlnk;
+ }
+ }
+
+ //
+ // The link does not exist, need to add an entry in the table for it
+ //
+
+ Link inlnk = new Link(parent_path, occurence);
+ in_links.addElement(inlnk);
+ return inlnk;
+ }
+
+ public void changeInLink(String filePath, boolean missing) {
+
+ if (missing) {
+ Vector inlinks = (Vector) inLinksTable.remove(filePath);
+ inLinksTable.put(LINK_MISSING_FILE + filePath, inlinks);
+ } else {
+ Vector inlinks = (Vector) inLinksTable.remove(LINK_MISSING_FILE + filePath);
+ inLinksTable.put(filePath, inlinks);
+ }
+ }
+
+
+ /*
+ * returns which projects depend on this file i.e. any projects that are in this file's list of
+ * in_links
+ */
+ public Collection getDependentProjects(String file_path) {
+ Hashtable outProjects = new Hashtable();
+ Vector in_links = (Vector) inLinksTable.get(file_path);
+
+ if (in_links != null) {
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+ // should be in the form of: /ProjName/....
+ if (url.length() > 0) {
+ // key could be the filename or the missing filename ("-" + filename)
+ // take this into account and offset the index accordingly
+ int index = 0;
+ int offset = 1;
+ if (url.charAt(0) == '-') {
+ index = url.indexOf(IPath.SEPARATOR, 2);
+ offset = 2;
+ } else {
+ index = url.indexOf(IPath.SEPARATOR, 1);
+ offset = 1;
+ }
+ if (index != -1) {
+ String projName = url.substring(offset, index);
+ outProjects.put(projName, projName);
+ }
+ }
+ }
+ }
+ return outProjects.values();
+ }
+
+ /*
+ * returns which cross-project files depend on this file i.e. any projects that are in this
+ * file's list of in_links
+ */
+ public Collection getDependentProjectFiles(String projName) {
+ Hashtable outProjects = new Hashtable();
+
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String path = (String) aenum.nextElement();
+ // should be in the form of: /ProjName/....
+ if (path.length() > 0) {
+ // if path is a missing filename ("-" + filename) then it means that it had
+ // to come from this project (that is, the external nonexistent file could not have
+ // linked to this project). So, we will not add this path. Also, since it is marked
+ // broken, it probably won't exist to do anything with it anyway.
+ if (path.charAt(0) != '-') {
+ int index = path.indexOf(IPath.SEPARATOR, 1);
+ if (index != -1) {
+ String currentProjName = path.substring(1, index);
+ if (!currentProjName.equals(projName)) {
+ outProjects.put(path, path);
+ }
+ }
+ }
+ }
+ }
+ return outProjects.values();
+ }
+
+
+
+ public void createInLinkEntry(String file_path, String parent_path, int occurence) {
+
+ Vector in_links = new Vector();
+ Link inlnk = new Link(parent_path, occurence);
+ in_links.addElement(inlnk);
+ inLinksTable.put(file_path, in_links);
+ }
+
+
+
+ public void dump() {
+// if (false) {
+// if (inLinksTable != null) {
+// for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+// StringBuffer St = new StringBuffer();
+// String key = (String) aenum.nextElement();
+// St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$
+// Vector in_links = (Vector) inLinksTable.get(key);
+// int nb_of_links = in_links.size();
+//
+// // Replace the string by index
+// // Add a '+'separator only for more than one links to save space
+// //
+//
+//
+// for (int i = 0; i < nb_of_links; i++) {
+// Link lnk = (Link) in_links.elementAt(i);
+// St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+// }
+// org.eclipse.jem.util.logger.proxy.Logger.getLogger().logInfo(St.toString());
+// }
+// }
+// }
+ }
+
+ public void dump(boolean dump) {
+ if (dump) {
+ if (inLinksTable != null) {
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ StringBuffer St = new StringBuffer();
+ String key = (String) aenum.nextElement();
+ St.append("\nKey=" + key + "\n");//$NON-NLS-1$//$NON-NLS-2$
+ Vector in_links = (Vector) inLinksTable.get(key);
+ int nb_of_links = in_links.size();
+
+ // Replace the string by index
+ // Add a '+'separator only for more than one links to save space
+ //
+
+
+ for (int i = 0; i < nb_of_links; i++) {
+ Link lnk = (Link) in_links.elementAt(i);
+ St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ }
+ WebPlugin.logError(St.toString());
+ }
+ }
+ }
+ }
+
+ /**
+ * used for LinksBuilder debugging
+ */
+ public void dump2() {
+ if (inLinksTable != null) {
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ StringBuffer St = new StringBuffer();
+ String key = (String) aenum.nextElement();
+
+ Vector in_links = (Vector) inLinksTable.get(key);
+ int nb_of_links = in_links.size();
+ St.append("\nKey=" + key + " -- num:" + nb_of_links + "\n");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ // Replace the string by index
+ // Add a '+'separator only for more than one links to save space
+ //
+
+
+ for (int i = 0; i < nb_of_links; i++) {
+ Link lnk = (Link) in_links.elementAt(i);
+ St.append("\tValue=" + lnk.getURL() + "[" + lnk.getOccurrences() + "]");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
+ }
+ System.out.println(St.toString());
+ }
+ }
+ System.out.println("************************************************\n\n\n\n************************************\n"); //$NON-NLS-1$
+ }
+
+
+ public Vector getInLinks(String filePath) {
+ return (Vector) inLinksTable.get(filePath);
+ }
+
+ public void getInLinks(String filePath, Vector vectInLinks) {
+
+ if (inLinksTable != null) {
+ dump();
+ Vector in_links = (Vector) inLinksTable.get(filePath);
+ if (in_links != null) {
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) ((Link) in_links.elementAt(i)).clone();
+ vectInLinks.addElement(inlnk);
+ }
+ }
+ }
+ }
+
+ public Hashtable getAnchorsTable() {
+ return anchorsTable;
+ }
+
+ /**
+ * Returns the file used to store ServerContextRoot for the project.
+ */
+ public static File getPreviousSCRFile(IProject project) {
+ return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_SERVERCONTEXTROOT_FILE_NAME).toFile();
+ }
+
+ /**
+ * Returns the file used to store the state of the link relations for the project.
+ *
+ * @return java.io.File The state file
+ * @param project
+ * org.eclipse.core.resources.IProject The project to get the state file for.
+ */
+ private File getStateFile(IProject project) {
+ return new Path(J2EEPlugin.getDefault().getStateLocation().toString() + File.separator + project.getName() + File.separator + LINK_STATE_FILE_NAME).toFile();
+ }
+
+ public boolean hasInLinkEntry(String path) {
+ return inLinksTable.containsKey(path);
+ }
+
+ /**
+ * Run through all missing-file (-) RD entries to see if any of them closely match the path to
+ * this class. Return all of the matches.
+ */
+ public Vector getPossibleMissingEndingMatches(IPath classPath) {
+ Vector v = new Vector();
+
+ String match = classPath.lastSegment();
+ match = match.substring(0, match.length() - 6); // length minus ".class"
+
+ String classPathStr = classPath.toString();
+ String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
+
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String path = (String) aenum.nextElement();
+ // check if path ends with the class name that has been added/removed
+ if (path.startsWith(LINK_MISSING_FILE) && path.endsWith(match)) {
+ // OK: simple match found; now let's match with finer granularity.
+ // Take path and put it into a form where we can check if it is a
+ // close match to the class that has changed:
+ // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
+ String linkPath;
+ int index = path.lastIndexOf(IPath.SEPARATOR);
+ if (index != -1 && index < path.length() - 1) {
+ linkPath = path.substring(index + 1);
+ } else {
+ linkPath = path;
+ }
+ String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
+
+ if (matchingClassPath.endsWith(closeMatch)) {
+ Vector in_links = (Vector) inLinksTable.get(path);
+ String nonMissingPath = path.substring(1, path.length());
+ changeInLink(nonMissingPath, false);
+ if (in_links != null) {
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+ v.add(url);
+ }
+ }
+ }
+ }
+ }
+ return v;
+ }
+
+
+ /**
+ * Run through all existing RD entries to see if any of them closely match the path to this
+ * class. Return all of the matches.
+ */
+ public Vector getPossibleExistingEndingMatches(IPath classPath) {
+ Vector v = new Vector();
+
+ String match = classPath.lastSegment();
+ match = match.substring(0, match.length() - 6); // length minus ".class"
+
+ String classPathStr = classPath.toString();
+ String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
+
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String path = (String) aenum.nextElement();
+ // check if path ends with the class name that has been added/removed
+ if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) {
+ // OK: simple match found; now let's match with finer granularity.
+ // Take path and put it into a form where we can check if it is a
+ // close match to the class that has changed:
+ // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
+ String linkPath;
+ int index = path.lastIndexOf(IPath.SEPARATOR);
+ if (index != -1 && index < path.length() - 1) {
+ linkPath = path.substring(index + 1);
+ } else {
+ linkPath = path;
+ }
+ String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
+
+ if (matchingClassPath.endsWith(closeMatch)) {
+ Vector in_links = (Vector) inLinksTable.get(path);
+ changeInLink(path, true);
+ if (in_links != null) {
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+ v.add(url);
+ }
+ }
+ }
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Run through all existing RD entries to see if any of them closely match the path to this
+ * class. Remove the inlinks for all the matches.
+ */
+ public void removeInLinksPossibleExistingEndingMatches(IPath classPath) {
+ String match = classPath.lastSegment();
+ match = match.substring(0, match.length() - 6); // length minus ".class"
+
+ String classPathStr = classPath.toString();
+ String matchingClassPath = classPathStr.toString().substring(0, classPathStr.length() - 6);
+
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String path = (String) aenum.nextElement();
+ if (path.endsWith(match) && !path.startsWith(LINK_MISSING_FILE)) {
+ // OK: simple match found; now let's match with finer granularity.
+ // Take path and put it into a form where we can check if it is a
+ // close match to the class that has changed:
+ // /Proj/Web Content/com.acme.Foo --> com/acme/Foo
+ String linkPath;
+ int index = path.lastIndexOf(IPath.SEPARATOR);
+ if (index != -1 && index < path.length() - 1) {
+ linkPath = path.substring(index + 1);
+ } else {
+ linkPath = path;
+ }
+ String closeMatch = linkPath.replace('.', IPath.SEPARATOR);
+
+ if (matchingClassPath.endsWith(closeMatch)) {
+ removeInLinks(path);
+ }
+ }
+ }
+ }
+
+ /**
+ * Initialize links tables
+ */
+ public void initialize() {
+ inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
+ anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
+
+ }
+
+ /**
+ * Initialize links tables
+ */
+ public void initializeAnchors() {
+ anchorsTable = new Hashtable(INIT_ANCHORS_HASH_TABLE_SIZE);
+ }
+
+ /**
+ * Initialize links tables
+ */
+ public void initializeInLinks() {
+ inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
+ }
+
+ /**
+ * Return true if the file to restore data from existed and was successfully read.
+ *
+ * @return boolean
+ */
+ public boolean isFileOk() {
+ return fileOk;
+ }
+
+ public boolean isInitialized() {
+ return (inLinksTable != null);
+ }
+
+ public void newInLinkEntry(String path) {
+ if (!inLinksTable.containsKey(path))
+ inLinksTable.put(path, new Vector());
+ }
+
+ public void removeInLinks(String file_path) {
+
+ //
+ // Iterate through the fLinksTable to remove all in-links references
+ // for file_path
+ //
+
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ for (int i = 0; i < in_links.size(); i++) {
+
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+ in_links.removeElementAt(i);
+ break;
+ }
+
+ //
+ // Remove the entry in the fLinksTable if the in-link
+ // of the file is not in the workbench and an orphan link
+ // otherwise update the in-links fLinksTable
+ //
+ }
+
+ if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) {
+ inLinksTable.remove(key);
+ }
+ }
+ }
+
+ /**
+ * Iterate through the fLinksTable to return all out-links references for file_path
+ *
+ * @param file_path
+ * @return
+ */
+ public List getOutLinks(String file_path) {
+ ArrayList list = new ArrayList();
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ for (int i = 0; i < in_links.size(); i++) {
+
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+ list.add(key);
+ break;
+ }
+ }
+ }
+
+ return list;
+ }
+
+
+ /**
+ * return whether other resources link to this file or not
+ */
+ public boolean referencedByOtherLinks(String file_path) {
+
+ //
+ // Iterate through the fLinksTable to remove all in-links references
+ // for file_path
+ //
+ boolean referenced = false;
+ for (Enumeration aenum = inLinksTable.keys(); !referenced && aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+ referenced = true;
+ break;
+ }
+ }
+ }
+ return referenced;
+ }
+
+
+ /*
+ * performs as removeInLinks( String ) ... But for performance reasons, this also additionally
+ * returns a list of all the projects that this file is dependent upon. This is useful to get
+ * this information, and then go to all of those projects' relation data and tell them to
+ * removeInLinks for this file.
+ */
+ public Collection removeInLinksForProjects(String file_path) {
+
+ //
+ // Iterate through the fLinksTable to remove all in-links references
+ // for file_path
+ //
+ Hashtable projects = new Hashtable();
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ for (int i = 0; i < in_links.size(); i++) {
+
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+ // should be in the form of: /ProjName/....
+ if (key.length() > 0) {
+ // key could be the filename or the missing filename ("-" + filename)
+ // take this into account and offset the index accordingly
+ int index = 0;
+ int offset = 1;
+ if (key.charAt(0) == '-') {
+ index = key.indexOf(IPath.SEPARATOR, 2);
+ offset = 2;
+ } else {
+ index = key.indexOf(IPath.SEPARATOR, 1);
+ offset = 1;
+ }
+ if (index != -1) {
+ String projName = key.substring(offset, index);
+ projects.put(projName, projName);
+ }
+ }
+ in_links.removeElementAt(i);
+ break;
+ }
+
+ //
+ // Remove the entry in the fLinksTable if the in-link
+ // of the file is not in the workbench and an orphan link
+ // otherwise update the in-links fLinksTable
+ //
+ }
+
+ if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE))
+ inLinksTable.remove(key);
+ }
+
+ return projects.values();
+ }
+
+
+
+ /**
+ * performs as removeInLinks( String ) ... But for performance reasons, it additionally returns
+ * which projects depend on this file. i.e. any projects that are in this file's list of
+ * in_links
+ */
+ public Collection removeInLinksAndGetDependentProjects(String file_path) {
+ //
+ // Iterate through the fLinksTable to remove all in-links references
+ // for file_path
+ //
+ Hashtable projects = new Hashtable();
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ if (key.equals(RelationData.LINK_MISSING_FILE + file_path)) {
+ int index = -1;
+ for (int i = 0; i < in_links.size(); i++) {
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+ index = i;
+ }
+ if (url.length() > 1) {
+ int projindex = url.indexOf(IPath.SEPARATOR, 1);
+ if (projindex != -1) {
+ String projName = url.substring(1, projindex);
+ projects.put(projName, projName);
+ }
+ }
+ }
+ if (index != -1) {
+ in_links.removeElementAt(index);
+ }
+
+ } else {
+ for (int i = 0; i < in_links.size(); i++) {
+
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(file_path) == 0) {
+
+ in_links.removeElementAt(i);
+ break;
+ }
+
+ //
+ // Remove the entry in the fLinksTable if the in-link
+ // of the file is not in the workbench and an orphan link
+ // otherwise update the in-links fLinksTable
+ //
+ }
+ }
+
+ if (in_links.isEmpty() && key.startsWith(LINK_MISSING_FILE)) {
+ inLinksTable.remove(key);
+ }
+ }
+ return projects.values();
+ }
+
+
+ /**
+ * remove all references to a specific inLink. When removeOrphan is true the inLink entry is
+ * removed as well, when there are no more refereces to it
+ */
+ public void removeInLinks(String inLinkEntry, String inLinkReference, boolean removeOrphan) {
+
+ String key = inLinkEntry;
+ Vector in_links = (Vector) inLinksTable.get(key);
+
+ for (int i = 0; i < in_links.size(); i++) {
+
+ Link inlnk = (Link) in_links.elementAt(i);
+ String url = inlnk.getURL();
+
+ if (url.compareTo(inLinkReference) == 0) {
+ in_links.removeElementAt(i);
+ break;
+ }
+ }
+
+ // If there are no more references to the inLinkEntry
+ // and the caller wants this orphan deleted then
+ // remove the key from the table
+ if (in_links.isEmpty() && removeOrphan)
+ inLinksTable.remove(key);
+
+ }
+
+ /**
+ * Restores this builder's saved state and returns whether it was successful in doing so.
+ */
+ public boolean restore(IProject project) {
+ if (project != null) {
+ // get the state
+ File stateFile = getStateFile(project);
+ if (stateFile.exists()) {
+ inLinksTable = new Hashtable(INIT_HASH_TABLE_SIZE);
+
+ // read inLinksTable from stateFile
+ Vector keys = new Vector();
+ Vector indices = new Vector();
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(stateFile));
+
+ String line = null;
+ // while( ((line = reader.readLine()) != null) && !line.startsWith(
+ // ANCHOR_SEPARATOR ) )
+ while ((line = reader.readLine()) != null) {
+ String buffer = line;
+
+
+ // to take into account the possibility of links spanning multiple lines,
+ // keep reading until we find a line that starts with an idicator
+ // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR)
+ line = reader.readLine();
+ while (line != null && !line.startsWith(LINK_INDEX_SEPARATOR)) {
+ buffer = buffer + line;
+ line = reader.readLine();
+ }
+ // add link string (/MyProj/file.html)
+ keys.addElement(buffer);
+ // add references line (+2/3...)
+ if (line != null) {
+ indices.addElement(line);
+ } else {
+ System.out.println(ProjectSupportResourceHandler.Syntax_Error_in_the_links_UI_); // = "Syntax Error in the links state file"
+ return false;
+ }
+ }
+
+ // Use this to load anchor information
+ // // Now let's add all of the extra anchor information
+ // if ( line != null && line.startsWith( ANCHOR_SEPARATOR ) ) {
+ // while( (line = reader.readLine()) != null )
+ // {
+ // String buffer = line;
+ //
+ // // to take into account the possibility of links spanning multiple lines,
+ // // keep reading until we find a line that starts with an idicator
+ // // that the link is finished (a line beginning w/ LINK_INDEX_SEPARATOR)
+ // line = reader.readLine();
+ // while ( line != null && !line.startsWith( ANCHOR_INDEX_SEPARATOR ) ) {
+ // buffer = buffer + line;
+ // line = reader.readLine();
+ // }
+ //
+ // // add file and all of its anchors
+ // if ( buffer != null && line != null)
+ // {
+ // anchorsTable.put( buffer, line );
+ // }
+ // else
+ // {
+ // System.out.println(ResourceHandler.getString("Syntax_Error_in_the_links_UI_"));
+ // //$NON-NLS-1$ = "Syntax Error in the links state file"
+ // return false;
+ // }
+ // }
+ //
+ // }
+ } catch (FileNotFoundException fe) {
+ WebPlugin.logError(fe);
+ } catch (IOException ie) {
+ WebPlugin.logError(ie);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ie2) {
+ WebPlugin.logError(ie2);
+ }
+ }
+ }
+
+
+ //
+ // Populate the hash inLinksTable with keys (file paths) and values (in links files
+ // paths)
+ //
+ fileOk = true;
+ for (int i = 0; i < keys.size(); i++) {
+ try {
+ String key = (String) keys.elementAt(i);
+ String compacted_indices = (String) indices.elementAt(i);
+
+ //
+ // Parse the in-links indexes
+ //
+
+ int size = keys.size();
+ Vector in_links = new Vector();
+ if (compacted_indices != LINK_INDEX_SEPARATOR) {
+
+ // Extract indexes and occurences
+
+ StringTokenizer st_idx_occ = new StringTokenizer(new String(compacted_indices), LINK_INDEX_SEPARATOR);
+ while (st_idx_occ.hasMoreTokens()) {
+ String idx_occ = new String(st_idx_occ.nextToken());
+ int pos_occ = idx_occ.indexOf(LINK_OCCURENCE_SEPARATOR);
+ int index;
+ int occurence = 1;
+ if (pos_occ == -1) {
+ index = Integer.valueOf(idx_occ).intValue();
+ } else {
+ index = Integer.valueOf(idx_occ.substring(0, pos_occ)).intValue();
+ occurence = Integer.valueOf(idx_occ.substring(pos_occ + 1)).intValue();
+ }
+ if (index >= 0 && index < size) {
+ Link inlnk = new Link((String) keys.elementAt(index), occurence);
+ in_links.addElement(inlnk);
+ }
+ }
+ }
+ inLinksTable.put(key, in_links);
+ } catch (Exception e) {
+ fileOk = false;
+ }
+ }
+
+ return fileOk;
+ }
+ return false;
+
+ }
+
+ return false;
+ }
+
+ /**
+ * Saves this builder's state to disk so that it can be restarted in the same state later.
+ */
+ public void save(IProject project) {
+
+ File stateFile = getStateFile(project);
+ if (inLinksTable == null) {
+ stateFile.delete();
+ } else {
+
+ // Prepare the index vector
+
+ Vector index_vector = new Vector(inLinksTable.size());
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ index_vector.addElement(aenum.nextElement());
+ }
+
+ // write inLinksTable to stateFile
+
+ try {
+ File parentFolder = stateFile.getParentFile();
+ if (!parentFolder.exists()) {
+ parentFolder.mkdirs();
+ }
+ PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(stateFile)));
+ for (Enumeration aenum = inLinksTable.keys(); aenum.hasMoreElements();) {
+ String key = (String) aenum.nextElement();
+ out.print(key);
+ out.println();
+ out.print(LINK_INDEX_SEPARATOR);
+ Vector in_links = (Vector) inLinksTable.get(key);
+ int nb_of_links = in_links.size();
+
+ // Replace the string by index
+ // Add a '+'separator only for more than one links to save space
+ // Add '/<occurence>' only if occurence > 1 to save space
+ //
+
+ Link lnk = null;
+ int nb_lnks = 0;
+ if (nb_of_links > 0) {
+ lnk = (Link) in_links.elementAt(0);
+ out.print(index_vector.indexOf(lnk.getURL()));
+ nb_lnks = lnk.getOccurrences();
+ if (nb_lnks > 1) {
+ out.print(LINK_OCCURENCE_SEPARATOR);
+ out.print(nb_lnks);
+ }
+ for (int i = 1; i < nb_of_links; i++) {
+ out.print(LINK_INDEX_SEPARATOR);
+ lnk = (Link) in_links.elementAt(i);
+ out.print(index_vector.indexOf(lnk.getURL()));
+ nb_lnks = lnk.getOccurrences();
+ if (nb_lnks > 1) {
+ out.print(LINK_OCCURENCE_SEPARATOR);
+ out.print(nb_lnks);
+ }
+ }
+ }
+ out.println();
+ }
+ /*
+ * use this to save out anchor information //
+ * ############################################ if ( !anchorsTable.isEmpty() ) {
+ * out.println( ANCHOR_SEPARATOR ); } for (Enumeration enum = anchorsTable.keys();
+ * enum.hasMoreElements();) { String key = (String) enum.nextElement();
+ * out.print(key); out.println(); //out.print(ANCHOR_INDEX_SEPARATOR); out.println(
+ * anchorsTable.get(key) ); }
+ */
+
+ out.flush();
+ out.close();
+ } catch (IOException e) {
+ WebPlugin.logError(ProjectSupportResourceHandler.Error_while_saving_links_s_EXC_); // = "Error while saving links state file"
+ }
+ }
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (3/21/2001 1:45:58 PM)
+ *
+ * @param newFileOk
+ * boolean
+ */
+ void setFileOk(boolean newFileOk) {
+ fileOk = newFileOk;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java
new file mode 100644
index 0000000..5003dc6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/ServerTargetUtil.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 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
+ *******************************************************************************/
+/*
+ * Created on Sep 12, 2003
+ */
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.ServerCore;
+
+/**
+ * A class with some useful methods that support server targetting for Web projects.
+ *
+ * @author Pratik Shah
+ */
+public class ServerTargetUtil {
+
+ private static final String defaultId = "com.ibm.etools.websphere.serverTarget.base.v51"; //$NON-NLS-1$
+ private static final String defaultExpressId = "com.ibm.etools.websphere.serverTarget.express.v51"; //$NON-NLS-1$
+
+ /**
+ * @param targets
+ * A list of IServerTargets
+ * @return The index of the target server with the
+ * {@link #getDefaultServerTargetId() default Id}; or 0, if it could not be found.
+ */
+ public static int findDefaultServerTargetIndex(List targets) {
+ int index = 0;
+ for (int i = 0; i < targets.size(); i++) {
+ IRuntime target = (IRuntime) targets.get(i);
+ if (target.getId().equals(getDefaultServerTargetId())) {
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
+
+ /**
+ * @param target
+ * The IServerTarget that has to be found in the given list; it can be
+ * <code>null</code>
+ * @param list
+ * The List from which the IServerTarget has to be found
+ *
+ * @return The index of the given target in the given list; or 0, if the given target could not
+ * be found in the given list. Two IServerTargets are considered to be equal if they
+ * have the same ID.
+ */
+ public static int findIndexOf(IRuntime target, List list) {
+ int index = 0;
+ if (target != null) {
+ for (int i = 0; i < list.size(); i++) {
+ IRuntime element = (IRuntime) list.get(i);
+ if (element.equals(target)) {
+ index = i;
+ break;
+ }
+ }
+ }
+ return index;
+ }
+
+ /**
+ * @return the Id of the target server that should be selected by default
+ */
+ public static String getDefaultServerTargetId() {
+ String id = defaultExpressId;
+ if (J2EEPlugin.isEJBSupportAvailable()) {
+ id = defaultId;
+ }
+ return id;
+ }
+
+ /**
+ * @param isJ2EE13
+ * <code>true</code> if the constant for J2EE version 1.3 is desired
+ * @return IServerTargetConstants.J2EE_12 or IServerTargetConstants.J2EE_13
+ */
+ public static String getJ2EEVersion(boolean isJ2EE13) {
+ return isJ2EE13 ? IServerTargetConstants.J2EE_13 : IServerTargetConstants.J2EE_12;
+ }
+
+ /**
+ * A convenient method that takes in a list of IServerTargets and returns an array of labels of
+ * the IServerTargets in the given list.
+ *
+ * @param serverTargets
+ * The list of IServerTargets
+ * @return An array lof labels of the IServerTargets in the given list
+ */
+ public static String[] getServerNames(List serverTargets) {
+ String[] result = new String[serverTargets.size()];
+ for (int i = 0; i < result.length; i++) {
+ IRuntime runtime = (IRuntime) serverTargets.get(i);
+ result[i] = runtime.getName() + " (" + runtime.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result;
+ }
+
+ /**
+ * @param prjName
+ * name of the project whose ServerTarget has to be retrieved; it can be
+ * <code>null</code>
+ *
+ * @return the ServerTarget of the given project; <code>null</code> if the project does not
+ * exist or its ServerTarget is not specified.
+ */
+ public static IRuntime getServerTarget(String prjName) {
+ if (prjName != null && !prjName.trim().equals("")) { //$NON-NLS-1$
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(prjName);
+ if (prj != null && prj.exists()) {
+ return ServerCore.getProjectProperties(prj).getRuntimeTarget();
+ }
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java
new file mode 100644
index 0000000..092e800
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/TemplateData.java
@@ -0,0 +1,94 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+
+
+public class TemplateData {
+ protected java.lang.String wtFileName = "";//$NON-NLS-1$
+ protected java.lang.String wtCSSName = "";//$NON-NLS-1$
+ protected java.lang.String wtContainerLocatoin = "";//$NON-NLS-1$
+ protected java.lang.String taglibs;
+
+ /**
+ * TemplateData constructor comment.
+ */
+ public TemplateData() {
+ super();
+ }
+
+ /**
+ */
+ public String getContainerLocatoin() {
+ return wtContainerLocatoin;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM)
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getCSSName() {
+ return wtCSSName;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM)
+ *
+ * @return java.lang.String
+ */
+ public String getFileName() {
+ return wtFileName;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM)
+ *
+ * @return java.lang.String
+ */
+ public java.lang.String getTaglibs() {
+ return taglibs;
+ }
+
+ /**
+ */
+ public void setContainerLocatoin(String newFileName) {
+ wtContainerLocatoin = newFileName;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/4/2001 5:24:30 PM)
+ *
+ * @param newCSSName
+ * java.lang.String
+ */
+ public void setCSSName(java.lang.String newCSSName) {
+ wtCSSName = newCSSName;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (6/4/2001 5:22:56 PM)
+ *
+ * @param newWtFileName
+ * java.lang.String
+ */
+ public void setFileName(String newFileName) {
+ wtFileName = newFileName;
+ }
+
+ /**
+ * Insert the method's description here. Creation date: (11/15/2001 4:16:10 PM)
+ *
+ * @param newTaglibs
+ * java.lang.String
+ */
+ public void setTaglibs(java.lang.String newTaglibs) {
+ taglibs = newTaglibs;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
new file mode 100644
index 0000000..e3853d5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.operations;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jem.workbench.utility.JemProjectUtilities;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+
+import com.ibm.icu.text.UTF16;
+import com.ibm.icu.util.StringTokenizer;
+
+public class WebPropertiesUtil {
+ // private static final char[] BAD_CHARS = {'/', '\\', ':'};
+ private static final char[] BAD_CHARS = {':'};
+ public static final String DEFAULT_JAVA_SOURCE_NAME = "Java Source"; //$NON-NLS-1$
+ //TODO Port to flexible structure
+ /**
+ * Update the Web Content folder to a new value if it is different. This applies to both Static
+ * and J2EE Web Projects. In the case of a J2EE Project, the library classpath entries will be
+ * modifies to reflect the new location.
+ *
+ * @param project
+ * The Web Project to update
+ * @param webContentName
+ * The new name given to the Web Project's Web Content folder
+ * @param progressMonitor
+ * Indicates progress of the update operation
+ * @return True if the web content rename was actually renamed, false if unneeded.
+ * @throws CoreException
+ * The exception that occured during renaming of the the project's web content
+ * folder
+ */
+ public static boolean updateWebContentNameAndProperties(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
+ boolean success = false;
+ if (project.exists() && project.isOpen()) {
+
+ /*
+ * IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); if
+ * (webContentName == null) { if (webNature.isStatic()) { webContentName =
+ * J2EEWebNatureRuntimeUtilities.getDefaultStaticWebContentName(); } else {
+ * webContentName = J2EEWebNatureRuntimeUtilities.getDefaultJ2EEWebContentName(); } }
+ */
+
+ IPath newPath = new Path(webContentName);
+ if (getModuleServerRoot(project).getProjectRelativePath().equals(newPath))
+ return false;
+ if (project.exists(newPath)) {
+ IStatus status = new Status(IStatus.ERROR, "org.eclipse.jst.j2ee", IStatus.OK, ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Could_not_rename_____2, new Object[]{webContentName}), null); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+
+ moveWebContentFolder(project, webContentName, progressMonitor);
+ updateWebContentNamePropertiesOnly(project, webContentName, progressMonitor);
+ success = true;
+ }
+ return success;
+ }
+
+ /**
+ * Update the classpath entries and Server Root Name for this web project only.
+ *
+ * @param project
+ * @param webContentName
+ * @return
+ */
+ public static void updateWebContentNamePropertiesOnly(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
+ IPath newPath = new Path(webContentName);
+ if (getModuleServerRoot(project).equals(newPath))
+ return;
+
+ if (!getModuleServerRoot(project).equals(webContentName)) {
+
+ // if (webModuleArtifact.isJ2EE) {
+ // Update the library references
+ IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
+
+ IClasspathEntry[] classpath = javaProject.getRawClasspath();
+ IClasspathEntry[] newClasspath = new IClasspathEntry[classpath.length];
+
+ for (int i = 0; i < classpath.length; i++) {
+ if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ IClasspathEntry library = classpath[i];
+ IPath libpath = library.getPath();
+ IPath modServerRootPath = getModuleServerRoot(project).getFullPath();
+ if (modServerRootPath.isPrefixOf(libpath)) {
+ IPath prunedPath = libpath.removeFirstSegments(modServerRootPath.segmentCount());
+ IPath relWebContentPath = new Path(webContentName + "/" + prunedPath.toString()); //$NON-NLS-1$
+ IResource absWebContentPath = project.getFile(relWebContentPath);
+
+ IPath srcAttachmentPath = library.getSourceAttachmentPath();
+ if (null != srcAttachmentPath) {
+ prunedPath = srcAttachmentPath.removeFirstSegments(modServerRootPath.segmentCount());
+ }
+ IResource absWebContentSrcAttachmentPath = project.getFile(relWebContentPath);
+
+ newClasspath[i] = JavaCore.newLibraryEntry(absWebContentPath.getFullPath(), absWebContentSrcAttachmentPath.getFullPath(), library.getSourceAttachmentRootPath(), library.isExported());
+
+ } else {
+ newClasspath[i] = classpath[i];
+ }
+
+ } else {
+ newClasspath[i] = classpath[i];
+ }
+ // }
+
+ // Set the java output folder
+ IFolder outputFolder = project.getFolder(getModuleServerRoot(project).getFullPath());
+ javaProject.setRawClasspath(newClasspath, outputFolder.getFullPath(), new SubProgressMonitor(progressMonitor, 1));
+ }
+ // update websettings
+ // TODO add to WebArtifactEdit
+ // webNature.setModuleServerRootName(webContentName);
+ }
+ }
+
+ /**
+ * Moves the web content folder to the name indicated only if that path doesn't already exist in
+ * the project.
+ *
+ * @param project
+ * The web project to be updated.
+ * @param webContentName
+ * The new web content name
+ * @param progressMonitor
+ * Indicates progress
+ * @throws CoreException
+ * The exception that occured during move operation
+ */
+ public static void moveWebContentFolder(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException {
+ IPath newPath = new Path(webContentName);
+ if (!project.exists(newPath)) {
+ if (newPath.segmentCount() > 1) {
+ for (int i = newPath.segmentCount() - 1; i > 0; i--) {
+ IPath tempPath = newPath.removeLastSegments(i);
+ IFolder tempFolder = project.getFolder(tempPath);
+ if (!tempFolder.exists()) {
+ tempFolder.create(true, true, null);
+ }
+ }
+ }
+ newPath = project.getFullPath().append(newPath);
+ IContainer webContentRoot = getModuleServerRoot(project);
+ IPath oldPath = webContentRoot.getProjectRelativePath();
+ webContentRoot.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1));
+ for (int i = 0; i < oldPath.segmentCount(); i++) {
+ IPath tempPath = oldPath.removeLastSegments(i);
+ IFolder tempFolder = project.getFolder(tempPath);
+ if (tempFolder.exists() && tempFolder.members().length == 0) {
+ tempFolder.delete(true, true, null);
+ }
+ }
+ }
+ }
+
+ /**
+ * Synchonizies the class path and the lib directories to catch any changes from the last use
+ * Creation date: (4/17/01 11:48:12 AM)
+ */
+ protected static void synch(IProject project, IProgressMonitor monitor) {
+ IProgressMonitor localMonitor = monitor;
+ try {
+ if (localMonitor == null) {
+ localMonitor = new NullProgressMonitor();
+ }
+ localMonitor.beginTask(ProjectSupportResourceHandler.Sychronize_Class_Path_UI_, 4);
+ //$NON-NLS-1$ = "Sychronize Class Path"
+
+ IContainer lib_folder = getWebLibFolder(project);
+ // Nothing to do if the lib folder does not exist.
+ if (lib_folder == null || !lib_folder.isAccessible())
+ return;
+ IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
+ IPath lib_path = lib_folder.getProjectRelativePath();
+ IPath lib_full_path = lib_folder.getFullPath();
+
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+
+ boolean needsToBeModified = false;
+ // Create a map of the lib projects in the current project
+ Hashtable lib_jars = new Hashtable();
+ IResource[] children = lib_folder.members();
+ localMonitor.subTask(ProjectSupportResourceHandler.Catalog_Lib_Directory__UI_);
+ //$NON-NLS-1$ = "Catalog Lib Directory:"
+ for (int j = 0; j < children.length; j++) {
+ IResource child = children[j];
+ // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_") +
+ // child); //$NON-NLS-1$ = "Catalog Lib Directory:"
+ // Make sure it is a zip or a jar file
+ if (child.getType() == IResource.FILE && (child.getFullPath().toString().toLowerCase().endsWith(IJ2EEModuleConstants.JAR_EXT)
+ || child.getFullPath().toString().toLowerCase().endsWith(".zip"))) { //$NON-NLS-1$
+ lib_jars.put(child.getFullPath(), child);
+ }
+
+ }
+
+ localMonitor.worked(1);
+ localMonitor.subTask(ProjectSupportResourceHandler.Update_ClassPath__UI_);
+ //$NON-NLS-1$ = "Update ClassPath:"
+ // Loop through all the classpath dirs looking for ones that may have
+ // been deleted
+ Vector newClassPathVector = new Vector();
+ for (int j = 0; j < cp.length; j++) {
+
+ // If it is a lib_path
+ if (cp[j].getPath().toString().startsWith(lib_path.toString()) || cp[j].getPath().toString().startsWith(lib_full_path.toString())) {
+ // It was already in the class path
+ if (lib_jars.get(cp[j].getPath()) != null) {
+ newClassPathVector.add(cp[j]);
+ // Remove it from the hash table of paths to add back
+ // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory__UI_")
+ // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:"
+ lib_jars.remove(cp[j].getPath());
+
+ } else {
+ // You have removed something form the class path you
+ // will need to re-build
+ // monitor.setTaskName(ResourceHandler.getString("Catalog_Lib_Directory_Remo_UI_")
+ // + cp[j].getPath()); //$NON-NLS-1$ = "Catalog Lib Directory:Remove "
+ needsToBeModified = true;
+ }
+ } else {
+ localMonitor.subTask(ProjectSupportResourceHandler.Catalog_Lib_Directory__UI_ + cp[j].getPath());
+ //$NON-NLS-1$ = "Catalog Lib Directory:"
+ newClassPathVector.add(cp[j]);
+ }
+ }
+ localMonitor.worked(1);
+ localMonitor.subTask(ProjectSupportResourceHandler.Update_ClassPath__UI_);
+ //$NON-NLS-1$ = "Update ClassPath:"
+
+ // Add any entries not already found
+ Enumeration aenum = lib_jars.keys();
+ while (aenum.hasMoreElements()) {
+ IPath path = (IPath) aenum.nextElement();
+ newClassPathVector.add(JavaCore.newLibraryEntry(path, null, null));
+ // You have added something form the class path you
+ // will need to re-build
+ // monitor.setTaskName(ResourceHandler.getString("23concat_UI_", (new Object[] {
+ // path }))); //$NON-NLS-1$ = "Catalog Lib Directory:Add {0}"
+ needsToBeModified = true;
+ }
+
+ localMonitor.worked(1);
+ localMonitor.subTask(ProjectSupportResourceHandler.Set_ClassPath__UI_);
+ //$NON-NLS-1$ = "Set ClassPath:"
+
+ // Tansfer the vector to an array
+ IClasspathEntry[] newClassPathArray = new IClasspathEntry[newClassPathVector.size()];
+
+ for (int j = 0; j < newClassPathArray.length; j++) {
+ newClassPathArray[j] = (IClasspathEntry) newClassPathVector.get(j);
+ }
+
+ // Only change the class path if there has been a modification
+ if (needsToBeModified) {
+
+ try {
+ javaProject.setRawClasspath(newClassPathArray, localMonitor);
+ } catch (Exception e) {
+ WebPlugin.logError(e);
+ }
+ }
+
+ } catch (ClassCastException ex) {
+ WebPlugin.logError(ex);
+ } catch (CoreException ex) {
+ WebPlugin.logError(ex);
+ } finally {
+ localMonitor.done();
+ }
+ }
+
+ public static void updateContextRoot(IProject project, String contextRoot) {
+
+ }
+
+
+ /**
+ * @param project
+ * org.eclipse.core.resources.IProject
+ */
+ /**
+ * Returns a error message that states whether a context root is valid or not returns null if
+ * context root is fine
+ *
+ * @return java.lang.String
+ * @param contextRoot
+ * java.lang.String
+ */
+ public static String validateContextRoot(String contextRoot) {
+
+ if (contextRoot == null)
+ return null;
+
+ String errorMessage = null;
+
+ String name = contextRoot;
+ if (name.equals("")) { //$NON-NLS-1$
+ // this was added because the error message shouldnt be shown initially. It should be
+ // shown only if context root field is edited to
+ errorMessage = ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2;
+ return errorMessage;
+ }
+
+ /*******************************************************************************************
+ * // JZ - fix to defect 204264, "/" is valid in context root if (name.indexOf("//") != -1) {
+ * //$NON-NLS-1$ errorMessage = "// are invalid characters in a resource name"; return
+ * errorMessage; }
+ ******************************************************************************************/
+
+ if (name.trim().equals(name)) {
+ StringTokenizer stok = new StringTokenizer(name, "."); //$NON-NLS-1$
+ outer : while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ int cp;
+ for (int i = 0; i < token.length(); i += UTF16.getCharCount(cp)) {
+ cp = UTF16.charAt(token, i);
+ if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
+ if (Character.isWhitespace(token.charAt(i))) {
+ // Removed because context roots can contain white space
+ // errorMessage =
+ // ResourceHandler.getString("_Context_root_cannot_conta_UI_");//$NON-NLS-1$
+ // = " Context root cannot contain whitespaces."
+ } else {
+ String invalidCharString = null;
+ if (UTF16.getCharCount(cp)>1)
+ {
+ invalidCharString = UTF16.valueOf(cp);
+ }
+ else
+ {
+ invalidCharString = (new Character(token.charAt(i))).toString();
+ }
+ Object[] invalidChar = new Object[]{invalidCharString};
+ errorMessage = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root, invalidChar);
+ break outer;
+ }
+ }
+ }
+ }
+ } // en/ end of if(name.trim
+ else
+ errorMessage = ProjectSupportResourceHandler.Names_cannot_begin_or_end_with_whitespace_5;
+
+ return errorMessage;
+ }
+
+
+ /**
+ * Return true if the string contains any of the characters in the array.
+ */
+ private static boolean contains(String str, char[] chars) {
+ for (int i = 0; i < chars.length; i++) {
+ if (str.indexOf(chars[i]) != -1)
+ return true;
+ }
+ return false;
+ }
+
+
+ public static String validateFolderName(String folderName) {
+ if (folderName.length() == 0)
+ return ProjectSupportResourceHandler.Folder_name_cannot_be_empty_2;
+
+ if (contains(folderName, BAD_CHARS))
+ return ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Folder_name_is_not_valid, new Object[]{folderName});
+
+ return null;
+ }
+
+
+ public static String validateWebContentName(String webContentName, IProject project, String javaSourceName) {
+
+ String msg = validateFolderName(webContentName);
+ if (msg != null)
+ return msg;
+
+ if (javaSourceName != null && webContentName.equals(javaSourceName))
+ return ProjectSupportResourceHandler.Folder_names_cannot_be_equal_4;
+
+ // If given a java project, check to make sure current package fragment
+ // root folders do not overlap with new web content name
+ if (project != null) {
+ IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
+ if (javaProject != null) {
+ try {
+ IPackageFragmentRoot roots[] = javaProject.getPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ IPackageFragmentRoot root = roots[i];
+ if (!root.isArchive()) {
+ IResource resource = root.getCorrespondingResource();
+ if (resource.getType() == IResource.FOLDER) {
+ IPath path = resource.getFullPath();
+ String rootFolder = path.segment(1);
+ if (webContentName.equals(rootFolder)) {
+ if (root.getKind() == IPackageFragmentRoot.K_SOURCE)
+ return ProjectSupportResourceHandler.Folder_name_cannot_be_the_same_as_Java_source_folder_5;
+
+ return ProjectSupportResourceHandler.Folder_name_cannot_be_the_same_as_Java_class_folder_6;
+ }
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ return null;
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Update given web nature to the current version if necessary.
+ *
+ * @param webNature
+ * The web Nature that should be examined.
+ * @return True if successful, false if unnecessary.
+ * @throws CoreException
+ * The exception that occured during the version change operation.
+ */
+ /*
+ * static public boolean updateNatureToCurrentVersion(J2EEWebNatureRuntime webNature) throws
+ * CoreException {
+ *
+ * boolean success = false;
+ *
+ * if (webNature.getVersion() != WEB.CURRENT_VERSION) {
+ * webNature.setVersion(J2EESettings.CURRENT_VERSION); success = true; }
+ * ((J2EEModuleWorkbenchURIConverterImpl)
+ * webNature.getResourceSet().getURIConverter()).recomputeContainersIfNecessary();
+ *
+ * return success; }
+ */
+
+ /**
+ * Move the old source folder to the new default folder.
+ *
+ * @param project
+ * The Web Project we are working with.
+ * @param oldSourceFolder
+ * The old "Java Source" folder that will be moved.
+ * @param javaSourceName
+ * The new name of the "Java Source" folder, or null for default.
+ * @return The location of the new folder, or null if no move was necessary.
+ * @throws CoreException
+ * The exception that occured during the move operation.
+ */
+ static public IContainer updateJavaSourceName(IProject project, IContainer oldSourceFolder, String javaSourceName, IProgressMonitor progressMonitor) throws CoreException {
+ IContainer newSourceFolder = null;
+ if (oldSourceFolder != null) {
+ IPath newPath;
+ if (javaSourceName == null)
+ newPath = new Path(DEFAULT_JAVA_SOURCE_NAME);
+ else
+ newPath = new Path(javaSourceName);
+
+ // Make sure new path is different form old path
+ if (!project.getFolder(newPath).getFullPath().equals(oldSourceFolder.getFullPath())) {
+ oldSourceFolder.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1));
+ JemProjectUtilities.removeFromJavaClassPath(project, oldSourceFolder);
+ newSourceFolder = project.getFolder(newPath);
+ JemProjectUtilities.appendJavaClassPath(project, JavaCore.newSourceEntry(project.getFolder(newPath).getFullPath()));
+ }
+ }
+ return newSourceFolder;
+ }
+
+
+ /**
+ * Get the source folder that should be used for migration.
+ *
+ * @param project
+ * The Web Project to examine.
+ * @return The source folder to use in migration, or null if it should be skipped.
+ */
+ static public IContainer getJavaSourceFolder(IProject project) {
+ List sourceRoots = JemProjectUtilities.getSourceContainers(project);
+ IContainer oldSourceFolder = null;
+
+ if (sourceRoots != null) {
+ if (sourceRoots.size() == 1) {
+ IContainer sourceFolder = (IContainer) sourceRoots.get(0);
+ if (sourceFolder instanceof IFolder) {
+ oldSourceFolder = sourceFolder;
+ }
+ }
+ }
+ return oldSourceFolder;
+ }
+
+ public static IFolder getModuleServerRoot(IProject project) {
+ // TODO need to implement module server root properly
+ IPath compRootPath = ComponentCore.createComponent(project).getRootFolder().getUnderlyingFolder().getProjectRelativePath();
+ return project.getFolder(compRootPath);
+ //return project.getFolder("WebContent");
+
+ }
+
+ public static IVirtualFolder getWebLibFolder(IVirtualComponent webComponent) {
+ IPath path = new Path(J2EEConstants.WEB_INF + "/" + "lib"); //$NON-NLS-1$//$NON-NLS-2$
+ IVirtualFolder libFolder = webComponent.getRootFolder().getFolder(path);
+ return libFolder;
+ }
+
+ //TODO delete jsholl
+ /**
+ * @deprecated use getWebLibFolder(IVirtualComponent webComponent)
+ * @param project
+ * @return
+ */
+ public static IContainer getWebLibFolder(IProject project) {
+ return getWebLibFolder(ComponentCore.createComponent(project)).getUnderlyingFolder();
+ }
+
+ //
+ // static public boolean isImportedClassesJARFileInLibDir(IResource resource) {
+ // if (resource == null || !resource.exists())
+ // return false;
+ // return resource.getType() == resource.FILE &&
+ // resource.getName().endsWith(IWebNatureConstants.IMPORTED_CLASSES_SUFFIX) && isZip(resource);
+ // }
+ //
+ // static public boolean isLibDirJARFile(IResource resource) {
+ // if (resource == null || !resource.exists())
+ // return false;
+ // return resource.getType() == resource.FILE && isZip(resource);
+ // }
+ //
+ // static public boolean isZip(IResource resource) {
+ // String path = resource.getLocation().toOSString();
+ // ZipFile zip = null;
+ //
+ // try {
+ // zip = new ZipFile(path);
+ // } catch (IOException notAZip) {
+ // return false;
+ // } finally {
+ // if (zip != null) {
+ // try {
+ // zip.close();
+ // } catch (IOException ex) {}
+ // }
+ // }
+ // return zip != null;
+ // }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java
new file mode 100644
index 0000000..a073e65
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingException.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.operations;
+
+
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.xml.sax.SAXException;
+
+
+/**
+ * The WebToolingException class is the generic class for exceptions generated by the web tooling.
+ */
+public class WebToolingException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5721765673799055122L;
+ public static final String SAX_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_SA_ERROR_; // = "Operation failed due to SAX error: "
+ public static final String IO_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_IO_ERROR_; // = "Operation failed due to IO error: "
+ public static final String CORE_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_Co_ERROR_; // = "Operation failed due to Core error: "
+ public static final String JAVA_MODEL_ERROR_MESSAGE = ProjectSupportResourceHandler.Operation_failed_due_to_Ja_ERROR_; // = "Operation failed due to Java Model error: "
+
+ /**
+ * Create a new WebToolingException with no message.
+ */
+ public WebToolingException() {
+ super();
+ }
+
+ /**
+ * Create a new instance of the receiver for a supplied IO Exception
+ *
+ * @param message
+ * java.lang.String
+ */
+ public WebToolingException(IOException exception) {
+ this(IO_ERROR_MESSAGE, exception);
+ }
+
+ /**
+ * Create a new WebToolingException with error message of s.
+ *
+ * @param s
+ * java.lang.String
+ */
+ public WebToolingException(String s) {
+ super(s);
+ }
+
+ /**
+ * Create a new instance of the receiver with the supplied preamble and the message of the
+ * example appended to the end.
+ *
+ * @param message
+ * java.lang.String
+ */
+ public WebToolingException(String preamble, Throwable exception) {
+ this(preamble + exception.getMessage());
+ }
+
+ /**
+ * Create a new instance of the receiver for a supplied CoreException
+ *
+ * @param exception
+ * CoreException
+ */
+ public WebToolingException(CoreException exception) {
+ this(CORE_ERROR_MESSAGE, exception);
+ }
+
+ /**
+ * Create a new instance of the receiver for a supplied JavaModelException.
+ *
+ * @param exception
+ * JavaModelException
+ */
+ public WebToolingException(JavaModelException exception) {
+ this(JAVA_MODEL_ERROR_MESSAGE, exception);
+ }
+
+ /**
+ * Create a new instance of the receiver for a supplied SAX Exception
+ *
+ * @param exception
+ * SAXException
+ */
+ public WebToolingException(SAXException exception) {
+ this(SAX_ERROR_MESSAGE, exception);
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java
new file mode 100644
index 0000000..7c9f607
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebToolingTemplate.java
@@ -0,0 +1,19 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 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.jst.j2ee.internal.web.operations;
+
+public interface WebToolingTemplate {
+ /**
+ * Insert the method's description here. Creation date: (12/6/2000 7:35:38 PM)
+ *
+ * @param data
+ * TemplateData
+ */
+ public String generate(TemplateData data);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java
new file mode 100644
index 0000000..eeba7ab
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebArtifactEditUtilities.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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 Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.internal.web.util;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.j2ee.webapplication.Servlet;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+public class WebArtifactEditUtilities {
+
+ public static IVirtualComponent getWebComponent(Servlet servlet) {
+ IProject project = ProjectUtilities.getProject(servlet);
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ WebArtifactEdit edit = null;
+ try {
+ if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ edit = WebArtifactEdit.getWebArtifactEditForRead(component);
+ WebApp webapp = edit.getWebApp();
+ if (webapp.getServletNamed(servlet.getServletName()) != null)
+ return component;
+ }
+ } finally {
+ if (edit != null)
+ edit.dispose();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java
new file mode 100644
index 0000000..1effdae
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/util/WebEditAdapterFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.internal.web.util;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
+
+
+/**
+ * <p>
+ * Adapts {@see org.eclipse.wst.common.modulecore.ArtifactEditModel}s to
+ * {@see org.eclipse.jst.j2ee.internal.web.util.WebArtifactEdit} facades.
+ * </p>
+ */
+public class WebEditAdapterFactory implements IAdapterFactory {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adapterType == WebArtifactEdit.ADAPTER_TYPE || adapterType == ArtifactEdit.ADAPTER_TYPE) {
+ ArtifactEditModel editModel = (ArtifactEditModel) adaptableObject;
+ if (JavaEEProjectUtilities.isDynamicWebProject(editModel.getProject()))
+ return new WebArtifactEdit((ArtifactEditModel) adaptableObject);
+ }
+ return null;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[]{ArtifactEdit.class, WebArtifactEdit.class};
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java
new file mode 100644
index 0000000..a995ed9
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/WebArtifactEdit.java
@@ -0,0 +1,710 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.web.componentcore.util;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions;
+import org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit;
+import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.XMLResource;
+import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentLoadStrategyImpl;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.WebUtilities;
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+import org.eclipse.jst.j2ee.webapplication.WebAppResource;
+import org.eclipse.jst.j2ee.webapplication.WebapplicationFactory;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFile;
+import org.eclipse.jst.j2ee.webapplication.WelcomeFileList;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.UnresolveableURIException;
+import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
+import org.eclipse.wst.common.componentcore.internal.BinaryComponentHelper;
+import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
+import org.eclipse.wst.common.componentcore.internal.util.IArtifactEditFactory;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+
+
+
+/**
+ * <p>
+ * WebArtifactEdit obtains a Web Deployment Descriptor metamodel specifec data from a
+ * {@see org.eclipse.jst.j2ee.webapplication.WebAppResource} which stores the metamodel. The
+ * {@see org.eclipse.jst.j2ee.webapplication.WebAppResource} is retrieved from the
+ * {@see org.eclipse.wst.common.modulecore.ArtifactEditModel} using a constant {@see
+ * J2EEConstants#WEBAPP_DD_URI_OBJ}. The defined methods extract data or manipulate the contents of
+ * the underlying resource.
+ * </p>
+ *
+ */
+public class WebArtifactEdit extends EnterpriseArtifactEdit implements IArtifactEditFactory {
+
+ private static final String WEB_CONTENT_TYPE = "org.eclipse.jst.j2ee.webDD"; //$NON-NLS-1$
+ /**
+ * <p>
+ * Identifier used to link WebArtifactEdit to a WebEditAdapterFactory {@see
+ * WebEditAdapterFactory} stored in an AdapterManger (@see AdapterManager)
+ * </p>
+ */
+ public static final Class ADAPTER_TYPE = WebArtifactEdit.class;
+ public static final String WEB_CONTENT = "WebContent"; //$NON-NLS-1$
+ public static final String WEB_INF = "WEB-INF"; //$NON-NLS-1$
+ public static final String META_INF = "META-INF"; //$NON-NLS-1$
+
+ public static IPath WEBLIB = new Path("/WEB-INF/lib"); //$NON-NLS-1$
+
+ /**
+ *
+ */
+ public WebArtifactEdit() {
+ super();
+ }
+
+ public WebArtifactEdit(IVirtualComponent aModule) {
+ super(aModule);
+ }
+
+ @Override
+ protected BinaryComponentHelper initBinaryComponentHelper(IVirtualComponent binaryModule) {
+ return new JavaEEBinaryComponentHelper(binaryModule);
+ }
+
+ /**
+ * @param aHandle
+ * @param toAccessAsReadOnly
+ * @throws IllegalArgumentException
+ */
+ public WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly) throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly);
+ }
+
+ /**
+ * @param aHandle
+ * @param toAccessAsReadOnly
+ * @throws IllegalArgumentException
+ */
+ public WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate) throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly, forCreate, J2EEProjectUtilities.DYNAMIC_WEB);
+ }
+
+ /**
+ * @param aHandle
+ * @param toAccessAsReadOnly
+ * @throws IllegalArgumentException
+ */
+ protected WebArtifactEdit(IProject aProject, boolean toAccessAsReadOnly, boolean forCreate, String editModelID) throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly, forCreate, editModelID);
+ }
+
+ /**
+ * <p>
+ * Returns an instance facade to manage the underlying edit model for the given
+ * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
+ * must be {@see #dispose()}ed of when no longer in use.
+ * </p>
+ * <p>
+ * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent} that
+ * will not be used for editing. Invocations of any save*() API on an instance returned from
+ * this method will throw exceptions.
+ * </p>
+ * <p>
+ * <b>The following method may return null. </b>
+ * </p>
+ *
+ * @param aModule
+ * A valid {@see WorkbenchComponent} with a handle that resolves to an
+ * accessible project in the workspace
+ * @return An instance of ArtifactEdit that may only be used to read the underlying content
+ * model
+ */
+ public static WebArtifactEdit getWebArtifactEditForRead(IProject aProject) {
+ WebArtifactEdit artifactEdit = null;
+ try {
+ if (isValidWebModule(ComponentCore.createComponent(aProject)))
+ artifactEdit = new WebArtifactEdit(aProject, true, false);
+ } catch (Exception e) {
+ artifactEdit = null;
+ }
+ return artifactEdit;
+ }
+
+ /**
+ * <p>
+ * Returns an instance facade to manage the underlying edit model for the given
+ * {@see WorkbenchComponent}. Instances of ArtifactEdit that are returned through this method
+ * must be {@see #dispose()}ed of when no longer in use.
+ * </p>
+ * <p>
+ * Use to acquire an ArtifactEdit facade for a specific {@see WorkbenchComponent} that
+ * will be used for editing.
+ * </p>
+ * <p>
+ * <b>The following method may return null. </b>
+ * </p>
+ *
+ * @param aModule
+ * A valid {@see WorkbenchComponent} with a handle that resolves to an
+ * accessible project in the workspace
+ * @return An instance of ArtifactEdit that may be used to modify and persist changes to the
+ * underlying content model
+ */
+ public static WebArtifactEdit getWebArtifactEditForWrite(IProject aProject) {
+ WebArtifactEdit artifactEdit = null;
+ try {
+ if (isValidWebModule(ComponentCore.createComponent(aProject)))
+ artifactEdit = new WebArtifactEdit(aProject, false, false);
+ } catch (Exception e) {
+ artifactEdit = null;
+ }
+ return artifactEdit;
+ }
+
+ /**
+ * <p>
+ * Returns an instance facade to manage the underlying edit model for the given
+ * {@see WorkbenchComponent}. Instances of WebArtifactEdit that are returned through this
+ * method must be {@see #dispose()}ed of when no longer in use.
+ * </p>
+ * <p>
+ * Use to acquire an WebArtifactEdit facade for a specific {@see WorkbenchComponent} that
+ * will not be used for editing. Invocations of any save*() API on an instance returned from
+ * this method will throw exceptions.
+ * </p>
+ * <p>
+ * <b>This method may return null. </b>
+ * </p>
+ *
+ * <p>
+ * Note: This method is for internal use only. Clients should not call this method.
+ * </p>
+ *
+ * @param aModule
+ * A valid {@see WorkbenchComponent} with a handle that resolves to an
+ * accessible project in the workspace
+ * @return An instance of WebArtifactEdit that may only be used to read the underlying content
+ * model
+ * @throws UnresolveableURIException
+ * could not resolve uri.
+ */
+ public static WebArtifactEdit getWebArtifactEditForRead(IVirtualComponent aModule) {
+ if (aModule == null)
+ return null;
+ if (aModule.isBinary()) {
+ return new WebArtifactEdit(aModule);
+ }
+
+ return getWebArtifactEditForRead(aModule.getProject());
+ }
+
+
+ /**
+ * <p>
+ * Returns an instance facade to manage the underlying edit model for the given
+ * {@see WorkbenchComponent}. Instances of WebArtifactEdit that are returned through this
+ * method must be {@see #dispose()}ed of when no longer in use.
+ * </p>
+ * <p>
+ * Use to acquire an WebArtifactEdit facade for a specific {@see WorkbenchComponent} that
+ * will be used for editing.
+ * </p>
+ * <p>
+ * <b>This method may return null. </b>
+ * </p>
+ *
+ * <p>
+ * Note: This method is for internal use only. Clients should not call this method.
+ * </p>
+ *
+ * @param aModule
+ * A valid {@see WorkbenchComponent} with a handle that resolves to an
+ * accessible project in the workspace
+ * @return An instance of WebArtifactEdit that may be used to modify and persist changes to the
+ * underlying content model
+ */
+ public static WebArtifactEdit getWebArtifactEditForWrite(IVirtualComponent aModule) {
+ if (aModule == null || aModule.isBinary())
+ return null;
+ return getWebArtifactEditForWrite(aModule.getProject());
+ }
+
+ /**
+ * @param module
+ * A {@see WorkbenchComponent}
+ * @return True if the supplied module
+ * {@see ArtifactEdit#isValidEditableModule(WorkbenchComponent)}and the moduleTypeId is
+ * a JST module
+ */
+ public static boolean isValidWebModule(IVirtualComponent aModule) throws UnresolveableURIException {
+ if (!isValidEditableModule(aModule))
+ return false;
+ return JavaEEProjectUtilities.isDynamicWebProject(aModule.getProject());
+ }
+
+ /**
+ * <p>
+ * Creates an instance facade for the given {@see ArtifactEditModel}.
+ * </p>
+ *
+ * @param anArtifactEditModel
+ */
+ public WebArtifactEdit(ArtifactEditModel model) {
+ super(model);
+
+ }
+
+ /**
+ * <p>
+ * Creates an instance facade for the given {@see ArtifactEditModel}
+ * </p>
+ *
+ * <p>
+ * Note: This method is for internal use only. Clients should not call this method.
+ * </p>
+ *
+ * @param aNature
+ * A non-null {@see ModuleCoreNature}for an accessible project
+ * @param aModule
+ * A non-null {@see WorkbenchComponent}pointing to a module from the given
+ * {@see ModuleCoreNature}
+ */
+ protected WebArtifactEdit(ModuleCoreNature aNature, IVirtualComponent aModule, boolean toAccessAsReadOnly) {
+ super(aNature, aModule, toAccessAsReadOnly);
+ }
+
+
+
+ /**
+ * <p>
+ * Retrieves J2EE version information from WebAppResource.
+ * </p>
+ *
+ * @return an integer representation of a J2EE Spec version
+ *
+ */
+ @Override
+ public int getJ2EEVersion() {
+ verifyOperationSupported();
+ return ((WebAppResource) getDeploymentDescriptorResource()).getJ2EEVersionID();
+ }
+
+ /**
+ * <p>
+ * Obtains the WebApp (@see WebApp) root object from the WebAppResource. If the root object does
+ * not exist, then one is created (@link addWebAppIfNecessary(getWebApplicationXmiResource())).
+ * The root object contains all other resource defined objects.
+ * </p>
+ *
+ * @return EObject
+ *
+ */
+ @Override
+ public EObject getDeploymentDescriptorRoot() {
+ verifyOperationSupported();
+ List contents = getDeploymentDescriptorResource().getContents();
+ if (contents.size() > 0)
+ return (EObject) contents.get(0);
+ if (isBinary()) {
+ return null;
+ }
+ addWebAppIfNecessary((WebAppResource) getDeploymentDescriptorResource());
+ return (EObject) contents.get(0);
+ }
+
+ /**
+ * <p>
+ * Retrieves the underlying resource from the ArtifactEditModel using defined URI.
+ * </p>
+ *
+ * @return Resource
+ *
+ */
+ @Override
+ public Resource getDeploymentDescriptorResource() {
+ verifyOperationSupported();
+ if (isBinary()) {
+ return getBinaryComponentHelper().getResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
+ }
+ return getArtifactEditModel().getResource(J2EEConstants.WEBAPP_DD_URI_OBJ);
+ }
+
+ /**
+ * <p>
+ * Retrieves Servlet version information derived from the {@see WebAppResource}.
+ * </p>
+ *
+ * @return an integer representation of a module version
+ *
+ */
+ public int getServletVersion() {
+ verifyOperationSupported();
+ return ((WebAppResource) getDeploymentDescriptorResource()).getModuleVersionID();
+ }
+
+ /**
+ * This method returns the integer representation for the JSP specification level associated
+ * with the J2EE version for this workbench module. This method will not return null and returns
+ * 20 as default.
+ *
+ * @see WebArtifactEdit#getServletVersion()
+ *
+ * @return an integer representation of the JSP level
+ */
+ public int getJSPVersion() {
+ verifyOperationSupported();
+ int servletVersion = getServletVersion();
+ if (servletVersion == J2EEVersionConstants.WEB_2_2_ID)
+ return J2EEVersionConstants.JSP_1_1_ID;
+ else if (servletVersion == J2EEVersionConstants.WEB_2_3_ID)
+ return J2EEVersionConstants.JSP_1_2_ID;
+ else
+ return J2EEVersionConstants.JSP_2_0_ID;
+ }
+
+ /**
+ * <p>
+ * Creates a deployment descriptor root object (WebApp) and populates with data. Adds the root
+ * object to the deployment descriptor resource.
+ * </p>
+ *
+ * <p>
+ *
+ * @param aModule
+ * A non-null pointing to a {@see XMLResource}
+ * @param version
+ * Version to be set on resource....if null default is taken
+ *
+ * Note: This method is typically used for JUNIT - move?
+ * </p>
+ */
+ protected void addWebAppIfNecessary(XMLResource aResource) {
+ verifyOperationSupported();
+ if (isBinary()) {
+ throwAttemptedBinaryEditModelAccess();
+ }
+ if (aResource != null) {
+ if (aResource.getContents() == null || aResource.getContents().isEmpty()) {
+ WebApp webAppNew = WebapplicationFactory.eINSTANCE.createWebApp();
+ aResource.getContents().add(webAppNew);
+ aResource.setModified(true);
+ }
+ WebApp webApp = (WebApp) aResource.getContents().get(0);
+ URI moduleURI = getArtifactEditModel().getModuleURI();
+ try {
+ webApp.setDisplayName(StructureEdit.getDeployedName(moduleURI));
+ } catch (UnresolveableURIException e) {
+ // Ignore
+ }
+ aResource.setID(webApp, J2EEConstants.WEBAPP_ID);
+
+ WelcomeFileList wList = WebapplicationFactory.eINSTANCE.createWelcomeFileList();
+ List files = wList.getFile();
+ WelcomeFile file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("index.html"); //$NON-NLS-1$
+ files.add(file);
+ file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("index.htm"); //$NON-NLS-1$
+ files.add(file);
+ file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("index.jsp"); //$NON-NLS-1$
+ files.add(file);
+ file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("default.html"); //$NON-NLS-1$
+ files.add(file);
+ file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("default.htm"); //$NON-NLS-1$
+ files.add(file);
+ file = WebapplicationFactory.eINSTANCE.createWelcomeFile();
+ file.setWelcomeFile("default.jsp"); //$NON-NLS-1$
+ files.add(file);
+
+ webApp.setFileList(wList);
+
+ try {
+ aResource.saveIfNecessary();
+ } catch (java.net.ConnectException ex) {
+
+ } catch (Exception e) {
+ WebPlugin.logError(e);
+ }
+ }
+ }
+
+
+ /**
+ * This method returns the full path to the deployment descriptor resource for the associated
+ * workbench module. This method may return null.
+ *
+ * @see WebArtifactEdit#getDeploymentDescriptorResource()
+ *
+ * @return the full IPath for the deployment descriptor resource
+ */
+ public IPath getDeploymentDescriptorPath() {
+ verifyOperationSupported();
+ IFile file = WorkbenchResourceHelper.getFile(getDeploymentDescriptorResource());
+ if (file != null)
+ return file.getFullPath();
+ return null;
+ }
+
+ /**
+ * This method will retrieve the web app resource, create it if necessary, add get the root
+ * object, the web app out of that web app resource. It will create the web app instance if need
+ * be, and add it to the web resource. Then, it returns the web app object as the model root.
+ * This method will not return null.
+ *
+ * @see EnterpriseArtifactEdit#createModelRoot()
+ *
+ * @return the eObject instance of the model root
+ */
+ @Override
+ public EObject createModelRoot() {
+ verifyOperationSupported();
+ if (isBinary()) {
+ throwAttemptedBinaryEditModelAccess();
+ }
+ return createModelRoot(getJ2EEVersion());
+ }
+
+ /**
+ * This method will retrieve the web app resource, create it if necessary, add get the root
+ * object, set version the web app out of that web app resource. It will create the web app
+ * instance if need be, and add it to the web resource. Then, it returns the web app object as
+ * the model root. This method will not return null.
+ *
+ * @see EnterpriseArtifactEdit#createModelRoot()
+ *
+ * @return the eObject instance of the model root
+ */
+ @Override
+ public EObject createModelRoot(int version) {
+ verifyOperationSupported();
+ if (isBinary()) {
+ throwAttemptedBinaryEditModelAccess();
+ }
+ WebAppResource res = (WebAppResource) getDeploymentDescriptorResource();
+ res.setModuleVersionID(version);
+ addWebAppIfNecessary(res);
+ return res.getRootObject();
+ }
+
+ /**
+ * @deprecated
+ * use {@link WebUtilities}{@link #getLibModules()}
+ */
+ public IVirtualReference[] getLibModules() {
+ return WebUtilities.getLibModules(getProject());
+ }
+
+ /**
+ * This method will add the dependent modules from the passed in array to the dependentmodules
+ * list of the associated workbench module. It will ensure a null is not passed and it will
+ * ensure the dependent modules are not already in the list.
+ *
+ * <p>
+ * Note: This method is for internal use only. Clients should not call this method.
+ * </p>
+ *
+ * @param libModules
+ * array of dependent modules to add as web libraries
+ */
+ public void addLibModules(ReferencedComponent[] libModules) {
+ // TODO - Need to implement
+ // if (libModules==null)
+ // return;
+ // for (int i=0; i<libModules.length; i++) {
+ // if (!module.getReferencedComponents().contains(libModules[i]))
+ // module.getReferencedComponents().add(libModules[i]);
+ // }
+ }
+
+ /**
+ * This method will retrieve the context root for this web project's .component file. It is
+ * meant to handle a standalone web case.
+ *
+ * @return contextRoot String
+ */
+ public String getServerContextRoot() {
+ return J2EEProjectUtilities.getServerContextRoot(getProject());
+ }
+
+ /**
+ * This method will retrieve the context root for this web project in the associated parameter's
+ * application.xml. If the earProject is null, then the contextRoot from the .component of the
+ * web project is returned.
+ *
+ * @param earProject
+ * @return contextRoot String
+ */
+ public String getServerContextRoot(IProject earProject) {
+ if (earProject == null || !JavaEEProjectUtilities.isEARProject(earProject))
+ return getServerContextRoot();
+ EARArtifactEdit earEdit = null;
+ String contextRoot = null;
+ try {
+ earEdit = EARArtifactEdit.getEARArtifactEditForRead(earProject);
+ if (earEdit != null)
+ contextRoot = earEdit.getWebContextRoot(getProject());
+ } finally {
+ if (earEdit != null)
+ earEdit.dispose();
+ }
+ return contextRoot;
+ }
+
+ /**
+ * This method will update the context root for this web project on the EAR which is passed in.
+ * If no EAR is passed the .component file for the web project will be updated.
+ *
+ * @param earProject
+ * @param aContextRoot
+ */
+ public void setServerContextRoot(IProject earProject, String aContextRoot) {
+ if (earProject == null || !JavaEEProjectUtilities.isEARProject(earProject))
+ setServerContextRoot(aContextRoot);
+ EARArtifactEdit earEdit = null;
+ try {
+ earEdit = EARArtifactEdit.getEARArtifactEditForWrite(earProject);
+ if (earEdit != null)
+ earEdit.setWebContextRoot(getProject(), aContextRoot);
+ } finally {
+ if (earEdit != null) {
+ earEdit.saveIfNecessary(new NullProgressMonitor());
+ earEdit.dispose();
+ }
+ }
+ }
+
+ /**
+ * This method sets the context root property on the web project's .component file for the
+ * standalone case.
+ *
+ * @param contextRoot
+ * string
+ */
+ public void setServerContextRoot(String contextRoot) {
+ J2EEProjectUtilities.setServerContextRoot(getProject(), contextRoot);
+ }
+
+
+ /**
+ * @return WebApp
+ */
+ public WebApp getWebApp() {
+ verifyOperationSupported();
+
+ return (WebApp) getDeploymentDescriptorRoot();
+ }
+
+
+ public ArtifactEdit createArtifactEditForRead(IVirtualComponent aComponent) {
+ return getWebArtifactEditForRead(aComponent);
+ }
+
+
+ public ArtifactEdit createArtifactEditForWrite(IVirtualComponent aComponent) {
+ return getWebArtifactEditForWrite(aComponent);
+ }
+
+ @Override
+ public Archive asArchive(boolean includeSource, boolean includeClasspathComponents) throws OpenFailureException {
+ return asArchive(includeSource, includeClasspathComponents, false);
+ }
+ public Archive asArchive(boolean includeSource, boolean includeClasspathComponents, boolean readOnly) throws OpenFailureException {
+ verifyOperationSupported();
+ if (isBinary()) {
+ JavaEEBinaryComponentHelper helper = (JavaEEBinaryComponentHelper)getBinaryComponentHelper();
+ return helper.accessLegacyArchive();
+ }
+ WebComponentLoadStrategyImpl loader = new WebComponentLoadStrategyImpl(getComponent(), includeClasspathComponents);
+ loader.setExportSource(includeSource);
+ loader.setReadOnly(readOnly);
+ String uri = ModuleURIUtil.getHandleString(getComponent());
+ ArchiveOptions options = new ArchiveOptions();
+ options.setLoadStrategy(loader);
+ options.setIsReadOnly(readOnly);
+ return CommonarchiveFactory.eINSTANCE.openWARFile(options, uri);
+ }
+
+ public static void createDeploymentDescriptor(IProject project, int version) {
+ WebArtifactEdit webEdit = new WebArtifactEdit(project, false, true);
+ try {
+ webEdit.createModelRoot(version);
+ webEdit.save(null);
+ } finally { // Make sure new resource is removed - the uri used for creation shouldn't be cached
+ Resource newRes = webEdit.getDeploymentDescriptorResource();
+ WorkbenchResourceHelperBase.getResourceSet(project).getResources().remove(newRes);
+ newRes.unload();
+ webEdit.dispose();
+ }
+ }
+ @Override
+ public IModelProvider create(IProject project) {
+ return getWebArtifactEditForRead(project);
+ }
+
+ @Override
+ public IModelProvider create(IVirtualComponent component) {
+ return getWebArtifactEditForRead(component);
+ }
+
+ @Override
+ public void modify(Runnable runnable, IPath modelPath) {
+ setWritableEdit(getWebArtifactEditForWrite(getProject()));
+ try{
+ runnable.run();
+ if( getWritableEdit() != null ){
+ // Always save regardless of resource path passed - Artifactedits save resources as a unit
+ getWritableEdit().saveIfNecessary( new NullProgressMonitor() );
+ }
+
+ }finally{
+ if (getWritableEdit() != null)
+ getWritableEdit().dispose();
+ setWritableEdit(null);
+ }
+ }
+
+
+ @Override
+ protected String getContentTypeDescriber() {
+ return WEB_CONTENT_TYPE;
+ }
+ @Override
+ protected URI getRootURI() {
+ return J2EEConstants.WEBAPP_DD_URI_OBJ;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml
new file mode 100644
index 0000000..6a17c4e
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/componentcore/util/package.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html>
+ <head>
+ <meta
+ name="root"
+ content="../../../../../../../" />
+ <title>WebArtifactEdit api overview</title>
+ </head>
+
+ <body>
+ <abstract>
+ This package includes the WebArtifactEdit api. This api is used to work with the emf model
+ of a flexible web module. It contains api to read and serialize out the emf model for web applications.
+ </abstract>
+
+ <a href="#top">top</a>
+ </body>
+</html>
+
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IConvertStaticWebToDyamnicDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IConvertStaticWebToDyamnicDataModelProperties.java
new file mode 100644
index 0000000..ccfad90
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IConvertStaticWebToDyamnicDataModelProperties.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.web.datamodel.properties;
+
+import org.eclipse.jst.j2ee.internal.web.operations.ConvertStaticWebToDyamnicDataModelProvider;
+
+public interface IConvertStaticWebToDyamnicDataModelProperties {
+
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = ConvertStaticWebToDyamnicDataModelProvider.class;
+
+ public static final String PROJECT = "IConvertStaticWebToDyamnicProperties.PROJECT"; //$NON-NLS-1$
+ public static final String CONVERT_TO_WEB_VERSION = "IConvertStaticWebToDyamnicProperties.CONVERT_TO_WEB_VERSION"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java
new file mode 100644
index 0000000..129150d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentExportDataModelProperties.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.web.datamodel.properties;
+
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
+/**
+ * <p>
+ * IWebComponentExportDataModelProperties provides properties to the IDataModel associated with the
+ * WebComponentExportDataModelProvider.
+ * NOTE: The associated Provider and Operations will be created during M5
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
+ *
+ * @plannedfor 1.0
+ */
+public interface IWebComponentExportDataModelProperties extends IJ2EEComponentExportDataModelProperties {
+ /**
+ * Required, type Boolean flag which indicates whether or not to export compiled JSP files
+ * (compiled files exist in /WEB-INF/classes as .class and .java[for debug])
+ */
+ public static final String EXCLUDE_COMPILE_JSP = "WebExportDataModel.EXCLUDE_COMPILE_JSP"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java
new file mode 100644
index 0000000..7a8697f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/IWebComponentImportDataModelProperties.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.web.datamodel.properties;
+
+import java.util.List;
+
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * <p>
+ * IWebComponentImportDataModelProperties provides properties to the IDataModel associated with the
+ * WebComponentImportDataModelProvider. NOTE: The associated Provider and Operations will be created
+ * during M5
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider
+ * @see org.eclipse.wst.common.frameworks.datamodel.DataModelFactory
+ * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties
+ *
+ * @plannedfor 1.0
+ */
+public interface IWebComponentImportDataModelProperties extends IJ2EEModuleImportDataModelProperties {
+
+ /**
+ * <p>
+ * This optional {@link List} property is used to specify which nested web libraries should be
+ * expanded into projects during import. The contents of this {@link List} property should be
+ * {@link Archive}s.
+ * </p>
+ */
+ public static final String WEB_LIB_ARCHIVES_SELECTED = "WARImportDataModel.WEB_LIB_ARCHIVES_SELECTED"; //$NON-NLS-1$
+
+ /**
+ * <p>
+ * This {@link List} property should not be set by clients. This list contains the
+ * {@link IDataModel}s for creating the new components to be created for each of the selected
+ * archives. This list will contain one entry for each web lib archive regardless of whether it
+ * is selected for import by the {@link #WEB_LIB_ARCHIVES_SELECTED} property.
+ * </p>
+ */
+ public static final String WEB_LIB_MODELS = "WARImportDataModel.WEB_LIB_MODELS"; //$NON-NLS-1$
+
+ public static final String CONTEXT_ROOT = "IAddWebComponentToEnterpriseApplicationDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml
new file mode 100644
index 0000000..bc7e674
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/datamodel/properties/package.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html>
+ <head>
+ <meta
+ name="root"
+ content="../../../../../../../" />
+ <title>web module data model api overview</title>
+ </head>
+
+ <body>
+ <abstract>
+ This package includes the api to create, import and export web modules. The interfaces in this package
+ define the properties that can be set on the web modules data models that are use to run the data model operations and drive the wizard data, validation.
+ </abstract>
+
+ <a href="#top">top</a>
+ </body>
+</html>
+
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
new file mode 100644
index 0000000..eb30aaf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+
+public interface IWebFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
+
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = WebFacetProjectCreationDataModelProvider.class;
+
+ public static final String CONTEXT_ROOT = "IWebFacetInstallDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
+
+ public static final String SOURCE_FOLDER = "IWebFacetInstallDataModelProperties.SOURCE_FOLDER"; //$NON-NLS-1$
+
+ public static final String INSTALL_WEB_LIBRARY = "IWebFacetInstallDataModelProperties.INSTALL_WEB_LIBRARY"; //$NON-NLS-1$
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentFacetInstallDataModelProperties.java
new file mode 100644
index 0000000..c40eb88
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentFacetInstallDataModelProperties.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+
+public interface IWebFragmentFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = WebFragmentFacetInstallDataModelProvider.class;
+
+ public static final String CONTENT_DIR = "IWebFragmentFacetInstallDataModelProperties.CONTENT_DIR"; //$NON-NLS-1$
+
+ public static final String ADD_TO_WAR = "IWebFragmentFacetInstallDataModelProperties.ADD_TO_WAR"; //$NON-NLS-1$
+ public static final String WAR_PROJECT_NAME = "IWebFragmentFacetInstallDataModelProperties.WAR_PROJECT_NAME"; //$NON-NLS-1$
+ public static final String LAST_WAR_NAME = "IWebFragmentFacetInstallDataModelProperties.LAST_WAR_NAME"; //$NON-NLS-1$
+
+ }
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentProjectCreationDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentProjectCreationDataModelProperties.java
new file mode 100644
index 0000000..cfc2dc7
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFragmentProjectCreationDataModelProperties.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+
+public interface IWebFragmentProjectCreationDataModelProperties
+ extends IFacetProjectCreationDataModelProperties{
+
+ public static final String ADD_TO_WAR = "IWebFragmentProjectCreationDataModelProperties.ADD_TO_WAR"; //$NON-NLS-1$
+ public static final String WAR_PROJECT_NAME = "IWebFragmentProjectCreationDataModelProperties.WAR_PROJECT_NAME"; //$NON-NLS-1$
+
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
new file mode 100644
index 0000000..b696c7b
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig.ChangeEvent;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainerUtils;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
+import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.project.facet.ProductManager;
+
+import com.ibm.icu.text.UTF16;
+import com.ibm.icu.util.StringTokenizer;
+
+public class WebFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IWebFacetInstallDataModelProperties {
+
+ @Override
+ protected void handleJavaFacetSourceFoldersChanged( final ChangeEvent event )
+ {
+ final List<IPath> sourceFolders = event.getJavaFacetInstallConfig().getSourceFolders();
+ final String sourceFolder = ( sourceFolders.isEmpty() ? null : sourceFolders.get( 0 ).toPortableString() );
+ getDataModel().setProperty( SOURCE_FOLDER, sourceFolder );
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ Set names = super.getPropertyNames();
+ names.add(CONTEXT_ROOT);
+ names.add(SOURCE_FOLDER);
+ names.add(INSTALL_WEB_LIBRARY);
+ return names;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(CONFIG_FOLDER)) {
+ if (model.isPropertySet(FACET_PROJECT_NAME))
+ {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME);
+ IProject project = (projectName.length() > 0) ? ResourcesPlugin.getWorkspace().getRoot().getProject(projectName) : null;
+
+ if (project != null && project.exists()) {
+ if (ModuleCoreNature.isFlexibleProject(project))
+ {
+ IVirtualComponent c = ComponentCore.createComponent(project, true);
+ IVirtualFolder ejbroot = c.getRootFolder();
+ IPath configFolderPath = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(ejbroot);
+ if (configFolderPath != null && project.getFolder(configFolderPath).exists())
+ {
+ return configFolderPath.toString();
+ }
+ }
+ }
+ }
+ return J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.WEB_CONTENT_FOLDER);
+ } else if (propertyName.equals(SOURCE_FOLDER)) {
+ return J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.DYN_WEB_SRC_FOLDER);
+ } else if (propertyName.equals(CONTEXT_ROOT)) {
+ return getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
+ } else if (propertyName.equals(FACET_ID)) {
+ return DYNAMIC_WEB;
+ } else if (propertyName.equals(MODULE_URI)) {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
+ return projectName + IJ2EEModuleConstants.WAR_EXT;
+ } else if (propertyName.equals(GENERATE_DD)) {
+ String facetVersion = getStringProperty(FACET_VERSION_STR);
+ if(J2EEVersionConstants.VERSION_2_5_TEXT.equals(facetVersion)) {
+ return Boolean.valueOf(J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.DYNAMIC_WEB_GENERATE_DD));
+ }
+ else if(J2EEVersionConstants.VERSION_3_0_TEXT.equals(facetVersion)) {
+ return Boolean.valueOf(J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.EE6_DYNAMIC_WEB_GENERATE_DD));
+ }
+
+ return Boolean.TRUE;
+ }else if (propertyName.equals(INSTALL_WEB_LIBRARY)){
+ return J2EEComponentClasspathContainerUtils.getDefaultUseWebAppLibraries();
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if (ADD_TO_EAR.equals(propertyName)) {
+ model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.ENABLE_CHG);
+ } else if (FACET_PROJECT_NAME.equals(propertyName)) {
+ model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.VALID_VALUES_CHG);
+ if (!model.isPropertySet(CONFIG_FOLDER)) {
+ model.notifyPropertyChange(CONFIG_FOLDER, IDataModel.DEFAULT_CHG);
+ }
+ } else if (propertyName.equals(CONFIG_FOLDER)) {
+ return true;
+ } else if (propertyName.equals(SOURCE_FOLDER))
+ {
+ if( this.javaFacetInstallConfig != null )
+ {
+ if( propertyValue == null )
+ {
+ this.javaFacetInstallConfig.setSourceFolder( null );
+ }
+ else
+ {
+ final IPath sourceFolder = new Path( (String) propertyValue );
+
+ if( ! this.javaFacetInstallConfig.getSourceFolders().contains( sourceFolder ) )
+ {
+ this.javaFacetInstallConfig.setSourceFolder( sourceFolder );
+ }
+ }
+ }
+ }
+
+ return super.propertySet(propertyName, propertyValue);
+ }
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ return super.isPropertyEnabled(propertyName);
+ }
+
+ @Override
+ protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version) {
+ return J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(version.getVersionString());
+ }
+
+ @Override
+ public IStatus validate(String name) {
+ if (name.equals(CONTEXT_ROOT)) {
+ return validateContextRoot(getStringProperty(CONTEXT_ROOT));
+ } else if (name.equals(SOURCE_FOLDER)) {
+ IStatus status = validateFolderName(getStringProperty(SOURCE_FOLDER));
+ if( status.isOK() ){
+ return validateSourceAndContentFolderUniqueness();
+ }
+ return status;
+ }else if (name.equals( CONFIG_FOLDER )) {
+ IStatus status = super.validate( CONFIG_FOLDER );
+ if( status.isOK() ){
+ status = validateSourceAndContentFolderUniqueness();
+ }
+ if( status.isOK() ){
+ String configFolder = model.getStringProperty(CONFIG_FOLDER);
+ String outFolder = null;
+ if( javaFacetInstallConfig != null ){
+ outFolder = javaFacetInstallConfig.getDefaultOutputFolder().toString();
+ }
+ if( outFolder != null )
+ status = validateWebConfigAndOutputFolder(configFolder, outFolder);
+ }
+ return status;
+ }
+ // the superclass validates the content directory which is actually a "CONFIG_FOLDER"
+ return super.validate(name);
+ }
+
+ protected IStatus validateContextRoot(String contextRoot) {
+ if (contextRoot == null || contextRoot.length() == 0) {
+ return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Context_Root_cannot_be_empty_2, new Object[]{contextRoot}), null);
+ } else if (contextRoot.trim().equals(contextRoot)) {
+ StringTokenizer stok = new StringTokenizer(contextRoot, "."); //$NON-NLS-1$
+ while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ int cp;
+ for (int i = 0; i < token.length(); i += UTF16.getCharCount(cp)) {
+ cp = UTF16.charAt(token, i);
+ if(token.charAt(i) == ' ')
+ {
+ return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Names_cannot_contain_whitespace_, new Object[]{contextRoot}), null);
+ }
+ else if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
+ String invalidCharString = null;
+ if (UTF16.getCharCount(cp)>1)
+ {
+ invalidCharString = UTF16.valueOf(cp);
+ }
+ else
+ {
+ invalidCharString = (new Character(token.charAt(i))).toString();
+ }
+ Object[] invalidChar = new Object[]{invalidCharString};
+ String errorStatus = ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.The_character_is_invalid_in_a_context_root, invalidChar);
+ return J2EEPlugin.newErrorStatus(errorStatus, null);
+ }
+ }
+ }
+ } else
+ return J2EEPlugin.newErrorStatus(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Names_cannot_contain_whitespace_, new Object[]{contextRoot}), null);
+ return OK_STATUS;
+ }
+
+ protected IStatus validateSourceAndContentFolderUniqueness(){
+ String srcFolder = getStringProperty(SOURCE_FOLDER);
+ String contentFolder = getStringProperty( CONFIG_FOLDER );
+ if( srcFolder != null && contentFolder != null){
+ if (srcFolder.equals( contentFolder )){
+ String errorMessage = ProjectSupportResourceHandler.DYNAMIC_WEB_DISTINCT_SRC_WEBCONTENT_ERROR;
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
+ }
+ return OK_STATUS;
+ }
+
+ public static IStatus validateWebConfigAndOutputFolder(String rawConfigFolder, String outFolder){
+ if( ProductManager.shouldUseSingleRootStructure()){
+ String expectedOutFolder = rawConfigFolder+"/"+J2EEConstants.WEB_INF_CLASSES; //$NON-NLS-1$
+ if( !outFolder.equals(expectedOutFolder) ){
+ String message = ProjectSupportResourceHandler.getString( ProjectSupportResourceHandler.DYNAMIC_WEB_PERFORMANCE_VALIDATION,
+ new Object[]{expectedOutFolder});
+ return WTPCommonPlugin.createWarningStatus(message);
+ }
+ }
+ return OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
new file mode 100644
index 0000000..0a57b65
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
@@ -0,0 +1,315 @@
+/******************************************************************************
+ * Copyright (c) 2005, 2011 BEA Systems, Inc. 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:
+ * Konstantin Komissarchik - initial API and implementation
+ * Roberto Sanchez (IBM) - Set default deployment descriptor folder
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jst.common.project.facet.WtpUtils;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
+import org.eclipse.jst.j2ee.internal.web.classpath.WebAppLibrariesContainer;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate;
+import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit;
+import org.eclipse.jst.javaee.core.DisplayName;
+import org.eclipse.jst.javaee.core.JavaeeFactory;
+import org.eclipse.jst.javaee.web.WebApp;
+import org.eclipse.jst.javaee.web.WebFactory;
+import org.eclipse.jst.javaee.web.WelcomeFileList;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public final class WebFacetInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
+
+ public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
+ if (monitor != null) {
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ }
+
+ try {
+ final IDataModel model = (IDataModel) cfg;
+
+ final IJavaProject jproj = JavaCore.create(project);
+
+ // Add WTP natures.
+
+ WtpUtils.addNatures(project);
+
+ // Create the directory structure.
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final IPath pjpath = project.getFullPath();
+
+ final IPath contentdir = setContentPropertyIfNeeded(model, pjpath, project);
+ mkdirs(ws.getRoot().getFolder(contentdir));
+
+ final IPath webinf = contentdir.append("WEB-INF"); //$NON-NLS-1$
+ IFolder webinfFolder = ws.getRoot().getFolder(webinf);
+ mkdirs(webinfFolder);
+
+ final IPath webinflib = webinf.append("lib"); //$NON-NLS-1$
+ mkdirs(ws.getRoot().getFolder(webinflib));
+
+ // Setup the flexible project structure.
+
+ final IVirtualComponent c = ComponentCore.createComponent(project, false);
+
+ c.create(0, null);
+
+ String contextRoot = model.getStringProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT);
+ setContextRootPropertyIfNeeded(c, contextRoot);
+ setOutputFolder(model, c);
+
+ final IVirtualFolder webroot = c.getRootFolder();
+ if (webroot.getProjectRelativePath().equals(new Path("/"))){ //$NON-NLS-1$
+ Path configFolderPath = new Path(model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER));
+ webroot.createLink(configFolderPath, 0, null);
+ J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(webroot, configFolderPath, null);
+ }
+
+ if( fv == WebFacetUtils.WEB_30 )
+ {
+ if(model.getBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)){
+ createWeb30DeploymentDescriptor(project, fv, webinfFolder, monitor);
+ }
+ }
+ else if( fv == WebFacetUtils.WEB_25 )
+ {
+ if(model.getBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)){
+ createWeb25DeploymentDescriptor(project, fv, webinfFolder, monitor);
+ }
+ }
+ else
+ {
+ // Create the deployment descriptor (web.xml) if one doesn't exist
+ if (!webinfFolder.getFile("web.xml").exists()) { //$NON-NLS-1$
+ String ver = fv.getVersionString();
+ int nVer = J2EEVersionUtil.convertVersionStringToInt(ver);
+ WebArtifactEdit.createDeploymentDescriptor(project, nVer);
+ }
+ }
+
+ // Set entries for src folders
+ final IVirtualFolder jsrc = c.getRootFolder().getFolder("/WEB-INF/classes"); //$NON-NLS-1$
+ final IClasspathEntry[] cp = jproj.getRawClasspath();
+ for (int i = 0; i < cp.length; i++) {
+ final IClasspathEntry cpe = cp[i];
+ if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ if( cpe.getPath().removeFirstSegments(1).segmentCount() > 0 ){
+ try{
+ IFolder srcFolder = ws.getRoot().getFolder(cpe.getPath());
+
+ IVirtualResource[] virtualResource = ComponentCore.createResources(srcFolder);
+ //create link for source folder only when it is not mapped
+ if( virtualResource.length == 0 ){
+ jsrc.createLink(cpe.getPath().removeFirstSegments(1), 0, null);
+ }
+ }
+ catch(Exception e){
+ WebPlugin.logError(e);
+ }
+ }
+ }
+ }
+
+ IVirtualFile vf = c.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI));
+ IFile manifestmf = vf.getUnderlyingFile();
+ if (manifestmf == null || !manifestmf.exists()) {
+ try {
+ createManifest(project, c.getRootFolder().getUnderlyingFolder(), monitor);
+ } catch (InvocationTargetException e) {
+ WebPlugin.logError(e);
+ } catch (InterruptedException e) {
+ WebPlugin.logError(e);
+ }
+ }
+
+ // Setup the classpath.
+
+ ClasspathHelper.removeClasspathEntries(project, fv);
+
+ if (!ClasspathHelper.addClasspathEntries(project, fv)) {
+ // TODO: Support the no runtime case.
+ // ClasspathHelper.addClasspathEntries( project, fv, <something> );
+ }
+
+ // Add the web libraries container.
+
+ if( model.getBooleanProperty(IWebFacetInstallDataModelProperties.INSTALL_WEB_LIBRARY)){
+ final IPath webLibContainer = new Path(WebAppLibrariesContainer.CONTAINER_ID);
+ addToClasspath(jproj, JavaCore.newContainerEntry(webLibContainer));
+ }
+
+ if( model.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.INSTALL_EAR_LIBRARY)){
+ final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID);
+ addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));
+ }
+
+ try {
+ ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
+ } catch (ExecutionException e) {
+ WebPlugin.logError(e);
+ }
+
+ if (monitor != null) {
+ monitor.worked(1);
+ }
+ } finally {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+ }
+
+
+ private void setContextRootPropertyIfNeeded(final IVirtualComponent c, String contextRoot) {
+ String existing = c.getMetaProperties().getProperty("context-root"); //$NON-NLS-1$
+ if (existing == null)
+ c.setMetaProperty("context-root", contextRoot); //$NON-NLS-1$
+ }
+
+ private IPath setContentPropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
+ IVirtualComponent c = ComponentCore.createComponent(project, false);
+ if (c.exists()) {
+ if( !c.getRootFolder().getProjectRelativePath().isRoot() ){
+ return c.getRootFolder().getUnderlyingResource().getFullPath();
+ }
+ }
+ return pjpath.append(model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER));
+ }
+
+ private void createWeb30DeploymentDescriptor(final IProject project, final IProjectFacetVersion fv,
+ IFolder webinfFolder, IProgressMonitor monitor) throws CoreException {
+ // Create the deployment descriptor (web.xml) if one doesn't exist
+ IFile webxmlFile = webinfFolder.getFile("web.xml"); //$NON-NLS-1$
+ if (!webxmlFile.exists()) {
+ try {
+ // Create a minimal web.xml file, so the model can be initialized
+ final String webXmlContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-app id=\"WebApp_ID\" version=\"3.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd\">\n</web-app>"; //$NON-NLS-1$
+ webxmlFile.create(new ByteArrayInputStream(webXmlContents.getBytes("UTF-8")), true, monitor); //$NON-NLS-1$
+
+ populateDefaultContent(project, fv);
+ } catch (UnsupportedEncodingException e) {
+ WebPlugin.logError(e);
+ }
+ }
+ }
+
+ private void createWeb25DeploymentDescriptor(final IProject project, final IProjectFacetVersion fv,
+ IFolder webinfFolder, IProgressMonitor monitor) throws CoreException {
+ // Create the deployment descriptor (web.xml) if one doesn't exist
+ IFile webxmlFile = webinfFolder.getFile("web.xml"); //$NON-NLS-1$
+ if (!webxmlFile.exists()) {
+ try {
+ // Create a minimal web.xml file, so the model can be initialized
+ final String webXmlContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-app id=\"WebApp_ID\" version=\"2.5\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\">\n</web-app>"; //$NON-NLS-1$
+ webxmlFile.create(new ByteArrayInputStream(webXmlContents.getBytes("UTF-8")), true, monitor); //$NON-NLS-1$
+
+ populateDefaultContent(project, fv);
+ } catch (UnsupportedEncodingException e) {
+ WebPlugin.logError(e);
+ }
+ }
+ }
+
+
+ private void populateDefaultContent(final IProject project,
+ final IProjectFacetVersion fv) {
+ final IModelProvider provider = ModelProviderManager.getModelProvider(project, fv);
+ Runnable runnable = new Runnable(){
+
+ public void run() {
+ WebApp webApp = (WebApp) provider.getModelObject();
+
+ // Add the display-name tag
+ DisplayName displayName = JavaeeFactory.eINSTANCE.createDisplayName();
+ displayName.setValue(project.getName());
+ webApp.getDisplayNames().add(displayName);
+
+ // welcome file list
+ List<String> welcomeFiles = Arrays.asList(
+ "index.html", //$NON-NLS-1$
+ "index.htm", //$NON-NLS-1$
+ "index.jsp", //$NON-NLS-1$
+ "default.html", //$NON-NLS-1$
+ "default.htm", //$NON-NLS-1$
+ "default.jsp" //$NON-NLS-1$
+ );
+
+ // Add the welcome-file-list tag
+ WelcomeFileList welcomeFileList = WebFactory.eINSTANCE.createWelcomeFileList();
+ welcomeFileList.getWelcomeFiles().addAll(welcomeFiles);
+ webApp.getWelcomeFileLists().add(welcomeFileList);
+ }
+ };
+ provider.modify(runnable, null);
+ }
+
+
+ private static void mkdirs(final IFolder folder)
+
+ throws CoreException
+
+ {
+ if (!folder.exists()) {
+ if (folder.getParent() instanceof IFolder) {
+ mkdirs((IFolder) folder.getParent());
+ }
+
+ folder.create(true, true, null);
+ }
+ else
+ {
+ IContainer x = folder;
+
+ while( x instanceof IFolder && x.isDerived() )
+ {
+ x.setDerived( false );
+ x = x.getParent();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegateForWebFragmentProjects.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegateForWebFragmentProjects.java
new file mode 100644
index 0000000..193bb92
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegateForWebFragmentProjects.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jem.util.UIContextDetermination;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig;
+import org.eclipse.jst.j2ee.application.internal.operations.AddWebFragmentComponentToWebApplicationDataModelProvider;
+import org.eclipse.jst.j2ee.application.internal.operations.IAddWebFragmentComponentToWebApplicationDataModelProperties;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences.Keys;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.web.internal.facet.RuntimePresetMappingRegistry;
+
+public abstract class WebFacetInstallDelegateForWebFragmentProjects {
+
+ protected static void addToClasspath(final IJavaProject jproj, final IClasspathEntry entry) throws CoreException {
+ final IClasspathEntry[] existingEntries = jproj.getRawClasspath();
+ for(IClasspathEntry existingEntry : existingEntries){
+ if(existingEntry.equals(entry)){
+ return;
+ }
+ }
+ final IClasspathEntry[] updated = new IClasspathEntry[existingEntries.length + 1];
+ System.arraycopy(existingEntries, 0, updated, 0, existingEntries.length);
+ updated[existingEntries.length] = entry;
+ jproj.setRawClasspath(updated, null);
+ }
+
+ protected void installWARFacet( final String j2eeVersionText,
+ final String warProjectName,
+ final IRuntime runtime,
+ final IProgressMonitor monitor )
+ {
+ IProject project = ProjectUtilities.getProject(warProjectName);
+ if( project.exists())
+ return;
+
+ IFacetedProjectWorkingCopy fpjwc = null;
+ try
+ {
+ fpjwc = FacetedProjectFramework.createNewProject();
+
+
+ fpjwc.setProjectName( warProjectName );
+
+ if( runtime != null )
+ {
+ fpjwc.setTargetedRuntimes( Collections.singleton( runtime ) );
+ }
+ ArrayList <IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
+ requiredFacets.add(JavaFacetUtils.JAVA_FACET);
+ requiredFacets.add(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ final Collection<IProjectFacet> fixedFacets = requiredFacets;
+ fpjwc.setFixedProjectFacets( new HashSet<IProjectFacet>( fixedFacets ) );
+ //fpjwc.setFixedProjectFacets( Collections.singleton( JavaFacetUtils.JAVA_FACET) );
+ fpjwc.setSelectedPreset( FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID );
+
+ if( j2eeVersionText != null )
+ {
+ final IProjectFacetVersion defaultWarFacetVersion
+ = fpjwc.getProjectFacetVersion( IJ2EEFacetConstants.DYNAMIC_WEB_FACET );
+
+ if( ! defaultWarFacetVersion.getVersionString().equals( j2eeVersionText ) )
+ {
+ String presetId = null;
+
+ if( runtime != null )
+ {
+ for( IRuntimeComponent rc : runtime.getRuntimeComponents() )
+ {
+ presetId = RuntimePresetMappingRegistry.INSTANCE.getPresetID
+ (
+ rc.getRuntimeComponentType().getId(),
+ rc.getRuntimeComponentVersion().getVersionString(),
+ IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getId(),
+ j2eeVersionText
+ );
+
+ if( presetId != null )
+ {
+ break;
+ }
+ }
+ }
+
+ final IProjectFacetVersion warFacetVersion
+ = IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getVersion( j2eeVersionText );
+
+
+
+ // Note that the next call is necessary even if a preset is going to be selected
+ // later since it allows the dynamic preset to adjust for the war facet version.
+ ArrayList <IProjectFacetVersion> requiredFacetVersions = new ArrayList<IProjectFacetVersion>();
+ requiredFacetVersions.add(JavaFacetUtils.JAVA_FACET.getVersion("1.5")); //$NON-NLS-1$
+ requiredFacetVersions.add(warFacetVersion);
+ final Collection<IProjectFacetVersion> fixedFacetVersions = requiredFacetVersions;
+ fpjwc.setProjectFacets( new HashSet<IProjectFacetVersion>( fixedFacetVersions ) );
+
+ //fpjwc.setProjectFacets( Collections.singleton( warFacetVersion ) );
+
+ if( presetId != null )
+ {
+ fpjwc.setSelectedPreset( presetId );
+ }
+ }
+
+ Set<IFacetedProject.Action> actions = fpjwc.getProjectFacetActions();
+ for(IFacetedProject.Action action: actions){
+ Object actionConfig = action.getConfig();
+ if( actionConfig instanceof JavaFacetInstallConfig){
+ JavaFacetInstallConfig c = (JavaFacetInstallConfig) actionConfig;
+ c.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.DYN_WEB_OUTPUT_FOLDER)));
+ }
+ }
+ }
+ try
+ {
+ fpjwc.commitChanges( null );
+ }
+ catch( CoreException e )
+ {
+ J2EEPlugin.logError( e );
+ }
+ }finally {
+ if(fpjwc != null){
+ fpjwc.dispose();
+ }
+ }
+ }
+
+ protected void addToWar(IVirtualComponent warComp, IVirtualComponent j2eeComp, String moduleURI ){
+ final IDataModel dataModel = DataModelFactory.createDataModel(new AddWebFragmentComponentToWebApplicationDataModelProvider());
+ Map map = (Map)dataModel.getProperty(IAddWebFragmentComponentToWebApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP);
+ map.put(j2eeComp, moduleURI);
+
+ dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, warComp);
+
+ List modList = (List) dataModel.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+ modList.add(j2eeComp);
+ dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList);
+ dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, "/WEB-INF/lib"); //$NON-NLS-1$
+ try {
+ dataModel.getDefaultOperation().execute(null, null);
+ } catch (ExecutionException e) {
+ J2EEPlugin.logError(e);
+ }
+ }
+
+ protected void installAndAddModuletoWAR( String j2eeVersionText,
+ String warProjectName,
+ IRuntime runtime,
+ IProject moduleProject,
+ String moduleURI,
+ IProgressMonitor monitor ){
+
+ installWARFacet(j2eeVersionText,
+ warProjectName,
+ runtime,
+ monitor);
+
+ final IVirtualComponent c = ComponentCore.createComponent( moduleProject );
+ final IProject warProject = ProjectUtilities.getProject( warProjectName );
+ final IVirtualComponent warComp = ComponentCore.createComponent( warProject );
+
+ if( UIContextDetermination.getCurrentContext() == UIContextDetermination.HEADLESS_CONTEXT ){
+ boolean isValidating = RendererFactory.getDefaultRendererFactory().isValidating();
+ try{
+ if( isValidating ){
+ RendererFactory.getDefaultRendererFactory().setValidating(false);
+ }
+ addToWar( warComp, c, moduleURI );
+ }finally{
+ RendererFactory.getDefaultRendererFactory().setValidating(isValidating);
+ }
+ }
+ else{
+ addToWar( warComp, c, moduleURI );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java
new file mode 100644
index 0000000..fbb89f6
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetPostInstallDelegate.java
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import static org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR;
+import static org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME;
+import static org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI;
+import static org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties.FACETED_PROJECT_WORKING_COPY;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDelegate;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public final class WebFacetPostInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
+
+ public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
+ if (monitor != null) {
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ }
+
+ try {
+ final IDataModel model = (IDataModel) cfg;
+
+ // Associate with an EAR, if necessary.
+ if ( model.getBooleanProperty(ADD_TO_EAR) ) {
+ final String earProjectName = model.getStringProperty(EAR_PROJECT_NAME);
+
+ if ( earProjectName != null && !earProjectName.equals("") ) { //$NON-NLS-1$
+
+ String ver = fv.getVersionString();
+
+ String j2eeVersionText = J2EEVersionUtil.convertVersionIntToString(J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(ver));
+ final String moduleURI = model.getStringProperty(MODULE_URI);
+
+ final IFacetedProjectWorkingCopy fpjwc
+ = (IFacetedProjectWorkingCopy) model.getProperty( FACETED_PROJECT_WORKING_COPY );
+
+ installAndAddModuletoEAR( j2eeVersionText,
+ earProjectName,
+ fpjwc.getPrimaryRuntime(),
+ project,
+ moduleURI,
+ monitor );
+
+ }
+ }
+
+ if (monitor != null) {
+ monitor.worked(1);
+ }
+ } finally {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java
new file mode 100644
index 0000000..b03ee51
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetRuntimeChangedDelegate.java
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class WebFacetRuntimeChangedDelegate
+
+ implements IDelegate
+
+{
+ public void execute( final IProject project,
+ final IProjectFacetVersion fv,
+ final Object cfg,
+ final IProgressMonitor monitor )
+
+ throws CoreException
+
+ {
+ if( monitor != null )
+ {
+ monitor.beginTask( "", 1 ); //$NON-NLS-1$
+ }
+
+ try
+ {
+ ClasspathHelper.removeClasspathEntries( project, fv );
+
+ if( ! ClasspathHelper.addClasspathEntries( project, fv ) )
+ {
+ // TODO: Support the no runtime case.
+ // ClasspathHelper.addClasspathEntries( project, fv, <something> );
+ }
+
+ if( monitor != null )
+ {
+ monitor.worked( 1 );
+ }
+ }
+ finally
+ {
+ if( monitor != null )
+ {
+ monitor.done();
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java
new file mode 100644
index 0000000..c53840d
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetUtils.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.jst.j2ee.web.project.facet;
+
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class WebFacetUtils {
+
+ public static final IProjectFacet WEB_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.DYNAMIC_WEB);
+ public static final IProjectFacet WEBFRAGMENT_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.WEBFRAGMENT);
+ public static final IProjectFacetVersion WEB_22 = WEB_FACET.getVersion("2.2"); //$NON-NLS-1$
+ public static final IProjectFacetVersion WEB_23 = WEB_FACET.getVersion("2.3"); //$NON-NLS-1$
+ public static final IProjectFacetVersion WEB_24 = WEB_FACET.getVersion("2.4"); //$NON-NLS-1$
+ public static final IProjectFacetVersion WEB_25 = WEB_FACET.getVersion("2.5"); //$NON-NLS-1$
+ public static final IProjectFacetVersion WEB_30 = WEB_FACET.getVersion("3.0"); //$NON-NLS-1$
+ public static final IProjectFacetVersion WEBFRAGMENT_30 = WEBFRAGMENT_FACET.getVersion("3.0"); //$NON-NLS-1$
+
+ public static final IProjectFacet WEB_XDOCLET_FACET = getWebDocletFacet();
+
+ public static IProjectFacet getProjectFacet(String id) {
+ try {
+ return ProjectFacetsManager.getProjectFacet(id);
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private static IProjectFacet getWebDocletFacet() {
+ try {
+ return ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.DYNAMIC_WEB_XDOCLET);
+ } catch (IllegalArgumentException e) {
+ // the web doclet facet is not defined
+ return null;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java
new file mode 100644
index 0000000..278b892
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetVersionChangeDelegate.java
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * Copyright (c) 2005 BEA Systems, Inc.
+ * 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:
+ * Konstantin Komissarchik - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.jst.j2ee.web.project.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ */
+
+public final class WebFacetVersionChangeDelegate
+
+ implements IDelegate
+
+{
+ public void execute( final IProject project,
+ final IProjectFacetVersion fv,
+ final Object cfg,
+ final IProgressMonitor monitor )
+
+ throws CoreException
+
+ {
+ if( monitor != null )
+ {
+ monitor.beginTask( "", 1 ); //$NON-NLS-1$
+ }
+
+ try
+ {
+ // Find the version that's currently installed.
+
+ final IFacetedProject fproj
+ = ProjectFacetsManager.create( project );
+
+ final IProjectFacetVersion oldver
+ = fproj.getInstalledVersion( fv.getProjectFacet() );
+
+ // Reset the classpath.
+
+ ClasspathHelper.removeClasspathEntries( project, oldver );
+
+ if( ! ClasspathHelper.addClasspathEntries( project, fv ) )
+ {
+ // TODO: Support the no runtime case.
+ // ClasspathHelper.addClasspathEntries( project, fv, <something> );
+ }
+
+ // Update the component version.
+
+
+// final IVirtualComponent c = ComponentCore.createComponent(project);
+
+// final StructureEdit edit
+// = StructureEdit.getStructureEditForWrite( project );
+//
+// try
+// {
+// final ComponentType oldctype
+// = StructureEdit.getComponentType( c );
+//
+// final ComponentType newctype
+// = ComponentcoreFactory.eINSTANCE.createComponentType();
+//
+// newctype.setComponentTypeId( oldctype.getComponentTypeId() );
+// newctype.setVersion( fv.getVersionString() );
+// newctype.getProperties().addAll( oldctype.getProperties() );
+//
+// StructureEdit.setComponentType( c, newctype );
+//
+// edit.saveIfNecessary( null );
+// }
+// finally
+// {
+// edit.dispose();
+// }
+
+ if( monitor != null )
+ {
+ monitor.worked( 1 );
+ }
+ }
+ finally
+ {
+ if( monitor != null )
+ {
+ monitor.done();
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDataModelProvider.java
new file mode 100644
index 0000000..69e0daf
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDataModelProvider.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.eclipse.core.internal.resources.ResourceStatus;
+import org.eclipse.core.internal.utils.Messages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public class WebFragmentFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IWebFragmentFacetInstallDataModelProperties {
+
+ public WebFragmentFacetInstallDataModelProvider() {
+ super();
+ }
+
+
+ @Override
+ public Set<String> getPropertyNames() {
+ Set<String> names = super.getPropertyNames();
+ names.add(CONTENT_DIR);
+ names.add(ADD_TO_WAR);
+ names.add(WAR_PROJECT_NAME);
+ names.add(LAST_WAR_NAME);
+ return names;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(CONTENT_DIR)) {
+ return ""; //$NON-NLS-1$
+ } else if (propertyName.equals(FACET_ID)) {
+ return WEBFRAGMENT;
+ }else if (propertyName.equals(ADD_TO_EAR)) {
+ return false;
+ }else if (propertyName.equals(ADD_TO_WAR)) {
+ return true;
+ }else if (propertyName.equals(MODULE_URI)) {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
+ return projectName + IJ2EEModuleConstants.JAR_EXT;
+ }else if (propertyName.equals(ADD_TO_WAR)) {
+ return new Boolean( J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.ADD_TO_EAR_BY_DEFAULT) && isWARSupportedByRuntime());
+ } else if (propertyName.equals(WAR_PROJECT_NAME)) {
+ if (model.isPropertySet(LAST_WAR_NAME)) {
+ IProject project = ProjectUtilities.getProject(getStringProperty(LAST_WAR_NAME));
+ if (project.exists() && project.isAccessible())
+ return project.getName();
+ }
+ DataModelPropertyDescriptor[] descs = getValidPropertyDescriptors(WAR_PROJECT_NAME);
+ if (descs.length > 0) {
+ DataModelPropertyDescriptor desc = descs[0];
+ String eARName = desc.getPropertyDescription();
+ if (eARName != null && !eARName.equals("")) { //$NON-NLS-1$
+ return eARName;
+ }
+ return getDataModel().getStringProperty(FACET_PROJECT_NAME) + "WAR"; //$NON-NLS-1$
+ }
+ return getDataModel().getStringProperty(FACET_PROJECT_NAME) + "WAR"; //$NON-NLS-1$
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+
+ @Override
+ public IStatus validate(String name) {
+
+ if (name.equals(CONTENT_DIR)) {
+ String folderName = model.getStringProperty(CONTENT_DIR);
+ IStatus status = validateFolderName(folderName);
+ if (status.isOK())
+ {
+ if (folderName.indexOf('#') != -1) {
+ String message = NLS.bind(Messages.resources_invalidCharInName, "#", folderName); //$NON-NLS-1$
+ status = new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message);
+ }
+ }
+ return status;
+ }
+
+ return super.validate(name);
+ }
+
+
+ @Override
+ protected IStatus validateFolderName(String folderName) {
+ // the directory is not required, but if the name is entered ensure that it
+ // contains only valid characters.
+ if (folderName == null || folderName.length() == 0) {
+ return OK_STATUS;
+ }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IPath path = new Path(folderName);
+ for (int i = 0, max = path.segmentCount(); i < max; i++) {
+ IStatus status = workspace.validateName(path.segment(i), IResource.FOLDER);
+ if (! status.isOK())
+ return status;
+ }
+
+ // all of the potential segments of the folder have been verified
+ return OK_STATUS;
+ }
+
+ private boolean isWARSupportedByRuntime() {
+ boolean ret = true;
+ IRuntime rt = (IRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ if (rt != null)
+ ret = rt.supports(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ return ret;
+ }
+
+ @Override
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (WAR_PROJECT_NAME.equals(propertyName)) {
+ int j2eeVersion = J2EEVersionUtil.convertVersionStringToInt(((IProjectFacetVersion) getProperty(FACET_VERSION)).getVersionString());
+ return getWebAppPropertyDescriptors(j2eeVersion);
+ }
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if (FACET_PROJECT_NAME.equals(propertyName)) {
+ if (getBooleanProperty(ADD_TO_WAR)) {
+ if (!model.isPropertySet(WAR_PROJECT_NAME)) {
+ model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.DEFAULT_CHG);
+ }
+ }
+ } else if (FACET_VERSION.equals(propertyName)) {
+ model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
+ } else if (propertyName.equals(CONFIG_FOLDER)) {
+ IDataModel masterModel = (IDataModel) model.getProperty(MASTER_PROJECT_DM);
+ if (masterModel != null) {
+ FacetDataModelMap map = (FacetDataModelMap) masterModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel javaModel = map.getFacetDataModel(JAVA);
+ if (javaModel != null) {
+ javaModel.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, propertyValue);
+ }
+ }
+ } else if ((WAR_PROJECT_NAME.equals(propertyName) || ADD_TO_WAR.equals(propertyName) || LAST_WAR_NAME.equals(propertyName)) && getBooleanProperty(ADD_TO_WAR)) {
+ //ValidateEAR really does general checks for project name. So its applicable here too.
+ IStatus status = validateEAR(model.getStringProperty(WAR_PROJECT_NAME));
+ if (status.isOK()) {
+ IProject project = ProjectUtilities.getProject(getStringProperty(WAR_PROJECT_NAME));
+ if (project.exists() && project.isAccessible() && JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ try {
+ IFacetedProject facetProj = ProjectFacetsManager.create(project, false, new NullProgressMonitor());
+ setProperty(FACET_RUNTIME, facetProj.getRuntime());
+ } catch (CoreException e) {
+ J2EEPlugin.logError(e);
+ }
+ }
+ }
+ model.notifyPropertyChange(FACET_RUNTIME, IDataModel.ENABLE_CHG);
+ } else if (propertyName.equals(IFacetProjectCreationDataModelProperties.FACET_RUNTIME)) {
+ model.notifyPropertyChange(ADD_TO_WAR, IDataModel.VALID_VALUES_CHG);
+ model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
+ }
+
+ if (ADD_TO_WAR.equals(propertyName)) {
+ IStatus stat = model.validateProperty(propertyName);
+ if (stat != OK_STATUS) {
+ return true;
+ }
+ model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
+ }
+
+
+ return super.propertySet(propertyName, propertyValue);
+ }
+
+ private DataModelPropertyDescriptor[] getWebAppPropertyDescriptors(int webAppVersion) {
+ ArrayList webAppDescriptorList = new ArrayList();
+
+ IProject[] projs = ProjectUtilities.getAllProjects();
+
+ for (int index = 0; index < projs.length; index++) {
+ IProject flexProject = projs[index];
+ if (flexProject != null) {
+ if (ModuleCoreNature.isFlexibleProject(flexProject)) {
+ IVirtualComponent comp = ComponentCore.createComponent(flexProject);
+ if (JavaEEProjectUtilities.isDynamicWebProject(comp.getProject())) {
+ String sVer = J2EEProjectUtilities.getJ2EEProjectVersion(comp.getProject());
+ int ver = J2EEVersionUtil.convertVersionStringToInt(sVer);
+ if (webAppVersion <= ver) {
+ DataModelPropertyDescriptor desc = new DataModelPropertyDescriptor(comp.getProject().getName());
+ webAppDescriptorList.add(desc);
+ }
+ }
+ }
+ }
+ }
+ DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[webAppDescriptorList.size()];
+ for (int i = 0; i < descriptors.length; i++) {
+ DataModelPropertyDescriptor desc = (DataModelPropertyDescriptor) webAppDescriptorList.get(i);
+ descriptors[i] = new DataModelPropertyDescriptor(desc.getPropertyDescription(), desc.getPropertyDescription());
+ }
+ return descriptors;
+ }
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (ADD_TO_WAR.equals(propertyName)) {
+ return isWARSupportedByRuntime();
+ }
+ if (WAR_PROJECT_NAME.equals(propertyName)) {
+ return isWARSupportedByRuntime() && getBooleanProperty(ADD_TO_WAR);
+ }
+ return super.isPropertyEnabled(propertyName);
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDelegate.java
new file mode 100644
index 0000000..f80f02f
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetInstallDelegate.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 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.jst.j2ee.web.project.facet;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.internal.resources.XMLWriter;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jem.util.emf.workbench.WorkbenchByteArrayOutputStream;
+import org.eclipse.jst.common.project.facet.WtpUtils;
+import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.internal.project.ManifestFileCreationAction;
+import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class WebFragmentFacetInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
+ if (monitor != null)
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ try {
+ IDataModel model = (IDataModel) config;
+ WtpUtils.addNatures(project);
+ final IVirtualComponent c = ComponentCore.createComponent(project, false);
+ c.create(0, null);
+ final IVirtualFolder jsrc = c.getRootFolder();
+ final IJavaProject jproj = JavaCore.create(project);
+ final IClasspathEntry[] cp = jproj.getRawClasspath();
+ IPath firstPath = null;
+ for (int i = 0; i < cp.length; i++) {
+ final IClasspathEntry cpe = cp[i];
+
+ if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IPath path = cpe.getPath().removeFirstSegments(1);
+ if (path.isEmpty()) {
+ path = new Path("/"); //$NON-NLS-1$
+ }
+ jsrc.createLink(path, 0, null);
+ if (firstPath == null){
+ firstPath = path;
+ }
+ }
+ }
+ J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(jsrc, firstPath, null);
+ final IVirtualFolder root = c.getRootFolder();
+ IContainer container = null;
+ if (root.getProjectRelativePath().segmentCount() == 0) {
+ container = project;
+ } else {
+ container = root.getUnderlyingFolder();
+ }
+ try {
+ if (container != null) {
+ createWebFragmentFile(project, fv, container, monitor);
+ createManifest (project, container, monitor);
+ }
+ } catch (InvocationTargetException e) {
+ J2EEPlugin.logError(e);
+ } catch (InterruptedException e) {
+ J2EEPlugin.logError(e);
+ }
+ ClasspathHelper.removeClasspathEntries(project, fv);
+ if (!ClasspathHelper.addClasspathEntries(project, fv)) {
+ // TODO: Support the no runtime case.
+ // ClasspathHelper.addClasspathEntries( project, fv, <something> );
+ }
+ try {
+ ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
+ } catch (ExecutionException e) {
+ WebPlugin.logError(e);
+ }
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+
+ protected void createWebFragmentFile(IProject project, IProjectFacetVersion fv, IContainer aFolder, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
+
+ IFile file = aFolder.getFile(new Path(J2EEConstants.WEBFRAGMENT_DD_URI));
+ if (file.exists()) return;
+ try {
+ createWebFragmentFile(file, project);
+ } catch (CoreException e) {
+ J2EEPlugin.logError(e);
+ } catch (IOException e) {
+ J2EEPlugin.logError(e);
+ }
+ }
+
+ public static void createWebFragmentFile(IFile file, IProject project) throws CoreException, IOException {
+ try {
+ WorkbenchByteArrayOutputStream out = new WorkbenchByteArrayOutputStream(file);
+ String projectNamewithoutSpecialChars = getNameWithoutSpecialCharacters(project.getName());
+ final String webFragXmlContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-fragment id=\"WebFragment_ID\" version=\"3.0\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd\">\n<display-name>" + XMLWriter.getEscaped(project.getName())+ "</display-name> \n <name>"+ XMLWriter.getEscaped(projectNamewithoutSpecialChars) + "</name> \n </web-fragment>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ out.write(webFragXmlContents.getBytes("UTF-8")); //$NON-NLS-1$
+ out.close();
+ } catch (IOException ioe) {
+ throw ioe;
+ }
+ }
+
+
+
+ protected void createManifest(IProject project, IContainer aFolder, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
+
+ IFile file = aFolder.getFile(new Path(J2EEConstants.MANIFEST_URI));
+ if (file.exists()) return;
+ try {
+ ManifestFileCreationAction.createManifestFile(file, project);
+ } catch (CoreException e) {
+ J2EEPlugin.logError(e);
+ } catch (IOException e) {
+ J2EEPlugin.logError(e);
+ }
+ }
+
+ private static String getNameWithoutSpecialCharacters(String projectName){
+ String result = projectName;
+ Pattern p = Pattern.compile("($|_|\\p{L})(\\p{L}|\\p{Nd}|_|$)*"); //$NON-NLS-1$
+ for(int curLength = 1; curLength <= result.length(); curLength++){
+ if(p.matcher(result.substring(0,curLength)).matches()== false){
+ result = result.replace(result.charAt(curLength-1 < 0 ? curLength : curLength-1), '_');
+ }
+ }
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetPostInstallDelegate.java
new file mode 100644
index 0000000..1272ffd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetPostInstallDelegate.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public final class WebFragmentFacetPostInstallDelegate extends WebFacetInstallDelegateForWebFragmentProjects implements IDelegate {
+
+ public void execute(final IProject project, final IProjectFacetVersion fv, final Object cfg, final IProgressMonitor monitor) throws CoreException {
+ if (monitor != null) {
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ }
+ try {
+ final IDataModel model = (IDataModel) cfg;
+ if (model.getBooleanProperty(IWebFragmentFacetInstallDataModelProperties.ADD_TO_WAR)) {
+ final String warProjectName = model.getStringProperty(IWebFragmentFacetInstallDataModelProperties.WAR_PROJECT_NAME);
+ if (warProjectName != null && warProjectName != "") //$NON-NLS-1$
+ {
+ final String moduleURI = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI);
+
+ installAndAddModuletoWAR( J2EEVersionConstants.VERSION_3_0_TEXT,
+ warProjectName,
+ (IRuntime) model.getProperty(IJ2EEFacetInstallDataModelProperties.FACET_RUNTIME),
+ project,
+ moduleURI,
+ monitor );
+ }
+ }
+ } catch (Exception e) {
+ J2EEPlugin.logError(e);
+ } finally {
+ if (monitor != null) {
+ monitor.done();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.java
new file mode 100644
index 0000000..abe00f5
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+
+ * Copyright (c) 2010 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.jst.j2ee.web.project.facet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.jst.j2ee.project.facet.J2EEFacetProjectCreationDataModelProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModelProviderNew;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class WebFragmentFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider implements IWebFragmentProjectCreationDataModelProperties{
+
+ public WebFragmentFacetProjectCreationDataModelProvider() {
+ super();
+ }
+
+ public IProjectFacet WEBFRAGMENT_FACET = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEBFRAGMENT_MODULE);
+
+
+ @Override
+ public void init() {
+ super.init();
+ Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
+ requiredFacets.add(JavaFacetUtils.JAVA_FACET);
+ requiredFacets.add(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEBFRAGMENT_MODULE));
+ setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel javaFacet = map.getFacetDataModel(JavaFacetUtils.JAVA_FACET.getId());
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, "bin"); //$NON-NLS-1$
+
+ IDataModel webFragmentFacet = map.getFacetDataModel(WEBFRAGMENT_FACET.getId());
+ webFragmentFacet.addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if (IWebFragmentFacetInstallDataModelProperties.WAR_PROJECT_NAME.equals(event.getPropertyName())) {
+ if (isPropertySet(WAR_PROJECT_NAME))
+ setProperty(WAR_PROJECT_NAME, event.getProperty());
+ else
+ model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.DEFAULT_CHG);
+ }else if (IWebFragmentFacetInstallDataModelProperties.ADD_TO_WAR.equals(event.getPropertyName())) {
+ setProperty(ADD_TO_WAR, event.getProperty());
+ }
+ }
+ });
+ }
+
+ @Override
+ public IStatus validate(String propertyName) {
+ if ( WAR_PROJECT_NAME.equals(propertyName) ) {
+ if (model.getBooleanProperty(ADD_TO_WAR)) {
+
+ IStatus status = validateWebProjForWebFragment(model.getStringProperty(WAR_PROJECT_NAME));
+ if (!status.isOK())
+ return status;
+
+ if (getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME).equals(getStringProperty(WAR_PROJECT_NAME))) {
+ String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME, new Object[]{getStringProperty(WAR_PROJECT_NAME)});
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
+ }
+ }
+ return super.validate(propertyName);
+ }
+
+
+ protected IStatus validateWebProjForWebFragment(String webAppName) {
+ if (webAppName.indexOf("#") != -1 || webAppName.indexOf("/") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
+ String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_INVALID_CHARS);
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ } else if (webAppName.equals("")) { //$NON-NLS-1$
+ String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
+
+ IStatus status = ProjectCreationDataModelProviderNew.validateProjectName(webAppName);
+ //check for the deleted case, the project is deleted from the workspace but still exists in the
+ //file system.
+ if( status.isOK()){
+ IProject webProj = JavaEEProjectUtilities.getProject(getStringProperty(WAR_PROJECT_NAME));
+ if( !webProj.exists() ){
+ IPath path = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ path = path.append(webAppName);
+ status = ProjectCreationDataModelProviderNew.validateExisting(webAppName, path.toOSString());
+ } else{
+ IProjectFacetVersion facetVersion = JavaEEProjectUtilities.getProjectFacetVersion(webProj, IJ2EEFacetConstants.DYNAMIC_WEB);
+ if(facetVersion != null){
+ if(facetVersion == IJ2EEFacetConstants.DYNAMIC_WEB_22 ||
+ facetVersion == IJ2EEFacetConstants.DYNAMIC_WEB_23 ||
+ facetVersion == IJ2EEFacetConstants.DYNAMIC_WEB_24 ||
+ facetVersion == IJ2EEFacetConstants.DYNAMIC_WEB_25){
+ String errorMessage = Resources.WEB_FRAGMENT_WEB_INCOMPATIBILITY;
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
+ }
+ }
+ }
+ return status;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (ADD_TO_WAR.equals(propertyName)) {
+ return true;
+ }else if (WAR_PROJECT_NAME.equals(propertyName)) {
+ IDataModel nestedJ2EEFacetDataModel = getJ2EEFacetModel();
+ if (nestedJ2EEFacetDataModel!=null)
+ return nestedJ2EEFacetDataModel.getProperty(IWebFragmentFacetInstallDataModelProperties.WAR_PROJECT_NAME);
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ Set names = super.getPropertyNames();
+ names.add(WAR_PROJECT_NAME);
+ names.add(ADD_TO_WAR);
+
+ return names;
+ }
+
+ private static final class Resources
+
+ extends NLS
+
+ {
+ public static String WEB_FRAGMENT_WEB_INCOMPATIBILITY;
+ static
+ {
+ initializeMessages( WebFragmentFacetProjectCreationDataModelProvider.class.getName(),
+ Resources.class );
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.properties b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.properties
new file mode 100644
index 0000000..b1941fd
--- /dev/null
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFragmentFacetProjectCreationDataModelProvider.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2010 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
+###############################################################################
+WEB_FRAGMENT_WEB_INCOMPATIBILITY=Web Fragments require a Web Module with version 3.0 or higher
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
index e40f634..0df7b72 100644
--- a/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.jst.j2ee; singleton:=true
-Bundle-Version: 1.1.405.qualifier
+Bundle-Version: 1.1.406.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
@@ -71,7 +71,7 @@
org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.sse.core;bundle-version="[1.1.0,1.2.0)",
org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.wst.common.modulecore;bundle-version="[1.2.5,2.0.0)";visibility:=reexport,
+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.7,2.0.0)";visibility:=reexport,
org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
org.eclipse.jst.common.annotations.controller;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)",
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDataModelProvider.java
index 6193a4a..999b6b5 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDataModelProvider.java
@@ -12,13 +12,21 @@
import java.util.Set;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
public class AppClientFacetInstallDataModelProvider extends J2EEModuleFacetInstallDataModelProvider implements IAppClientFacetInstallDataModelProperties {
@@ -41,7 +49,27 @@
else if (propertyName.equals(CREATE_DEFAULT_MAIN_CLASS))
return Boolean.TRUE;
else if (propertyName.equals(CONFIG_FOLDER))
+ {
+ if (model.isPropertySet(FACET_PROJECT_NAME))
+ {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME);
+ IProject project = (projectName.length() > 0) ? ResourcesPlugin.getWorkspace().getRoot().getProject(projectName) : null;
+
+ if (project != null && project.exists()) {
+ if (ModuleCoreNature.isFlexibleProject(project))
+ {
+ IVirtualComponent c = ComponentCore.createComponent(project, true);
+ IVirtualFolder ejbroot = c.getRootFolder();
+ IPath configFolderPath = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(ejbroot);
+ if (configFolderPath != null && project.getFolder(configFolderPath).exists())
+ {
+ return configFolderPath.toString();
+ }
+ }
+ }
+ }
return J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.APP_CLIENT_CONTENT_FOLDER);
+ }
else if (propertyName.equals(MODULE_URI)) {
String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ','_');
return projectName + IJ2EEModuleConstants.JAR_EXT;
@@ -72,7 +100,13 @@
this.javaFacetInstallConfig.setSourceFolder( sourceFolder );
}
}
-
+ else if (FACET_PROJECT_NAME.equals(propertyName))
+ {
+ if (!model.isPropertySet(CONFIG_FOLDER)) {
+ model.notifyPropertyChange(CONFIG_FOLDER, IDataModel.DEFAULT_CHG);
+ }
+ }
+
return super.propertySet(propertyName, propertyValue);
}
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
index 6d48e6f..46ab1bf 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2011 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
@@ -31,6 +31,7 @@
import org.eclipse.jst.common.project.facet.WtpUtils;
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer;
@@ -106,7 +107,9 @@
IFolder sourceFolder = null;
String configFolder = null;
configFolder = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER);
- root.createLink(new Path("/" + configFolder), 0, null); //$NON-NLS-1$
+ Path configFolderPath = new Path(configFolder);
+ root.createLink(configFolderPath, 0, null);
+ J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(root, configFolderPath, null);
String configFolderName = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER);
IPath configFolderpath = pjpath.append(configFolderName);
sourceFolder = ws.getRoot().getFolder(configFolderpath);
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/ClasspathDependenciesCollector.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/ClasspathDependenciesCollector.java
index 3f263bf..a585035 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/ClasspathDependenciesCollector.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/ClasspathDependenciesCollector.java
@@ -12,18 +12,21 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jst.common.internal.modulecore.AddClasspathLibReferencesParticipant;
import org.eclipse.jst.common.internal.modulecore.IClasspathDependencyComponent;
import org.eclipse.jst.common.internal.modulecore.IClasspathDependencyProvider;
import org.eclipse.jst.common.internal.modulecore.IClasspathDependencyReceiver;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.jst.j2ee.project.WebUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.wst.common.componentcore.internal.flat.AbstractFlattenParticipant;
+import org.eclipse.wst.common.componentcore.internal.flat.ChildModuleReference;
import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent;
import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference;
import org.eclipse.wst.common.componentcore.internal.flat.IFlatFile;
@@ -60,6 +63,21 @@
if (classpathReferences != null) {
classpathReferences.finalize(getComponent(), null, resources);
+ // Retrieve the children modules contributed by classpath references and
+ // add them as children of this FlatVirtualComponent
+ List <IVirtualReference> refToModules = classpathReferences.getChildModules(getComponent(), null);
+ if (refToModules != null){
+ for (IVirtualReference ref:refToModules){
+ ChildModuleReference cm = new ChildModuleReference(ref, new Path("")); //$NON-NLS-1$
+ List<IChildModuleReference> duplicates = new ArrayList();
+ for( IChildModuleReference tmp : children ) {
+ if(tmp.getRelativeURI().equals(cm.getRelativeURI()))
+ duplicates.add(tmp);
+ }
+ children.removeAll(duplicates);
+ children.add(cm);
+ }
+ }
}
}
}
@@ -70,6 +88,30 @@
return fetchFlatFiles(resources, flatFiles);
}
+ /**
+ * This method will return an array of {@link IVirtualReference} for all of
+ * the utility modules contributed by classpath dependencies.
+ *
+ * @return - an array of {@link IVirtualReference} of utility modules
+ * @throws CoreException
+ */
+ public IVirtualReference[] getUtilityModuleReferences() throws CoreException {
+
+ List <IVirtualReference> result = new ArrayList<IVirtualReference>();
+ if (getComponent() != null) {
+ List<String> componentTypes = Collections.singletonList(IJ2EEFacetConstants.UTILITY);
+ for (IChildModuleReference moduleRef:getChildModules()){
+ if (componentTypes.contains(JavaEEProjectUtilities.getJ2EEComponentType(moduleRef.getReference().getReferencedComponent()))) {
+ result.add(moduleRef.getReference());
+ }
+ }
+
+ if (result.size() > 0)
+ return result.toArray(new IVirtualReference[result.size()]);
+ }
+ return new IVirtualReference[0];
+ }
+
private List <IFlatFile> fetchFlatFiles(IFlatResource[] resources, List<IFlatFile> flatFiles) {
for (int i = 0; i < resources.length; i++) {
IFlatResource resource = resources[i];
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/JavaEESingleRootCallback.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/JavaEESingleRootCallback.java
index ce0848f..bdcbf6f 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/JavaEESingleRootCallback.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/exportmodel/JavaEESingleRootCallback.java
@@ -34,6 +34,10 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class JavaEESingleRootCallback implements SingleRootParticipantCallback {
+ //Warnings
+ public static final int UNNECESSARY_RESOURCE_MAP = 100;
+
+ //Errors
public static final int EAR_PROJECT_FOUND = 10100;
public static final int ATLEAST_1_RESOURCE_MAP_MISSING = 10101;
public static final int JAVA_OUTPUT_NOT_WEBINF_CLASSES = 10102;
@@ -123,6 +127,8 @@
*/
private boolean hasDefaultWebResourceMappings(SingleRootUtil util, List resourceMaps) {
int rootValidMaps = 0;
+ IPath pathMappedToContentRoot = null;
+ List<ComponentResource> tmpResources = new ArrayList<ComponentResource>();
IPath webInfClasses = new Path(J2EEConstants.WEB_INF_CLASSES).makeAbsolute();
for (int i = 0; i < resourceMaps.size(); i++) {
@@ -134,6 +140,8 @@
// Verify if the map is for the content root
if (util.isRootMapping(resourceMap)) {
rootValidMaps++;
+ if (pathMappedToContentRoot == null) //we are interested only if the first resource mapped to root
+ pathMappedToContentRoot = sourcePath;
}
// Verify if the map is for a java src folder and is mapped to "WEB-INF/classes"
else if (runtimePath.equals(webInfClasses)) {
@@ -147,11 +155,28 @@
}
}
else {
- util.reportStatus(RUNTIME_PATH_NOT_ROOT_OR_WEBINF_CLASSES, runtimePath);
- }
-
+ // Do not report status yet. Below we do some extra validation
+ tmpResources.add(resourceMap);
+ }
if (util.getValidateFlag() == CANCEL) return false;
}
+
+ if (pathMappedToContentRoot != null){
+ for (ComponentResource res:tmpResources){
+ IPath completePath = pathMappedToContentRoot.append(res.getRuntimePath());
+ if (completePath.equals(res.getSourcePath())){
+ // This mapping is redundant, because there is already a mapping that includes this resource
+ util.reportStatus(UNNECESSARY_RESOURCE_MAP, res.getSourcePath());
+ }
+ else{
+ // Not root, not WEB-INF/classes and not redundant, report status
+ util.reportStatus(RUNTIME_PATH_NOT_ROOT_OR_WEBINF_CLASSES, res.getRuntimePath());
+ }
+ if (util.getValidateFlag() == CANCEL) return false;
+ }
+ tmpResources = null;
+ }
+
// Make sure only one of the maps is the content root, and that at least one is for the java folder
if (rootValidMaps != 1) {
if (rootValidMaps < 1) {
diff --git a/plugins/org.eclipse.jst.j2ee/commonedit/org/eclipse/jst/j2ee/common/internal/provider/ListenerItemProvider.java b/plugins/org.eclipse.jst.j2ee/commonedit/org/eclipse/jst/j2ee/common/internal/provider/ListenerItemProvider.java
index cf06938..20b1cbf 100644
--- a/plugins/org.eclipse.jst.j2ee/commonedit/org/eclipse/jst/j2ee/common/internal/provider/ListenerItemProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/commonedit/org/eclipse/jst/j2ee/common/internal/provider/ListenerItemProvider.java
@@ -101,6 +101,11 @@
*/
@Override
public void notifyChanged(Notification notification) {
+ switch (notification.getFeatureID(Listener.class)) {
+ case CommonPackage.LISTENER__LISTENER_CLASS:
+ fireNotifyChanged(notification);
+ return;
+ }
super.notifyChanged(notification);
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
index f4ef8b7..f884892 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 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
@@ -208,6 +208,11 @@
List<IVirtualReference> hardReferences = getHardReferences(this);
return hardReferences.toArray(new IVirtualReference[hardReferences.size()]);
}
+ if( refType != null && IVirtualComponent.DISPLAYABLE_REFERENCES_ALL.equals(refType)){
+ checkIfStillValid(); // This will clear the cache of raw references if needed.
+ return getAllReferences();
+ }
+
IVirtualReference[] refs = getReferences();
Boolean objGetExpandRefs = (Boolean)options.get(J2EEModuleVirtualComponent.GET_EXPANDED_LIB_REFS);
boolean getExpandRefs = objGetExpandRefs != null ? objGetExpandRefs.booleanValue() : false;
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
index eb82f03..e87cc5d 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EarFacetInstallDataModelProvider.java
@@ -16,14 +16,20 @@
import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
import org.eclipse.jst.j2ee.project.facet.J2EEFacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
import org.eclipse.osgi.util.NLS;
@@ -44,6 +50,24 @@
if (propertyName.equals(FACET_ID)) {
return ENTERPRISE_APPLICATION;
} else if (propertyName.equals(CONTENT_DIR)) {
+ if (model.isPropertySet(FACET_PROJECT_NAME))
+ {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME);
+ IProject project = (projectName.length() > 0) ? ResourcesPlugin.getWorkspace().getRoot().getProject(projectName) : null;
+
+ if (project != null && project.exists()) {
+ if (ModuleCoreNature.isFlexibleProject(project))
+ {
+ IVirtualComponent c = ComponentCore.createComponent(project, true);
+ IVirtualFolder ejbroot = c.getRootFolder();
+ IPath configFolderPath = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(ejbroot);
+ if (configFolderPath != null && project.getFolder(configFolderPath).exists())
+ {
+ return configFolderPath.toString();
+ }
+ }
+ }
+ }
return J2EEPlugin.getDefault().getJ2EEPreferences().getString(J2EEPreferences.Keys.APPLICATION_CONTENT_FOLDER);
} else if (propertyName.equals(J2EE_PROJECTS_LIST) || propertyName.equals(JAVA_PROJECT_LIST)) {
return Collections.EMPTY_LIST;
@@ -86,4 +110,16 @@
protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version) {
return J2EEVersionUtil.convertVersionStringToInt(version.getVersionString());
}
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if (FACET_PROJECT_NAME.equals(propertyName))
+ {
+ if (!model.isPropertySet(CONTENT_DIR)) {
+ model.notifyPropertyChange(CONTENT_DIR, IDataModel.DEFAULT_CHG);
+ }
+ }
+
+ return super.propertySet(propertyName, propertyValue);
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
index 9ae043a..04fd949 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/EarFacetInstallDelegate.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2005 BEA Systems, Inc.
+ * Copyright (c) 2005, 2011 BEA Systems, Inc. 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Konstantin Komissarchik - initial API and implementation
+ * Roberto Sanchez (IBM) - Set default deployment descriptor folder
******************************************************************************/
package org.eclipse.jst.j2ee.project.facet;
@@ -24,6 +25,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.common.project.facet.WtpUtils;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
@@ -60,7 +62,9 @@
c.create(0, null);
final IVirtualFolder earroot = c.getRootFolder();
- earroot.createLink(new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$
+ Path contentDirPath = new Path(model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR));
+ earroot.createLink(contentDirPath, 0, null);
+ J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(earroot, contentDirPath, null);
try {
((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
index 7342930..1c95720 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 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
@@ -22,6 +22,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
@@ -49,12 +50,14 @@
import org.eclipse.wst.common.componentcore.internal.resources.VirtualReference;
import org.eclipse.wst.common.componentcore.internal.util.IComponentImplFactory;
import org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities;
+import org.eclipse.wst.common.componentcore.resources.ITaggedVirtualResource;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
public class J2EEModuleVirtualComponent extends VirtualComponent implements IComponentImplFactory, IClasspathDependencyProvider, IClasspathDependencyReceiver {
+ public static final String DD_FOLDER_TAG = org.eclipse.wst.common.componentcore.internal.WorkbenchComponent.DEFAULT_ROOT_SOURCE_TAG;
public static String GET_JAVA_REFS = "GET_JAVA_REFS"; //$NON-NLS-1$
public static String GET_FUZZY_EAR_REFS = "GET_FUZZY_EAR_REFS"; //$NON-NLS-1$
public static String GET_EXPANDED_LIB_REFS = "GET_EXPANDED_LIB_REFS"; //$NON-NLS-1$
@@ -139,6 +142,9 @@
if( val != null ) {
if( HARD_REFERENCES.equals(val) || NON_DERIVED_REFERENCES.equals(val) || DISPLAYABLE_REFERENCES.equals(val)){
return getHardReferences();
+ } else if(DISPLAYABLE_REFERENCES_ALL.equals(val)){
+ checkIfStillValid(); // This will clear the cache of raw references if needed.
+ return getAllReferences();
} else if (ONLY_MANIFEST_REFERENCES.equals(val)){
ArrayList<IVirtualReference> all = new ArrayList<IVirtualReference>();
checkIfStillValid();
@@ -515,4 +521,26 @@
}
return new Path("/"); //$NON-NLS-1$
}
+
+ public static void setDefaultDeploymentDescriptorFolder(IVirtualFolder folder, IPath aProjectRelativeLocation, IProgressMonitor monitor) {
+ if (folder instanceof ITaggedVirtualResource){
+ ITaggedVirtualResource taggedFolder = (ITaggedVirtualResource)folder;
+ //First, remove tag is there is already one folder already tagged
+ IPath[] paths = taggedFolder.getTaggedResources(DD_FOLDER_TAG);
+ for (IPath path:paths){
+ taggedFolder.tagResource(path, null, monitor);
+ }
+ // Now, tag the correct path
+ ((ITaggedVirtualResource)folder).tagResource(aProjectRelativeLocation, DD_FOLDER_TAG, monitor);
+ }
+ }
+
+ public static IPath getDefaultDeploymentDescriptorFolder(IVirtualFolder folder) {
+ IPath returnValue = null;
+ if (folder instanceof ITaggedVirtualResource){
+ returnValue = ((ITaggedVirtualResource)folder).getFirstTaggedResource(DD_FOLDER_TAG);
+ }
+ return returnValue;
+ }
+
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/WebUtilities.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/WebUtilities.java
index a66b3c1..6c6fdee 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/WebUtilities.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/WebUtilities.java
@@ -22,7 +22,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.XMLResource;
@@ -108,7 +110,7 @@
IVirtualReference[] refComponents = webComponent.getReferences(options);
for(IVirtualReference virtualReference : refComponents){
- if(virtualReference.getRuntimePath().equals(WEBLIB)){
+ if(virtualReference.getRuntimePath().equals(WEBLIB) && !ClasspathDependencyUtil.isClassFolderReference(virtualReference)){
IVirtualComponent virtualComponent = virtualReference.getReferencedComponent();
if(JavaEEProjectUtilities.isWebFragmentProject(virtualComponent)){
result.add(virtualComponent);
@@ -159,7 +161,7 @@
// base path
for (int i = 0; i < refComponents.length; i++) {
IVirtualReference reference = refComponents[i];
- if (reference.getRuntimePath().equals(WEBLIB))
+ if (reference.getRuntimePath().equals(WEBLIB) && !ClasspathDependencyUtil.isClassFolderReference(reference))
result.add(reference);
}
@@ -224,6 +226,29 @@
{
ComponentUtilities.setServerContextRoot(webProject, contextRoot);
}
+ /**
+ * This method will get the context root on the associated workbench module if null is passed for the earProject, or will use the ear to determine the context root.
+ * This context root is used by the server at runtime.
+ *
+ * @param webProject IProject
+ * @param earProject IProject - can be null
+ */
+ public static String getServerContextRoot(IProject webProject,IProject earProject) {
+ String contextRoot = null;
+ if (earProject == null || !JavaEEProjectUtilities.deploymentDescriptorExists(earProject))
+ return ComponentUtilities.getServerContextRoot(webProject);
+ else if (JavaEEProjectUtilities.isEARProject(earProject) && JavaEEProjectUtilities.isDynamicWebProject(webProject)) {
+ EARArtifactEdit edit = null;
+ try {
+ edit = EARArtifactEdit.getEARArtifactEditForRead(earProject);
+ contextRoot = edit.getWebContextRoot(webProject);
+ } finally {
+ if (edit!=null)
+ edit.dispose();
+ }
+ }
+ return contextRoot;
+ }
/**
* Returns all referencing Web projects.
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
index 56338f1..236d17a 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
@@ -15,6 +15,7 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -39,6 +40,7 @@
public class J2EEFacetProjectCreationDataModelProvider extends FacetProjectCreationDataModelProvider implements IJ2EEFacetProjectCreationDataModelProperties {
private static Set<IProjectFacet> MODULE_FACETS = new HashSet<IProjectFacet>();
+ private boolean caseSensitiveFs = EFS.getLocalFileSystem().isCaseSensitive();
static
{
@@ -186,6 +188,10 @@
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME, new Object[]{getStringProperty(EAR_PROJECT_NAME)});
return WTPCommonPlugin.createErrorStatus(errorMessage);
}
+ if (!caseSensitiveFs && getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME).equalsIgnoreCase(getStringProperty(EAR_PROJECT_NAME))) {
+ String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.SAME_MODULE_AND_EAR_NAME_DIFFERENT_CASE, new Object[]{getStringProperty(EAR_PROJECT_NAME)});
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
}
}
return super.validate(propertyName);
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
index d0398b2..c99a51a 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
@@ -32,6 +33,7 @@
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainerUtils;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences.Keys;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.osgi.util.NLS;
@@ -209,6 +211,25 @@
if( config instanceof JavaFacetInstallConfig )
{
this.javaFacetInstallConfig = (JavaFacetInstallConfig) config;
+
+ String providerId = model.getID();
+ if(providerId != "") //$NON-NLS-1$
+ {
+ if (providerId.indexOf("WebFacetInstallDataModelProvider") != -1) //$NON-NLS-1$
+ { this.javaFacetInstallConfig.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.DYN_WEB_OUTPUT_FOLDER))); }
+ else
+ if(providerId.indexOf("EjbFacetInstallDataModelProvider") != -1) //$NON-NLS-1$
+ { this.javaFacetInstallConfig.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.EJB_OUTPUT_FOLDER))); }
+ else
+ if(providerId.indexOf("AppClientFacetInstallDataModelProvider") != -1) //$NON-NLS-1$
+ { this.javaFacetInstallConfig.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.APP_CLIENT_OUTPUT_FOLDER))); }
+ else
+ if(providerId.indexOf("ConnectorFacetInstallDataModelProvider") != -1) //$NON-NLS-1$
+ { this.javaFacetInstallConfig.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getString(Keys.JCA_OUTPUT_FOLDER))); }
+ else
+ if(providerId.indexOf("UtilityFacetInstallDataModelProvider") != -1) //$NON-NLS-1$
+ { this.javaFacetInstallConfig.setDefaultOutputFolder(new Path(J2EEPlugin.getDefault().getJ2EEPreferences().getUtilityOutputFolderName())); }
+ }
}
else
{
diff --git a/plugins/org.eclipse.jst.j2ee/refactor/org/eclipse/jst/j2ee/refactor/operations/ProjectRenameOperation.java b/plugins/org.eclipse.jst.j2ee/refactor/org/eclipse/jst/j2ee/refactor/operations/ProjectRenameOperation.java
index 71b098c..ffab03f 100644
--- a/plugins/org.eclipse.jst.j2ee/refactor/org/eclipse/jst/j2ee/refactor/operations/ProjectRenameOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/refactor/org/eclipse/jst/j2ee/refactor/operations/ProjectRenameOperation.java
@@ -107,8 +107,8 @@
}
final IProject refactoredProject = refactoredMetadata.getProject();
String pType = JavaEEProjectUtilities.getJ2EEProjectType(refactoredProject);
- if(IJ2EEFacetConstants.UTILITY.equals(pType) || "".equals(pType)) { //$NON-NLS-1$
- // skip if a utility project (will not have a ModelProvider and checking logs an error
+ if(IJ2EEFacetConstants.UTILITY.equals(pType) || "".equals(pType) || IJ2EEFacetConstants.STATIC_WEB.equals(pType)) { //$NON-NLS-1$
+ // skip if a utility or static web project (will not have a ModelProvider and checking logs an error
return;
}
final IModelProvider model = ModelProviderManager.getModelProvider(refactoredProject);
diff --git a/plugins/org.eclipse.jst.servlet.ui/.classpath b/plugins/org.eclipse.jst.servlet.ui/.classpath
deleted file mode 100644
index 8ceb3f1..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="servlet_ui"/>
- <classpathentry kind="src" path="property_files"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.jst.servlet.ui/.cvsignore b/plugins/org.eclipse.jst.servlet.ui/.cvsignore
deleted file mode 100644
index a19913c..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-bin
-temp.folder
-build.xml
-servletui.jar
-@dot
-src.zip
-javaCompiler...args
diff --git a/plugins/org.eclipse.jst.servlet.ui/.project b/plugins/org.eclipse.jst.servlet.ui/.project
deleted file mode 100644
index c209be8..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/.project
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jst.servlet.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>
- <nature>com.ibm.etools.ctc.javaprojectnature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 2b256b9..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,52 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.jst.servlet.ui; singleton:=true
-Bundle-Version: 1.1.406.qualifier
-Bundle-Activator: org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin
-Bundle-Vendor: %pluginVendor
-Bundle-Localization: plugin
-Export-Package: org.eclipse.jst.servlet.ui,
- org.eclipse.jst.servlet.ui.internal.actions;x-internal:=true,
- org.eclipse.jst.servlet.ui.internal.deployables;x-internal:=true,
- org.eclipse.jst.servlet.ui.internal.plugin;x-internal:=true,
- org.eclipse.jst.servlet.ui.internal.wizard;x-internal:=true,
- org.eclipse.jst.servlet.ui.project.facet
-Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.workbench;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jface;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jst.j2ee.ui;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.wst.common.frameworks.ui;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.jst.j2ee.core;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.jst.j2ee.web;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.wst.web;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.common.modulecore;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.jem;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.jst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.server.core;bundle-version="[1.0.102,2.0.0)",
- org.eclipse.jst.server.core;bundle-version="[1.0.102,2.0.0)",
- org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.wst.web.ui;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.ui.navigator.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.emf.edit;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.jst.jee.ui;bundle-version="[1.0.100,1.1.0)",
- org.eclipse.wst.common.modulecore.ui;bundle-version="[1.0.0,1.1.0)",
- org.eclipse.jst.common.ui;bundle-version="[1.0.0,1.1.0)",
- org.eclipse.team.cvs.core;bundle-version="[3.3.0,5.0.0)",
- org.eclipse.team.cvs.ui;bundle-version="[3.3.0,5.0.0)",
- org.eclipse.team.core;bundle-version="[3.5.0,5.0.0)",
- org.eclipse.team.ui;bundle-version="[3.5.0,5.0.0)"
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.jst.servlet.ui/build.properties b/plugins/org.eclipse.jst.servlet.ui/build.properties
deleted file mode 100644
index 0d63d85..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.. = servlet_ui/,\
- property_files/
-output.. = bin/
-bin.includes = plugin.xml,\
- .,\
- plugin.properties,\
- icons/,\
- META-INF/,\
- about.html
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newWebFragmentProject.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newWebFragmentProject.gif
deleted file mode 100644
index 9bebd32..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newWebFragmentProject.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newfilter_wiz.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newfilter_wiz.gif
deleted file mode 100644
index 06cafc3..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newfilter_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newlistener_wiz.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newlistener_wiz.gif
deleted file mode 100644
index 09f2a89..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/newlistener_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/web-wiz-icon.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/web-wiz-icon.gif
deleted file mode 100644
index b9ac6be..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/web-wiz-icon.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webfragment_wizban.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webfragment_wizban.gif
deleted file mode 100644
index 27f1d1f..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webfragment_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webjava-icon.gif b/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webjava-icon.gif
deleted file mode 100644
index 37cb4e7..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/icons/full/ctool16/webjava-icon.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.jst.servlet.ui/plugin.properties b/plugins/org.eclipse.jst.servlet.ui/plugin.properties
deleted file mode 100644
index 72f5755..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/plugin.properties
+++ /dev/null
@@ -1,57 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 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
-###############################################################################
-
-pluginName=WTP Servlet UI Plug-in
-pluginVendor=Eclipse Web Tools Platform
-create.web.module_ui_=Create a J2EE Web Module
-create.web.project_ui_=Create a J2EE Web module
-web.actions.description_ui_=Actions for J2EE Web Development
-create_servlet_ui_=Create Java Servlet file
-war.import.description_ui_=Import an external WAR file into an Web project
-war.import.action.description_ui_=Import WAR File...
-war.export.description_ui_=Export a Web project into a WAR file
-war.export.action.description_ui_=Export WAR File...
-WarexportWizard.name=WAR file
-WarexportWizard.description=Export a Web Module into an external WAR file
-WarImportWizard.name=WAR file
-WarImportWizard.description=Import an external WAR file into a Web Project
-web.category_ui_=Web
-web.project_ui_=Dynamic Web Project
-static.web.project_ui_=Static Web Project
-new.web.project.description_ui_=Create a Dynamic Web project
-ConvertWebProjectType=Convert Web Project
-convertWebProjectTypeAction.label=Convert to a Dynamic Web project...
-ConvertWebProjectTypeAction.tooltip=Web Module Conversion Wizard
-convertToDynamic=Convert to Web Module...
-ServletWebRegionWizard.name=Servlet
-ServletWebRegionWizard.description=Create a new Servlet
-ServletWebRegionWizard.title=New Servlet
-Servlet_UI_=Servlet...
-FilterWebRegionWizard.name=Filter
-FilterWebRegionWizard.description=Create a new Filter
-servletAnnotationDecorator=Servlet Annotation Decorator
-servletAnnotationDecorator.description=Adds a decorator to an annotated servlet.
-web-project-wizard-name = Web Project
-web-project-wizard-description = Create a Web project
-webAppLibrariesContainerName = Web App Libraries
-
-ListenerWebRegionWizard.name=Listener
-ListenerWebRegionWizard.description=Create a new Application Lifecycle Listener
-
-enhanced.java.for.web.name=Enhanced Java Rendering for Web
-j2ee=Java EE
-j2ee.actions.description_ui_=Actions for J2EE Development
-webFragmentProjectUI=Web Fragment Project
-webFragmentProjectUI_desc=Create a new Web Fragment Project
-Project=Project
-
-CompressedJavaProjectCVSDecorator.name=Virtual Nodes Java Project CVS Decorator
-CompressedJavaProjectCVSDecorator.desc=Shows CVS specific information on virtual nodes as the "Java Resources" in projects under CVS control.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.servlet.ui/plugin.xml b/plugins/org.eclipse.jst.servlet.ui/plugin.xml
deleted file mode 100644
index 588ecee..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/plugin.xml
+++ /dev/null
@@ -1,512 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <!-- Create Java EE Projects drop down toolbar button -->
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="%j2ee"
- description="%j2ee.actions.description_ui_"
- visible="false"
- id="org.eclipse.jst.j2ee.J2eeMainActionSet">
- <action
- id="org.eclipse.jst.j2ee.internal.actions.NewJavaEEArtifact"
- toolbarPath="J2EEMain"
- class="org.eclipse.jst.j2ee.internal.actions.NewJavaEEArtifactDropDownAction"
- icon="icons/full/ctool16/newservlet_wiz.gif"
- label="%ServletWebRegionWizard.name"
- style="pulldown"
- tooltip="%ServletWebRegionWizard.description" />
- <action
- id="org.eclipse.jst.j2ee.internal.actions.NewJavaEEProject"
- toolbarPath="J2EEMain"
- class="org.eclipse.jst.j2ee.internal.actions.NewJavaEEProjectDropDownAction"
- icon="icons/full/ctool16/newwar_wiz.gif"
- label="%web.project_ui_"
- style="pulldown"
- tooltip="%new.web.project.description_ui_" />
- </actionSet>
- </extension>
-
- <extension
- id="J2EEUIProjectWizards"
- point="org.eclipse.ui.newWizards">
- <category
- name="%web.category_ui_"
- id="org.eclipse.wst.web.ui">
- </category>
- <wizard
- name="%webFragmentProjectUI"
- icon="icons/full/ctool16/newWebFragmentProject.gif"
- category="org.eclipse.wst.web.ui"
- project="true"
- finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
- id="org.eclipse.jst.servlet.ui.project.facet.WebFragmentProjectWizard">
- <class class="org.eclipse.jst.servlet.ui.project.facet.WebFragmentProjectWizard">
- <parameter name="javaeeproject" value="true"/>
- <parameter name="menuIndex" value="15" />
- </class>
- <description>
- %webFragmentProjectUI_desc
- </description>
- <selection
- class="org.eclipse.core.resources.IResource" />
- </wizard>
- </extension>
-
- <!-- Web Module Wizard -->
- <extension
- id="J2EEUIProjectWizards"
- point="org.eclipse.ui.newWizards">
- <category
- name="%web.category_ui_"
- id="org.eclipse.wst.web.ui">
- </category>
- <wizard
- name="%web.project_ui_"
- icon="icons/full/ctool16/newwar_wiz.gif"
- category="org.eclipse.wst.web.ui"
- project="true"
- finalPerspective="org.eclipse.jst.j2ee.J2EEPerspective"
- id="org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard">
- <class class="org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard">
- <parameter name="javaeeproject" value="true"/>
- <parameter name="menuIndex" value="10" />
- </class>
- <description>
- %new.web.project.description_ui_
- </description>
- <selection
- class="org.eclipse.core.resources.IResource" />
- </wizard>
-
- <!--new servlet contribution-->
- <wizard
- name="%ServletWebRegionWizard.name"
- icon="icons/full/ctool16/newservlet_wiz.gif"
- category="org.eclipse.wst.web.ui"
- id="org.eclipse.jst.servlet.ui.internal.wizard.AddServletWizard">
- <class class="org.eclipse.jst.servlet.ui.internal.wizard.AddServletWizard">
- <parameter name="javaeeartifact" value="true"/>
- <parameter name="menuIndex" value="10" />
- </class>
- <description>
- %ServletWebRegionWizard.description
- </description>
- </wizard>
-
- <!--new filter contribution-->
- <wizard
- category="org.eclipse.wst.web.ui"
- icon="icons/full/ctool16/newfilter_wiz.gif"
- id="org.eclipse.jst.servlet.ui.internal.wizard.AddFilterWizard"
- name="%FilterWebRegionWizard.name">
- <class class="org.eclipse.jst.servlet.ui.internal.wizard.AddFilterWizard">
- <parameter name="javaeeartifact" value="true"/>
- <parameter name="menuIndex" value="20" />
- </class>
- <description>
- %FilterWebRegionWizard.description
- </description>
- </wizard>
-
- <!--new listener contribution-->
- <wizard
- name="%ListenerWebRegionWizard.name"
- icon="icons/full/ctool16/newlistener_wiz.gif"
- category="org.eclipse.wst.web.ui"
- id="org.eclipse.jst.servlet.ui.internal.wizard.AddListenerWizard">
- <class class="org.eclipse.jst.servlet.ui.internal.wizard.AddListenerWizard">
- <parameter name="javaeeartifact" value="true"/>
- <parameter name="menuIndex" value="30" />
- </class>
- <description>
- %ListenerWebRegionWizard.description
- </description>
- </wizard>
- </extension>
-
- <extension
- point="org.eclipse.ui.importWizards">
- <category
- name="%web.category_ui_"
- id="org.eclipse.wst.web.ui">
- </category>
- <wizard
- name="%WarImportWizard.name"
- icon="icons/full/ctool16/importwar_wiz.gif"
- class="org.eclipse.jst.servlet.ui.internal.wizard.WebComponentImportWizard"
- category="org.eclipse.wst.web.ui"
- id="org.eclipse.jst.servlet.ui.internal.wizard.WebComponentImportWizard">
- <description>
- %WarImportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
-
- </extension>
-
- <extension
- point="org.eclipse.ui.exportWizards">
- <category
- name="%web.category_ui_"
- id="org.eclipse.wst.web.ui">
- </category>
- <wizard
- name="%WarexportWizard.name"
- icon="icons/full/ctool16/exportwar_wiz.gif"
- class="org.eclipse.jst.servlet.ui.internal.wizard.WebComponentExportWizard"
- category="org.eclipse.wst.web.ui"
- id="org.eclipse.jst.servlet.ui.internal.wizard.WebComponentExportWizard">
- <description>
- %WarexportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- </extension>
-
- <extension
- point="org.eclipse.wst.common.frameworks.ui.extendableWizard">
- <extendableWizard
- id="org.eclipse.jst.servlet.ui.WebModuleCreationWizard">
- </extendableWizard>
- </extension>
-
-
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- id = "convertToWebModuleTypeAction">
- <menu
- label="%static.web.project_ui_"
- path="additions"
- id="ConvertWebProjectType">
- <separator
- name="ConvertWebProjectType">
- </separator>
- </menu>
- <action
- label="%convertWebProjectTypeAction.label"
- tooltip="%ConvertWebProjectTypeAction.tooltip"
- menubarPath="org.eclipse.ui.projectConfigure/additions"
- class="org.eclipse.jst.servlet.ui.internal.actions.ConvertToWebModuleTypeAction"
- enablesFor="1"
- id="convertToWebModuleTypeAction">
- </action>
- <enablement>
- <adapt type="org.eclipse.core.resources.IProject">
- <test forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="wst.web" />
- </adapt>
- </enablement>
- </objectContribution>
- </extension>
-
- <!-- ==================================================================== -->
-<!-- Extension point: org.eclipse.etools.server.core.moduleObjectAdapters -->
-<!-- Purpose: Define adapters for Web resources -->
-<!-- ==================================================================== -->
- <extension point="org.eclipse.wst.server.core.moduleArtifactAdapters">
-
- <moduleArtifactAdapter
- id="org.eclipse.jst.web.server.webresource"
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory">
- <enablement>
- <with variable="selection">
- <adapt type="org.eclipse.jst.j2ee.webapplication.WebApp"/>
- </with>
- </enablement>
- </moduleArtifactAdapter>
-
- <moduleArtifactAdapter
- id="org.eclipse.jst.web.server.webresource2"
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory">
- <enablement>
- <with variable="selection">
- <adapt type="org.eclipse.jst.server.core.Servlet"/>
- </with>
- </enablement>
- </moduleArtifactAdapter>
-
- <moduleArtifactAdapter
- id="org.eclipse.jst.web.server.webresource3"
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory">
- <enablement>
- <with variable="selection">
- <adapt type="org.eclipse.core.resources.IProject">
- <test forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jst.web:2.4]" />
- </adapt>
- </with>
- </enablement>
- </moduleArtifactAdapter>
-
- <moduleArtifactAdapter
- id="org.eclipse.jst.web.server.webresource4"
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory">
- <enablement>
- <with variable="selection">
- <adapt type="org.eclipse.core.resources.IFile">
- <test forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jst.web:2.4]" />
- </adapt>
- </with>
- </enablement>
- </moduleArtifactAdapter>
-
- <moduleArtifactAdapter
- id="org.eclipse.jst.web.server.webresource5"
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory">
-
- <enablement>
- <with variable="selection">
- <adapt type="org.eclipse.jdt.core.ICompilationUnit">
- <test forcePluginActivation="true"
- property="org.eclipse.jst.j2ee.common.projectFacet"
- value="jst.web:2.4]" />
- </adapt>
- </with>
- </enablement>
- </moduleArtifactAdapter>
- </extension>
-
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.core.resources.IProject">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.jdt.core.ICompilationUnit">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.core.resources.IFile">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.jst.j2ee.webapplication.Servlet">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.jst.j2ee.webapplication.WebApp">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
- <factory
- class="org.eclipse.jst.servlet.ui.internal.deployables.WebDeployableArtifactAdapterFactory"
- adaptableType="org.eclipse.jst.server.core.Servlet">
- <adapter type= "org.eclipse.debug.ui.actions.ILaunchable"/>
- </factory>
-
- </extension>
-
-<!-- ====================================================== -->
-<!-- Label Decorators -->
-<!-- ====================================================== -->
-
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- lightweight="true"
- adaptable="true"
- label="%servletAnnotationDecorator"
- class="org.eclipse.jst.j2ee.internal.ui.util.AnnotationIconDecorator"
- state="true"
- location="TOP_LEFT"
- id="org.eclipse.jst.j2ee.internal.ui.util.AnnotationIconDecorator_servlet">
- <description>
- %servletAnnotationDecorator.description
- </description>
- <enablement>
- <objectClass
- name="org.eclipse.jst.j2ee.webapplication.Servlet">
- </objectClass>
- </enablement>
- </decorator>
- </extension>
-
- <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
- <wizard-pages action="jst.web.install">
- <page class="org.eclipse.jst.servlet.ui.project.facet.WebFacetInstallPage"/>
- </wizard-pages>
- </extension>
-
- <extension point="org.eclipse.wst.common.project.facet.ui.images">
- <image facet="jst.web" path="icons/war.gif"/>
- </extension>
-
- <extension
- point="org.eclipse.jdt.ui.classpathContainerPage">
- <classpathContainerPage
- name="%webAppLibrariesContainerName"
- class="org.eclipse.jst.servlet.ui.internal.wizard.WebAppLibrariesContainerPage"
- id="org.eclipse.jst.j2ee.internal.web.container">
- </classpathContainerPage>
- </extension>
- <extension
- point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent
- activeByDefault="true"
- contentProvider="org.eclipse.jst.servlet.ui.internal.navigator.WebJavaContentProvider"
- icon="icons/full/ctool16/webjava-icon.gif"
- id="org.eclipse.jst.servlet.ui.EnhancedJavaRendering"
- labelProvider="org.eclipse.jst.servlet.ui.internal.navigator.WebJavaLabelProvider"
- name="%enhanced.java.for.web.name"
- priority="higher">
- <override
- policy="InvokeOnlyIfSuppressedExtAlsoVisibleAndActive"
- suppressedExtensionId="org.eclipse.jdt.java.ui.javaContent"/>
- <triggerPoints>
- <or>
- <and>
- <adapt
- type="org.eclipse.core.resources.IProject">
- <or>
- <test forcePluginActivation="true"
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jst.web" />
- </or>
- </adapt>
- </and>
- <instanceof value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </or>
- </triggerPoints>
- <possibleChildren>
- <or>
- <instanceof value="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProject"/>
- <instanceof value="org.eclipse.jdt.core.IPackageFragmentRoot"/>
- <instanceof value="org.eclipse.jdt.core.IPackageFragment"/>
- <instanceof value="org.eclipse.core.resources.IFolder"/>
- <instanceof value="org.eclipse.jdt.internal.ui.packageview.ClassPathContainer"/>
- <instanceof value="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaLibraries"/>
- </or>
- </possibleChildren>
- <actionProvider
- class="org.eclipse.ui.internal.navigator.resources.actions.NewActionProvider"
- id="org.eclipse.jst.servlet.ui.EnhancedJavaRendering.actions.NewActionProvider">
- <enablement>
- <instanceof
- value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </enablement>
- </actionProvider>
- <commonSorter
- class="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaSorter"
- id="org.eclipse.jst.servlet.ui.EnhancedJavaRendering.sorter">
- <parentExpression>
- <instanceof value="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProject"/>
- </parentExpression>
- </commonSorter>
-
- <commonWizard
- type="new"
- wizardId="org.eclipse.jdt.ui.wizards.NewPackageCreationWizard">
- <enablement>
- <instanceof
- value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </enablement>
- </commonWizard>
- <commonWizard
- type="new"
- wizardId="org.eclipse.jdt.ui.wizards.NewClassCreationWizard">
- <enablement>
- <instanceof
- value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </enablement>
- </commonWizard>
-
- <commonWizard
- type="new"
- wizardId="org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard">
- <enablement>
- <instanceof
- value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </enablement>
- </commonWizard>
- <commonWizard
- type="new"
- wizardId="org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard">
- <enablement>
- <instanceof
- value="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode" />
- </enablement>
- </commonWizard>
- </navigatorContent>
- </extension>
- <extension
- point="org.eclipse.ui.navigator.viewer">
- <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
- <includes>
- <contentExtension pattern="org.eclipse.jst.servlet.ui.EnhancedJavaRendering"/>
- </includes>
- </viewerContentBinding>
- </extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProject"
- class="org.eclipse.jst.servlet.ui.internal.navigator.CompressedNodeAdapterFactory">
- <adapter type="org.eclipse.jdt.core.IJavaProject"/>
- <adapter type="org.eclipse.jdt.core.IJavaElement"/>
- </factory>
- </extension>
-
- <extension
- point="org.eclipse.wst.common.modulecore.ui.moduleDependencyPropertyPage">
- <dependencyPage
- class="org.eclipse.jst.servlet.ui.internal.WebModuleDependencyPageProvider"
- id="org.eclipse.jst.servlet.ui.internal.WebModuleDependencyPageProvider">
- </dependencyPage>
- </extension>
- <extension
- point="org.eclipse.wst.common.modulecore.ui.referenceWizardFragment">
- <referenceFragment
- class="org.eclipse.jst.servlet.ui.internal.CustomWebProjectReferenceWizardFragment"
- hidden="true"
- icon="icons/prj_obj.gif"
- id="org.eclipse.jst.servlet.ui.internal.CustomWebProjectReferenceWizardFragment"
- name="%Project">
- </referenceFragment>
- </extension>
-
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- id="org.eclipse.jst.servlet.ui.internal.navigator.FacetedProjectPropertyTester"
- type="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode"
- namespace="org.eclipse.jst.servlet.ui.navigator"
- properties="projectFacet"
- class="org.eclipse.jst.servlet.ui.internal.navigator.FacetedProjectPropertyTester">
- </propertyTester>
- </extension>
- <!-- **************** Decorator ******************* -->
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- lightweight="true"
- adaptable="true"
- location="BOTTOM_RIGHT"
- label="%CompressedJavaProjectCVSDecorator.name"
- state="true"
- class="org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProjectCVSDecorator"
- id="org.eclipse.jst.servlet.ui.Decorator">
- <description>
- %CompressedJavaProjectCVSDecorator.desc
- </description>
- <enablement>
- <objectClass name="org.eclipse.jst.servlet.ui.internal.navigator.ICompressedNode"/>
- </enablement>
- </decorator>
- </extension>
-</plugin>
diff --git a/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties b/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties
deleted file mode 100644
index 9939c53..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/property_files/web_ui.properties
+++ /dev/null
@@ -1,159 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 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
-###############################################################################
-_0=Failed to find the image "{0}".
-_1=New Dynamic Web Project
-_2=Servlet version:
-_3=Dynamic Web Project
-_4=Create a standalone Dynamic Web project or add it to a new or existing Enterprise Application.
-_5=Web &project:
-_6=WAR file:
-_7=Import a WAR file from the file system
-_8=WAR Import
-_9=WAR Export
-_10=Export Web project to the local file system.
-_11=Context root:
-_12=Convert Simple Web to Web Module
-_13=Convert Simple Web to Web Module.
-_14=WAR Import: Web libraries
-_15=Select the web library jars from the list below to be imported as web library projects. Unselected web libraries will be imported as jars in the WEB-INF/lib directory.
-_16=Select All
-_17=Deselect All
-_18=New Web Fragment Project
-ADD_SERVLET_WIZARD_WINDOW_TITLE=Create Servlet
-ADD_SERVLET_WIZARD_PAGE_TITLE=Create Servlet
-ADD_SERVLET_WIZARD_PAGE_DESC=Enter servlet deployment descriptor specific information.
-
-ADD_FILTER_WIZARD_WINDOW_TITLE=Create Filter
-ADD_FILTER_WIZARD_PAGE_TITLE=Create Filter
-ADD_FILTER_WIZARD_PAGE_DESC=Enter servlet filter deployment descriptor specific information.
-
-ADD_LISTENER_WIZARD_WINDOW_TITLE=Create Listener
-ADD_LISTENER_WIZARD_PAGE_TITLE=Create Listener
-ADD_LISTENER_WIZARD_PAGE_DESC=Select the application lifecycle events to listen to.
-
-DISPATCHER_REQUEST=&REQUEST
-DISPATCHER_FORWARD=&FORWARD
-DISPATCHER_INCLUDE=&INCLUDE
-DISPATCHER_ERROR=&ERROR
-
-DEFAULT_PACKAGE=(default package)
-SELECT_CLASS_TITLE=Select Class
-MAP_CLASS_NAME_TO_CLASS_ERROR_MSG=IWAE0060E Could not uniquely map the class name to a class.
-EMPTY_LIST_MSG=Empty List
-ADD_LABEL=Add
-USE_EXISTING_SERVLET_CLASS=&Use an existing Servlet class or JSP
-USE_EXISTING_FILTER_CLASS=&Use existing Filter class
-USE_EXISTING_LISTENER_CLASS=&Use existing Listener class
-INIT_PARAM_TITLE=Initialization Parameters
-INIT_PARAM_LABEL=Initialization ¶meters:
-URL_MAPPINGS_TITLE=URL Mappings
-URL_MAPPINGS_LABEL=&URL mappings:
-CHOOSE_SERVLET_CLASS=&Choose a JSP file:
-
-NEW_SERVLET_WIZARD_WINDOW_TITLE=New Servlet
-NEW_SERVLET_WIZARD_PAGE_TITLE=Servlet
-NEW_SERVLET_WIZARD_PAGE_DESC=Create a new servlet.
-SERVLET_PACKAGE_LABEL=Java package:
-SERVLET_NAME_LABEL=Servlet name:
-
-NEW_FILTER_WIZARD_WINDOW_TITLE=New Filter
-CHOOSE_FILTER_CLASS=Choose a filter class
-SERVLET_MAPPINGS_LABEL=Servlet mappings:
-FILTER_MAPPINGS_LABEL=Fi<er mappings:
-
-ADD_LISTENER_WIZARD_SERVLET_CONTEXT_EVENTS=Servlet context events
-ADD_LISTENER_WIZARD_HTTP_SESSION_EVENTS=HTTP session events
-ADD_LISTENER_WIZARD_SERVLET_REQUEST_EVENTS=Servlet request events
-ADD_LISTENER_WIZARD_LIFECYCLE=Lifecycle
-ADD_LISTENER_WIZARD_LIFECYCLE_L=&Lifecycle
-ADD_LISTENER_WIZARD_LIFECYCLE_I=L&ifecycle
-ADD_LISTENER_WIZARD_LIFECYCLE_Y=Lifec&ycle
-ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES=Changes to attributes
-ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_C=&Changes to attributes
-ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_H=C&hanges to attributes
-ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_G=Chan&ges to attributes
-ADD_LISTENER_WIZARD_SESSION_MIGRATION=Session &migration
-ADD_LISTENER_WIZARD_OBJECT_BINDING=&Object binding
-
-ADD_BUTTON_LABEL=Add...
-ADD_BUTTON_LABEL_A=&Add...
-ADD_BUTTON_LABEL_D=A&dd...
-EDIT_BUTTON_LABEL=Edit...
-EDIT_BUTTON_LABEL_E=&Edit...
-EDIT_BUTTON_LABEL_T=Edi&t...
-REMOVE_BUTTON_LABEL=Remove
-REMOVE_BUTTON_LABEL_R=&Remove
-REMOVE_BUTTON_LABEL_V=Remo&ve
-URL_PATTERN_TITLE=URL Patterns
-URL_PATTERN_LABEL=&Pattern:
-FOLDER_LABEL=Folder:
-JAVA_PACKAGE_LABEL=Java package:
-CLASS_NAME_LABEL=Class na&me:
-SUPERCLASS_LABEL=&Superclass:
-CONTAINER_SELECTION_DIALOG_TITLE=Container Selection
-CONTAINER_SELECTION_DIALOG_DESC=Choose a Container:
-CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG=Choose the Web Content Folder or its subfolder
-PACKAGE_SELECTION_DIALOG_TITLE=Package Selection
-PACKAGE_SELECTION_DIALOG_DESC=Choose a package:
-PACKAGE_SELECTION_DIALOG_MSG_NONE=No packages to choose from
-SUPERCLASS_SELECTION_DIALOG_TITLE=Superclass Selection
-SUPERCLASS_SELECTION_DIALOG_DESC=Choose a superclass:
-INTERFACE_SELECTION_DIALOG_TITLE=Interface Selection
-INTERFACE_SELECTION_DIALOG_DESC=Choose interfaces:
-INTERFACE_SELECTION_DIALOG_MSG_NONE=''{0}'' added.
-JAVA_CLASS_MODIFIERS_LABEL=Modifiers:
-JAVA_CLASS_PUBLIC_CHECKBOX_LABEL=&Public
-JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL=Abs&tract
-JAVA_CLASS_FINAL_CHECKBOX_LABEL=fina&l
-JAVA_CLASS_INTERFACES_LABEL=&Interfaces:
-JAVA_CLASS_METHOD_STUBS_LABEL=Which method stubs would you like to create?
-JAVA_CLASS_MAIN_CHECKBOX_LABEL=public static void main(String[] args)
-JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL=&Constructors from superclass
-JAVA_CLASS_INHERIT_CHECKBOX_LABEL=In&herited abstract methods
-JAVA_CLASS_BROWER_DIALOG_TITLE=Java Class Browser
-JAVA_CLASS_BROWER_DIALOG_MESSAGE=Browse for a Java class
-
-NAME_TITLE=Name
-NAME_LABEL=Na&me:
-DESCRIPTION_TITLE=Description
-DESCRIPTION_LABEL=De&scription:
-VALUE_TITLE=Value
-VALUE_LABEL=&Value:
-URL_SERVLET_LABEL=URL Pattern / Servlet Name
-DISPATCHERS_LABEL=Dispatchers
-
-BROWSE_BUTTON_LABEL=Bro&wse...
-REMOVE_BUTTON=Remove
-SELECT_ALL_BUTTON=&Select All
-CLEAR_BUTTON=&Deselect All
-
-NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC=Specify class file destination.
-NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC=Specify modifiers, interfaces to implement, and method stubs to generate.
-
-ImportWARAction_UI_=Import Web Module...
-ExportWARAction_UI_=Export WAR file...
-
-NO_WEB_PROJECTS=No Web Projects
-
-SERVLETS =Servlets
-
-WEB_CONT_NAME = WebAppContainerPage
-WEB_CONT_PAGE_TITLE = Web App Libraries Container
-WEB_CONT_PAGE_DESCRIPTION = This container dynamically populates classpath entries from the WEB-INF/lib and WEB-INF/classes directories of a web app.
-WEB_CONT_PAGE_COMP_LABEL = Component:
-WEBCONTENT=Web Content folder:
-
-
-Compressed_Libraries= Libraries
-Compressed_JavaResources= Java Resources{0}
-
-ConvertToWebTitle=Convert to Dynamic Web Project
-SelectWebVersion=Select a Dynamic Web module version:
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/IWebUIContextIds.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/IWebUIContextIds.java
deleted file mode 100644
index caba816..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/IWebUIContextIds.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui;
-
-public interface IWebUIContextIds {
-
-public static final String PLUGIN_SERVLET_UI = "org.eclipse.jst.servlet.ui."; //$NON-NLS-1$
-
- public static final String NEW_DYNAMIC_WEB_PROJECT_PAGE1 = PLUGIN_SERVLET_UI + "webw1000"; //$NON-NLS-1$
- public static final String NEW_DYNAMIC_WEB_PROJECT_PAGE2 = PLUGIN_SERVLET_UI + "webw1100"; //$NON-NLS-1$
- public static final String NEW_DYNAMIC_WEB_PROJECT_PAGE3 = PLUGIN_SERVLET_UI + "webw1200"; //$NON-NLS-1$
-
- public static final String WAR_IMPORT_PAGE1 = PLUGIN_SERVLET_UI + "webi1000"; //$NON-NLS-1$
- public static final String WAR_IMPORT_PAGE2 = PLUGIN_SERVLET_UI + "webi1100"; //$NON-NLS-1$
-
- public static final String WAR_EXPORT_PAGE1 = PLUGIN_SERVLET_UI + "webe1000"; //$NON-NLS-1$
-
- public static final String WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_1 = PLUGIN_SERVLET_UI + "srvw1050"; //$NON-NLS-1$
- public static final String WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_2 = PLUGIN_SERVLET_UI + "srvw1100"; //$NON-NLS-1$
- public static final String WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_3 = PLUGIN_SERVLET_UI + "srvw1200"; //$NON-NLS-1$
-
- public static final String WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_1 = PLUGIN_SERVLET_UI + "lstw1050"; //$NON-NLS-1$
- public static final String WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_2 = PLUGIN_SERVLET_UI + "lstw1100"; //$NON-NLS-1$
- public static final String WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_3 = PLUGIN_SERVLET_UI + "lstw1200"; //$NON-NLS-1$
-
- public static final String WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_1 = PLUGIN_SERVLET_UI + "fltw1050"; //$NON-NLS-1$
- public static final String WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_2 = PLUGIN_SERVLET_UI + "fltw1100"; //$NON-NLS-1$
- public static final String WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_3 = PLUGIN_SERVLET_UI + "fltw1200"; //$NON-NLS-1$
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/CustomWebProjectReferenceWizardFragment.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/CustomWebProjectReferenceWizardFragment.java
deleted file mode 100644
index 347ec9b..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/CustomWebProjectReferenceWizardFragment.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2009 Red Hat 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:
- * Rob Stryker - initial implementation and ongoing maintenance
- * Chuck Bridgham - Ongoing improvements
- * Konstantin Komissarchik - misc. UI cleanup
- ******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.ui.internal.propertypage.ProjectReferenceWizardFragment;
-import org.eclipse.wst.common.componentcore.ui.internal.taskwizard.IWizardHandle;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
-
-public class CustomWebProjectReferenceWizardFragment extends ProjectReferenceWizardFragment {
-
- public CustomWebProjectReferenceWizardFragment() {
- super();
- }
-
- private boolean isWebLib = true;
- private Button button;
-
- @Override
- public Composite createComposite(Composite parent, IWizardHandle handle) {
-
- Composite c = new Composite(parent, SWT.NONE);
-
- final GridLayout gl = new GridLayout();
- gl.marginWidth = 0;
- gl.marginHeight = 0;
-
- c.setLayout(gl);
-
- Composite tableComp = super.createComposite(c, handle);
- tableComp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // make button
- button = new Button(c, SWT.CHECK);
- button.setText(Messages.CustomWebProjectReferenceWizardFragment);
-
- final GridData gd = new GridData();
- gd.horizontalIndent = 5;
- button.setLayoutData(gd);
-
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- public void widgetSelected(SelectionEvent e) {
- handleEdit();
- }
- });
- button.setSelection(true);
-
- return c;
- }
-
- public Composite createTableColumnComposite(Composite parent) {
- Composite aButtonColumn = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- aButtonColumn.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- //data.minimumHeight = 500;
- //data.minimumWidth = 400;
- aButtonColumn.setLayoutData(data);
- return aButtonColumn;
- }
-
- protected void handleEdit() {
- isWebLib = button.getSelection();
- }
-
- @Override
- protected String getArchiveName(IProject proj, IVirtualComponent comp) {
- return super.getArchiveName(proj, comp);
- }
-
- @Override
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < selected.length; i++) {
- IProject proj = selected[i];
- if(JavaEEProjectUtilities.getJ2EEProjectType(proj).equals("")) //$NON-NLS-1$
- J2EEProjectUtilities.createFlexJavaProjectForProjectOperation(proj).execute(monitor, null);
- }
- String location = "/"; //$NON-NLS-1$
- if(isWebLib) location += J2EEConstants.WEB_INF_LIB;
- getTaskModel().putObject(IReferenceWizardConstants.DEFAULT_LIBRARY_LOCATION, location);
- super.performFinish(monitor);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/Messages.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/Messages.java
deleted file mode 100644
index 4add98c..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.jst.servlet.ui.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.jst.servlet.ui.internal.messages"; //$NON-NLS-1$
- public static String DeploymentAssembly;
- public static String WebDeploymentAssembly;
- public static String ManifestEntries;
- public static String CustomWebProjectReferenceWizardFragment;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebDependencyPropertyPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebDependencyPropertyPage.java
deleted file mode 100644
index c53e02f..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebDependencyPropertyPage.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2010 Red Hat 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:
- * Rob Stryker - initial implementation and ongoing maintenance
- * Konstantin Komissarchik - misc. UI cleanup
- ******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.ui.J2EEModuleDependenciesPropertyPage;
-import org.eclipse.jst.j2ee.internal.ui.preferences.Messages;
-import org.eclipse.wst.common.componentcore.internal.impl.TaskModel;
-import org.eclipse.wst.common.componentcore.ui.internal.propertypage.DependencyPageExtensionManager;
-import org.eclipse.wst.common.componentcore.ui.internal.propertypage.DependencyPageExtensionManager.ReferenceExtension;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IReferenceWizardConstants;
-import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
-
-public class WebDependencyPropertyPage extends J2EEModuleDependenciesPropertyPage {
-
- public WebDependencyPropertyPage(IProject project,
- ModuleAssemblyRootPage page) {
- super(project, page);
- }
-
-
- @Override
- protected void createPushButtons() {
- super.createPushButtons();
- }
-
- @Override
- protected void setCustomReferenceWizardProperties(TaskModel model) {
- model.putObject(IReferenceWizardConstants.DEFAULT_LIBRARY_LOCATION, J2EEConstants.WEB_INF_LIB);
- }
-
- @Override
- protected String getModuleAssemblyRootPageDescription() {
- return Messages.WebDependencyPropertyPage_1;
- }
-
- @Override
- protected void filterReferenceTypes( final List<ReferenceExtension> extensions )
- {
- // Replace the default one with our own custom one, in class CustomWebProjectReferenceWizardFragment
-
- for( int i = 0, n = extensions.size(); i < n; i++ )
- {
- final ReferenceExtension ext = extensions.get( i );
-
- if( ext.getId().equals( "org.eclipse.wst.common.componentcore.ui.newProjectReference" ) ) //$NON-NLS-1$
- {
- extensions.set( i, DependencyPageExtensionManager.getManager().findReferenceExtension( "org.eclipse.jst.servlet.ui.internal.CustomWebProjectReferenceWizardFragment" ) ); //$NON-NLS-1$
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebModuleDependencyPageProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebModuleDependencyPageProvider.java
deleted file mode 100644
index 05e08da..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/WebModuleDependencyPageProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2010 Red Hat 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:
- * Rob Stryker - initial implementation and ongoing maintenance
- * Chuck Bridgham - Additional support
- * Konstantin Komissarchik - misc. UI cleanup
- ******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.common.internal.modulecore.util.JavaModuleComponentUtility;
-import org.eclipse.jst.common.ui.internal.assembly.wizard.ManifestModuleDependencyControl;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IDependencyPageProvider;
-import org.eclipse.wst.common.componentcore.ui.propertypage.IModuleDependenciesControl;
-import org.eclipse.wst.common.componentcore.ui.propertypage.ModuleAssemblyRootPage;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class WebModuleDependencyPageProvider implements IDependencyPageProvider {
-
- private IModuleDependenciesControl[] controls;
-
- public boolean canHandle(IFacetedProject project) {
- boolean isWeb = project.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE));
- return isWeb;
- }
-
- /*
- * This now allows extenders to say whether this project is standalone or not
- */
- protected boolean isStandalone(IProject project) {
- return JavaModuleComponentUtility.findParentProjects(project).length == 0;
- }
-
- public IModuleDependenciesControl[] createPages(IFacetedProject project,
- ModuleAssemblyRootPage parent) {
-
- if( isStandalone(project.getProject()))
- return new IModuleDependenciesControl[] {
- new WebDependencyPropertyPage(project.getProject(), parent)};
-
- return new IModuleDependenciesControl[] {
- new WebDependencyPropertyPage(project.getProject(), parent),
- new ManifestModuleDependencyControl(project.getProject(), parent)
- };
- }
-
- public Composite createRootControl(IFacetedProject project,IModuleDependenciesControl[] pages,
- Composite parent) {
-
- if( isStandalone(project.getProject()))
- return pages[0].createContents(parent);
-
- final TabFolder folder = new TabFolder(parent, SWT.LEFT);
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
- folder.setFont(parent.getFont());
-
- // Create the two tabs
- controls = new IModuleDependenciesControl[2];
- controls[0] = pages[0];
- controls[1] = pages[1];
-
- TabItem tab = new TabItem(folder, SWT.NONE);
- tab.setControl(create(controls[0],folder));
- tab.setText(Messages.DeploymentAssembly);
- tab = new TabItem(folder, SWT.NONE);
- tab.setControl(create(controls[1],folder));
- tab.setText(Messages.ManifestEntries);
-
- folder.setSelection(0);
- return folder;
- }
-
- private static Control create( final IModuleDependenciesControl control,
- final Composite parent )
- {
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( new GridLayout() );
- final Composite inner = control.createContents( composite );
- inner.setLayoutData( new GridData( GridData.FILL_BOTH ) );
-
- return composite;
- }
-
- public String getPageTitle(IProject project) {
- return Messages.WebDeploymentAssembly;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java
deleted file mode 100644
index fdf1f51..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.jst.servlet.ui.internal.actions;
-
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IConvertStaticWebToDyamnicDataModelProperties;
-import org.eclipse.jst.servlet.ui.internal.wizard.ConvertToWebModuleTypeDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.web.ui.internal.Logger;
-
-/**
- * Convert a simple static web project to a J2EE Dynamic Web Project
- */
-public class ConvertToWebModuleTypeAction extends Action implements IWorkbenchWindowActionDelegate {
-
- IStructuredSelection fSelection = null;
- IProject project = null;
- IWorkbenchWindow fWindow;
-
- /**
- * ConvertLinksDialog constructor comment.
- */
- public ConvertToWebModuleTypeAction() {
- super();
- }
-
- /**
- * make sure a web project is selected.
- */
- protected boolean isValidProject(IProject aProject) {
- return JavaEEProjectUtilities.isStaticWebProject(aProject);
- }
-
- /**
- * selectionChanged method comment.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- boolean bEnable = false;
- if (selection instanceof IStructuredSelection) {
- fSelection = (IStructuredSelection) selection;
- bEnable = validateSelected(fSelection);
- }
- ((Action) action).setEnabled(bEnable);
- }
-
- /**
- * selectionChanged method comment.
- */
- protected boolean validateSelected(ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
- return false;
-
- fSelection = (IStructuredSelection) selection;
-
- Object selectedProject = fSelection.getFirstElement();
- if (!(selectedProject instanceof IProject))
- return false;
-
- project = (IProject) selectedProject;
- return isValidProject(project);
- }
-
- public void dispose() {
- // Default
- }
-
- public void init(IWorkbenchWindow window) {
- // Default
- }
-
- public void run(IAction action) {
- try {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getWorkbenchWindows()[0];
- ConvertToWebModuleTypeDialog dialog = new ConvertToWebModuleTypeDialog(window.getShell());
- dialog.open();
- if (dialog.getReturnCode() == Window.CANCEL)
- return;
-
- doConvert(ConvertToWebModuleTypeDialog.getSelectedVersion());
-
- } catch (Exception e) {
- Logger.logException(e);
- }
- }
-
- protected void doConvert(String selectedVersion) throws Exception {
-
- IDataModel model = DataModelFactory.createDataModel(IConvertStaticWebToDyamnicDataModelProperties.class);
- model.setProperty(IConvertStaticWebToDyamnicDataModelProperties.PROJECT, project);
- model.setStringProperty(IConvertStaticWebToDyamnicDataModelProperties.CONVERT_TO_WEB_VERSION, ConvertToWebModuleTypeDialog.getSelectedVersion());
- model.getDefaultOperation().execute(new NullProgressMonitor(), null);
-
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/NewWebComponentAction.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/NewWebComponentAction.java
deleted file mode 100644
index 61d934a..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/NewWebComponentAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.actions;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jst.j2ee.internal.actions.AbstractOpenWizardWorkbenchAction;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard;
-import org.eclipse.ui.IWorkbench;
-
-public class NewWebComponentAction extends AbstractOpenWizardWorkbenchAction {
-
- public static String LABEL = WEBUIMessages.WEB_MODULE_WIZ_TITLE;
- private static final String ICON = "war_wiz"; //$NON-NLS-1$
-
- public NewWebComponentAction() {
- super();
- setText(LABEL);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(ICON));
- }
-
- public NewWebComponentAction(IWorkbench workbench, String label, Class[] activatedOnTypes, boolean acceptEmptySelection) {
- super(workbench, label, activatedOnTypes, acceptEmptySelection);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(ICON));
- }
-
- public NewWebComponentAction(IWorkbench workbench, String label, boolean acceptEmptySelection) {
- super(workbench, label, acceptEmptySelection);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(ICON));
- }
-
- @Override
- protected Wizard createWizard() {
- return new WebProjectWizard();
- }
-
- @Override
- protected boolean shouldAcceptElement(Object obj) {
- return true; /* NewGroup.isOnBuildPath(obj) && !NewGroup.isInArchive(obj); */
- }
- @Override
- protected String getDialogText() {
- return null;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java
deleted file mode 100644
index cccad87..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/deployables/WebDeployableArtifactAdapterFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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.jst.servlet.ui.internal.deployables;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.ui.actions.ILaunchable;
-import org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableArtifactUtil;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
-
-public class WebDeployableArtifactAdapterFactory extends ModuleArtifactAdapterDelegate implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- return null;
- }
-
- public Class[] getAdapterList() {
- return new Class[]{ILaunchable.class};
- }
-
-
- @Override
- public IModuleArtifact getModuleArtifact(Object obj) {
- return WebDeployableArtifactUtil.getModuleObject(obj);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/messages.properties b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/messages.properties
deleted file mode 100644
index 4848c4d..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/messages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-CustomWebProjectReferenceWizardFragment=Assemble projects into the &WEB-INF/lib folder of the web application
-DeploymentAssembly=Deplo&yment Assembly
-WebDeploymentAssembly=Web Deployment Assembly
-ManifestEntries=&Manifest Entries
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaLibraries.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaLibraries.java
deleted file mode 100644
index 5363803..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaLibraries.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.swt.graphics.Image;
-
-public class CompressedJavaLibraries implements ICompressedNode {
-
-
- private CompressedJavaProject compressedProject;
- private Image image;
-
- public CompressedJavaLibraries(CompressedJavaProject compressedProject) {
- this.compressedProject = compressedProject;
- }
-
- public Image getImage() {
- if(image == null) {
- image = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_LIBRARY);
- }
- return image;
- }
-
- public String getLabel() {
- return WEBUIMessages.Compressed_Libraries;
- }
-
- public Object[] getChildren(ITreeContentProvider delegateContentProvider) {
-
- List classpathContainers = new ArrayList();
- Object[] delegateChildren = delegateContentProvider.getChildren(compressedProject.getProject());
- for (int i = 0; i < delegateChildren.length; i++) {
- if (delegateChildren[i] instanceof IPackageFragmentRoot) {
- try {
- IClasspathEntry rawClasspathEntry = ((IPackageFragmentRoot) delegateChildren[i]).getRawClasspathEntry();
- if (rawClasspathEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER &&
- rawClasspathEntry.getEntryKind() != IClasspathEntry.CPE_SOURCE)
- classpathContainers.add(delegateChildren[i]);
- } catch (JavaModelException e) {
-
- }
- } else if (!(delegateChildren[i] instanceof IJavaElement) && !(delegateChildren[i] instanceof IResource)) {
- classpathContainers.add(delegateChildren[i]);
- }
- }
- return classpathContainers.toArray();
- }
-
- public CompressedJavaProject getCompressedProject() {
- return compressedProject;
- }
-
- public IJavaElement getJavaElement() {
- return null;
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProject.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProject.java
deleted file mode 100644
index 9c317c2..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProject.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-
-public class CompressedJavaProject implements ICompressedNode, IAdaptable {
-
- private IProject project;
- private CompressedJavaLibraries compressedLibraries;
- private Image image;
-
- public CompressedJavaProject(StructuredViewer viewer, IProject project) {
- this.project = project;
-
- }
-
- public Image getImage() {
- if(image == null)
- image = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_PACKFRAG_ROOT);
- return image;
- }
-
- public String getLabel() {
- return determineLabel();
-
- }
-
- public boolean isFlatteningSourceFolder() {
- return getNonExternalSourceFolders().size() == 1;
- }
-
- private String determineLabel() {
- return NLS.bind(WEBUIMessages.Compressed_JavaResources, ""); //$NON-NLS-1$
- }
-
- public IProject getProject() {
- return project;
- }
-
- public Object[] getChildren(ITreeContentProvider delegateContentProvider) {
-
- List nonExternalSourceFolders = getNonExternalSourceFolders();
- nonExternalSourceFolders.add(getCompressedJavaLibraries());
- return nonExternalSourceFolders.toArray();
- }
-
- public List getNonExternalSourceFolders() {
- List nonExternalSourceFolders = null;
- IPackageFragmentRoot[] sourceFolders;
- try {
- IJavaProject jProject = JavaCore.create(project);
- sourceFolders = jProject.getPackageFragmentRoots();
- nonExternalSourceFolders = new ArrayList(Arrays.asList(sourceFolders));
- for (Iterator iter = nonExternalSourceFolders.iterator(); iter.hasNext();) {
- IPackageFragmentRoot root = (IPackageFragmentRoot) iter.next();
- if (root.isExternal() || root.isArchive() || root.getKind()==IPackageFragmentRoot.K_BINARY)
- iter.remove();
- }
- } catch (JavaModelException e) {
- ServletUIPlugin.log(e);
- }
- return nonExternalSourceFolders != null ? nonExternalSourceFolders : Collections.EMPTY_LIST;
- }
-
- public CompressedJavaLibraries getCompressedJavaLibraries() {
- if(compressedLibraries == null)
- compressedLibraries = new CompressedJavaLibraries(this);
- return compressedLibraries;
-
- }
-
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- public IJavaElement getJavaElement() {
- List nonExternalSourceFolders = getNonExternalSourceFolders();
- if (nonExternalSourceFolders.size() == 1) {
- return (IJavaElement) nonExternalSourceFolders.get(0);
- }
- return JavaCore.create(project);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProjectCVSDecorator.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProjectCVSDecorator.java
deleted file mode 100644
index 822e31b..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaProjectCVSDecorator.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jst.servlet.ui.internal.navigator;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.IDecorationContext;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber;
-import org.eclipse.team.internal.ccvs.ui.CVSDecoration;
-import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.mapping.SynchronizationStateTester;
-import org.osgi.framework.Bundle;
-
-/**
- * CVS Decorator for the "Java Resources" virtual node.
- */
-@SuppressWarnings("restriction")
-public class CompressedJavaProjectCVSDecorator extends CVSLightweightDecorator {
-
- private static final SynchronizationStateTester DEFAULT_TESTER = new SynchronizationStateTester();
-
-
- @Override
- /**
- * This method only decorates the "Java Resources" virtual node.
- * It should be only called by the decorator thread, once it detects a CompressedJavaProject needs to be decorated.
- * @param element
- * @param decoration
- */
- public void decorate(Object element, IDecoration decoration) {
- if (element instanceof org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProject){
- // Get the sync state tester from the context
- SynchronizationStateTester tester = getTester(decoration);
- try {
- if (tester.isDecorationEnabled(element)) {
- // Calculate the decoration for the father of the node
- CVSDecoration cvsDecoration = getDecoration(getElementFatherProject(element), tester);
- // apply the decoration on this node
- cvsDecoration.apply(decoration);
- }
- } catch(CoreException e) {
- ServletUIPlugin.log(e);
- } catch (IllegalStateException e) {
- ServletUIPlugin.log(e);
- // This is thrown by Core if the workspace is in an illegal state
- // If we are not active, ignore it. Otherwise, propagate it.
- // (see bug 78303)
- if (Platform.getBundle(CVSUIPlugin.ID).getState() == Bundle.ACTIVE) {
- if (Platform.getBundle(ServletUIPlugin.PLUGIN_ID).getState() == Bundle.ACTIVE) {
- throw e;
- }
- }
- }
- }
- }
-
- protected IProject getElementFatherProject(Object element) {
- CompressedJavaProject cjp = (CompressedJavaProject) element;
- IProject fatherIproject = cjp.getProject();
- return fatherIproject;
- }
-
- protected SynchronizationStateTester getTester(IDecoration decoration) {
- IDecorationContext context = decoration.getDecorationContext();
- SynchronizationStateTester tester = DEFAULT_TESTER;
- Object property = context.getProperty(SynchronizationStateTester.PROP_TESTER);
- if (property instanceof SynchronizationStateTester) {
- tester = (SynchronizationStateTester) property;
- }
- return tester;
- }
-
- /**
- * This method creates a new CVSDecoration that only decorates the synchronization state.
- * @param element
- * @param tester
- * @return CVSDecoration
- * @throws CoreException
- */
- public static CVSDecoration getDecoration(Object element, SynchronizationStateTester tester) throws CoreException {
- CVSDecoration decoration = new CVSDecoration();
- // this only decorate the synchronization state
- int state = IDiff.NO_CHANGE;
- if (isSupervised(element)) {
- // as taken from CVSDecoration decorate()
- decoration.setHasRemote(true);
- state = getElementCVSState(element, tester);
- decoration.setStateFlags(state);
- } else {
- decoration.setIgnored(true);
- }
- //we cut here, we will not set that this element is decorated, because this decoration is only for a virtual node.
- return decoration;
- }
-
- private static int getElementCVSState(Object element,
- SynchronizationStateTester tester)
- throws CoreException {
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- int state;
- state = tester.getState(element,
- store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY)
- ? IDiff.ADD | IDiff.REMOVE | IDiff.CHANGE | IThreeWayDiff.OUTGOING
- : 0,
- new NullProgressMonitor());
- return state;
- }
-
- /*
- * private method on CVSLightweightDecorator
- */
- protected static IResource[] getTraversalRoots(Object element) throws CoreException {
- Set<IResource> result = new HashSet<IResource>();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null) {
- ResourceTraversal[] traversals = mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- result.add(resource);
- }
- }
- }
- return result.toArray(new IResource[result.size()]);
- }
-
- /*
- * private method on CVSLightweightDecorator
- */
- protected static boolean isSupervised(Object element) throws CoreException {
- IResource[] resources = getTraversalRoots(element);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (getSubscriber().isSupervised(resource))
- return true;
- }
- return false;
- }
-
- /*
- * private method on CVSLightweightDecorator
- */
- protected static CVSWorkspaceSubscriber getSubscriber() {
- return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaSorter.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaSorter.java
deleted file mode 100644
index 4ee9c12..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedJavaSorter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import org.eclipse.jdt.ui.JavaElementSorter;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public class CompressedJavaSorter extends ViewerSorter {
-
- private JavaElementSorter sorter = new JavaElementSorter();
-
- @Override
- public int category(Object element) {
- if(element instanceof CompressedJavaLibraries)
- return 1;
- return 0;
- }
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- if(e1 instanceof CompressedJavaLibraries)
- return 1;
- else if(e2 instanceof CompressedJavaLibraries)
- return -1;
-
- return sorter.compare(viewer, e1, e2);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedNodeAdapterFactory.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedNodeAdapterFactory.java
deleted file mode 100644
index a73b085..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/CompressedNodeAdapterFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-
-//
-public class CompressedNodeAdapterFactory implements IAdapterFactory {
-
- private static final Class IJAVA_PROJECT_CLASS = IJavaProject.class;
- private static final Class IJAVA_ELEMENT_CLASS = IJavaElement.class;
-
- private static final Class[] ADAPTER_LIST = new Class[] { IJAVA_PROJECT_CLASS };
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adaptableObject instanceof CompressedJavaProject) {
- if(adapterType == IJAVA_PROJECT_CLASS) {
- return ((CompressedJavaProject)adaptableObject).getProject();
- } else if (adapterType == IJAVA_ELEMENT_CLASS) {
- return ((CompressedJavaProject)adaptableObject).getJavaElement();
- }
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/FacetedProjectPropertyTester.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/FacetedProjectPropertyTester.java
deleted file mode 100644
index 7acbd73..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/FacetedProjectPropertyTester.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.navigator;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-
-public class FacetedProjectPropertyTester extends PropertyTester
-
-{
- public boolean test( final Object receiver,
- final String property,
- final Object[] args,
- final Object value )
- {
- try
- {
- if( ! ( receiver instanceof ICompressedNode ) )
- {
- return false;
- }
-
- IProject pj = null;
- if (receiver instanceof CompressedJavaProject) {
- pj = ((CompressedJavaProject) receiver).getProject();
- } else if (receiver instanceof CompressedJavaLibraries) {
- pj = ((CompressedJavaLibraries) receiver).getCompressedProject().getProject();
- }
-
- if( pj == null )
- {
- return false;
- }
-
- final String val = (String) value;
- final int colon = val.indexOf( ':' );
-
- final String fid;
- final String vexpr;
-
- if( colon == -1 || colon == val.length() - 1 )
- {
- fid = val;
- vexpr = null;
- }
- else
- {
- fid = val.substring( 0, colon );
- vexpr = val.substring( colon + 1 );
- }
-
- return FacetedProjectFramework.hasProjectFacet( pj, fid, vexpr );
- }
- catch( CoreException e )
- {
- //
- }
-
- return false;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/ICompressedNode.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/ICompressedNode.java
deleted file mode 100644
index 7d1bb73..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/ICompressedNode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- *
- * Provides a simple interface that is used to manipulate the rendering of Java elements to a format
- * that is friendlier for Web Projects.
- *
- */
-public interface ICompressedNode {
- /**
- *
- * @return The image to display for this node.
- */
- public Image getImage();
-
- /**
- *
- * @return The text label to display for this node.
- */
- public String getLabel();
-
- /**
- *
- * @param delegateContentProvider
- * The content provider that should used for any children that I cannot provide
- * children for.
- * @return The children either from me or the delegateContentProvider.
- */
- public Object[] getChildren(ITreeContentProvider delegateContentProvider);
-
- /**
- *
- * @return The Java element associated with this node, if any.
- */
- public IJavaElement getJavaElement();
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaContentProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaContentProvider.java
deleted file mode 100644
index 5a76c85..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaContentProvider.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.navigator;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.CommonViewer;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.INavigatorContentExtension;
-import org.eclipse.ui.navigator.INavigatorContentService;
-import org.eclipse.ui.navigator.IPipelinedTreeContentProvider;
-import org.eclipse.ui.navigator.PipelinedShapeModification;
-import org.eclipse.ui.navigator.PipelinedViewerUpdate;
-
-public class WebJavaContentProvider implements IPipelinedTreeContentProvider {
-
- private static final Object[] NO_CHILDREN = new Object[0];
- private static final String JAVA_EXTENSION_ID = "org.eclipse.jdt.java.ui.javaContent"; //$NON-NLS-1$
-
- /*
- * JDT likes to make it interesting so just one of their viewer types is made internal To avoid
- * the dependency, we use some reflection here to filter the type.
- */
-
- private static Class INTERNAL_CONTAINER_CLASS;
- static {
- try {
- INTERNAL_CONTAINER_CLASS = Class.forName("org.eclipse.jdt.internal.ui.packageview.ClassPathContainer"); //$NON-NLS-1$
- } catch (Throwable t) {
- // ignore if the class has been removed or renamed.
- INTERNAL_CONTAINER_CLASS = null;
- }
- }
-
-
- private CommonViewer commonViewer;
- private ITreeContentProvider delegateContentProvider;
- private final Map compressedNodes = new HashMap();
-
- public void getPipelinedChildren(Object aParent, Set theCurrentChildren) {
- try {
- if (aParent instanceof IProject && ((IProject)aParent).hasNature(JavaCore.NATURE_ID) && JavaEEProjectUtilities.isDynamicWebProject((IProject)aParent)) {
- cleanJavaContribution(theCurrentChildren);
- theCurrentChildren.add(getCompressedNode((IProject)aParent));
- }
- } catch (CoreException e) {
- ServletUIPlugin.log(e);
- }
- }
-
- private void cleanJavaContribution(Set theCurrentChildren) {
- IJavaElement element = null;
- for (Iterator iter = theCurrentChildren.iterator(); iter.hasNext();) {
- Object child = iter.next();
- if (child instanceof IResource && ((element = JavaCore.create((IResource) child)) != null) && element.exists())
- iter.remove();
- else if (child instanceof IJavaElement)
- iter.remove();
- else if (INTERNAL_CONTAINER_CLASS != null && INTERNAL_CONTAINER_CLASS.isInstance(child))
- iter.remove();
- }
- }
-
- private CompressedJavaProject getCompressedNode(IProject project) {
- if (!JavaEEProjectUtilities.isDynamicWebProject(project))
- return null;
- CompressedJavaProject result = (CompressedJavaProject) compressedNodes.get(project);
- if (result == null) {
- compressedNodes.put(project, result = new CompressedJavaProject(commonViewer, project));
- }
- return result;
- }
-
- public void getPipelinedElements(Object anInput, Set theCurrentElements) {
-
- }
-
- public Object getPipelinedParent(Object anObject, Object aSuggestedParent) {
-
- try {
- if (anObject instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot root = (IPackageFragmentRoot) anObject;
- if (!root.isExternal()) {
- if( aSuggestedParent instanceof IJavaProject ) {
- return getCompressedNode( ((IJavaProject) aSuggestedParent).getProject() );
- } else if ( aSuggestedParent instanceof IProject && ((IProject)aSuggestedParent).hasNature(JavaCore.NATURE_ID) && JavaEEProjectUtilities.isDynamicWebProject((IProject)aSuggestedParent) ){
- return getCompressedNode( ((IProject) aSuggestedParent) );
- }
- }
- } else if(INTERNAL_CONTAINER_CLASS.isInstance(anObject)) {
- if( aSuggestedParent instanceof IJavaProject ) {
- return getCompressedNode( ((IJavaProject) aSuggestedParent).getProject() ).getCompressedJavaLibraries();
- } else if ( aSuggestedParent instanceof IProject && ((IProject)aSuggestedParent).hasNature(JavaCore.NATURE_ID) && JavaEEProjectUtilities.isDynamicWebProject((IProject)aSuggestedParent)){
- return getCompressedNode( ((IProject) aSuggestedParent) ).getCompressedJavaLibraries();
- }
- }
- } catch (CoreException e) {
- ServletUIPlugin.log(e);
- }
-
- return null;
- }
-
- public PipelinedShapeModification interceptAdd(PipelinedShapeModification anAddModification) {
- Object parent = anAddModification.getParent();
-
- if (parent instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot sourceFolder = (IPackageFragmentRoot) parent;
- if (JavaEEProjectUtilities.isDynamicWebProject(sourceFolder.getJavaProject().getProject())) {
- CompressedJavaProject compressedNode = getCompressedNode(sourceFolder.getJavaProject().getProject());
- if(compressedNode.isFlatteningSourceFolder()) {
- anAddModification.setParent(compressedNode);
- }
- }
- }
-
- return anAddModification;
- }
-
-
- public PipelinedShapeModification interceptRemove(PipelinedShapeModification aRemoveModification) {
-
- Object parent = aRemoveModification.getParent();
-
- Set children = aRemoveModification.getChildren();
-
- for (Object child : children) {
- if (child instanceof IFolder){
- try {
- IPackageFragment locatePackageFragment = locatePackageFragment((IFolder)child);
- if(locatePackageFragment != null){
- aRemoveModification.getChildren().remove(child);
- aRemoveModification.getChildren().add(locatePackageFragment);
-
- return aRemoveModification;
- }
- } catch (JavaModelException e) {
- }
- }
- }
-
- if (parent instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot sourceFolder = (IPackageFragmentRoot) parent;
- if (JavaEEProjectUtilities.isDynamicWebProject(sourceFolder.getJavaProject().getProject())) {
- CompressedJavaProject compressedNode = getCompressedNode(sourceFolder.getJavaProject().getProject());
- if(compressedNode.isFlatteningSourceFolder()) {
- aRemoveModification.setParent(compressedNode);
- }
- }
-
- }
-
- return aRemoveModification;
- }
-
- private IPackageFragment locatePackageFragment(IFolder child) throws JavaModelException {
- IJavaElement elem = JavaCore.create(child);
- if (elem instanceof IPackageFragment) {
- IPackageFragment packageFragment = (IPackageFragment)elem;
- for (IJavaElement javaElem = packageFragment ; javaElem != null ; javaElem = javaElem.getParent()) {
- if (javaElem instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot)javaElem;
- if (!fragmentRoot.isReadOnly() && !fragmentRoot.isExternal()) {
- return packageFragment;
- }
- }
- }
- }
- return null;
- }
-
- public boolean interceptRefresh(PipelinedViewerUpdate aRefreshSynchronization) {
-
- Set refreshTargets = aRefreshSynchronization.getRefreshTargets();
- for (Iterator iter = refreshTargets.iterator(); iter.hasNext();) {
- Object refreshTarget = iter.next();
- if (refreshTarget instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot sourceFolder = (IPackageFragmentRoot) refreshTarget;
- if (JavaEEProjectUtilities.isDynamicWebProject(sourceFolder.getJavaProject().getProject())) {
- CompressedJavaProject compressedNode = getCompressedNode(sourceFolder.getJavaProject().getProject());
- if(compressedNode.isFlatteningSourceFolder()) {
- iter.remove(); // voids the iter but is okay because we're done with it
- refreshTargets.add(compressedNode);
- return true;
- }
- }
-
- }
- }
-
- return false;
- }
-
-
- public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
- Set refreshTargets = anUpdateSynchronization.getRefreshTargets();
- for (Iterator iter = refreshTargets.iterator(); iter.hasNext();) {
- Object refreshTarget = iter.next();
- if (refreshTarget instanceof IPackageFragmentRoot) {
- IPackageFragmentRoot sourceFolder = (IPackageFragmentRoot) refreshTarget;
- if (sourceFolder.getJavaProject()!=null && sourceFolder.getJavaProject().exists() && sourceFolder.getJavaProject().isOpen() && JavaEEProjectUtilities.isDynamicWebProject(sourceFolder.getJavaProject().getProject())) {
- CompressedJavaProject compressedNode = getCompressedNode(sourceFolder.getJavaProject().getProject());
- if(compressedNode.isFlatteningSourceFolder()) {
- iter.remove(); // voids the iterator; but is okay because we're done with it
- refreshTargets.add(compressedNode);
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- public void init(ICommonContentExtensionSite aSite) {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (delegateContentProvider != null) {
- if (parentElement instanceof CompressedJavaProject) {
- return ((CompressedJavaProject)parentElement).getChildren(delegateContentProvider);
- } else if (parentElement instanceof CompressedJavaLibraries) {
- return ((CompressedJavaLibraries)parentElement).getChildren(delegateContentProvider);
- }
- }
- return NO_CHILDREN;
- }
-
- public Object getParent(Object element) {
- if (element instanceof CompressedJavaProject)
- return ((CompressedJavaProject) element).getProject();
- if (element instanceof CompressedJavaLibraries)
- return ((CompressedJavaLibraries) element).getCompressedProject();
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return (element instanceof CompressedJavaProject || element instanceof CompressedJavaLibraries);
- }
-
- public Object[] getElements(Object inputElement) {
- return NO_CHILDREN;
- }
-
- public void dispose() {
- compressedNodes.clear();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (viewer instanceof CommonViewer) {
- commonViewer = (CommonViewer) viewer;
- INavigatorContentService service = commonViewer.getNavigatorContentService();
- INavigatorContentExtension javaext = service.getContentExtensionById(JAVA_EXTENSION_ID);
- if (javaext != null)
- delegateContentProvider = javaext.getContentProvider();
- compressedNodes.clear();
- }
-
- }
-
- public void restoreState(IMemento aMemento) {
-
- }
-
- public void saveState(IMemento aMemento) {
-
- }
-
- public boolean isClasspathContainer(Object o) {
- return INTERNAL_CONTAINER_CLASS != null && INTERNAL_CONTAINER_CLASS.isInstance(o);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaLabelProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaLabelProvider.java
deleted file mode 100644
index f87ed5d..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/navigator/WebJavaLabelProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.navigator;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.ui.ProblemsLabelDecorator;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-
-public class WebJavaLabelProvider implements ILabelProvider {
-
- private ILabelDecorator decorator = new ProblemsLabelDecorator();
-
- public Image getImage(Object element) {
- Image image = null;
- if(element instanceof ICompressedNode)
- image = ((ICompressedNode)element).getImage();
-
- IJavaElement javaElement = null;
- if(image != null && ( javaElement = ((ICompressedNode)element).getJavaElement()) != null ) {
- image = decorator.decorateImage(image, javaElement);
- }
- return image;
- }
-
- public String getText(Object element) {
- String text = null;
- if(element instanceof ICompressedNode)
- text = ((ICompressedNode)element).getLabel();
-
- IJavaElement javaElement = null;
- if(text != null && ( javaElement = ((ICompressedNode)element).getJavaElement()) != null ) {
- text = decorator.decorateText(text, javaElement);
- }
- return text;
- }
-
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- public void dispose() {
- decorator.dispose();
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
-
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/ServletUIPlugin.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/ServletUIPlugin.java
deleted file mode 100644
index bae2970..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/ServletUIPlugin.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.plugin;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.core.runtime.Platform;
-import java.lang.Throwable;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * @author jlanuti
- *
- */
-public class ServletUIPlugin extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.jst.servlet.ui"; //$NON-NLS-1$
- // The shared instance.
- private static ServletUIPlugin plugin;
-
- /**
- * The constructor.
- */
- public ServletUIPlugin() {
- super();
- plugin = this;
- }
-
-
- /**
- * Returns the shared instance.
- */
- public static ServletUIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- public static void log( final Exception e )
- {
- final String msg = e.getMessage() + ""; //$NON-NLS-1$
- log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e ) );
- }
-
- public static void log( final IStatus status )
- {
- getDefault().getLog().log( status );
- }
-
-
- public static IStatus createStatus(int severity, String message, Throwable exception) {
- return new Status(severity, PLUGIN_ID, message, exception);
- }
-
-
- public static IStatus createStatus(int severity, String message) {
- return createStatus(severity, message, null);
- }
-
-
- public static void logError(Throwable exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
- }
-
-
- public static void logError(CoreException exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java
deleted file mode 100644
index 11626e3..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/plugin/WEBUIMessages.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.plugin;
-
-import org.eclipse.osgi.util.NLS;
-
-
-public class WEBUIMessages extends NLS {
-
- private static final String BUNDLE_NAME = "web_ui";//$NON-NLS-1$
-
- private WEBUIMessages() {
- // Do not instantiate
- }
-
- public static String NEW_SERVLET_WIZARD_PAGE_TITLE;
- public static String FOLDER_LABEL;
- public static String URL_MAPPINGS_TITLE;
- public static String URL_MAPPINGS_LABEL;
- public static String SERVLET_MAPPINGS_LABEL;
- public static String FILTER_MAPPINGS_LABEL;
- public static String URL_SERVLET_LABEL;
- public static String DISPATCHERS_LABEL;
- public static String JAVA_CLASS_MODIFIERS_LABEL;
- public static String SUPERCLASS_LABEL;
- public static String WEB_CONT_PAGE_TITLE;
- public static String SERVLET_PACKAGE_LABEL;
- public static String PACKAGE_SELECTION_DIALOG_MSG_NONE;
- public static String JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL;
- public static String ADD_SERVLET_WIZARD_WINDOW_TITLE;
- public static String ADD_SERVLET_WIZARD_PAGE_TITLE;
- public static String ADD_FILTER_WIZARD_WINDOW_TITLE;
- public static String ADD_FILTER_WIZARD_PAGE_TITLE;
- public static String JAVA_CLASS_MAIN_CHECKBOX_LABEL;
- public static String EMPTY_LIST_MSG;
- public static String ExportWARAction_UI_;
- public static String NO_WEB_PROJECTS;
- public static String INTERFACE_SELECTION_DIALOG_MSG_NONE;
- public static String SUPERCLASS_SELECTION_DIALOG_TITLE;
- public static String PACKAGE_SELECTION_DIALOG_DESC;
- public static String JAVA_CLASS_BROWER_DIALOG_TITLE;
- public static String CONTAINER_SELECTION_DIALOG_DESC;
- public static String NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC;
- public static String JAVA_CLASS_PUBLIC_CHECKBOX_LABEL;
- public static String URL_PATTERN_LABEL;
- public static String CONTAINER_SELECTION_DIALOG_TITLE;
- public static String WEB_CONT_NAME;
- public static String URL_PATTERN_TITLE;
- public static String CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG;
- public static String DESCRIPTION_TITLE;
- public static String DESCRIPTION_LABEL;
- public static String USE_EXISTING_SERVLET_CLASS;
- public static String USE_EXISTING_FILTER_CLASS;
- public static String USE_EXISTING_LISTENER_CLASS;
- public static String JAVA_CLASS_FINAL_CHECKBOX_LABEL;
- public static String INTERFACE_SELECTION_DIALOG_DESC;
- public static String ADD_LABEL;
- public static String ADD_SERVLET_WIZARD_PAGE_DESC;
- public static String ADD_FILTER_WIZARD_PAGE_DESC;
- public static String SELECT_CLASS_TITLE;
- public static String JAVA_CLASS_BROWER_DIALOG_MESSAGE;
- public static String ImportWARAction_UI_;
- public static String _9;
- public static String JAVA_CLASS_METHOD_STUBS_LABEL;
- public static String _8;
- public static String JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL;
- public static String _7;
- public static String SERVLETS;
- public static String _6;
- public static String DEFAULT_PACKAGE;
- public static String _5;
- public static String MAP_CLASS_NAME_TO_CLASS_ERROR_MSG;
- public static String BROWSE_BUTTON_LABEL;
- public static String _4;
- public static String REMOVE_BUTTON;
- public static String _3;
- public static String _2;
- public static String _1;
- public static String INIT_PARAM_TITLE;
- public static String INIT_PARAM_LABEL;
- public static String SERVLET_NAME_LABEL;
- public static String _0;
- public static String CLASS_NAME_LABEL;
- public static String _17;
- public static String _16;
- public static String JAVA_PACKAGE_LABEL;
- public static String _15;
- public static String _14;
- public static String _13;
- public static String PACKAGE_SELECTION_DIALOG_TITLE;
- public static String _12;
- public static String ADD_BUTTON_LABEL;
- public static String ADD_BUTTON_LABEL_A;
- public static String ADD_BUTTON_LABEL_D;
- public static String EDIT_BUTTON_LABEL;
- public static String EDIT_BUTTON_LABEL_E;
- public static String EDIT_BUTTON_LABEL_T;
- public static String _11;
- public static String _10;
- public static String SUPERCLASS_SELECTION_DIALOG_DESC;
- public static String NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC;
- public static String REMOVE_BUTTON_LABEL;
- public static String REMOVE_BUTTON_LABEL_R;
- public static String REMOVE_BUTTON_LABEL_V;
- public static String NEW_SERVLET_WIZARD_WINDOW_TITLE;
- public static String NEW_FILTER_WIZARD_WINDOW_TITLE;
- public static String INTERFACE_SELECTION_DIALOG_TITLE;
- public static String NAME_TITLE;
- public static String NAME_LABEL;
- public static String VALUE_TITLE;
- public static String VALUE_LABEL;
- public static String WEB_CONT_PAGE_COMP_LABEL;
- public static String CHOOSE_SERVLET_CLASS;
- public static String CHOOSE_FILTER_CLASS;
- public static String NEW_SERVLET_WIZARD_PAGE_DESC;
- public static String JAVA_CLASS_INHERIT_CHECKBOX_LABEL;
- public static String WEB_CONT_PAGE_DESCRIPTION;
- public static String JAVA_CLASS_INTERFACES_LABEL;
- public static String WEBCONTENT;
- public static String SELECT_ALL_BUTTON;
- public static String CLEAR_BUTTON;
-
- public static String Compressed_Libraries;
- public static String Compressed_JavaResources;
-
- public static String ConvertToWebTitle;
- public static String SelectWebVersion;
-
- public static String ADD_LISTENER_WIZARD_WINDOW_TITLE;
- public static String ADD_LISTENER_WIZARD_PAGE_TITLE;
- public static String ADD_LISTENER_WIZARD_PAGE_DESC;
- public static String ADD_LISTENER_WIZARD_SERVLET_CONTEXT_EVENTS;
- public static String ADD_LISTENER_WIZARD_HTTP_SESSION_EVENTS;
- public static String ADD_LISTENER_WIZARD_SERVLET_REQUEST_EVENTS;
- public static String ADD_LISTENER_WIZARD_LIFECYCLE;
- public static String ADD_LISTENER_WIZARD_LIFECYCLE_L;
- public static String ADD_LISTENER_WIZARD_LIFECYCLE_I;
- public static String ADD_LISTENER_WIZARD_LIFECYCLE_Y;
- public static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES;
- public static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_C;
- public static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_H;
- public static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_G;
- public static String ADD_LISTENER_WIZARD_SESSION_MIGRATION;
- public static String ADD_LISTENER_WIZARD_OBJECT_BINDING;
-
- public static String DISPATCHER_REQUEST;
- public static String DISPATCHER_FORWARD;
- public static String DISPATCHER_INCLUDE;
- public static String DISPATCHER_ERROR;
- public static String _18;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, WEBUIMessages.class);
- }
-
- public static final String IMAGE_LOAD_ERROR = _0;
- public static final String WEB_MODULE_WIZ_TITLE = _1;
- public static final String WEB_VERSION_LBL = _2;
- public static final String WEB_PROJECT_MAIN_PG_TITLE = _3;
- public static final String WEB_PROJECT_MAIN_PG_DESC = _4;
- public static final String WEB_PROJECT_LBL = _5;
- public static final String WEB_FILE_LBL = _6;
- public static final String WEB_IMPORT_MAIN_PG_DESC = _7;
- public static final String WEB_IMPORT_MAIN_PG_TITLE = _8;
- public static final String WEB_EXPORT_MAIN_PG_TITLE = _9;
- public static final String WEB_EXPORT_MAIN_PG_DESC = _10;
- public static final String WEB_IMPORT_CONTEXT_ROOT = _11;
- public static final String WEB_CONVERT_MAIN_PG_DESC = _12;
- public static final String WEB_CONVERT_MAIN_PG_TITLE = _13;
- public static final String WEB_IMPORT_WEB_LIB_PG_TITLE = _14;
- public static final String WEB_IMPORT_WEB_LIB_PG_DESC = _15;
- public static final String WAR_IMPORT_SELECT_ALL_LIBS_BUTTON = _16;
- public static final String WAR_IMPORT_DESELECT_ALL_LIBS_BUTTON = _17;
- public static final String WEBFRAGMENT_MODULE_WIZ_TITLE = _18;
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddEditFilterMappingDialog.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddEditFilterMappingDialog.java
deleted file mode 100644
index 8ff4e39..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddEditFilterMappingDialog.java
+++ /dev/null
@@ -1,617 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ERROR;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.FORWARD;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.INCLUDE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.REQUEST;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.URL_PATTERN_LABEL;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jst.j2ee.internal.dialogs.TwoArrayQuickSorter;
-import org.eclipse.jst.j2ee.internal.web.operations.FilterMappingItem;
-import org.eclipse.jst.j2ee.internal.web.operations.IFilterMappingItem;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.j2ee.webapplication.Servlet;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionStatusDialog;
-import org.eclipse.ui.internal.layout.CellLayout;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Insert the type's description here.
- * Creation date: (7/30/2001 11:16:36 AM)
- */
-public class AddEditFilterMappingDialog extends SelectionStatusDialog implements SelectionListener {
-
- private static class TypeRenderer extends LabelProvider {
- private final Image SERVLET_ICON =
- ImageDescriptor.createFromURL((URL) WebPlugin.getDefault().getImage("servlet")).createImage(); //$NON-NLS-1$
-
- @Override
- public String getText(Object element) {
- return ((String) element);
- }
-
- @Override
- public Image getImage(Object element) {
- return SERVLET_ICON;
- }
-
- }
-
- public final static int SERVLET = 0;
- public final static int URL_PATTERN = 1;
- protected Button fServletButton;
- protected Button fURLPatternButton;
- protected int fSelection = -1;
- protected PageBook fPageBook = null;
- protected Control fURLPatternControl = null;
- protected Control fServletControl = null;
- protected Composite fChild = null;
- // construction parameters
- protected IRunnableContext fRunnableContext;
- protected ILabelProvider fElementRenderer;
- private Object[] fElements;
- private boolean fIgnoreCase = true;
- private String fUpperListLabel;
-
- // SWT widgets
- private Table fUpperList;
- protected Text fURLText;
- private String[] fServletNames;
- private String[] fRenderedStrings;
- private int dispatchers;
- private Button fRequest;
- private Button fForward;
- private Button fInclude;
- private Button fErorr;
- private IFilterMappingItem selectedItem;
-
- /**
- * MultiSelectFilteredFileSelectionDialog constructor comment.
- * @param parent Shell
- * @param title String
- * @param message String
- * @parent extensions String[]
- * @param allowMultiple boolean
- */
- public AddEditFilterMappingDialog(Shell parent, String title, IProject project,
- List<IFilterMappingItem> elements, IFilterMappingItem item) {
- super(parent);
- selectedItem = item;
- setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
-
- if (title == null)
- setTitle(WebAppEditResourceHandler.getString("File_Selection_UI_")); //$NON-NLS-1$
- else setTitle(title);
-
- Status currStatus = new Status(Status.OK, ServletUIPlugin.PLUGIN_ID, Status.OK, "", null); //$NON-NLS-1$
-
- updateStatus(currStatus);
- fElementRenderer = new TypeRenderer();
- fRunnableContext = ServletUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- try {
- IModelProvider provider = ModelProviderManager.getModelProvider(project);
- Object mObj = provider.getModelObject();
- ArrayList<String> servletsList = new ArrayList<String>();
- if (mObj instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) mObj;
- List<Servlet> servlets = webApp.getServlets();
- for (Servlet servlet : servlets) {
- String servletName = servlet.getServletName();
- if (!servletName.equals(item != null ? item.getName() : null) &&
- isAlreadyAdded(servletName, elements)) continue;
- servletsList.add(servletName);
- }
- } else if (mObj instanceof org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp= (org.eclipse.jst.javaee.web.WebApp) mObj;
- List<org.eclipse.jst.javaee.web.Servlet> servlets = webApp.getServlets();
- for (org.eclipse.jst.javaee.web.Servlet servlet : servlets) {
- String servletName = servlet.getServletName();
- if (!servletName.equals(item != null ? item.getName() : null) &&
- isAlreadyAdded(servletName, elements)) continue;
- servletsList.add(servletName);
- }
- }
-
- fServletNames = servletsList.toArray(new String[servletsList.size()]);
- servletsList = null;
- } catch (Exception e) {
- ServletUIPlugin.log(e);
- }
- }
-
- private boolean isAlreadyAdded(String servlet, List<IFilterMappingItem> elements) {
- for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
- IFilterMappingItem item = (IFilterMappingItem) iterator.next();
- if (item.isServletNameType() && item.getName().equals(servlet))
- return true;
- }
- return false;
- }
-
- /**
- * @private
- */
- @Override
- protected void computeResult() {
- if (fSelection == URL_PATTERN) {
- java.util.List result = new ArrayList(1);
- dispatchers = getDispatchers();
- FilterMappingItem mappingItem =
- new FilterMappingItem(FilterMappingItem.URL_PATTERN, fURLText.getText().trim(),
- dispatchers);
- result.add(mappingItem);
- setResult(result);
- } else {
- String servletName = (String) getWidgetSelection();
- if (servletName == null) {
-// String title = WebAppEditResourceHandler.getString("Select_Class_UI_"); //$NON-NLS-1$ = "Select Class"
-// String message = WebAppEditResourceHandler.getString("Could_not_uniquely_map_the_ERROR_"); //$NON-NLS-1$ = "Could not uniquely map the class name to a class."
-// MessageDialog.openError(getShell(), title, message);
- setResult(null);
- } else {
- dispatchers = getDispatchers();
- java.util.List result = new ArrayList(1);
- FilterMappingItem mappingItem =
- new FilterMappingItem(FilterMappingItem.SERVLET_NAME, servletName, dispatchers);
- result.add(mappingItem);
- setResult(result);
- }
- }
- }
-
- private int getDispatchers() {
- int dispatchers = 0;
- if (fRequest.getSelection()) {
- dispatchers |= IFilterMappingItem.REQUEST;
- }
- if (fForward.getSelection()) {
- dispatchers |= IFilterMappingItem.FORWARD;
- }
- if (fInclude.getSelection()) {
- dispatchers |= IFilterMappingItem.INCLUDE;
- }
- if (fErorr.getSelection()) {
- dispatchers |= IFilterMappingItem.ERROR;
- }
- return dispatchers;
- }
-
- @Override
- public void create() {
- super.create();
- if (selectedItem == null && (fServletNames != null && fServletNames.length > 0)) fSelection = SERVLET;
- updateOkState();
- }
-
- /**
- * Creates and returns the contents of this dialog's
- * button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
- * framework method to populate it. Subclasses may override.
- * </p>
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
-
- layout.numColumns = 2;
-
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite composite2 = new Composite(composite, SWT.NONE);
-
- // create a layout with spacing and margins appropriate for the font size.
- layout = new GridLayout();
- layout.numColumns = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- layout.marginWidth = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING);
-
- composite2.setLayout(layout);
-
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- composite2.setLayoutData(data);
-
- composite2.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- super.createButtonsForButtonBar(composite2);
-
- return composite;
- }
-
- /*
- * @private
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- GridData gd = new GridData();
-
- fChild = new Composite(parent, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- gl.marginHeight = 0;
- fChild.setLayout(gl);
-
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessVerticalSpace = true;
- fChild.setLayoutData(gd);
-
- // Create the Web Type radio buttons and text fields.
- fServletButton = new Button(fChild, SWT.RADIO);
- fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet
- gd = new GridData();
- fServletButton.setLayoutData(gd);
- fServletButton.addSelectionListener(this);
-
- fURLPatternButton = new Button(fChild, SWT.RADIO);
- fURLPatternButton.setText(WebAppEditResourceHandler.getString("URL_pattern_UI_")); //$NON-NLS-1$
- gd = new GridData();
- fURLPatternButton.setLayoutData(gd);
- fURLPatternButton.addSelectionListener(this);
-
- //Create URL Pattern page
- fPageBook = new PageBook(fChild, SWT.NONE);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.horizontalSpan = 2;
- fPageBook.setLayoutData(gd);
-
- Composite composite = new Composite(fPageBook, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- Label messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(URL_PATTERN_LABEL);
-
- fURLText = new Text(composite, SWT.BORDER);
- GridData spec = new GridData();
- spec.grabExcessVerticalSpace = false;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.BEGINNING;
- fURLText.setLayoutData(spec);
- Listener l = new Listener() {
- public void handleEvent(Event evt) {
- updateOkState();
- }
- };
- fURLText.addListener(SWT.Modify, l);
- fURLPatternControl = composite;
-
- //Create Servlet page
- composite = new Composite(fPageBook, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$
-
- fUpperList = createUpperList(composite);
-
- fServletControl = composite;
-
- //Create Dispatchers control
- Group dispatchers = new Group(fChild, SWT.SHADOW_IN);
- dispatchers.setText(WebAppEditResourceHandler.getString("Select_Dispatchers_UI_")); //$NON-NLS-1$
- dispatchers.setLayout(new CellLayout(2).setMargins(10,10).setSpacing(5,5));
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- dispatchers.setLayoutData(gridData);
- fRequest = new Button(dispatchers, SWT.CHECK);
- fRequest.setText(REQUEST);
- fForward = new Button(dispatchers, SWT.CHECK);
- fForward.setText(FORWARD);
- fInclude = new Button(dispatchers, SWT.CHECK);
- fInclude.setText(INCLUDE);
- fErorr = new Button(dispatchers, SWT.CHECK);
- fErorr.setText(ERROR);
-
- if (selectedItem != null) {
- if (selectedItem.isUrlPatternType()) {
- fSelection = URL_PATTERN;
- } else {
- fSelection = SERVLET;
- }
- } else {
- if (fServletNames == null || fServletNames.length == 0) {
- fSelection = URL_PATTERN;
- }
- }
- updateUpperListWidget();
-
- fServletButton.setEnabled(true);
- if (fSelection == URL_PATTERN) {
- fURLPatternButton.setSelection(true);
- fPageBook.showPage(fURLPatternControl);
- fServletButton.setSelection(false);
- if (fServletNames == null || fServletNames.length == 0) {
- fServletButton.setEnabled(false);
- }
- if (selectedItem != null) {
- fURLText.setText(selectedItem.getName());
- setDispatchers(selectedItem.getDispatchers());
- }
- } else {
- fServletButton.setSelection(true);
- fPageBook.showPage(fServletControl);
- if (selectedItem != null) {
- fUpperList.setSelection(getServletIndex(fUpperList, selectedItem.getName()));
- setDispatchers(selectedItem.getDispatchers());
- }
- }
- updateOkState();
- return parent;
- }
-
- private int getServletIndex(Table list, String name) {
- TableItem[] items = list.getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem tableItem = items[i];
- if (tableItem.getText().equals(name)) return i;
- }
- return -1;
- }
-
- private void setDispatchers(int dispatchers) {
- if ((dispatchers & IFilterMappingItem.REQUEST) > 0) {
- fRequest.setSelection(true);
- }
- if ((dispatchers & IFilterMappingItem.FORWARD) > 0) {
- fForward.setSelection(true);
- }
- if ((dispatchers & IFilterMappingItem.INCLUDE) > 0) {
- fInclude.setSelection(true);
- }
- if ((dispatchers & IFilterMappingItem.ERROR) > 0) {
- fErorr.setSelection(true);
- }
- }
-
- /**
- * Creates the list widget and sets layout data.
- * @return org.eclipse.swt.widgets.List
- */
- private Table createUpperList(Composite parent) {
- if (fUpperListLabel != null)
- (new Label(parent, SWT.NONE)).setText(fUpperListLabel);
-
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
-// list.addListener(SWT.Selection, new Listener() {
-// public void handleEvent(Event evt) {
-// handleUpperSelectionChanged();
-// }
-// });
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleUpperDoubleClick();
- }
- });
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fElementRenderer.dispose();
- }
- });
- GridData spec = new GridData();
- spec.widthHint = convertWidthInCharsToPixels(50);
- spec.heightHint = convertHeightInCharsToPixels(4);
- spec.grabExcessVerticalSpace = true;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- list.setLayoutData(spec);
- return list;
- }
-
- /**
- * @return the ID of the button that is 'pressed' on doubleClick in the lists.
- * By default it is the OK button.
- * Override to change this setting.
- */
- protected int getDefaultButtonID() {
- return IDialogConstants.OK_ID;
- }
-
- public int getSelectedItem() {
- return fSelection;
- }
-
- protected Object getWidgetSelection() {
- int index = fUpperList.getSelectionIndex();
- return index >= 0 ? fElements[index] : null;
- }
-
- protected final void handleLowerDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- protected final void handleLowerSelectionChanged() {
- updateOkState();
- }
-
- protected final void handleUpperDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- @Override
- public int open() {
- if (fServletNames == null || fServletNames.length == 0) {
- fSelection = URL_PATTERN;
- }
-
- setElements(fServletNames);
- setInitialSelections(new Object[] { "" }); //$NON-NLS-1$
- return super.open();
- }
-
- /**
- *
- * @return java.lang.String[]
- * @param p org.eclipse.jface.elements.IIndexedProperty
- */
- private String[] renderStrings(Object[] p) {
- String[] strings = new String[p.length];
- int size = strings.length;
- for (int i = 0; i < size; i++) {
- strings[i] = fElementRenderer.getText(p[i]);
- }
- new TwoArrayQuickSorter(fIgnoreCase).sort(strings, p);
- return strings;
- }
-
- public void setElements(Object[] elements) {
- Object [] innerElements = elements;
- if (innerElements == null){
- innerElements = new Object[0];
- }
- fElements = innerElements;
- fRenderedStrings = renderStrings(fElements);
- }
-
- public void setSelectedItem(int newSelection) {
- fSelection = newSelection;
- }
-
- private void updateOkState() {
- Button okButton = getOkButton();
- if (okButton != null)
- if (fSelection == SERVLET) {
- okButton.setEnabled(getWidgetSelection() != null);
- } else {
- String result = fURLText.getText().trim();
- okButton.setEnabled(result.length() > 0);
- }
- }
-
- private void updateUpperListWidget() {
- fUpperList.setRedraw(false);
- fUpperList.clearAll();
- for (int i = 0; i < fRenderedStrings.length; i++) {
- TableItem ti = new TableItem(fUpperList, SWT.NONE);
- ti.setText(fRenderedStrings[i]);
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- Image img = fElementRenderer.getImage(fRenderedStrings[i]);
- ti.setImage(img);
- }
- if (fUpperList.getItemCount() > 0) {
- fUpperList.setSelection(0);
- }
- fUpperList.setRedraw(true);
- }
-
- /**
- * Sent when default selection occurs in the control.
- * <p>
- * For example, on some platforms default selection occurs
- * in a List when the user double-clicks an item or types
- * return in a Text.
- * </p>
- *
- * @param e an event containing information about the default selection
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
-
- /**
- * Sent when selection occurs in the control.
- * <p>
- * For example, on some platforms selection occurs in
- * a List when the user selects an item or items.
- * </p>
- *
- * @param e an event containing information about the selection
- */
- public void widgetSelected(SelectionEvent e) {
- if (e.widget == fURLPatternButton) {
- fSelection = URL_PATTERN;
- fPageBook.showPage(fURLPatternControl);
- updateOkState();
- } else if (e.widget == fServletButton) {
- fSelection = SERVLET;
- fPageBook.showPage(fServletControl);
- getShell().pack();
- updateOkState();
- } else
- fSelection = -1;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizard.java
deleted file mode 100644
index d87fed9..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizard.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_FILTER_WIZARD_PAGE_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_FILTER_WIZARD_WINDOW_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.web.operations.NewFilterClassDataModelProvider;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * New servlet filter wizard
- */
-public class AddFilterWizard extends NewWebArtifactWizard {
-
- public AddFilterWizard() {
- this(null);
- }
-
- public AddFilterWizard(IDataModel model) {
- super(model);
- }
-
- @Override
- protected String getTitle() {
- return ADD_FILTER_WIZARD_WINDOW_TITLE;
- }
-
- @Override
- protected ImageDescriptor getImage() {
- return getImageFromJ2EEPlugin("newfilter_wiz"); //$NON-NLS-1$
- }
-
- @Override
- public void doAddPages() {
- NewFilterClassWizardPage page1 = new NewFilterClassWizardPage(
- getDataModel(),
- PAGE_ONE,
- NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC,
- ADD_FILTER_WIZARD_PAGE_TITLE,
- J2EEProjectUtilities.DYNAMIC_WEB);
- page1.setInfopopID(IWebUIContextIds.WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_1);
- addPage(page1);
-
- AddFilterWizardPage page2 = new AddFilterWizardPage(getDataModel(), PAGE_TWO);
- page2.setInfopopID(IWebUIContextIds.WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_2);
- addPage(page2);
-
- NewFilterClassOptionsWizardPage page3 = new NewFilterClassOptionsWizardPage(
- getDataModel(),
- PAGE_THREE,
- NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC,
- ADD_FILTER_WIZARD_PAGE_TITLE);
- page3.setInfopopID(IWebUIContextIds.WEBEDITOR_FILTER_PAGE_ADD_FILTER_WIZARD_3);
- addPage(page3);
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new NewFilterClassDataModelProvider();
- }
-
- @Override
- protected void postPerformFinish() throws InvocationTargetException {
- //open new filter class in java editor
- openJavaClass();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java
deleted file mode 100644
index 79ca1ae..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddFilterWizardPage.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_BUTTON_LABEL_A;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_FILTER_WIZARD_PAGE_DESC;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_FILTER_WIZARD_PAGE_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DESCRIPTION_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DESCRIPTION_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.EDIT_BUTTON_LABEL_E;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.INIT_PARAM_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.INIT_PARAM_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NAME_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NAME_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NO_WEB_PROJECTS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.REMOVE_BUTTON_LABEL_R;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.VALUE_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.VALUE_TITLE;
-import static org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties.PROJECT_NAME;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.internal.wizard.StringArrayTableWizardSection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * Filter Wizard Setting Page
- */
-public class AddFilterWizardPage extends DataModelWizardPage {
-
- final static String[] FILTEREXTENSIONS = {"java"}; //$NON-NLS-1$
-
- private Text displayNameText;
-
- FilterMappingsArrayTableWizardSection mappingSection;
-
- public AddFilterWizardPage(IDataModel model, String pageName) {
- super(model, pageName);
- setDescription(ADD_FILTER_WIZARD_PAGE_DESC);
- setTitle(ADD_FILTER_WIZARD_PAGE_TITLE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] { DISPLAY_NAME,
- INIT_PARAM,
- FILTER_MAPPINGS };
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- createNameDescription(composite);
-
- StringArrayTableWizardSectionCallback callback = new StringArrayTableWizardSectionCallback();
- StringArrayTableWizardSection initSection = new StringArrayTableWizardSection(
- composite,
- INIT_PARAM_LABEL,
- INIT_PARAM_TITLE,
- ADD_BUTTON_LABEL_A,
- EDIT_BUTTON_LABEL_E,
- REMOVE_BUTTON_LABEL_R,
- new String[] { NAME_TITLE, VALUE_TITLE, DESCRIPTION_TITLE },
- new String[] { NAME_LABEL, VALUE_LABEL, DESCRIPTION_LABEL },
- null,// WebPlugin.getDefault().getImage("initializ_parameter"),
- model,
- INIT_PARAM);
- initSection.setCallback(callback);
-
- mappingSection = new FilterMappingsArrayTableWizardSection(composite,
- model, FILTER_MAPPINGS);
-
- displayNameText.setFocus();
-
- IStatus projectStatus = validateProjectName();
- if (!projectStatus.isOK()) {
- setErrorMessage(projectStatus.getMessage());
- composite.setEnabled(false);
- }
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected IStatus validateProjectName() {
- // check for empty
- if (model.getStringProperty(PROJECT_NAME) == null || model.getStringProperty(PROJECT_NAME).trim().length() == 0) {
- return WTPCommonPlugin.createErrorStatus(NO_WEB_PROJECTS);
- }
- return WTPCommonPlugin.OK_STATUS;
- }
-
- protected void createNameDescription(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- // display name
- Label displayNameLabel = new Label(composite, SWT.LEFT);
- displayNameLabel.setText(NAME_LABEL);
- displayNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- displayNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- displayNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(displayNameText, DISPLAY_NAME, null);
-
- // description
- Label descLabel = new Label(composite, SWT.LEFT);
- descLabel.setText(DESCRIPTION_LABEL);
- descLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text descText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- descText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(descText, DESCRIPTION, null);
- }
-
- public String getDisplayName() {
- return displayNameText.getText();
- }
-
- @Override
- public boolean canFlipToNextPage() {
- if (model.getBooleanProperty(USE_EXISTING_CLASS))
- return false;
- return super.canFlipToNextPage();
- }
-
- @Override
- protected boolean showValidationErrorsOnEnter() {
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizard.java
deleted file mode 100644
index 1b90021..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizard.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_LISTENER_WIZARD_PAGE_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_LISTENER_WIZARD_WINDOW_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * New application lifecycle listener wizard
- */
-public class AddListenerWizard extends NewWebArtifactWizard {
-
- public AddListenerWizard() {
- this(null);
- }
-
- public AddListenerWizard(IDataModel model) {
- super(model);
- }
-
- @Override
- protected String getTitle() {
- return ADD_LISTENER_WIZARD_WINDOW_TITLE;
- }
-
- @Override
- protected ImageDescriptor getImage() {
- return getImageFromJ2EEPlugin("newlistener_wiz"); //$NON-NLS-1$
- }
-
- @Override
- public void doAddPages() {
- NewListenerClassWizardPage page1 = new NewListenerClassWizardPage(
- getDataModel(),
- PAGE_ONE,
- NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC,
- ADD_LISTENER_WIZARD_PAGE_TITLE, J2EEProjectUtilities.DYNAMIC_WEB);
- page1.setInfopopID(IWebUIContextIds.WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_1);
- addPage(page1);
- AddListenerWizardPage page2 = new AddListenerWizardPage(getDataModel(), PAGE_TWO);
- page2.setInfopopID(IWebUIContextIds.WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_2);
- addPage(page2);
- NewListenerClassOptionsWizardPage page3 = new NewListenerClassOptionsWizardPage(
- getDataModel(),
- PAGE_THREE,
- NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC,
- ADD_LISTENER_WIZARD_PAGE_TITLE);
- page3.setInfopopID(IWebUIContextIds.WEBEDITOR_LISTENER_PAGE_ADD_LISTENER_WIZARD_3);
- addPage(page3);
- }
-
- @Override
- protected void postPerformFinish() throws InvocationTargetException {
- // open new listener class in java editor
- openJavaClass();
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new NewListenerClassDataModelProvider();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java
deleted file mode 100644
index 8b1d3c3..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddListenerWizardPage.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.j2ee.internal.web.operations.NewListenerClassDataModelProvider.LISTENER_INTERFACES;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_BINDING_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_HTTP_SESSION_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_CONTEXT_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.*;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.internal.ui.JavaPluginImages;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-
-public class AddListenerWizardPage extends DataModelWizardPage {
-
- private static final Image IMG_INTERFACE = JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE);
-
- protected ServletDataModelSyncHelper synchHelper;
-
- public AddListenerWizardPage(IDataModel model, String pageName) {
- super(model, pageName);
- setDescription(ADD_LISTENER_WIZARD_PAGE_DESC);
- setTitle(ADD_LISTENER_WIZARD_PAGE_TITLE);
- synchHelper = initializeSynchHelper(model);
- }
-
- @Override
- public ServletDataModelSyncHelper initializeSynchHelper(IDataModel dm) {
- return new ServletDataModelSyncHelper(dm);
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- createServletContextEvents(composite);
- createHttpSessionEvents(composite);
- createServletRequestEvents(composite);
- createSelectAllGroup(composite);
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] {
- INTERFACES
- };
- }
-
- @Override
- protected void enter() {
- super.enter();
- synchHelper.synchUIWithModel(INTERFACES, DataModelEvent.VALUE_CHG);
- }
-
- private void createServletContextEvents(Composite parent) {
- Group group = createGroup(parent, ADD_LISTENER_WIZARD_SERVLET_CONTEXT_EVENTS);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_LIFECYCLE_L,
- QUALIFIED_SERVLET_CONTEXT_LISTENER,
- INTERFACES);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_C,
- QUALIFIED_SERVLET_CONTEXT_ATTRIBUTE_LISTENER,
- INTERFACES);
- }
-
- private void createHttpSessionEvents(Composite parent) {
- Group group = createGroup(parent, ADD_LISTENER_WIZARD_HTTP_SESSION_EVENTS);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_LIFECYCLE_I,
- QUALIFIED_HTTP_SESSION_LISTENER,
- INTERFACES);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_H,
- QUALIFIED_HTTP_SESSION_ATTRIBUTE_LISTENER,
- INTERFACES);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_SESSION_MIGRATION,
- QUALIFIED_HTTP_SESSION_ACTIVATION_LISTENER,
- INTERFACES);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_OBJECT_BINDING,
- QUALIFIED_HTTP_SESSION_BINDING_LISTENER,
- INTERFACES);
- }
-
- private void createServletRequestEvents(Composite parent) {
- Group group = createGroup(parent, ADD_LISTENER_WIZARD_SERVLET_REQUEST_EVENTS);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_LIFECYCLE_Y,
- QUALIFIED_SERVLET_REQUEST_LISTENER,
- INTERFACES);
-
- createEventListenerRow(group,
- ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_G,
- QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER,
- INTERFACES);
- }
-
- private Group createGroup(Composite parent, String text) {
- Group group = new Group(parent, SWT.NONE);
-
- group.setLayout(new GridLayout(3, false));
- group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- group.setText(text);
-
- return group;
- }
-
- private void createEventListenerRow(Composite parent, String event, String listener, String property) {
- createCheckbox(parent, event, listener, property);
- createInterfaceIcon(parent);
- createInterfaceLabel(parent, listener);
- }
-
- private Button createCheckbox(Composite parent, String text, String value, String property) {
- Button button = new Button(parent, SWT.CHECK);
-
- button.setText(text);
- button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
- synchHelper.synchCheckbox(button, value, property, null);
-
- return button;
- }
-
- private Label createInterfaceIcon(Composite parent) {
- GridData data = new GridData();
- data.horizontalIndent = 50;
-
- Label label = new Label(parent, SWT.RIGHT);
- label.setImage(IMG_INTERFACE);
- label.setLayoutData(data);
-
- return label;
- }
-
- private Label createInterfaceLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
-
- label.setText(text);
-
- return label;
- }
-
- private void createSelectAllGroup(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Button selectAll = new Button(composite, SWT.PUSH);
- selectAll.setText(SELECT_ALL_BUTTON);
- selectAll.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectAll();
- }
- });
-
- Button clear = new Button(composite, SWT.PUSH);
- clear.setText(CLEAR_BUTTON);
- clear.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectNone();
- }
- });
- }
-
- private void handleSelectAll() {
- List interfaces = (List) model.getProperty(INTERFACES);
- if (interfaces == null) {
- interfaces = new ArrayList();
- model.setProperty(INTERFACES, interfaces);
- }
-
- for (String iface : LISTENER_INTERFACES) {
- if (!interfaces.contains(iface)) {
- interfaces.add(iface);
- }
- }
-
- synchHelper.synchUIWithModel(INTERFACES, DataModelEvent.VALUE_CHG);
- model.notifyPropertyChange(INTERFACES, DataModelEvent.VALUE_CHG);
- }
-
- private void handleSelectNone() {
- List interfaces = (List) model.getProperty(INTERFACES);
- if (interfaces == null) {
- interfaces = new ArrayList();
- model.setProperty(INTERFACES, interfaces);
- }
-
- interfaces.removeAll(Arrays.asList(LISTENER_INTERFACES));
-
- synchHelper.synchUIWithModel(INTERFACES, DataModelEvent.VALUE_CHG);
- model.notifyPropertyChange(INTERFACES, DataModelEvent.VALUE_CHG);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizard.java
deleted file mode 100644
index b3a35d6..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizard.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_SERVLET_WIZARD_PAGE_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_SERVLET_WIZARD_WINDOW_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.web.operations.NewServletClassDataModelProvider;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * New servlet wizard
- */
-public class AddServletWizard extends NewWebArtifactWizard {
-
- public AddServletWizard() {
- this(null);
- }
-
- public AddServletWizard(IDataModel model) {
- super(model);
- }
-
- @Override
- protected String getTitle() {
- return ADD_SERVLET_WIZARD_WINDOW_TITLE;
- }
-
- @Override
- protected ImageDescriptor getImage() {
- return J2EEUIPlugin.getDefault().getImageDescriptor("newservlet_wiz"); //$NON-NLS-1$
- }
-
- @Override
- public void doAddPages() {
- NewServletClassWizardPage page1 = new NewServletClassWizardPage(
- getDataModel(),
- PAGE_ONE,
- NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC,
- ADD_SERVLET_WIZARD_PAGE_TITLE, J2EEProjectUtilities.DYNAMIC_WEB);
- page1.setInfopopID(IWebUIContextIds.WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_1);
- addPage(page1);
- AddServletWizardPage page2 = new AddServletWizardPage(getDataModel(), PAGE_TWO);
- page2.setInfopopID(IWebUIContextIds.WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_2);
- addPage(page2);
- NewServletClassOptionsWizardPage page3 = new NewServletClassOptionsWizardPage(
- getDataModel(),
- PAGE_THREE,
- NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC,
- ADD_SERVLET_WIZARD_PAGE_TITLE);
- page3.setInfopopID(IWebUIContextIds.WEBEDITOR_SERVLET_PAGE_ADD_SERVLET_WIZARD_3);
- addPage(page3);
- }
-
- @Override
- protected void postPerformFinish() throws InvocationTargetException {
- boolean isServlet = getDataModel().getBooleanProperty(IS_SERVLET_TYPE);
- if (isServlet) {
- // open new servlet class in java editor
- openJavaClass();
- } else {
- // open new jsp file in jsp editor
- openWebFile();
- }
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new NewServletClassDataModelProvider();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java
deleted file mode 100644
index 83fdc45..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AddServletWizardPage.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.INIT_PARAM;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.URL_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_BUTTON_LABEL_A;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_BUTTON_LABEL_D;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_SERVLET_WIZARD_PAGE_DESC;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.ADD_SERVLET_WIZARD_PAGE_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DESCRIPTION_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DESCRIPTION_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.EDIT_BUTTON_LABEL_E;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.EDIT_BUTTON_LABEL_T;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.INIT_PARAM_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.INIT_PARAM_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NAME_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NAME_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NO_WEB_PROJECTS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.REMOVE_BUTTON_LABEL_R;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.REMOVE_BUTTON_LABEL_V;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.URL_MAPPINGS_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.URL_MAPPINGS_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.URL_PATTERN_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.URL_PATTERN_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.VALUE_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.VALUE_TITLE;
-import static org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties.PROJECT_NAME;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.internal.wizard.StringArrayTableWizardSection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
-import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-
-/**
- * Servlet Wizard Setting Page
- */
-public class AddServletWizardPage extends DataModelWizardPage {
- final static String[] JSPEXTENSIONS = {"jsp"}; //$NON-NLS-1$
-
- private Text displayNameText;
-
- private StringArrayTableWizardSection urlSection;
-
- public AddServletWizardPage(IDataModel model, String pageName) {
- super(model, pageName);
- setDescription(ADD_SERVLET_WIZARD_PAGE_DESC);
- this.setTitle(ADD_SERVLET_WIZARD_PAGE_TITLE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jem.util.ui.wizard.WTPWizardPage#getValidationPropertyNames()
- */
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] { DISPLAY_NAME, INIT_PARAM, URL_MAPPINGS };
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 300;
- composite.setLayoutData(data);
-
- createNameDescription(composite);
-
- StringArrayTableWizardSectionCallback callback = new StringArrayTableWizardSectionCallback();
- StringArrayTableWizardSection initSection = new StringArrayTableWizardSection(
- composite,
- INIT_PARAM_LABEL,
- INIT_PARAM_TITLE,
- ADD_BUTTON_LABEL_A,
- EDIT_BUTTON_LABEL_E,
- REMOVE_BUTTON_LABEL_R,
- new String[] { NAME_TITLE, VALUE_TITLE, DESCRIPTION_TITLE },
- new String[] { NAME_LABEL, VALUE_LABEL, DESCRIPTION_LABEL },
- null,// WebPlugin.getDefault().getImage("initializ_parameter"),
- model,
- INIT_PARAM);
- initSection.setCallback(callback);
- urlSection = new StringArrayTableWizardSection(
- composite,
- URL_MAPPINGS_LABEL,
- URL_MAPPINGS_TITLE,
- ADD_BUTTON_LABEL_D,
- EDIT_BUTTON_LABEL_T,
- REMOVE_BUTTON_LABEL_V,
- new String[] { URL_PATTERN_TITLE },
- new String[] { URL_PATTERN_LABEL },
- null,// WebPlugin.getDefault().getImage("url_type"),
- model,
- URL_MAPPINGS);
- urlSection.setCallback(callback);
-
- String text = displayNameText.getText();
- // Set default URL Pattern
- List input = new ArrayList();
- input.add(new String[]{"/" + text}); //$NON-NLS-1$
- if (urlSection != null)
- urlSection.setInput(input);
- displayNameText.setFocus();
-
- IStatus projectStatus = validateProjectName();
- if (!projectStatus.isOK()) {
- setErrorMessage(projectStatus.getMessage());
- composite.setEnabled(false);
- }
- Dialog.applyDialogFont(parent);
- return composite;
- }
-
- protected IStatus validateProjectName() {
- // check for empty
- if (model.getStringProperty(PROJECT_NAME) == null || model.getStringProperty(PROJECT_NAME).trim().length() == 0) {
- return WTPCommonPlugin.createErrorStatus(NO_WEB_PROJECTS);
- }
- return WTPCommonPlugin.OK_STATUS;
- }
-
- protected void createNameDescription(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- // display name
- Label displayNameLabel = new Label(composite, SWT.LEFT);
- displayNameLabel.setText(NAME_LABEL);
- displayNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- displayNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- displayNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- displayNameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String text = displayNameText.getText();
- // Set default URL Pattern
- List input = new ArrayList();
- input.add(new String[]{"/" + text}); //$NON-NLS-1$
- if (urlSection != null)
- urlSection.setInput(input);
- }
-
- });
- synchHelper.synchText(displayNameText, DISPLAY_NAME, null);
-
- // description
- Label descLabel = new Label(composite, SWT.LEFT);
- descLabel.setText(DESCRIPTION_LABEL);
- descLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text descText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- descText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- synchHelper.synchText(descText, DESCRIPTION, null);
- }
-
- public String getDisplayName() {
- return displayNameText.getText();
- }
-
- @Override
- public boolean canFlipToNextPage() {
- if (model.getBooleanProperty(USE_EXISTING_CLASS))
- return false;
- return super.canFlipToNextPage();
- }
-
- @Override
- protected boolean showValidationErrorsOnEnter() {
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AvailableWebLibProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AvailableWebLibProvider.java
deleted file mode 100644
index 8ce5e4a..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/AvailableWebLibProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.wizard.AvailableJarsProvider;
-import org.eclipse.swt.graphics.Image;
-
-public class AvailableWebLibProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- public AvailableWebLibProvider() {
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof ArchiveWrapper) {
- Object[] array = ((ArchiveWrapper) inputElement).getWebLibs().toArray();
- Arrays.sort(array, new Comparator() {
- public int compare(Object o1, Object o2) {
- return getColumnText(o1, 0).compareTo(getColumnText(o2, 0));
- }
-
- });
- return array;
- }
- return new Object[0];
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return AvailableJarsProvider.getUtilImage();
- }
-
- public String getColumnText(Object element, int columnIndex) {
- ArchiveWrapper wrapper = (ArchiveWrapper)element;
- return wrapper.getName();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ConvertToWebModuleTypeDialog.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ConvertToWebModuleTypeDialog.java
deleted file mode 100644
index a6409d0..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ConvertToWebModuleTypeDialog.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class ConvertToWebModuleTypeDialog extends Dialog {
-
- private String fShellTitle = IWebWizardConstants.CONVERT_TO_WEB_TITLE;
- private String fLabelText = IWebWizardConstants.SELECT_WEB_VERSION;
- private static String fSelection= null;
- private String[] fAllowedStrings = new String[] {J2EEVersionConstants.VERSION_2_2_TEXT, J2EEVersionConstants.VERSION_2_3_TEXT, J2EEVersionConstants.VERSION_2_4_TEXT, J2EEVersionConstants.VERSION_2_5_TEXT, J2EEVersionConstants.VERSION_3_0_TEXT};
- private int fInitialSelectionIndex = fAllowedStrings.length-1;
-
- public static String getSelectedVersion() {
- return fSelection;
- }
-
- public ConvertToWebModuleTypeDialog(IShellProvider parentShell) {
- super(parentShell);
- }
-
- public ConvertToWebModuleTypeDialog(Shell parentShell) {
- super(parentShell);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(fShellTitle);
-
- Composite composite = (Composite)super.createDialogArea(parent);
- Composite innerComposite = new Composite(composite, SWT.NONE);
- innerComposite.setLayoutData(new GridData());
- GridLayout gl= new GridLayout();
- gl.numColumns= 2;
- innerComposite.setLayout(gl);
-
- Label label= new Label(innerComposite, SWT.NONE);
- label.setText(fLabelText);
- label.setLayoutData(new GridData());
-
- final Combo combo= new Combo(innerComposite, SWT.READ_ONLY);
- for (int i = 0; i < fAllowedStrings.length; i++) {
- combo.add(fAllowedStrings[i]);
- }
- combo.select(fInitialSelectionIndex);
- fSelection= combo.getItem(combo.getSelectionIndex());
- GridData gd= new GridData();
- combo.setLayoutData(gd);
- combo.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- fSelection= combo.getItem(combo.getSelectionIndex());
- }
- });
- return composite;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/FilterMappingsArrayTableWizardSection.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/FilterMappingsArrayTableWizardSection.java
deleted file mode 100644
index 261d093..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/FilterMappingsArrayTableWizardSection.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.*;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.internal.web.operations.FilterMappingItem;
-import org.eclipse.jst.j2ee.internal.web.operations.IFilterMappingItem;
-import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin;
-import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-
-public class FilterMappingsArrayTableWizardSection extends Composite implements IDataModelListener {
-
- protected class StringArrayListContentProvider implements IStructuredContentProvider {
- public boolean isDeleted(Object element) {
- return false;
- }
- public Object[] getElements(Object element) {
- if (element instanceof List) {
- return ((List<FilterMappingItem>) element).toArray();
- }
- return new Object[0];
- }
- public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
- //Default nothing
- }
- public void dispose() {
- //Default nothing
- }
- }
- protected class StringArrayListLabelProvider extends LabelProvider implements ITableLabelProvider {
- private final Image URL_PATTERN_ICON =
- ImageDescriptor.createFromURL((URL) WebPlugin.getDefault().getImage("url_mapping")).createImage(); //$NON-NLS-1$
- private final Image SERVLET_ICON =
- ImageDescriptor.createFromURL((URL) WebPlugin.getDefault().getImage("servlet")).createImage(); //$NON-NLS-1$
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- FilterMappingItem item = (FilterMappingItem) element;
- if (item.isServletNameType()) {
- return SERVLET_ICON;
- } else if (item.isUrlPatternType()) {
- return URL_PATTERN_ICON;
- }
-
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == 1) {
- return ((FilterMappingItem) element).getName();
- } else if (columnIndex == 2) {
- return ((FilterMappingItem) element).getDispatchersAsString();
- }
- return null;
- }
-
- }
-
- final static int ICON_WIDTH = 25;
- final static int DISPATCHERS_WIDTH = 100;
- private final static String ICON_PROP = "ICON_PROP"; //$NON-NLS-1$
- private final static String NAME_PROP = "NAME_PROP"; //$NON-NLS-1$
- private final static String DISPATCHERS_PROP = "DISPATCHERS_PROP"; //$NON-NLS-1$
-
- private TableViewer viewer;
- private Button addButton;
- private Button editButton;
- private Button removeButton;
- private IDataModel model;
- private String propertyName;
-
- public FilterMappingsArrayTableWizardSection(Composite parent, IDataModel model, String propertyName) {
- super(parent, SWT.NONE);
-
- this.model = model;
- this.propertyName = propertyName;
- model.addListener(this);
-
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 4;
- layout.marginWidth = 0;
- this.setLayout(layout);
- this.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label titleLabel = new Label(this, SWT.LEFT);
- titleLabel.setText(FILTER_MAPPINGS_LABEL);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- titleLabel.setLayoutData(data);
-
- Table table = new Table(this, SWT.FULL_SELECTION | SWT.BORDER);
- viewer = new TableViewer(table);
- table.setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setContentProvider(new StringArrayListContentProvider());
- viewer.setLabelProvider(new StringArrayListLabelProvider());
-
- final Composite buttonCompo = new Composite(this, SWT.NULL);
- layout = new GridLayout();
- layout.marginHeight = 0;
- buttonCompo.setLayout(layout);
- buttonCompo.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
-
- addButton = new Button(buttonCompo, SWT.PUSH);
- addButton.setText(ADD_BUTTON_LABEL_D);
- addButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- addButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleAddButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
-
- editButton = new Button(buttonCompo, SWT.PUSH);
- editButton.setText(EDIT_BUTTON_LABEL_T);
- editButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- editButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleEditButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
- editButton.setEnabled(false);
-
- removeButton = new Button(buttonCompo, SWT.PUSH);
- removeButton.setText(REMOVE_BUTTON_LABEL_V);
- removeButton.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL));
- removeButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- handleRemoveButtonSelected();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- //Do nothing
- }
- });
- removeButton.setEnabled(false);
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (editButton != null) {
- boolean enabled = ((IStructuredSelection) selection).size() == 1;
- editButton.setEnabled(enabled);
- }
- removeButton.setEnabled(!selection.isEmpty());
- }
- });
-
- if (editButton != null) {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleEditButtonSelected();
- }
- });
- }
-
- TableColumn tableColumn = new TableColumn(table, SWT.NONE);
- tableColumn.setWidth(ICON_WIDTH);
- tableColumn.setResizable(false);
- tableColumn = new TableColumn(table, SWT.NONE);
- tableColumn.setText(URL_SERVLET_LABEL);
- tableColumn.setResizable(true);
- tableColumn = new TableColumn(table, SWT.NONE);
- tableColumn.setText(DISPATCHERS_LABEL);
- tableColumn.setWidth(DISPATCHERS_WIDTH);
- tableColumn.setResizable(false);
- viewer.setColumnProperties(new String[] {ICON_PROP, NAME_PROP, DISPATCHERS_PROP});
- table.setHeaderVisible(true);
- this.addControlListener(new ControlAdapter() {
- @Override
- public void controlResized(ControlEvent e) {
- Table table = viewer.getTable();
- TableColumn[] columns = table.getColumns();
- Point buttonArea = buttonCompo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Rectangle area = table.getParent().getClientArea();
- Point preferredSize = viewer.getTable().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int width = area.width - 2*table.getBorderWidth() - buttonArea.x - columns.length*2;
- if (preferredSize.y > area.height + table.getHeaderHeight()) {
- // Subtract the scrollbar width from the total column width
- // if a vertical scrollbar will be required
- Point vBarSize = table.getVerticalBar().getSize();
- width -= vBarSize.x;
- }
- Point oldSize = table.getSize();
- for (int i=0; i < columns.length; i++) {
- if (oldSize.x > area.width) {
- // table is getting smaller so make the columns
- // smaller first and then resize the table to
- // match the client area width
- if (i == 1) columns[i].setWidth(width - ICON_WIDTH - DISPATCHERS_WIDTH);
- table.setSize(area.width - buttonArea.x - columns.length*2, area.height);
- } else {
- // table is getting bigger so make the table
- // bigger first and then make the columns wider
- // to match the client area width
- table.setSize(area.width - buttonArea.x - columns.length*2, area.height);
- if (i == 1) columns[i].setWidth(width - ICON_WIDTH - DISPATCHERS_WIDTH);
- }
- }
- }
- });
-
- viewer.setInput(model.getProperty(propertyName));
- }
-
- private void handleAddButtonSelected() {
- String title = WebAppEditResourceHandler.getString("Add_Filter_Mapping_Title_UI_"); //$NON-NLS-1$
- IProject p = (IProject) model.getProperty(PROJECT);
- List valueList = (List) viewer.getInput();
- AddEditFilterMappingDialog dialog =
- new AddEditFilterMappingDialog(getShell(), title, p, valueList, null);
- dialog.open();
- Object[] result = dialog.getResult();
-
- addFilterMapping((result != null && result.length > 0) ? (IFilterMappingItem) result[0] : null);
- }
-
- private void handleEditButtonSelected() {
- String title = WebAppEditResourceHandler.getString("Edit_Filter_Mapping_Title_UI_"); //$NON-NLS-1$
- ISelection s = viewer.getSelection();
- if (!(s instanceof IStructuredSelection))
- return;
- IStructuredSelection selection = (IStructuredSelection) s;
- if (selection.size() != 1)
- return;
- List valueList = (List) viewer.getInput();
- Object selectedObj = selection.getFirstElement();
- FilterMappingItem value = (FilterMappingItem) selectedObj;
- IProject p = (IProject) model.getProperty(PROJECT);
- AddEditFilterMappingDialog dialog =
- new AddEditFilterMappingDialog(getShell(), title, p, valueList, value);
- dialog.open();
- Object[] result = dialog.getResult();
- if (result == null || result.length == 0) return;
- editFilterMapping(value, (IFilterMappingItem) result[0]);
- }
-
- private void handleRemoveButtonSelected() {
- ISelection selection = viewer.getSelection();
- if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return;
- List selectedObj = ((IStructuredSelection) selection).toList();
- removeFilterMappings(selectedObj);
- }
-
- private void addFilterMapping(IFilterMappingItem filterMapping) {
- if (filterMapping == null) return;
- List valueList = (List) viewer.getInput();
- if (valueList == null) {
- valueList = new ArrayList();
- }
- valueList.add(filterMapping);
- setInput(valueList);
- }
-
- private void editFilterMapping(IFilterMappingItem oldFilterMapping, IFilterMappingItem newFilterMapping) {
- if (newFilterMapping == null) return;
- List valueList = (List) viewer.getInput();
- if (valueList == null) {
- valueList = new ArrayList();
- }
- int index = valueList.indexOf(oldFilterMapping);
- if (index == -1) {
- valueList.add(newFilterMapping);
- } else {
- valueList.set(index, newFilterMapping);
- }
-
- setInput(valueList);
- }
-
- private void removeFilterMappings(Collection selectedFilterMappings) {
- List valueList = (List) viewer.getInput();
- valueList.removeAll(selectedFilterMappings);
- setInput(valueList);
- }
-
- public void setInput(List input) {
- viewer.setInput(input);
- // Create a new list to trigger property change
- List newInput = new ArrayList();
- newInput.addAll(input);
- model.setProperty(propertyName, newInput);
- }
-
- public List getInput() {
- List valueList = (List) viewer.getInput();
- if (valueList == null) {
- valueList = new ArrayList();
- }
- return valueList;
- }
-
- public void propertyChanged(DataModelEvent event) {
- if (this.propertyName.equals(event.getPropertyName())) {
- viewer.setInput(event.getProperty());
- }
- }
-
- @Override
- public void dispose() {
- model.removeListener(this);
- super.dispose();
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java
deleted file mode 100644
index 8b052af..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/IWebWizardConstants.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-
-public interface IWebWizardConstants {
-
- // AddServletWizard
- public final static String ADD_SERVLET_WIZARD_WINDOW_TITLE = WEBUIMessages.ADD_SERVLET_WIZARD_WINDOW_TITLE;
- public final static String ADD_SERVLET_WIZARD_PAGE_TITLE = WEBUIMessages.ADD_SERVLET_WIZARD_PAGE_TITLE;
- public final static String ADD_SERVLET_WIZARD_PAGE_DESC = WEBUIMessages.ADD_SERVLET_WIZARD_PAGE_DESC;
-
- public final static String DEFAULT_PACKAGE = WEBUIMessages.DEFAULT_PACKAGE;
- public final static String SELECT_CLASS_TITLE = WEBUIMessages.SELECT_CLASS_TITLE;
- public final static String MAP_CLASS_NAME_TO_CLASS_ERROR_MSG = WEBUIMessages.MAP_CLASS_NAME_TO_CLASS_ERROR_MSG;
- public final static String EMPTY_LIST_MSG = WEBUIMessages.EMPTY_LIST_MSG;
- public final static String ADD_LABEL = WEBUIMessages.ADD_LABEL;
- public final static String USE_EXISTING_SERVLET_CLASS = WEBUIMessages.USE_EXISTING_SERVLET_CLASS;
- public final static String INIT_PARAM_TITLE = WEBUIMessages.INIT_PARAM_TITLE;
- public final static String INIT_PARAM_LABEL = WEBUIMessages.INIT_PARAM_LABEL;
- public final static String URL_MAPPINGS_TITLE = WEBUIMessages.URL_MAPPINGS_TITLE;
- public final static String URL_MAPPINGS_LABEL = WEBUIMessages.URL_MAPPINGS_LABEL;
- public final static String CHOOSE_SERVLET_CLASS = WEBUIMessages.CHOOSE_SERVLET_CLASS;
-
- // NewServletWizard
- public final static String NEW_SERVLET_WIZARD_WINDOW_TITLE = WEBUIMessages.NEW_SERVLET_WIZARD_WINDOW_TITLE;
- public final static String NEW_SERVLET_WIZARD_PAGE_TITLE = WEBUIMessages.NEW_SERVLET_WIZARD_PAGE_TITLE;
- public final static String NEW_SERVLET_WIZARD_PAGE_DESC = WEBUIMessages.NEW_SERVLET_WIZARD_PAGE_DESC;
- public final static String SERVLET_PACKAGE_LABEL = WEBUIMessages.SERVLET_PACKAGE_LABEL;
- public final static String SERVLET_NAME_LABEL = WEBUIMessages.SERVLET_NAME_LABEL;
-
- // AddFilterWizard
- public final static String ADD_FILTER_WIZARD_WINDOW_TITLE = WEBUIMessages.ADD_FILTER_WIZARD_WINDOW_TITLE;
- public final static String ADD_FILTER_WIZARD_PAGE_TITLE = WEBUIMessages.ADD_FILTER_WIZARD_PAGE_TITLE;
- public final static String ADD_FILTER_WIZARD_PAGE_DESC = WEBUIMessages.ADD_FILTER_WIZARD_PAGE_DESC;
-
- public final static String USE_EXISTING_FILTER_CLASS = WEBUIMessages.USE_EXISTING_FILTER_CLASS;
- public final static String CHOOSE_FILTER_CLASS = WEBUIMessages.CHOOSE_FILTER_CLASS;
- public final static String SERVLET_MAPPINGS_LABEL = WEBUIMessages.SERVLET_MAPPINGS_LABEL;
- public final static String FILTER_MAPPINGS_LABEL = WEBUIMessages.FILTER_MAPPINGS_LABEL;
- public final static String URL_SERVLET_LABEL = WEBUIMessages.URL_SERVLET_LABEL;
- public final static String DISPATCHERS_LABEL = WEBUIMessages.DISPATCHERS_LABEL;
-
- public static String REQUEST = WEBUIMessages.DISPATCHER_REQUEST;
- public static String FORWARD = WEBUIMessages.DISPATCHER_FORWARD;
- public static String INCLUDE = WEBUIMessages.DISPATCHER_INCLUDE;
- public static String ERROR = WEBUIMessages.DISPATCHER_ERROR;
-
- // NewFilterWizard
- public final static String NEW_FILTER_WIZARD_WINDOW_TITLE = WEBUIMessages.NEW_FILTER_WIZARD_WINDOW_TITLE;
-
- // AddListenerWizard
- public final static String ADD_LISTENER_WIZARD_WINDOW_TITLE = WEBUIMessages.ADD_LISTENER_WIZARD_WINDOW_TITLE;
- public final static String ADD_LISTENER_WIZARD_PAGE_TITLE = WEBUIMessages.ADD_LISTENER_WIZARD_PAGE_TITLE;
- public final static String ADD_LISTENER_WIZARD_PAGE_DESC = WEBUIMessages.ADD_LISTENER_WIZARD_PAGE_DESC;
-
- public final static String USE_EXISTING_LISTENER_CLASS = WEBUIMessages.USE_EXISTING_LISTENER_CLASS;
- public final static String ADD_LISTENER_WIZARD_SERVLET_CONTEXT_EVENTS = WEBUIMessages.ADD_LISTENER_WIZARD_SERVLET_CONTEXT_EVENTS;
- public final static String ADD_LISTENER_WIZARD_HTTP_SESSION_EVENTS = WEBUIMessages.ADD_LISTENER_WIZARD_HTTP_SESSION_EVENTS;
- public final static String ADD_LISTENER_WIZARD_SERVLET_REQUEST_EVENTS = WEBUIMessages.ADD_LISTENER_WIZARD_SERVLET_REQUEST_EVENTS;
- public final static String ADD_LISTENER_WIZARD_LIFECYCLE = WEBUIMessages.ADD_LISTENER_WIZARD_LIFECYCLE;
- public final static String ADD_LISTENER_WIZARD_LIFECYCLE_L = WEBUIMessages.ADD_LISTENER_WIZARD_LIFECYCLE_L;
- public final static String ADD_LISTENER_WIZARD_LIFECYCLE_I = WEBUIMessages.ADD_LISTENER_WIZARD_LIFECYCLE_I;
- public final static String ADD_LISTENER_WIZARD_LIFECYCLE_Y = WEBUIMessages.ADD_LISTENER_WIZARD_LIFECYCLE_Y;
- public final static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES = WEBUIMessages.ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES;
- public final static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_C = WEBUIMessages.ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_C;
- public final static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_H = WEBUIMessages.ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_H;
- public final static String ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_G = WEBUIMessages.ADD_LISTENER_WIZARD_CHANGES_TO_ATTRIBUTES_G;
- public final static String ADD_LISTENER_WIZARD_SESSION_MIGRATION = WEBUIMessages.ADD_LISTENER_WIZARD_SESSION_MIGRATION;
- public final static String ADD_LISTENER_WIZARD_OBJECT_BINDING = WEBUIMessages.ADD_LISTENER_WIZARD_OBJECT_BINDING;
-
- // common
- public final static String ADD_BUTTON_LABEL = WEBUIMessages.ADD_BUTTON_LABEL;
- public final static String ADD_BUTTON_LABEL_A = WEBUIMessages.ADD_BUTTON_LABEL_A;
- public final static String ADD_BUTTON_LABEL_D = WEBUIMessages.ADD_BUTTON_LABEL_D;
- public final static String EDIT_BUTTON_LABEL = WEBUIMessages.EDIT_BUTTON_LABEL;
- public final static String EDIT_BUTTON_LABEL_E = WEBUIMessages.EDIT_BUTTON_LABEL_E;
- public final static String EDIT_BUTTON_LABEL_T = WEBUIMessages.EDIT_BUTTON_LABEL_T;
- public final static String REMOVE_BUTTON_LABEL = WEBUIMessages.REMOVE_BUTTON_LABEL;
- public final static String REMOVE_BUTTON_LABEL_R = WEBUIMessages.REMOVE_BUTTON_LABEL_R;
- public final static String REMOVE_BUTTON_LABEL_V = WEBUIMessages.REMOVE_BUTTON_LABEL_V;
- public final static String URL_PATTERN_TITLE = WEBUIMessages.URL_PATTERN_TITLE;
- public final static String URL_PATTERN_LABEL = WEBUIMessages.URL_PATTERN_LABEL;
- public final static String FOLDER_LABEL = WEBUIMessages.FOLDER_LABEL;
- public final static String JAVA_PACKAGE_LABEL = WEBUIMessages.JAVA_PACKAGE_LABEL;
- public final static String CLASS_NAME_LABEL = WEBUIMessages.CLASS_NAME_LABEL;
- public final static String SUPERCLASS_LABEL = WEBUIMessages.SUPERCLASS_LABEL;
- public final static String CONTAINER_SELECTION_DIALOG_TITLE = WEBUIMessages.CONTAINER_SELECTION_DIALOG_TITLE;
- public final static String CONTAINER_SELECTION_DIALOG_DESC = WEBUIMessages.CONTAINER_SELECTION_DIALOG_DESC;
- public final static String CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG = WEBUIMessages.CONTAINER_SELECTION_DIALOG_VALIDATOR_MESG;
- public final static String PACKAGE_SELECTION_DIALOG_TITLE = WEBUIMessages.PACKAGE_SELECTION_DIALOG_TITLE;
- public final static String PACKAGE_SELECTION_DIALOG_DESC = WEBUIMessages.PACKAGE_SELECTION_DIALOG_DESC;
- public final static String PACKAGE_SELECTION_DIALOG_MSG_NONE = WEBUIMessages.PACKAGE_SELECTION_DIALOG_MSG_NONE;
- public final static String SUPERCLASS_SELECTION_DIALOG_TITLE = WEBUIMessages.SUPERCLASS_SELECTION_DIALOG_TITLE;
- public final static String SUPERCLASS_SELECTION_DIALOG_DESC = WEBUIMessages.SUPERCLASS_SELECTION_DIALOG_DESC;
- public final static String INTERFACE_SELECTION_DIALOG_TITLE = WEBUIMessages.INTERFACE_SELECTION_DIALOG_TITLE;
- public final static String INTERFACE_SELECTION_DIALOG_DESC = WEBUIMessages.INTERFACE_SELECTION_DIALOG_DESC;
- public final static String INTERFACE_SELECTION_DIALOG_MSG_NONE = WEBUIMessages.INTERFACE_SELECTION_DIALOG_MSG_NONE;
- public final static String JAVA_CLASS_MODIFIERS_LABEL = WEBUIMessages.JAVA_CLASS_MODIFIERS_LABEL;
- public final static String JAVA_CLASS_INTERFACES_LABEL = WEBUIMessages.JAVA_CLASS_INTERFACES_LABEL;
- public final static String JAVA_CLASS_METHOD_STUBS_LABEL = WEBUIMessages.JAVA_CLASS_METHOD_STUBS_LABEL;
- public final static String JAVA_CLASS_PUBLIC_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_PUBLIC_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_ABSTRACT_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_FINAL_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_FINAL_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_MAIN_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_MAIN_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_INHERIT_CHECKBOX_LABEL = WEBUIMessages.JAVA_CLASS_INHERIT_CHECKBOX_LABEL;
- public final static String JAVA_CLASS_BROWER_DIALOG_TITLE = WEBUIMessages.JAVA_CLASS_BROWER_DIALOG_TITLE;
- public final static String JAVA_CLASS_BROWER_DIALOG_MESSAGE = WEBUIMessages.JAVA_CLASS_BROWER_DIALOG_MESSAGE;
-
- public final static String NAME_TITLE = WEBUIMessages.NAME_TITLE;
- public final static String NAME_LABEL = WEBUIMessages.NAME_LABEL;
- public final static String DESCRIPTION_TITLE = WEBUIMessages.DESCRIPTION_TITLE;
- public final static String DESCRIPTION_LABEL = WEBUIMessages.DESCRIPTION_LABEL;
- public final static String VALUE_TITLE = WEBUIMessages.VALUE_TITLE;
- public final static String VALUE_LABEL = WEBUIMessages.VALUE_LABEL;
- public final static String EMPTY_STRING = ""; //$NON-NLS-1$
- public final static String BROWSE_BUTTON_LABEL = WEBUIMessages.BROWSE_BUTTON_LABEL;
- public static final String REMOVE_BUTTON = WEBUIMessages.REMOVE_BUTTON;
- public final static String SELECT_ALL_BUTTON = WEBUIMessages.SELECT_ALL_BUTTON;
- public final static String CLEAR_BUTTON = WEBUIMessages.CLEAR_BUTTON;
-
-
- public final static String NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC = WEBUIMessages.NEW_JAVA_CLASS_DESTINATION_WIZARD_PAGE_DESC;
- public final static String NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC = WEBUIMessages.NEW_JAVA_CLASS_OPTIONS_WIZARD_PAGE_DESC;
-
- public final static String ImportWARAction_UI_ = WEBUIMessages.ImportWARAction_UI_;
- public final static String ExportWARAction_UI_ = WEBUIMessages.ExportWARAction_UI_;
-
- public final static String NO_WEB_PROJECTS = WEBUIMessages.NO_WEB_PROJECTS;
-
- public static final String SERVLETS = WEBUIMessages.SERVLETS;
-
- public static final String CONVERT_TO_WEB_TITLE = WEBUIMessages.ConvertToWebTitle;
- public static final String SELECT_WEB_VERSION = WEBUIMessages.SelectWebVersion;
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFileSelectionDialog.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFileSelectionDialog.java
deleted file mode 100644
index 4565ebe..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFileSelectionDialog.java
+++ /dev/null
@@ -1,691 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DEFAULT_PACKAGE;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jst.j2ee.internal.dialogs.FilteredFileSelectionDialog;
-import org.eclipse.jst.j2ee.internal.dialogs.TwoArrayQuickSorter;
-import org.eclipse.jst.j2ee.internal.dialogs.TypedFileViewerFilter;
-import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Insert the type's description here.
- * Creation date: (7/30/2001 11:16:36 AM)
- */
-public class MultiSelectFilteredFileSelectionDialog extends
- FilteredFileSelectionDialog implements SelectionListener {
-
-
- private static class PackageRenderer extends LabelProvider {
- private final Image PACKAGE_ICON = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_PACKAGE);
-
- @Override
- public String getText(Object element) {
- IType type = (IType) element;
- String p = type.getPackageFragment().getElementName();
- if ("".equals(p)) //$NON-NLS-1$
- p = DEFAULT_PACKAGE;
- return (p + " - " + type.getPackageFragment().getParent().getPath().toString()); //$NON-NLS-1$
- }
- @Override
- public Image getImage(Object element) {
- return PACKAGE_ICON;
- }
- }
-
- private static class TypeRenderer extends LabelProvider {
- private final Image CLASS_ICON = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CLASS);
-
- @Override
- public String getText(Object element) {
- IType e = ((IType) element);
- return e.getElementName();
- }
-
- @Override
- public Image getImage(Object element) {
- return CLASS_ICON;
- }
-
- }
- public final static int JSP = 0;
- public final static int SERVLET = 1;
- protected Button fServletButton;
- protected Button fJSPButton;
- protected int fSelection = -1;
- protected PageBook fPageBook = null;
- protected Control fJspControl = null;
- protected Control fServletControl = null;
- protected Composite fChild = null;
- // construction parameters
- protected IRunnableContext fRunnableContext;
- protected ILabelProvider fElementRenderer;
- protected ILabelProvider fQualifierRenderer;
- private Object[] fElements;
- private boolean fIgnoreCase = true;
- private String fUpperListLabel;
- private String fLowerListLabel;
- // SWT widgets
- private Table fUpperList;
- private Table fLowerList;
- protected Text fText;
- private IType[] fIT;
- private String[] fRenderedStrings;
- private int[] fElementMap;
- private Integer[] fQualifierMap;
- private Object fInput;
-
- private ISelectionStatusValidator fLocalValidator = null;
- /**
- * MultiSelectFilteredFileSelectionDialog constructor comment.
- * @param parent Shell
- * @param title String
- * @param message String
- * @parent extensions String[]
- * @param allowMultiple boolean
- */
- public MultiSelectFilteredFileSelectionDialog(Shell parent, String title, String message, String[] extensions, boolean allowMultiple, IProject project) {
- super(parent, title, message, extensions, allowMultiple);
- setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
-
- if (title == null)
- setTitle(WebAppEditResourceHandler.getString("File_Selection_UI_")); //$NON-NLS-1$
- if (message == null)
- {
- setMessage(WebAppEditResourceHandler.getString("Select_a_file__UI_")); //$NON-NLS-1$
- }
- fLocalValidator = new SimpleTypedElementSelectionValidator(new Class[] { IFile.class }, allowMultiple);
- setValidator(fLocalValidator);
-
- //StatusInfo currStatus = new StatusInfo();
- //currStatus.setOK();
- Status currStatus = new Status(Status.OK, ServletUIPlugin.PLUGIN_ID, Status.OK, "", null);//$NON-NLS-1$
-
- updateStatus(currStatus);
- fElementRenderer = new TypeRenderer();
- fQualifierRenderer = new PackageRenderer();
- fRunnableContext = ServletUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- try {
- IJavaElement jelem = null;
- IProject proj = null;
- jelem = (IJavaElement) project.getAdapter(IJavaElement.class);
- if (jelem == null) {
- IResource resource = (IResource) project.getAdapter(IResource.class);
- if (resource != null) {
- proj = resource.getProject();
- if (proj != null) {
- jelem = org.eclipse.jdt.core.JavaCore.create(proj);
- }
- }
- }
- if(jelem != null){
- IJavaProject jp = jelem.getJavaProject();
-
- IType servletType = jp.findType(QUALIFIED_SERVLET);
- ArrayList servletClasses = new ArrayList();
- if (servletType != null)
- {
- ITypeHierarchy tH = servletType.newTypeHierarchy(jp, null);
- IType[] types = tH.getAllSubtypes(servletType);
- for (int i = 0; i < types.length; i++) {
- if (types[i].isClass() && !servletClasses.contains(types[i]))
- servletClasses.add(types[i]);
- }
- }
- fIT = (IType[]) servletClasses.toArray(new IType[servletClasses.size()]);
- servletClasses = null;
- }
- } catch (Exception e) {
- ServletUIPlugin.log(e);
- }
- }
-
- /**
- * @private
- */
- @Override
- protected void computeResult() {
- if (fSelection == JSP) {
- super.computeResult();
- } else {
- IType type = (IType) getWidgetSelection();
- if (type != null) {
- java.util.List result = new ArrayList(1);
- result.add(type);
- setResult(result);
- }
- }
- }
-
- @Override
- public void create() {
- super.create();
- fText.setFocus();
- rematch(""); //$NON-NLS-1$
- updateOkState();
- }
-
- /**
- * Creates and returns the contents of this dialog's
- * button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
- * framework method to populate it. Subclasses may override.
- * </p>
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
- @Override
- protected Control createButtonBar(Composite parent) {
-
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
-
- layout.numColumns = 2;
-
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite composite2 = new Composite(composite, SWT.NONE);
-
- // create a layout with spacing and margins appropriate for the font size.
- layout = new GridLayout();
- layout.numColumns = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- layout.marginWidth = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING);
-
- composite2.setLayout(layout);
-
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- composite2.setLayoutData(data);
-
- composite2.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- super.createButtonsForButtonBar(composite2);
-
- return composite;
- }
-
- /*
- * @private
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- GridData gd = new GridData();
-
- fChild = new Composite(parent, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- gl.marginHeight = 0;
- fChild.setLayout(gl);
-
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessVerticalSpace = true;
- fChild.setLayoutData(gd);
-
- // Create the Web Type radio buttons and text fields.
- fServletButton = new Button(fChild, SWT.RADIO);
- fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet
- gd = new GridData();
- fServletButton.setLayoutData(gd);
- fServletButton.addSelectionListener(this);
-
- fJSPButton = new Button(fChild, SWT.RADIO);
- fJSPButton.setText(WebAppEditResourceHandler.getString("JSP_UI_")); //$NON-NLS-1$ = JSP
- gd = new GridData();
- fJSPButton.setLayoutData(gd);
- fJSPButton.addSelectionListener(this);
-
- if (fSelection == JSP)
- fJSPButton.setSelection(true);
- else {
- fServletButton.setSelection(true);
- fSelection = SERVLET;
- }
-
- fPageBook = new PageBook(fChild, SWT.NONE);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.horizontalSpan = 2;
- fPageBook.setLayoutData(gd);
- fJspControl = super.createDialogArea(fPageBook);
-
- Composite composite = new Composite(fPageBook, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- Label messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$
-
- fText = createText(composite);
-
- messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Matching_servlets__2")); //$NON-NLS-1$
-
- fUpperList = createUpperList(composite);
-
- messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$
-
- fLowerList = createLowerList(composite);
-
- fServletControl = composite;
-
- if (fSelection == JSP)
- fPageBook.showPage(fJspControl);
- else
- fPageBook.showPage(fServletControl);
- return parent;
- }
-
- /**
- * Creates the list widget and sets layout data.
- * @return org.eclipse.swt.widgets.List
- */
- private Table createLowerList(Composite parent) {
- if (fLowerListLabel != null)
- (new Label(parent, SWT.NONE)).setText(fLowerListLabel);
-
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- handleLowerSelectionChanged();
- }
- });
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleLowerDoubleClick();
- }
- });
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fQualifierRenderer.dispose();
- }
- });
- GridData spec = new GridData();
- spec.widthHint = convertWidthInCharsToPixels(50);
- spec.heightHint = convertHeightInCharsToPixels(5);
- spec.grabExcessVerticalSpace = true;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- list.setLayoutData(spec);
- return list;
- }
-
- /**
- * Creates the text widget and sets layout data.
- * @return org.eclipse.swt.widgets.Text
- */
- private Text createText(Composite parent) {
- Text text = new Text(parent, SWT.BORDER);
- GridData spec = new GridData();
- spec.grabExcessVerticalSpace = false;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.BEGINNING;
- text.setLayoutData(spec);
- Listener l = new Listener() {
- public void handleEvent(Event evt) {
- rematch(fText.getText());
- }
- };
- text.addListener(SWT.Modify, l);
- return text;
- }
-
- /**
- * Creates the list widget and sets layout data.
- * @return org.eclipse.swt.widgets.List
- */
- private Table createUpperList(Composite parent) {
- if (fUpperListLabel != null)
- (new Label(parent, SWT.NONE)).setText(fUpperListLabel);
-
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- handleUpperSelectionChanged();
- }
- });
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleUpperDoubleClick();
- }
- });
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fElementRenderer.dispose();
- }
- });
- GridData spec = new GridData();
- spec.widthHint = convertWidthInCharsToPixels(50);
- spec.heightHint = convertHeightInCharsToPixels(15);
- spec.grabExcessVerticalSpace = true;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- list.setLayoutData(spec);
- return list;
- }
-
- /**
- * @return the ID of the button that is 'pressed' on doubleClick in the lists.
- * By default it is the OK button.
- * Override to change this setting.
- */
- protected int getDefaultButtonID() {
- return IDialogConstants.OK_ID;
- }
-
- public int getSelectedItem() {
- return fSelection;
- }
-
- protected Object getWidgetSelection() {
- int i = fLowerList.getSelectionIndex();
- if (fQualifierMap != null) {
- if (fQualifierMap.length == 1)
- i = 0;
- if (i < 0) {
- return null;
- }
- Integer index = fQualifierMap[i];
- return fElements[index.intValue()];
- }
- return null;
- }
-
- protected final void handleLowerDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- protected final void handleLowerSelectionChanged() {
- updateOkState();
- }
-
- protected final void handleUpperDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- protected final void handleUpperSelectionChanged() {
- int selection = fUpperList.getSelectionIndex();
- if (selection >= 0) {
- int i = fElementMap[selection];
- int k = i;
- int length = fRenderedStrings.length;
- while (k < length && fRenderedStrings[k].equals(fRenderedStrings[i])) {
- k++;
- }
- updateLowerListWidget(i, k);
- } else
- updateLowerListWidget(0, 0);
- }
-
- @Override
- public int open() {
-
- if (fIT == null || fIT.length == 0) {
- if (!hasJSPs())
- {
- MessageDialog.openInformation(getShell(), WebAppEditResourceHandler.getString("Empty_List_1"), WebAppEditResourceHandler.getString("_INFO_No_servlets_exist_to_add._1")); //$NON-NLS-2$ //$NON-NLS-1$
- return CANCEL;
- }
- fSelection = JSP;
- }
- setElements(fIT);
- setInitialSelection(""); //$NON-NLS-1$
- return super.open();
- }
-
- /**
- * update the list to reflect a new match string.
- * @param matchString java.lang.String
- */
- protected final void rematch(String matchString) {
- int k = 0;
- String text = fText.getText();
- StringMatcher matcher = new StringMatcher(text + "*", fIgnoreCase, false); //$NON-NLS-1$
- String lastString = null;
- int length = fElements.length;
- for (int i = 0; i < length; i++) {
- while (i < length && fRenderedStrings[i].equals(lastString))
- i++;
- if (i < length) {
- lastString = fRenderedStrings[i];
- if (matcher.match(fRenderedStrings[i])) {
- fElementMap[k] = i;
- k++;
- }
- }
- }
- fElementMap[k] = -1;
-
- updateUpperListWidget(fElementMap, k);
- }
-
- /**
- *
- * @return java.lang.String[]
- * @param p org.eclipse.jface.elements.IIndexedProperty
- */
- private String[] renderStrings(Object[] p) {
- String[] strings = new String[p.length];
- int size = strings.length;
- for (int i = 0; i < size; i++) {
- strings[i] = fElementRenderer.getText(p[i]);
- }
- new TwoArrayQuickSorter(fIgnoreCase).sort(strings, p);
- return strings;
- }
-
- public void setElements(Object[] elements) {
- fElements = elements;
- fElementMap = new int[fElements.length + 1];
- fRenderedStrings = renderStrings(fElements);
- }
-
- public void setSelectedItem(int newSelection) {
- fSelection = newSelection;
- }
-
- private void updateLowerListWidget(int from, int to) {
- fLowerList.removeAll();
- fQualifierMap = new Integer[to - from];
- String[] qualifiers = new String[to - from];
- for (int i = from; i < to; i++) {
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- qualifiers[i - from] = fQualifierRenderer.getText(fElements[i]);
- fQualifierMap[i - from] = new Integer(i);
- }
-
- new TwoArrayQuickSorter(fIgnoreCase).sort(qualifiers, fQualifierMap);
-
- for (int i = 0; i < to - from; i++) {
- TableItem ti = new TableItem(fLowerList, i);
- ti.setText(qualifiers[i]);
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- Image img = fQualifierRenderer.getImage(fElements[from + i]);
- if (img != null)
- ti.setImage(img);
- }
-
- if (fLowerList.getItemCount() > 0)
- fLowerList.setSelection(0);
- updateOkState();
- }
-
- private void updateOkState() {
- Button okButton = getOkButton();
- if (okButton != null)
- okButton.setEnabled(getWidgetSelection() != null);
- }
-
- private void updateUpperListWidget(int[] indices, int size) {
- fUpperList.setRedraw(false);
- int itemCount = fUpperList.getItemCount();
- if (size < itemCount)
- fUpperList.remove(0, itemCount - size - 1);
- TableItem[] items = fUpperList.getItems();
- for (int i = 0; i < size; i++) {
- TableItem ti = null;
- if (i < itemCount)
- ti = items[i];
- else
- ti = new TableItem(fUpperList, i);
- ti.setText(fRenderedStrings[indices[i]]);
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- Image img = fElementRenderer.getImage(fElements[indices[i]]);
- if (img != null)
- ti.setImage(img);
- }
- if (fUpperList.getItemCount() > 0)
- fUpperList.setSelection(0);
- fUpperList.setRedraw(true);
- handleUpperSelectionChanged();
- }
-
- /**
- * Sent when default selection occurs in the control.
- * <p>
- * For example, on some platforms default selection occurs
- * in a List when the user double-clicks an item or types
- * return in a Text.
- * </p>
- *
- * @param e an event containing information about the default selection
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
-
- /**
- * Sent when selection occurs in the control.
- * <p>
- * For example, on some platforms selection occurs in
- * a List when the user selects an item or items.
- * </p>
- *
- * @param e an event containing information about the selection
- */
- public void widgetSelected(SelectionEvent e) {
- if (e.widget == fJSPButton) {
- fSelection = JSP;
- fPageBook.showPage(fJspControl);
- updateOKStatus();
- } else if (e.widget == fServletButton) {
- fSelection = SERVLET;
- fPageBook.showPage(fServletControl);
- } else
- fSelection = -1;
- }
-
- /**
- * @see ElementTreeSelectionDialog#updateOKStatus()
- */
- @Override
- protected void updateOKStatus() {
- super.updateOKStatus();
- Button okButton = getOkButton();
- if (okButton != null)
- okButton.setEnabled(fLocalValidator.validate(getResult()).isOK());
- }
-
- private boolean hasJSPs() {
- WorkbenchContentProvider workbenchContentProvider = new WorkbenchContentProvider();
- Object[] elements = workbenchContentProvider.getElements(fInput);
- if (elements.length > 0) {
- TypedFileViewerFilter viewerFilter = new TypedFileViewerFilter(getExtensions());
- elements = viewerFilter.filter(getTreeViewer(), fInput, elements);
- }
- return elements.length != 0;
- }
-
- /**
- * Sets the tree input.
- * @param input the tree input.
- */
- @Override
- public void setInput(Object input) {
- fInput = input;
- super.setInput(input);
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFilterFileSelectionDialog.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFilterFileSelectionDialog.java
deleted file mode 100644
index 4b84465..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/MultiSelectFilteredFilterFileSelectionDialog.java
+++ /dev/null
@@ -1,606 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.DEFAULT_PACKAGE;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jst.j2ee.internal.dialogs.FilteredFileSelectionDialog;
-import org.eclipse.jst.j2ee.internal.dialogs.TwoArrayQuickSorter;
-import org.eclipse.jst.j2ee.internal.dialogs.TypedFileViewerFilter;
-import org.eclipse.jst.j2ee.internal.web.providers.WebAppEditResourceHandler;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * Insert the type's description here.
- * Creation date: (7/30/2001 11:16:36 AM)
- */
-public class MultiSelectFilteredFilterFileSelectionDialog extends
- FilteredFileSelectionDialog {
-
-
- private static class PackageRenderer extends LabelProvider {
- private final Image PACKAGE_ICON = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_PACKAGE);
-
- @Override
- public String getText(Object element) {
- IType type = (IType) element;
- String p = type.getPackageFragment().getElementName();
- if ("".equals(p)) //$NON-NLS-1$
- p = DEFAULT_PACKAGE;
- return (p + " - " + type.getPackageFragment().getParent().getPath().toString()); //$NON-NLS-1$
- }
- @Override
- public Image getImage(Object element) {
- return PACKAGE_ICON;
- }
- }
-
- private static class TypeRenderer extends LabelProvider {
- private final Image CLASS_ICON = JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CLASS);
-
- @Override
- public String getText(Object element) {
- IType e = ((IType) element);
- return e.getElementName();
- }
-
- @Override
- public Image getImage(Object element) {
- return CLASS_ICON;
- }
-
- }
- protected PageBook fPageBook = null;
- protected Control fServletControl = null;
- protected Composite fChild = null;
- // construction parameters
- protected IRunnableContext fRunnableContext;
- protected ILabelProvider fElementRenderer;
- protected ILabelProvider fQualifierRenderer;
- private Object[] fElements;
- private boolean fIgnoreCase = true;
- private String fUpperListLabel;
- private String fLowerListLabel;
- // SWT widgets
- private Table fUpperList;
- private Table fLowerList;
- protected Text fText;
- private IType[] fIT;
- private String[] fRenderedStrings;
- private int[] fElementMap;
- private Integer[] fQualifierMap;
-
- private ISelectionStatusValidator fLocalValidator = null;
- /**
- * This is a selection dialog for available servlet.
- * @param parent Shell
- * @param title String
- * @param message String
- * @parent extensions String[]
- * @param allowMultiple boolean
- */
- public MultiSelectFilteredFilterFileSelectionDialog(Shell parent, String title, String message, String[] extensions, boolean allowMultiple, IProject project) {
- super(parent, title, message, extensions, allowMultiple);
- setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
-
- if (title == null)
- setTitle(WebAppEditResourceHandler.getString("File_Selection_UI_")); //$NON-NLS-1$
- String innerMessage = message;
- if (innerMessage == null)
- innerMessage = WebAppEditResourceHandler.getString("Select_a_file__UI_"); //$NON-NLS-1$
- setMessage(innerMessage);
- setExtensions(extensions);
- addFilter(new TypedFileViewerFilter(extensions));
- fLocalValidator = new SimpleTypedElementSelectionValidator(new Class[] { IFile.class }, allowMultiple);
- setValidator(fLocalValidator);
-
- //StatusInfo currStatus = new StatusInfo();
- //currStatus.setOK();
- Status currStatus = new Status(Status.OK, ServletUIPlugin.PLUGIN_ID, Status.OK, "", null);//$NON-NLS-1$
-
- updateStatus(currStatus);
- fElementRenderer = new TypeRenderer();
- fQualifierRenderer = new PackageRenderer();
- fRunnableContext = ServletUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- try {
- IJavaElement jelem = null;
- IProject proj = null;
- jelem = (IJavaElement) project.getAdapter(IJavaElement.class);
- if (jelem == null) {
- IResource resource = (IResource) project.getAdapter(IResource.class);
- if (resource != null) {
- proj = resource.getProject();
- if (proj != null) {
- jelem = org.eclipse.jdt.core.JavaCore.create(proj);
- }
- }
- }
- if(jelem != null){
- IJavaProject jp = jelem.getJavaProject();
- IType filterType = jp.findType(QUALIFIED_FILTER);
- // next 3 lines fix defect 177686
- if (filterType == null) {
- return;
- }
- ArrayList filterClasses = new ArrayList();
- ITypeHierarchy tH = filterType.newTypeHierarchy(jp, null);
- IType[] types = tH.getAllSubtypes(filterType);
- for (int i = 0; i < types.length; i++) {
- if (types[i].isClass() && !filterClasses.contains(types[i]))
- filterClasses.add(types[i]);
- }
- fIT = (IType[]) filterClasses.toArray(new IType[filterClasses.size()]);
- filterClasses = null;
- }
- } catch (Exception e) {
- ServletUIPlugin.log(e);
- }
- }
-
- /**
- * @private
- */
- @Override
- protected void computeResult() {
- IType type = (IType) getWidgetSelection();
- if (type != null) {
- java.util.List result = new ArrayList(1);
- result.add(type);
- setResult(result);
- }
- }
-
- @Override
- public void create() {
- super.create();
- fText.setFocus();
- rematch(""); //$NON-NLS-1$
- updateOkState();
- }
-
- /**
- * Creates and returns the contents of this dialog's
- * button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
- * framework method to populate it. Subclasses may override.
- * </p>
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
-
- layout.numColumns = 2;
-
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite composite2 = new Composite(composite, SWT.NONE);
-
- // create a layout with spacing and margins appropriate for the font size.
- layout = new GridLayout();
- layout.numColumns = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- layout.marginWidth = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING);
-
- composite2.setLayout(layout);
-
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- composite2.setLayoutData(data);
-
- composite2.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- super.createButtonsForButtonBar(composite2);
-
- return composite;
- }
-
- /*
- * @private
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- GridData gd = new GridData();
-
- fChild = new Composite(parent, SWT.NONE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- gl.marginHeight = 5;
- fChild.setLayout(gl);
-
- gd.verticalAlignment = GridData.FILL;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessVerticalSpace = true;
- fChild.setLayoutData(gd);
-
- fPageBook = new PageBook(fChild, SWT.NONE);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.horizontalSpan = 2;
- fPageBook.setLayoutData(gd);
- super.createDialogArea(fPageBook);
-
- Composite composite = new Composite(fPageBook, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- Label messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_filter__1")); //$NON-NLS-1$
-
- fText = createText(composite);
-
- messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Matching_filters__2")); //$NON-NLS-1$
-
- fUpperList = createUpperList(composite);
-
- messageLabel = new Label(composite, SWT.NONE);
- gd = new GridData();
- messageLabel.setLayoutData(gd);
- messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$
-
- fLowerList = createLowerList(composite);
-
- fServletControl = composite;
-
- fPageBook.showPage(fServletControl);
- return parent;
- }
-
- /**
- * Creates the list widget and sets layout data.
- * @return org.eclipse.swt.widgets.List
- */
- private Table createLowerList(Composite parent) {
- if (fLowerListLabel != null)
- (new Label(parent, SWT.NONE)).setText(fLowerListLabel);
-
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- handleLowerSelectionChanged();
- }
- });
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleLowerDoubleClick();
- }
- });
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fQualifierRenderer.dispose();
- }
- });
- GridData spec = new GridData();
- spec.widthHint = convertWidthInCharsToPixels(50);
- spec.heightHint = convertHeightInCharsToPixels(5);
- spec.grabExcessVerticalSpace = true;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- list.setLayoutData(spec);
- return list;
- }
-
- /**
- * Creates the text widget and sets layout data.
- * @return org.eclipse.swt.widgets.Text
- */
- private Text createText(Composite parent) {
- Text text = new Text(parent, SWT.BORDER);
- GridData spec = new GridData();
- spec.grabExcessVerticalSpace = false;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.BEGINNING;
- text.setLayoutData(spec);
- Listener l = new Listener() {
- public void handleEvent(Event evt) {
- rematch(fText.getText());
- }
- };
- text.addListener(SWT.Modify, l);
- return text;
- }
-
- /**
- * Creates the list widget and sets layout data.
- * @return org.eclipse.swt.widgets.List
- */
- private Table createUpperList(Composite parent) {
- if (fUpperListLabel != null)
- (new Label(parent, SWT.NONE)).setText(fUpperListLabel);
-
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- handleUpperSelectionChanged();
- }
- });
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleUpperDoubleClick();
- }
- });
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fElementRenderer.dispose();
- }
- });
- GridData spec = new GridData();
- spec.widthHint = convertWidthInCharsToPixels(50);
- spec.heightHint = convertHeightInCharsToPixels(15);
- spec.grabExcessVerticalSpace = true;
- spec.grabExcessHorizontalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- list.setLayoutData(spec);
- return list;
- }
-
- /**
- * @return the ID of the button that is 'pressed' on doubleClick in the lists.
- * By default it is the OK button.
- * Override to change this setting.
- */
- protected int getDefaultButtonID() {
- return IDialogConstants.OK_ID;
- }
-
- protected Object getWidgetSelection() {
- int i = fLowerList.getSelectionIndex();
- if (fQualifierMap != null) {
- if (fQualifierMap.length == 1)
- i = 0;
- if (i < 0) {
- return null;
- }
- Integer index = fQualifierMap[i];
- return fElements[index.intValue()];
- }
- return null;
- }
-
- protected final void handleLowerDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- protected final void handleLowerSelectionChanged() {
- updateOkState();
- }
-
- protected final void handleUpperDoubleClick() {
- if (getWidgetSelection() != null)
- buttonPressed(getDefaultButtonID());
- }
-
- protected final void handleUpperSelectionChanged() {
- int selection = fUpperList.getSelectionIndex();
- if (selection >= 0) {
- int i = fElementMap[selection];
- int k = i;
- int length = fRenderedStrings.length;
- while (k < length && fRenderedStrings[k].equals(fRenderedStrings[i])) {
- k++;
- }
- updateLowerListWidget(i, k);
- } else
- updateLowerListWidget(0, 0);
- }
-
- @Override
- public int open() {
- if (fIT == null || fIT.length == 0) {
- MessageDialog.openInformation(getShell(),
- WebAppEditResourceHandler.getString("Empty_List_1"), //$NON-NLS-1$
- WebAppEditResourceHandler.getString("_INFO_No_filters_exist_to_add._1")); //$NON-NLS-1$
- return CANCEL;
- }
-
- setElements(fIT);
- setInitialSelection(""); //$NON-NLS-1$
- return super.open();
- }
-
- /**
- * update the list to reflect a new match string.
- * @param matchString java.lang.String
- */
- protected final void rematch(String matchString) {
- int k = 0;
- String text = fText.getText();
- StringMatcher matcher = new StringMatcher(text + "*", fIgnoreCase, false); //$NON-NLS-1$
- String lastString = null;
- int length = fElements.length;
- for (int i = 0; i < length; i++) {
- while (i < length && fRenderedStrings[i].equals(lastString))
- i++;
- if (i < length) {
- lastString = fRenderedStrings[i];
- if (matcher.match(fRenderedStrings[i])) {
- fElementMap[k] = i;
- k++;
- }
- }
- }
- fElementMap[k] = -1;
-
- updateUpperListWidget(fElementMap, k);
- }
-
- /**
- *
- * @return java.lang.String[]
- * @param p org.eclipse.jface.elements.IIndexedProperty
- */
- private String[] renderStrings(Object[] p) {
- String[] strings = new String[p.length];
- int size = strings.length;
- for (int i = 0; i < size; i++) {
- strings[i] = fElementRenderer.getText(p[i]);
- }
- new TwoArrayQuickSorter(fIgnoreCase).sort(strings, p);
- return strings;
- }
-
- public void setElements(Object[] elements) {
- fElements = elements;
- fElementMap = new int[fElements.length + 1];
- fRenderedStrings = renderStrings(fElements);
- }
-
- private void updateLowerListWidget(int from, int to) {
- fLowerList.removeAll();
- fQualifierMap = new Integer[to - from];
- String[] qualifiers = new String[to - from];
- for (int i = from; i < to; i++) {
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- qualifiers[i - from] = fQualifierRenderer.getText(fElements[i]);
- fQualifierMap[i - from] = new Integer(i);
- }
-
- new TwoArrayQuickSorter(fIgnoreCase).sort(qualifiers, fQualifierMap);
-
- for (int i = 0; i < to - from; i++) {
- TableItem ti = new TableItem(fLowerList, i);
- ti.setText(qualifiers[i]);
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- Image img = fQualifierRenderer.getImage(fElements[from + i]);
- if (img != null)
- ti.setImage(img);
- }
-
- if (fLowerList.getItemCount() > 0)
- fLowerList.setSelection(0);
- updateOkState();
- }
-
- private void updateOkState() {
- Button okButton = getOkButton();
- if (okButton != null)
- okButton.setEnabled(getWidgetSelection() != null);
- }
-
- private void updateUpperListWidget(int[] indices, int size) {
- fUpperList.setRedraw(false);
- int itemCount = fUpperList.getItemCount();
- if (size < itemCount)
- fUpperList.remove(0, itemCount - size - 1);
- TableItem[] items = fUpperList.getItems();
- for (int i = 0; i < size; i++) {
- TableItem ti = null;
- if (i < itemCount)
- ti = items[i];
- else
- ti = new TableItem(fUpperList, i);
- ti.setText(fRenderedStrings[indices[i]]);
- // XXX: 1G65LDG: JFUIF:WIN2000 - ILabelProvider used outside a viewer
- Image img = fElementRenderer.getImage(fElements[indices[i]]);
- if (img != null)
- ti.setImage(img);
- }
- if (fUpperList.getItemCount() > 0)
- fUpperList.setSelection(0);
- fUpperList.setRedraw(true);
- handleUpperSelectionChanged();
- }
-
- /**
- * Sent when default selection occurs in the control.
- * <p>
- * For example, on some platforms default selection occurs
- * in a List when the user double-clicks an item or types
- * return in a Text.
- * </p>
- *
- * @param e an event containing information about the default selection
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do nothing
- }
-
- /**
- * @see ElementTreeSelectionDialog#updateOKStatus()
- */
- @Override
- protected void updateOKStatus() {
- super.updateOKStatus();
- Button okButton = getOkButton();
- if (okButton != null)
- okButton.setEnabled(fLocalValidator.validate(getResult()).isOK());
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassOptionsWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassOptionsWizardPage.java
deleted file mode 100644
index 94124e0..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassOptionsWizardPage.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DESTROY;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.DO_FILTER;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.INIT;
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jst.j2ee.internal.web.operations.FilterSupertypesValidator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewFilterClassOptionsWizardPage extends
- NewWebClassOptionsWizardPage implements ISelectionChangedListener {
-
- protected Button initButton;
- protected Button destroyButton;
- protected Button doFilterButton;
-
- public NewFilterClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
- super(model, pageName, pageDesc, pageTitle);
- }
-
- /**
- * Create the composite with all the stubs
- */
- @Override
- protected void createStubsComposite(Composite parent) {
- super.createStubsComposite(parent);
-
- Composite comp = new Composite(methodStubs, SWT.NULL);
- GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.makeColumnsEqualWidth = true;
- comp.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- comp.setLayoutData(data);
-
- initButton = new Button(comp, SWT.CHECK);
- initButton.setText("init"); //$NON-NLS-1$
- synchHelper.synchCheckbox(initButton, INIT, null);
-
- destroyButton = new Button(comp, SWT.CHECK);
- destroyButton.setText("destroy"); //$NON-NLS-1$
- synchHelper.synchCheckbox(destroyButton, DESTROY, null);
-
- doFilterButton = new Button(comp, SWT.CHECK);
- doFilterButton.setText("doFilter"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doFilterButton, DO_FILTER, null);
-
- interfaceViewer.addSelectionChangedListener(this);
-
- Dialog.applyDialogFont(parent);
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
-
- // if the selection is empty, then the remove button is disabled
- if (selection.isEmpty()) {
- removeButton.setEnabled(false);
- return;
- }
-
- // if the selection is non-empty and the filter extends a class which
- // implements javax.servlet.Filter, then the remove button is enabled
- if (FilterSupertypesValidator.isFilterSuperclass(model)) {
- removeButton.setEnabled(true);
- return;
- }
-
- // if the selection is non-empty and the filter does not extend a class
- // which implements javax.servlet.Filter, then the remove button is
- // disabled only if the Filter interface is in the selection
- Iterator iter = selection.iterator();
- while (iter.hasNext()) {
- if (QUALIFIED_FILTER.equals(iter.next()))
- removeButton.setEnabled(false);
- return;
- }
-
- // in all other cases the remove button is enabled
- removeButton.setEnabled(true);
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassWizardPage.java
deleted file mode 100644
index 2ad1bd1..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewFilterClassWizardPage.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewFilterClassDataModelProperties.FILTER_MAPPINGS;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.CHOOSE_FILTER_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_FILTER_WIZARD_WINDOW_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.USE_EXISTING_FILTER_CLASS;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.war.ui.util.WebFiltersGroupItemProvider;
-import org.eclipse.jst.j2ee.internal.web.operations.FilterMappingItem;
-import org.eclipse.jst.j2ee.internal.web.operations.IFilterMappingItem;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.WebUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.jee.ui.internal.navigator.web.GroupFiltersItemProvider;
-import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class NewFilterClassWizardPage extends NewWebClassWizardPage {
-
- private final static String[] FILTEREXTENSIONS = { "java" }; //$NON-NLS-1$
-
- public NewFilterClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle, String moduleType) {
- super(model, pageName, pageDesc, pageTitle, moduleType);
- }
-
- @Override
- protected String getUseExistingCheckboxText() {
- return USE_EXISTING_FILTER_CLASS;
- }
-
- @Override
- protected String getUseExistingProperty() {
- return USE_EXISTING_CLASS;
- }
-
- @Override
- protected IProject getExtendedSelectedProject(Object selection) {
- if (selection instanceof WebFiltersGroupItemProvider) {
- WebApp webApp = (WebApp)((WebFiltersGroupItemProvider) selection).getParent();
- return ProjectUtilities.getProject(webApp);
- }else if(selection instanceof WebAppProvider){
- return ((WebAppProvider) selection).getProject();
- } if(selection instanceof GroupFiltersItemProvider){
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) ((GroupFiltersItemProvider) selection).getJavaEEObject();
- return ProjectUtilities.getProject(webApp);
- }
-
- return super.getExtendedSelectedProject(selection);
- }
-
- @Override
- protected void handleClassButtonSelected() {
- getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
- IProject project = (IProject) model.getProperty(PROJECT);
- IVirtualComponent component = ComponentCore.createComponent(project);
- MultiSelectFilteredFilterFileSelectionDialog ms = new MultiSelectFilteredFilterFileSelectionDialog(
- getShell(),
- NEW_FILTER_WIZARD_WINDOW_TITLE,
- CHOOSE_FILTER_CLASS,
- FILTEREXTENSIONS,
- false,
- project);
- IContainer root = component.getRootFolder().getUnderlyingFolder();
- ms.setInput(root);
- ms.open();
- if (ms.getReturnCode() == Window.OK) {
- String qualifiedClassName = ""; //$NON-NLS-1$
- IType type = (IType) ms.getFirstResult();
- if (type != null) {
- qualifiedClassName = type.getFullyQualifiedName();
- }
- existingClassText.setText(qualifiedClassName);
- }
- getControl().setCursor(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.servlet.ui.internal.wizard.NewWebClassWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = super.createTopLevelComposite(parent);
-
- Object obj = getSelectedObject();
- if (isFilter(obj)) {
- checkExistingButton(true);
- existingClassText.setText(getFilterClass(obj));
- } else if (isServlet(obj)) {
- String servletName = getServletName(obj);
- // set the class name
- classText.setText(makeFirstCharUppercase(servletName) + "Filter"); //$NON-NLS-1$
- // set the filter mapping
- if (servletName != null) {
- List<IFilterMappingItem> mappings = new ArrayList<IFilterMappingItem>();
- mappings.add(new FilterMappingItem(IFilterMappingItem.SERVLET_NAME, servletName));
- model.setProperty(FILTER_MAPPINGS, mappings);
- }
- } else if (isWebFolder(obj)) {
- IFolder folder = (IFolder) obj;
- // set the class name
- String webFolderName = makeFirstCharUppercase(folder.getName());
- classText.setText(webFolderName + "Filter"); //$NON-NLS-1$
- // set the filter mapping
- String webFolderPath = getWebResourcePath(folder);
- List<IFilterMappingItem> mappings = new ArrayList<IFilterMappingItem>();
- mappings.add(new FilterMappingItem(IFilterMappingItem.URL_PATTERN, webFolderPath + "/*")); //$NON-NLS-1$
- model.setProperty(FILTER_MAPPINGS, mappings);
- } else if (WebUtilities.isWebResource(obj)) {
- IFile file = (IFile) obj;
- // set the class name
- String webResourceName = makeFirstCharUppercase(getFileNameWithouFileExtension(file));
- classText.setText(webResourceName + "Filter"); //$NON-NLS-1$
- // set the filter mapping
- String webResourcePath = getWebResourcePath(file);
- List<IFilterMappingItem> mappings = new ArrayList<IFilterMappingItem>();
- mappings.add(new FilterMappingItem(IFilterMappingItem.URL_PATTERN, webResourcePath));
- model.setProperty(FILTER_MAPPINGS, mappings);
- }
-
- return composite;
- }
-
- @Override
- protected boolean isProjectValid(IProject project) {
- boolean result = super.isProjectValid(project);
- if (!result)
- return false;
-
- if (JavaEEProjectUtilities.isWebFragmentProject(project))
- return true;
-
- // get the version of the web facet
- IProjectFacetVersion facetVersion = JavaEEProjectUtilities.getProjectFacetVersion(project, IJ2EEFacetConstants.DYNAMIC_WEB);
- if (facetVersion == null)
- return false;
-
- // convert the version to an integer
- int version = J2EEVersionUtil.convertVersionStringToInt(facetVersion.getVersionString());
-
- // only web 2.3 and greater projects are valid
- return version > J2EEVersionConstants.SERVLET_2_2;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassOptionsWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassOptionsWizardPage.java
deleted file mode 100644
index 6d4d265..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassOptionsWizardPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewListenerClassOptionsWizardPage extends NewWebClassOptionsWizardPage {
-
- public NewListenerClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
- super(model, pageName, pageDesc, pageTitle);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassWizardPage.java
deleted file mode 100644
index 031ed18..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewListenerClassWizardPage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.USE_EXISTING_LISTENER_CLASS;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.war.ui.util.WebListenerGroupItemProvider;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.jee.ui.internal.navigator.web.GroupListenerItemProvider;
-import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class NewListenerClassWizardPage extends NewWebClassWizardPage {
-
- public NewListenerClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle, String moduleType) {
- super(model, pageName, pageDesc, pageTitle, moduleType);
- }
-
- @Override
- protected String getUseExistingCheckboxText() {
- return USE_EXISTING_LISTENER_CLASS;
- }
-
- @Override
- protected String getUseExistingProperty() {
- return USE_EXISTING_CLASS;
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = super.createTopLevelComposite(parent);
-
- existingButton.setEnabled(false);
-
- return composite;
- }
-
- @Override
- protected IProject getExtendedSelectedProject(Object selection) {
- if (selection instanceof WebListenerGroupItemProvider) {
- WebApp webApp = (WebApp)((WebListenerGroupItemProvider) selection).getParent();
- return ProjectUtilities.getProject(webApp);
- }else if(selection instanceof WebAppProvider){
- return ((WebAppProvider) selection).getProject();
- } else if(selection instanceof GroupListenerItemProvider){
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) ((GroupListenerItemProvider) selection).getJavaEEObject();
- return ProjectUtilities.getProject(webApp);
- }
-
- return super.getExtendedSelectedProject(selection);
- }
-
- @Override
- protected void handleClassButtonSelected() {
- }
-
- @Override
- protected boolean isProjectValid(IProject project) {
- boolean result = super.isProjectValid(project);
- if (!result)
- return false;
-
- if (JavaEEProjectUtilities.isWebFragmentProject(project))
- return true;
-
- // get the version of the web facet
- IProjectFacetVersion facetVersion = JavaEEProjectUtilities.getProjectFacetVersion(project, IJ2EEFacetConstants.DYNAMIC_WEB);
- if (facetVersion == null)
- return false;
-
- // convert the version to an integer
- int version = J2EEVersionUtil.convertVersionStringToInt(facetVersion.getVersionString());
-
- // only web 2.3 and greater projects are valid
- return version > J2EEVersionConstants.SERVLET_2_2;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassOptionsWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassOptionsWizardPage.java
deleted file mode 100644
index d7d3779..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassOptionsWizardPage.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - bug 142500
- * Kiril Mitov, k.mitov@sap.com - bug 204160
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties;
-import org.eclipse.jst.j2ee.internal.web.operations.ServletSupertypesValidator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewServletClassOptionsWizardPage extends
- NewWebClassOptionsWizardPage implements ISelectionChangedListener {
-
- protected Button initButton;
- protected Button destroyButton;
- protected Button getConfigButton;
- protected Button getInfoButton;
- protected Button serviceButton;
- protected Button doGetButton;
- protected Button doPostButton;
- protected Button doPutButton;
- protected Button doDeleteButton;
- protected Button doHeadButton;
- protected Button doOptionsButton;
- protected Button doTraceButton;
-
- public NewServletClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
- super(model, pageName, pageDesc, pageTitle);
- }
-
- @Override
- protected void enter() {
- super.enter();
-
- boolean httpServlet = ServletSupertypesValidator.isHttpServletSuperclass(model);
- doGetButton.setVisible(httpServlet);
- doPostButton.setVisible(httpServlet);
- doPutButton.setVisible(httpServlet);
- doDeleteButton.setVisible(httpServlet);
- doHeadButton.setVisible(httpServlet);
- doOptionsButton.setVisible(httpServlet);
- doTraceButton.setVisible(httpServlet);
- }
-
- /**
- * Create the composite with all the stubs
- */
- @Override
- protected void createStubsComposite(Composite parent) {
- super.createStubsComposite(parent);
-
- inheritButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- boolean enable = inheritButton.getSelection();
- enableGenericServletButtons(enable);
- enableHttpServletButtons(enable);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- //Do nothing
- }
-
- private void enableGenericServletButtons(boolean enable) {
- if (ServletSupertypesValidator.isGenericServletSuperclass(model)) {
- initButton.setEnabled(enable);
- destroyButton.setEnabled(enable);
- getConfigButton.setEnabled(enable);
- getInfoButton.setEnabled(enable);
- serviceButton.setEnabled(enable);
- }
- }
-
- private void enableHttpServletButtons(boolean enable) {
- doGetButton.setEnabled(enable);
- doPostButton.setEnabled(enable);
- doPutButton.setEnabled(enable);
- doDeleteButton.setEnabled(enable);
- doHeadButton.setEnabled(enable);
- doOptionsButton.setEnabled(enable);
- doTraceButton.setEnabled(enable);
- }
- });
-
- Composite comp = new Composite(methodStubs, SWT.NULL);
- GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.makeColumnsEqualWidth = true;
- comp.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- comp.setLayoutData(data);
-
- initButton = new Button(comp, SWT.CHECK);
- initButton.setText("init"); //$NON-NLS-1$
- synchHelper.synchCheckbox(initButton, INewServletClassDataModelProperties.INIT, null);
-
- destroyButton = new Button(comp, SWT.CHECK);
- destroyButton.setText("destroy"); //$NON-NLS-1$
- synchHelper.synchCheckbox(destroyButton, INewServletClassDataModelProperties.DESTROY, null);
-
- getConfigButton = new Button(comp, SWT.CHECK);
- getConfigButton.setText("getServletConfig"); //$NON-NLS-1$
- synchHelper.synchCheckbox(getConfigButton, INewServletClassDataModelProperties.GET_SERVLET_CONFIG, null);
-
- getInfoButton = new Button(comp, SWT.CHECK);
- getInfoButton.setText("getServletInfo"); //$NON-NLS-1$
- synchHelper.synchCheckbox(getInfoButton, INewServletClassDataModelProperties.GET_SERVLET_INFO, null);
-
- serviceButton = new Button(comp, SWT.CHECK);
- serviceButton.setText("service"); //$NON-NLS-1$
- synchHelper.synchCheckbox(serviceButton, INewServletClassDataModelProperties.SERVICE, null);
-
- doGetButton = new Button(comp, SWT.CHECK);
- doGetButton.setText("do&Get"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doGetButton, INewServletClassDataModelProperties.DO_GET, null);
-
- doPostButton = new Button(comp, SWT.CHECK);
- doPostButton.setText("do&Post"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doPostButton, INewServletClassDataModelProperties.DO_POST, null);
-
- doPutButton = new Button(comp, SWT.CHECK);
- doPutButton.setText("doP&ut"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doPutButton, INewServletClassDataModelProperties.DO_PUT, null);
-
- doDeleteButton = new Button(comp, SWT.CHECK);
- doDeleteButton.setText("do&Delete"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doDeleteButton, INewServletClassDataModelProperties.DO_DELETE, null);
-
- doHeadButton = new Button(comp, SWT.CHECK);
- doHeadButton.setText("doH&ead"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doHeadButton, INewServletClassDataModelProperties.DO_HEAD, null);
-
- doOptionsButton = new Button(comp, SWT.CHECK);
- doOptionsButton.setText("do&Options"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doOptionsButton, INewServletClassDataModelProperties.DO_OPTIONS, null);
-
- doTraceButton = new Button(comp, SWT.CHECK);
- doTraceButton.setText("do&Trace"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doTraceButton, INewServletClassDataModelProperties.DO_TRACE, null);
-
- interfaceViewer.addSelectionChangedListener(this);
-
- Dialog.applyDialogFont(parent);
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- removeButton.setEnabled(canRemoveSelectedInterfaces(selection));
- }
-
- @Override
- protected KeyListener getInterfaceKeyListener() {
- return new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- IStructuredSelection selection = (IStructuredSelection) interfaceViewer.getSelection();
- if (canRemoveSelectedInterfaces(selection)) {
- handleInterfaceRemoveButtonSelected();
- }
- }
- }
-
- };
- }
-
- private boolean canRemoveSelectedInterfaces(IStructuredSelection selection) {
- // if the selection is empty, then remove is not possible
- if (selection.isEmpty()) {
- return false;
- }
-
- // if the selection is non-empty and the servlet extends GenericServlet, then
- // remove is possible
- if (ServletSupertypesValidator.isGenericServletSuperclass(model)) {
- return true;
- }
-
- // if the selection is non-empty and the servlet does not extend GenericServlet,
- // then remove is not possible only if the Servlet interface is in the selection
- Iterator iter = selection.iterator();
- while (iter.hasNext()) {
- if (QUALIFIED_SERVLET.equals(iter.next())) {
- return false;
- }
- }
-
- // in all other cases remove is possible
- return true;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java
deleted file mode 100644
index d6b3809..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewServletClassWizardPage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewServletClassDataModelProperties.IS_SERVLET_TYPE;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.CHOOSE_SERVLET_CLASS;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.NEW_SERVLET_WIZARD_WINDOW_TITLE;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.USE_EXISTING_SERVLET_CLASS;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.j2ee.internal.war.ui.util.WebServletGroupItemProvider;
-import org.eclipse.jst.j2ee.webapplication.WebApp;
-import org.eclipse.jst.jee.ui.internal.navigator.web.GroupServletItemProvider;
-import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewServletClassWizardPage extends NewWebClassWizardPage {
-
- private final static String[] JSPEXTENSIONS = { "jsp" }; //$NON-NLS-1$
-
- public NewServletClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle, String moduleType) {
- super(model, pageName, pageDesc, pageTitle, moduleType);
- }
-
- @Override
- protected String getUseExistingCheckboxText() {
- return USE_EXISTING_SERVLET_CLASS;
- }
-
- @Override
- protected String getUseExistingProperty() {
- return USE_EXISTING_CLASS;
- }
-
- @Override
- protected IProject getExtendedSelectedProject(Object selection) {
- if (selection instanceof WebServletGroupItemProvider) {
- WebApp webApp = (WebApp) ((WebServletGroupItemProvider) selection).getParent();
- return ProjectUtilities.getProject(webApp);
- } else if(selection instanceof WebAppProvider){
- return ((WebAppProvider) selection).getProject();
- } else if(selection instanceof GroupServletItemProvider){
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) ((GroupServletItemProvider) selection).getJavaEEObject();
- return ProjectUtilities.getProject(webApp);
- }
-
- return super.getExtendedSelectedProject(selection);
- }
-
- @Override
- protected void handleClassButtonSelected() {
- getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
- try {
- IProject project = (IProject) model.getProperty(PROJECT);
-
- if (project == null) {
- // show info message
- return;
- }
-
- IVirtualComponent component = ComponentCore.createComponent(project);
- MultiSelectFilteredFileSelectionDialog ms = new MultiSelectFilteredFileSelectionDialog(
- getShell(),
- NEW_SERVLET_WIZARD_WINDOW_TITLE,
- CHOOSE_SERVLET_CLASS,
- JSPEXTENSIONS,
- false,
- project);
- IContainer root = component.getRootFolder().getUnderlyingFolder();
- ms.setInput(root);
- ms.open();
- if (ms.getReturnCode() == Window.OK) {
- String qualifiedClassName = ""; //$NON-NLS-1$
- if (ms.getSelectedItem() == MultiSelectFilteredFileSelectionDialog.JSP) {
- Object obj = ms.getFirstResult();
- if (obj != null) {
- if (obj instanceof IFile) {
- IFile file = (IFile) obj;
- IPath pFull = file.getFullPath();
- IPath pBase = root.getFullPath();
- IPath path = pFull.removeFirstSegments(pBase.segmentCount());
- qualifiedClassName = path.makeAbsolute().toString();
- model.setProperty(IS_SERVLET_TYPE, new Boolean(false));
- }
- }
- }
- else {
- IType type = (IType) ms.getFirstResult();
- if (type != null) {
- qualifiedClassName = type.getFullyQualifiedName();
- model.setProperty(IS_SERVLET_TYPE, new Boolean(true));
- }
- }
- existingClassText.setText(qualifiedClassName);
- }
- } finally {
- getControl().setCursor(null);
- }
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = super.createTopLevelComposite(parent);
-
- Object obj = getSelectedObject();
- if (isServlet(obj)) {
- checkExistingButton(true);
- if (isServletJSP(obj)) {
- existingClassText.setText(getServletJSPFile(obj));
- model.setBooleanProperty(IS_SERVLET_TYPE, false);
- } else {
- existingClassText.setText(getServletClass(obj));
- model.setBooleanProperty(IS_SERVLET_TYPE, true);
- }
- } else if (isJSP(obj)) {
- checkExistingButton(true);
- existingClassText.setText(getWebResourcePath((IResource) obj));
- model.setBooleanProperty(IS_SERVLET_TYPE, false);
- }
-
- return composite;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebArtifactWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebArtifactWizard.java
deleted file mode 100644
index a75b864..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebArtifactWizard.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.JAVA_PACKAGE;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.OPEN_IN_EDITOR;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.QUALIFIED_CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.JAVA_SOURCE_FOLDER;
-import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
-
-import java.net.URL;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jst.j2ee.internal.common.operations.JavaModelUtil;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEEditorUtility;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class NewWebArtifactWizard extends NewWebWizard {
-
- protected static final String PAGE_ONE = "pageOne"; //$NON-NLS-1$
- protected static final String PAGE_TWO = "pageTwo"; //$NON-NLS-1$
- protected static final String PAGE_THREE = "pageThree"; //$NON-NLS-1$
-
- public NewWebArtifactWizard(IDataModel model) {
- super(model);
- setWindowTitle(getTitle());
- setDefaultPageImageDescriptor(getImage());
- }
-
- @Override
- protected boolean runForked() {
- return false;
- }
-
- @Override
- public boolean canFinish() {
- return getDataModel().isValid();
- }
-
- protected abstract String getTitle();
-
- protected abstract ImageDescriptor getImage();
-
- protected ImageDescriptor getImageFromJ2EEPlugin(String key) {
- URL url = (URL) J2EEPlugin.getDefault().getImage(key);
- return ImageDescriptor.createFromURL(url);
- }
-
- protected void openJavaClass() {
- try {
- String className;
- if (getDataModel().getBooleanProperty(USE_EXISTING_CLASS)) {
- className = getDataModel().getStringProperty(CLASS_NAME);
- } else {
- className = getDataModel().getStringProperty(QUALIFIED_CLASS_NAME);
- }
- IProject p = (IProject) getDataModel().getProperty(PROJECT);
- IJavaProject javaProject = J2EEEditorUtility.getJavaProject(p);
- IType type = javaProject.findType(className);
- IFile file = null;
-
- if (type != null){
- file = (IFile) type.getResource();
- }
- else if (!getDataModel().getBooleanProperty(USE_EXISTING_CLASS)){
- // If we could not find the type, the class might be in a folder that is not part of the build path.
- // Let's look for it using the class name and source folder (this does not work when using existing class, but
- // should not be a problem, because the wizard to select the existing class will not let you select class that
- // is not in the build path)
- IFolder sourceFolder = (IFolder) getDataModel().getProperty(JAVA_SOURCE_FOLDER);
- String packageName = getDataModel().getStringProperty(JAVA_PACKAGE);
- IPackageFragmentRoot packageFragmentRoot = javaProject.getPackageFragmentRoot(sourceFolder);
- IPackageFragment packageFragment = null;
- if (packageFragmentRoot!= null){
- packageFragment = packageFragmentRoot.getPackageFragment(packageName);
- }
- if (packageFragment!= null){
- ICompilationUnit cu = packageFragment.getCompilationUnit(getDataModel().getStringProperty(CLASS_NAME) + JavaModelUtil.DEFAULT_CU_SUFFIX);
- IResource resource = cu.getResource();
- if (resource.exists() && resource instanceof IFile) {
- file = (IFile)resource;
- }
- }
- }
- if (file != null){
- openEditor(file);
- }
- } catch (Exception cantOpen) {
- ServletUIPlugin.log(cantOpen);
- }
- }
-
- protected void openWebFile() {
- try {
- String className = getDataModel().getStringProperty(CLASS_NAME);
- IProject p = (IProject) getDataModel().getProperty(PROJECT);
- IVirtualComponent component = ComponentCore.createComponent(p);
- IContainer webContent = component.getRootFolder().getUnderlyingFolder();
- IFile file = webContent.getFile(new Path(className));
- openEditor(file);
- } catch (Exception cantOpen) {
- ServletUIPlugin.log(cantOpen);
- }
- }
-
- protected void openEditor(final IFile file) {
- if (getDataModel().getBooleanProperty(OPEN_IN_EDITOR)) {
- if (file != null) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
- }
- catch (PartInitException e) {
- ServletUIPlugin.log(e);
- }
- }
- });
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassOptionsWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassOptionsWizardPage.java
deleted file mode 100644
index 5a55cca..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassOptionsWizardPage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.ABSTRACT_METHODS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CONSTRUCTOR;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.JAVA_CLASS_INHERIT_CHECKBOX_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.JAVA_CLASS_METHOD_STUBS_LABEL;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.internal.wizard.NewJavaClassOptionsWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewWebClassOptionsWizardPage extends NewJavaClassOptionsWizardPage {
-
- protected Composite methodStubs;
-
- public NewWebClassOptionsWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle) {
- super(model, pageName, pageDesc, pageTitle);
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] { INTERFACES };
- }
-
- @Override
- protected void createStubsComposite(Composite parent) {
- Label stubLabel = new Label(parent, SWT.NONE);
- stubLabel.setText(JAVA_CLASS_METHOD_STUBS_LABEL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- stubLabel.setLayoutData(data);
-
- methodStubs = new Composite(parent, SWT.NULL);
- methodStubs.setLayout(new GridLayout());
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.horizontalIndent = 15;
- methodStubs.setLayoutData(data);
-
- constructorButton = new Button(methodStubs, SWT.CHECK);
- constructorButton.setText(JAVA_CLASS_CONSTRUCTOR_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(constructorButton, CONSTRUCTOR, null);
-
- inheritButton = new Button(methodStubs, SWT.CHECK);
- inheritButton.setText(JAVA_CLASS_INHERIT_CHECKBOX_LABEL);
- synchHelper.synchCheckbox(inheritButton, ABSTRACT_METHODS, null);
-
- Dialog.applyDialogFont(parent);
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java
deleted file mode 100644
index 07d9961..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 SAP AG 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:
- * Kaloyan Raev, kaloyan.raev@sap.com - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
-import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.GENERATE_DD;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.BROWSE_BUTTON_LABEL;
-import static org.eclipse.jst.servlet.ui.internal.wizard.IWebWizardConstants.CLASS_NAME_LABEL;
-import static org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties.PROJECT_NAME;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.commonarchivecore.internal.util.J2EEFileUtil;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.wizard.AnnotationsStandaloneGroup;
-import org.eclipse.jst.j2ee.internal.wizard.NewJavaClassWizardPage;
-import org.eclipse.jst.j2ee.model.IModelProvider;
-import org.eclipse.jst.j2ee.model.ModelProviderManager;
-import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
-import org.eclipse.jst.j2ee.project.WebUtilities;
-import org.eclipse.jst.j2ee.web.IServletConstants;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.jst.servlet.ui.internal.navigator.CompressedJavaProject;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public abstract class NewWebClassWizardPage extends NewJavaClassWizardPage {
-
- protected AnnotationsStandaloneGroup annotationsGroup;
-
- protected Button existingClassButton;
- protected Label existingClassLabel;
- protected Text existingClassText;
- protected Button existingButton;
-
- public NewWebClassWizardPage(IDataModel model, String pageName, String pageDesc, String pageTitle, String moduleType) {
- super(model, pageName, pageDesc, pageTitle, moduleType);
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = super.createTopLevelComposite(parent);
-
- //bug 303931
- // projectNameLabel.setText(WEBUIMessages.WEB_PROJECT_LBL);
-
- addSeperator(composite, 3);
- createUseExistingGroup(composite);
- createAnnotationsGroup(composite);
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- @Override
- protected IProject getExtendedSelectedProject(Object selection) {
- if (selection instanceof CompressedJavaProject) {
- return ((CompressedJavaProject) selection).getProject().getProject();
- }
-
- return super.getExtendedSelectedProject(selection);
- }
-
- protected abstract String getUseExistingCheckboxText();
-
- protected abstract String getUseExistingProperty();
-
- protected abstract void handleClassButtonSelected();
-
- /**
- * Create annotations group and set default enablement
- */
- private void createAnnotationsGroup(Composite parent) {
- if (isWebDocletProject()) {
- annotationsGroup = new AnnotationsStandaloneGroup(parent, model, J2EEProjectUtilities.EJB.equals(projectType),
- J2EEProjectUtilities.DYNAMIC_WEB.equals(projectType));
- if (!model.isPropertySet(PROJECT_NAME))
- return;
- IProject project = ProjectUtilities.getProject(model.getStringProperty(PROJECT_NAME));
- annotationsGroup.setEnablement(project);
- // annotationsGroup.setUseAnnotations(true);
- } else {
- // not a Web Doclet project - make sure that the USE_ANNOTATIONS property is off
- model.setProperty(USE_ANNOTATIONS, false);
- }
- }
-
- private void createUseExistingGroup(Composite composite) {
- existingButton = new Button(composite, SWT.CHECK);
- existingButton.setText(getUseExistingCheckboxText());
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- existingButton.setLayoutData(data);
- synchHelper.synchCheckbox(existingButton, getUseExistingProperty(), null);
- existingButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleExistingButtonSelected();
- }
- });
-
- existingClassLabel = new Label(composite, SWT.LEFT);
- existingClassLabel.setText(CLASS_NAME_LABEL);
- existingClassLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- existingClassLabel.setEnabled(false);
-
- existingClassText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- existingClassText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- existingClassText.setEnabled(false);
- synchHelper.synchText(existingClassText, CLASS_NAME, null);
-
- existingClassButton = new Button(composite, SWT.PUSH);
- existingClassButton.setText(BROWSE_BUTTON_LABEL);
- existingClassButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- existingClassButton.setEnabled(false);
- existingClassButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleClassButtonSelected();
- }
- });
- }
-
- private void handleExistingButtonSelected() {
- boolean enable = existingButton.getSelection();
- existingClassLabel.setEnabled(enable);
- existingClassButton.setEnabled(enable);
- packageText.setEnabled(!enable);
- packageButton.setEnabled(!enable);
- packageLabel.setEnabled(!enable);
- classText.setEnabled(!enable);
- classLabel.setEnabled(!enable);
- superText.setEnabled(!enable);
- superButton.setEnabled(!enable);
- superLabel.setEnabled(!enable);
- }
-
- private boolean isWebDocletProject() {
- String projectName = model.getStringProperty(PROJECT_NAME);
- if(projectName != null && !"".equals(projectName.trim())){ //$NON-NLS-1$
- IProject project = ProjectUtilities.getProject(projectName);
- try {
- IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- return facetedProject.hasProjectFacet(WebFacetUtils.WEB_XDOCLET_FACET);
- } catch (CoreException e) {
- ServletUIPlugin.log(e);
- }
- }
- return false;
- }
-
- @Override
- protected void validateProjectRequirements(IProject project)
- {
- if(JavaEEProjectUtilities.isWebFragmentProject(project)){
- // don't create a web DD, since web fragment project is created with one.
- model.setBooleanProperty(GENERATE_DD, Boolean.FALSE);
- return;
- }
- IVirtualComponent component = ComponentCore.createComponent(project);
- if(component.getRootFolder() != null
- && component.getRootFolder().getUnderlyingFolder() != null){
- IFile ddXmlFile = component.getRootFolder().getUnderlyingFolder().getFile(new Path(J2EEConstants.WEBAPP_DD_URI));
- if (!ddXmlFile.exists())
- {
- // add a flag into the model to create the DD at the beginning of the operation
- model.setBooleanProperty(GENERATE_DD, Boolean.TRUE);
- }
- else
- {
- // don't create a DD, since one already exists.
- model.setBooleanProperty(GENERATE_DD, Boolean.FALSE);
- }
- }
- }
-
- protected Object getSelectedObject() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- ISelection selection = window.getSelectionService().getSelection();
- if (selection == null)
- return null;
- if (!(selection instanceof IStructuredSelection))
- return null;
- IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() != 1)
- return null;
- return ssel.getFirstElement();
- }
-
- private IType getPrimaryType(ICompilationUnit cu) {
- return cu.getType(new Path(cu.getElementName()).removeFileExtension().toString());
- }
-
- private boolean isObjectSubclassOf(Object obj, String base) {
- IJavaElement jelem = getJavaElement(obj);
-
- try {
- if (jelem != null) {
- if (jelem instanceof ICompilationUnit) {
- ICompilationUnit cu = (ICompilationUnit) jelem;
- jelem = getPrimaryType(cu);
- }
-
- if (jelem instanceof IType && ((IType) jelem).isClass()) {
- IType type = (IType) jelem;
- ITypeHierarchy typeHierarchy = type.newTypeHierarchy(null);
- for (IType superType : typeHierarchy.getAllSuperInterfaces(type)) {
- if (base.equals(superType.getFullyQualifiedName()))
- return true;
- }
- }
- }
- } catch (JavaModelException e) {
- ServletUIPlugin.log(e);
- }
-
- return false;
- }
-
- protected boolean isServlet(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Servlet)
- return true;
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Servlet)
- return true;
-
- return isObjectSubclassOf(obj, IServletConstants.QUALIFIED_SERVLET);
- }
-
- protected boolean isFilter(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Filter)
- return true;
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Filter)
- return true;
-
- return isObjectSubclassOf(obj, IServletConstants.QUALIFIED_FILTER);
- }
-
- private String getJavaClass(Object obj) {
- IJavaElement jelem = getJavaElement(obj);
-
- if (jelem == null) {
- throw new IllegalArgumentException("the object parameter must be instance of IJavaElement"); //$NON-NLS-1$
- }
-
- if (jelem instanceof ICompilationUnit) {
- ICompilationUnit cu = (ICompilationUnit) jelem;
- jelem = getPrimaryType(cu);
- }
- return ((IType) jelem).getFullyQualifiedName();
- }
-
- protected String getServletClass(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Servlet) {
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) obj;
- return servlet.getServletClass();
- }
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Servlet) {
- org.eclipse.jst.j2ee.webapplication.Servlet servlet = (org.eclipse.jst.j2ee.webapplication.Servlet) obj;
- return servlet.getServletClass().getQualifiedName();
- }
-
- return getJavaClass(obj);
- }
-
- protected String getFilterClass(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Filter) {
- org.eclipse.jst.javaee.web.Filter filter = (org.eclipse.jst.javaee.web.Filter) obj;
- return filter.getFilterClass();
- }
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Filter) {
- org.eclipse.jst.j2ee.webapplication.Filter filter = (org.eclipse.jst.j2ee.webapplication.Filter) obj;
- return filter.getFilterClass().getQualifiedName();
- }
-
- return getJavaClass(obj);
- }
-
- protected String getServletName(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Servlet) {
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) obj;
- return servlet.getServletName();
- }
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Servlet) {
- org.eclipse.jst.j2ee.webapplication.Servlet servlet = (org.eclipse.jst.j2ee.webapplication.Servlet) obj;
- return servlet.getServletName();
- }
-
- String servletClass = getServletClass(obj);
- IProject project = getJavaElement(obj).getJavaProject().getProject();
- IModelProvider provider = ModelProviderManager.getModelProvider(project);
- Object modelObject = provider.getModelObject();
- if (modelObject instanceof org.eclipse.jst.javaee.web.WebApp) {
- org.eclipse.jst.javaee.web.WebApp webApp = (org.eclipse.jst.javaee.web.WebApp) modelObject;
- Iterator servlets = webApp.getServlets().iterator();
- while (servlets.hasNext()) {
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) servlets.next();
- String qualified = servlet.getServletClass();
- if (qualified.equals(servletClass)) {
- return servlet.getServletName();
- }
- }
- } else if (modelObject instanceof org.eclipse.jst.j2ee.webapplication.WebApp) {
- org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) modelObject;
- Iterator servlets = webApp.getServlets().iterator();
- while (servlets.hasNext()) {
- org.eclipse.jst.j2ee.webapplication.Servlet servlet = (org.eclipse.jst.j2ee.webapplication.Servlet) servlets.next();
- String qualified = servlet.getServletClass().getQualifiedName();
- if (qualified.equals(servletClass)) {
- return servlet.getServletName();
- }
- }
- }
-
- return null;
- }
-
- protected boolean isServletJSP(Object obj) {
- return getServletJSPFile(obj) != null;
- }
-
- protected String getServletJSPFile(Object obj) {
- if (obj instanceof org.eclipse.jst.javaee.web.Servlet) {
- org.eclipse.jst.javaee.web.Servlet servlet = (org.eclipse.jst.javaee.web.Servlet) obj;
- return servlet.getJspFile();
- }
-
- if (obj instanceof org.eclipse.jst.j2ee.webapplication.Servlet) {
- org.eclipse.jst.j2ee.webapplication.Servlet servlet = (org.eclipse.jst.j2ee.webapplication.Servlet) obj;
- org.eclipse.jst.j2ee.webapplication.WebType webType = servlet.getWebType();
- if (webType.isJspType()) {
- org.eclipse.jst.j2ee.webapplication.JSPType jspType = (org.eclipse.jst.j2ee.webapplication.JSPType) webType;
- return jspType.getJspFile();
- }
- }
-
- return null;
- }
-
- protected boolean isWebFolder(Object obj) {
- if (obj instanceof IFolder) {
- return WebUtilities.isWebResource(obj);
- }
- return false;
- }
-
- protected boolean isJSP(Object obj) {
- if (obj instanceof IFile) {
- IFile file = (IFile) obj;
- return WebUtilities.isWebResource(file) && file.getName().endsWith(J2EEFileUtil.DOT_JSP);
- }
- return false;
- }
-
- protected String getWebResourcePath(IResource resource) {
- IVirtualComponent comp = ComponentCore.createComponent(resource.getProject());
- if (comp != null) {
- IPath rootPath = comp.getRootFolder().getWorkspaceRelativePath();
- return "/" + resource.getFullPath().makeRelativeTo(rootPath).toString(); //$NON-NLS-1$
- }
- return null;
- }
-
- protected String makeFirstCharUppercase(String str) {
- if (str == null || str.length() == 0)
- return str;
-
- StringBuilder builder = new StringBuilder(str);
- builder.setCharAt(0, Character.toUpperCase(builder.charAt(0)));
- return builder.toString();
- }
-
- protected String getFileNameWithouFileExtension(IFile file) {
- String name = file.getName();
- String ext = file.getFileExtension();
-
- if (ext == null)
- return name;
-
- return name.substring(0, name.length() - (ext.length() + 1));
- }
-
- protected void checkExistingButton(boolean state) {
- existingButton.setSelection(state);
- existingButton.notifyListeners(SWT.Selection, new Event());
- }
-
- @Override
- protected boolean isProjectValid(IProject project) {
- boolean result;
- try {
- result = project.isAccessible() &&
- project.hasNature(IModuleConstants.MODULE_NATURE_ID) &&
- (JavaEEProjectUtilities.isDynamicWebProject(project) || JavaEEProjectUtilities.isWebFragmentProject(project));
- } catch (CoreException ce) {
- result = false;
- }
- return result;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebWizard.java
deleted file mode 100644
index d1f6fb9..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Kaloyan Raev, kaloyan.raev@sap.com
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;
-
-/**
- * @author jlanuti
- */
-public abstract class NewWebWizard extends DataModelWizard implements INewWizard {
-
- /**
- * @param model
- */
- public NewWebWizard(IDataModel model) {
- super(model);
- }
-
- /**
- * Default constructor
- */
- public NewWebWizard() {
- super();
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- getDataModel();
- }
-
- protected IStructuredSelection getCurrentSelection() {
- IWorkbenchWindow window = ServletUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- ISelection selection = window.getSelectionService().getSelection();
- if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection) selection;
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ServletDataModelSyncHelper.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ServletDataModelSyncHelper.java
deleted file mode 100644
index ce69dac..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/ServletDataModelSyncHelper.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
-
-public class ServletDataModelSyncHelper extends DataModelSynchHelper {
- protected Map widgetToValueHash;
- protected MultipleCheckboxSelectionListener multipleCheckboxSelectionListener;
-
- public ServletDataModelSyncHelper(IDataModel model) {
- super(model);
- }
-
- /**
- * Sets the UI to have the property value defined in the model
- *
- * @param propertyName
- * @link IDataModelListener for the flag values.
- */
- @Override
- public void synchUIWithModel(final String propertyName, final int flag) {
- if (null != propertyToWidgetHash && propertyToWidgetHash.containsKey(propertyName)) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- Object obj = propertyToWidgetHash.get(propertyName);
- if (obj != null) {
- if (obj instanceof List) {
- List widgets = (List) obj;
- for (int i = 0; i < widgets.size(); i++) {
- currentWidget = (Widget) widgets.get(i);
- synchUIWithModel(propertyName, flag, currentWidget);
- }
- } else {
- currentWidget = (Widget) obj;
- synchUIWithModel(propertyName, flag, currentWidget);
- }
- }
- } finally {
- currentWidget = null;
- }
- }
- });
- }
- }
-
- protected void synchUIWithModel(final String propertyName, final int flag, Widget currentWidget) {
- if (currentWidget != null && currentWidget != currentWidgetFromEvent) {
- //We must hold a copy in a temp variable because setting the widget value
- //may trigger an event that will cause this method to be called again.
- Widget widget = currentWidget;
- try {
- ignoreModifyEvent = true;
- if (currentWidget instanceof Text)
- setWidgetValue(propertyName, flag, (Text) currentWidget);
- else if (currentWidget instanceof Combo) {
- setWidgetValue(propertyName, flag, (Combo) currentWidget);
- } else if (currentWidget instanceof Button)
- setWidgetValue(propertyName, flag, (Button) currentWidget);
- else if (currentWidget instanceof Label)
- setWidgetValue(propertyName, flag, (Label) currentWidget);
- else if (currentWidget instanceof List)
- setWidgetValue(propertyName, flag, (org.eclipse.swt.widgets.List) currentWidget);
- else if (currentWidget instanceof Table)
- setWidgetValue(propertyName, flag, (Table) currentWidget);
- else if (currentWidget instanceof Tree)
- setWidgetValue(propertyName, flag, (Tree) currentWidget);
- } finally {
- ignoreModifyEvent = false;
- }
- //Pass the copy of the currentWidget
- setEnablement((Control) widget, dataModel.isPropertyEnabled(propertyName));
- }
- }
-
- @Override
- protected void setWidgetValue(String propertyName, int flag, Button button) {
- if ((button.getStyle() & SWT.CHECK) == SWT.CHECK) {
- Object propertyValue = dataModel.getProperty(propertyName);
- if (propertyValue instanceof java.util.List) {
- List value = (List) propertyValue;
- Object buttonValue = widgetToValueHash.get(button);
- boolean exists = value.contains(buttonValue);
- if (button.getSelection() != exists) {
- button.setSelection(exists);
- }
- return;
- }
- }
- }
-
- private class MultipleCheckboxSelectionListener implements SelectionListener {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.getSource();
- if (currentWidget == button)
- return;
- try {
- currentWidgetFromEvent = button;
- String propertyName = (String) widgetToPropertyHash.get(button);
- Object propertyValue = widgetToValueHash.get(button);
-
- Object contents = dataModel.getProperty(propertyName);
-
- if (contents == null) {
- contents = new ArrayList();
- }
- if (contents instanceof java.util.List) {
- List list = (List) contents;
- if (button.getSelection()) {
- if (!list.contains(propertyValue))
- list.add(propertyValue);
- } else {
- list.remove(propertyValue);
- }
- setProperty(propertyName, list);
- dataModel.notifyPropertyChange(propertyName, DataModelEvent.VALUE_CHG);
- }
- } finally {
- currentWidgetFromEvent = null;
- }
- }
-
-
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- }
-
- public void synchCheckbox(Button checkbox, String textValue, String propertyName, Control[] dependentControls) {
- setCompositeValue(checkbox, textValue);
- synchComposite(checkbox, propertyName, dependentControls);
- if (multipleCheckboxSelectionListener == null) {
- multipleCheckboxSelectionListener = new MultipleCheckboxSelectionListener();
- }
- checkbox.addSelectionListener(multipleCheckboxSelectionListener);
- }
-
- protected void setCompositeValue(Widget widget, Object value) {
- if (widgetToValueHash == null)
- widgetToValueHash = new HashMap();
- widgetToValueHash.put(widget, value);
- }
-
- @Override
- protected void synchComposite(Widget widget, String propertyName, Control[] depControls) {
- if (null == widgetToPropertyHash)
- widgetToPropertyHash = new HashMap();
- if (propertyToWidgetHash == null)
- propertyToWidgetHash = new HashMap();
- widgetToPropertyHash.put(widget, propertyName);
- Object value = propertyToWidgetHash.get(propertyName);
- List widgets;
- if (value == null || !(value instanceof List)) {
- widgets = new ArrayList();
- } else {
- widgets = (List) value;
- }
- widgets.add(widget);
- propertyToWidgetHash.put(propertyName, widgets);
-
- if (depControls != null) {
- if (widgetToDepControls == null)
- widgetToDepControls = new HashMap();
- widgetToDepControls.put(widget, depControls);
- }
- synchUIWithModel(propertyName, DataModelEvent.VALUE_CHG);
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/SimpleTypedElementSelectionValidator.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/SimpleTypedElementSelectionValidator.java
deleted file mode 100644
index a05cca4..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/SimpleTypedElementSelectionValidator.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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 Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-
-/**
- * Implementation of a <code>ISelectionValidator</code> to validate the type
- * of an element. Empty selections are not accepted.
- */
-public class SimpleTypedElementSelectionValidator implements ISelectionStatusValidator {
-
- private IStatus fgErrorStatus = new Status(IStatus.ERROR, ServletUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- private IStatus fgOKStatus = new Status(IStatus.OK, ServletUIPlugin.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
-
- private Class[] fAcceptedTypes;
- private boolean fAllowMultipleSelection;
-
- /**
- * @param acceptedTypes
- * The types accepted by the validator
- * @param allowMultipleSelection
- * If set to <code>true</code>, the validator allows
- * multiple selection.
- */
- public SimpleTypedElementSelectionValidator(Class[] acceptedTypes, boolean allowMultipleSelection) {
- org.eclipse.core.runtime.Assert.isNotNull(acceptedTypes);
- fAcceptedTypes = acceptedTypes;
- fAllowMultipleSelection = allowMultipleSelection;
- }
-
- /*
- * @see org.eclipse.ui.dialogs.ISelectionValidator#isValid(java.lang.Object)
- */
- public IStatus validate(Object[] elements) {
- if (isValid(elements)) {
- return fgOKStatus;
- }
- return fgErrorStatus;
- }
-
- private boolean isOfAcceptedType(Object o) {
- for (int i = 0; i < fAcceptedTypes.length; i++) {
- if (fAcceptedTypes[i].isInstance(o)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isValid(Object[] selection) {
- if (selection.length == 0) {
- return false;
- }
-
- if (!fAllowMultipleSelection && selection.length != 1) {
- return false;
- }
-
- for (int i = 0; i < selection.length; i++) {
- Object o = selection[i];
- if (!isOfAcceptedType(o)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringArrayTableWizardSectionCallback.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringArrayTableWizardSectionCallback.java
deleted file mode 100644
index e75f6c1..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringArrayTableWizardSectionCallback.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jst.j2ee.internal.wizard.StringArrayTableWizardSection.StringArrayDialogCallback;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Implementation of the <code>StringArrayDialogCallback</code> interface for
- * both "Initialization Parameters" and "URL Mappings" table views.
- */
-public class StringArrayTableWizardSectionCallback implements
- StringArrayDialogCallback {
-
- /**
- * The first text field should not be empty.
- */
- public boolean validate(Text[] texts) {
- if (texts.length > 0) {
- return texts[0].getText().trim().length() > 0;
- }
- return true;
- }
-
- /**
- * Trims the text values.
- */
- public String[] retrieveResultStrings(Text[] texts) {
- int n = texts.length;
- String[] result = new String[n];
- for (int i = 0; i < n; i++) {
- result[i] = texts[i].getText().trim();
- }
- return result;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringMatcher.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringMatcher.java
deleted file mode 100644
index d148b9c..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/StringMatcher.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*******************************************************************************
- * 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
- *
- *
- * Note: this class was copied from org.eclipse.jst.internal.ui.util
- * It has much requested as an API since there are a dozen such copies throughout
- * Eclipse and related projects. (Such as, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=12214)
- * These requests have been rejected since, all users should eventually migrate to use javax.regx
- * counterparts instead.
- *
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import java.util.*;
-
-/**
- * A string pattern matcher. Supports '*' and '?' wildcards.
- */
-public class StringMatcher {
- protected String fPattern;
- protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
- protected boolean fHasLeadingStar;
- protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
-
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound= 0;
-
-
- protected static final char fSingleWildCard= '\u0000';
-
- public static class Position {
- int start; //inclusive
- int end; //exclusive
- public Position(int start, int end) {
- this.start= start;
- this.end= end;
- }
- public int getStart() {
- return start;
- }
- public int getEnd() {
- return end;
- }
- }
- /**
- * StringMatcher constructor takes in a String object that is a simple
- * pattern. The pattern may contain '*' for 0 and many characters and
- * '?' for exactly one character.
- *
- * Literal '*' and '?' characters must be escaped in the pattern
- * e.g., "\*" means literal "*", etc.
- *
- * Escaping any other character (including the escape character itself),
- * just results in that character in the pattern.
- * e.g., "\a" means "a" and "\\" means "\"
- *
- * If invoking the StringMatcher with string literals in Java, don't forget
- * escape characters are represented by "\\".
- *
- * @param pattern the pattern to match text against
- * @param ignoreCase if true, case is ignored
- * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
- * (everything is taken literally).
- */
- public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
- if (pattern == null)
- throw new IllegalArgumentException();
- fIgnoreCase= ignoreCase;
- fIgnoreWildCards= ignoreWildCards;
- fPattern= pattern;
- fLength= pattern.length();
-
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
- parseWildCards();
- }
- }
- /**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param text the String object to search in
- * @param start the starting index of the search range, inclusive
- * @param end the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
- * pattern in the specified range of the text; return null if not found or subtext
- * is empty (start==end). A pair of zeros is returned if pattern is empty string
- * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
- * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
- */
- public StringMatcher.Position find(String text, int start, int end) {
- if (text == null)
- throw new IllegalArgumentException();
-
- int tlen= text.length();
- int innerStart = start;
- int innerEnd = end;
- if (innerStart < 0)
- innerStart= 0;
- if (innerEnd > tlen)
- innerEnd= tlen;
- if (innerEnd < 0 ||innerStart >= innerEnd )
- return null;
- if (fLength == 0)
- return new Position(innerStart, innerStart);
- if (fIgnoreWildCards) {
- int x= posIn(text, innerStart, innerEnd);
- if (x < 0)
- return null;
- return new Position(x, x+fLength);
- }
-
- int segCount= fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (innerStart, innerEnd);
-
- int curPos= innerStart;
- int matchStart= -1;
- int i;
- for (i= 0; i < segCount && curPos < innerEnd; ++i) {
- String current= fSegments[i];
- int nextMatch= regExpPosIn(text, curPos, innerEnd, current);
- if (nextMatch < 0 )
- return null;
- if(i == 0)
- matchStart= nextMatch;
- curPos= nextMatch + current.length();
- }
- if (i < segCount)
- return null;
- return new Position(matchStart, curPos);
- }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched eitherwise false
- * @param text a String object
- */
- public boolean match(String text) {
- return match(text, 0, text.length());
- }
- /**
- * Given the starting (inclusive) and the ending (exclusive) positions in the
- * <code>text</code>, determine if the given substring matches with aPattern
- * @return true if the specified portion of the text matches the pattern
- * @param text a String object that contains the substring to match
- * @param start marks the starting position (inclusive) of the substring
- * @param end marks the ending index (exclusive) of the substring
- */
- public boolean match(String text, int start, int end) {
- if (null == text)
- throw new IllegalArgumentException();
-
- int innerStart = start;
- int innerEnd = end;
-
- if (innerStart > innerEnd)
- return false;
-
- if (fIgnoreWildCards)
- return (innerEnd - innerStart == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, innerStart, fLength);
- int segCount= fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
- return true;
- if (innerStart == innerEnd)
- return fLength == 0;
- if (fLength == 0)
- return innerStart == innerEnd;
-
- int tlen= text.length();
- if (innerStart < 0)
- innerStart= 0;
- if (innerEnd > tlen)
- innerEnd= tlen;
-
- int tCurPos= innerStart;
- int bound= innerEnd - fBound;
- if ( bound < 0)
- return false;
- int i=0;
- String current= fSegments[i];
- int segLength= current.length();
-
- /* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, innerStart, current, 0, segLength)) {
- return false;
- }
- ++i;
- tCurPos= tCurPos + segLength;
- }
- if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
- // only one segment to match, no wildcards specified
- return tCurPos == innerEnd;
- }
- /* process middle segments */
- while (i < segCount) {
- current= fSegments[i];
- int currentMatch;
- int k= current.indexOf(fSingleWildCard);
- if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, innerEnd, current);
- if (currentMatch < 0)
- return false;
- } else {
- currentMatch= regExpPosIn(text, tCurPos, innerEnd, current);
- if (currentMatch < 0)
- return false;
- }
- tCurPos= currentMatch + current.length();
- i++;
- }
-
- /* process final segment */
- if (!fHasTrailingStar && tCurPos != innerEnd) {
- int clen= current.length();
- return regExpRegionMatches(text, innerEnd - clen, current, 0, clen);
- }
- return i == segCount ;
- }
-
- /**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * Since wildcards are not being used in this case, the pattern consists of a single segment.
- */
- private void parseNoWildCards() {
- fSegments= new String[1];
- fSegments[0]= fPattern;
- fBound= fLength;
- }
- /**
- * Parses the given pattern into segments seperated by wildcard '*' characters.
- */
- private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar= true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
- /* make sure it's not an escaped wildcard */
- if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar= true;
- }
- }
-
- Vector temp= new Vector();
-
- int pos= 0;
- StringBuffer buf= new StringBuffer();
- while (pos < fLength) {
- char c= fPattern.charAt(pos++);
- switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
- } else {
- char next= fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
- break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default:
- buf.append(c);
- }
- }
-
- /* add last buffer to segment list */
- if (buf.length() > 0) {
- temp.addElement(buf.toString());
- fBound += buf.length();
- }
-
- fSegments= new String[temp.size()];
- temp.copyInto(fSegments);
- }
- /**
- * @param text a string which contains no wildcard
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int posIn(String text, int start, int end) {//no wild card in pattern
- int max= end - fLength;
-
- if (!fIgnoreCase) {
- int i= text.indexOf(fPattern, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength))
- return i;
- }
-
- return -1;
- }
- /**
- * @param text a simple regular expression that may only contain '?'(s)
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @param p a simple regular expression that may contains '?'
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int regExpPosIn(String text, int start, int end, String p) {
- int plen= p.length();
-
- int max= end - plen;
- for (int i= start; i <= max; ++i) {
- if (regExpRegionMatches(text, i, p, 0, plen))
- return i;
- }
- return -1;
- }
-
-
- protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
- int innerPlen = plen;
- int innerTStart = tStart;
- int innerPStart = pStart;
- while (innerPlen-- > 0) {
- char tchar= text.charAt(innerTStart++);
- char pchar= p.charAt(innerPStart++);
-
- /* process wild cards */
- if (!fIgnoreWildCards) {
- /* skip single wild cards */
- if (pchar == fSingleWildCard) {
- continue;
- }
- }
- if (pchar == tchar)
- continue;
- if (fIgnoreCase) {
- if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar))
- continue;
- // comparing after converting to upper case doesn't handle all cases;
- // also compare after converting to lower case
- if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
- continue;
- }
- return false;
- }
- return true;
- }
- /**
- * @param text the string to match
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @param p a string that has no wildcard
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int textPosIn(String text, int start, int end, String p) {
-
- int plen= p.length();
- int max= end - plen;
-
- if (!fIgnoreCase) {
- int i= text.indexOf(p, start);
- if (i == -1 || i > max)
- return -1;
- return i;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen))
- return i;
- }
-
- return -1;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.java
deleted file mode 100644
index a498a9b..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2006 BEA Systems, Inc.
- * 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:
- * Konstantin Komissarchik - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
-import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
-import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.jst.j2ee.internal.web.classpath.WebAppLibrariesContainer;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-
-public class WebAppLibrariesContainerPage
-
- extends NewElementWizardPage
- implements IClasspathContainerPage, IClasspathContainerPageExtension
-
-{
- private IProject ownerProject;
- private String libsProjectName;
- private Combo projectsCombo;
-
- public WebAppLibrariesContainerPage()
- {
- super( "WebAppLibrariesContainerPage" ); //$NON-NLS-1$
-
- setTitle( Resources.pageTitle );
- setDescription( Resources.pageDescription );
- }
-
- public IClasspathEntry getSelection()
- {
- IPath path = new Path( WebAppLibrariesContainer.CONTAINER_ID );
-
- final int index = this.projectsCombo.getSelectionIndex();
- if(index != -1){
- final String selectedProjectName = this.projectsCombo.getItem( index );
-
- if( this.ownerProject == null ||
- ! selectedProjectName.equals( this.ownerProject.getName() ) )
- {
- path = path.append( selectedProjectName );
- }
- }
-
- return JavaCore.newContainerEntry( path );
- }
-
- public void setSelection( final IClasspathEntry cpentry )
- {
- final IPath path = cpentry == null ? null : cpentry.getPath();
-
- if( path == null || path.segmentCount() == 1 )
- {
- if( this.ownerProject != null )
- {
- this.libsProjectName = this.ownerProject.getName();
- }
- }
- else
- {
- this.libsProjectName = path.segment( 1 );
- }
- }
-
- public void createControl( final Composite parent )
- {
- final Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( new GridLayout( 2, false ) );
-
- final Label label = new Label( composite, SWT.NONE );
- label.setText( Resources.projectsLabel );
-
- final String[] webProjects = getWebProjects();
-
- this.projectsCombo = new Combo( composite, SWT.READ_ONLY );
- this.projectsCombo.setItems( webProjects );
-
- final int index;
-
- if( this.ownerProject != null )
- {
- index = indexOf( webProjects, this.libsProjectName );
- }
- else
- {
- if( this.projectsCombo.getItemCount() > 0 )
- {
- index = 0;
- }
- else
- {
- index = -1;
- }
- }
-
- if( index != -1 )
- {
- this.projectsCombo.select( index );
- }
-
- final GridData gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.minimumWidth = 100;
-
- this.projectsCombo.setLayoutData( gd );
-
- setControl( composite );
- }
-
- public boolean finish()
- {
- return true;
- }
-
- public void initialize( final IJavaProject project,
- final IClasspathEntry[] currentEntries )
- {
- this.ownerProject = ( project == null ? null : project.getProject() );
- }
-
- private static String[] getWebProjects()
- {
- try
- {
- final Set projects
- = ProjectFacetsManager.getFacetedProjects( WebFacetUtils.WEB_FACET );
-
- final String[] names = new String[ projects.size() ];
- int i = 0;
-
- for( Iterator itr = projects.iterator(); itr.hasNext(); i++ )
- {
- final IFacetedProject fproj = (IFacetedProject) itr.next();
- names[ i ] = fproj.getProject().getName();
- }
-
- Arrays.sort( names );
-
- return names;
- }
- catch( CoreException e )
- {
- ServletUIPlugin.log( e.getStatus() );
- return new String[ 0 ];
- }
- }
-
- private static int indexOf( final String[] array,
- final String str )
- {
- for( int i = 0; i < array.length; i++ )
- {
- if( array[ i ].equals( str ) )
- {
- return i;
- }
- }
-
- return -1;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String pageTitle;
- public static String pageDescription;
- public static String projectsLabel;
-
- static
- {
- initializeMessages( WebAppLibrariesContainerPage.class.getName(),
- Resources.class );
- }
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.properties b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.properties
deleted file mode 100644
index 85621ab..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebAppLibrariesContainerPage.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# 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
-###############################################################################
-pageTitle = Web App Libraries
-pageDescription = This container dynamically manages classpath entries for types in the WEB-INF/lib and WEB-INF/classes directories.
-projectsLabel = Project:\
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportPage.java
deleted file mode 100644
index 66b7631..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportPage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleExportPage;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class WebComponentExportPage extends J2EEModuleExportPage {
- /**
- * @param model
- * @param pageName
- */
- public WebComponentExportPage(IDataModel model, String pageName, IStructuredSelection selection) {
- super(model, pageName, selection);
- setTitle(WEBUIMessages.WEB_EXPORT_MAIN_PG_TITLE);
- setDescription(WEBUIMessages.WEB_EXPORT_MAIN_PG_DESC);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_EXPORT_WIZARD_BANNER));
- setInfopopID(IWebUIContextIds.WAR_EXPORT_PAGE1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
- */
- @Override
- protected String getComponentLabel() {
- return WEBUIMessages.WEB_PROJECT_LBL;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
- */
- @Override
- protected String[] getFilterExpression() {
- return new String[]{"*.war"}; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
- */
- @Override
- protected boolean isMetaTypeSupported(Object o) {
- return o instanceof org.eclipse.jst.j2ee.webapplication.WebApp;
- }
-
- @Override
- protected String getComponentID() {
- return "JST_WEB"; //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportWizard.java
deleted file mode 100644
index ccc4021..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentExportWizard.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactExportWizard;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-
-/**
- * <p>
- * Wizard used to export J2EE Web Application module structures
- * from the Eclipse Workbench to a deployable Web Application
- * Archive *.war file.
- * </p>
- */
-public final class WebComponentExportWizard extends J2EEArtifactExportWizard implements IExportWizard {
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection,
- * no model instance, and no operation instance. The model and
- * operation will be created as needed.
- * </p>
- */
- public WebComponentExportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls
- * and interface with the operation.
- * </p>
- * @param model The model parameter is used to pre-populate wizard controls and interface with the operation
- */
- public WebComponentExportWizard(IDataModel model) {
- super(model);
- }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new WebComponentExportDataModelProvider();
- }
- /**
- * <p>
- * Adds the following pages:
- * <ul>
- * <li> {@link WebComponentExportPage} as the main wizard page ({@link #MAIN_PG})
- * </ul>
- * </p>
- */
- @Override
- public void doAddPages() {
- addPage(new WebComponentExportPage(getDataModel(), MAIN_PG, getSelection()));
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the default wizard page image.
- * </p>
- */
- @Override
- protected void doInit() {
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_EXPORT_WIZARD_BANNER));
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportPage.java
deleted file mode 100644
index 12ed5a9..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportPage.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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
- *******************************************************************************/
-/*
- * Created on Dec 3, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleImportPage;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class WebComponentImportPage extends J2EEModuleImportPage {
- /**
- * @param model
- * @param pageName
- */
- public WebComponentImportPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(WEBUIMessages.WEB_IMPORT_MAIN_PG_TITLE);
- setDescription(WEBUIMessages.WEB_IMPORT_MAIN_PG_DESC);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_IMPORT_WIZARD_BANNER));
- setInfopopID(IWebUIContextIds.WAR_IMPORT_PAGE1);
- }
-
- @Override
- protected String getFileImportLabel() {
- return WEBUIMessages.WEB_FILE_LBL;
- }
-
- @Override
- protected String[] getFilterExpression() {
- return new String[]{"*.war"}; //$NON-NLS-1$
- }
-
- @Override
- protected String getProjectImportLabel() {
- return WEBUIMessages.WEB_PROJECT_LBL;
- }
-
- @Override
- protected void createAnnotationsStandaloneGroup(Composite composite) {
- // TODO: implement with new import wizards
- // new AnnotationsStandaloneGroup(composite, getWebDataModel(), false);
- }
-
- @Override
- protected String getModuleFacetID(){
- return J2EEProjectUtilities.DYNAMIC_WEB;
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWebLibsPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWebLibsPage.java
deleted file mode 100644
index 55d8e3e..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWebLibsPage.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.servlet.ui.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
-import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEImportPage;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-
-/**
- * @author cbridgha
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class WebComponentImportWebLibsPage extends J2EEImportPage {
- private Button deselectAllButton;
- private Button selectAllButton;
- protected ArchiveWrapper archiveWrapper;
- public CheckboxTableViewer availableJARsViewer;
- public boolean utilJarSelectionChanged = false;
-
- /**
- * @param model
- * @param pageName
- */
- public WebComponentImportWebLibsPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(WEBUIMessages.WEB_IMPORT_WEB_LIB_PG_TITLE);
- setDescription(WEBUIMessages.WEB_IMPORT_WEB_LIB_PG_DESC);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_IMPORT_WIZARD_BANNER));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizardPage#createTopLevelComposite(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- setInfopopID(IWebUIContextIds.WAR_IMPORT_PAGE2);
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createAvailableJarsList(composite);
- createButtonsGroup(composite);
- return composite;
- }
-
- /*
- * Updates the enable state of the all buttons
- */
- protected void updateButtonEnablements() {
- utilJarSelectionChanged = true;
- }
-
- protected void createAvailableJarsList(Composite listGroup) {
- availableJARsViewer = CheckboxTableViewer.newCheckList(listGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData gData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- gData.widthHint = 200;
- gData.heightHint = 80;
- availableJARsViewer.getControl().setLayoutData(gData);
- AvailableWebLibProvider libsProvider = new AvailableWebLibProvider();
- availableJARsViewer.setContentProvider(libsProvider);
- availableJARsViewer.setLabelProvider(libsProvider);
- availableJARsViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- availableJARCheckStateChanged(event);
- }
- });
- availableJARsViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateButtonEnablements();
- }
- });
- TableLayout tableLayout = new TableLayout();
- availableJARsViewer.getTable().setLayout(tableLayout);
- availableJARsViewer.getTable().setHeaderVisible(false);
- availableJARsViewer.getTable().setLinesVisible(false);
-
- model.addListener(new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (event.getPropertyName().equals(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED)) {
- availableJARsViewer.setCheckedElements(((List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED)).toArray());
- }
- }
- });
- }
-
- private void handleDeselectAllButtonPressed() {
- ArrayList emptySelection = new ArrayList(2);
- model.setProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED, emptySelection);
- }
-
- private void handleSelectAllButtonPressed() {
- ArrayList allSelection = new ArrayList(2);
- Object selection = null;
- for (int i = 0; (null != (selection = availableJARsViewer.getElementAt(i))); i++) {
- allSelection.add(selection);
- }
- model.setProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED, allSelection);
- }
-
- protected void createButtonsGroup(org.eclipse.swt.widgets.Composite parent) {
- Composite buttonGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- buttonGroup.setLayout(layout);
- buttonGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- selectAllButton = new Button(buttonGroup, SWT.PUSH);
- selectAllButton.setText(WEBUIMessages.WAR_IMPORT_SELECT_ALL_LIBS_BUTTON);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 1;
- gd.heightHint = SWT.DEFAULT;
- gd.widthHint = SWT.DEFAULT;
- selectAllButton.setLayoutData(gd);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleSelectAllButtonPressed();
- }
- });
-
- deselectAllButton = new Button(buttonGroup, SWT.PUSH);
- deselectAllButton.setText(WEBUIMessages.WAR_IMPORT_DESELECT_ALL_LIBS_BUTTON);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- gd.heightHint = SWT.DEFAULT;
- gd.widthHint = SWT.DEFAULT;
- deselectAllButton.setLayoutData(gd);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleDeselectAllButtonPressed();
- }
- });
- }
-
- private void refreshEARFileIfNecessary() {
- if (isEARFileChanged()) {
- archiveWrapper = (ArchiveWrapper) model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- refresh();
- }
- }
-
- protected void setJARsCompositeEnabled(boolean enabled) {
- availableJARsViewer.getTable().setEnabled(enabled);
- availableJARsViewer.setAllChecked(false);
- availableJARsViewer.setAllGrayed(!enabled);
- selectAllButton.setEnabled(enabled);
- deselectAllButton.setEnabled(enabled);
- }
-
- private void refresh() {
- availableJARsViewer.setInput(archiveWrapper);
- }
-
- public boolean isEARFileChanged() {
- return archiveWrapper != model.getProperty(IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER);
- }
-
- @Override
- protected void enter() {
- super.enter();
- refreshEARFileIfNecessary();
- }
-
- public void availableJARCheckStateChanged(CheckStateChangedEvent event) {
- model.setProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED, getJARsForProjects());
- validatePage();
- }
-
- public List getJARsForProjects() {
- refreshEARFileIfNecessary();
- List result = new ArrayList();
- result.addAll(Arrays.asList(availableJARsViewer.getCheckedElements()));
- return result;
- }
-
- protected boolean isNullOrEmpty(String aString) {
- return aString == null || aString.length() == 0;
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[]{};
- }
-
- @Override
- protected void restoreWidgetValues() {
- // This page doesn't implement...
- }
-
- @Override
- public void storeDefaultSettings() {
- // This page doesn't implement...
- }
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWizard.java
deleted file mode 100644
index c840ec2..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/WebComponentImportWizard.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.internal.wizard;
-
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentImportWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-
-/**
- * <p>
- * Wizard used to import J2EE Web Application module structures into the Eclipse Workbench from an
- * existing Web Application *.war file.
- * </p>
- */
-public final class WebComponentImportWizard extends J2EEComponentImportWizard {
-
- protected static final String WEB_LIBS_PG = "WEB_LIBS_PG"; //$NON-NLS-1$
-
- /**
- * <p>
- * The default constructor. Creates a wizard with no selection, no model instance, and no
- * operation instance. The model and operation will be created as needed.
- * </p>
- */
- public WebComponentImportWizard() {
- super();
- }
-
- /**
- * <p>
- * The model is used to prepopulate the wizard controls and interface with the operation.
- * </p>
- *
- * @param model
- * The model parameter is used to pre-populate wizard controls and interface with the
- * operation
- */
- public WebComponentImportWizard(IDataModel model) {
- super(model);
- }
-
- /**
- * <p>
- * Adds an {@link WARImportPage} as the main wizard page ({@link #MAIN_PG}).
- * </p>
- */
- @Override
- public void doAddPages() {
- addPage(new WebComponentImportPage(getDataModel(), MAIN_PG));
- addPage(new WebComponentImportWebLibsPage(getDataModel(), WEB_LIBS_PG));
- }
-
- /**
- * {@inheritDoc}
- *
- * <p>
- * Sets up the dialog window title and default wizard page image.
- * </p>
- */
- @Override
- public final void doInit() {
- setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.IMPORT_WIZ_TITLE));
- setDefaultPageImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_IMPORT_WIZARD_BANNER));
- // updateEARToModelFromSelection(getSpecificDataModel());
- }
-
- @Override
- protected String[] getModuleValidatorStrings() {
- return new String[]{"org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator"}; //$NON-NLS-1$
- }
-
-
- // protected String getFinalPerspectiveID() {
- // // J2EEComponentCreationDataModel projCreationModel =
- // // getSpecificDataModel().getJ2EEModuleCreationDataModel();
- // // return projCreationModel.getStringProperty(ComponentCreationDataModel.FINAL_PERSPECTIVE);
- // return getDataModel().getStringProperty(ComponentCreationDataModel.FINAL_PERSPECTIVE);
- // }
-
- @Override
- protected IDataModelProvider getDefaultProvider() {
- return new WebComponentImportDataModelProvider();
- }
-
- @Override
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_WEB);
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.java
deleted file mode 100644
index 0e8e405..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.jst.servlet.ui.project.facet;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFragmentFacetInstallDataModelProperties;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
-
-
-public final class WebAppSelectionPanel implements IWebFragmentFacetInstallDataModelProperties
-
-{
- private final Button addToWar;
- private final Combo combo;
- private final Button newButton;
- private final Label label;
-
- private final IDataModel model;
- private DataModelSynchHelper synchhelper;
-
- public WebAppSelectionPanel( final IDataModel model, final Composite parent)
- {
- this.model = model;
- this.synchhelper = new DataModelSynchHelper(model);
-
- final Group group = new Group( parent, SWT.NONE );
- group.setLayoutData( gdhfill() );
- group.setLayout( new GridLayout( 3, false ) );
- group.setText( Resources.warMemberShip );
-
- this.addToWar = new Button( group, SWT.CHECK );
- this.addToWar.setText( Resources.addToWarLabel );
- GridDataFactory.defaultsFor(this.addToWar).span(3, 1).applyTo(this.addToWar);
- synchhelper.synchCheckbox(addToWar, ADD_TO_WAR, null);
-
- label = new Label(group, SWT.NULL);
- label.setText(Resources.warProjectLabel);
- this.combo = new Combo(group, SWT.NONE);
- this.combo.setLayoutData( gdhfill() );
-
- this.newButton = new Button( group, SWT.PUSH );
- this.newButton.setText( Resources.newButtonLabel );
- GridDataFactory.defaultsFor(this.newButton).applyTo(this.newButton);
-
- this.newButton.addSelectionListener( new SelectionAdapter()
- {
- @Override
- public void widgetSelected( final SelectionEvent event )
- {
- handleAddButton();
- }
- } );
-
- synchhelper.synchCombo(combo, WAR_PROJECT_NAME, new Control[]{label, newButton});
- Dialog.applyDialogFont(parent);
- }
-
- private void handleAddButton()
- {
- final WebProjectWizard wizard = new WebProjectWizard();
-
- final WizardDialog dialog
- = new WizardDialog( newButton.getShell(), wizard );
-
-/* IRuntime runtime = (IRuntime)model.getProperty(FACET_RUNTIME);
- wizard.ssetRuntimeInDataModel(runtime);
-*/
- if( dialog.open() != Window.CANCEL )
- {
- model.notifyPropertyChange(WAR_PROJECT_NAME, IDataModel.VALID_VALUES_CHG);
- final String warproj = wizard.getProjectName();
- model.setProperty(WAR_PROJECT_NAME, warproj);
- }
- }
-
- private static GridData gdhfill()
- {
- return new GridData( GridData.FILL_HORIZONTAL );
- }
-
- public static final GridData gdhspan( final GridData gd,
- final int span )
- {
- gd.horizontalSpan = span;
- return gd;
- }
-
- private static final class Resources
-
- extends NLS
-
- {
- public static String addToWarLabel;
- public static String newButtonLabel;
- public static String warProjectLabel;
- public static String warMemberShip;
-
- static
- {
- initializeMessages( WebAppSelectionPanel.class.getName(),
- Resources.class );
- }
- }
-
- public void dispose() {
- if(synchhelper != null){
- synchhelper.dispose();
- synchhelper = null;
- }
- }
-
- public String getComboText(){
- return combo.getText();
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.properties b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.properties
deleted file mode 100644
index bbf6b0b..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebAppSelectionPanel.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 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
-###############################################################################
-addToWarLabel = Add &project to a Dynamic Web project
-newButtonLabel = Ne&w...
-warProjectLabel=Dynamic Web pro&ject name:
-warMemberShip=Dynamic Web project membership
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.java
deleted file mode 100644
index e9b6aa0..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2005, 2006 BEA Systems, Inc. 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:
- * Konstantin Komissarchik - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ******************************************************************************/
-
-package org.eclipse.jst.servlet.ui.project.facet;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
-import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleFacetInstallPage;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
- */
-public class WebFacetInstallPage extends J2EEModuleFacetInstallPage implements IWebFacetInstallDataModelProperties {
- private Label contextRootLabel;
- private Text contextRoot;
- private Label contentDirLabel;
- private Text contentDir;
-
- public WebFacetInstallPage() {
- super("web.facet.install.page"); //$NON-NLS-1$
- setTitle(Resources.pageTitle);
- setDescription(Resources.pageDescription);
- }
-
- @Override
- protected Composite createTopLevelComposite(final Composite parent) {
- setInfopopID(IWebUIContextIds.NEW_DYNAMIC_WEB_PROJECT_PAGE3);
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
-
- this.contextRootLabel = new Label(composite, SWT.NONE);
- this.contextRootLabel.setText(Resources.contextRootLabel);
- this.contextRootLabel.setLayoutData(new GridData());
-
- this.contextRoot = new Text(composite, SWT.BORDER);
- this.contextRoot.setLayoutData(gdhfill());
- this.contextRoot.setData("label", this.contextRootLabel); //$NON-NLS-1$
- synchHelper.synchText(contextRoot, CONTEXT_ROOT, new Control[]{contextRootLabel});
-
- this.contentDirLabel = new Label(composite, SWT.NONE);
- this.contentDirLabel.setText(Resources.contentDirLabel);
- this.contentDirLabel.setLayoutData(new GridData());
-
- this.contentDir = new Text(composite, SWT.BORDER);
- this.contentDir.setLayoutData(gdhfill());
- this.contentDir.setData("label", this.contentDirLabel); //$NON-NLS-1$
- synchHelper.synchText(contentDir, CONFIG_FOLDER, null);
-
- new Label(composite, SWT.NONE); // pad
-
- createGenerateDescriptorControl(composite, J2EEConstants.WEBAPP_DD_SHORT_NAME);
- registerFacetVersionChangeListener();
-
- Dialog.applyDialogFont(parent);
-
- return composite;
- }
-
- @Override
- protected void handleFacetVersionChangedEvent()
- {
- String fv = model.getStringProperty(FACET_VERSION_STR);
- boolean isWeb25OrGreater = J2EEVersionUtil.convertVersionStringToInt(fv) >= J2EEVersionConstants.WEB_2_5_ID;
- this.addDD.setVisible(isWeb25OrGreater);
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[]{EAR_PROJECT_NAME, CONTEXT_ROOT, CONFIG_FOLDER, SOURCE_FOLDER};
- }
-
- private static final class Resources extends NLS {
- public static String pageTitle;
- public static String pageDescription;
- public static String contextRootLabel;
- public static String contentDirLabel;
-
- static {
- initializeMessages(WebFacetInstallPage.class.getName(), Resources.class);
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.properties b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.properties
deleted file mode 100644
index c408577..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFacetInstallPage.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-pageTitle = Web Module
-pageDescription = Configure web module settings.
-contextRootLabel = Context &root:
-contentDirLabel = Content &directory:
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectContentProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectContentProvider.java
deleted file mode 100644
index 0b0748b..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectContentProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
-
- * Copyright (c) 2010 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.jst.servlet.ui.project.facet;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-
-public class WebFragmentProjectContentProvider implements IStructuredContentProvider {
-
- public void dispose() {
- // Do nothing
- }
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- // Do nothing
- }
-
- public Object[] getElements(Object arg0) {
- if (arg0 instanceof IWorkspaceRoot) {
- IProject[] projects = ((IWorkspaceRoot) arg0).getProjects();
- if (projects != null && projects.length != 0) {
- List<IProject> theProjects = new ArrayList<IProject>(0);
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- try {
- if (FacetedProjectFramework.hasProjectFacet(project, IModuleConstants.JST_WEBFRAGMENT_MODULE)) {
- theProjects.add(project);
- }
- } catch (CoreException e) {
- ServletUIPlugin.log(e);
- }
- }
- return theProjects.toArray();
- }
- }
- return new Object[0];
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java
deleted file mode 100644
index 1b86aa5..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-
- * Copyright (c) 2010 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.jst.servlet.ui.project.facet;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage;
-import org.eclipse.jst.j2ee.web.project.facet.IWebFragmentProjectCreationDataModelProperties;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public class WebFragmentProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
-
- protected WebAppSelectionPanel warPanel;
- public WebFragmentProjectFirstPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- setTitle(Resources.pageTitle);
- setDescription(Resources.pageDescription);
- }
-
- private static final class Resources extends NLS {
- public static String pageTitle;
- public static String pageDescription;
- static {
- initializeMessages(WebFragmentProjectFirstPage.class.getName(), Resources.class);
- }
- }
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- setShouldAddEARComposite(false);
- final Composite top = super.createTopLevelComposite(parent);
- createWarComposite(top);
- createWorkingSetGroupPanel(top, new String[] { RESOURCE_WORKING_SET, JAVA_WORKING_SET });
- return top;
- }
-
- private void createWarComposite(Composite top)
- {
- final IFacetedProjectWorkingCopy fpjwc
- = (IFacetedProjectWorkingCopy) this.model.getProperty( FACETED_PROJECT_WORKING_COPY );
-
- final String moduleFacetId = getModuleTypeID();
- final IProjectFacet moduleFacet = ProjectFacetsManager.getProjectFacet( moduleFacetId );
- final IFacetedProject.Action action = fpjwc.getProjectFacetAction( moduleFacet );
-
- warPanel = new WebAppSelectionPanel( (IDataModel) action.getConfig(), top );
- }
-
- @Override
- protected String[] getValidationPropertyNames()
- {
- String[] superProperties = super.getValidationPropertyNames();
- List list = Arrays.asList(superProperties);
- ArrayList arrayList = new ArrayList();
- arrayList.addAll( list );
- arrayList.add( IWebFragmentProjectCreationDataModelProperties.WAR_PROJECT_NAME );
- arrayList.add( IWebFragmentProjectCreationDataModelProperties.ADD_TO_WAR );
- return (String[])arrayList.toArray( new String[0] );
- }
-
- @Override
- protected String getModuleFacetID() {
- return IModuleConstants.JST_WEBFRAGMENT_MODULE;
- }
-
- @Override
- protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
- {
- IRuntime runtime = (IRuntime)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
- final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( 2 );
-
- if(runtime != null) {
- facets.addAll(super.getFacetConfiguration(primaryFacetVersion));
- }
- else {
- facets.add(primaryFacetVersion);
-
- if(primaryFacetVersion == WebFacetUtils.WEBFRAGMENT_30)
- {
- facets.add(JavaFacetUtils.JAVA_60);
- }
- }
- return Collections.unmodifiableSet( facets );
- }
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.properties b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.properties
deleted file mode 100644
index 5233684..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 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
-###############################################################################
-pageTitle = Web Fragment
-pageDescription = Configure web fragment module settings.
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectLabelProvider.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectLabelProvider.java
deleted file mode 100644
index 0b4c74f..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectLabelProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
-
- * Copyright (c) 2010 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.jst.servlet.ui.project.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class WebFragmentProjectLabelProvider extends LabelProvider {
- private ILabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
- private ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
-
- @Override
- public Image getImage(Object o) {
- Image image = workbenchLabelProvider.getImage(o);
-
- if (o instanceof IProject) {
- Image decorated = decorator.decorateImage(image, o);
-
- if (decorated != null) {
- return decorated;
- }}
- return image;
- }
-
- @Override
- public String getText(Object o) {
- if (o instanceof IProject) {
- return ((IProject) o).getName();
- }
- return ""; //$NON-NLS-1$
- }
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectWizard.java
deleted file mode 100644
index 5f6843f..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectWizard.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
-
- * Copyright (c) 2010 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.jst.servlet.ui.project.facet;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jst.j2ee.web.project.facet.WebFragmentFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
-import org.osgi.framework.Bundle;
-
-
-public class WebFragmentProjectWizard extends NewProjectDataModelFacetWizard {
-
- public WebFragmentProjectWizard(IDataModel modelid) {
- super(modelid);
- setWindowTitle(WEBUIMessages.WEBFRAGMENT_MODULE_WIZ_TITLE);
- }
-
- public WebFragmentProjectWizard(){
- super();
- setWindowTitle(WEBUIMessages.WEBFRAGMENT_MODULE_WIZ_TITLE);
- }
-
- @Override
- protected IDataModel createDataModel() {
- return DataModelFactory.createDataModel(new WebFragmentFacetProjectCreationDataModelProvider());
- }
-
- @Override
- protected ImageDescriptor getDefaultPageImageDescriptor() {
- final Bundle bundle = Platform.getBundle("org.eclipse.jst.servlet.ui"); //$NON-NLS-1$
- final URL url = bundle.getEntry("icons/full/ctool16/webfragment_wizban.gif"); //$NON-NLS-1$
- return ImageDescriptor.createFromURL(url);
- }
-
- @Override
- protected IFacetedProjectTemplate getTemplate() {
- return ProjectFacetsManager.getTemplate("template.jst.webfragment"); //$NON-NLS-1$
- }
-
- @Override
- protected IWizardPage createFirstPage() {
- return new WebFragmentProjectFirstPage(model, "first.page"); //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java
deleted file mode 100644
index fe4506f..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.project.facet;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.jst.common.project.facet.JavaFacetUtils;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPluginIcons;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
-import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage;
-import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
-import org.eclipse.jst.servlet.ui.IWebUIContextIds;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public class WebProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
-
- public WebProjectFirstPage(IDataModel model, String pageName) {
- super(model, pageName);
- setTitle(WEBUIMessages.WEB_PROJECT_MAIN_PG_TITLE);
- setDescription(WEBUIMessages.WEB_PROJECT_MAIN_PG_DESC);
- setImageDescriptor(J2EEUIPlugin.getDefault().getImageDescriptor(J2EEUIPluginIcons.WEB_PROJECT_WIZARD_BANNER));
- setInfopopID(IWebUIContextIds.NEW_DYNAMIC_WEB_PROJECT_PAGE1);
- }
-
- @Override
- protected String getModuleFacetID() {
- return J2EEProjectUtilities.DYNAMIC_WEB;
- }
-
- @Override
- protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
- {
- IRuntime runtime = (IRuntime)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
- final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( 2 );
-
- if(runtime != null) {
- facets.addAll(super.getFacetConfiguration(primaryFacetVersion));
- }
- else {
- facets.add( primaryFacetVersion );
-
- if( primaryFacetVersion == WebFacetUtils.WEB_30)
- {
- facets.add( JavaFacetUtils.JAVA_60 );
- }
- else if(primaryFacetVersion == WebFacetUtils.WEB_25 )
- {
- facets.add( JavaFacetUtils.JAVA_50 );
- }
- else if( primaryFacetVersion == WebFacetUtils.WEB_24 )
- {
- facets.add( JavaFacetUtils.JAVA_14 );
- }
- else if( primaryFacetVersion == WebFacetUtils.WEB_23 ||
- primaryFacetVersion == WebFacetUtils.WEB_22 )
- {
- facets.add( JavaFacetUtils.JAVA_13 );
- }
- }
- return Collections.unmodifiableSet( facets );
- }
-
-}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectWizard.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectWizard.java
deleted file mode 100644
index 86ce7f8..0000000
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectWizard.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.jst.servlet.ui.project.facet;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
-import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
-import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
-import org.osgi.framework.Bundle;
-import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin;
-
-public class WebProjectWizard extends NewProjectDataModelFacetWizard {
-
- public WebProjectWizard(IDataModel model) {
- super(model);
- setWindowTitle(WEBUIMessages.WEB_MODULE_WIZ_TITLE);
- }
-
- public WebProjectWizard() {
- super();
- setWindowTitle(WEBUIMessages.WEB_MODULE_WIZ_TITLE);
- }
-
- @Override
- protected IDataModel createDataModel() {
- try
- {
- return DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
- }
- catch( Exception e )
- {
- ServletUIPlugin.logError(e);
- return null;
- }
- }
-
- @Override
- protected IFacetedProjectTemplate getTemplate() {
- return ProjectFacetsManager.getTemplate("template.jst.web"); //$NON-NLS-1$
- }
-
- @Override
- protected IWizardPage createFirstPage() {
- return new WebProjectFirstPage(model, "first.page"); //$NON-NLS-1$
- }
-
- @Override
- protected ImageDescriptor getDefaultPageImageDescriptor() {
- final Bundle bundle = Platform.getBundle("org.eclipse.jst.servlet.ui"); //$NON-NLS-1$
- final URL url = bundle.getEntry("icons/full/ctool16/web-wiz-banner.gif"); //$NON-NLS-1$
- return ImageDescriptor.createFromURL(url);
- }
-
- @Override
- protected String getFinalPerspectiveID() {
- return ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_WEB);
- }
-}
diff --git a/plugins/org.eclipse.wst.web/.classpath b/plugins/org.eclipse.wst.web/.classpath
new file mode 100644
index 0000000..15a90f8
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="static_web_project"/>
+ <classpathentry kind="src" path="property_files"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.wst.web/.cvsignore b/plugins/org.eclipse.wst.web/.cvsignore
new file mode 100644
index 0000000..590084f
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/.cvsignore
@@ -0,0 +1,7 @@
+bin
+runtime
+temp.folder
+build.xml
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.wst.web/.project b/plugins/org.eclipse.wst.web/.project
new file mode 100644
index 0000000..fb86548
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.web</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/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..51c2889
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,97 @@
+#Tue Sep 29 10:42:06 EDT 2009
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+eclipse.preferences.version=1
+org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
diff --git a/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..9602203
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,6 @@
+#Tue Sep 29 10:42:06 EDT 2009
+org.eclipse.jdt.ui.exception.name=e
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.gettersetter.use.is=true
diff --git a/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..0e312b8
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.eclipse.wst.web; singleton:=true
+Bundle-Version: 1.1.403.qualifier
+Bundle-Activator: org.eclipse.wst.web.internal.WSTWebPlugin
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-Localization: plugin
+Export-Package: org.eclipse.wst.project.facet,
+ org.eclipse.wst.web.internal;x-internal:=true,
+ org.eclipse.wst.web.internal.deployables;x-internal:=true,
+ org.eclipse.wst.web.internal.facet,
+ org.eclipse.wst.web.internal.operation;x-internal:=true
+Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.commands;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.102,2.0.0)",
+ org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,2.0.0)",
+ com.ibm.icu;bundle-version="3.8.1",
+ org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)"
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.jst.servlet.ui/about.html b/plugins/org.eclipse.wst.web/about.html
similarity index 100%
copy from plugins/org.eclipse.jst.servlet.ui/about.html
copy to plugins/org.eclipse.wst.web/about.html
diff --git a/plugins/org.eclipse.wst.web/build.properties b/plugins/org.eclipse.wst.web/build.properties
new file mode 100644
index 0000000..182b94a
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/build.properties
@@ -0,0 +1,11 @@
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ META-INF/,\
+ about.html,\
+ .
+jars.compile.order = .
+src.includes = component.xml
+output.. = bin/
+source.. = static_web_project/,\
+ property_files/
diff --git a/plugins/org.eclipse.wst.web/component.xml b/plugins/org.eclipse.wst.web/component.xml
new file mode 100644
index 0000000..89207cb
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/component.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.wst.web"><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.wst.web" fragment="false"/><plugin id="org.eclipse.wst.web.ui" fragment="false"/></component>
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/icons/full/obj16/web_application.gif b/plugins/org.eclipse.wst.web/icons/full/obj16/web_application.gif
new file mode 100644
index 0000000..09f609d
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/icons/full/obj16/web_application.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.web/icons/full/obj16/webstatic_deploy.gif b/plugins/org.eclipse.wst.web/icons/full/obj16/webstatic_deploy.gif
new file mode 100644
index 0000000..80531e3
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/icons/full/obj16/webstatic_deploy.gif
Binary files differ
diff --git a/plugins/org.eclipse.wst.web/icons/full/wizban/newwprj_wiz.png b/plugins/org.eclipse.wst.web/icons/full/wizban/newwprj_wiz.png
new file mode 100644
index 0000000..1edd090
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/icons/full/wizban/newwprj_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.wst.web/plugin.properties b/plugins/org.eclipse.wst.web/plugin.properties
new file mode 100644
index 0000000..d686a74
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/plugin.properties
@@ -0,0 +1,11 @@
+#########################################
+# (c) Copyright IBM Corp. 2000, 2001.
+# All Rights Reserved.
+#########################################
+
+Bundle-Vendor.0 = Eclipse Web Tools Platform
+Bundle-Name.0 = Simple Web Plug-in
+
+SIMPLE_WEB_LABEL=Static Web Module
+SIMPLE_WEB_DESCRIPTION=Enables the project to be deployed as a static web module.
+SIMPLE_WEB_TEMPLATE=Static Web Project
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/plugin.xml b/plugins/org.eclipse.wst.web/plugin.xml
new file mode 100644
index 0000000..0fd8b4d
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/plugin.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension-point id="runtimePresetMappings" name="Runtime Preset Mappings Extension" schema="schema/runtimePresetMappings.exsd"/>
+ <extension
+ point="org.eclipse.wst.server.core.moduleFactories">
+ <moduleFactory
+ projects="true"
+ class="org.eclipse.wst.web.internal.deployables.StaticWebDeployableFactory"
+ id="org.eclipse.wst.web.internal.deployables.static">
+ <moduleType
+ versions="1.0, 1.2, 1.3, 1.4"
+ types="wst.web">
+ </moduleType>
+ </moduleFactory>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.server.core.moduleArtifactAdapters">
+ <moduleArtifactAdapter
+ id="org.eclipse.jst.web.server.webstatic1"
+ class="org.eclipse.wst.web.internal.deployables.StaticWebDeployableObjectAdapter">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="wst.web" />
+ </adapt>
+ </with>
+ </enablement>
+ </moduleArtifactAdapter>
+ <moduleArtifactAdapter
+ id="org.eclipse.jst.web.server.webstatic2"
+ class="org.eclipse.wst.web.internal.deployables.StaticWebDeployableObjectAdapter">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.core.resources.IFile">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="wst.web" />
+ </adapt>
+ </with>
+ </enablement>
+ </moduleArtifactAdapter>
+ </extension>
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.wst.web.internal.deployables.StaticWebDeployableObjectAdapter"
+ adaptableType="org.eclipse.core.resources.IProject">
+ <adapter type="org.eclipse.wst.web.internal.deployables.IStaticWebModuleArtifact"/>
+ </factory>
+ </extension>
+
+ <!--============================-->
+ <!-- Builder Provider registrations-->
+ <!--============================-->
+ <extension
+ point="org.eclipse.wst.common.frameworks.DataModelProviderExtension">
+ <ProviderDefinesType
+ providerType="wst.web.builder"
+ providerID="org.eclipse.wst.common.componentcore.internal.builder.WorkbenchComponentBuilderDataModelProvider"/>
+ <DataModelProvider
+ class="org.eclipse.wst.web.internal.operation.SimpleWebModuleCreationDataModelProvider"
+ id="org.eclipse.wst.web.internal.operation.SimpleWebModuleCreationDataModelProvider"/>
+ </extension>
+
+ <!-- Project Facets -->
+ <extension point="org.eclipse.wst.common.project.facet.core.facets">
+
+ <project-facet id="wst.web">
+ <label>%SIMPLE_WEB_LABEL</label>
+ <description>%SIMPLE_WEB_DESCRIPTION</description>
+ <property name="hide.version" value="true"/>
+ </project-facet>
+
+ <project-facet-version facet="wst.web" version="1.0">
+ <action type="install" id="wst.web.install">
+ <delegate class="org.eclipse.wst.project.facet.SimpleWebFacetInstallDelegate"/>
+ <config-factory class="org.eclipse.wst.project.facet.SimpleWebFacetInstallDataModelProvider"/>
+ </action>
+ <action type="uninstall" id="wst.web.uninstall">
+ <delegate class="org.eclipse.wst.project.facet.SimpleWebFacetUninstallDelegate"/>
+ <config-factory class="org.eclipse.wst.project.facet.SimpleWebFacetInstallDataModelProvider"/>
+ </action>
+ <constraint>
+ <conflicts group="modules"/>
+ </constraint>
+ <group-member id="modules"/>
+ </project-facet-version>
+
+ <template id="template.wst.web">
+ <label>%SIMPLE_WEB_TEMPLATE</label>
+ <fixed facet="wst.web"/>
+ </template>
+
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.wst.web/property_files/staticwebproject.properties b/plugins/org.eclipse.wst.web/property_files/staticwebproject.properties
new file mode 100644
index 0000000..c3c3687
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/property_files/staticwebproject.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# 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
+###############################################################################
+StaticWebProjectCreationWizard_Wizard_Title=New Static Web Project
+StaticWebProjectWizardBasePage_Page_Description=Create a Web project for simple content (HTML files) only.
+StaticWebSettingsPropertiesPage_Web_Content_Label=&Web content folder name:
+StaticContextRootComposite_Context_Root_Label=&Context root:
+StaticWebProjectWizardBasePage_Page_Title=Static Web Project
+StaticWebSettingsPropertiesPage_Not_available_for_closed_projects=Web settings are not available for a closed project.
+TargetRuntime=Target r&untime
+NewDotDotDot=N&ew...
+InvalidServerTarget=Invalid target server selected.
+ConfigureSettings=Configure Static Web module settings.
+Context_Root_cannot_be_empty_2=Context root cannot be empty
+Names_cannot_contain_whitespace=Context root cannot contain whitespace
+The_character_is_invalid_in_a_context_root=The character ''{0}'' is invalid in a context root.
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/schema/runtimePresetMappings.exsd b/plugins/org.eclipse.wst.web/schema/runtimePresetMappings.exsd
new file mode 100644
index 0000000..3d27116
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/schema/runtimePresetMappings.exsd
@@ -0,0 +1,141 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.wst.web" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.wst.web" id="RuntimePresetMappings" name="Runtime Preset Mappings Extension"/>
+ </appinfo>
+ <documentation>
+ This extension point allows the configuration of a default facet preset for any Runtime Type ID, Facet ID & Fact Version combination. For example, given runtime type X, facet jst.web, and version 2.4, the preset Y should be selected by default where as given runtime type X, facet jst.web, and version 2.5, the preset Z should be selected by default.
+
+For each of the four facetRuntimeTypeID, facetRuntimeVersion, facetID, facetVersion the following pattern is used to ease the definition process. The pattern specified allows a comma deliminated list of possible values. For example to match only "1.0" the pattern should be "1.0". To match multiple values, say 1.0, 2.0, and 3.0, use "1.0,2.0,3.0". Asterests may be used to specify multiple values. For example, "1.*" will match any values starting with '1.' including 1., 1.0, 1.1, 1.2, but not 1 Likewise, "*.0" will match any values ending with '.0' including 1.0, 2.0, 3.0, but not 1 or 0 Asterists may be added both at the begining and end of a string, so "*00*" will match any string that contains '00' such as 00, 100, 1001.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="mapping" minOccurs="1" maxOccurs="unbounded"/>
+ </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="mapping">
+ <annotation>
+ <documentation>
+ Each mapping element defineds a mapping from (runtimeid, facetid, facetversion) to presetid.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="facetRuntimeTypeID" type="string" use="required">
+ <annotation>
+ <documentation>
+ Follows the pattern outlined in the overview
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="facetRuntimeVersion" type="string" use="required">
+ <annotation>
+ <documentation>
+ Follows the pattern outlined in the overview
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="facetID" type="string" use="required">
+ <annotation>
+ <documentation>
+ Follows the pattern outlined in the overview
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="facetVersion" type="string" use="required">
+ <annotation>
+ <documentation>
+ Follows the pattern outlined in the overview
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="presetID" type="string" use="required">
+ <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>
+
+
+</schema>
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java
new file mode 100644
index 0000000..6ef3b6b
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.wst.project.facet;
+
+/**
+ * These constants define the set of properties that this pluging expects to
+ * be available via <code>IProduct.getProperty(String)</code>. The status of
+ * this interface and the facilities offered is highly provisional.
+ * Productization support will be reviewed and possibly modified in future
+ * releases.
+ *
+ * @see org.eclipse.core.runtime.IProduct#getProperty(String)
+ */
+
+public interface IProductConstants {
+
+ public static final String APPLICATION_CONTENT_FOLDER = "earContent"; //$NON-NLS-1$
+ public static final String WEB_CONTENT_FOLDER = "webContent"; //$NON-NLS-1$
+ public static final String EJB_CONTENT_FOLDER = "ejbContent"; //$NON-NLS-1$
+ public static final String APP_CLIENT_CONTENT_FOLDER = "appClientContent"; //$NON-NLS-1$
+ public static final String JCA_CONTENT_FOLDER = "jcaContent"; //$NON-NLS-1$
+ public static final String DEFAULT_SOURCE_FOLDER = "defaultSource"; //$NON-NLS-1$
+ public static final String ADD_TO_EAR_BY_DEFAULT = "addToEarByDefault"; //$NON-NLS-1$
+ public static final String OUTPUT_FOLDER = "outputFolder"; //$NON-NLS-1$
+ public static final String USE_SINGLE_ROOT_STRUCTURE = "useSingleRootStructure"; //$NON-NLS-1$
+ public static final String ID_PERSPECTIVE_HIERARCHY_VIEW = "idPerspectiveHierarchyView"; //$NON-NLS-1$
+ public static final String SHOW_JAVA_EE_MODULE_DEPENDENCY_PAGE = "showJavaEEModuleDependencyPage"; //$NON-NLS-1$
+ public static final String DYNAMIC_WEB_GENERATE_DD = "dynamic_web_generate_dd"; //$NON-NLS-1$
+ public static final String EE6_CONNECTOR_GENERATE_DD = "ee6_connector_generate_dd"; //$NON-NLS-1$
+
+ /**
+ * @deprecated Do not use. The ALLOW_CLASSPATH_DEP preference has been deprecated and its ability to disable dynamic manifest updates will soon be removed.
+ */
+ public static final String ALLOW_CLASSPATH_DEP = "allowClasspathDep"; //$NON-NLS-1$
+ public static final String VALIDATE_DUPLICATE_CLASSPATH_COMPONENT_URI = "validateDupClasspathCompURI"; //$NON-NLS-1$
+
+ public static final String DYN_WEB_OUTPUT_FOLDER = "dynWebOutput"; //$NON-NLS-1$
+ public static final String EJB_OUTPUT_FOLDER = "ejbOutput"; //$NON-NLS-1$
+ public static final String APP_CLIENT_OUTPUT_FOLDER = "appClientOutput"; //$NON-NLS-1$
+ public static final String JCA_OUTPUT_FOLDER = "jcaOutput"; //$NON-NLS-1$
+ public static final String UTILITY_OUTPUT_FOLDER ="utilOutput"; //$NON-NLS-1$
+
+ /**
+ * Alters the final perspective used by the following new project wizards
+ */
+ public static final String FINAL_PERSPECTIVE_WEB = "finalPerspectiveWeb"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_EJB = "finalPerspectiveEjb"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_EAR = "finalPerspectiveEar"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_APPCLIENT = "finalPerspectiveAppClient"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_JCA = "finalPerspectiveJca"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_UTILITY = "finalPerspectiveUtility"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_STATICWEB = "finalPerspectiveStaticWeb"; //$NON-NLS-1$
+ public static final String FINAL_PERSPECTIVE_WEBFRAGMENT = "finalPerspectiveWebFragment"; //$NON-NLS-1$
+
+ /**
+ * Ability to default initial runtimes chosen in wizards
+ */
+ public static final String DEFAULT_RUNTIME_1 = "defaultRuntime1"; //$NON-NLS-1$
+ public static final String DEFAULT_RUNTIME_2 = "defaultRuntime2"; //$NON-NLS-1$
+ public static final String DEFAULT_RUNTIME_3 = "defaultRuntime3"; //$NON-NLS-1$
+ public static final String DEFAULT_RUNTIME_4 = "defaultRuntime4"; //$NON-NLS-1$
+ public static final String VIEWER_SYNC_FOR_WEBSERVICES = "viewerSyncForWebservices"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ISimpleWebFacetInstallDataModelProperties.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ISimpleWebFacetInstallDataModelProperties.java
new file mode 100644
index 0000000..2f3263e
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ISimpleWebFacetInstallDataModelProperties.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.project.facet;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
+
+public interface ISimpleWebFacetInstallDataModelProperties extends IDataModelProperties {
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = SimpleWebFacetProjectCreationDataModelProvider.class;
+
+ public static final String CONTENT_DIR = "IStaticWebFacetInstallDataModelProperties.CONTENT_DIR"; //$NON-NLS-1$
+
+ public static final String CONTEXT_ROOT = "IStaticWebFacetInstallDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java
new file mode 100644
index 0000000..1a54a74
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * 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.wst.project.facet;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.web.internal.WSTWebPlugin;
+
+public class ProductManager {
+
+ /**
+ * Default values for WTP level product
+ */
+ private static final String APPLICATION_CONTENT_FOLDER = "EarContent"; //$NON-NLS-1$
+ private static final String WEB_CONTENT_FOLDER = "WebContent"; //$NON-NLS-1$
+ private static final String EJB_CONTENT_FOLDER = "ejbModule"; //$NON-NLS-1$
+ private static final String APP_CLIENT_CONTENT_FOLDER = "appClientModule"; //$NON-NLS-1$
+ private static final String JCA_CONTENT_FOLDER = "connectorModule"; //$NON-NLS-1$
+ private static final String DEFAULT_SOURCE_FOLDER = "src"; //$NON-NLS-1$
+ private static final String ADD_TO_EAR_BY_DEFAULT = "false"; //$NON-NLS-1$
+ private static final String OUTPUT_FOLDER = "build/classes"; //$NON-NLS-1$
+ private static final String USE_SINGLE_ROOT_STRUCTURE = "false"; //$NON-NLS-1$
+ private static final String VIEWER_SYNC_FOR_WEBSERVICES = "true"; //$NON-NLS-1$
+ private static final String ID_PERSPECTIVE_HIERARCHY_VIEW = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+ private static final String SHOW_JAVA_EE_MODULE_DEPENDENCY_PAGE = "true"; //$NON-NLS-1$
+ private static final String FINAL_PERSPECTIVE = "org.eclipse.jst.j2ee.J2EEPerspective"; //$NON-NLS-1$
+ private static final String FINAL_WEB_PERSPECTIVE = "org.eclipse.wst.web.ui.webDevPerspective"; //$NON-NLS-1$
+ private static final String DYNAMIC_WEB_GENERATE_DD = "true"; //$NON-NLS-1$
+ private static final char RUNTIME_SEPARATOR = ':';
+ private static final String[] DEFAULT_RUNTIME_KEYS =
+ new String[]{IProductConstants.DEFAULT_RUNTIME_1,
+ IProductConstants.DEFAULT_RUNTIME_2,
+ IProductConstants.DEFAULT_RUNTIME_3,
+ IProductConstants.DEFAULT_RUNTIME_4};
+
+ /**
+ * Return the value for the associated key from the Platform Product registry or return the
+ * WTP default for the J2EE cases.
+ *
+ * @param key
+ * @return String value of product's property
+ */
+ public static String getProperty(String key) {
+ if (key == null)
+ return null;
+ String value = null;
+ if (Platform.getProduct()!=null)
+ value = Platform.getProduct().getProperty(key);
+ if (value == null)
+ {
+ value = Platform.getPreferencesService().getString(WSTWebPlugin.PLUGIN_ID, key, null, null);
+ }
+ if (value == null) {
+ if (key.equals(IProductConstants.APPLICATION_CONTENT_FOLDER))
+ return APPLICATION_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.WEB_CONTENT_FOLDER))
+ return WEB_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.EJB_CONTENT_FOLDER))
+ return EJB_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.APP_CLIENT_CONTENT_FOLDER))
+ return APP_CLIENT_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.JCA_CONTENT_FOLDER))
+ return JCA_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.DEFAULT_SOURCE_FOLDER))
+ return DEFAULT_SOURCE_FOLDER;
+ else if (key.equals(IProductConstants.ADD_TO_EAR_BY_DEFAULT))
+ return ADD_TO_EAR_BY_DEFAULT;
+ else if (key.equals(IProductConstants.USE_SINGLE_ROOT_STRUCTURE))
+ return USE_SINGLE_ROOT_STRUCTURE;
+ else if (key.equals(IProductConstants.VIEWER_SYNC_FOR_WEBSERVICES))
+ return VIEWER_SYNC_FOR_WEBSERVICES;
+ else if (key.equals(IProductConstants.OUTPUT_FOLDER))
+ return OUTPUT_FOLDER;
+ else if (key.equals(IProductConstants.ID_PERSPECTIVE_HIERARCHY_VIEW))
+ return ID_PERSPECTIVE_HIERARCHY_VIEW;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_APPCLIENT))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_EAR))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_EJB))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_JCA))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_STATICWEB))
+ return FINAL_WEB_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_UTILITY))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_WEB))
+ return FINAL_PERSPECTIVE;
+ else if (key.equals(IProductConstants.SHOW_JAVA_EE_MODULE_DEPENDENCY_PAGE))
+ return SHOW_JAVA_EE_MODULE_DEPENDENCY_PAGE;
+ else if (key.equals(IProductConstants.DYNAMIC_WEB_GENERATE_DD))
+ return DYNAMIC_WEB_GENERATE_DD;
+ }
+ return value;
+ }
+
+ public static boolean shouldAddToEARByDefault() {
+ String value = getProperty(IProductConstants.ADD_TO_EAR_BY_DEFAULT);
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public static boolean shouldUseSingleRootStructure() {
+ String value = getProperty(IProductConstants.USE_SINGLE_ROOT_STRUCTURE);
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public static boolean shouldUseViewerSyncForWebservices() {
+ String value = getProperty(IProductConstants.VIEWER_SYNC_FOR_WEBSERVICES);
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public static List/*<IRuntime>*/ getDefaultRuntimes() {
+ List theRuntimes = null;
+ Set runtimes = RuntimeManager.getRuntimes();
+ if (!runtimes.isEmpty()) {
+ IRuntime defaultRuntime = null;
+ // First check if defaults are defined
+ for (int i = 0; i < DEFAULT_RUNTIME_KEYS.length; i++) {
+ defaultRuntime = getMatchingRuntime(DEFAULT_RUNTIME_KEYS[i], runtimes);
+ if (defaultRuntime != null) {
+ if (theRuntimes == null) {
+ theRuntimes = new ArrayList(DEFAULT_RUNTIME_KEYS.length);
+ }
+ theRuntimes.add(defaultRuntime);
+ }
+ }
+ }
+ if (theRuntimes == null) {
+ theRuntimes = Collections.EMPTY_LIST;
+ }
+ return theRuntimes;
+ }
+
+ private static IRuntime getMatchingRuntime(String defaultProductRuntimeProperty, Set runtimes) {
+ String defaultProductRuntimeKey = getProperty(defaultProductRuntimeProperty);
+ if (defaultProductRuntimeKey == null || defaultProductRuntimeKey.length() == 0) {
+ return null;
+ }
+ //The defaultProductRuntimeKey needs to be in the following format
+ //<facet runtime id>:<facet version>.
+ int seperatorIndex = defaultProductRuntimeKey.indexOf(RUNTIME_SEPARATOR);
+ if (seperatorIndex < 0 && seperatorIndex < defaultProductRuntimeKey.length()) {
+ //Consider throwing an exception here.
+ WSTWebPlugin.logError("Invalid default product runtime id. It should follow the format <facet runtime id>:<facet version>. Id processed: " + defaultProductRuntimeKey); //$NON-NLS-1$
+ return null;
+ }
+ String defaultRuntimeID = defaultProductRuntimeKey.substring(0, seperatorIndex);
+ String defaultFacetVersion = defaultProductRuntimeKey.substring(seperatorIndex + 1);
+ for (Iterator runtimeIt = runtimes.iterator(); runtimeIt.hasNext();) {
+ IRuntime runtime = (IRuntime) runtimeIt.next();
+ List runtimeComps = runtime.getRuntimeComponents();
+ if (!runtimeComps.isEmpty()) {
+ for (Iterator compsIter = runtimeComps.iterator(); compsIter.hasNext();) {
+ IRuntimeComponent runtimeComp = (IRuntimeComponent) compsIter.next();
+ if (defaultRuntimeID.equals(runtimeComp.getRuntimeComponentType().getId()) &&
+ (defaultFacetVersion.equals(runtimeComp.getRuntimeComponentVersion().getVersionString()))) {
+ return runtime;
+ }
+ }
+ }
+ }
+ //No matches found.
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDataModelProvider.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDataModelProvider.java
new file mode 100644
index 0000000..c551407
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDataModelProvider.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * 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.wst.project.facet;
+
+import java.util.Set;
+
+import org.eclipse.core.internal.resources.ResourceStatus;
+import org.eclipse.core.internal.utils.Messages;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.web.internal.ResourceHandler;
+
+import com.ibm.icu.text.UTF16;
+import com.ibm.icu.util.StringTokenizer;
+
+public class SimpleWebFacetInstallDataModelProvider extends FacetInstallDataModelProvider implements ISimpleWebFacetInstallDataModelProperties {
+
+ public SimpleWebFacetInstallDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ Set names = super.getPropertyNames();
+ names.add(CONTENT_DIR);
+ names.add(CONTEXT_ROOT);
+ return names;
+ }
+
+ @Override
+ public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(CONTENT_DIR)) {
+ return "WebContent"; //$NON-NLS-1$
+ } else if (propertyName.equals(CONTEXT_ROOT)) {
+ return getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
+ } else if (propertyName.equals(FACET_ID)) {
+ return IModuleConstants.WST_WEB_MODULE;
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+ @Override
+ public boolean propertySet(String propertyName, Object propertyValue) {
+ if (FACET_PROJECT_NAME.equals(propertyName)) {
+ model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.VALID_VALUES_CHG);
+ }
+ return super.propertySet(propertyName, propertyValue);
+ }
+
+ @Override
+ public IStatus validate(String name) {
+ if (name.equals(CONTEXT_ROOT)) {
+ return validateContextRoot(getStringProperty(CONTEXT_ROOT));
+ }
+ else if (name.equals(CONTENT_DIR)) {
+ String folderName = model.getStringProperty(CONTENT_DIR);
+ if (folderName == null || folderName.length() == 0 || folderName.equals("/") || folderName.equals("\\")) { //$NON-NLS-1$ //$NON-NLS-2$
+ // all folders which meet the criteria of "CONFIG_FOLDER" are required
+ String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.WEBCONTENTFOLDER_EMPTY);
+ return WTPCommonPlugin.createErrorStatus(errorMessage);
+ }
+ IStatus status = validateFolderName(folderName);
+ if (status.isOK())
+ {
+ if (folderName.indexOf('#') != -1) {
+ String message = NLS.bind(Messages.resources_invalidCharInName, "#", folderName); //$NON-NLS-1$
+ status = new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message);
+ }
+ }
+ return status;
+ }
+
+ return super.validate(name);
+ }
+
+ protected IStatus validateContextRoot(String contextRoot) {
+ if (contextRoot == null || contextRoot.length() == 0) {
+ return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, ResourceHandler.Context_Root_cannot_be_empty_2);
+ } else if (contextRoot.trim().equals(contextRoot)) {
+ StringTokenizer stok = new StringTokenizer(contextRoot, "."); //$NON-NLS-1$
+ while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ int cp;
+ for (int i = 0; i < token.length(); i += UTF16.getCharCount(cp)) {
+ cp = UTF16.charAt(token, i);
+ if(token.charAt(i) == ' ')
+ {
+ return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, ResourceHandler.Names_cannot_contain_whitespace);
+ }
+ else if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
+ String invalidCharString = null;
+ if (UTF16.getCharCount(cp)>1)
+ {
+ invalidCharString = UTF16.valueOf(cp);
+ }
+ else
+ {
+ invalidCharString = (new Character(token.charAt(i))).toString();
+ }
+ Object[] invalidChar = new Object[]{invalidCharString};
+ String errorStatus = ResourceHandler.getString(ResourceHandler.The_character_is_invalid_in_a_context_root, invalidChar);
+ return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, errorStatus);
+ }
+ }
+ }
+ } else
+ {
+ return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, ResourceHandler.Names_cannot_contain_whitespace);
+ }
+ return OK_STATUS;
+ }
+
+ protected IStatus validateFolderName(String folderName) {
+ // the directory is not required, but if the name is entered ensure that it
+ // contains only valid characters.
+ if (folderName == null || folderName.length() == 0) {
+ return OK_STATUS;
+ }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IPath path = new Path(folderName);
+ for (int i = 0, max = path.segmentCount(); i < max; i++) {
+ IStatus status = workspace.validateName(path.segment(i), IResource.FOLDER);
+ if (! status.isOK())
+ return status;
+ }
+
+ // all of the potential segments of the folder have been verified
+ return OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDelegate.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDelegate.java
new file mode 100644
index 0000000..15276d6
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetInstallDelegate.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.project.facet;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.FacetDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.web.internal.WSTWebPlugin;
+
+public class SimpleWebFacetInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
+ if (monitor != null)
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ try {
+ IDataModel model = (IDataModel) config;
+ addNatures(project);
+ final IVirtualComponent c = ComponentCore.createComponent(project, false);
+ c.create(0, null);
+
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final IPath pjpath = project.getFullPath();
+ final IPath contentdir = setContentPropertyIfNeeded(model, pjpath, project);
+ mkdirs(ws.getRoot().getFolder(contentdir));
+
+ final IVirtualFolder webroot = c.getRootFolder();
+ if (webroot.getProjectRelativePath().equals(new Path("/"))) { //$NON-NLS-1$
+ webroot.createLink(new Path("/" + model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTENT_DIR)), 0, null); //$NON-NLS-1$
+ }
+
+ ComponentUtilities.setServerContextRoot(project,model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTEXT_ROOT));
+
+ try {
+ ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION)).execute(monitor, null);
+ } catch (ExecutionException e) {
+ WSTWebPlugin.logError(e);
+ }
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+
+ private IPath setContentPropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
+ IVirtualComponent c = ComponentCore.createComponent(project);
+ if (c.exists()) {
+ if( !c.getRootFolder().getProjectRelativePath().isRoot() ){
+ return c.getRootFolder().getUnderlyingResource().getFullPath();
+ }
+ }
+ return pjpath.append(model.getStringProperty(ISimpleWebFacetInstallDataModelProperties.CONTENT_DIR));
+ }
+
+ private void addNatures(final IProject project) throws CoreException {
+ final IProjectDescription desc = project.getDescription();
+ final String[] current = desc.getNatureIds();
+ final String[] replacement = new String[current.length + 1];
+ System.arraycopy(current, 0, replacement, 0, current.length);
+ replacement[current.length] = IModuleConstants.MODULE_NATURE_ID;
+ desc.setNatureIds(replacement);
+ project.setDescription(desc, null);
+ }
+
+ private static void mkdirs(final IFolder folder) throws CoreException {
+ if (!folder.exists()) {
+ if (folder.getParent() instanceof IFolder) {
+ mkdirs((IFolder) folder.getParent());
+ }
+ folder.create(true, true, null);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetProjectCreationDataModelProvider.java
new file mode 100644
index 0000000..90020ff
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetProjectCreationDataModelProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.wst.project.facet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class SimpleWebFacetProjectCreationDataModelProvider extends FacetProjectCreationDataModelProvider {
+
+ public SimpleWebFacetProjectCreationDataModelProvider() {
+ super();
+ }
+
+ @Override
+ public void init() {
+ super.init();
+
+ Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
+ requiredFacets.add(ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE));
+ setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetUninstallDelegate.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetUninstallDelegate.java
new file mode 100644
index 0000000..2445796
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/SimpleWebFacetUninstallDelegate.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.project.facet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class SimpleWebFacetUninstallDelegate implements IDelegate {
+
+ public SimpleWebFacetUninstallDelegate() {
+ super();
+ }
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
+ if (monitor != null)
+ monitor.beginTask("", 1); //$NON-NLS-1$
+ try {
+ // Remove the .component file
+ IFile file = project.getFile(StructureEdit.MODULE_META_FILE_NAME);
+ file.delete(true, monitor);
+
+ // Remove the module core nature
+ ProjectUtilities.removeNatureFromProject(project, IModuleConstants.MODULE_NATURE_ID);
+ } finally {
+ if (monitor != null)
+ monitor.done();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/DelegateConfigurationElement.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/DelegateConfigurationElement.java
new file mode 100644
index 0000000..7add548
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/DelegateConfigurationElement.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+/*
+ * Created on December 14, 2004
+ */
+package org.eclipse.wst.web.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IContributor;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+
+/**
+ * An object which represents the user-defined contents of an extension in a plug-in manifest.
+ */
+public class DelegateConfigurationElement implements IConfigurationElement {
+
+ private final IConfigurationElement delegateElement;
+ private static final String DELEGATE_NAME = "delegateConfigurationElement"; //$NON-NLS-1$
+ private static final String DELEGATE_NAMESPACE = "delegateConfigurationElementNamespace"; //$NON-NLS-1$
+ private static final String DELEGATE_NULL_STRING = "delegateConfigurationElement: NULL"; //$NON-NLS-1$
+
+ public DelegateConfigurationElement(IConfigurationElement aDelegate) {
+ delegateElement = aDelegate;
+ }
+
+ /**
+ * @param propertyName
+ * @return
+ * @throws org.eclipse.core.runtime.CoreException
+ */
+ public Object createExecutableExtension(String propertyName) throws CoreException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.createExecutableExtension(propertyName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (delegateElement == null)
+ return false;
+ return delegateElement.equals(obj);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getAttribute(String name) throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.getAttribute(name);
+ }
+
+ /**
+ * @param name
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getAttributeAsIs(String name) throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.getAttributeAsIs(name);
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String[] getAttributeNames() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return new String[0];
+ return delegateElement.getAttributeNames();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public IConfigurationElement[] getChildren() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return new IConfigurationElement[0];
+ return delegateElement.getChildren();
+ }
+
+ /**
+ * @param name
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public IConfigurationElement[] getChildren(String name) throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return new IConfigurationElement[0];
+ return delegateElement.getChildren(name);
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public IExtension getDeclaringExtension() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ throw new InvalidRegistryObjectException();
+ return delegateElement.getDeclaringExtension();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getName() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return DELEGATE_NAME;
+ return delegateElement.getName();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getNamespace() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return DELEGATE_NAMESPACE;
+ return delegateElement.getNamespace();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public Object getParent() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.getParent();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getValue() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.getValue();
+ }
+
+ /**
+ * @return
+ * @throws org.eclipse.core.runtime.InvalidRegistryObjectException
+ */
+ public String getValueAsIs() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return null;
+ return delegateElement.getValueAsIs();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ if (delegateElement == null)
+ return -1;
+ return delegateElement.hashCode();
+ }
+
+ /**
+ * @return
+ */
+ public boolean isValid() {
+
+ if (delegateElement == null)
+ return false;
+ return delegateElement.isValid();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ if (delegateElement == null)
+ return DELEGATE_NULL_STRING;
+ return delegateElement.toString();
+ }
+
+ public IConfigurationElement toEquinox() {
+ return null;
+ }
+
+ public IContributor getContributor() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ throw new InvalidRegistryObjectException();
+ return delegateElement.getContributor();
+ }
+
+ public String getNamespaceIdentifier() throws InvalidRegistryObjectException {
+ if (delegateElement == null)
+ return DELEGATE_NAMESPACE;
+ return delegateElement.getNamespaceIdentifier();
+ }
+
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=296122
+ public String getAttribute(String attrName, String locale) throws InvalidRegistryObjectException {
+ if (delegateElement == null) return null;
+ return delegateElement.getAttribute(attrName, locale);
+ }
+
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=296122
+ public String getValue(String locale) throws InvalidRegistryObjectException {
+ if (delegateElement == null) return null;
+ return delegateElement.getValue(locale);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ISimpleWebModuleConstants.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ISimpleWebModuleConstants.java
new file mode 100644
index 0000000..e58e260
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ISimpleWebModuleConstants.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.web.internal;
+
+
+public interface ISimpleWebModuleConstants
+{
+ public static final String PLUG_IN_ID = "org.eclipse.wst.web"; //$NON-NLS-1$
+ public static final String STATIC_PROJECT_TYPE = "STATIC"; //$NON-NLS-1$
+ public static final String CSS_DIRECTORY = "theme"; //$NON-NLS-1$
+ public static final String INFO_DIRECTORY = "WEB-INF"; //$NON-NLS-1$
+ public static final String LIBRARY_DIRECTORY = "lib"; //$NON-NLS-1$
+ public static final String CLASSES_DIRECTORY = "classes"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/IWSTWebPreferences.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/IWSTWebPreferences.java
new file mode 100644
index 0000000..0f4e7aa
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/IWSTWebPreferences.java
@@ -0,0 +1,13 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.wst.web.internal;
+
+public interface IWSTWebPreferences {
+ String PREF_STATICWEBCONTENT = "org.eclipse.jst.j2ee.preference.staticWebContentName"; //$NON-NLS-1$
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ResourceHandler.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ResourceHandler.java
new file mode 100644
index 0000000..7167724
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/ResourceHandler.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.wst.web.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class ResourceHandler extends NLS {
+
+ private static final String BUNDLE_NAME = "staticwebproject";//$NON-NLS-1$
+
+ private ResourceHandler() {
+ // Do not instantiate
+ }
+
+ public static String StaticWebProjectCreationWizard_Wizard_Title;
+ public static String StaticWebProjectWizardBasePage_Page_Description;
+ public static String StaticWebSettingsPropertiesPage_Web_Content_Label;
+ public static String StaticContextRootComposite_Context_Root_Label;
+ public static String StaticWebProjectWizardBasePage_Page_Title;
+ public static String StaticWebSettingsPropertiesPage_Not_available_for_closed_projects;
+ public static String TargetRuntime;
+ public static String NewDotDotDot;
+ public static String InvalidServerTarget;
+ public static String ConfigureSettings;
+ public static String Context_Root_cannot_be_empty_2;
+ public static String Names_cannot_contain_whitespace;
+ public static String The_character_is_invalid_in_a_context_root;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ResourceHandler.class);
+ }
+
+ public static String getString(String key, Object[] args) {
+ return NLS.bind(key, args);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPlugin.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPlugin.java
new file mode 100644
index 0000000..d14b6c8
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPlugin.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.web.internal;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import java.lang.Throwable;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.MultiStatus;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class WSTWebPlugin extends Plugin
+{
+ //The shared instance.
+ private static WSTWebPlugin plugin;
+
+ private WSTWebPreferences preferences;
+
+ public static final String VALIDATION_BUILDER_ID = ValidationPlugin.VALIDATION_BUILDER_ID; // plugin
+
+ public static final String[] ICON_DIRS = new String[]{"icons/full/obj16", //$NON-NLS-1$
+ "icons/full/ctool16", //$NON-NLS-1$
+ "icons/full/wizban", //$NON-NLS-1$
+ "icons", //$NON-NLS-1$
+ ""}; //$NON-NLS-1$
+
+ //the ID for this plugin (added automatically by logging quickfix)
+ public static final String PLUGIN_ID = "org.eclipse.wst.web"; //$NON-NLS-1$
+ /**
+ * The constructor.
+ */
+ public WSTWebPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static WSTWebPlugin getDefault()
+ {
+ return plugin;
+ }
+
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ @Override
+ protected void initializeDefaultPluginPreferences() {
+ getWSTWebPreferences().initializeDefaultPreferences();
+ }
+ /**
+ * @return Returns the preferences.
+ */
+ public WSTWebPreferences getWSTWebPreferences() {
+ if (this.preferences == null)
+ this.preferences = new WSTWebPreferences(this);
+ return this.preferences;
+ }
+
+ public static IStatus createStatus(int severity, String message, Throwable exception) {
+ return new Status(severity, PLUGIN_ID, message, exception);
+ }
+
+ public static IStatus createStatus(int severity, String message) {
+ return createStatus(severity, message, null);
+ }
+
+ public static void logError(String message) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message));
+ }
+
+ public static void logError(String message, Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message, exception));
+ }
+
+ public static void logError(String message, CoreException exception) {
+ MultiStatus status = new MultiStatus(PLUGIN_ID,IStatus.ERROR,new IStatus[]{exception.getStatus()},message,exception);
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( status );
+ }
+
+ public static void logError(Throwable exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
+ }
+
+ public static void logError(CoreException exception) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPreferences.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPreferences.java
new file mode 100644
index 0000000..fd5256a
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WSTWebPreferences.java
@@ -0,0 +1,81 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+
+package org.eclipse.wst.web.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Preferences;
+
+public class WSTWebPreferences {
+ public interface Keys {
+ final static String STATIC_WEB_CONTENT = "org.eclipse.jst.j2ee.preference.staticWebContentName"; //$NON-NLS-1$
+ }
+ public interface Values {
+ final static String STATIC_WEB_CONTENT = "WebContent"; //$NON-NLS-1$
+ }
+ public interface Defaults {
+ final static String STATIC_WEB_CONTENT = Values.STATIC_WEB_CONTENT;
+ }
+ private Plugin owner = null;
+ private Preferences preferences = null;
+ private boolean persistOnChange = false;
+
+ public WSTWebPreferences(Plugin owner) {
+ this.owner = owner;
+ }
+ protected void initializeDefaultPreferences() {
+ getPreferences().setDefault(Keys.STATIC_WEB_CONTENT, Defaults.STATIC_WEB_CONTENT);
+ }
+
+ public String getStaticWebContentFolderName() {
+ return getPreferences().getString(Keys.STATIC_WEB_CONTENT);
+ }
+
+ public void setStaticWebContentFolderName(String value) {
+ getPreferences().setValue(Keys.STATIC_WEB_CONTENT, value);
+ firePreferenceChanged();
+ }
+
+ public void firePreferenceChanged() {
+ if (isPersistOnChange())
+ persist();
+ }
+
+ public void persist() {
+ getOwner().savePluginPreferences();
+ }
+
+ /**
+ * @return Returns the persistOnChange.
+ */
+ public boolean isPersistOnChange() {
+ return this.persistOnChange;
+ }
+
+ /**
+ * @param persistOnChange
+ * The persistOnChange to set.
+ */
+ public void setPersistOnChange(boolean persistOnChange) {
+ this.persistOnChange = persistOnChange;
+ }
+
+ private Preferences getPreferences() {
+ if (this.preferences == null)
+ this.preferences = getOwner().getPluginPreferences();
+ return this.preferences;
+ }
+
+ /**
+ * @return Returns the owner.
+ */
+ private Plugin getOwner() {
+ return this.owner;
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WebPropertiesUtil.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WebPropertiesUtil.java
new file mode 100644
index 0000000..efa92d0
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/WebPropertiesUtil.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.web.internal;
+
+import com.ibm.icu.util.StringTokenizer;
+
+public class WebPropertiesUtil {
+ private static final char[] BAD_CHARS = {'/', '\\', ':'};
+ /**
+ * @param project
+ * org.eclipse.core.resources.IProject
+ */
+ /**
+ * Returns a error message that states whether a context root is valid or not returns null if
+ * context root is fine
+ *
+ * @return java.lang.String
+ * @param contextRoot
+ * java.lang.String
+ */
+ public static String validateContextRoot(String contextRoot) {
+
+ if (contextRoot == null)
+ return null;
+
+ String errorMessage = null;
+
+ String name = contextRoot;
+ if (name.equals("")) { //$NON-NLS-1$
+ // this was added because the error message shouldnt be shown initially. It should be
+ // shown only if context root field is edited to
+ errorMessage = ResourceHandler.StaticWebProjectWizardBasePage_Page_Title;
+
+ //errorMessage = ProjectSupportResourceHandler.getString("Context_Root_cannot_be_empty_2"); //$NON-NLS-1$
+ return errorMessage;
+ }
+
+ /*******************************************************************************************
+ * // JZ - fix to defect 204264, "/" is valid in context root if (name.indexOf("//") != -1) {
+ * //$NON-NLS-1$ errorMessage = "// are invalid characters in a resource name"; return
+ * errorMessage;
+ * }
+ ******************************************************************************************/
+
+ if (name.trim().equals(name)) {
+ StringTokenizer stok = new StringTokenizer(name, "."); //$NON-NLS-1$
+ outer : while (stok.hasMoreTokens()) {
+ String token = stok.nextToken();
+ for (int i = 0; i < token.length(); i++) {
+ if (!(token.charAt(i) == '_') && !(token.charAt(i) == '-') && !(token.charAt(i) == '/') && Character.isLetterOrDigit(token.charAt(i)) == false) {
+ if (Character.isWhitespace(token.charAt(i))) {
+ //Removed because context roots can contain white space
+ //errorMessage =
+ // ResourceHandler.getString("_Context_root_cannot_conta_UI_");//$NON-NLS-1$
+ // = " Context root cannot contain whitespaces."
+ } else {
+ errorMessage = ResourceHandler.StaticWebProjectWizardBasePage_Page_Title;
+
+ //errorMessage = ProjectSupportResourceHandler.getString("The_character_is_invalid_in_a_context_root", new Object[]{(new Character(token.charAt(i))).toString()}); //$NON-NLS-1$
+ break outer;
+ }
+ }
+ }
+ }
+ } // en/ end of if(name.trim
+ else
+ errorMessage = ResourceHandler.StaticWebProjectWizardBasePage_Page_Title;
+ //errorMessage = ProjectSupportResourceHandler.getString("Names_cannot_begin_or_end_with_whitespace_5"); //$NON-NLS-1$
+
+ return errorMessage;
+ }
+
+
+ /**
+ * Return true if the string contains any of the characters in the array.
+ */
+ private static boolean contains(String str, char[] chars) {
+ for (int i = 0; i < chars.length; i++) {
+ if (str.indexOf(chars[i]) != -1)
+ return true;
+ }
+ return false;
+ }
+
+
+ public static String validateFolderName(String folderName) {
+ if (folderName.length() == 0)
+ return ResourceHandler.StaticWebProjectWizardBasePage_Page_Title;
+
+ //return ProjectSupportResourceHandler.getString("Folder_name_cannot_be_empty_2"); //$NON-NLS-1$
+
+ if (contains(folderName, BAD_CHARS))
+ return ResourceHandler.StaticWebProjectWizardBasePage_Page_Title;
+
+ //return ProjectSupportResourceHandler.getString("Folder_name_is_not_valid", new Object[]{folderName}); //$NON-NLS-1$
+
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java
new file mode 100644
index 0000000..251db89
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java
@@ -0,0 +1,429 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.web.internal.deployables;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.util.ModuleFile;
+import org.eclipse.wst.server.core.util.ModuleFolder;
+import org.eclipse.wst.server.core.util.ProjectModule;
+
+/**
+ * @deprecated as of WTP 3.2
+ */
+public abstract class ComponentDeployable extends ProjectModule {
+
+ protected IVirtualComponent component = null;
+ protected List<IModuleResource> members = new ArrayList<IModuleResource>();
+
+ public ComponentDeployable(IProject project) {
+ this(project,ComponentCore.createComponent(project));
+ }
+
+ public ComponentDeployable(IProject project, IVirtualComponent aComponent) {
+ super(project);
+ this.component = aComponent;
+ }
+
+ /**
+ * @see org.eclipse.jst.server.core.IJ2EEModule#isBinary()
+ */
+ public boolean isBinary() {
+ if (component==null)
+ return false;
+ return component.isBinary();
+ }
+
+ /**
+ * Add the resources from mr to the existing resources in Module Folder mf
+ * @param ModuleFolder mf
+ * @param IModuleResource[] mr
+ */
+ protected void addMembersToModuleFolder(ModuleFolder mf, IModuleResource[] mr) {
+ // If the folder is null or the resources to add are null or empty, bail and return
+ if (mf == null || mr == null || mr.length==0)
+ return;
+ // Get the existing members in the module folder
+ IModuleResource[] mf_members = mf.members();
+ int mf_size = 0;
+ // Get the length of the existing members in the module folder
+ if (mf_members != null)
+ mf_size = mf_members.length;
+ // Create a new array to set on the module folder which will combine the existing and
+ // new module resources
+ IModuleResource[] res = new IModuleResource[mf_size + mr.length];
+ // Copy the existing members into the array if there are any
+ if (mf_members != null && mf_size > 0)
+ System.arraycopy(mf_members, 0, res, 0, mf_size);
+ // Copy the new members into the array
+ System.arraycopy(mr, 0, res, mf_size, mr.length);
+ // Set the new members array on the module folder
+ mf.setMembers(res);
+ }
+
+ /**
+ * Returns the child modules of this module.
+ *
+ * @return org.eclipse.wst.server.core.model.IModule[]
+ */
+ @Override
+ public IModule[] getChildModules() {
+ return getModules();
+ }
+
+ public IModule[] getModules() {
+ List<IModule> modules = new ArrayList<IModule>();
+ if (component != null) {
+ IVirtualReference[] components = getReferences(component);
+ for (int i = 0; i < components.length; i++) {
+ IVirtualReference reference = components[i];
+ if (reference != null && reference.getDependencyType()==IVirtualReference.DEPENDENCY_TYPE_USES) {
+ IVirtualComponent virtualComp = reference.getReferencedComponent();
+ IModule module = gatherModuleReference(component, virtualComp);
+ if (module != null && !modules.contains(module))
+ modules.add(module);
+ }
+ }
+ }
+ return modules.toArray(new IModule[modules.size()]);
+ }
+
+ protected IVirtualReference[] getReferences(IVirtualComponent aComponent) {
+ return aComponent.getReferences();
+ }
+
+ protected IModule gatherModuleReference(IVirtualComponent component, IVirtualComponent targetComponent ) {
+ // Handle workspace project module components
+ if (targetComponent != null && targetComponent.getProject()!=component.getProject()) {
+ if (!targetComponent.isBinary())
+ return ServerUtil.getModule(targetComponent.getProject());
+ }
+ return null;
+ }
+
+ /**
+ * Find the module resources for a given container and path. Inserts in the java containers
+ * at a given path if not null.
+ *
+ * @param cont a container
+ * @param path the current module relative path
+ * @param javaPath the path where Java resources fit in the root
+ * @param javaCont
+ * @return a possibly-empty array of module resources
+ * @throws CoreException
+ */
+ protected IModuleResource[] getMembers(IContainer cont, IPath path, IPath javaPath, IContainer[] javaCont) throws CoreException {
+ IResource[] res = cont.members();
+ int size2 = res.length;
+ List<IModuleFile> list = new ArrayList<IModuleFile>(size2);
+ for (int j = 0; j < size2; j++) {
+ if (res[j] instanceof IContainer) {
+ IContainer cc = (IContainer) res[j];
+
+ IPath newPath = path.append(cc.getName()).makeRelative();
+ // Retrieve already existing module folder if applicable
+ ModuleFolder mf = (ModuleFolder) getExistingModuleResource(members,newPath);
+ if (mf == null) {
+ mf = new ModuleFolder(cc, cc.getName(), path);
+ ModuleFolder parent = (ModuleFolder) getExistingModuleResource(members, path);
+ if (path.isEmpty())
+ members.add(mf);
+ else {
+ if (parent == null)
+ parent = ensureParentExists(path, cc);
+ addMembersToModuleFolder(parent, new IModuleResource[] {mf});
+ }
+ }
+ IModuleResource[] mr = getMembers(cc, newPath, javaPath, javaCont);
+
+ if (javaPath != null && newPath.isPrefixOf(javaPath))
+ mr = handleJavaPath(path, javaPath, newPath, javaCont, mr, cc);
+
+ addMembersToModuleFolder(mf, mr);
+
+ } else {
+ IFile f = (IFile) res[j];
+ // Handle the default package case
+ if (path.equals(javaPath)) {
+ ModuleFolder mFolder = (ModuleFolder) getExistingModuleResource(members,javaPath);
+ IModuleFile mFile = createModuleFile(f, javaPath);
+ if (mFolder != null)
+ addMembersToModuleFolder(mFolder,new IModuleResource[]{mFile});
+ else
+ list.add(mFile);
+ } else {
+ IModuleFile mf = createModuleFile(f, path);
+ list.add(mf);
+ }
+ }
+ }
+ IModuleResource[] mr = new IModuleResource[list.size()];
+ list.toArray(mr);
+ return mr;
+ }
+
+ protected IModuleFile createModuleFile(final IFile file, final IPath path) {
+ return new ModuleFile(file, file.getName(), path);
+ }
+
+ protected IModuleResource[] getMembers(IVirtualContainer cont, IPath path) throws CoreException {
+ IVirtualResource[] res = cont.members();
+ int size2 = res.length;
+ List<IModuleFile> list = new ArrayList<IModuleFile>(size2);
+ for (int j = 0; j < size2; j++) {
+ if (res[j] instanceof IVirtualContainer) {
+ IVirtualContainer cc = (IVirtualContainer) res[j];
+ // Retrieve already existing module folder if applicable
+ ModuleFolder mf = (ModuleFolder) getExistingModuleResource(members,path.append(new Path(cc.getName()).makeRelative()));
+ if (mf == null) {
+ mf = new ModuleFolder((IContainer)cc.getUnderlyingResource(), cc.getName(), path);
+ ModuleFolder parent = (ModuleFolder) getExistingModuleResource(members, path);
+ if (path.isEmpty())
+ members.add(mf);
+ else {
+ if (parent == null)
+ parent = ensureParentExists(path, (IContainer)cc.getUnderlyingResource());
+ addMembersToModuleFolder(parent, new IModuleResource[] {mf});
+ }
+ }
+ IModuleResource[] mr = getMembers(cc, path.append(cc.getName()));
+ addMembersToModuleFolder(mf, mr);
+ } else {
+ IFile f = (IFile) res[j].getUnderlyingResource();
+ IModuleFile mf = null;
+ if (shouldAddComponentFile(f)) {
+ mf = createModuleFile(f, path);
+ list.add(mf);
+ }
+ }
+ }
+ IModuleResource[] mr = new IModuleResource[list.size()];
+ list.toArray(mr);
+ return mr;
+ }
+
+ protected ModuleFolder ensureParentExists(IPath path, IContainer cc) {
+ ModuleFolder parent = (ModuleFolder) getExistingModuleResource(members, path);
+ if (parent == null) {
+ String folderName = path.lastSegment();
+ IPath folderPath = Path.EMPTY;
+ if (path.segmentCount()>1)
+ folderPath = path.removeLastSegments(1);
+ parent = new ModuleFolder(cc, folderName, folderPath);
+ if (path.segmentCount()>1)
+ addMembersToModuleFolder(ensureParentExists(path.removeLastSegments(1),cc), new IModuleResource[] {parent});
+ else
+ members.add(parent);
+ }
+ return parent;
+ }
+
+ /**
+ * This method is meant to be overridden by subclasses. Return whether or not to add this file
+ * to the members list.
+ *
+ * @param file
+ * @return boolean should add file?
+ */
+ protected boolean shouldAddComponentFile(IFile file) {
+ return true;
+ }
+
+ /**
+ * Check the current cache to see if we already have an existing module resource for
+ * the given path.
+ * @param aList
+ * @param path
+ * @return an existing moduleResource from the cached result
+ */
+
+ protected IModuleResource getExistingModuleResource(List aList, IPath path) {
+ // If the list is empty, return null
+ if (aList==null || aList.isEmpty() || path == null)
+ return null;
+ // Otherwise recursively check to see if given resource matches current resource or if it is a child
+ String[] pathSegments = path.segments();
+ IModuleResource moduleResource = null;
+
+ if(pathSegments.length == 0)
+ return null;
+ for (Iterator iter = aList.iterator(); iter.hasNext();) {
+ moduleResource = (IModuleResource) iter.next();
+ String[] moduleSegments = moduleResource.getModuleRelativePath().segments();
+ // If the last segment in passed in path equals the module resource name
+ // and segment count is the same and the path segments start with the module path segments
+ // then we have a match and we return the existing moduleResource
+ if (pathSegments[pathSegments.length - 1].equals(moduleResource.getName()) &&
+ (moduleSegments.length + 1) == pathSegments.length &&
+ startsWith(moduleSegments, pathSegments))
+ return moduleResource;
+
+ // Otherwise, if it is a folder, check its children for the existing resource path
+ // but only check if the beginning segments are a match
+ if(moduleResource instanceof IModuleFolder &&
+ startsWith(moduleSegments, pathSegments) && pathSegments.length > moduleSegments.length &&
+ moduleResource.getName().equals(pathSegments[moduleSegments.length > 0 ? moduleSegments.length : 0]))
+ if (((IModuleFolder)moduleResource).members()!=null)
+ return getExistingModuleResource(Arrays.asList(((IModuleFolder)moduleResource).members()),path);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param beginningSegments
+ * @param testSegments
+ * @return True if beginningSegments[i] == testSegments[i] for all 0<=i<beginningSegments[i]
+ */
+ private boolean startsWith(String[] beginningSegments, String[] testSegments) {
+ for(int i=0; i < beginningSegments.length; i++) {
+ if(!beginningSegments[i].equals(testSegments[i]))
+ return false;
+ }
+ return true;
+ }
+
+ protected IModuleResource[] handleJavaPath(IPath path, IPath javaPath, IPath curPath, IContainer[] javaCont, IModuleResource[] mr, IContainer cc) throws CoreException {
+ //subclasses may override
+ return new IModuleResource[]{};
+ }
+
+ @Override
+ public IModuleResource[] members() throws CoreException {
+ members.clear();
+ IVirtualComponent vc = ComponentCore.createComponent(getProject());
+ if (vc != null) {
+ IVirtualFolder vFolder = vc.getRootFolder();
+ IModuleResource[] mr = getMembers(vFolder, Path.EMPTY);
+ int size = mr.length;
+ for (int j = 0; j < size; j++) {
+ members.add(mr[j]);
+ }
+ addUtilMembers(vc);
+ }
+
+ IModuleResource[] mr = new IModuleResource[members.size()];
+ members.toArray(mr);
+ return mr;
+ }
+
+ protected boolean shouldIncludeUtilityComponent(IVirtualComponent virtualComp, IVirtualReference[] components, ArtifactEdit edit) {
+ return virtualComp != null && virtualComp.isBinary() && virtualComp.getProject()==component.getProject();
+ }
+
+ protected void addUtilMembers(IVirtualComponent vc) {
+ ArtifactEdit edit = null;
+ try {
+ edit = getComponentArtifactEditForRead();
+ IVirtualReference[] components = vc.getReferences();
+ for (int i = 0; i < components.length; i++) {
+ IVirtualReference reference = components[i];
+ IVirtualComponent virtualComp = reference.getReferencedComponent();
+ if (shouldIncludeUtilityComponent(virtualComp,components,edit)) {
+ addUtilMember(vc, reference, reference.getRuntimePath());
+ }
+ }
+ } finally {
+ if (edit!=null)
+ edit.dispose();
+ }
+ }
+
+ protected void addUtilMember(IVirtualComponent parent, IVirtualReference reference, IPath runtimePath) {
+ IModuleFile mf = null;
+ final String archiveName2 = reference.getArchiveName();
+ final String archiveName = new Path(archiveName2).lastSegment();
+ final IVirtualComponent virtualComp = reference.getReferencedComponent();
+ IFile ifile = (IFile)virtualComp.getAdapter(IFile.class);
+ if (ifile != null) { //In Workspace
+ String name = null != archiveName ? archiveName : ifile.getName();
+ mf = new ModuleFile(ifile, name, runtimePath.makeRelative());
+ } else {
+ File extFile = (File)virtualComp.getAdapter(File.class);
+ String name = null != archiveName ? archiveName : extFile.getName();
+ mf = new ModuleFile(extFile, name, runtimePath.makeRelative());
+ }
+ IModuleResource moduleParent = getExistingModuleResource(members, mf.getModuleRelativePath());
+ if (moduleParent != null && moduleParent instanceof ModuleFolder) {
+ addMembersToModuleFolder((ModuleFolder)moduleParent, new IModuleResource[]{mf});
+ } else {
+ if (mf.getModuleRelativePath().isEmpty()) {
+ members.add(mf);
+ } else {
+ if (moduleParent == null) {
+ moduleParent = ensureParentExists(mf.getModuleRelativePath(), (IContainer)parent.getRootFolder().getUnderlyingResource());
+ }
+ addMembersToModuleFolder((ModuleFolder)moduleParent, new IModuleResource[] {mf});
+ }
+ }
+ }
+
+ protected ArtifactEdit getComponentArtifactEditForRead() {
+ return null;
+ }
+
+ protected static boolean isProjectOfType(IProject project, String typeID) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ return false;
+ }
+
+ if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined(typeID)) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(typeID);
+ return projectFacet!=null && facetedProject.hasProjectFacet(projectFacet);
+ }
+ return false;
+ }
+
+ /**
+ * Returns the root folders for the resources in this module.
+ *
+ * @return a possibly-empty array of resource folders
+ */
+ public IContainer[] getResourceFolders() {
+ IVirtualComponent vc = ComponentCore.createComponent(getProject());
+ if (vc != null) {
+ IVirtualFolder vFolder = vc.getRootFolder();
+ if (vFolder != null)
+ return vFolder.getUnderlyingFolders();
+ }
+ return new IContainer[]{};
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java
new file mode 100644
index 0000000..fb8689b
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/FlatComponentDeployable.java
@@ -0,0 +1,379 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat 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:
+ * Red Hat - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.web.internal.deployables;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent;
+import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.FlatComponentTaskModel;
+import org.eclipse.wst.common.componentcore.internal.flat.IChildModuleReference;
+import org.eclipse.wst.common.componentcore.internal.flat.IFlatFile;
+import org.eclipse.wst.common.componentcore.internal.flat.IFlatFolder;
+import org.eclipse.wst.common.componentcore.internal.flat.IFlatResource;
+import org.eclipse.wst.common.componentcore.internal.flat.IFlatVirtualComponent;
+import org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant;
+import org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.eclipse.wst.server.core.util.ModuleFile;
+import org.eclipse.wst.server.core.util.ProjectModule;
+
+public abstract class FlatComponentDeployable extends ProjectModule {
+
+ /*
+ * Register an adapt IModule to IVirtualComponent
+ */
+ static {
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+ public Class[] getAdapterList() {
+ return new Class[] { IVirtualComponent.class };
+ }
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IModule) {
+ IModule module = (IModule) adaptableObject;
+ FlatComponentDeployable deployable = (FlatComponentDeployable) module.loadAdapter(FlatComponentDeployable.class, null);
+ if(deployable != null){
+ IVirtualComponent virtualComponent = deployable.getComponent();
+ return virtualComponent;
+ }
+ }
+ return null;
+ }
+ }, IModule.class);
+ }
+
+ protected IVirtualComponent component = null;
+ protected List<IModuleResource> members = new ArrayList<IModuleResource>();
+
+ public FlatComponentDeployable(IProject project) {
+ this(project,ComponentCore.createComponent(project));
+ }
+
+ public FlatComponentDeployable(IProject project, IVirtualComponent aComponent) {
+ super(project);
+ this.component = aComponent;
+ }
+
+ public IVirtualComponent getComponent() {
+ return component;
+ }
+
+ /**
+ * We will cache the flattened piece here, and instead redirect
+ * the module factories to recreate the modules *whenever* there is
+ * a workspace change. This will still be much more efficient than
+ * traversing the tree each time a call to getResources() or getChildModules().
+ */
+ private FlatVirtualComponent cacheFlattened = null;
+
+
+ public boolean shouldCache() {
+ return false;
+ }
+
+ public void clearCache() {
+ cacheFlattened = null;
+ }
+
+ /**
+ * The export model is what does the grunt of the work
+ * @return
+ */
+ protected IFlatVirtualComponent getFlatComponent() {
+ if( !shouldCache() || cacheFlattened == null ) {
+ FlatComponentTaskModel options = new FlatComponentTaskModel();
+ options.put(FlatVirtualComponent.PARTICIPANT_LIST, Arrays.asList(getParticipants()));
+ FlatVirtualComponent tmp = new FlatVirtualComponent(component, options);
+ if( shouldCache())
+ cacheFlattened = tmp;
+ return tmp;
+ }
+ return cacheFlattened;
+ }
+
+ /**
+ * Subclasses can provide a list of participants who may
+ * be involved in forming the export model
+ *
+ * A deployable with no participant should still properly
+ * consume consumed references and traverse the model appropriately
+ *
+ * @return
+ */
+ protected IFlattenParticipant[] getParticipants() {
+ return new IFlattenParticipant[]{
+ };
+ }
+
+ public boolean isBinary() {
+ return component == null ? false : component.isBinary();
+ }
+
+ @Override
+ public IModuleResource[] members() throws CoreException {
+ if( component.isBinary() )
+ return LEGACY_binaryMembers();
+
+ IFlatVirtualComponent em = getFlatComponent();
+ IFlatResource[] resources = em.fetchResources();
+ return convert(resources);
+
+ }
+
+ protected IModuleResource[] LEGACY_binaryMembers() {
+ IFile ifile = (IFile)component.getAdapter(IFile.class);
+ File file = (File)component.getAdapter(File.class);
+ ModuleFile mf = ifile != null ? new ModuleFile(ifile, ifile.getName(), new Path("")) //$NON-NLS-1$
+ : new ModuleFile(file, file.getName(), new Path("")); //$NON-NLS-1$
+ return new IModuleResource[]{mf};
+ }
+
+ /**
+ * Returns the child modules of this module.
+ *
+ * @return org.eclipse.wst.server.core.model.IModule[]
+ */
+ @Override
+ public IModule[] getChildModules() {
+ return getModules();
+ }
+
+ public /* non api */ IChildModuleReference[] getExportModelChildren() throws CoreException {
+ IFlatVirtualComponent em = getFlatComponent();
+ IChildModuleReference[] children = em.getChildModules();
+ return children;
+ }
+
+ public IModule[] getModules() {
+ // Legacy, here in case the old modules are used
+ if( component.isBinary() )
+ return new IModule[]{};
+
+ try {
+ List<IModule> modules = new ArrayList<IModule>();
+ IChildModuleReference[] children = getExportModelChildren();
+ for( int i = 0; i < children.length; i++ ) {
+ IModule child = gatherModuleReference(component, children[i]);
+ if( child != null )
+ modules.add(child);
+ }
+ return modules.toArray(new IModule[modules.size()]);
+ } catch( CoreException ce ) {
+ }
+ return new IModule[]{};
+ }
+
+ @Override
+ public String getPath(IModule m) {
+ return getURI(m);
+ }
+
+ /**
+ * Returns the URI of the given contained CHILD module.
+ *
+ * SOFT requirements (NOT API!!) in use by some adopters
+ * If the passed in module is equal to this module, return our own deployed name
+ *
+ * @param module a module
+ * @return the URI of the given module, or <code>null</code> if the URI could
+ * not be found
+ */
+ public String getURI(IModule module) {
+ ProjectModule md = (ProjectModule)module.loadAdapter(ProjectModule.class, new NullProgressMonitor());
+ if( md == this ) {
+ // guess my own name
+ return VirtualReferenceUtilities.INSTANCE.getDefaultProjectArchiveName(this.component);
+ }
+ try {
+ FlatComponentDeployable cd = (FlatComponentDeployable)module.loadAdapter(FlatComponentDeployable.class, new NullProgressMonitor());
+ if( cd != null ) {
+ IFlatVirtualComponent em = getFlatComponent();
+ IChildModuleReference[] children = em.getChildModules();
+ for( int i = 0; i < children.length; i++ ) {
+ IModule child = gatherModuleReference(component, children[i]);
+ if( child != null && child.getId().equals(module.getId()))
+ return children[i].getRelativeURI().toString();
+ }
+ }
+ } catch( CoreException ce ) {
+ }
+ return null;
+ }
+
+ /**
+ * If I know how to find an IModule for this child, do so now
+ *
+ * I would love to see this replaced with some API to locate a
+ * possible child module based on a virtual component.
+ *
+ * @param component
+ * @param targetComponent
+ * @return
+ */
+ protected IModule gatherModuleReference(IVirtualComponent component, IChildModuleReference child) {
+ // Handle workspace project module components
+ // Subclasses should extend
+ IVirtualComponent targetComponent = child.getComponent();
+ if (targetComponent != null && targetComponent.getProject()!= component.getProject()) {
+ if (!targetComponent.isBinary()) {
+ return filterModuleDelegates(ServerUtil.getModules(targetComponent.getProject()));
+ }
+ }
+ return null;
+ }
+
+ /**
+ * An extender may wish to override this method in order to control which
+ * delegate is returned in the scenario where more than one exist. By default
+ * the first one found is returned.
+ *
+ * @param IModule[] modules
+ * @return IModule[]
+ */
+ protected IModule filterModuleDelegates(IModule[] modules) {
+ for (int i = 0; i < modules.length; i++) {
+ ModuleDelegate md = (ModuleDelegate)modules[i].loadAdapter(ModuleDelegate.class, new NullProgressMonitor());
+ if (md instanceof ProjectModule) {
+ return modules[i];
+ }
+ }
+ return modules.length > 0 ? modules[0] : null;
+ }
+
+ /*
+ * Below are STATIC utility classes and methods
+ */
+ protected static IModuleResource[] convert(IFlatResource[] resources) {
+ ArrayList<IModuleResource> list = new ArrayList<IModuleResource>();
+ for( int i = 0; i < resources.length; i++ ) {
+ if( resources[i] instanceof IFlatFile)
+ list.add(new ComponentModuleFile(resources[i]));
+ else if( resources[i] instanceof IFlatFolder)
+ list.add(new ComponentModuleFolder(resources[i]));
+ }
+ return list.toArray(new IModuleResource[list.size()]);
+ }
+
+ public static class ComponentModuleResource {
+ protected IFlatResource delegate;
+ public ComponentModuleResource(IFlatResource resource) {
+ this.delegate = resource;
+ }
+ public long getModificationStamp() {
+ return ((IFlatFile)delegate).getModificationStamp();
+ }
+
+ public IPath getModuleRelativePath() {
+ return delegate.getModuleRelativePath();
+ }
+ public String getName() {
+ return delegate.getName();
+ }
+ public Object getAdapter(Class adapter) {
+ return delegate.getAdapter(adapter);
+ }
+ public IModuleResource[] members() {
+ IFlatResource[] children = ((IFlatFolder)delegate).members();
+ return convert(children);
+ }
+ }
+
+ public static class ComponentModuleFile extends ComponentModuleResource implements IModuleFile{
+ public ComponentModuleFile(IFlatResource resource) {
+ super(resource);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+
+ if (!(obj instanceof IModuleFile))
+ return false;
+
+ IModuleFile mf = (IModuleFile) obj;
+ if (!getName().equals(mf.getName()))
+ return false;
+ if (!getModuleRelativePath().equals(mf.getModuleRelativePath()))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return getName().hashCode() * 37 + getModuleRelativePath().hashCode();
+ }
+ }
+
+ public static class ComponentModuleFolder extends ComponentModuleResource implements IModuleFolder {
+ public ComponentModuleFolder(IFlatResource resource) {
+ super(resource);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+
+ if (!(obj instanceof IModuleFolder))
+ return false;
+
+ IModuleFolder mf = (IModuleFolder) obj;
+ if (!getName().equals(mf.getName()))
+ return false;
+ if (!getModuleRelativePath().equals(mf.getModuleRelativePath()))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return getName().hashCode() * 37 + getModuleRelativePath().hashCode();
+ }
+
+ }
+
+ protected static boolean isProjectOfType(IProject project, String typeID) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ return false;
+ }
+
+ if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined(typeID)) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(typeID);
+ return projectFacet!=null && facetedProject.hasProjectFacet(projectFacet);
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/IStaticWebModuleArtifact.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/IStaticWebModuleArtifact.java
new file mode 100644
index 0000000..7fd5bfb
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/IStaticWebModuleArtifact.java
@@ -0,0 +1,14 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+
+package org.eclipse.wst.web.internal.deployables;
+
+public interface IStaticWebModuleArtifact {
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java
new file mode 100644
index 0000000..a8e0b9a
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployable.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.web.internal.deployables;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.util.IStaticWeb;
+
+public class StaticWebDeployable extends FlatComponentDeployable implements IStaticWeb {
+
+ public StaticWebDeployable(IProject project, IVirtualComponent component) {
+ super(project);
+ }
+
+ public String getContextRoot() {
+ Properties props = component.getMetaProperties();
+ if(props.containsKey("context-root")) //$NON-NLS-1$
+ return props.getProperty("context-root"); //$NON-NLS-1$
+ return component.getName();
+ }
+
+ /* TODO This is never called ?? */
+// public String getURI(IModule module) {
+// IVirtualComponent comp = ComponentCore.createComponent(module.getProject());
+// String aURI = null;
+// if (comp !=null) {
+// if (!comp.isBinary() && isProjectOfType(module.getProject(),IModuleConstants.WST_WEB_MODULE)) {
+// IVirtualReference ref = component.getReference(comp.getName());
+// aURI = ref.getRuntimePath().append(comp.getName()+".war").toString(); //$NON-NLS-1$
+// }
+// }
+//
+// if (aURI !=null && aURI.length()>1 && aURI.startsWith("/")) //$NON-NLS-1$
+// aURI = aURI.substring(1);
+// return aURI;
+// }
+
+ public String getVersion() {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(component.getProject());
+ if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined(IModuleConstants.WST_WEB_MODULE)) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE);
+ return facetedProject.getInstalledVersion(projectFacet).getVersionString();
+ }
+ } catch (Exception e) {
+ //Ignore
+ }
+ return "1.0"; //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableFactory.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableFactory.java
new file mode 100644
index 0000000..4c4c6f0
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableFactory.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 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.wst.web.internal.deployables;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
+import org.eclipse.wst.web.internal.WSTWebPlugin;
+
+public class StaticWebDeployableFactory extends ProjectModuleFactoryDelegate {
+ private static final String ID = "org.eclipse.wst.web.internal.deployables.static"; //$NON-NLS-1$
+ protected ArrayList moduleDelegates = new ArrayList();
+
+ /*
+ * @see DeployableProjectFactoryDelegate#getFactoryID()
+ */
+ public static String getFactoryId() {
+ return ID;
+ }
+
+ /**
+ * Use {@link #createModules(IProject)} instead.
+ * @deprecated
+ * @param nature
+ * @return
+ */
+ protected IModule[] createModules(ModuleCoreNature nature) {
+ if(nature != null){
+ return createModules(nature.getProject());
+ }
+ return null;
+ }
+ /**
+ * Returns true if the project represents a deployable project of this type.
+ *
+ * @param project
+ * org.eclipse.core.resources.IProject
+ * @return boolean
+ */
+ protected boolean isValidModule(IProject project) {
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if (facetedProject == null)
+ return false;
+ IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet(IModuleConstants.WST_WEB_MODULE);
+ return facetedProject.hasProjectFacet(webFacet);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.wst.server.core.model.ModuleFactoryDelegate#getModuleDelegate(org.eclipse.wst.server.core.IModule)
+ */
+ @Override
+ public ModuleDelegate getModuleDelegate(IModule module) {
+ for (Iterator iter = moduleDelegates.iterator(); iter.hasNext();) {
+ ModuleDelegate element = (ModuleDelegate) iter.next();
+ if (module == element.getModule())
+ return element;
+ }
+ return null;
+
+ }
+
+ @Override
+ protected IModule[] createModules(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component != null){
+ try {
+ return createModuleDelegates(component);
+ } catch (CoreException e) {
+ WSTWebPlugin.logError(e);
+ }
+ }
+ return null;
+ }
+
+ protected IModule[] createModuleDelegates(IVirtualComponent component) throws CoreException {
+ if(component == null){
+ return null;
+ }
+ StaticWebDeployable moduleDelegate = null;
+ IModule module = null;
+ try {
+ if(isValidModule(component.getProject())) {
+ moduleDelegate = new StaticWebDeployable(component.getProject(),component);
+ module = createModule(component.getName(), component.getName(), IModuleConstants.WST_WEB_MODULE, moduleDelegate.getVersion(), moduleDelegate.getProject());
+ moduleDelegate.initialize(module);
+ }
+ } catch (Exception e) {
+ WSTWebPlugin.logError(e);
+ } finally {
+ if (module != null) {
+ if (getModuleDelegate(module) == null)
+ moduleDelegates.add(moduleDelegate);
+ }
+ }
+ if (module == null)
+ return null;
+ return new IModule[] {module};
+ }
+
+ /**
+ * Returns the list of resources that the module should listen to
+ * for state changes. The paths should be project relative paths.
+ * Subclasses can override this method to provide the paths.
+ *
+ * @return a possibly empty array of paths
+ */
+ @Override
+ protected IPath[] getListenerPaths() {
+ return new IPath[] {
+ new Path(".project"), // nature //$NON-NLS-1$
+ new Path(StructureEdit.MODULE_META_FILE_NAME), // component
+ new Path(".settings/org.eclipse.wst.common.project.facet.core.xml") // facets //$NON-NLS-1$
+ };
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapter.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapter.java
new file mode 100644
index 0000000..b4ed6ad
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapter.java
@@ -0,0 +1,36 @@
+/***************************************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+
+package org.eclipse.wst.web.internal.deployables;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
+
+public class StaticWebDeployableObjectAdapter extends ModuleArtifactAdapterDelegate implements IAdapterFactory
+
+{
+
+ public StaticWebDeployableObjectAdapter() {
+ super();
+ }
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[]{IStaticWebModuleArtifact.class};
+ }
+
+ @Override
+ public IModuleArtifact getModuleArtifact(Object obj) {
+ return StaticWebDeployableObjectAdapterUtil.getModuleObject(obj);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapterUtil.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapterUtil.java
new file mode 100644
index 0000000..f179163
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/StaticWebDeployableObjectAdapterUtil.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wst.web.internal.deployables;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.util.WebResource;
+
+public class StaticWebDeployableObjectAdapterUtil {
+
+ private final static String[] extensionsToExclude = new String[]{"sql", "xmi"}; //$NON-NLS-1$ //$NON-NLS-2$
+ static String INFO_DIRECTORY = "WEB-INF"; //$NON-NLS-1$
+
+ public static IModuleArtifact getModuleObject(Object obj) {
+ IResource resource = null;
+ if (obj instanceof IResource)
+ resource = (IResource) obj;
+ else if (obj instanceof IAdaptable)
+ resource = (IResource) ((IAdaptable) obj).getAdapter(IResource.class);
+
+ if (resource == null)
+ return null;
+
+ if (resource instanceof IProject) {
+ IProject project = (IProject) resource;
+ if (hasInterestedComponents(project))
+ return new WebResource(getModule(project), new Path("")); //$NON-NLS-1$
+ return null;
+ }
+
+ IProject project = ProjectUtilities.getProject(resource);
+ if (project != null && !hasInterestedComponents(project))
+ return null;
+
+ IVirtualComponent comp = ComponentCore.createComponent(project);
+ // determine path
+ IPath rootPath = comp.getRootFolder().getProjectRelativePath();
+ IPath resourcePath = resource.getProjectRelativePath();
+
+ // Check to make sure the resource is under the webApplication directory
+ if (resourcePath.matchingFirstSegments(rootPath) != rootPath.segmentCount())
+ return null;
+
+ // Do not allow resource under the web-inf directory
+ resourcePath = resourcePath.removeFirstSegments(rootPath.segmentCount());
+ if (resourcePath.segmentCount() > 1 && resourcePath.segment(0).equals(INFO_DIRECTORY))
+ return null;
+
+ if (shouldExclude(resource))
+ return null;
+
+ // return Web resource type
+ return new WebResource(getModule(project), resourcePath);
+
+ }
+
+ /**
+ * Method shouldExclude.
+ *
+ * @param resource
+ * @return boolean
+ */
+ private static boolean shouldExclude(IResource resource) {
+ String fileExt = resource.getFileExtension();
+
+ // Exclude files of certain extensions
+ for (int i = 0; i < extensionsToExclude.length; i++) {
+ String extension = extensionsToExclude[i];
+ if (extension.equalsIgnoreCase(fileExt))
+ return true;
+ }
+ return false;
+ }
+
+ protected static IModule getModule(IProject project) {
+ if (hasInterestedComponents(project))
+ return ServerUtil.getModule(project);
+ return null;
+ }
+
+ protected static boolean hasInterestedComponents(IProject project) {
+ return isProjectOfType(project, IModuleConstants.WST_WEB_MODULE);
+ }
+
+ protected static boolean isProjectOfType(IProject project, String typeID) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ return false;
+ }
+
+ if (facetedProject != null && ProjectFacetsManager.isProjectFacetDefined(typeID)) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(typeID);
+ return projectFacet != null && facetedProject.hasProjectFacet(projectFacet);
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/MappingDescriptor.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/MappingDescriptor.java
new file mode 100644
index 0000000..8b5f3c5
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/MappingDescriptor.java
@@ -0,0 +1,59 @@
+package org.eclipse.wst.web.internal.facet;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
+public class MappingDescriptor {
+
+ protected IConfigurationElement element = null;
+
+ public MappingDescriptor(IConfigurationElement configurationElement) {
+ this.element = configurationElement;
+ }
+
+ public IConfigurationElement getElement() {
+ return element;
+ }
+
+ public String getID() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_ID);
+ }
+
+ public String getFacetRuntimeTypeID() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_FACET_RUNTIME_TYPE_ID);
+ }
+
+ public String getFacetRuntimeVersion() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_FACET_RUNTIME_VERSION);
+ }
+
+ public String getFacetID() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_FACET_ID);
+ }
+
+ public String getFacetVersion() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_FACET_VERSION);
+ }
+
+ public String getPresetID() {
+ return element.getAttribute(RuntimePresetMappingRegistry.ATTRIBUTE_PRESET_ID);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buff = new StringBuffer();
+ buff.append("id:"); //$NON-NLS-1$
+ buff.append(getID());
+ buff.append(" facetRuntimeTypeID:"); //$NON-NLS-1$
+ buff.append(getFacetRuntimeTypeID());
+ buff.append(" facetRuntimeVersion:"); //$NON-NLS-1$
+ buff.append(getFacetRuntimeVersion());
+ buff.append(" facetID:"); //$NON-NLS-1$
+ buff.append(getFacetID());
+ buff.append(" facetVersion:"); //$NON-NLS-1$
+ buff.append(getFacetVersion());
+ buff.append(" presetID:"); //$NON-NLS-1$
+ buff.append(getPresetID());
+ return buff.toString();
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/RuntimePresetMappingRegistry.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/RuntimePresetMappingRegistry.java
new file mode 100644
index 0000000..b2bcd0b
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/facet/RuntimePresetMappingRegistry.java
@@ -0,0 +1,261 @@
+package org.eclipse.wst.web.internal.facet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.web.internal.WSTWebPlugin;
+
+public class RuntimePresetMappingRegistry {
+
+ static final String EXTENSION_POINT = "runtimePresetMappings"; //$NON-NLS-1$
+
+ static final String ELEMENT_MAPPING = "mapping"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_FACET_RUNTIME_TYPE_ID = "facetRuntimeTypeID"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_FACET_RUNTIME_VERSION = "facetRuntimeVersion"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_FACET_ID = "facetID"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_FACET_VERSION = "facetVersion"; //$NON-NLS-1$
+
+ static final String ATTRIBUTE_PRESET_ID = "presetID"; //$NON-NLS-1$
+
+ public static RuntimePresetMappingRegistry INSTANCE = new RuntimePresetMappingRegistry();
+
+ private List<MappingDescriptor> descriptors = null;
+
+ public String getPresetID(String facetRuntimeTypeID,
+ String facetRuntimeVersion, String facetID, String facetVersion) {
+ if (descriptors == null) {
+ readDescriptors();
+ }
+ for (MappingDescriptor descriptor : descriptors) {
+ if(matches(facetRuntimeTypeID, descriptor.getFacetRuntimeTypeID()) &&
+ matches(facetRuntimeVersion, descriptor.getFacetRuntimeVersion()) &&
+ matches(facetID, descriptor.getFacetID()) &&
+ matches(facetVersion, descriptor.getFacetVersion())){
+ return descriptor.getPresetID();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns true if the value is matched by the pattern The pattern consists
+ * of a common deliminated list of simple patterns Each simple pattern has
+ * an optional starting or ending * so a String.startsWith() or
+ * String.endsWith(). Both may be combined to compute a String.indexOf() !=
+ * -1
+ *
+ * @param value
+ * @param pattern
+ * @return
+ */
+ private static boolean matches(String value, String pattern){
+ StringTokenizer strTok = new StringTokenizer(pattern, ","); //$NON-NLS-1$
+ while(strTok.hasMoreTokens()){
+ String simplePattern = strTok.nextToken().trim();
+ if(simplePattern.startsWith("*")){ //$NON-NLS-1$
+ if(simplePattern.length() < 2){
+ return true; // i.e. *
+ }
+ if(simplePattern.endsWith("*")){ //$NON-NLS-1$
+ if(simplePattern.length() < 3){
+ return true; // i.e. **
+ }
+ if(value.indexOf(simplePattern.substring(1, simplePattern.length()-2)) != -1){
+ return true;
+ }
+ } else {
+ if(value.endsWith(simplePattern.substring(1))){
+ return true;
+ }
+ }
+ } else if(simplePattern.endsWith("*")){ //$NON-NLS-1$
+ if(value.startsWith(simplePattern.substring(0, simplePattern.length()-2))){
+ return true;
+ }
+ } else if(value.equals(simplePattern)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static List <String> getStaticTokens(String pattern){
+ List <String> staticTokens = new ArrayList <String> ();
+ StringTokenizer strTok = new StringTokenizer(pattern, ","); //$NON-NLS-1$
+ while(strTok.hasMoreTokens()){
+ String simplePattern = strTok.nextToken().trim();
+ if(!simplePattern.startsWith("*") && !simplePattern.endsWith("*")){ //$NON-NLS-1$ //$NON-NLS-2$
+ staticTokens.add(simplePattern);
+ }
+ }
+ return staticTokens;
+ }
+
+
+ private void readDescriptors() {
+ descriptors = new ArrayList<MappingDescriptor>();
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(WSTWebPlugin.PLUGIN_ID, EXTENSION_POINT);
+ if (point == null)
+ return;
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement element = elements[i];
+ if (ELEMENT_MAPPING.equals(element.getName())) {
+ String id = element.getAttribute(ATTRIBUTE_ID);
+ if (null == id || id.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_ID); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+
+ String runtimeID = element.getAttribute(ATTRIBUTE_FACET_RUNTIME_TYPE_ID);
+ if (null == runtimeID || runtimeID.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_FACET_RUNTIME_TYPE_ID); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+
+ List <String> staticRuntimeIDs = getStaticTokens(runtimeID);
+ List <IRuntimeComponentType> staticRuntimeTypes = new ArrayList<IRuntimeComponentType>();
+ for(String staticRuntimeID : staticRuntimeIDs){
+ try {
+ IRuntimeComponentType runtimeType = RuntimeManager.getRuntimeComponentType(staticRuntimeID);
+ if(runtimeType != null){
+ staticRuntimeTypes.add(runtimeType);
+ }
+ } catch (IllegalArgumentException e) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " defined invalid attribute " + ATTRIBUTE_FACET_RUNTIME_TYPE_ID + ": " + runtimeID +" unable to resolve runtime: "+staticRuntimeID, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+ }
+
+ String runtimeVersionStr = element.getAttribute(ATTRIBUTE_FACET_RUNTIME_VERSION);
+ if (null == runtimeVersionStr || runtimeVersionStr.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_FACET_RUNTIME_VERSION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+ if(!staticRuntimeTypes.isEmpty()){
+ List <String> staticRuntimeVersions = getStaticTokens(runtimeVersionStr);
+ for(String staticVersion : staticRuntimeVersions){
+ boolean foundVersion = false;
+ for(int k=0;k<staticRuntimeTypes.size() && !foundVersion;k++){
+ IRuntimeComponentType runtimeType = staticRuntimeTypes.get(k);
+ try {
+ runtimeType.getVersion(staticVersion);
+ foundVersion = true;
+ } catch (IllegalArgumentException e) {
+ //eat it
+ }
+ }
+ if(!foundVersion){
+ StringBuffer validVersions = new StringBuffer(" valid versions include: "); //$NON-NLS-1$
+ for(IRuntimeComponentType runtimeType : staticRuntimeTypes) {
+ validVersions.append("\n"); //$NON-NLS-1$
+ validVersions.append(runtimeType.getId());
+ validVersions.append(": "); //$NON-NLS-1$
+ for (Iterator<IRuntimeComponentVersion> iterator = runtimeType.getVersions().iterator(); iterator.hasNext();) {
+ validVersions.append(iterator.next().getVersionString());
+ if (iterator.hasNext()) {
+ validVersions.append(" "); //$NON-NLS-1$
+ }
+ }
+ }
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " defined invalid attribute " + ATTRIBUTE_FACET_RUNTIME_VERSION + ": " + staticVersion //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ + validVersions);
+ }
+ }
+ }
+
+ String facetID = element.getAttribute(ATTRIBUTE_FACET_ID);
+ if (null == facetID || facetID.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_FACET_ID); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+
+ List <String> staticFacetIDs = getStaticTokens(facetID);
+ List <IProjectFacet> staticFacets = new ArrayList <IProjectFacet>();
+ for(String staticFacetID:staticFacetIDs){
+ try {
+ IProjectFacet facet = ProjectFacetsManager.getProjectFacet(staticFacetID);
+ if(null != facet){
+ staticFacets.add(facet);
+ }
+ } catch (IllegalArgumentException e) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " defined invalid attribute " + ATTRIBUTE_FACET_ID + ": " + staticFacetID, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ String facetVersionStr = element.getAttribute(ATTRIBUTE_FACET_VERSION);
+ if (null == facetVersionStr || facetVersionStr.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_FACET_VERSION); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+ List <String>staticFacetVersionStrs = getStaticTokens(facetVersionStr);
+ if(!staticFacets.isEmpty() && !staticFacetVersionStrs.isEmpty()){
+ for(String staticFacetVersion:staticFacetVersionStrs){
+ boolean foundFacetVersion = false;
+ for(int k=0;k< staticFacets.size() && !foundFacetVersion; k++) {
+ IProjectFacet staticFacet = staticFacets.get(k);
+ try {
+ IProjectFacetVersion staticVersion = staticFacet.getVersion(staticFacetVersion);
+ if(staticVersion != null){
+ foundFacetVersion = true;
+ }
+ } catch (IllegalArgumentException e) {
+ //eat it
+ }
+ }
+ if(!foundFacetVersion){
+ StringBuffer validVersions = new StringBuffer(" valid versions include: "); //$NON-NLS-1$
+ for(IProjectFacet staticFacet:staticFacets){
+ validVersions.append("\n"); //$NON-NLS-1$
+ validVersions.append(staticFacet.getId());
+ validVersions.append(": "); //$NON-NLS-1$
+ for (Iterator<IProjectFacetVersion> iterator = staticFacet.getVersions().iterator(); iterator.hasNext();) {
+ validVersions.append(iterator.next().getVersionString());
+ if (iterator.hasNext()) {
+ validVersions.append(" "); //$NON-NLS-1$
+ }
+ }
+ }
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " defined invalid attribute " + ATTRIBUTE_FACET_VERSION + ": " + staticFacetVersion //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ + validVersions);
+ continue;
+ }
+ }
+ }
+ String presetID = element.getAttribute(ATTRIBUTE_PRESET_ID);
+ if (null == presetID || presetID.trim().length() == 0) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " is missing attribute " + ATTRIBUTE_PRESET_ID); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ continue;
+ }
+ try {
+ ProjectFacetsManager.getPreset(presetID);
+ } catch (IllegalArgumentException e) {
+ WSTWebPlugin.logError("Extension: " + EXTENSION_POINT + " Element: " + ELEMENT_MAPPING + " defined invalid attribute " + ATTRIBUTE_PRESET_ID + ": " + presetID, e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ continue;
+ }
+ MappingDescriptor descriptor = new MappingDescriptor(element);
+ descriptors.add(descriptor);
+ } else {
+ WSTWebPlugin.logError("Elements must be named: " + ELEMENT_MAPPING + " within the extension: " + EXTENSION_POINT); //$NON-NLS-1$ //$NON-NLS-2$
+ WSTWebPlugin.logError("Element: " + element.getName() + " is invalid within the extension: " + EXTENSION_POINT); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/IWebProjectPropertiesUpdateDataModelProperties.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/IWebProjectPropertiesUpdateDataModelProperties.java
new file mode 100644
index 0000000..5d7622b
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/IWebProjectPropertiesUpdateDataModelProperties.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.wst.web.internal.operation;
+
+import org.eclipse.wst.common.componentcore.datamodel.properties.IServerContextRootDataModelProperties;
+
+/**
+ * @deprecated Replaced by {@link IServerContextRootDataModelProperties}
+ *
+ */
+public interface IWebProjectPropertiesUpdateDataModelProperties {
+
+ public static final String PROJECT = "IWebProjectPropertiesUpdateDataModelProperties.PROJECT"; //$NON-NLS-1$
+ public static final String CONTEXT_ROOT = "IWebProjectPropertiesUpdateDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateDataModelProvider.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateDataModelProvider.java
new file mode 100644
index 0000000..b602f5a
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateDataModelProvider.java
@@ -0,0 +1,45 @@
+package org.eclipse.wst.web.internal.operation;
+
+/*******************************************************************************
+ * Copyright (c) 2003, 2004, 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
+ *******************************************************************************/
+
+import java.util.Set;
+
+import org.eclipse.wst.common.componentcore.internal.operation.ServerContextRootDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+
+/**
+ * @deprecated Replaced by {@link ServerContextRootDataModelProvider}
+ *
+ */
+public class WebProjectPropertiesUpdateDataModelProvider
+ extends AbstractDataModelProvider
+ implements IWebProjectPropertiesUpdateDataModelProperties{
+
+ public WebProjectPropertiesUpdateDataModelProvider(){
+ super();
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ Set names = super.getPropertyNames();
+ names.add(PROJECT);
+ names.add(CONTEXT_ROOT);
+ return names;
+ }
+
+ @Override
+ public IDataModelOperation getDefaultOperation() {
+ return new WebProjectPropertiesUpdateOperation(model);
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateOperation.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateOperation.java
new file mode 100644
index 0000000..71ab6e9
--- /dev/null
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/operation/WebProjectPropertiesUpdateOperation.java
@@ -0,0 +1,52 @@
+package org.eclipse.wst.web.internal.operation;
+
+/*******************************************************************************
+ * Copyright (c) 2003, 2004, 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
+ *******************************************************************************/
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.common.componentcore.internal.operation.ServerContextRootUpdateOperation;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+
+
+
+/**
+ * @deprecated
+ * Replaced by {@link ServerContextRootUpdateOperation}
+ * @version 1.0
+ * @author
+ */
+public class WebProjectPropertiesUpdateOperation
+ extends AbstractDataModelOperation
+ implements IWebProjectPropertiesUpdateDataModelProperties{
+
+
+ public WebProjectPropertiesUpdateOperation(IDataModel model) {
+ super(model);
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IProject project = (IProject)model.getProperty( IWebProjectPropertiesUpdateDataModelProperties.PROJECT );
+ String contextRoot = model.getStringProperty( IWebProjectPropertiesUpdateDataModelProperties.CONTEXT_ROOT );
+ if (contextRoot != null) {
+ ComponentUtilities.setServerContextRoot(project, contextRoot);
+ }
+ return OK_STATUS;
+ }
+
+}