jdk6/jdk6/langtools: 7e27c39553e1 (original) (raw)
--- a/README Mon Jun 21 11:28:17 2010 -0700 +++ b/README Mon Jun 21 11:43:28 2010 -0700 @@ -15,7 +15,7 @@ System Requirements: Ant: version 1.6.5 or later
- NetBeans: version 6.5 or later (optional) JDK: currently version 1.5.0, although 1.6.0 is recommended OS: any system supporting the above tools
--- a/make/netbeans/README Mon Jun 21 11:28:17 2010 -0700 +++ b/make/netbeans/README Mon Jun 21 11:43:28 2010 -0700 @@ -1,28 +1,39 @@ -Working on the "langtools" workspace using NetBeans. +Using NetBeans to work on the langtools repository. + +Netbeans 6.0 or later is recommended. -This directory (make/netbeans) contains NetBeans projects that -allow you to work on the various tools using the NetBeans IDE. +The "langtools" project in this directory allows you to +edit, run, test and debug the tools in the OpenJDK langtools +repository. -NetBeans 5.0 or later is required and sufficient to use these -projects. This is different from other projects in OpenJDK, -which requires version 6.0 or later. +The repository contains a number of tools:
+ +Build Properties. -The following projects are provided: +To build this repository, you must set some properties for Ant. +You can set these properties in a number of ways: + +- Set the properties in the Properties panel under Tool> Options> Ant.
- Properties set this way will apply globally to all the langtools
- repositories you may be working on. -compiler: for working on the compiler, javac -javadoc: for working on the documentation tool, javadoc -doclets: for working on the standard doclets used by the
-javah: for working on the C header tool, javah -javap: for working on the disassembler, javap -apt: for working on the annotation processing tool, apt.documentation tool, javadoc[](#l2.34)
Note that this is just provided for completeness;[](#l2.38)
the tool has been superceded by new features in javac,[](#l2.39)
and work on apt itself is discouraged.[](#l2.40)
+- Create a file build.properties in the root directory of a
- langtools repository, and set the properties in that file.
- These properties will be specific to that repository. + +To build the repository, at a minimum you must set the "boot.java.home" +property. To run the tools, you must also set "target.java.home". To +run the regression tests, you must set "jtreg.home". -However, any tool can be worked on from any project; the only difference -between these projects is the behavior of the standard NetBeans actions, -so that "Build" in the compiler project will build the compiler, etc. +By default, the build and test targets will build and test all +of these tools. The run and debug targets will prompt you for the +name of a tool to execute. - - +As an alternative, you can focus on a single tool. When you do +this, you will still see all the source code for all the tools, +but the various Ant targets will now be focussed on the selected tool. +To focus on a tool, bring up the context menu on the "langtools" +project (i.e. right-click on the project) and select "Select Tool". +This brings up a dialog which allows you to specify which tool you +wish to work on, and the arguments to use if and when you run it.
--- a/make/netbeans/apt/README Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -"apt" project README. - -This project is for working on the annotation processing tool (apt) -in the OpenJDK langtools component. - -The tool was provided in Java 1.5, but has been superceded by new -features in the compiler (javac) in Java 6. apt itself is now -deprecated, and any further devlopment on it is strongly discouraged. - -The main class for the tool is com.sun.tools.apt.Main. - -NetBeans 5.0 or later is required and sufficient to use this -project, and others in the OpenJDK langtools component. -This is different from other projects in OpenJDK, which -require version 6.0 or later.
--- a/make/netbeans/apt/build.xml Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l4.13)
notice, this list of conditions and the following disclaimer in the[](#l4.16)
documentation and/or other materials provided with the distribution.[](#l4.17)
contributors may be used to endorse or promote products derived[](#l4.20)
from this software without specific prior written permission.[](#l4.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- Build file for the annotation processing tool, apt.
- make/netbeans/common/shared.xml.
- This tool is now deprecated, and any further development is strongly
- discouraged. ---> - -
- [](#l6.56)
- [](#l6.73)
<run/>[](#l6.76)
- [](#l6.79)
<fail unless="run.classname">Must set property 'run.classname'</fail>[](#l6.82)
<run name="${run.classname}" mainclass="${run.classname}" default.args=""/>[](#l6.83)
- [](#l6.86)
<nbbrowse file="${jtreg.report}/report.html"/>[](#l6.89)
<fail>Some tests failed; see report for details.</fail>[](#l6.90)
- [](#l6.93)
<start-debugger/>[](#l6.96)
<run jpda.jvmargs="${jpda.jvmargs}"/>[](#l6.97)
- [](#l6.100)
<fail unless="debug.classname">Must set property 'debug.classname'</fail>[](#l6.103)
<start-debugger/>[](#l6.104)
<run name="${debug.classname}" mainclass="${debug.classname}" default.args=""[](#l6.105)
jpda.jvmargs="${jpda.jvmargs}"/>[](#l6.106)
- [](#l6.109)
<fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>[](#l6.112)
<start-debugger/>[](#l6.113)
<jtreg-tool name="${tool.name}" samevm="false" tests="${jtreg.tests}" [](#l6.114)
jpda.jvmargs="${jpda.jvmargs}"/>[](#l6.115)
- [](#l6.118)
<fail unless="class">Must set property 'class'</fail>[](#l6.121)
<antcall target="compile-single">[](#l6.122)
<param name="includes" value="${class}.java"/>[](#l6.123)
</antcall>[](#l6.124)
<nbjpdareload>[](#l6.125)
<fileset dir="${build.classes.dir}">[](#l6.126)
<include name="${class}.class"/>[](#l6.127)
</fileset>[](#l6.128)
</nbjpdareload>[](#l6.129)
- [](#l6.133)
<nbbrowse file="${build.javadoc.dir}/${tool.name}/index.html"/>[](#l6.136)
- [](#l6.143)
<macrodef name="run">[](#l6.146)
<attribute name="name" default="${tool.name}"/>[](#l6.147)
<attribute name="mainclass" default="${tool.mainclass}"/>[](#l6.148)
<attribute name="default.args" default="${tool.default.args}"/>[](#l6.149)
<attribute name="jpda.jvmargs" default=""/>[](#l6.150)
<sequential>[](#l6.151)
<input addproperty="run.args" message="Run @{name} with options" defaultvalue="@{default.args}"/>[](#l6.152)
<java fork="true" jvm="${target.java}" classname="@{mainclass}">[](#l6.153)
<bootclasspath>[](#l6.154)
<pathelement location="${build.classes.dir}"/>[](#l6.155)
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>[](#l6.156)
</bootclasspath>[](#l6.157)
<jvmarg line="@{jpda.jvmargs}"/> [](#l6.158)
<arg line="${run.args}"/>[](#l6.159)
</java>[](#l6.160)
</sequential>[](#l6.161)
</macrodef>[](#l6.162)
- [](#l6.165)
<macrodef name="start-debugger">[](#l6.168)
<attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>[](#l6.169)
<sequential>[](#l6.170)
<nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">[](#l6.171)
<bootclasspath>[](#l6.172)
<pathelement location="${build.classes.dir}"/>[](#l6.173)
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>[](#l6.174)
</bootclasspath>[](#l6.175)
<sourcepath>[](#l6.176)
<pathelement location="${src.classes.dir}"/>[](#l6.177)
</sourcepath>[](#l6.178)
</nbjpdastart>[](#l6.179)
<property [](#l6.180)
name="@{jpda.jvmargs.property}" [](#l6.181)
value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"[](#l6.182)
/>[](#l6.183)
</sequential>[](#l6.184)
</macrodef>[](#l6.185)
--- a/make/netbeans/common/standard-context-menu-items-no-javadoc.ent Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l7.13)
notice, this list of conditions and the following disclaimer in the[](#l7.16)
documentation and/or other materials provided with the distribution.[](#l7.17)
contributors may be used to endorse or promote products derived[](#l7.20)
from this software without specific prior written permission.[](#l7.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- This file defines the actions that will appear on the project's context
- menu, in the Projects viewer.
- It is normally included as an entity into a project's project.xml file. -
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l7.43)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l7.45)
--- a/make/netbeans/common/standard-context-menu-items.ent Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l8.13)
notice, this list of conditions and the following disclaimer in the[](#l8.16)
documentation and/or other materials provided with the distribution.[](#l8.17)
contributors may be used to endorse or promote products derived[](#l8.20)
from this software without specific prior written permission.[](#l8.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- This file defines the actions that will appear on the project's context
- menu, in the Projects viewer.
- It is normally included as an entity into a project's project.xml file. -
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l8.43)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l8.45)
--- a/make/netbeans/common/standard-ide-actions-no-javadoc.ent Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l9.13)
notice, this list of conditions and the following disclaimer in the[](#l9.16)
documentation and/or other materials provided with the distribution.[](#l9.17)
contributors may be used to endorse or promote products derived[](#l9.20)
from this software without specific prior written permission.[](#l9.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- This file defines the standard actions accepted by langtools projects.
- It is normally included as an entity into a project's project.xml file. -
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l9.42)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l9.44)
- compile-single
- ${root}/src/share/classes
<property>includes</property>[](#l9.64)
<folder>${root}/src/share/classes</folder>[](#l9.65)
<pattern>\.java$</pattern>[](#l9.66)
<format>relative-path</format>[](#l9.67)
<arity>[](#l9.68)
<separated-files>,</separated-files>[](#l9.69)
</arity>[](#l9.70)
- run-single
<property>run.classname</property>[](#l9.81)
<folder>${root}/src/share/classes</folder>[](#l9.82)
<pattern>\.java$</pattern>[](#l9.83)
<format>java-name</format>[](#l9.84)
<arity>[](#l9.85)
<one-file-only/>[](#l9.86)
</arity>[](#l9.87)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( ---> - -
- jtreg
<property>jtreg.tests</property>[](#l9.99)
<folder>${root}/test</folder>[](#l9.100)
<pattern>\.(java|sh)$</pattern>[](#l9.101)
<format>relative-path</format>[](#l9.102)
<arity>[](#l9.103)
<separated-files>,</separated-files>[](#l9.104)
</arity>[](#l9.105)
- debug-single-nb
<property>debug.classname</property>[](#l9.120)
<folder>${root}/src/share/classes</folder>[](#l9.121)
<pattern>\.java$</pattern>[](#l9.122)
<format>java-name</format>[](#l9.123)
<arity>[](#l9.124)
<one-file-only/>[](#l9.125)
</arity>[](#l9.126)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( ---> - -
- debug-jtreg-nb
<property>jtreg.tests</property>[](#l9.138)
<folder>${root}/test</folder>[](#l9.139)
<pattern>\.(java|sh)$</pattern>[](#l9.140)
<format>relative-path</format>[](#l9.141)
<arity>[](#l9.142)
<one-file-only/>[](#l9.143)
</arity>[](#l9.144)
- debug-fix
- ${root}/src/share/classes
<property>class</property>[](#l9.152)
<folder>${root}/src/share/classes</folder>[](#l9.153)
<pattern>\.java$</pattern>[](#l9.154)
<format>relative-path-noext</format>[](#l9.155)
<arity>[](#l9.156)
<one-file-only/>[](#l9.157)
</arity>[](#l9.158)
--- a/make/netbeans/common/standard-ide-actions.ent Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l10.13)
notice, this list of conditions and the following disclaimer in the[](#l10.16)
documentation and/or other materials provided with the distribution.[](#l10.17)
contributors may be used to endorse or promote products derived[](#l10.20)
from this software without specific prior written permission.[](#l10.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- This file defines the standard actions accepted by langtools projects.
- It is normally included as an entity into a project's project.xml file. -
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l10.42)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l10.44)
- compile-single
- ${root}/src/share/classes
<property>includes</property>[](#l10.64)
<folder>${root}/src/share/classes</folder>[](#l10.65)
<pattern>\.java$</pattern>[](#l10.66)
<format>relative-path</format>[](#l10.67)
<arity>[](#l10.68)
<separated-files>,</separated-files>[](#l10.69)
</arity>[](#l10.70)
- run-single
<property>run.classname</property>[](#l10.81)
<folder>${root}/src/share/classes</folder>[](#l10.82)
<pattern>\.java$</pattern>[](#l10.83)
<format>java-name</format>[](#l10.84)
<arity>[](#l10.85)
<one-file-only/>[](#l10.86)
</arity>[](#l10.87)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( ---> - -
- jtreg
<property>jtreg.tests</property>[](#l10.99)
<folder>${root}/test</folder>[](#l10.100)
<pattern>\.(java|sh)$</pattern>[](#l10.101)
<format>relative-path</format>[](#l10.102)
<arity>[](#l10.103)
<separated-files>,</separated-files>[](#l10.104)
</arity>[](#l10.105)
- debug-single-nb
<property>debug.classname</property>[](#l10.120)
<folder>${root}/src/share/classes</folder>[](#l10.121)
<pattern>\.java$</pattern>[](#l10.122)
<format>java-name</format>[](#l10.123)
<arity>[](#l10.124)
<one-file-only/>[](#l10.125)
</arity>[](#l10.126)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( ---> - -
- debug-jtreg-nb
<property>jtreg.tests</property>[](#l10.138)
<folder>${root}/test</folder>[](#l10.139)
<pattern>\.(java|sh)$</pattern>[](#l10.140)
<format>relative-path</format>[](#l10.141)
<arity>[](#l10.142)
<one-file-only/>[](#l10.143)
</arity>[](#l10.144)
- debug-fix
- ${root}/src/share/classes
<property>class</property>[](#l10.152)
<folder>${root}/src/share/classes</folder>[](#l10.153)
<pattern>\.java$</pattern>[](#l10.154)
<format>relative-path-noext</format>[](#l10.155)
<arity>[](#l10.156)
<one-file-only/>[](#l10.157)
</arity>[](#l10.158)
--- a/make/netbeans/compiler/README Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -"compiler" project README. - -This project is for working on the compiler tool (javac) -in the OpenJDK langtools component. - -The main class for the tool is com.sun.tools.javac.Main. - -NetBeans 5.0 or later is required and sufficient to use this -project, and others in the OpenJDK langtools component. -This is different from other projects in OpenJDK, which -require version 6.0 or later.
--- a/make/netbeans/compiler/build.xml Mon Jun 21 11:28:17 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ - -<!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: -
notice, this list of conditions and the following disclaimer.[](#l12.13)
notice, this list of conditions and the following disclaimer in the[](#l12.16)
documentation and/or other materials provided with the distribution.[](#l12.17)
contributors may be used to endorse or promote products derived[](#l12.20)
from this software without specific prior written permission.[](#l12.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> - -<!--
- Build file for the compiler.
- make/netbeans/common/shared.xml.
- [](#l26.73)
<fail unless="includes">Must set property 'includes'</fail>[](#l26.76)
<javac fork="true" executable="${build.bootstrap.dir}/bin/javac"[](#l26.77)
srcdir="${src.classes.dir}"[](#l26.78)
destdir="${build.classes.dir}"[](#l26.79)
includes="${includes}"[](#l26.80)
sourcepath=""[](#l26.81)
includeAntRuntime="no"[](#l26.82)
target="${javac.target}"[](#l26.83)
debug="${javac.debug}" [](#l26.84)
debuglevel="${javac.debuglevel}"/>[](#l26.85)
- [](#l26.99)
<fail unless="run.classname">Must set property 'run.classname' </fail>[](#l26.102)
<echo level="info" message="run ${run.classname}"/>[](#l26.103)
<run mainclass="${run.classname}" args=""/>[](#l26.104)
- [](#l26.139)
<echo level="info" message="Debug <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mi>l</mi><mi>a</mi><mi>n</mi><mi>g</mi><mi>t</mi><mi>o</mi><mi>o</mi><mi>l</mi><mi>s</mi><mi mathvariant="normal">.</mi><mi>t</mi><mi>o</mi><mi>o</mi><mi>l</mi><mi mathvariant="normal">.</mi><mi>n</mi><mi>a</mi><mi>m</mi><mi>e</mi></mrow><mi>w</mi><mi>i</mi><mi>t</mi><mi>h</mi><mi>a</mi><mi>r</mi><mi>g</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">{langtools.tool.name} with args </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">an</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span><span class="mord mathnormal">t</span><span class="mord mathnormal">oo</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">s</span><span class="mord">.</span><span class="mord mathnormal">t</span><span class="mord mathnormal">oo</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord">.</span><span class="mord mathnormal">nam</span><span class="mord mathnormal">e</span></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">ha</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span><span class="mord mathnormal">s</span></span></span></span>{langtools.tool.args}"/>[](#l26.142)
<start-debugger/>[](#l26.143)
<run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>[](#l26.144)
- [](#l26.147)
<fail unless="debug.classname">Must set property 'debug.classname'</fail>[](#l26.149)
<start-debugger/>[](#l26.150)
<run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/>[](#l26.151)
- [](#l26.154)
<fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>[](#l26.156)
<start-debugger/>[](#l26.157)
<jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/>[](#l26.158)
- [](#l26.161)
<fail unless="class">Must set property 'class'[](#l26.164)
</fail>[](#l26.165)
<antcall target="compile-single">[](#l26.166)
<param name="includes" value="${class}.java"/>[](#l26.167)
</antcall>[](#l26.168)
<nbjpdareload>[](#l26.169)
<fileset dir="${build.classes.dir}">[](#l26.170)
<include name="${class}.class"/>[](#l26.171)
</fileset>[](#l26.172)
</nbjpdareload>[](#l26.173)
- [](#l26.208)
<select-tool [](#l26.211)
toolproperty="langtools.tool.name" [](#l26.212)
propertyfile="${langtools.properties}"[](#l26.213)
askIfUnset="false"[](#l26.214)
/>[](#l26.215)
<select-tool [](#l26.219)
toolproperty="langtools.tool.name" [](#l26.220)
argsproperty="langtools.tool.args" [](#l26.221)
propertyfile="${langtools.properties}"[](#l26.222)
askIfUnset="true"[](#l26.223)
/>[](#l26.224)
- [](#l26.227)
<macrodef name="run">[](#l26.229)
<attribute name="mainclass"/>[](#l26.230)
<attribute name="args" default=""/>[](#l26.231)
<attribute name="jpda.jvmargs" default=""/>[](#l26.232)
<sequential>[](#l26.233)
<java fork="true" jvm="${target.java}" classname="@{mainclass}">[](#l26.234)
<jvmarg line="-Xbootclasspath/p:${build.classes.dir}"/>[](#l26.235)
<jvmarg line="@{jpda.jvmargs}"/>[](#l26.236)
<arg line="@{args}"/>[](#l26.237)
</java>[](#l26.238)
</sequential>[](#l26.239)
</macrodef>[](#l26.240)
- [](#l26.243)
<macrodef name="start-debugger">[](#l26.245)
<attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>[](#l26.246)
<sequential>[](#l26.247)
<nbjpdastart name="${ant.project.name}" addressproperty="jpda.address" transport="dt_socket">[](#l26.248)
<bootclasspath>[](#l26.249)
<pathelement location="${build.classes.dir}"/>[](#l26.250)
<pathelement location="${target.java.home}/jre/lib/rt.jar"/>[](#l26.251)
</bootclasspath>[](#l26.252)
<sourcepath>[](#l26.253)
<pathelement location="${src.classes.dir}"/>[](#l26.254)
</sourcepath>[](#l26.255)
</nbjpdastart>[](#l26.256)
<property [](#l26.257)
name="@{jpda.jvmargs.property}" [](#l26.258)
value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"[](#l26.259)
/>[](#l26.260)
</sequential>[](#l26.261)
</macrodef>[](#l26.262)
<mkdir dir="${build.toolclasses.dir}"/>[](#l26.266)
<javac srcdir="${make.tools.dir}/SelectTool"[](#l26.267)
destdir="${build.toolclasses.dir}/"[](#l26.268)
classpath="${ant.home}/lib/ant.jar"[](#l26.269)
debug="${javac.debug}" [](#l26.270)
debuglevel="${javac.debuglevel}">[](#l26.271)
<compilerarg line="-Xlint"/>[](#l26.272)
</javac>[](#l26.273)
<taskdef name="select-tool"[](#l26.274)
classname="SelectToolTask" [](#l26.275)
classpath="${build.toolclasses.dir}/"/>[](#l26.276)
[](#l26.278)
<select-tool propertyfile="${langtools.properties}"/>[](#l26.280)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/netbeans/langtools/nbproject/project.xml Mon Jun 21 11:43:28 2010 -0700 @@ -0,0 +1,108 @@ + +<!--
- Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: +
notice, this list of conditions and the following disclaimer.[](#l27.13)
notice, this list of conditions and the following disclaimer in the[](#l27.16)
documentation and/or other materials provided with the distribution.[](#l27.17)
contributors may be used to endorse or promote products derived[](#l27.20)
from this software without specific prior written permission.[](#l27.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<!DOCTYPE project [
- org.netbeans.modules.ant.freeform
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">[](#l27.43)
<!-- Do not use Project Properties customizer when editing this file manually. -->[](#l27.44)
<name>langtools</name>[](#l27.45)
<properties>[](#l27.46)
<property name="root">../../..</property>[](#l27.47)
</properties>[](#l27.48)
<folders>[](#l27.49)
<source-folder>[](#l27.50)
<label>langtools</label>[](#l27.51)
<location>${root}</location>[](#l27.52)
</source-folder>[](#l27.53)
<source-folder>[](#l27.54)
<label>Source files</label>[](#l27.55)
<type>java</type>[](#l27.56)
<location>${root}/src/share/classes</location>[](#l27.57)
</source-folder>[](#l27.58)
<source-folder>[](#l27.59)
<label>Test files</label>[](#l27.60)
<type>tests</type>[](#l27.61)
<location>${root}/test</location>[](#l27.62)
</source-folder>[](#l27.63)
<source-folder>[](#l27.64)
<label>Build files</label>[](#l27.65)
<type>build</type>[](#l27.66)
<location>${root}/make</location>[](#l27.67)
</source-folder>[](#l27.68)
</folders>[](#l27.69)
<ide-actions>[](#l27.70)
&standard-ide-actions;[](#l27.71)
</ide-actions>[](#l27.72)
<export>[](#l27.73)
<type>folder</type>[](#l27.74)
<location>${root}/build/classes</location>[](#l27.75)
<build-target>build</build-target>[](#l27.76)
</export>[](#l27.77)
<view>[](#l27.78)
<items>[](#l27.79)
<source-folder style="tree">[](#l27.80)
<label>Source files</label>[](#l27.81)
<location>${root}/src/share/classes</location>[](#l27.82)
</source-folder>[](#l27.83)
<source-folder style="tree">[](#l27.84)
<label>Test files</label>[](#l27.85)
<location>${root}/test</location>[](#l27.86)
</source-folder>[](#l27.87)
<source-folder style="tree">[](#l27.88)
<label>Build files</label>[](#l27.89)
<location>${root}/make</location>[](#l27.90)
</source-folder>[](#l27.91)
<source-file>[](#l27.92)
<label>README</label>[](#l27.93)
<location>README</location>[](#l27.94)
</source-file>[](#l27.95)
</items>[](#l27.96)
<context-menu>[](#l27.97)
&standard-context-menu-items;[](#l27.98)
</context-menu>[](#l27.99)
</view>[](#l27.100)
<subprojects/>[](#l27.101)
</general-data>[](#l27.102)
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">[](#l27.103)
<compilation-unit>[](#l27.104)
<package-root>${root}/src/share/classes</package-root>[](#l27.105)
<built-to>${root}/build/classes</built-to>[](#l27.106)
<source-level>1.5</source-level> <!-- FIXME -->[](#l27.107)
</compilation-unit>[](#l27.108)
</java-data>[](#l27.109)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/netbeans/langtools/nbproject/standard-context-menu-items.ent Mon Jun 21 11:43:28 2010 -0700 @@ -0,0 +1,61 @@ + +<!--
- Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: +
notice, this list of conditions and the following disclaimer.[](#l28.13)
notice, this list of conditions and the following disclaimer in the[](#l28.16)
documentation and/or other materials provided with the distribution.[](#l28.17)
contributors may be used to endorse or promote products derived[](#l28.20)
from this software without specific prior written permission.[](#l28.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<!--
- This file defines the actions that will appear on the project's context
- menu, in the Projects viewer.
- It is normally included as an entity into a project's project.xml file. +
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l28.43)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l28.45)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/netbeans/langtools/nbproject/standard-ide-actions.ent Mon Jun 21 11:43:28 2010 -0700 @@ -0,0 +1,173 @@ + +<!--
- Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. +
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met: +
notice, this list of conditions and the following disclaimer.[](#l29.13)
notice, this list of conditions and the following disclaimer in the[](#l29.16)
documentation and/or other materials provided with the distribution.[](#l29.17)
contributors may be used to endorse or promote products derived[](#l29.20)
from this software without specific prior written permission.[](#l29.21)
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--> + +<!--
- This file defines the standard actions accepted by langtools projects.
- It is normally included as an entity into a project's project.xml file. +
- For information on these actions, see
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html[](#l29.42)
at http://www.netbeans.org/kb/41/freeform-config.html [](#l29.44)
- compile-single
- ${root}/src/share/classes
<property>includes</property>[](#l29.64)
<folder>${root}/src/share/classes</folder>[](#l29.65)
<pattern>\.java$</pattern>[](#l29.66)
<format>relative-path</format>[](#l29.67)
<arity>[](#l29.68)
<separated-files>,</separated-files>[](#l29.69)
</arity>[](#l29.70)
- run-single
<property>run.classname</property>[](#l29.81)
<folder>${root}/src/share/classes</folder>[](#l29.82)
<pattern>\.java$</pattern>[](#l29.83)
<format>java-name</format>[](#l29.84)
<arity>[](#l29.85)
<one-file-only/>[](#l29.86)
</arity>[](#l29.87)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( +--> + +
- jtreg
<property>jtreg.tests</property>[](#l29.99)
<folder>${root}/test</folder>[](#l29.100)
<pattern>\.(java|sh)$</pattern>[](#l29.101)
<format>relative-path</format>[](#l29.102)
<arity>[](#l29.103)
<separated-files>,</separated-files>[](#l29.104)
</arity>[](#l29.105)
- debug-single
<property>debug.classname</property>[](#l29.120)
<folder>${root}/src/share/classes</folder>[](#l29.121)
<pattern>\.java$</pattern>[](#l29.122)
<format>java-name</format>[](#l29.123)
<arity>[](#l29.124)
<one-file-only/>[](#l29.125)
</arity>[](#l29.126)
- Note: NetBeans does not appear to support context menu items
- on shell scripts :-( +--> + +
- debug-jtreg
<property>jtreg.tests</property>[](#l29.138)
<folder>${root}/test</folder>[](#l29.139)
<pattern>\.(java|sh)$</pattern>[](#l29.140)
<format>relative-path</format>[](#l29.141)
<arity>[](#l29.142)
<one-file-only/>[](#l29.143)
</arity>[](#l29.144)
- debug-fix
- ${root}/src/share/classes
<property>class</property>[](#l29.152)
<folder>${root}/src/share/classes</folder>[](#l29.153)
<pattern>\.java$</pattern>[](#l29.154)
<format>relative-path-noext</format>[](#l29.155)
<arity>[](#l29.156)
<one-file-only/>[](#l29.157)
</arity>[](#l29.158)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/tools/SelectTool/SelectToolTask.java Mon Jun 21 11:43:28 2010 -0700 @@ -0,0 +1,284 @@ +/*
- *
- *
- *
- *
- CA 95054 USA or visit www.sun.com if you need additional information or
- */ + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import javax.swing.SwingUtilities; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + +/**
- *
- */ +public class SelectToolTask extends Task {
- /**
* Set the location of the private properties file used to keep the retain[](#l30.76)
* user preferences for this repository.[](#l30.77)
*/[](#l30.78)
- public void setPropertyFile(File propertyFile) {
this.propertyFile = propertyFile;[](#l30.80)
- }
- /**
* Set the name of the property which will be set to the name of the[](#l30.84)
* selected tool, if any. If no tool is selected, the property will[](#l30.85)
* remain unset.[](#l30.86)
*/[](#l30.87)
- public void setToolProperty(String toolProperty) {
this.toolProperty = toolProperty;[](#l30.89)
- }
- /**
* Set the name of the property which will be set to the execution args of the[](#l30.93)
* selected tool, if any. The args default to an empty string.[](#l30.94)
*/[](#l30.95)
- public void setArgsProperty(String argsProperty) {
this.argsProperty = argsProperty;[](#l30.97)
- }
- /**
* Specify whether or not to pop up a dialog if the user has not specified[](#l30.101)
* a default value for a property.[](#l30.102)
*/[](#l30.103)
- public void setAskIfUnset(boolean askIfUnset) {
this.askIfUnset = askIfUnset;[](#l30.105)
- }
Properties props = readProperties(propertyFile);[](#l30.112)
toolName = props.getProperty("tool.name");[](#l30.113)
if (toolName != null) {[](#l30.114)
toolArgs = props.getProperty(toolName + ".args", "");[](#l30.115)
}[](#l30.116)
if (toolProperty == null ||[](#l30.118)
askIfUnset && (toolName == null[](#l30.119)
|| (argsProperty != null && toolArgs == null))) {[](#l30.120)
showGUI(props);[](#l30.121)
}[](#l30.122)
// finally, return required values, if any[](#l30.124)
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {[](#l30.125)
p.setProperty(toolProperty, toolName);[](#l30.126)
if (argsProperty != null && toolArgs != null)[](#l30.128)
p.setProperty(argsProperty, toolArgs);[](#l30.129)
}[](#l30.130)
- }
- void showGUI(Properties fileProps) {
Properties guiProps = new Properties(fileProps);[](#l30.134)
JOptionPane p = createPane(guiProps);[](#l30.135)
p.createDialog("Select Tool").setVisible(true);[](#l30.136)
toolName = (String) toolChoice.getSelectedItem();[](#l30.138)
toolArgs = argsField.getText();[](#l30.139)
if (defaultCheck.isSelected()) {[](#l30.141)
if (toolName.equals("")) {[](#l30.142)
fileProps.remove("tool.name");[](#l30.143)
} else {[](#l30.144)
fileProps.put("tool.name", toolName);[](#l30.145)
fileProps.put(toolName + ".args", toolArgs);[](#l30.146)
}[](#l30.147)
writeProperties(propertyFile, fileProps);[](#l30.148)
}[](#l30.149)
- }
- JOptionPane createPane(final Properties props) {
JPanel body = new JPanel(new GridBagLayout());[](#l30.153)
GridBagConstraints lc = new GridBagConstraints();[](#l30.154)
lc.insets.right = 10;[](#l30.155)
lc.insets.bottom = 3;[](#l30.156)
GridBagConstraints fc = new GridBagConstraints();[](#l30.157)
fc.anchor = GridBagConstraints.WEST;[](#l30.158)
fc.gridx = 1;[](#l30.159)
fc.gridwidth = GridBagConstraints.REMAINDER;[](#l30.160)
fc.insets.bottom = 3;[](#l30.161)
JLabel toolLabel = new JLabel("Tool:");[](#l30.163)
body.add(toolLabel, lc);[](#l30.164)
String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };[](#l30.165)
if (true || toolProperty == null) {[](#l30.166)
// include empty value in setup mode[](#l30.167)
List<String> l = new ArrayList<String>(Arrays.asList(toolChoices));[](#l30.168)
l.add(0, "");[](#l30.169)
toolChoices = l.toArray(new String[l.size()]);[](#l30.170)
}[](#l30.171)
toolChoice = new JComboBox(toolChoices);[](#l30.172)
if (toolName != null)[](#l30.173)
toolChoice.setSelectedItem(toolName);[](#l30.174)
toolChoice.addItemListener(new ItemListener() {[](#l30.175)
public void itemStateChanged(ItemEvent e) {[](#l30.176)
String tn = (String) e.getItem();[](#l30.177)
argsField.setText(getDefaultArgsForTool(props, tn));[](#l30.178)
if (toolProperty != null)[](#l30.179)
okButton.setEnabled(!tn.equals(""));[](#l30.180)
}[](#l30.181)
});[](#l30.182)
body.add(toolChoice, fc);[](#l30.183)
argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);[](#l30.185)
if (toolProperty == null || argsProperty != null) {[](#l30.186)
JLabel argsLabel = new JLabel("Args:");[](#l30.187)
body.add(argsLabel, lc);[](#l30.188)
body.add(argsField, fc);[](#l30.189)
argsField.addFocusListener(new FocusListener() {[](#l30.190)
public void focusGained(FocusEvent e) {[](#l30.191)
}[](#l30.192)
public void focusLost(FocusEvent e) {[](#l30.193)
String toolName = (String) toolChoice.getSelectedItem();[](#l30.194)
if (toolName.length() > 0)[](#l30.195)
props.put(toolName + ".args", argsField.getText());[](#l30.196)
}[](#l30.197)
});[](#l30.198)
}[](#l30.199)
defaultCheck = new JCheckBox("Set as default");[](#l30.201)
if (toolProperty == null)[](#l30.202)
defaultCheck.setSelected(true);[](#l30.203)
else[](#l30.204)
body.add(defaultCheck, fc);[](#l30.205)
final JOptionPane p = new JOptionPane(body);[](#l30.207)
okButton = new JButton("OK");[](#l30.208)
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));[](#l30.209)
okButton.addActionListener(new ActionListener() {[](#l30.210)
public void actionPerformed(ActionEvent e) {[](#l30.211)
JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);[](#l30.212)
d.setVisible(false);[](#l30.213)
}[](#l30.214)
});[](#l30.215)
p.setOptions(new Object[] { okButton });[](#l30.216)
- Properties readProperties(File file) {
Properties p = new Properties();[](#l30.222)
if (file != null && file.exists()) {[](#l30.223)
Reader in = null;[](#l30.224)
try {[](#l30.225)
in = new BufferedReader(new FileReader(file));[](#l30.226)
p.load(in);[](#l30.227)
in.close();[](#l30.228)
} catch (IOException e) {[](#l30.229)
throw new BuildException("error reading property file", e);[](#l30.230)
} finally {[](#l30.231)
if (in != null) {[](#l30.232)
try {[](#l30.233)
in.close();[](#l30.234)
} catch (IOException e) {[](#l30.235)
throw new BuildException("cannot close property file", e);[](#l30.236)
}[](#l30.237)
}[](#l30.238)
}[](#l30.239)
}[](#l30.240)
return p;[](#l30.241)
- }
- void writeProperties(File file, Properties p) {
if (file != null) {[](#l30.245)
Writer out = null;[](#l30.246)
try {[](#l30.247)
File dir = file.getParentFile();[](#l30.248)
if (dir != null && !dir.exists())[](#l30.249)
dir.mkdirs();[](#l30.250)
out = new BufferedWriter(new FileWriter(file));[](#l30.251)
p.store(out, "langtools properties");[](#l30.252)
out.close();[](#l30.253)
} catch (IOException e) {[](#l30.254)
throw new BuildException("error writing property file", e);[](#l30.255)
} finally {[](#l30.256)
if (out != null) {[](#l30.257)
try {[](#l30.258)
out.close();[](#l30.259)
} catch (IOException e) {[](#l30.260)
throw new BuildException("cannot close property file", e);[](#l30.261)
}[](#l30.262)
}[](#l30.263)
}[](#l30.264)
}[](#l30.265)
- }
- String getDefaultArgsForTool(Properties props, String tn) {
return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");[](#l30.269)
- }
- // Ant task parameters
- private boolean askIfUnset;
- private String toolProperty;
- private String argsProperty;
- private File propertyFile;