Ability to parse Java source, slightly improving web UI features based on the parser results
1.1 --- a/remoting/server/web/base.web.api/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
1.2 +++ b/remoting/server/web/base.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
1.3 @@ -395,6 +395,11 @@
1.4 </and>
1.5 </condition>
1.6 </target>
1.7 + <target name="-init-test-properties">
1.8 + <property name="test.binaryincludes" value="<nothing>"/>
1.9 + <property name="test.binarytestincludes" value=""/>
1.10 + <property name="test.binaryexcludes" value=""/>
1.11 + </target>
1.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
1.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
1.14 <attribute default="${includes}" name="includes"/>
1.15 @@ -418,7 +423,7 @@
1.16 </sequential>
1.17 </macrodef>
1.18 </target>
1.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
1.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
1.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
1.22 <attribute default="${includes}" name="includes"/>
1.23 <attribute default="${excludes}" name="excludes"/>
1.24 @@ -432,6 +437,9 @@
1.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
1.26 <filename name="@{testincludes}"/>
1.27 </fileset>
1.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
1.29 + <filename name="${test.binarytestincludes}"/>
1.30 + </fileset>
1.31 </batchtest>
1.32 <syspropertyset>
1.33 <propertyref prefix="test-sys-prop."/>
1.34 @@ -454,42 +462,16 @@
1.35 <attribute default="" name="testmethods"/>
1.36 <element name="customize" optional="true"/>
1.37 <sequential>
1.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
1.39 - <path>
1.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
1.41 - </path>
1.42 - <chainedmapper>
1.43 - <globmapper from="*.java" to="*.class"/>
1.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
1.45 - </chainedmapper>
1.46 - </pathconvert>
1.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
1.48 - <path>
1.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
1.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
1.51 - </path>
1.52 - <chainedmapper>
1.53 - <globmapper from="*.java" to="*.class"/>
1.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
1.55 - </chainedmapper>
1.56 - </pathconvert>
1.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
1.58 - <path>
1.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
1.60 - </path>
1.61 - <chainedmapper>
1.62 - <globmapper from="*.java" to="*.class"/>
1.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
1.64 - </chainedmapper>
1.65 - </pathconvert>
1.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
1.67 <isset property="test.method"/>
1.68 </condition>
1.69 + <union id="test.set">
1.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
1.71 + <filename name="@{testincludes}"/>
1.72 + </fileset>
1.73 + </union>
1.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
1.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="base.web.api" testname="TestNG tests" workingDir="${work.dir}">
1.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
1.77 - <filename name="${testng.testincludes}"/>
1.78 - </classfileset>
1.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="base.web.api" testname="TestNG tests" workingDir="${work.dir}">
1.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
1.81 <propertyset>
1.82 <propertyref prefix="test-sys-prop."/>
1.83 @@ -560,39 +542,73 @@
1.84 </sequential>
1.85 </macrodef>
1.86 </target>
1.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
1.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
1.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
1.90 - <attribute default="${main.class}" name="testClass"/>
1.91 - <attribute default="" name="testMethod"/>
1.92 - <element name="customize2" optional="true"/>
1.93 + <attribute default="${includes}" name="includes"/>
1.94 + <attribute default="${excludes}" name="excludes"/>
1.95 + <attribute default="**" name="testincludes"/>
1.96 + <attribute default="" name="testmethods"/>
1.97 + <element name="customize" optional="true"/>
1.98 <sequential>
1.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
1.100 - <delete file="${test.report.file}"/>
1.101 - <mkdir dir="${build.test.results.dir}"/>
1.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
1.103 - <isset property="test.method"/>
1.104 - </condition>
1.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
1.106 - <customize>
1.107 - <arg value="@{testClass}"/>
1.108 - <arg value="${junit.methods.arg}"/>
1.109 - <arg value="showoutput=true"/>
1.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
1.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
1.112 - <customize2/>
1.113 - </customize>
1.114 - </j2seproject3:debug>
1.115 + <property name="junit.forkmode" value="perTest"/>
1.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
1.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
1.118 + <syspropertyset>
1.119 + <propertyref prefix="test-sys-prop."/>
1.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
1.121 + </syspropertyset>
1.122 + <formatter type="brief" usefile="false"/>
1.123 + <formatter type="xml"/>
1.124 + <jvmarg value="-ea"/>
1.125 + <jvmarg line="${debug-args-line}"/>
1.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
1.127 + <customize/>
1.128 + </junit>
1.129 </sequential>
1.130 </macrodef>
1.131 </target>
1.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
1.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
1.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
1.135 + <attribute default="${includes}" name="includes"/>
1.136 + <attribute default="${excludes}" name="excludes"/>
1.137 + <attribute default="**" name="testincludes"/>
1.138 + <attribute default="" name="testmethods"/>
1.139 + <element name="customize" optional="true"/>
1.140 + <sequential>
1.141 + <property name="junit.forkmode" value="perTest"/>
1.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
1.143 + <batchtest todir="${build.test.results.dir}">
1.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
1.145 + <filename name="@{testincludes}"/>
1.146 + </fileset>
1.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
1.148 + <filename name="${test.binarytestincludes}"/>
1.149 + </fileset>
1.150 + </batchtest>
1.151 + <syspropertyset>
1.152 + <propertyref prefix="test-sys-prop."/>
1.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
1.154 + </syspropertyset>
1.155 + <formatter type="brief" usefile="false"/>
1.156 + <formatter type="xml"/>
1.157 + <jvmarg value="-ea"/>
1.158 + <jvmarg line="${debug-args-line}"/>
1.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
1.160 + <customize/>
1.161 + </junit>
1.162 + </sequential>
1.163 + </macrodef>
1.164 + </target>
1.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
1.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
1.167 - <attribute default="${main.class}" name="testClass"/>
1.168 - <attribute default="" name="testMethod"/>
1.169 - <element implicit="true" name="customize2" optional="true"/>
1.170 + <attribute default="${includes}" name="includes"/>
1.171 + <attribute default="${excludes}" name="excludes"/>
1.172 + <attribute default="**" name="testincludes"/>
1.173 + <attribute default="" name="testmethods"/>
1.174 + <element implicit="true" name="customize" optional="true"/>
1.175 <sequential>
1.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
1.177 - <customize2/>
1.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
1.179 + <customize/>
1.180 </j2seproject3:junit-debug>
1.181 </sequential>
1.182 </macrodef>
1.183 @@ -625,7 +641,7 @@
1.184 </macrodef>
1.185 </target>
1.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
1.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
1.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
1.189 <attribute default="${main.class}" name="testClass"/>
1.190 <attribute default="" name="testMethod"/>
1.191 <element implicit="true" name="customize2" optional="true"/>
1.192 @@ -636,32 +652,62 @@
1.193 </sequential>
1.194 </macrodef>
1.195 </target>
1.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
1.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
1.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
1.199 + <attribute default="${includes}" name="includes"/>
1.200 + <attribute default="${excludes}" name="excludes"/>
1.201 + <attribute default="**" name="testincludes"/>
1.202 + <attribute default="" name="testmethods"/>
1.203 <attribute default="${main.class}" name="testClass"/>
1.204 <attribute default="" name="testMethod"/>
1.205 <sequential>
1.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
1.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
1.208 + <customize>
1.209 + <classpath>
1.210 + <path path="${run.test.classpath}"/>
1.211 + </classpath>
1.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
1.213 + <jvmarg line="${run.jvmargs}"/>
1.214 + <jvmarg line="${run.jvmargs.ide}"/>
1.215 + </customize>
1.216 + </j2seproject3:test-debug-impl>
1.217 + </sequential>
1.218 + </macrodef>
1.219 + </target>
1.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
1.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
1.222 + <attribute default="${includes}" name="includes"/>
1.223 + <attribute default="${excludes}" name="excludes"/>
1.224 + <attribute default="**" name="testincludes"/>
1.225 + <attribute default="" name="testmethods"/>
1.226 + <attribute default="${main.class}" name="testClass"/>
1.227 + <attribute default="" name="testMethod"/>
1.228 + <sequential>
1.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
1.230 <customize2>
1.231 <syspropertyset>
1.232 <propertyref prefix="test-sys-prop."/>
1.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
1.234 </syspropertyset>
1.235 </customize2>
1.236 - </j2seproject3:test-debug-impl>
1.237 + </j2seproject3:testng-debug-impl>
1.238 </sequential>
1.239 </macrodef>
1.240 </target>
1.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
1.242 - <target name="-profile-pre-init">
1.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
1.244 + <!--
1.245 + pre NB7.2 profiling section; consider it deprecated
1.246 + -->
1.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
1.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
1.249 <!-- Empty placeholder for easier customization. -->
1.250 <!-- You can override this target in the ../build.xml file. -->
1.251 </target>
1.252 - <target name="-profile-post-init">
1.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
1.254 <!-- Empty placeholder for easier customization. -->
1.255 <!-- You can override this target in the ../build.xml file. -->
1.256 </target>
1.257 - <target name="-profile-init-macrodef-profile">
1.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
1.259 <macrodef name="resolve">
1.260 <attribute name="name"/>
1.261 <attribute name="value"/>
1.262 @@ -693,10 +739,13 @@
1.263 </sequential>
1.264 </macrodef>
1.265 </target>
1.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
1.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
1.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
1.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
1.270 </target>
1.271 + <!--
1.272 + end of pre NB7.2 profiling section
1.273 + -->
1.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
1.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
1.276 <attribute default="${main.class}" name="name"/>
1.277 @@ -771,6 +820,7 @@
1.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
1.279 <attribute default="${main.class}" name="classname"/>
1.280 <attribute default="${run.classpath}" name="classpath"/>
1.281 + <attribute default="jvm" name="jvm"/>
1.282 <element name="customize" optional="true"/>
1.283 <sequential>
1.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
1.285 @@ -805,6 +855,9 @@
1.286 <path path="${run.classpath.without.build.classes.dir}"/>
1.287 <chainedmapper>
1.288 <flattenmapper/>
1.289 + <filtermapper>
1.290 + <replacestring from=" " to="%20"/>
1.291 + </filtermapper>
1.292 <globmapper from="*" to="lib/*"/>
1.293 </chainedmapper>
1.294 </pathconvert>
1.295 @@ -903,7 +956,7 @@
1.296 <target if="has.persistence.xml" name="-copy-persistence-xml">
1.297 <mkdir dir="${build.classes.dir}/META-INF"/>
1.298 <copy todir="${build.classes.dir}/META-INF">
1.299 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
1.300 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
1.301 </copy>
1.302 </target>
1.303 <target name="-post-compile">
1.304 @@ -1066,7 +1119,11 @@
1.305 PROFILING SECTION
1.306 =================
1.307 -->
1.308 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
1.309 + <!--
1.310 + pre NB7.2 profiler integration
1.311 + -->
1.312 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
1.313 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1.314 <nbprofiledirect>
1.315 <classpath>
1.316 <path path="${run.classpath}"/>
1.317 @@ -1074,8 +1131,9 @@
1.318 </nbprofiledirect>
1.319 <profile/>
1.320 </target>
1.321 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
1.322 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
1.323 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
1.324 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1.325 <nbprofiledirect>
1.326 <classpath>
1.327 <path path="${run.classpath}"/>
1.328 @@ -1083,12 +1141,8 @@
1.329 </nbprofiledirect>
1.330 <profile classname="${profile.class}"/>
1.331 </target>
1.332 - <!--
1.333 - =========================
1.334 - APPLET PROFILING SECTION
1.335 - =========================
1.336 - -->
1.337 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
1.338 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
1.339 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1.340 <nbprofiledirect>
1.341 <classpath>
1.342 <path path="${run.classpath}"/>
1.343 @@ -1100,12 +1154,8 @@
1.344 </customize>
1.345 </profile>
1.346 </target>
1.347 - <!--
1.348 - =========================
1.349 - TESTS PROFILING SECTION
1.350 - =========================
1.351 - -->
1.352 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
1.353 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
1.354 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
1.355 <nbprofiledirect>
1.356 <classpath>
1.357 <path path="${run.test.classpath}"/>
1.358 @@ -1128,6 +1178,42 @@
1.359 </junit>
1.360 </target>
1.361 <!--
1.362 + end of pre NB72 profiling section
1.363 + -->
1.364 + <target if="netbeans.home" name="-profile-check">
1.365 + <condition property="profiler.configured">
1.366 + <or>
1.367 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
1.368 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
1.369 + </or>
1.370 + </condition>
1.371 + </target>
1.372 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
1.373 + <startprofiler/>
1.374 + <antcall target="run"/>
1.375 + </target>
1.376 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
1.377 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1.378 + <startprofiler/>
1.379 + <antcall target="run-single"/>
1.380 + </target>
1.381 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
1.382 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
1.383 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1.384 + <startprofiler/>
1.385 + <antcall target="test-single"/>
1.386 + </target>
1.387 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
1.388 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
1.389 + <startprofiler/>
1.390 + <antcal target="run-test-with-main"/>
1.391 + </target>
1.392 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
1.393 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
1.394 + <startprofiler/>
1.395 + <antcall target="run-applet"/>
1.396 + </target>
1.397 + <!--
1.398 ===============
1.399 JAVADOC SECTION
1.400 ===============
1.401 @@ -1253,13 +1339,14 @@
1.402 TEST DEBUGGING SECTION
1.403 =======================
1.404 -->
1.405 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
1.406 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
1.407 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1.408 - <j2seproject3:test-debug testClass="${test.class}"/>
1.409 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
1.410 </target>
1.411 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
1.412 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
1.413 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1.414 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
1.415 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
1.416 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
1.417 </target>
1.418 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
1.419 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
2.1 --- a/remoting/server/web/base.web.api/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
2.2 +++ b/remoting/server/web/base.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
2.3 @@ -4,5 +4,5 @@
2.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
2.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
2.6 nbproject/build-impl.xml.data.CRC32=8d18f2d6
2.7 -nbproject/build-impl.xml.script.CRC32=fc259fbe
2.8 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
2.9 +nbproject/build-impl.xml.script.CRC32=5f2c273b
2.10 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.54.0.46
3.1 --- a/remoting/server/web/base.web.api/nbproject/project.properties Fri Nov 30 07:36:26 2012 +0100
3.2 +++ b/remoting/server/web/base.web.api/nbproject/project.properties Fri Nov 30 18:49:18 2012 +0100
3.3 @@ -27,8 +27,6 @@
3.4 dist.javadoc.dir=${dist.dir}/javadoc
3.5 endorsed.classpath=
3.6 excludes=
3.7 -file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
3.8 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
3.9 file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
3.10 file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
3.11 file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
3.12 @@ -39,8 +37,6 @@
3.13 javac.classpath=\
3.14 ${libs.freemarker.classpath}:\
3.15 ${libs.jersey.classpath}:\
3.16 - ${file.reference.org-netbeans-modules-java-source.jar}:\
3.17 - ${file.reference.org-netbeans-modules-parsing-api.jar}:\
3.18 ${file.reference.org-openide-filesystems.jar}:\
3.19 ${file.reference.org-openide-util-lookup.jar}:\
3.20 ${file.reference.util-commons.jar}:\
4.1 --- a/remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/CategoryStorage.java Fri Nov 30 07:36:26 2012 +0100
4.2 +++ b/remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/CategoryStorage.java Fri Nov 30 18:49:18 2012 +0100
4.3 @@ -67,7 +67,9 @@
4.4 import org.netbeans.modules.parsing.lucene.support.Index;
4.5 import org.netbeans.modules.parsing.lucene.support.IndexManager;
4.6 import org.openide.filesystems.FileObject;
4.7 +import org.openide.filesystems.FileSystem;
4.8 import org.openide.filesystems.FileUtil;
4.9 +import org.openide.filesystems.JarFileSystem;
4.10
4.11 /**
4.12 *
4.13 @@ -139,17 +141,20 @@
4.14 this.displayName = displayName;
4.15 }
4.16
4.17 - private Iterable<? extends URL> getCategoryIndexFolders() {
4.18 + private Iterable<? extends SourceRoot> sourceRoots;
4.19 +
4.20 + public synchronized Iterable<? extends SourceRoot> getSourceRoots() {
4.21 + if (sourceRoots != null) return sourceRoots;
4.22 +
4.23 + List<SourceRoot> result = new ArrayList<SourceRoot>();
4.24 +
4.25 try {
4.26 - Set<URL> result = new HashSet<URL>();
4.27 Map<String, String> invertedSegments = getInvertedSegments();
4.28
4.29 - for (String c : invertedSegments.keySet()) {
4.30 - if (!c.startsWith("rel:")) continue;
4.31 - result.add(new URL(c));
4.32 + for (Entry<String, String> e : invertedSegments.entrySet()) {
4.33 + if (!e.getKey().startsWith("rel:")) continue;
4.34 + result.add(new SourceRoot(this, new URL(e.getKey()).getPath().substring(1), e.getValue()));
4.35 }
4.36 -
4.37 - return result;
4.38 } catch (IllegalArgumentException ex) {
4.39 Logger.getLogger(CategoryStorage.class.getName()).log(Level.SEVERE, null, ex);
4.40 } catch (SecurityException ex) {
4.41 @@ -157,18 +162,28 @@
4.42 } catch (IOException ex) {
4.43 Logger.getLogger(CategoryStorage.class.getName()).log(Level.SEVERE, null, ex);
4.44 }
4.45 - return Collections.emptyList();
4.46 +
4.47 + return result;
4.48 }
4.49
4.50 - public Iterable<? extends String> getSourceRoots() {
4.51 - List<String> result = new ArrayList<String>();
4.52 + private final Map<String, Reference<FileSystem>> embeddedJar2FileSystem = new HashMap<String, Reference<FileSystem>>();
4.53
4.54 - for (URL srcRoot : getCategoryIndexFolders()) {
4.55 - if (!"rel".equals(srcRoot.getProtocol())) continue;
4.56 - result.add(srcRoot.getPath().substring(1));
4.57 + public synchronized FileObject getEmbeddedJarRoot(String jarName) throws IOException {
4.58 + Reference<FileSystem> fsRef = embeddedJar2FileSystem.get(jarName);
4.59 + FileSystem fs = fsRef != null ? fsRef.get() : null;
4.60 +
4.61 + if (fs == null) {
4.62 + File f = new File(FileUtil.toFile(getCacheRoot()), jarName);
4.63 +
4.64 + if (!f.canRead()) {
4.65 + return null;//XXX: should not happen, but does?
4.66 +// throw new IllegalStateException(jarName);
4.67 + }
4.68 +
4.69 + embeddedJar2FileSystem.put(jarName, new SoftReference<FileSystem>(fs = new JarFileSystem(f)));
4.70 }
4.71
4.72 - return result;
4.73 + return fs.getRoot();
4.74 }
4.75
4.76 public String getId() {
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/SourceRoot.java Fri Nov 30 18:49:18 2012 +0100
5.3 @@ -0,0 +1,151 @@
5.4 +/*
5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 + *
5.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5.8 + *
5.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5.10 + * Other names may be trademarks of their respective owners.
5.11 + *
5.12 + * The contents of this file are subject to the terms of either the GNU
5.13 + * General Public License Version 2 only ("GPL") or the Common
5.14 + * Development and Distribution License("CDDL") (collectively, the
5.15 + * "License"). You may not use this file except in compliance with the
5.16 + * License. You can obtain a copy of the License at
5.17 + * http://www.netbeans.org/cddl-gplv2.html
5.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.19 + * specific language governing permissions and limitations under the
5.20 + * License. When distributing the software, include this License Header
5.21 + * Notice in each file and include the License file at
5.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
5.23 + * particular file as subject to the "Classpath" exception as provided
5.24 + * by Oracle in the GPL Version 2 section of the License file that
5.25 + * accompanied this code. If applicable, add the following below the
5.26 + * License Header, with the fields enclosed by brackets [] replaced by
5.27 + * your own identifying information:
5.28 + * "Portions Copyrighted [year] [name of copyright owner]"
5.29 + *
5.30 + * If you wish your version of this file to be governed by only the CDDL
5.31 + * or only the GPL Version 2, indicate your decision by adding
5.32 + * "[Contributor] elects to include this software in this distribution
5.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.34 + * single choice of license, a recipient has the option to distribute
5.35 + * your version of this file under either the CDDL, the GPL Version 2 or
5.36 + * to extend the choice of license to its licensees as provided above.
5.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
5.38 + * Version 2 license, then the option applies only if the new code is
5.39 + * made subject to such option by the copyright holder.
5.40 + *
5.41 + * Contributor(s):
5.42 + *
5.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
5.44 + */
5.45 +package org.netbeans.modules.jackpot30.backend.base;
5.46 +
5.47 +import java.io.File;
5.48 +import java.io.IOException;
5.49 +import java.io.InputStream;
5.50 +import java.util.ArrayList;
5.51 +import java.util.Collection;
5.52 +import java.util.Properties;
5.53 +import java.util.logging.Level;
5.54 +import java.util.logging.Logger;
5.55 +import org.openide.filesystems.FileObject;
5.56 +import org.openide.filesystems.JarFileSystem;
5.57 +
5.58 +/**
5.59 + *
5.60 + * @author lahvac
5.61 + */
5.62 +public class SourceRoot {
5.63 +
5.64 + private static final Logger LOG = Logger.getLogger(SourceRoot.class.getName());
5.65 + private final CategoryStorage category;
5.66 + private final String relativePath;
5.67 + private final String code;
5.68 +
5.69 + SourceRoot(CategoryStorage category, String relativePath, String code) {
5.70 + this.category = category;
5.71 + this.relativePath = relativePath;
5.72 + this.code = code;
5.73 + }
5.74 +
5.75 + public CategoryStorage getCategory() {
5.76 + return category;
5.77 + }
5.78 +
5.79 + public String getRelativePath() {
5.80 + return relativePath;
5.81 + }
5.82 +
5.83 + private Collection<FileObject> classPath; //XXX: soft reference?
5.84 +
5.85 + public synchronized Collection<FileObject> getClassPath() {
5.86 + if (classPath == null) {
5.87 + classPath = computeClassPath();
5.88 + }
5.89 +
5.90 + return classPath;
5.91 + }
5.92 +
5.93 + public String getCode() {
5.94 + return code;
5.95 + }
5.96 +
5.97 + public String getClassPathString() {
5.98 + try {
5.99 + InputStream in = category.getCacheRoot().getFileObject("classpath").getInputStream();
5.100 + Properties props = new Properties();
5.101 +
5.102 + try {
5.103 + props.load(in);
5.104 + } finally {
5.105 + in.close();
5.106 + }
5.107 +
5.108 + return props.getProperty(code);
5.109 + } catch (IOException ex) {
5.110 + Logger.getLogger(SourceRoot.class.getName()).log(Level.SEVERE, null, ex);
5.111 + return null;
5.112 + }
5.113 + }
5.114 +
5.115 + private Collection<FileObject> computeClassPath() {
5.116 + Collection<FileObject> result = new ArrayList<FileObject>();
5.117 +
5.118 + try {
5.119 + final String bootPath = System.getProperty("sun.boot.class.path");
5.120 +
5.121 + for (String bp : bootPath.split(":")) {
5.122 + File f = new File(bp);
5.123 +
5.124 + if (!f.canRead()) continue;
5.125 +
5.126 + FileObject root = new JarFileSystem(f).getRoot();
5.127 +
5.128 + result.add(root);
5.129 + }
5.130 +
5.131 + String classpath = getClassPathString();
5.132 +
5.133 + if (classpath != null) {
5.134 + for (String entry : classpath.split(":")) {
5.135 + FileObject root = category.getEmbeddedJarRoot(entry);
5.136 +
5.137 + if (!entry.endsWith(".jar")) {
5.138 + root = root.getFileObject("java/14/classes");
5.139 + }
5.140 +
5.141 + if (root != null) {
5.142 + result.add(root);
5.143 + } else {
5.144 + LOG.log(Level.FINE, "Cannot find {0}", entry);
5.145 + }
5.146 + }
5.147 + }
5.148 + } catch (IOException ex) {
5.149 + ex.printStackTrace();//XXX
5.150 + }
5.151 +
5.152 + return result;
5.153 + }
5.154 +}
6.1 --- a/remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/Utilities.java Fri Nov 30 07:36:26 2012 +0100
6.2 +++ b/remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/Utilities.java Fri Nov 30 18:49:18 2012 +0100
6.3 @@ -57,12 +57,12 @@
6.4 Map<String, List<T>> result = new LinkedHashMap<String, List<T>>();
6.5
6.6 for (Entry<String, T> e : found) {
6.7 - for (String rel : category.getSourceRoots()) {
6.8 - if (e.getKey().startsWith(rel)) {
6.9 - List<T> current = result.get(rel);
6.10 + for (SourceRoot sourceRoot : category.getSourceRoots()) {
6.11 + if (e.getKey().startsWith(sourceRoot.getRelativePath())) {
6.12 + List<T> current = result.get(sourceRoot.getRelativePath());
6.13
6.14 if (current == null) {
6.15 - result.put(rel, current = new ArrayList<T>());
6.16 + result.put(sourceRoot.getRelativePath(), current = new ArrayList<T>());
6.17 }
6.18
6.19 current.add(e.getValue());
7.1 --- a/remoting/server/web/nbindex.web.api/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
7.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
7.3 @@ -395,6 +395,11 @@
7.4 </and>
7.5 </condition>
7.6 </target>
7.7 + <target name="-init-test-properties">
7.8 + <property name="test.binaryincludes" value="<nothing>"/>
7.9 + <property name="test.binarytestincludes" value=""/>
7.10 + <property name="test.binaryexcludes" value=""/>
7.11 + </target>
7.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
7.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
7.14 <attribute default="${includes}" name="includes"/>
7.15 @@ -418,7 +423,7 @@
7.16 </sequential>
7.17 </macrodef>
7.18 </target>
7.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
7.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
7.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
7.22 <attribute default="${includes}" name="includes"/>
7.23 <attribute default="${excludes}" name="excludes"/>
7.24 @@ -432,6 +437,9 @@
7.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.26 <filename name="@{testincludes}"/>
7.27 </fileset>
7.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
7.29 + <filename name="${test.binarytestincludes}"/>
7.30 + </fileset>
7.31 </batchtest>
7.32 <syspropertyset>
7.33 <propertyref prefix="test-sys-prop."/>
7.34 @@ -454,42 +462,16 @@
7.35 <attribute default="" name="testmethods"/>
7.36 <element name="customize" optional="true"/>
7.37 <sequential>
7.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
7.39 - <path>
7.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
7.41 - </path>
7.42 - <chainedmapper>
7.43 - <globmapper from="*.java" to="*.class"/>
7.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
7.45 - </chainedmapper>
7.46 - </pathconvert>
7.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
7.48 - <path>
7.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
7.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
7.51 - </path>
7.52 - <chainedmapper>
7.53 - <globmapper from="*.java" to="*.class"/>
7.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
7.55 - </chainedmapper>
7.56 - </pathconvert>
7.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
7.58 - <path>
7.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
7.60 - </path>
7.61 - <chainedmapper>
7.62 - <globmapper from="*.java" to="*.class"/>
7.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
7.64 - </chainedmapper>
7.65 - </pathconvert>
7.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
7.67 <isset property="test.method"/>
7.68 </condition>
7.69 + <union id="test.set">
7.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
7.71 + <filename name="@{testincludes}"/>
7.72 + </fileset>
7.73 + </union>
7.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
7.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="nbindex.web.api" testname="TestNG tests" workingDir="${work.dir}">
7.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
7.77 - <filename name="${testng.testincludes}"/>
7.78 - </classfileset>
7.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="nbindex.web.api" testname="TestNG tests" workingDir="${work.dir}">
7.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
7.81 <propertyset>
7.82 <propertyref prefix="test-sys-prop."/>
7.83 @@ -560,39 +542,73 @@
7.84 </sequential>
7.85 </macrodef>
7.86 </target>
7.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
7.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
7.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
7.90 - <attribute default="${main.class}" name="testClass"/>
7.91 - <attribute default="" name="testMethod"/>
7.92 - <element name="customize2" optional="true"/>
7.93 + <attribute default="${includes}" name="includes"/>
7.94 + <attribute default="${excludes}" name="excludes"/>
7.95 + <attribute default="**" name="testincludes"/>
7.96 + <attribute default="" name="testmethods"/>
7.97 + <element name="customize" optional="true"/>
7.98 <sequential>
7.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
7.100 - <delete file="${test.report.file}"/>
7.101 - <mkdir dir="${build.test.results.dir}"/>
7.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
7.103 - <isset property="test.method"/>
7.104 - </condition>
7.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
7.106 - <customize>
7.107 - <arg value="@{testClass}"/>
7.108 - <arg value="${junit.methods.arg}"/>
7.109 - <arg value="showoutput=true"/>
7.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
7.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
7.112 - <customize2/>
7.113 - </customize>
7.114 - </j2seproject3:debug>
7.115 + <property name="junit.forkmode" value="perTest"/>
7.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
7.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
7.118 + <syspropertyset>
7.119 + <propertyref prefix="test-sys-prop."/>
7.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.121 + </syspropertyset>
7.122 + <formatter type="brief" usefile="false"/>
7.123 + <formatter type="xml"/>
7.124 + <jvmarg value="-ea"/>
7.125 + <jvmarg line="${debug-args-line}"/>
7.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
7.127 + <customize/>
7.128 + </junit>
7.129 </sequential>
7.130 </macrodef>
7.131 </target>
7.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
7.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
7.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
7.135 + <attribute default="${includes}" name="includes"/>
7.136 + <attribute default="${excludes}" name="excludes"/>
7.137 + <attribute default="**" name="testincludes"/>
7.138 + <attribute default="" name="testmethods"/>
7.139 + <element name="customize" optional="true"/>
7.140 + <sequential>
7.141 + <property name="junit.forkmode" value="perTest"/>
7.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
7.143 + <batchtest todir="${build.test.results.dir}">
7.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
7.145 + <filename name="@{testincludes}"/>
7.146 + </fileset>
7.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
7.148 + <filename name="${test.binarytestincludes}"/>
7.149 + </fileset>
7.150 + </batchtest>
7.151 + <syspropertyset>
7.152 + <propertyref prefix="test-sys-prop."/>
7.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.154 + </syspropertyset>
7.155 + <formatter type="brief" usefile="false"/>
7.156 + <formatter type="xml"/>
7.157 + <jvmarg value="-ea"/>
7.158 + <jvmarg line="${debug-args-line}"/>
7.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
7.160 + <customize/>
7.161 + </junit>
7.162 + </sequential>
7.163 + </macrodef>
7.164 + </target>
7.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
7.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
7.167 - <attribute default="${main.class}" name="testClass"/>
7.168 - <attribute default="" name="testMethod"/>
7.169 - <element implicit="true" name="customize2" optional="true"/>
7.170 + <attribute default="${includes}" name="includes"/>
7.171 + <attribute default="${excludes}" name="excludes"/>
7.172 + <attribute default="**" name="testincludes"/>
7.173 + <attribute default="" name="testmethods"/>
7.174 + <element implicit="true" name="customize" optional="true"/>
7.175 <sequential>
7.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
7.177 - <customize2/>
7.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
7.179 + <customize/>
7.180 </j2seproject3:junit-debug>
7.181 </sequential>
7.182 </macrodef>
7.183 @@ -625,7 +641,7 @@
7.184 </macrodef>
7.185 </target>
7.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
7.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
7.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
7.189 <attribute default="${main.class}" name="testClass"/>
7.190 <attribute default="" name="testMethod"/>
7.191 <element implicit="true" name="customize2" optional="true"/>
7.192 @@ -636,32 +652,62 @@
7.193 </sequential>
7.194 </macrodef>
7.195 </target>
7.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
7.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
7.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
7.199 + <attribute default="${includes}" name="includes"/>
7.200 + <attribute default="${excludes}" name="excludes"/>
7.201 + <attribute default="**" name="testincludes"/>
7.202 + <attribute default="" name="testmethods"/>
7.203 <attribute default="${main.class}" name="testClass"/>
7.204 <attribute default="" name="testMethod"/>
7.205 <sequential>
7.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
7.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
7.208 + <customize>
7.209 + <classpath>
7.210 + <path path="${run.test.classpath}"/>
7.211 + </classpath>
7.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
7.213 + <jvmarg line="${run.jvmargs}"/>
7.214 + <jvmarg line="${run.jvmargs.ide}"/>
7.215 + </customize>
7.216 + </j2seproject3:test-debug-impl>
7.217 + </sequential>
7.218 + </macrodef>
7.219 + </target>
7.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
7.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
7.222 + <attribute default="${includes}" name="includes"/>
7.223 + <attribute default="${excludes}" name="excludes"/>
7.224 + <attribute default="**" name="testincludes"/>
7.225 + <attribute default="" name="testmethods"/>
7.226 + <attribute default="${main.class}" name="testClass"/>
7.227 + <attribute default="" name="testMethod"/>
7.228 + <sequential>
7.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
7.230 <customize2>
7.231 <syspropertyset>
7.232 <propertyref prefix="test-sys-prop."/>
7.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
7.234 </syspropertyset>
7.235 </customize2>
7.236 - </j2seproject3:test-debug-impl>
7.237 + </j2seproject3:testng-debug-impl>
7.238 </sequential>
7.239 </macrodef>
7.240 </target>
7.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
7.242 - <target name="-profile-pre-init">
7.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
7.244 + <!--
7.245 + pre NB7.2 profiling section; consider it deprecated
7.246 + -->
7.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
7.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
7.249 <!-- Empty placeholder for easier customization. -->
7.250 <!-- You can override this target in the ../build.xml file. -->
7.251 </target>
7.252 - <target name="-profile-post-init">
7.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
7.254 <!-- Empty placeholder for easier customization. -->
7.255 <!-- You can override this target in the ../build.xml file. -->
7.256 </target>
7.257 - <target name="-profile-init-macrodef-profile">
7.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
7.259 <macrodef name="resolve">
7.260 <attribute name="name"/>
7.261 <attribute name="value"/>
7.262 @@ -693,10 +739,13 @@
7.263 </sequential>
7.264 </macrodef>
7.265 </target>
7.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
7.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
7.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
7.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
7.270 </target>
7.271 + <!--
7.272 + end of pre NB7.2 profiling section
7.273 + -->
7.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
7.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
7.276 <attribute default="${main.class}" name="name"/>
7.277 @@ -771,6 +820,7 @@
7.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
7.279 <attribute default="${main.class}" name="classname"/>
7.280 <attribute default="${run.classpath}" name="classpath"/>
7.281 + <attribute default="jvm" name="jvm"/>
7.282 <element name="customize" optional="true"/>
7.283 <sequential>
7.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
7.285 @@ -805,6 +855,9 @@
7.286 <path path="${run.classpath.without.build.classes.dir}"/>
7.287 <chainedmapper>
7.288 <flattenmapper/>
7.289 + <filtermapper>
7.290 + <replacestring from=" " to="%20"/>
7.291 + </filtermapper>
7.292 <globmapper from="*" to="lib/*"/>
7.293 </chainedmapper>
7.294 </pathconvert>
7.295 @@ -910,7 +963,7 @@
7.296 <target if="has.persistence.xml" name="-copy-persistence-xml">
7.297 <mkdir dir="${build.classes.dir}/META-INF"/>
7.298 <copy todir="${build.classes.dir}/META-INF">
7.299 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
7.300 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
7.301 </copy>
7.302 </target>
7.303 <target name="-post-compile">
7.304 @@ -1073,7 +1126,11 @@
7.305 PROFILING SECTION
7.306 =================
7.307 -->
7.308 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
7.309 + <!--
7.310 + pre NB7.2 profiler integration
7.311 + -->
7.312 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
7.313 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
7.314 <nbprofiledirect>
7.315 <classpath>
7.316 <path path="${run.classpath}"/>
7.317 @@ -1081,8 +1138,9 @@
7.318 </nbprofiledirect>
7.319 <profile/>
7.320 </target>
7.321 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
7.322 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
7.323 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
7.324 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
7.325 <nbprofiledirect>
7.326 <classpath>
7.327 <path path="${run.classpath}"/>
7.328 @@ -1090,12 +1148,8 @@
7.329 </nbprofiledirect>
7.330 <profile classname="${profile.class}"/>
7.331 </target>
7.332 - <!--
7.333 - =========================
7.334 - APPLET PROFILING SECTION
7.335 - =========================
7.336 - -->
7.337 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
7.338 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
7.339 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
7.340 <nbprofiledirect>
7.341 <classpath>
7.342 <path path="${run.classpath}"/>
7.343 @@ -1107,12 +1161,8 @@
7.344 </customize>
7.345 </profile>
7.346 </target>
7.347 - <!--
7.348 - =========================
7.349 - TESTS PROFILING SECTION
7.350 - =========================
7.351 - -->
7.352 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
7.353 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
7.354 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
7.355 <nbprofiledirect>
7.356 <classpath>
7.357 <path path="${run.test.classpath}"/>
7.358 @@ -1135,6 +1185,42 @@
7.359 </junit>
7.360 </target>
7.361 <!--
7.362 + end of pre NB72 profiling section
7.363 + -->
7.364 + <target if="netbeans.home" name="-profile-check">
7.365 + <condition property="profiler.configured">
7.366 + <or>
7.367 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
7.368 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
7.369 + </or>
7.370 + </condition>
7.371 + </target>
7.372 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
7.373 + <startprofiler/>
7.374 + <antcall target="run"/>
7.375 + </target>
7.376 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
7.377 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
7.378 + <startprofiler/>
7.379 + <antcall target="run-single"/>
7.380 + </target>
7.381 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
7.382 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
7.383 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
7.384 + <startprofiler/>
7.385 + <antcall target="test-single"/>
7.386 + </target>
7.387 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
7.388 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
7.389 + <startprofiler/>
7.390 + <antcal target="run-test-with-main"/>
7.391 + </target>
7.392 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
7.393 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
7.394 + <startprofiler/>
7.395 + <antcall target="run-applet"/>
7.396 + </target>
7.397 + <!--
7.398 ===============
7.399 JAVADOC SECTION
7.400 ===============
7.401 @@ -1260,13 +1346,14 @@
7.402 TEST DEBUGGING SECTION
7.403 =======================
7.404 -->
7.405 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
7.406 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
7.407 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
7.408 - <j2seproject3:test-debug testClass="${test.class}"/>
7.409 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
7.410 </target>
7.411 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
7.412 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
7.413 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
7.414 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
7.415 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
7.416 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
7.417 </target>
7.418 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
7.419 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
8.1 --- a/remoting/server/web/nbindex.web.api/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
8.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
8.3 @@ -4,5 +4,5 @@
8.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
8.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
8.6 nbproject/build-impl.xml.data.CRC32=0e5c43eb
8.7 -nbproject/build-impl.xml.script.CRC32=1c4046d5
8.8 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
8.9 +nbproject/build-impl.xml.script.CRC32=851e01f3
8.10 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.54.0.46
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/remoting/server/web/resolve.web.api/build.xml Fri Nov 30 18:49:18 2012 +0100
9.3 @@ -0,0 +1,74 @@
9.4 +<?xml version="1.0" encoding="UTF-8"?>
9.5 +<!-- You may freely edit this file. See commented blocks below for -->
9.6 +<!-- some examples of how to customize the build. -->
9.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
9.8 +<!-- By default, only the Clean and Build commands use this build script. -->
9.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
9.10 +<!-- the Compile on Save feature is turned off for the project. -->
9.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9.12 +<!-- in the project's Project Properties dialog box.-->
9.13 +<project name="resolve.web.api" default="default" basedir=".">
9.14 + <description>Builds, tests, and runs the project resolve.web.api.</description>
9.15 + <import file="nbproject/build-impl.xml"/>
9.16 + <!--
9.17 +
9.18 + There exist several targets which are by default empty and which can be
9.19 + used for execution of your tasks. These targets are usually executed
9.20 + before and after some main targets. They are:
9.21 +
9.22 + -pre-init: called before initialization of project properties
9.23 + -post-init: called after initialization of project properties
9.24 + -pre-compile: called before javac compilation
9.25 + -post-compile: called after javac compilation
9.26 + -pre-compile-single: called before javac compilation of single file
9.27 + -post-compile-single: called after javac compilation of single file
9.28 + -pre-compile-test: called before javac compilation of JUnit tests
9.29 + -post-compile-test: called after javac compilation of JUnit tests
9.30 + -pre-compile-test-single: called before javac compilation of single JUnit test
9.31 + -post-compile-test-single: called after javac compilation of single JUunit test
9.32 + -pre-jar: called before JAR building
9.33 + -post-jar: called after JAR building
9.34 + -post-clean: called after cleaning build products
9.35 +
9.36 + (Targets beginning with '-' are not intended to be called on their own.)
9.37 +
9.38 + Example of inserting an obfuscator after compilation could look like this:
9.39 +
9.40 + <target name="-post-compile">
9.41 + <obfuscate>
9.42 + <fileset dir="${build.classes.dir}"/>
9.43 + </obfuscate>
9.44 + </target>
9.45 +
9.46 + For list of available properties check the imported
9.47 + nbproject/build-impl.xml file.
9.48 +
9.49 +
9.50 + Another way to customize the build is by overriding existing main targets.
9.51 + The targets of interest are:
9.52 +
9.53 + -init-macrodef-javac: defines macro for javac compilation
9.54 + -init-macrodef-junit: defines macro for junit execution
9.55 + -init-macrodef-debug: defines macro for class debugging
9.56 + -init-macrodef-java: defines macro for class execution
9.57 + -do-jar-with-manifest: JAR building (if you are using a manifest)
9.58 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
9.59 + run: execution of project
9.60 + -javadoc-build: Javadoc generation
9.61 + test-report: JUnit report generation
9.62 +
9.63 + An example of overriding the target for project execution could look like this:
9.64 +
9.65 + <target name="run" depends="resolve.web.api-impl.jar">
9.66 + <exec dir="bin" executable="launcher.exe">
9.67 + <arg file="${dist.jar}"/>
9.68 + </exec>
9.69 + </target>
9.70 +
9.71 + Notice that the overridden target depends on the jar target and not only on
9.72 + the compile target as the regular run target does. Again, for a list of available
9.73 + properties which you can use, check the target you are overriding in the
9.74 + nbproject/build-impl.xml file.
9.75 +
9.76 + -->
9.77 +</project>
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/remoting/server/web/resolve.web.api/manifest.mf Fri Nov 30 18:49:18 2012 +0100
10.3 @@ -0,0 +1,3 @@
10.4 +Manifest-Version: 1.0
10.5 +X-COMMENT: Main-Class will be added automatically by build
10.6 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/remoting/server/web/resolve.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
11.3 @@ -0,0 +1,1464 @@
11.4 +<?xml version="1.0" encoding="UTF-8"?>
11.5 +<!--
11.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
11.7 +*** EDIT ../build.xml INSTEAD ***
11.8 +
11.9 +For the purpose of easier reading the script
11.10 +is divided into following sections:
11.11 +
11.12 + - initialization
11.13 + - compilation
11.14 + - jar
11.15 + - execution
11.16 + - debugging
11.17 + - javadoc
11.18 + - test compilation
11.19 + - test execution
11.20 + - test debugging
11.21 + - applet
11.22 + - cleanup
11.23 +
11.24 + -->
11.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="resolve.web.api-impl">
11.26 + <fail message="Please build using Ant 1.8.0 or higher.">
11.27 + <condition>
11.28 + <not>
11.29 + <antversion atleast="1.8.0"/>
11.30 + </not>
11.31 + </condition>
11.32 + </fail>
11.33 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
11.34 + <!--
11.35 + ======================
11.36 + INITIALIZATION SECTION
11.37 + ======================
11.38 + -->
11.39 + <target name="-pre-init">
11.40 + <!-- Empty placeholder for easier customization. -->
11.41 + <!-- You can override this target in the ../build.xml file. -->
11.42 + </target>
11.43 + <target depends="-pre-init" name="-init-private">
11.44 + <property file="nbproject/private/config.properties"/>
11.45 + <property file="nbproject/private/configs/${config}.properties"/>
11.46 + <property file="nbproject/private/private.properties"/>
11.47 + </target>
11.48 + <target name="-pre-init-libraries">
11.49 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
11.50 + <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
11.51 + <pathconvert dirsep="/" property="libraries.dir">
11.52 + <path path="${libraries.dir.nativedirsep}"/>
11.53 + </pathconvert>
11.54 + <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
11.55 + <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
11.56 + </target>
11.57 + <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
11.58 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
11.59 + <filterchain>
11.60 + <replacestring from="$${base}" to="${libraries.dir}"/>
11.61 + <escapeunicode/>
11.62 + </filterchain>
11.63 + </loadproperties>
11.64 + </target>
11.65 + <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
11.66 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
11.67 + <filterchain>
11.68 + <replacestring from="$${base}" to="${libraries.dir}"/>
11.69 + <escapeunicode/>
11.70 + </filterchain>
11.71 + </loadproperties>
11.72 + </target>
11.73 + <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
11.74 + <property file="${user.properties.file}"/>
11.75 + <!-- The two properties below are usually overridden -->
11.76 + <!-- by the active platform. Just a fallback. -->
11.77 + <property name="default.javac.source" value="1.4"/>
11.78 + <property name="default.javac.target" value="1.4"/>
11.79 + </target>
11.80 + <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
11.81 + <property file="nbproject/configs/${config}.properties"/>
11.82 + <property file="nbproject/project.properties"/>
11.83 + </target>
11.84 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
11.85 + <available file="${manifest.file}" property="manifest.available"/>
11.86 + <condition property="splashscreen.available">
11.87 + <and>
11.88 + <not>
11.89 + <equals arg1="${application.splash}" arg2="" trim="true"/>
11.90 + </not>
11.91 + <available file="${application.splash}"/>
11.92 + </and>
11.93 + </condition>
11.94 + <condition property="main.class.available">
11.95 + <and>
11.96 + <isset property="main.class"/>
11.97 + <not>
11.98 + <equals arg1="${main.class}" arg2="" trim="true"/>
11.99 + </not>
11.100 + </and>
11.101 + </condition>
11.102 + <condition property="manifest.available+main.class">
11.103 + <and>
11.104 + <isset property="manifest.available"/>
11.105 + <isset property="main.class.available"/>
11.106 + </and>
11.107 + </condition>
11.108 + <condition property="do.archive">
11.109 + <not>
11.110 + <istrue value="${jar.archive.disabled}"/>
11.111 + </not>
11.112 + </condition>
11.113 + <condition property="do.mkdist">
11.114 + <and>
11.115 + <isset property="do.archive"/>
11.116 + <isset property="libs.CopyLibs.classpath"/>
11.117 + <not>
11.118 + <istrue value="${mkdist.disabled}"/>
11.119 + </not>
11.120 + </and>
11.121 + </condition>
11.122 + <condition property="manifest.available+main.class+mkdist.available">
11.123 + <and>
11.124 + <istrue value="${manifest.available+main.class}"/>
11.125 + <isset property="do.mkdist"/>
11.126 + </and>
11.127 + </condition>
11.128 + <condition property="do.archive+manifest.available">
11.129 + <and>
11.130 + <isset property="manifest.available"/>
11.131 + <istrue value="${do.archive}"/>
11.132 + </and>
11.133 + </condition>
11.134 + <condition property="do.archive+main.class.available">
11.135 + <and>
11.136 + <isset property="main.class.available"/>
11.137 + <istrue value="${do.archive}"/>
11.138 + </and>
11.139 + </condition>
11.140 + <condition property="do.archive+splashscreen.available">
11.141 + <and>
11.142 + <isset property="splashscreen.available"/>
11.143 + <istrue value="${do.archive}"/>
11.144 + </and>
11.145 + </condition>
11.146 + <condition property="do.archive+manifest.available+main.class">
11.147 + <and>
11.148 + <istrue value="${manifest.available+main.class}"/>
11.149 + <istrue value="${do.archive}"/>
11.150 + </and>
11.151 + </condition>
11.152 + <condition property="manifest.available-mkdist.available">
11.153 + <or>
11.154 + <istrue value="${manifest.available}"/>
11.155 + <isset property="do.mkdist"/>
11.156 + </or>
11.157 + </condition>
11.158 + <condition property="manifest.available+main.class-mkdist.available">
11.159 + <or>
11.160 + <istrue value="${manifest.available+main.class}"/>
11.161 + <isset property="do.mkdist"/>
11.162 + </or>
11.163 + </condition>
11.164 + <condition property="have.tests">
11.165 + <or>
11.166 + <available file="${test.src.dir}"/>
11.167 + </or>
11.168 + </condition>
11.169 + <condition property="have.sources">
11.170 + <or>
11.171 + <available file="${src.dir}"/>
11.172 + </or>
11.173 + </condition>
11.174 + <condition property="netbeans.home+have.tests">
11.175 + <and>
11.176 + <isset property="netbeans.home"/>
11.177 + <isset property="have.tests"/>
11.178 + </and>
11.179 + </condition>
11.180 + <condition property="no.javadoc.preview">
11.181 + <and>
11.182 + <isset property="javadoc.preview"/>
11.183 + <isfalse value="${javadoc.preview}"/>
11.184 + </and>
11.185 + </condition>
11.186 + <property name="run.jvmargs" value=""/>
11.187 + <property name="run.jvmargs.ide" value=""/>
11.188 + <property name="javac.compilerargs" value=""/>
11.189 + <property name="work.dir" value="${basedir}"/>
11.190 + <condition property="no.deps">
11.191 + <and>
11.192 + <istrue value="${no.dependencies}"/>
11.193 + </and>
11.194 + </condition>
11.195 + <property name="javac.debug" value="true"/>
11.196 + <property name="javadoc.preview" value="true"/>
11.197 + <property name="application.args" value=""/>
11.198 + <property name="source.encoding" value="${file.encoding}"/>
11.199 + <property name="runtime.encoding" value="${source.encoding}"/>
11.200 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
11.201 + <and>
11.202 + <isset property="javadoc.encoding"/>
11.203 + <not>
11.204 + <equals arg1="${javadoc.encoding}" arg2=""/>
11.205 + </not>
11.206 + </and>
11.207 + </condition>
11.208 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
11.209 + <property name="includes" value="**"/>
11.210 + <property name="excludes" value=""/>
11.211 + <property name="do.depend" value="false"/>
11.212 + <condition property="do.depend.true">
11.213 + <istrue value="${do.depend}"/>
11.214 + </condition>
11.215 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
11.216 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
11.217 + <length length="0" string="${endorsed.classpath}" when="greater"/>
11.218 + </condition>
11.219 + <condition else="false" property="jdkBug6558476">
11.220 + <and>
11.221 + <matches pattern="1\.[56]" string="${java.specification.version}"/>
11.222 + <not>
11.223 + <os family="unix"/>
11.224 + </not>
11.225 + </and>
11.226 + </condition>
11.227 + <property name="javac.fork" value="${jdkBug6558476}"/>
11.228 + <property name="jar.index" value="false"/>
11.229 + <property name="jar.index.metainf" value="${jar.index}"/>
11.230 + <property name="copylibs.rebase" value="true"/>
11.231 + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
11.232 + <condition property="junit.available">
11.233 + <or>
11.234 + <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
11.235 + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
11.236 + </or>
11.237 + </condition>
11.238 + <condition property="testng.available">
11.239 + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
11.240 + </condition>
11.241 + <condition property="junit+testng.available">
11.242 + <and>
11.243 + <istrue value="${junit.available}"/>
11.244 + <istrue value="${testng.available}"/>
11.245 + </and>
11.246 + </condition>
11.247 + <condition else="testng" property="testng.mode" value="mixed">
11.248 + <istrue value="${junit+testng.available}"/>
11.249 + </condition>
11.250 + <condition else="" property="testng.debug.mode" value="-mixed">
11.251 + <istrue value="${junit+testng.available}"/>
11.252 + </condition>
11.253 + </target>
11.254 + <target name="-post-init">
11.255 + <!-- Empty placeholder for easier customization. -->
11.256 + <!-- You can override this target in the ../build.xml file. -->
11.257 + </target>
11.258 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
11.259 + <fail unless="src.dir">Must set src.dir</fail>
11.260 + <fail unless="test.src.dir">Must set test.src.dir</fail>
11.261 + <fail unless="build.dir">Must set build.dir</fail>
11.262 + <fail unless="dist.dir">Must set dist.dir</fail>
11.263 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
11.264 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
11.265 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
11.266 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
11.267 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
11.268 + <fail unless="dist.jar">Must set dist.jar</fail>
11.269 + </target>
11.270 + <target name="-init-macrodef-property">
11.271 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
11.272 + <attribute name="name"/>
11.273 + <attribute name="value"/>
11.274 + <sequential>
11.275 + <property name="@{name}" value="${@{value}}"/>
11.276 + </sequential>
11.277 + </macrodef>
11.278 + </target>
11.279 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
11.280 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
11.281 + <attribute default="${src.dir}" name="srcdir"/>
11.282 + <attribute default="${build.classes.dir}" name="destdir"/>
11.283 + <attribute default="${javac.classpath}" name="classpath"/>
11.284 + <attribute default="${javac.processorpath}" name="processorpath"/>
11.285 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
11.286 + <attribute default="${includes}" name="includes"/>
11.287 + <attribute default="${excludes}" name="excludes"/>
11.288 + <attribute default="${javac.debug}" name="debug"/>
11.289 + <attribute default="${empty.dir}" name="sourcepath"/>
11.290 + <attribute default="${empty.dir}" name="gensrcdir"/>
11.291 + <element name="customize" optional="true"/>
11.292 + <sequential>
11.293 + <property location="${build.dir}/empty" name="empty.dir"/>
11.294 + <mkdir dir="${empty.dir}"/>
11.295 + <mkdir dir="@{apgeneratedsrcdir}"/>
11.296 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
11.297 + <src>
11.298 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
11.299 + <include name="*"/>
11.300 + </dirset>
11.301 + </src>
11.302 + <classpath>
11.303 + <path path="@{classpath}"/>
11.304 + </classpath>
11.305 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
11.306 + <compilerarg line="${javac.compilerargs}"/>
11.307 + <compilerarg value="-processorpath"/>
11.308 + <compilerarg path="@{processorpath}:${empty.dir}"/>
11.309 + <compilerarg line="${ap.processors.internal}"/>
11.310 + <compilerarg line="${annotation.processing.processor.options}"/>
11.311 + <compilerarg value="-s"/>
11.312 + <compilerarg path="@{apgeneratedsrcdir}"/>
11.313 + <compilerarg line="${ap.proc.none.internal}"/>
11.314 + <customize/>
11.315 + </javac>
11.316 + </sequential>
11.317 + </macrodef>
11.318 + </target>
11.319 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
11.320 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
11.321 + <attribute default="${src.dir}" name="srcdir"/>
11.322 + <attribute default="${build.classes.dir}" name="destdir"/>
11.323 + <attribute default="${javac.classpath}" name="classpath"/>
11.324 + <attribute default="${javac.processorpath}" name="processorpath"/>
11.325 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
11.326 + <attribute default="${includes}" name="includes"/>
11.327 + <attribute default="${excludes}" name="excludes"/>
11.328 + <attribute default="${javac.debug}" name="debug"/>
11.329 + <attribute default="${empty.dir}" name="sourcepath"/>
11.330 + <attribute default="${empty.dir}" name="gensrcdir"/>
11.331 + <element name="customize" optional="true"/>
11.332 + <sequential>
11.333 + <property location="${build.dir}/empty" name="empty.dir"/>
11.334 + <mkdir dir="${empty.dir}"/>
11.335 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
11.336 + <src>
11.337 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
11.338 + <include name="*"/>
11.339 + </dirset>
11.340 + </src>
11.341 + <classpath>
11.342 + <path path="@{classpath}"/>
11.343 + </classpath>
11.344 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
11.345 + <compilerarg line="${javac.compilerargs}"/>
11.346 + <customize/>
11.347 + </javac>
11.348 + </sequential>
11.349 + </macrodef>
11.350 + </target>
11.351 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
11.352 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
11.353 + <attribute default="${src.dir}" name="srcdir"/>
11.354 + <attribute default="${build.classes.dir}" name="destdir"/>
11.355 + <attribute default="${javac.classpath}" name="classpath"/>
11.356 + <sequential>
11.357 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
11.358 + <classpath>
11.359 + <path path="@{classpath}"/>
11.360 + </classpath>
11.361 + </depend>
11.362 + </sequential>
11.363 + </macrodef>
11.364 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
11.365 + <attribute default="${build.classes.dir}" name="destdir"/>
11.366 + <sequential>
11.367 + <fail unless="javac.includes">Must set javac.includes</fail>
11.368 + <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
11.369 + <path>
11.370 + <filelist dir="@{destdir}" files="${javac.includes}"/>
11.371 + </path>
11.372 + <globmapper from="*.java" to="*.class"/>
11.373 + </pathconvert>
11.374 + <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
11.375 + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
11.376 + <delete>
11.377 + <files includesfile="${javac.includesfile.binary}"/>
11.378 + </delete>
11.379 + <delete>
11.380 + <fileset file="${javac.includesfile.binary}"/>
11.381 + </delete>
11.382 + </sequential>
11.383 + </macrodef>
11.384 + </target>
11.385 + <target if="${junit.available}" name="-init-macrodef-junit-init">
11.386 + <condition else="false" property="nb.junit.batch" value="true">
11.387 + <and>
11.388 + <istrue value="${junit.available}"/>
11.389 + <not>
11.390 + <isset property="test.method"/>
11.391 + </not>
11.392 + </and>
11.393 + </condition>
11.394 + <condition else="false" property="nb.junit.single" value="true">
11.395 + <and>
11.396 + <istrue value="${junit.available}"/>
11.397 + <isset property="test.method"/>
11.398 + </and>
11.399 + </condition>
11.400 + </target>
11.401 + <target name="-init-test-properties">
11.402 + <property name="test.binaryincludes" value="<nothing>"/>
11.403 + <property name="test.binarytestincludes" value=""/>
11.404 + <property name="test.binaryexcludes" value=""/>
11.405 + </target>
11.406 + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
11.407 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
11.408 + <attribute default="${includes}" name="includes"/>
11.409 + <attribute default="${excludes}" name="excludes"/>
11.410 + <attribute default="**" name="testincludes"/>
11.411 + <attribute default="" name="testmethods"/>
11.412 + <element name="customize" optional="true"/>
11.413 + <sequential>
11.414 + <property name="junit.forkmode" value="perTest"/>
11.415 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
11.416 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
11.417 + <syspropertyset>
11.418 + <propertyref prefix="test-sys-prop."/>
11.419 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.420 + </syspropertyset>
11.421 + <formatter type="brief" usefile="false"/>
11.422 + <formatter type="xml"/>
11.423 + <jvmarg value="-ea"/>
11.424 + <customize/>
11.425 + </junit>
11.426 + </sequential>
11.427 + </macrodef>
11.428 + </target>
11.429 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
11.430 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
11.431 + <attribute default="${includes}" name="includes"/>
11.432 + <attribute default="${excludes}" name="excludes"/>
11.433 + <attribute default="**" name="testincludes"/>
11.434 + <attribute default="" name="testmethods"/>
11.435 + <element name="customize" optional="true"/>
11.436 + <sequential>
11.437 + <property name="junit.forkmode" value="perTest"/>
11.438 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
11.439 + <batchtest todir="${build.test.results.dir}">
11.440 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
11.441 + <filename name="@{testincludes}"/>
11.442 + </fileset>
11.443 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
11.444 + <filename name="${test.binarytestincludes}"/>
11.445 + </fileset>
11.446 + </batchtest>
11.447 + <syspropertyset>
11.448 + <propertyref prefix="test-sys-prop."/>
11.449 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.450 + </syspropertyset>
11.451 + <formatter type="brief" usefile="false"/>
11.452 + <formatter type="xml"/>
11.453 + <jvmarg value="-ea"/>
11.454 + <customize/>
11.455 + </junit>
11.456 + </sequential>
11.457 + </macrodef>
11.458 + </target>
11.459 + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
11.460 + <target if="${testng.available}" name="-init-macrodef-testng">
11.461 + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
11.462 + <attribute default="${includes}" name="includes"/>
11.463 + <attribute default="${excludes}" name="excludes"/>
11.464 + <attribute default="**" name="testincludes"/>
11.465 + <attribute default="" name="testmethods"/>
11.466 + <element name="customize" optional="true"/>
11.467 + <sequential>
11.468 + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
11.469 + <isset property="test.method"/>
11.470 + </condition>
11.471 + <union id="test.set">
11.472 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
11.473 + <filename name="@{testincludes}"/>
11.474 + </fileset>
11.475 + </union>
11.476 + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
11.477 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="resolve.web.api" testname="TestNG tests" workingDir="${work.dir}">
11.478 + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
11.479 + <propertyset>
11.480 + <propertyref prefix="test-sys-prop."/>
11.481 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.482 + </propertyset>
11.483 + <customize/>
11.484 + </testng>
11.485 + </sequential>
11.486 + </macrodef>
11.487 + </target>
11.488 + <target name="-init-macrodef-test-impl">
11.489 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
11.490 + <attribute default="${includes}" name="includes"/>
11.491 + <attribute default="${excludes}" name="excludes"/>
11.492 + <attribute default="**" name="testincludes"/>
11.493 + <attribute default="" name="testmethods"/>
11.494 + <element implicit="true" name="customize" optional="true"/>
11.495 + <sequential>
11.496 + <echo>No tests executed.</echo>
11.497 + </sequential>
11.498 + </macrodef>
11.499 + </target>
11.500 + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
11.501 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
11.502 + <attribute default="${includes}" name="includes"/>
11.503 + <attribute default="${excludes}" name="excludes"/>
11.504 + <attribute default="**" name="testincludes"/>
11.505 + <attribute default="" name="testmethods"/>
11.506 + <element implicit="true" name="customize" optional="true"/>
11.507 + <sequential>
11.508 + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
11.509 + <customize/>
11.510 + </j2seproject3:junit>
11.511 + </sequential>
11.512 + </macrodef>
11.513 + </target>
11.514 + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
11.515 + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
11.516 + <attribute default="${includes}" name="includes"/>
11.517 + <attribute default="${excludes}" name="excludes"/>
11.518 + <attribute default="**" name="testincludes"/>
11.519 + <attribute default="" name="testmethods"/>
11.520 + <element implicit="true" name="customize" optional="true"/>
11.521 + <sequential>
11.522 + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
11.523 + <customize/>
11.524 + </j2seproject3:testng>
11.525 + </sequential>
11.526 + </macrodef>
11.527 + </target>
11.528 + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
11.529 + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
11.530 + <attribute default="${includes}" name="includes"/>
11.531 + <attribute default="${excludes}" name="excludes"/>
11.532 + <attribute default="**" name="testincludes"/>
11.533 + <attribute default="" name="testmethods"/>
11.534 + <sequential>
11.535 + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
11.536 + <customize>
11.537 + <classpath>
11.538 + <path path="${run.test.classpath}"/>
11.539 + </classpath>
11.540 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
11.541 + <jvmarg line="${run.jvmargs}"/>
11.542 + <jvmarg line="${run.jvmargs.ide}"/>
11.543 + </customize>
11.544 + </j2seproject3:test-impl>
11.545 + </sequential>
11.546 + </macrodef>
11.547 + </target>
11.548 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
11.549 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.550 + <attribute default="${includes}" name="includes"/>
11.551 + <attribute default="${excludes}" name="excludes"/>
11.552 + <attribute default="**" name="testincludes"/>
11.553 + <attribute default="" name="testmethods"/>
11.554 + <element name="customize" optional="true"/>
11.555 + <sequential>
11.556 + <property name="junit.forkmode" value="perTest"/>
11.557 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
11.558 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
11.559 + <syspropertyset>
11.560 + <propertyref prefix="test-sys-prop."/>
11.561 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.562 + </syspropertyset>
11.563 + <formatter type="brief" usefile="false"/>
11.564 + <formatter type="xml"/>
11.565 + <jvmarg value="-ea"/>
11.566 + <jvmarg line="${debug-args-line}"/>
11.567 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
11.568 + <customize/>
11.569 + </junit>
11.570 + </sequential>
11.571 + </macrodef>
11.572 + </target>
11.573 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
11.574 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.575 + <attribute default="${includes}" name="includes"/>
11.576 + <attribute default="${excludes}" name="excludes"/>
11.577 + <attribute default="**" name="testincludes"/>
11.578 + <attribute default="" name="testmethods"/>
11.579 + <element name="customize" optional="true"/>
11.580 + <sequential>
11.581 + <property name="junit.forkmode" value="perTest"/>
11.582 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
11.583 + <batchtest todir="${build.test.results.dir}">
11.584 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
11.585 + <filename name="@{testincludes}"/>
11.586 + </fileset>
11.587 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
11.588 + <filename name="${test.binarytestincludes}"/>
11.589 + </fileset>
11.590 + </batchtest>
11.591 + <syspropertyset>
11.592 + <propertyref prefix="test-sys-prop."/>
11.593 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.594 + </syspropertyset>
11.595 + <formatter type="brief" usefile="false"/>
11.596 + <formatter type="xml"/>
11.597 + <jvmarg value="-ea"/>
11.598 + <jvmarg line="${debug-args-line}"/>
11.599 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
11.600 + <customize/>
11.601 + </junit>
11.602 + </sequential>
11.603 + </macrodef>
11.604 + </target>
11.605 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
11.606 + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
11.607 + <attribute default="${includes}" name="includes"/>
11.608 + <attribute default="${excludes}" name="excludes"/>
11.609 + <attribute default="**" name="testincludes"/>
11.610 + <attribute default="" name="testmethods"/>
11.611 + <element implicit="true" name="customize" optional="true"/>
11.612 + <sequential>
11.613 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
11.614 + <customize/>
11.615 + </j2seproject3:junit-debug>
11.616 + </sequential>
11.617 + </macrodef>
11.618 + </target>
11.619 + <target if="${testng.available}" name="-init-macrodef-testng-debug">
11.620 + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.621 + <attribute default="${main.class}" name="testClass"/>
11.622 + <attribute default="" name="testMethod"/>
11.623 + <element name="customize2" optional="true"/>
11.624 + <sequential>
11.625 + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
11.626 + <isset property="test.method"/>
11.627 + </condition>
11.628 + <condition else="-suitename resolve.web.api -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
11.629 + <matches pattern=".*\.xml" string="@{testClass}"/>
11.630 + </condition>
11.631 + <delete dir="${build.test.results.dir}" quiet="true"/>
11.632 + <mkdir dir="${build.test.results.dir}"/>
11.633 + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
11.634 + <customize>
11.635 + <customize2/>
11.636 + <jvmarg value="-ea"/>
11.637 + <arg line="${testng.debug.mode}"/>
11.638 + <arg line="-d ${build.test.results.dir}"/>
11.639 + <arg line="-listener org.testng.reporters.VerboseReporter"/>
11.640 + <arg line="${testng.cmd.args}"/>
11.641 + </customize>
11.642 + </j2seproject3:debug>
11.643 + </sequential>
11.644 + </macrodef>
11.645 + </target>
11.646 + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
11.647 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
11.648 + <attribute default="${main.class}" name="testClass"/>
11.649 + <attribute default="" name="testMethod"/>
11.650 + <element implicit="true" name="customize2" optional="true"/>
11.651 + <sequential>
11.652 + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
11.653 + <customize2/>
11.654 + </j2seproject3:testng-debug>
11.655 + </sequential>
11.656 + </macrodef>
11.657 + </target>
11.658 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
11.659 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.660 + <attribute default="${includes}" name="includes"/>
11.661 + <attribute default="${excludes}" name="excludes"/>
11.662 + <attribute default="**" name="testincludes"/>
11.663 + <attribute default="" name="testmethods"/>
11.664 + <attribute default="${main.class}" name="testClass"/>
11.665 + <attribute default="" name="testMethod"/>
11.666 + <sequential>
11.667 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
11.668 + <customize>
11.669 + <classpath>
11.670 + <path path="${run.test.classpath}"/>
11.671 + </classpath>
11.672 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
11.673 + <jvmarg line="${run.jvmargs}"/>
11.674 + <jvmarg line="${run.jvmargs.ide}"/>
11.675 + </customize>
11.676 + </j2seproject3:test-debug-impl>
11.677 + </sequential>
11.678 + </macrodef>
11.679 + </target>
11.680 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
11.681 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.682 + <attribute default="${includes}" name="includes"/>
11.683 + <attribute default="${excludes}" name="excludes"/>
11.684 + <attribute default="**" name="testincludes"/>
11.685 + <attribute default="" name="testmethods"/>
11.686 + <attribute default="${main.class}" name="testClass"/>
11.687 + <attribute default="" name="testMethod"/>
11.688 + <sequential>
11.689 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
11.690 + <customize2>
11.691 + <syspropertyset>
11.692 + <propertyref prefix="test-sys-prop."/>
11.693 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.694 + </syspropertyset>
11.695 + </customize2>
11.696 + </j2seproject3:testng-debug-impl>
11.697 + </sequential>
11.698 + </macrodef>
11.699 + </target>
11.700 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
11.701 + <!--
11.702 + pre NB7.2 profiling section; consider it deprecated
11.703 + -->
11.704 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
11.705 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
11.706 + <!-- Empty placeholder for easier customization. -->
11.707 + <!-- You can override this target in the ../build.xml file. -->
11.708 + </target>
11.709 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
11.710 + <!-- Empty placeholder for easier customization. -->
11.711 + <!-- You can override this target in the ../build.xml file. -->
11.712 + </target>
11.713 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
11.714 + <macrodef name="resolve">
11.715 + <attribute name="name"/>
11.716 + <attribute name="value"/>
11.717 + <sequential>
11.718 + <property name="@{name}" value="${env.@{value}}"/>
11.719 + </sequential>
11.720 + </macrodef>
11.721 + <macrodef name="profile">
11.722 + <attribute default="${main.class}" name="classname"/>
11.723 + <element name="customize" optional="true"/>
11.724 + <sequential>
11.725 + <property environment="env"/>
11.726 + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
11.727 + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
11.728 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
11.729 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
11.730 + <jvmarg line="${profiler.info.jvmargs}"/>
11.731 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
11.732 + <arg line="${application.args}"/>
11.733 + <classpath>
11.734 + <path path="${run.classpath}"/>
11.735 + </classpath>
11.736 + <syspropertyset>
11.737 + <propertyref prefix="run-sys-prop."/>
11.738 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
11.739 + </syspropertyset>
11.740 + <customize/>
11.741 + </java>
11.742 + </sequential>
11.743 + </macrodef>
11.744 + </target>
11.745 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
11.746 + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
11.747 + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
11.748 + </target>
11.749 + <!--
11.750 + end of pre NB7.2 profiling section
11.751 + -->
11.752 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
11.753 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
11.754 + <attribute default="${main.class}" name="name"/>
11.755 + <attribute default="${debug.classpath}" name="classpath"/>
11.756 + <attribute default="" name="stopclassname"/>
11.757 + <sequential>
11.758 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
11.759 + <classpath>
11.760 + <path path="@{classpath}"/>
11.761 + </classpath>
11.762 + </nbjpdastart>
11.763 + </sequential>
11.764 + </macrodef>
11.765 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
11.766 + <attribute default="${build.classes.dir}" name="dir"/>
11.767 + <sequential>
11.768 + <nbjpdareload>
11.769 + <fileset dir="@{dir}" includes="${fix.classes}">
11.770 + <include name="${fix.includes}*.class"/>
11.771 + </fileset>
11.772 + </nbjpdareload>
11.773 + </sequential>
11.774 + </macrodef>
11.775 + </target>
11.776 + <target name="-init-debug-args">
11.777 + <property name="version-output" value="java version "${ant.java.version}"/>
11.778 + <condition property="have-jdk-older-than-1.4">
11.779 + <or>
11.780 + <contains string="${version-output}" substring="java version "1.0"/>
11.781 + <contains string="${version-output}" substring="java version "1.1"/>
11.782 + <contains string="${version-output}" substring="java version "1.2"/>
11.783 + <contains string="${version-output}" substring="java version "1.3"/>
11.784 + </or>
11.785 + </condition>
11.786 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
11.787 + <istrue value="${have-jdk-older-than-1.4}"/>
11.788 + </condition>
11.789 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
11.790 + <os family="windows"/>
11.791 + </condition>
11.792 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
11.793 + <isset property="debug.transport"/>
11.794 + </condition>
11.795 + </target>
11.796 + <target depends="-init-debug-args" name="-init-macrodef-debug">
11.797 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
11.798 + <attribute default="${main.class}" name="classname"/>
11.799 + <attribute default="${debug.classpath}" name="classpath"/>
11.800 + <element name="customize" optional="true"/>
11.801 + <sequential>
11.802 + <java classname="@{classname}" dir="${work.dir}" fork="true">
11.803 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
11.804 + <jvmarg line="${debug-args-line}"/>
11.805 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
11.806 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
11.807 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
11.808 + <jvmarg line="${run.jvmargs}"/>
11.809 + <jvmarg line="${run.jvmargs.ide}"/>
11.810 + <classpath>
11.811 + <path path="@{classpath}"/>
11.812 + </classpath>
11.813 + <syspropertyset>
11.814 + <propertyref prefix="run-sys-prop."/>
11.815 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
11.816 + </syspropertyset>
11.817 + <customize/>
11.818 + </java>
11.819 + </sequential>
11.820 + </macrodef>
11.821 + </target>
11.822 + <target name="-init-macrodef-java">
11.823 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
11.824 + <attribute default="${main.class}" name="classname"/>
11.825 + <attribute default="${run.classpath}" name="classpath"/>
11.826 + <attribute default="jvm" name="jvm"/>
11.827 + <element name="customize" optional="true"/>
11.828 + <sequential>
11.829 + <java classname="@{classname}" dir="${work.dir}" fork="true">
11.830 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
11.831 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
11.832 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
11.833 + <jvmarg line="${run.jvmargs}"/>
11.834 + <jvmarg line="${run.jvmargs.ide}"/>
11.835 + <classpath>
11.836 + <path path="@{classpath}"/>
11.837 + </classpath>
11.838 + <syspropertyset>
11.839 + <propertyref prefix="run-sys-prop."/>
11.840 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
11.841 + </syspropertyset>
11.842 + <customize/>
11.843 + </java>
11.844 + </sequential>
11.845 + </macrodef>
11.846 + </target>
11.847 + <target name="-init-macrodef-copylibs">
11.848 + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
11.849 + <attribute default="${manifest.file}" name="manifest"/>
11.850 + <element name="customize" optional="true"/>
11.851 + <sequential>
11.852 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
11.853 + <pathconvert property="run.classpath.without.build.classes.dir">
11.854 + <path path="${run.classpath}"/>
11.855 + <map from="${build.classes.dir.resolved}" to=""/>
11.856 + </pathconvert>
11.857 + <pathconvert pathsep=" " property="jar.classpath">
11.858 + <path path="${run.classpath.without.build.classes.dir}"/>
11.859 + <chainedmapper>
11.860 + <flattenmapper/>
11.861 + <filtermapper>
11.862 + <replacestring from=" " to="%20"/>
11.863 + </filtermapper>
11.864 + <globmapper from="*" to="lib/*"/>
11.865 + </chainedmapper>
11.866 + </pathconvert>
11.867 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
11.868 + <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
11.869 + <fileset dir="${build.classes.dir}"/>
11.870 + <manifest>
11.871 + <attribute name="Class-Path" value="${jar.classpath}"/>
11.872 + <customize/>
11.873 + </manifest>
11.874 + </copylibs>
11.875 + </sequential>
11.876 + </macrodef>
11.877 + </target>
11.878 + <target name="-init-presetdef-jar">
11.879 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
11.880 + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
11.881 + <j2seproject1:fileset dir="${build.classes.dir}"/>
11.882 + </jar>
11.883 + </presetdef>
11.884 + </target>
11.885 + <target name="-init-ap-cmdline-properties">
11.886 + <property name="annotation.processing.enabled" value="true"/>
11.887 + <property name="annotation.processing.processors.list" value=""/>
11.888 + <property name="annotation.processing.processor.options" value=""/>
11.889 + <property name="annotation.processing.run.all.processors" value="true"/>
11.890 + <property name="javac.processorpath" value="${javac.classpath}"/>
11.891 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
11.892 + <condition property="ap.supported.internal" value="true">
11.893 + <not>
11.894 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
11.895 + </not>
11.896 + </condition>
11.897 + </target>
11.898 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
11.899 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
11.900 + <isfalse value="${annotation.processing.run.all.processors}"/>
11.901 + </condition>
11.902 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
11.903 + <isfalse value="${annotation.processing.enabled}"/>
11.904 + </condition>
11.905 + </target>
11.906 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
11.907 + <property name="ap.cmd.line.internal" value=""/>
11.908 + </target>
11.909 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
11.910 + <!--
11.911 + ===================
11.912 + COMPILATION SECTION
11.913 + ===================
11.914 + -->
11.915 + <target name="-deps-jar-init" unless="built-jar.properties">
11.916 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
11.917 + <delete file="${built-jar.properties}" quiet="true"/>
11.918 + </target>
11.919 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
11.920 + <echo level="warn" message="Cycle detected: resolve.web.api was already built"/>
11.921 + </target>
11.922 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
11.923 + <mkdir dir="${build.dir}"/>
11.924 + <touch file="${built-jar.properties}" verbose="false"/>
11.925 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
11.926 + <antcall target="-warn-already-built-jar"/>
11.927 + <propertyfile file="${built-jar.properties}">
11.928 + <entry key="${basedir}" value=""/>
11.929 + </propertyfile>
11.930 + <antcall target="-maybe-call-dep">
11.931 + <param name="call.built.properties" value="${built-jar.properties}"/>
11.932 + <param location="${project.base_web_api}" name="call.subproject"/>
11.933 + <param location="${project.base_web_api}/build.xml" name="call.script"/>
11.934 + <param name="call.target" value="jar"/>
11.935 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
11.936 + </antcall>
11.937 + <antcall target="-maybe-call-dep">
11.938 + <param name="call.built.properties" value="${built-jar.properties}"/>
11.939 + <param location="${project.source_web_api}" name="call.subproject"/>
11.940 + <param location="${project.source_web_api}/build.xml" name="call.script"/>
11.941 + <param name="call.target" value="jar"/>
11.942 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
11.943 + </antcall>
11.944 + </target>
11.945 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
11.946 + <target depends="init" name="-check-automatic-build">
11.947 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
11.948 + </target>
11.949 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
11.950 + <antcall target="clean"/>
11.951 + </target>
11.952 + <target depends="init,deps-jar" name="-pre-pre-compile">
11.953 + <mkdir dir="${build.classes.dir}"/>
11.954 + </target>
11.955 + <target name="-pre-compile">
11.956 + <!-- Empty placeholder for easier customization. -->
11.957 + <!-- You can override this target in the ../build.xml file. -->
11.958 + </target>
11.959 + <target if="do.depend.true" name="-compile-depend">
11.960 + <pathconvert property="build.generated.subdirs">
11.961 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
11.962 + <include name="*"/>
11.963 + </dirset>
11.964 + </pathconvert>
11.965 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
11.966 + </target>
11.967 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
11.968 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
11.969 + <copy todir="${build.classes.dir}">
11.970 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
11.971 + </copy>
11.972 + </target>
11.973 + <target if="has.persistence.xml" name="-copy-persistence-xml">
11.974 + <mkdir dir="${build.classes.dir}/META-INF"/>
11.975 + <copy todir="${build.classes.dir}/META-INF">
11.976 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
11.977 + </copy>
11.978 + </target>
11.979 + <target name="-post-compile">
11.980 + <!-- Empty placeholder for easier customization. -->
11.981 + <!-- You can override this target in the ../build.xml file. -->
11.982 + </target>
11.983 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
11.984 + <target name="-pre-compile-single">
11.985 + <!-- Empty placeholder for easier customization. -->
11.986 + <!-- You can override this target in the ../build.xml file. -->
11.987 + </target>
11.988 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
11.989 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
11.990 + <j2seproject3:force-recompile/>
11.991 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
11.992 + </target>
11.993 + <target name="-post-compile-single">
11.994 + <!-- Empty placeholder for easier customization. -->
11.995 + <!-- You can override this target in the ../build.xml file. -->
11.996 + </target>
11.997 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
11.998 + <!--
11.999 + ====================
11.1000 + JAR BUILDING SECTION
11.1001 + ====================
11.1002 + -->
11.1003 + <target depends="init" name="-pre-pre-jar">
11.1004 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
11.1005 + <mkdir dir="${dist.jar.dir}"/>
11.1006 + </target>
11.1007 + <target name="-pre-jar">
11.1008 + <!-- Empty placeholder for easier customization. -->
11.1009 + <!-- You can override this target in the ../build.xml file. -->
11.1010 + </target>
11.1011 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
11.1012 + <j2seproject1:jar/>
11.1013 + </target>
11.1014 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
11.1015 + <j2seproject1:jar manifest="${manifest.file}"/>
11.1016 + </target>
11.1017 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
11.1018 + <j2seproject1:jar manifest="${manifest.file}">
11.1019 + <j2seproject1:manifest>
11.1020 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
11.1021 + </j2seproject1:manifest>
11.1022 + </j2seproject1:jar>
11.1023 + <echo level="info">To run this application from the command line without Ant, try:</echo>
11.1024 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
11.1025 + <property location="${dist.jar}" name="dist.jar.resolved"/>
11.1026 + <pathconvert property="run.classpath.with.dist.jar">
11.1027 + <path path="${run.classpath}"/>
11.1028 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
11.1029 + </pathconvert>
11.1030 + <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
11.1031 + </target>
11.1032 + <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
11.1033 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
11.1034 + <touch file="${tmp.manifest.file}" verbose="false"/>
11.1035 + </target>
11.1036 + <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
11.1037 + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
11.1038 + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
11.1039 + </target>
11.1040 + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
11.1041 + <manifest file="${tmp.manifest.file}" mode="update">
11.1042 + <attribute name="Main-Class" value="${main.class}"/>
11.1043 + </manifest>
11.1044 + </target>
11.1045 + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
11.1046 + <basename file="${application.splash}" property="splashscreen.basename"/>
11.1047 + <mkdir dir="${build.classes.dir}/META-INF"/>
11.1048 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
11.1049 + <manifest file="${tmp.manifest.file}" mode="update">
11.1050 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
11.1051 + </manifest>
11.1052 + </target>
11.1053 + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
11.1054 + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
11.1055 + <echo level="info">To run this application from the command line without Ant, try:</echo>
11.1056 + <property location="${dist.jar}" name="dist.jar.resolved"/>
11.1057 + <echo level="info">java -jar "${dist.jar.resolved}"</echo>
11.1058 + </target>
11.1059 + <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
11.1060 + <delete>
11.1061 + <fileset file="${tmp.manifest.file}"/>
11.1062 + </delete>
11.1063 + </target>
11.1064 + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
11.1065 + <target name="-post-jar">
11.1066 + <!-- Empty placeholder for easier customization. -->
11.1067 + <!-- You can override this target in the ../build.xml file. -->
11.1068 + </target>
11.1069 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
11.1070 + <!--
11.1071 + =================
11.1072 + EXECUTION SECTION
11.1073 + =================
11.1074 + -->
11.1075 + <target depends="init,compile" description="Run a main class." name="run">
11.1076 + <j2seproject1:java>
11.1077 + <customize>
11.1078 + <arg line="${application.args}"/>
11.1079 + </customize>
11.1080 + </j2seproject1:java>
11.1081 + </target>
11.1082 + <target name="-do-not-recompile">
11.1083 + <property name="javac.includes.binary" value=""/>
11.1084 + </target>
11.1085 + <target depends="init,compile-single" name="run-single">
11.1086 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
11.1087 + <j2seproject1:java classname="${run.class}"/>
11.1088 + </target>
11.1089 + <target depends="init,compile-test-single" name="run-test-with-main">
11.1090 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
11.1091 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
11.1092 + </target>
11.1093 + <!--
11.1094 + =================
11.1095 + DEBUGGING SECTION
11.1096 + =================
11.1097 + -->
11.1098 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
11.1099 + <j2seproject1:nbjpdastart name="${debug.class}"/>
11.1100 + </target>
11.1101 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
11.1102 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
11.1103 + </target>
11.1104 + <target depends="init,compile" name="-debug-start-debuggee">
11.1105 + <j2seproject3:debug>
11.1106 + <customize>
11.1107 + <arg line="${application.args}"/>
11.1108 + </customize>
11.1109 + </j2seproject3:debug>
11.1110 + </target>
11.1111 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
11.1112 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
11.1113 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
11.1114 + </target>
11.1115 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
11.1116 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
11.1117 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
11.1118 + <j2seproject3:debug classname="${debug.class}"/>
11.1119 + </target>
11.1120 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
11.1121 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
11.1122 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
11.1123 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
11.1124 + </target>
11.1125 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
11.1126 + <target depends="init" name="-pre-debug-fix">
11.1127 + <fail unless="fix.includes">Must set fix.includes</fail>
11.1128 + <property name="javac.includes" value="${fix.includes}.java"/>
11.1129 + </target>
11.1130 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
11.1131 + <j2seproject1:nbjpdareload/>
11.1132 + </target>
11.1133 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
11.1134 + <!--
11.1135 + =================
11.1136 + PROFILING SECTION
11.1137 + =================
11.1138 + -->
11.1139 + <!--
11.1140 + pre NB7.2 profiler integration
11.1141 + -->
11.1142 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
11.1143 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
11.1144 + <nbprofiledirect>
11.1145 + <classpath>
11.1146 + <path path="${run.classpath}"/>
11.1147 + </classpath>
11.1148 + </nbprofiledirect>
11.1149 + <profile/>
11.1150 + </target>
11.1151 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
11.1152 + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
11.1153 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
11.1154 + <nbprofiledirect>
11.1155 + <classpath>
11.1156 + <path path="${run.classpath}"/>
11.1157 + </classpath>
11.1158 + </nbprofiledirect>
11.1159 + <profile classname="${profile.class}"/>
11.1160 + </target>
11.1161 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
11.1162 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
11.1163 + <nbprofiledirect>
11.1164 + <classpath>
11.1165 + <path path="${run.classpath}"/>
11.1166 + </classpath>
11.1167 + </nbprofiledirect>
11.1168 + <profile classname="sun.applet.AppletViewer">
11.1169 + <customize>
11.1170 + <arg value="${applet.url}"/>
11.1171 + </customize>
11.1172 + </profile>
11.1173 + </target>
11.1174 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
11.1175 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
11.1176 + <nbprofiledirect>
11.1177 + <classpath>
11.1178 + <path path="${run.test.classpath}"/>
11.1179 + </classpath>
11.1180 + </nbprofiledirect>
11.1181 + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
11.1182 + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
11.1183 + <jvmarg value="${profiler.info.jvmargs.agent}"/>
11.1184 + <jvmarg line="${profiler.info.jvmargs}"/>
11.1185 + <test name="${profile.class}"/>
11.1186 + <classpath>
11.1187 + <path path="${run.test.classpath}"/>
11.1188 + </classpath>
11.1189 + <syspropertyset>
11.1190 + <propertyref prefix="test-sys-prop."/>
11.1191 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
11.1192 + </syspropertyset>
11.1193 + <formatter type="brief" usefile="false"/>
11.1194 + <formatter type="xml"/>
11.1195 + </junit>
11.1196 + </target>
11.1197 + <!--
11.1198 + end of pre NB72 profiling section
11.1199 + -->
11.1200 + <target if="netbeans.home" name="-profile-check">
11.1201 + <condition property="profiler.configured">
11.1202 + <or>
11.1203 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
11.1204 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
11.1205 + </or>
11.1206 + </condition>
11.1207 + </target>
11.1208 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
11.1209 + <startprofiler/>
11.1210 + <antcall target="run"/>
11.1211 + </target>
11.1212 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
11.1213 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
11.1214 + <startprofiler/>
11.1215 + <antcall target="run-single"/>
11.1216 + </target>
11.1217 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
11.1218 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
11.1219 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
11.1220 + <startprofiler/>
11.1221 + <antcall target="test-single"/>
11.1222 + </target>
11.1223 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
11.1224 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
11.1225 + <startprofiler/>
11.1226 + <antcal target="run-test-with-main"/>
11.1227 + </target>
11.1228 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
11.1229 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
11.1230 + <startprofiler/>
11.1231 + <antcall target="run-applet"/>
11.1232 + </target>
11.1233 + <!--
11.1234 + ===============
11.1235 + JAVADOC SECTION
11.1236 + ===============
11.1237 + -->
11.1238 + <target depends="init" if="have.sources" name="-javadoc-build">
11.1239 + <mkdir dir="${dist.javadoc.dir}"/>
11.1240 + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
11.1241 + <and>
11.1242 + <isset property="endorsed.classpath.cmd.line.arg"/>
11.1243 + <not>
11.1244 + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
11.1245 + </not>
11.1246 + </and>
11.1247 + </condition>
11.1248 + <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
11.1249 + <classpath>
11.1250 + <path path="${javac.classpath}"/>
11.1251 + </classpath>
11.1252 + <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
11.1253 + <filename name="**/*.java"/>
11.1254 + </fileset>
11.1255 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
11.1256 + <include name="**/*.java"/>
11.1257 + <exclude name="*.java"/>
11.1258 + </fileset>
11.1259 + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
11.1260 + </javadoc>
11.1261 + <copy todir="${dist.javadoc.dir}">
11.1262 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
11.1263 + <filename name="**/doc-files/**"/>
11.1264 + </fileset>
11.1265 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
11.1266 + <include name="**/doc-files/**"/>
11.1267 + </fileset>
11.1268 + </copy>
11.1269 + </target>
11.1270 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
11.1271 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
11.1272 + </target>
11.1273 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
11.1274 + <!--
11.1275 + =========================
11.1276 + TEST COMPILATION SECTION
11.1277 + =========================
11.1278 + -->
11.1279 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
11.1280 + <mkdir dir="${build.test.classes.dir}"/>
11.1281 + </target>
11.1282 + <target name="-pre-compile-test">
11.1283 + <!-- Empty placeholder for easier customization. -->
11.1284 + <!-- You can override this target in the ../build.xml file. -->
11.1285 + </target>
11.1286 + <target if="do.depend.true" name="-compile-test-depend">
11.1287 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
11.1288 + </target>
11.1289 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
11.1290 + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
11.1291 + <copy todir="${build.test.classes.dir}">
11.1292 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
11.1293 + </copy>
11.1294 + </target>
11.1295 + <target name="-post-compile-test">
11.1296 + <!-- Empty placeholder for easier customization. -->
11.1297 + <!-- You can override this target in the ../build.xml file. -->
11.1298 + </target>
11.1299 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
11.1300 + <target name="-pre-compile-test-single">
11.1301 + <!-- Empty placeholder for easier customization. -->
11.1302 + <!-- You can override this target in the ../build.xml file. -->
11.1303 + </target>
11.1304 + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
11.1305 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
11.1306 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
11.1307 + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
11.1308 + <copy todir="${build.test.classes.dir}">
11.1309 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
11.1310 + </copy>
11.1311 + </target>
11.1312 + <target name="-post-compile-test-single">
11.1313 + <!-- Empty placeholder for easier customization. -->
11.1314 + <!-- You can override this target in the ../build.xml file. -->
11.1315 + </target>
11.1316 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
11.1317 + <!--
11.1318 + =======================
11.1319 + TEST EXECUTION SECTION
11.1320 + =======================
11.1321 + -->
11.1322 + <target depends="init" if="have.tests" name="-pre-test-run">
11.1323 + <mkdir dir="${build.test.results.dir}"/>
11.1324 + </target>
11.1325 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
11.1326 + <j2seproject3:test testincludes="**/*Test.java"/>
11.1327 + </target>
11.1328 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
11.1329 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
11.1330 + </target>
11.1331 + <target depends="init" if="have.tests" name="test-report"/>
11.1332 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
11.1333 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
11.1334 + <target depends="init" if="have.tests" name="-pre-test-run-single">
11.1335 + <mkdir dir="${build.test.results.dir}"/>
11.1336 + </target>
11.1337 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
11.1338 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
11.1339 + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
11.1340 + </target>
11.1341 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
11.1342 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
11.1343 + </target>
11.1344 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
11.1345 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
11.1346 + <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
11.1347 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
11.1348 + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
11.1349 + </target>
11.1350 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
11.1351 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
11.1352 + </target>
11.1353 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
11.1354 + <!--
11.1355 + =======================
11.1356 + TEST DEBUGGING SECTION
11.1357 + =======================
11.1358 + -->
11.1359 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
11.1360 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
11.1361 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
11.1362 + </target>
11.1363 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
11.1364 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
11.1365 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
11.1366 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
11.1367 + </target>
11.1368 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
11.1369 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
11.1370 + </target>
11.1371 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
11.1372 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
11.1373 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
11.1374 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
11.1375 + </target>
11.1376 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
11.1377 + <!--
11.1378 + =========================
11.1379 + APPLET EXECUTION SECTION
11.1380 + =========================
11.1381 + -->
11.1382 + <target depends="init,compile-single" name="run-applet">
11.1383 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
11.1384 + <j2seproject1:java classname="sun.applet.AppletViewer">
11.1385 + <customize>
11.1386 + <arg value="${applet.url}"/>
11.1387 + </customize>
11.1388 + </j2seproject1:java>
11.1389 + </target>
11.1390 + <!--
11.1391 + =========================
11.1392 + APPLET DEBUGGING SECTION
11.1393 + =========================
11.1394 + -->
11.1395 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
11.1396 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
11.1397 + <j2seproject3:debug classname="sun.applet.AppletViewer">
11.1398 + <customize>
11.1399 + <arg value="${applet.url}"/>
11.1400 + </customize>
11.1401 + </j2seproject3:debug>
11.1402 + </target>
11.1403 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
11.1404 + <!--
11.1405 + ===============
11.1406 + CLEANUP SECTION
11.1407 + ===============
11.1408 + -->
11.1409 + <target name="-deps-clean-init" unless="built-clean.properties">
11.1410 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
11.1411 + <delete file="${built-clean.properties}" quiet="true"/>
11.1412 + </target>
11.1413 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
11.1414 + <echo level="warn" message="Cycle detected: resolve.web.api was already built"/>
11.1415 + </target>
11.1416 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
11.1417 + <mkdir dir="${build.dir}"/>
11.1418 + <touch file="${built-clean.properties}" verbose="false"/>
11.1419 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
11.1420 + <antcall target="-warn-already-built-clean"/>
11.1421 + <propertyfile file="${built-clean.properties}">
11.1422 + <entry key="${basedir}" value=""/>
11.1423 + </propertyfile>
11.1424 + <antcall target="-maybe-call-dep">
11.1425 + <param name="call.built.properties" value="${built-clean.properties}"/>
11.1426 + <param location="${project.base_web_api}" name="call.subproject"/>
11.1427 + <param location="${project.base_web_api}/build.xml" name="call.script"/>
11.1428 + <param name="call.target" value="clean"/>
11.1429 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
11.1430 + </antcall>
11.1431 + <antcall target="-maybe-call-dep">
11.1432 + <param name="call.built.properties" value="${built-clean.properties}"/>
11.1433 + <param location="${project.source_web_api}" name="call.subproject"/>
11.1434 + <param location="${project.source_web_api}/build.xml" name="call.script"/>
11.1435 + <param name="call.target" value="clean"/>
11.1436 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
11.1437 + </antcall>
11.1438 + </target>
11.1439 + <target depends="init" name="-do-clean">
11.1440 + <delete dir="${build.dir}"/>
11.1441 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
11.1442 + </target>
11.1443 + <target name="-post-clean">
11.1444 + <!-- Empty placeholder for easier customization. -->
11.1445 + <!-- You can override this target in the ../build.xml file. -->
11.1446 + </target>
11.1447 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
11.1448 + <target name="-check-call-dep">
11.1449 + <property file="${call.built.properties}" prefix="already.built."/>
11.1450 + <condition property="should.call.dep">
11.1451 + <and>
11.1452 + <not>
11.1453 + <isset property="already.built.${call.subproject}"/>
11.1454 + </not>
11.1455 + <available file="${call.script}"/>
11.1456 + </and>
11.1457 + </condition>
11.1458 + </target>
11.1459 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
11.1460 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
11.1461 + <propertyset>
11.1462 + <propertyref prefix="transfer."/>
11.1463 + <mapper from="transfer.*" to="*" type="glob"/>
11.1464 + </propertyset>
11.1465 + </ant>
11.1466 + </target>
11.1467 +</project>
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/remoting/server/web/resolve.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
12.3 @@ -0,0 +1,8 @@
12.4 +build.xml.data.CRC32=6b9c67e4
12.5 +build.xml.script.CRC32=7afd01f6
12.6 +build.xml.stylesheet.CRC32=28e38971@1.56.0.46
12.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
12.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
12.9 +nbproject/build-impl.xml.data.CRC32=6b9c67e4
12.10 +nbproject/build-impl.xml.script.CRC32=ce04aacf
12.11 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.0.46
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/remoting/server/web/resolve.web.api/nbproject/project.properties Fri Nov 30 18:49:18 2012 +0100
13.3 @@ -0,0 +1,92 @@
13.4 +annotation.processing.enabled=true
13.5 +annotation.processing.enabled.in.editor=false
13.6 +annotation.processing.processor.options=
13.7 +annotation.processing.processors.list=
13.8 +annotation.processing.run.all.processors=true
13.9 +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
13.10 +build.classes.dir=${build.dir}/classes
13.11 +build.classes.excludes=**/*.java,**/*.form
13.12 +# This directory is removed when the project is cleaned:
13.13 +build.dir=build
13.14 +build.generated.dir=${build.dir}/generated
13.15 +build.generated.sources.dir=${build.dir}/generated-sources
13.16 +# Only compile against the classpath explicitly listed here:
13.17 +build.sysclasspath=ignore
13.18 +build.test.classes.dir=${build.dir}/test/classes
13.19 +build.test.results.dir=${build.dir}/test/results
13.20 +# Uncomment to specify the preferred debugger connection transport:
13.21 +#debug.transport=dt_socket
13.22 +debug.classpath=\
13.23 + ${run.classpath}
13.24 +debug.test.classpath=\
13.25 + ${run.test.classpath}
13.26 +# This directory is removed when the project is cleaned:
13.27 +dist.dir=dist
13.28 +dist.jar=${dist.dir}/resolve.web.api.jar
13.29 +dist.javadoc.dir=${dist.dir}/javadoc
13.30 +excludes=
13.31 +file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
13.32 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
13.33 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
13.34 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
13.35 +file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
13.36 +file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
13.37 +includes=**
13.38 +jar.compress=false
13.39 +javac.classpath=\
13.40 + ${file.reference.org-netbeans-modules-parsing-lucene.jar}:\
13.41 + ${reference.base_web_api.jar}:\
13.42 + ${libs.jersey.classpath}:\
13.43 + ${file.reference.org-netbeans-modules-parsing-api.jar}:\
13.44 + ${file.reference.org-openide-filesystems.jar}:\
13.45 + ${libs.lucene.classpath}:\
13.46 + ${libs.javac.classpath}:\
13.47 + ${reference.source_web_api.jar}:\
13.48 + ${file.reference.org-netbeans-modules-java-source.jar}:\
13.49 + ${file.reference.util-commons.jar}:\
13.50 + ${file.reference.util-pojson.jar}
13.51 +# Space-separated list of extra javac options
13.52 +javac.compilerargs=
13.53 +javac.deprecation=false
13.54 +javac.processorpath=\
13.55 + ${javac.classpath}
13.56 +javac.source=1.6
13.57 +javac.target=1.6
13.58 +javac.test.classpath=\
13.59 + ${javac.classpath}:\
13.60 + ${build.classes.dir}
13.61 +javac.test.processorpath=\
13.62 + ${javac.test.classpath}
13.63 +javadoc.additionalparam=
13.64 +javadoc.author=false
13.65 +javadoc.encoding=${source.encoding}
13.66 +javadoc.noindex=false
13.67 +javadoc.nonavbar=false
13.68 +javadoc.notree=false
13.69 +javadoc.private=false
13.70 +javadoc.splitindex=true
13.71 +javadoc.use=true
13.72 +javadoc.version=false
13.73 +javadoc.windowtitle=
13.74 +main.class=
13.75 +manifest.file=manifest.mf
13.76 +meta.inf.dir=${src.dir}/META-INF
13.77 +mkdist.disabled=false
13.78 +platform.active=default_platform
13.79 +project.base_web_api=../base.web.api
13.80 +project.source_web_api=../source.web.api
13.81 +reference.base_web_api.jar=${project.base_web_api}/dist/base.web.api.jar
13.82 +reference.source_web_api.jar=${project.source_web_api}/dist/source.web.api.jar
13.83 +run.classpath=\
13.84 + ${javac.classpath}:\
13.85 + ${build.classes.dir}
13.86 +# Space-separated list of JVM arguments used when running the project
13.87 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
13.88 +# or test-sys-prop.name=value to set system properties for unit tests):
13.89 +run.jvmargs=
13.90 +run.test.classpath=\
13.91 + ${javac.test.classpath}:\
13.92 + ${build.test.classes.dir}
13.93 +source.encoding=UTF-8
13.94 +src.dir=src
13.95 +test.src.dir=test
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/remoting/server/web/resolve.web.api/nbproject/project.xml Fri Nov 30 18:49:18 2012 +0100
14.3 @@ -0,0 +1,36 @@
14.4 +<?xml version="1.0" encoding="UTF-8"?>
14.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
14.6 + <type>org.netbeans.modules.java.j2seproject</type>
14.7 + <configuration>
14.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
14.9 + <name>resolve.web.api</name>
14.10 + <source-roots>
14.11 + <root id="src.dir"/>
14.12 + </source-roots>
14.13 + <test-roots>
14.14 + <root id="test.src.dir"/>
14.15 + </test-roots>
14.16 + </data>
14.17 + <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
14.18 + <definitions>../../../../lib/nblibraries.properties</definitions>
14.19 + </libraries>
14.20 + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
14.21 + <reference>
14.22 + <foreign-project>base_web_api</foreign-project>
14.23 + <artifact-type>jar</artifact-type>
14.24 + <script>build.xml</script>
14.25 + <target>jar</target>
14.26 + <clean-target>clean</clean-target>
14.27 + <id>jar</id>
14.28 + </reference>
14.29 + <reference>
14.30 + <foreign-project>source_web_api</foreign-project>
14.31 + <artifact-type>jar</artifact-type>
14.32 + <script>build.xml</script>
14.33 + <target>jar</target>
14.34 + <clean-target>clean</clean-target>
14.35 + <id>jar</id>
14.36 + </reference>
14.37 + </references>
14.38 + </configuration>
14.39 +</project>
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/CompilationInfo.java Fri Nov 30 18:49:18 2012 +0100
15.3 @@ -0,0 +1,78 @@
15.4 +/*
15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 + *
15.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
15.8 + *
15.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
15.10 + * Other names may be trademarks of their respective owners.
15.11 + *
15.12 + * The contents of this file are subject to the terms of either the GNU
15.13 + * General Public License Version 2 only ("GPL") or the Common
15.14 + * Development and Distribution License("CDDL") (collectively, the
15.15 + * "License"). You may not use this file except in compliance with the
15.16 + * License. You can obtain a copy of the License at
15.17 + * http://www.netbeans.org/cddl-gplv2.html
15.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.19 + * specific language governing permissions and limitations under the
15.20 + * License. When distributing the software, include this License Header
15.21 + * Notice in each file and include the License file at
15.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
15.23 + * particular file as subject to the "Classpath" exception as provided
15.24 + * by Oracle in the GPL Version 2 section of the License file that
15.25 + * accompanied this code. If applicable, add the following below the
15.26 + * License Header, with the fields enclosed by brackets [] replaced by
15.27 + * your own identifying information:
15.28 + * "Portions Copyrighted [year] [name of copyright owner]"
15.29 + *
15.30 + * If you wish your version of this file to be governed by only the CDDL
15.31 + * or only the GPL Version 2, indicate your decision by adding
15.32 + * "[Contributor] elects to include this software in this distribution
15.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
15.34 + * single choice of license, a recipient has the option to distribute
15.35 + * your version of this file under either the CDDL, the GPL Version 2 or
15.36 + * to extend the choice of license to its licensees as provided above.
15.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
15.38 + * Version 2 license, then the option applies only if the new code is
15.39 + * made subject to such option by the copyright holder.
15.40 + *
15.41 + * Contributor(s):
15.42 + *
15.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
15.44 + */
15.45 +package org.netbeans.modules.jackpot30.resolve.api;
15.46 +
15.47 +import com.sun.source.tree.CompilationUnitTree;
15.48 +import com.sun.source.util.Trees;
15.49 +import javax.lang.model.util.Elements;
15.50 +import javax.lang.model.util.Types;
15.51 +
15.52 +/**
15.53 + *
15.54 + * @author lahvac
15.55 + */
15.56 +public class CompilationInfo {
15.57 +
15.58 + private final Javac javac;
15.59 + private final CompilationUnitTree cut;
15.60 +
15.61 + public CompilationInfo(Javac javac, CompilationUnitTree cut) {
15.62 + this.javac = javac;
15.63 + this.cut = cut;
15.64 + }
15.65 +
15.66 + public /*@NonNull*/ Trees getTrees() {
15.67 + return Trees.instance(javac.getTask());
15.68 + }
15.69 +
15.70 + public /*@NonNull*/ Types getTypes() {
15.71 + return javac.getTask().getTypes();
15.72 + }
15.73 +
15.74 + public /*@NonNull*/ Elements getElements() {
15.75 + return javac.getTask().getElements();
15.76 + }
15.77 +
15.78 + public CompilationUnitTree getCompilationUnit() {
15.79 + return cut;
15.80 + }
15.81 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/JavaUtils.java Fri Nov 30 18:49:18 2012 +0100
16.3 @@ -0,0 +1,76 @@
16.4 +/*
16.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.6 + *
16.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
16.8 + *
16.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
16.10 + * Other names may be trademarks of their respective owners.
16.11 + *
16.12 + * The contents of this file are subject to the terms of either the GNU
16.13 + * General Public License Version 2 only ("GPL") or the Common
16.14 + * Development and Distribution License("CDDL") (collectively, the
16.15 + * "License"). You may not use this file except in compliance with the
16.16 + * License. You can obtain a copy of the License at
16.17 + * http://www.netbeans.org/cddl-gplv2.html
16.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.19 + * specific language governing permissions and limitations under the
16.20 + * License. When distributing the software, include this License Header
16.21 + * Notice in each file and include the License file at
16.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
16.23 + * particular file as subject to the "Classpath" exception as provided
16.24 + * by Oracle in the GPL Version 2 section of the License file that
16.25 + * accompanied this code. If applicable, add the following below the
16.26 + * License Header, with the fields enclosed by brackets [] replaced by
16.27 + * your own identifying information:
16.28 + * "Portions Copyrighted [year] [name of copyright owner]"
16.29 + *
16.30 + * If you wish your version of this file to be governed by only the CDDL
16.31 + * or only the GPL Version 2, indicate your decision by adding
16.32 + * "[Contributor] elects to include this software in this distribution
16.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
16.34 + * single choice of license, a recipient has the option to distribute
16.35 + * your version of this file under either the CDDL, the GPL Version 2 or
16.36 + * to extend the choice of license to its licensees as provided above.
16.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
16.38 + * Version 2 license, then the option applies only if the new code is
16.39 + * made subject to such option by the copyright holder.
16.40 + *
16.41 + * Contributor(s):
16.42 + *
16.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
16.44 + */
16.45 +package org.netbeans.modules.jackpot30.resolve.api;
16.46 +
16.47 +import java.util.EnumSet;
16.48 +import java.util.Set;
16.49 +import javax.lang.model.element.ElementKind;
16.50 +import org.netbeans.api.java.source.ElementHandle;
16.51 +import org.netbeans.api.java.source.SourceUtils;
16.52 +
16.53 +/**
16.54 + *
16.55 + * @author lahvac
16.56 + */
16.57 +public class JavaUtils {
16.58 +
16.59 + public static final Set<ElementKind> SUPPORTED_KINDS = EnumSet.of(ElementKind.PACKAGE, ElementKind.CLASS,
16.60 + ElementKind.INTERFACE, ElementKind.ENUM, ElementKind.ANNOTATION_TYPE, ElementKind.METHOD,
16.61 + ElementKind.CONSTRUCTOR, ElementKind.INSTANCE_INIT, ElementKind.STATIC_INIT,
16.62 + ElementKind.FIELD, ElementKind.ENUM_CONSTANT);
16.63 +
16.64 + public static String serialize(ElementHandle<?> h) {
16.65 + StringBuilder result = new StringBuilder();
16.66 +
16.67 + result.append(h.getKind());
16.68 +
16.69 + String[] signatures = SourceUtils.getJVMSignature(h);
16.70 +
16.71 + for (String sig : signatures) {
16.72 + result.append(":");
16.73 + result.append(sig);
16.74 + }
16.75 +
16.76 + return result.toString();
16.77 + }
16.78 +
16.79 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/Javac.java Fri Nov 30 18:49:18 2012 +0100
17.3 @@ -0,0 +1,312 @@
17.4 +/*
17.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 + *
17.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
17.8 + *
17.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
17.10 + * Other names may be trademarks of their respective owners.
17.11 + *
17.12 + * The contents of this file are subject to the terms of either the GNU
17.13 + * General Public License Version 2 only ("GPL") or the Common
17.14 + * Development and Distribution License("CDDL") (collectively, the
17.15 + * "License"). You may not use this file except in compliance with the
17.16 + * License. You can obtain a copy of the License at
17.17 + * http://www.netbeans.org/cddl-gplv2.html
17.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.19 + * specific language governing permissions and limitations under the
17.20 + * License. When distributing the software, include this License Header
17.21 + * Notice in each file and include the License file at
17.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
17.23 + * particular file as subject to the "Classpath" exception as provided
17.24 + * by Oracle in the GPL Version 2 section of the License file that
17.25 + * accompanied this code. If applicable, add the following below the
17.26 + * License Header, with the fields enclosed by brackets [] replaced by
17.27 + * your own identifying information:
17.28 + * "Portions Copyrighted [year] [name of copyright owner]"
17.29 + *
17.30 + * If you wish your version of this file to be governed by only the CDDL
17.31 + * or only the GPL Version 2, indicate your decision by adding
17.32 + * "[Contributor] elects to include this software in this distribution
17.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
17.34 + * single choice of license, a recipient has the option to distribute
17.35 + * your version of this file under either the CDDL, the GPL Version 2 or
17.36 + * to extend the choice of license to its licensees as provided above.
17.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
17.38 + * Version 2 license, then the option applies only if the new code is
17.39 + * made subject to such option by the copyright holder.
17.40 + *
17.41 + * Contributor(s):
17.42 + *
17.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
17.44 + */
17.45 +package org.netbeans.modules.jackpot30.resolve.api;
17.46 +
17.47 +import com.sun.source.tree.CompilationUnitTree;
17.48 +import com.sun.source.util.JavacTask;
17.49 +import com.sun.tools.javac.api.JavacTaskImpl;
17.50 +import java.io.IOException;
17.51 +import java.io.InputStream;
17.52 +import java.io.OutputStream;
17.53 +import java.io.Reader;
17.54 +import java.io.Writer;
17.55 +import java.lang.ref.Reference;
17.56 +import java.lang.ref.SoftReference;
17.57 +import java.net.URI;
17.58 +import java.util.ArrayList;
17.59 +import java.util.Arrays;
17.60 +import java.util.Collection;
17.61 +import java.util.Collections;
17.62 +import java.util.HashMap;
17.63 +import java.util.Iterator;
17.64 +import java.util.List;
17.65 +import java.util.Map;
17.66 +import java.util.Set;
17.67 +import java.util.WeakHashMap;
17.68 +import javax.lang.model.element.Modifier;
17.69 +import javax.lang.model.element.NestingKind;
17.70 +import javax.tools.FileObject;
17.71 +import javax.tools.JavaFileManager;
17.72 +import javax.tools.JavaFileManager.Location;
17.73 +import javax.tools.JavaFileObject;
17.74 +import javax.tools.JavaFileObject.Kind;
17.75 +import javax.tools.SimpleJavaFileObject;
17.76 +import javax.tools.StandardLocation;
17.77 +import javax.tools.ToolProvider;
17.78 +import org.netbeans.modules.jackpot30.backend.base.SourceRoot;
17.79 +
17.80 +/**
17.81 + *
17.82 + * @author lahvac
17.83 + */
17.84 +public class Javac {
17.85 + private static final Map<SourceRoot, Reference<Javac>> category2Javac = new WeakHashMap<SourceRoot, Reference<Javac>>();
17.86 +
17.87 + static synchronized Javac get(SourceRoot sourceRoot) {
17.88 + Reference<Javac> javacSR = category2Javac.get(sourceRoot);
17.89 + Javac javac = javacSR != null ? javacSR.get() : null;
17.90 +
17.91 + if (javac == null) {
17.92 + category2Javac.put(sourceRoot, new SoftReference<Javac>(javac = new Javac(sourceRoot)));
17.93 + }
17.94 +
17.95 + return javac;
17.96 + }
17.97 +
17.98 + private final SourceRoot sourceRoot;
17.99 + private final JavacTaskImpl javacTask;
17.100 + private final Map<String, CompilationInfo> path2CUT = new HashMap<String, CompilationInfo>();
17.101 +
17.102 + private Javac(SourceRoot sourceRoot) {
17.103 + this.sourceRoot = sourceRoot;
17.104 + FMImpl fm = new FMImpl(sourceRoot.getClassPath());
17.105 + this.javacTask = (JavacTaskImpl) ToolProvider.getSystemJavaCompiler().getTask(null, fm, null, Arrays.asList("-Xjcov", "-proc:none"), null, Collections.<JavaFileObject>emptyList());
17.106 + }
17.107 +
17.108 +
17.109 + public CompilationInfo parse(String relativePath) throws IOException, InterruptedException {
17.110 + CompilationInfo result = path2CUT.get(relativePath);
17.111 +
17.112 + if (result == null) {
17.113 + String content = org.netbeans.modules.jackpot30.source.api.API.readFileContent(sourceRoot.getCategory(), relativePath);
17.114 + Iterable<? extends CompilationUnitTree> cuts = javacTask.parse(new FileObjectImpl(relativePath, content));
17.115 + CompilationUnitTree cut = cuts.iterator().next();
17.116 +
17.117 + javacTask.analyze(javacTask.enter(Collections.singletonList(cut)));
17.118 +
17.119 + path2CUT.put(relativePath, result = new CompilationInfo(this, cut));
17.120 + }
17.121 +
17.122 + return result;
17.123 + }
17.124 +
17.125 + public JavacTask getTask() {
17.126 + return javacTask;
17.127 + }
17.128 +
17.129 + private static class FileObjectImpl extends SimpleJavaFileObject {
17.130 + private String text;
17.131 + public FileObjectImpl(String relativePath, String text) {
17.132 + super(URI.create("myfo:/" + relativePath), JavaFileObject.Kind.SOURCE);
17.133 + this.text = text;
17.134 + }
17.135 + public CharSequence getCharContent(boolean ignoreEncodingErrors) {
17.136 + return text;
17.137 + }
17.138 + }
17.139 +
17.140 + private static final class FMImpl implements JavaFileManager {
17.141 +
17.142 + private final Collection<org.openide.filesystems.FileObject> classpath;
17.143 + private final Map<org.openide.filesystems.FileObject, JFOImpl> files = new HashMap<org.openide.filesystems.FileObject, JFOImpl>();
17.144 +
17.145 + public FMImpl(Collection<org.openide.filesystems.FileObject> classpath) {
17.146 + this.classpath = classpath;
17.147 + }
17.148 +
17.149 + @Override
17.150 + public ClassLoader getClassLoader(Location location) {
17.151 + throw new UnsupportedOperationException("Not supported yet.");
17.152 + }
17.153 +
17.154 + @Override
17.155 + public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
17.156 + assert !recurse;
17.157 + if (!kinds.contains(Kind.CLASS) || location != StandardLocation.CLASS_PATH) return Collections.emptyList();
17.158 +
17.159 + String dir = packageName.replace('.', '/');
17.160 + List<JavaFileObject> result = new ArrayList<JavaFileObject>();
17.161 +
17.162 + for (org.openide.filesystems.FileObject root : classpath) {
17.163 + org.openide.filesystems.FileObject dirFO = root.getFileObject(dir);
17.164 +
17.165 + if (dirFO != null) {
17.166 + for (org.openide.filesystems.FileObject f : dirFO.getChildren()) {
17.167 + if (!f.isData()) continue;
17.168 +
17.169 + JFOImpl jfo = files.get(f);
17.170 +
17.171 + if (jfo == null) {
17.172 + files.put(f, jfo = new JFOImpl(f, packageName + "." + f.getName()));
17.173 + }
17.174 +
17.175 + result.add(jfo);
17.176 + }
17.177 + }
17.178 + }
17.179 +
17.180 + return result;
17.181 + }
17.182 +
17.183 + @Override
17.184 + public String inferBinaryName(Location location, JavaFileObject file) {
17.185 + return ((JFOImpl) file).binaryName;
17.186 + }
17.187 +
17.188 + @Override
17.189 + public boolean isSameFile(FileObject a, FileObject b) {
17.190 + throw new UnsupportedOperationException("Not supported yet.");
17.191 + }
17.192 +
17.193 + @Override
17.194 + public boolean handleOption(String current, Iterator<String> remaining) {
17.195 + throw new UnsupportedOperationException("Not supported yet.");
17.196 + }
17.197 +
17.198 + @Override
17.199 + public boolean hasLocation(Location location) {
17.200 + return StandardLocation.CLASS_PATH == location;
17.201 + }
17.202 +
17.203 + @Override
17.204 + public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
17.205 + throw new UnsupportedOperationException("Not supported yet.");
17.206 + }
17.207 +
17.208 + @Override
17.209 + public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
17.210 + throw new UnsupportedOperationException("Not supported yet.");
17.211 + }
17.212 +
17.213 + @Override
17.214 + public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
17.215 + throw new UnsupportedOperationException("Not supported yet.");
17.216 + }
17.217 +
17.218 + @Override
17.219 + public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
17.220 + throw new UnsupportedOperationException("Not supported yet.");
17.221 + }
17.222 +
17.223 + @Override
17.224 + public void flush() throws IOException {
17.225 + throw new UnsupportedOperationException("Not supported yet.");
17.226 + }
17.227 +
17.228 + @Override
17.229 + public void close() throws IOException {
17.230 + throw new UnsupportedOperationException("Not supported yet.");
17.231 + }
17.232 +
17.233 + @Override
17.234 + public int isSupportedOption(String option) {
17.235 + throw new UnsupportedOperationException("Not supported yet.");
17.236 + }
17.237 + }
17.238 +
17.239 + private static final class JFOImpl implements JavaFileObject {
17.240 +
17.241 + private final org.openide.filesystems.FileObject file;
17.242 + private final String binaryName;
17.243 +
17.244 + public JFOImpl(org.openide.filesystems.FileObject file, String binaryName) {
17.245 + this.file = file;
17.246 + this.binaryName = binaryName;
17.247 + }
17.248 +
17.249 + @Override
17.250 + public Kind getKind() {
17.251 + return Kind.CLASS;
17.252 + }
17.253 +
17.254 + @Override
17.255 + public boolean isNameCompatible(String simpleName, Kind kind) {
17.256 + throw new UnsupportedOperationException("Not supported yet.");
17.257 + }
17.258 +
17.259 + @Override
17.260 + public NestingKind getNestingKind() {
17.261 + throw new UnsupportedOperationException("Not supported yet.");
17.262 + }
17.263 +
17.264 + @Override
17.265 + public Modifier getAccessLevel() {
17.266 + throw new UnsupportedOperationException("Not supported yet.");
17.267 + }
17.268 +
17.269 + @Override
17.270 + public URI toUri() {
17.271 + throw new UnsupportedOperationException("Not supported yet.");
17.272 + }
17.273 +
17.274 + @Override
17.275 + public String getName() {
17.276 + return file.getName();
17.277 + }
17.278 +
17.279 + @Override
17.280 + public InputStream openInputStream() throws IOException {
17.281 + return file.getInputStream();
17.282 + }
17.283 +
17.284 + @Override
17.285 + public OutputStream openOutputStream() throws IOException {
17.286 + throw new UnsupportedOperationException("Not supported yet.");
17.287 + }
17.288 +
17.289 + @Override
17.290 + public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
17.291 + throw new UnsupportedOperationException("Not supported yet.");
17.292 + }
17.293 +
17.294 + @Override
17.295 + public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
17.296 + throw new UnsupportedOperationException("Not supported yet.");
17.297 + }
17.298 +
17.299 + @Override
17.300 + public Writer openWriter() throws IOException {
17.301 + throw new UnsupportedOperationException("Not supported yet.");
17.302 + }
17.303 +
17.304 + @Override
17.305 + public long getLastModified() {
17.306 + throw new UnsupportedOperationException("Not supported yet.");
17.307 + }
17.308 +
17.309 + @Override
17.310 + public boolean delete() {
17.311 + throw new UnsupportedOperationException("Not supported yet.");
17.312 + }
17.313 +
17.314 + }
17.315 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/remoting/server/web/resolve.web.api/src/org/netbeans/modules/jackpot30/resolve/api/ResolveService.java Fri Nov 30 18:49:18 2012 +0100
18.3 @@ -0,0 +1,295 @@
18.4 +/*
18.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 + *
18.7 + * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
18.8 + *
18.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
18.10 + * Other names may be trademarks of their respective owners.
18.11 + *
18.12 + * The contents of this file are subject to the terms of either the GNU
18.13 + * General Public License Version 2 only ("GPL") or the Common
18.14 + * Development and Distribution License("CDDL") (collectively, the
18.15 + * "License"). You may not use this file except in compliance with the
18.16 + * License. You can obtain a copy of the License at
18.17 + * http://www.netbeans.org/cddl-gplv2.html
18.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.19 + * specific language governing permissions and limitations under the
18.20 + * License. When distributing the software, include this License Header
18.21 + * Notice in each file and include the License file at
18.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18.23 + * particular file as subject to the "Classpath" exception as provided
18.24 + * by Oracle in the GPL Version 2 section of the License file that
18.25 + * accompanied this code. If applicable, add the following below the
18.26 + * License Header, with the fields enclosed by brackets [] replaced by
18.27 + * your own identifying information:
18.28 + * "Portions Copyrighted [year] [name of copyright owner]"
18.29 + *
18.30 + * If you wish your version of this file to be governed by only the CDDL
18.31 + * or only the GPL Version 2, indicate your decision by adding
18.32 + * "[Contributor] elects to include this software in this distribution
18.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
18.34 + * single choice of license, a recipient has the option to distribute
18.35 + * your version of this file under either the CDDL, the GPL Version 2 or
18.36 + * to extend the choice of license to its licensees as provided above.
18.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
18.38 + * Version 2 license, then the option applies only if the new code is
18.39 + * made subject to such option by the copyright holder.
18.40 + *
18.41 + * Contributor(s):
18.42 + *
18.43 + * Portions Copyrighted 2012 Sun Microsystems, Inc.
18.44 + */
18.45 +package org.netbeans.modules.jackpot30.resolve.api;
18.46 +
18.47 +import com.sun.source.tree.ClassTree;
18.48 +import com.sun.source.tree.IdentifierTree;
18.49 +import com.sun.source.tree.MemberSelectTree;
18.50 +import com.sun.source.tree.MethodTree;
18.51 +import com.sun.source.tree.Tree;
18.52 +import com.sun.source.tree.VariableTree;
18.53 +import com.sun.source.util.TreePath;
18.54 +import com.sun.source.util.TreePathScanner;
18.55 +import com.sun.tools.javac.tree.JCTree;
18.56 +import java.io.IOException;
18.57 +import java.io.InputStream;
18.58 +import java.util.ArrayList;
18.59 +import java.util.Arrays;
18.60 +import java.util.HashMap;
18.61 +import java.util.List;
18.62 +import java.util.Map;
18.63 +import java.util.Properties;
18.64 +import javax.lang.model.element.Element;
18.65 +import org.netbeans.api.java.source.ElementHandle;
18.66 +import org.netbeans.modules.jackpot30.backend.base.CategoryStorage;
18.67 +import org.netbeans.modules.jackpot30.backend.base.SourceRoot;
18.68 +import org.openide.filesystems.FileObject;
18.69 +
18.70 +/**
18.71 + *
18.72 + * @author lahvac
18.73 + */
18.74 +public class ResolveService {
18.75 +
18.76 + static SourceRoot sourceRoot(CategoryStorage category, String relativePath) {
18.77 + for (SourceRoot sr : category.getSourceRoots()) {
18.78 + if (relativePath.startsWith(sr.getRelativePath())) {
18.79 + return sr;
18.80 + }
18.81 + }
18.82 +
18.83 + throw new IllegalStateException();
18.84 + }
18.85 +
18.86 + Javac javacFor(String segment, String relative) throws IOException, InterruptedException {
18.87 + CategoryStorage category = CategoryStorage.forId(segment);
18.88 + return Javac.get(sourceRoot(category, relative));
18.89 + }
18.90 +
18.91 + public static CompilationInfo parse(String segment, String relative) throws IOException, InterruptedException {
18.92 + CategoryStorage category = CategoryStorage.forId(segment);
18.93 + Javac javac = Javac.get(sourceRoot(category, relative));
18.94 + return javac.parse(relative);
18.95 + }
18.96 +
18.97 + /**Long or String*/
18.98 + public static Object resolveGoToTarget(final CompilationInfo info, final long pos) throws IOException, InterruptedException {
18.99 + final Object[] result = new Object[1];
18.100 +
18.101 + new TreePathScanner<Void, Void>() {
18.102 + @Override public Void visitIdentifier(IdentifierTree node, Void p) {
18.103 + handle();
18.104 + return super.visitIdentifier(node, p);
18.105 + }
18.106 + @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
18.107 + handle();
18.108 + return super.visitMemberSelect(node, p);
18.109 + }
18.110 + private void handle() {
18.111 + Element el = info.getTrees().getElement(getCurrentPath());
18.112 +
18.113 + if (el == null) return;
18.114 +
18.115 + long[] span = nameSpan(info, getCurrentPath());
18.116 +
18.117 + if (span[0] <= pos && pos <= span[1]) {
18.118 + TreePath tp = info.getTrees().getPath(el);
18.119 +
18.120 + if (tp != null && tp.getCompilationUnit() == info.getCompilationUnit()) {
18.121 + result[0] = info.getTrees().getSourcePositions().getStartPosition(tp.getCompilationUnit(), tp.getLeaf());
18.122 + } else {
18.123 + assert JavaUtils.SUPPORTED_KINDS.contains(el.getKind());
18.124 +
18.125 + result[0] = JavaUtils.serialize(ElementHandle.create(el));
18.126 + }
18.127 + }
18.128 + }
18.129 + }.scan(info.getCompilationUnit(), null);
18.130 +
18.131 + return result[0];
18.132 + }
18.133 +
18.134 + public static String resolveSource(String segment, String relative, String signature) throws IOException, InterruptedException {
18.135 + String fqn = signature.split(":")[1];
18.136 + SourceRoot sourceRoot = sourceRoot(CategoryStorage.forId(segment), relative);
18.137 + List<String> classpathElements = new ArrayList<String>();
18.138 +
18.139 + classpathElements.add(sourceRoot.getCode());
18.140 +
18.141 + String classpath = sourceRoot.getClassPathString();
18.142 +
18.143 + if (classpath != null) classpathElements.addAll(Arrays.asList(classpath.split(":")));
18.144 +
18.145 + for (String element : classpathElements) {
18.146 + if (element.endsWith(".jar")) continue;
18.147 +
18.148 + String file = fileForFQN(sourceRoot.getCategory(), element, fqn);
18.149 +
18.150 + if (file != null) {
18.151 + return file;
18.152 + }
18.153 + }
18.154 +
18.155 + return null;
18.156 + }
18.157 +
18.158 + public static Map<? extends CategoryStorage, ? extends Iterable<? extends String>> findSourcesContaining(String signature) throws IOException, InterruptedException {
18.159 + Map<CategoryStorage, Iterable<? extends String>> result = new HashMap<CategoryStorage, Iterable<? extends String>>();
18.160 + String fqn = signature.split(":")[1];
18.161 +
18.162 + for (CategoryStorage category : CategoryStorage.listCategories()) {
18.163 + //would it be faster to check if the given class is in the current category?
18.164 +
18.165 + List<String> files = new ArrayList<String>();
18.166 +
18.167 + for (SourceRoot sourceRoot : category.getSourceRoots()) {
18.168 + String file = fileForFQN(category, sourceRoot.getCode(), fqn);
18.169 +
18.170 + if (file != null) {
18.171 + files.add(file);
18.172 + }
18.173 + }
18.174 +
18.175 + if (!files.isEmpty()) {
18.176 + result.put(category, files);
18.177 + }
18.178 + }
18.179 +
18.180 + return result;
18.181 + }
18.182 +
18.183 + private static String fileForFQN(CategoryStorage category, String code, String fqn) throws IOException {
18.184 + FileObject root = category.getEmbeddedJarRoot(code);
18.185 + FileObject fqn2files = root != null ? root.getFileObject("java/14/fqn2files.properties") : null;
18.186 +
18.187 + if (fqn2files == null) return null;
18.188 +
18.189 + Properties props = new Properties();
18.190 + InputStream in = fqn2files.getInputStream();
18.191 +
18.192 + try {
18.193 + props.load(in);
18.194 + } finally {
18.195 + in.close();
18.196 + }
18.197 +
18.198 + String file = props.getProperty(fqn);
18.199 +
18.200 + if (file != null) {
18.201 + return file.substring("rel:/".length());
18.202 + }
18.203 +
18.204 + return null;
18.205 + }
18.206 +
18.207 + public static long[] nameSpan(CompilationInfo info, TreePath forTree) {
18.208 + JCTree jcTree = (JCTree) forTree.getLeaf(); //XXX
18.209 + CharSequence name = null;
18.210 +
18.211 + switch (forTree.getLeaf().getKind()) {
18.212 + case IDENTIFIER: name = ((IdentifierTree) forTree.getLeaf()).getName(); break;
18.213 + case MEMBER_SELECT: name = ((MemberSelectTree) forTree.getLeaf()).getIdentifier(); break;
18.214 + }
18.215 +
18.216 + if (name != null) {
18.217 + return new long[] {
18.218 + info.getTrees().getSourcePositions().getStartPosition(forTree.getCompilationUnit(), forTree.getLeaf()),
18.219 + info.getTrees().getSourcePositions().getEndPosition(forTree.getCompilationUnit(), forTree.getLeaf()),
18.220 + jcTree.pos,
18.221 + jcTree.pos + name.length()
18.222 + };
18.223 + }
18.224 +
18.225 + return new long[] {
18.226 + info.getTrees().getSourcePositions().getStartPosition(forTree.getCompilationUnit(), forTree.getLeaf()),
18.227 + info.getTrees().getSourcePositions().getEndPosition(forTree.getCompilationUnit(), forTree.getLeaf()),
18.228 + info.getTrees().getSourcePositions().getStartPosition(forTree.getCompilationUnit(), forTree.getLeaf()),
18.229 + info.getTrees().getSourcePositions().getEndPosition(forTree.getCompilationUnit(), forTree.getLeaf())
18.230 + };
18.231 + }
18.232 +
18.233 + public static long[] declarationSpans(final CompilationInfo info, final String signature) {
18.234 + final long[][] result = new long[1][];
18.235 +
18.236 + new TreePathScanner<Void, Void>() {
18.237 + @Override public Void visitClass(ClassTree node, Void p) {
18.238 + handleDeclaration(node.getSimpleName());
18.239 + return super.visitClass(node, p);
18.240 + }
18.241 + @Override public Void visitMethod(MethodTree node, Void p) {
18.242 + handleDeclaration(node.getName());
18.243 + return super.visitMethod(node, p);
18.244 + }
18.245 + @Override public Void visitVariable(VariableTree node, Void p) {
18.246 + handleDeclaration(node.getName());
18.247 + return super.visitVariable(node, p);
18.248 + }
18.249 + private void handleDeclaration(CharSequence name) {
18.250 + Element el = info.getTrees().getElement(getCurrentPath());
18.251 +
18.252 + if (el == null/*how?*/ || !JavaUtils.SUPPORTED_KINDS.contains(el.getKind())) return ;
18.253 +
18.254 + String thisSignature = JavaUtils.serialize(ElementHandle.create(el));
18.255 + Tree node = getCurrentPath().getLeaf();
18.256 +
18.257 + if (thisSignature.equals(signature)) {
18.258 + long[] spans = new long[] {
18.259 + info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), node),
18.260 + info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), node),
18.261 + ((JCTree) node).pos,
18.262 + ((JCTree) node).pos + name.length()
18.263 + };
18.264 + result[0] = spans;
18.265 + }
18.266 + }
18.267 + }.scan(info.getCompilationUnit(), null);
18.268 +
18.269 + return result[0];
18.270 + }
18.271 +
18.272 + public static List<long[]> usages(final CompilationInfo info, final String signature) {
18.273 + final List<long[]> result = new ArrayList<long[]>();
18.274 +
18.275 + new TreePathScanner<Void, Void>() {
18.276 + @Override public Void visitIdentifier(IdentifierTree node, Void p) {
18.277 + handle();
18.278 + return super.visitIdentifier(node, p);
18.279 + }
18.280 + @Override public Void visitMemberSelect(MemberSelectTree node, Void p) {
18.281 + handle();
18.282 + return super.visitMemberSelect(node, p);
18.283 + }
18.284 + private void handle() {
18.285 + Element el = info.getTrees().getElement(getCurrentPath());
18.286 + if (el == null || !JavaUtils.SUPPORTED_KINDS.contains(el.getKind())) return;
18.287 + String thisSignature = JavaUtils.serialize(ElementHandle.create(el));
18.288 +
18.289 + if (thisSignature.equals(signature)) {
18.290 + result.add(ResolveService.nameSpan(info, getCurrentPath()));
18.291 + }
18.292 + }
18.293 + }.scan(info.getCompilationUnit(), null);
18.294 +
18.295 + return result;
18.296 + }
18.297 +
18.298 +}
19.1 --- a/remoting/server/web/source.web.api/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
19.2 +++ b/remoting/server/web/source.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
19.3 @@ -395,6 +395,11 @@
19.4 </and>
19.5 </condition>
19.6 </target>
19.7 + <target name="-init-test-properties">
19.8 + <property name="test.binaryincludes" value="<nothing>"/>
19.9 + <property name="test.binarytestincludes" value=""/>
19.10 + <property name="test.binaryexcludes" value=""/>
19.11 + </target>
19.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
19.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
19.14 <attribute default="${includes}" name="includes"/>
19.15 @@ -418,7 +423,7 @@
19.16 </sequential>
19.17 </macrodef>
19.18 </target>
19.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
19.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
19.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
19.22 <attribute default="${includes}" name="includes"/>
19.23 <attribute default="${excludes}" name="excludes"/>
19.24 @@ -432,6 +437,9 @@
19.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
19.26 <filename name="@{testincludes}"/>
19.27 </fileset>
19.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
19.29 + <filename name="${test.binarytestincludes}"/>
19.30 + </fileset>
19.31 </batchtest>
19.32 <syspropertyset>
19.33 <propertyref prefix="test-sys-prop."/>
19.34 @@ -454,42 +462,16 @@
19.35 <attribute default="" name="testmethods"/>
19.36 <element name="customize" optional="true"/>
19.37 <sequential>
19.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
19.39 - <path>
19.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
19.41 - </path>
19.42 - <chainedmapper>
19.43 - <globmapper from="*.java" to="*.class"/>
19.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
19.45 - </chainedmapper>
19.46 - </pathconvert>
19.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
19.48 - <path>
19.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
19.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
19.51 - </path>
19.52 - <chainedmapper>
19.53 - <globmapper from="*.java" to="*.class"/>
19.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
19.55 - </chainedmapper>
19.56 - </pathconvert>
19.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
19.58 - <path>
19.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
19.60 - </path>
19.61 - <chainedmapper>
19.62 - <globmapper from="*.java" to="*.class"/>
19.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
19.64 - </chainedmapper>
19.65 - </pathconvert>
19.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
19.67 <isset property="test.method"/>
19.68 </condition>
19.69 + <union id="test.set">
19.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
19.71 + <filename name="@{testincludes}"/>
19.72 + </fileset>
19.73 + </union>
19.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
19.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="source.web.api" testname="TestNG tests" workingDir="${work.dir}">
19.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
19.77 - <filename name="${testng.testincludes}"/>
19.78 - </classfileset>
19.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="source.web.api" testname="TestNG tests" workingDir="${work.dir}">
19.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
19.81 <propertyset>
19.82 <propertyref prefix="test-sys-prop."/>
19.83 @@ -560,39 +542,73 @@
19.84 </sequential>
19.85 </macrodef>
19.86 </target>
19.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
19.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
19.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
19.90 - <attribute default="${main.class}" name="testClass"/>
19.91 - <attribute default="" name="testMethod"/>
19.92 - <element name="customize2" optional="true"/>
19.93 + <attribute default="${includes}" name="includes"/>
19.94 + <attribute default="${excludes}" name="excludes"/>
19.95 + <attribute default="**" name="testincludes"/>
19.96 + <attribute default="" name="testmethods"/>
19.97 + <element name="customize" optional="true"/>
19.98 <sequential>
19.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
19.100 - <delete file="${test.report.file}"/>
19.101 - <mkdir dir="${build.test.results.dir}"/>
19.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
19.103 - <isset property="test.method"/>
19.104 - </condition>
19.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
19.106 - <customize>
19.107 - <arg value="@{testClass}"/>
19.108 - <arg value="${junit.methods.arg}"/>
19.109 - <arg value="showoutput=true"/>
19.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
19.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
19.112 - <customize2/>
19.113 - </customize>
19.114 - </j2seproject3:debug>
19.115 + <property name="junit.forkmode" value="perTest"/>
19.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
19.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
19.118 + <syspropertyset>
19.119 + <propertyref prefix="test-sys-prop."/>
19.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
19.121 + </syspropertyset>
19.122 + <formatter type="brief" usefile="false"/>
19.123 + <formatter type="xml"/>
19.124 + <jvmarg value="-ea"/>
19.125 + <jvmarg line="${debug-args-line}"/>
19.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
19.127 + <customize/>
19.128 + </junit>
19.129 </sequential>
19.130 </macrodef>
19.131 </target>
19.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
19.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
19.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
19.135 + <attribute default="${includes}" name="includes"/>
19.136 + <attribute default="${excludes}" name="excludes"/>
19.137 + <attribute default="**" name="testincludes"/>
19.138 + <attribute default="" name="testmethods"/>
19.139 + <element name="customize" optional="true"/>
19.140 + <sequential>
19.141 + <property name="junit.forkmode" value="perTest"/>
19.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
19.143 + <batchtest todir="${build.test.results.dir}">
19.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
19.145 + <filename name="@{testincludes}"/>
19.146 + </fileset>
19.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
19.148 + <filename name="${test.binarytestincludes}"/>
19.149 + </fileset>
19.150 + </batchtest>
19.151 + <syspropertyset>
19.152 + <propertyref prefix="test-sys-prop."/>
19.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
19.154 + </syspropertyset>
19.155 + <formatter type="brief" usefile="false"/>
19.156 + <formatter type="xml"/>
19.157 + <jvmarg value="-ea"/>
19.158 + <jvmarg line="${debug-args-line}"/>
19.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
19.160 + <customize/>
19.161 + </junit>
19.162 + </sequential>
19.163 + </macrodef>
19.164 + </target>
19.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
19.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
19.167 - <attribute default="${main.class}" name="testClass"/>
19.168 - <attribute default="" name="testMethod"/>
19.169 - <element implicit="true" name="customize2" optional="true"/>
19.170 + <attribute default="${includes}" name="includes"/>
19.171 + <attribute default="${excludes}" name="excludes"/>
19.172 + <attribute default="**" name="testincludes"/>
19.173 + <attribute default="" name="testmethods"/>
19.174 + <element implicit="true" name="customize" optional="true"/>
19.175 <sequential>
19.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
19.177 - <customize2/>
19.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
19.179 + <customize/>
19.180 </j2seproject3:junit-debug>
19.181 </sequential>
19.182 </macrodef>
19.183 @@ -625,7 +641,7 @@
19.184 </macrodef>
19.185 </target>
19.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
19.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
19.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
19.189 <attribute default="${main.class}" name="testClass"/>
19.190 <attribute default="" name="testMethod"/>
19.191 <element implicit="true" name="customize2" optional="true"/>
19.192 @@ -636,32 +652,62 @@
19.193 </sequential>
19.194 </macrodef>
19.195 </target>
19.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
19.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
19.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
19.199 + <attribute default="${includes}" name="includes"/>
19.200 + <attribute default="${excludes}" name="excludes"/>
19.201 + <attribute default="**" name="testincludes"/>
19.202 + <attribute default="" name="testmethods"/>
19.203 <attribute default="${main.class}" name="testClass"/>
19.204 <attribute default="" name="testMethod"/>
19.205 <sequential>
19.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
19.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
19.208 + <customize>
19.209 + <classpath>
19.210 + <path path="${run.test.classpath}"/>
19.211 + </classpath>
19.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
19.213 + <jvmarg line="${run.jvmargs}"/>
19.214 + <jvmarg line="${run.jvmargs.ide}"/>
19.215 + </customize>
19.216 + </j2seproject3:test-debug-impl>
19.217 + </sequential>
19.218 + </macrodef>
19.219 + </target>
19.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
19.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
19.222 + <attribute default="${includes}" name="includes"/>
19.223 + <attribute default="${excludes}" name="excludes"/>
19.224 + <attribute default="**" name="testincludes"/>
19.225 + <attribute default="" name="testmethods"/>
19.226 + <attribute default="${main.class}" name="testClass"/>
19.227 + <attribute default="" name="testMethod"/>
19.228 + <sequential>
19.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
19.230 <customize2>
19.231 <syspropertyset>
19.232 <propertyref prefix="test-sys-prop."/>
19.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
19.234 </syspropertyset>
19.235 </customize2>
19.236 - </j2seproject3:test-debug-impl>
19.237 + </j2seproject3:testng-debug-impl>
19.238 </sequential>
19.239 </macrodef>
19.240 </target>
19.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
19.242 - <target name="-profile-pre-init">
19.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
19.244 + <!--
19.245 + pre NB7.2 profiling section; consider it deprecated
19.246 + -->
19.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
19.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
19.249 <!-- Empty placeholder for easier customization. -->
19.250 <!-- You can override this target in the ../build.xml file. -->
19.251 </target>
19.252 - <target name="-profile-post-init">
19.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
19.254 <!-- Empty placeholder for easier customization. -->
19.255 <!-- You can override this target in the ../build.xml file. -->
19.256 </target>
19.257 - <target name="-profile-init-macrodef-profile">
19.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
19.259 <macrodef name="resolve">
19.260 <attribute name="name"/>
19.261 <attribute name="value"/>
19.262 @@ -693,10 +739,13 @@
19.263 </sequential>
19.264 </macrodef>
19.265 </target>
19.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
19.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
19.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
19.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
19.270 </target>
19.271 + <!--
19.272 + end of pre NB7.2 profiling section
19.273 + -->
19.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
19.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
19.276 <attribute default="${main.class}" name="name"/>
19.277 @@ -771,6 +820,7 @@
19.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
19.279 <attribute default="${main.class}" name="classname"/>
19.280 <attribute default="${run.classpath}" name="classpath"/>
19.281 + <attribute default="jvm" name="jvm"/>
19.282 <element name="customize" optional="true"/>
19.283 <sequential>
19.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
19.285 @@ -805,6 +855,9 @@
19.286 <path path="${run.classpath.without.build.classes.dir}"/>
19.287 <chainedmapper>
19.288 <flattenmapper/>
19.289 + <filtermapper>
19.290 + <replacestring from=" " to="%20"/>
19.291 + </filtermapper>
19.292 <globmapper from="*" to="lib/*"/>
19.293 </chainedmapper>
19.294 </pathconvert>
19.295 @@ -910,7 +963,7 @@
19.296 <target if="has.persistence.xml" name="-copy-persistence-xml">
19.297 <mkdir dir="${build.classes.dir}/META-INF"/>
19.298 <copy todir="${build.classes.dir}/META-INF">
19.299 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
19.300 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
19.301 </copy>
19.302 </target>
19.303 <target name="-post-compile">
19.304 @@ -1073,7 +1126,11 @@
19.305 PROFILING SECTION
19.306 =================
19.307 -->
19.308 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
19.309 + <!--
19.310 + pre NB7.2 profiler integration
19.311 + -->
19.312 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
19.313 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
19.314 <nbprofiledirect>
19.315 <classpath>
19.316 <path path="${run.classpath}"/>
19.317 @@ -1081,8 +1138,9 @@
19.318 </nbprofiledirect>
19.319 <profile/>
19.320 </target>
19.321 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
19.322 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
19.323 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
19.324 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
19.325 <nbprofiledirect>
19.326 <classpath>
19.327 <path path="${run.classpath}"/>
19.328 @@ -1090,12 +1148,8 @@
19.329 </nbprofiledirect>
19.330 <profile classname="${profile.class}"/>
19.331 </target>
19.332 - <!--
19.333 - =========================
19.334 - APPLET PROFILING SECTION
19.335 - =========================
19.336 - -->
19.337 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
19.338 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
19.339 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
19.340 <nbprofiledirect>
19.341 <classpath>
19.342 <path path="${run.classpath}"/>
19.343 @@ -1107,12 +1161,8 @@
19.344 </customize>
19.345 </profile>
19.346 </target>
19.347 - <!--
19.348 - =========================
19.349 - TESTS PROFILING SECTION
19.350 - =========================
19.351 - -->
19.352 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
19.353 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
19.354 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
19.355 <nbprofiledirect>
19.356 <classpath>
19.357 <path path="${run.test.classpath}"/>
19.358 @@ -1135,6 +1185,42 @@
19.359 </junit>
19.360 </target>
19.361 <!--
19.362 + end of pre NB72 profiling section
19.363 + -->
19.364 + <target if="netbeans.home" name="-profile-check">
19.365 + <condition property="profiler.configured">
19.366 + <or>
19.367 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
19.368 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
19.369 + </or>
19.370 + </condition>
19.371 + </target>
19.372 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
19.373 + <startprofiler/>
19.374 + <antcall target="run"/>
19.375 + </target>
19.376 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
19.377 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
19.378 + <startprofiler/>
19.379 + <antcall target="run-single"/>
19.380 + </target>
19.381 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
19.382 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
19.383 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
19.384 + <startprofiler/>
19.385 + <antcall target="test-single"/>
19.386 + </target>
19.387 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
19.388 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
19.389 + <startprofiler/>
19.390 + <antcal target="run-test-with-main"/>
19.391 + </target>
19.392 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
19.393 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
19.394 + <startprofiler/>
19.395 + <antcall target="run-applet"/>
19.396 + </target>
19.397 + <!--
19.398 ===============
19.399 JAVADOC SECTION
19.400 ===============
19.401 @@ -1260,13 +1346,14 @@
19.402 TEST DEBUGGING SECTION
19.403 =======================
19.404 -->
19.405 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
19.406 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
19.407 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
19.408 - <j2seproject3:test-debug testClass="${test.class}"/>
19.409 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
19.410 </target>
19.411 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
19.412 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
19.413 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
19.414 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
19.415 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
19.416 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
19.417 </target>
19.418 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
19.419 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
20.1 --- a/remoting/server/web/source.web.api/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
20.2 +++ b/remoting/server/web/source.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
20.3 @@ -4,5 +4,5 @@
20.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
20.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
20.6 nbproject/build-impl.xml.data.CRC32=52865c72
20.7 -nbproject/build-impl.xml.script.CRC32=41204d0a
20.8 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
20.9 +nbproject/build-impl.xml.script.CRC32=ad481bda
20.10 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.0.46
21.1 --- a/remoting/server/web/type.web.api/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
21.2 +++ b/remoting/server/web/type.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
21.3 @@ -395,6 +395,11 @@
21.4 </and>
21.5 </condition>
21.6 </target>
21.7 + <target name="-init-test-properties">
21.8 + <property name="test.binaryincludes" value="<nothing>"/>
21.9 + <property name="test.binarytestincludes" value=""/>
21.10 + <property name="test.binaryexcludes" value=""/>
21.11 + </target>
21.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
21.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
21.14 <attribute default="${includes}" name="includes"/>
21.15 @@ -418,7 +423,7 @@
21.16 </sequential>
21.17 </macrodef>
21.18 </target>
21.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
21.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
21.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
21.22 <attribute default="${includes}" name="includes"/>
21.23 <attribute default="${excludes}" name="excludes"/>
21.24 @@ -432,6 +437,9 @@
21.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
21.26 <filename name="@{testincludes}"/>
21.27 </fileset>
21.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
21.29 + <filename name="${test.binarytestincludes}"/>
21.30 + </fileset>
21.31 </batchtest>
21.32 <syspropertyset>
21.33 <propertyref prefix="test-sys-prop."/>
21.34 @@ -454,42 +462,16 @@
21.35 <attribute default="" name="testmethods"/>
21.36 <element name="customize" optional="true"/>
21.37 <sequential>
21.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
21.39 - <path>
21.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
21.41 - </path>
21.42 - <chainedmapper>
21.43 - <globmapper from="*.java" to="*.class"/>
21.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
21.45 - </chainedmapper>
21.46 - </pathconvert>
21.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
21.48 - <path>
21.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
21.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
21.51 - </path>
21.52 - <chainedmapper>
21.53 - <globmapper from="*.java" to="*.class"/>
21.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
21.55 - </chainedmapper>
21.56 - </pathconvert>
21.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
21.58 - <path>
21.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
21.60 - </path>
21.61 - <chainedmapper>
21.62 - <globmapper from="*.java" to="*.class"/>
21.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
21.64 - </chainedmapper>
21.65 - </pathconvert>
21.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
21.67 <isset property="test.method"/>
21.68 </condition>
21.69 + <union id="test.set">
21.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
21.71 + <filename name="@{testincludes}"/>
21.72 + </fileset>
21.73 + </union>
21.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
21.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="type.web.api" testname="TestNG tests" workingDir="${work.dir}">
21.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
21.77 - <filename name="${testng.testincludes}"/>
21.78 - </classfileset>
21.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="type.web.api" testname="TestNG tests" workingDir="${work.dir}">
21.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
21.81 <propertyset>
21.82 <propertyref prefix="test-sys-prop."/>
21.83 @@ -560,39 +542,73 @@
21.84 </sequential>
21.85 </macrodef>
21.86 </target>
21.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
21.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
21.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
21.90 - <attribute default="${main.class}" name="testClass"/>
21.91 - <attribute default="" name="testMethod"/>
21.92 - <element name="customize2" optional="true"/>
21.93 + <attribute default="${includes}" name="includes"/>
21.94 + <attribute default="${excludes}" name="excludes"/>
21.95 + <attribute default="**" name="testincludes"/>
21.96 + <attribute default="" name="testmethods"/>
21.97 + <element name="customize" optional="true"/>
21.98 <sequential>
21.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
21.100 - <delete file="${test.report.file}"/>
21.101 - <mkdir dir="${build.test.results.dir}"/>
21.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
21.103 - <isset property="test.method"/>
21.104 - </condition>
21.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
21.106 - <customize>
21.107 - <arg value="@{testClass}"/>
21.108 - <arg value="${junit.methods.arg}"/>
21.109 - <arg value="showoutput=true"/>
21.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
21.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
21.112 - <customize2/>
21.113 - </customize>
21.114 - </j2seproject3:debug>
21.115 + <property name="junit.forkmode" value="perTest"/>
21.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
21.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
21.118 + <syspropertyset>
21.119 + <propertyref prefix="test-sys-prop."/>
21.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
21.121 + </syspropertyset>
21.122 + <formatter type="brief" usefile="false"/>
21.123 + <formatter type="xml"/>
21.124 + <jvmarg value="-ea"/>
21.125 + <jvmarg line="${debug-args-line}"/>
21.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
21.127 + <customize/>
21.128 + </junit>
21.129 </sequential>
21.130 </macrodef>
21.131 </target>
21.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
21.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
21.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
21.135 + <attribute default="${includes}" name="includes"/>
21.136 + <attribute default="${excludes}" name="excludes"/>
21.137 + <attribute default="**" name="testincludes"/>
21.138 + <attribute default="" name="testmethods"/>
21.139 + <element name="customize" optional="true"/>
21.140 + <sequential>
21.141 + <property name="junit.forkmode" value="perTest"/>
21.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
21.143 + <batchtest todir="${build.test.results.dir}">
21.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
21.145 + <filename name="@{testincludes}"/>
21.146 + </fileset>
21.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
21.148 + <filename name="${test.binarytestincludes}"/>
21.149 + </fileset>
21.150 + </batchtest>
21.151 + <syspropertyset>
21.152 + <propertyref prefix="test-sys-prop."/>
21.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
21.154 + </syspropertyset>
21.155 + <formatter type="brief" usefile="false"/>
21.156 + <formatter type="xml"/>
21.157 + <jvmarg value="-ea"/>
21.158 + <jvmarg line="${debug-args-line}"/>
21.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
21.160 + <customize/>
21.161 + </junit>
21.162 + </sequential>
21.163 + </macrodef>
21.164 + </target>
21.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
21.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
21.167 - <attribute default="${main.class}" name="testClass"/>
21.168 - <attribute default="" name="testMethod"/>
21.169 - <element implicit="true" name="customize2" optional="true"/>
21.170 + <attribute default="${includes}" name="includes"/>
21.171 + <attribute default="${excludes}" name="excludes"/>
21.172 + <attribute default="**" name="testincludes"/>
21.173 + <attribute default="" name="testmethods"/>
21.174 + <element implicit="true" name="customize" optional="true"/>
21.175 <sequential>
21.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
21.177 - <customize2/>
21.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
21.179 + <customize/>
21.180 </j2seproject3:junit-debug>
21.181 </sequential>
21.182 </macrodef>
21.183 @@ -625,7 +641,7 @@
21.184 </macrodef>
21.185 </target>
21.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
21.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
21.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
21.189 <attribute default="${main.class}" name="testClass"/>
21.190 <attribute default="" name="testMethod"/>
21.191 <element implicit="true" name="customize2" optional="true"/>
21.192 @@ -636,32 +652,62 @@
21.193 </sequential>
21.194 </macrodef>
21.195 </target>
21.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
21.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
21.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
21.199 + <attribute default="${includes}" name="includes"/>
21.200 + <attribute default="${excludes}" name="excludes"/>
21.201 + <attribute default="**" name="testincludes"/>
21.202 + <attribute default="" name="testmethods"/>
21.203 <attribute default="${main.class}" name="testClass"/>
21.204 <attribute default="" name="testMethod"/>
21.205 <sequential>
21.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
21.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
21.208 + <customize>
21.209 + <classpath>
21.210 + <path path="${run.test.classpath}"/>
21.211 + </classpath>
21.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
21.213 + <jvmarg line="${run.jvmargs}"/>
21.214 + <jvmarg line="${run.jvmargs.ide}"/>
21.215 + </customize>
21.216 + </j2seproject3:test-debug-impl>
21.217 + </sequential>
21.218 + </macrodef>
21.219 + </target>
21.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
21.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
21.222 + <attribute default="${includes}" name="includes"/>
21.223 + <attribute default="${excludes}" name="excludes"/>
21.224 + <attribute default="**" name="testincludes"/>
21.225 + <attribute default="" name="testmethods"/>
21.226 + <attribute default="${main.class}" name="testClass"/>
21.227 + <attribute default="" name="testMethod"/>
21.228 + <sequential>
21.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
21.230 <customize2>
21.231 <syspropertyset>
21.232 <propertyref prefix="test-sys-prop."/>
21.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
21.234 </syspropertyset>
21.235 </customize2>
21.236 - </j2seproject3:test-debug-impl>
21.237 + </j2seproject3:testng-debug-impl>
21.238 </sequential>
21.239 </macrodef>
21.240 </target>
21.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
21.242 - <target name="-profile-pre-init">
21.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
21.244 + <!--
21.245 + pre NB7.2 profiling section; consider it deprecated
21.246 + -->
21.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
21.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
21.249 <!-- Empty placeholder for easier customization. -->
21.250 <!-- You can override this target in the ../build.xml file. -->
21.251 </target>
21.252 - <target name="-profile-post-init">
21.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
21.254 <!-- Empty placeholder for easier customization. -->
21.255 <!-- You can override this target in the ../build.xml file. -->
21.256 </target>
21.257 - <target name="-profile-init-macrodef-profile">
21.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
21.259 <macrodef name="resolve">
21.260 <attribute name="name"/>
21.261 <attribute name="value"/>
21.262 @@ -693,10 +739,13 @@
21.263 </sequential>
21.264 </macrodef>
21.265 </target>
21.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
21.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
21.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
21.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
21.270 </target>
21.271 + <!--
21.272 + end of pre NB7.2 profiling section
21.273 + -->
21.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
21.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
21.276 <attribute default="${main.class}" name="name"/>
21.277 @@ -771,6 +820,7 @@
21.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
21.279 <attribute default="${main.class}" name="classname"/>
21.280 <attribute default="${run.classpath}" name="classpath"/>
21.281 + <attribute default="jvm" name="jvm"/>
21.282 <element name="customize" optional="true"/>
21.283 <sequential>
21.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
21.285 @@ -805,6 +855,9 @@
21.286 <path path="${run.classpath.without.build.classes.dir}"/>
21.287 <chainedmapper>
21.288 <flattenmapper/>
21.289 + <filtermapper>
21.290 + <replacestring from=" " to="%20"/>
21.291 + </filtermapper>
21.292 <globmapper from="*" to="lib/*"/>
21.293 </chainedmapper>
21.294 </pathconvert>
21.295 @@ -910,7 +963,7 @@
21.296 <target if="has.persistence.xml" name="-copy-persistence-xml">
21.297 <mkdir dir="${build.classes.dir}/META-INF"/>
21.298 <copy todir="${build.classes.dir}/META-INF">
21.299 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
21.300 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
21.301 </copy>
21.302 </target>
21.303 <target name="-post-compile">
21.304 @@ -1073,7 +1126,11 @@
21.305 PROFILING SECTION
21.306 =================
21.307 -->
21.308 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
21.309 + <!--
21.310 + pre NB7.2 profiler integration
21.311 + -->
21.312 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
21.313 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
21.314 <nbprofiledirect>
21.315 <classpath>
21.316 <path path="${run.classpath}"/>
21.317 @@ -1081,8 +1138,9 @@
21.318 </nbprofiledirect>
21.319 <profile/>
21.320 </target>
21.321 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
21.322 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
21.323 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
21.324 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
21.325 <nbprofiledirect>
21.326 <classpath>
21.327 <path path="${run.classpath}"/>
21.328 @@ -1090,12 +1148,8 @@
21.329 </nbprofiledirect>
21.330 <profile classname="${profile.class}"/>
21.331 </target>
21.332 - <!--
21.333 - =========================
21.334 - APPLET PROFILING SECTION
21.335 - =========================
21.336 - -->
21.337 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
21.338 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
21.339 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
21.340 <nbprofiledirect>
21.341 <classpath>
21.342 <path path="${run.classpath}"/>
21.343 @@ -1107,12 +1161,8 @@
21.344 </customize>
21.345 </profile>
21.346 </target>
21.347 - <!--
21.348 - =========================
21.349 - TESTS PROFILING SECTION
21.350 - =========================
21.351 - -->
21.352 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
21.353 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
21.354 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
21.355 <nbprofiledirect>
21.356 <classpath>
21.357 <path path="${run.test.classpath}"/>
21.358 @@ -1135,6 +1185,42 @@
21.359 </junit>
21.360 </target>
21.361 <!--
21.362 + end of pre NB72 profiling section
21.363 + -->
21.364 + <target if="netbeans.home" name="-profile-check">
21.365 + <condition property="profiler.configured">
21.366 + <or>
21.367 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
21.368 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
21.369 + </or>
21.370 + </condition>
21.371 + </target>
21.372 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
21.373 + <startprofiler/>
21.374 + <antcall target="run"/>
21.375 + </target>
21.376 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
21.377 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
21.378 + <startprofiler/>
21.379 + <antcall target="run-single"/>
21.380 + </target>
21.381 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
21.382 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
21.383 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
21.384 + <startprofiler/>
21.385 + <antcall target="test-single"/>
21.386 + </target>
21.387 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
21.388 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
21.389 + <startprofiler/>
21.390 + <antcal target="run-test-with-main"/>
21.391 + </target>
21.392 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
21.393 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
21.394 + <startprofiler/>
21.395 + <antcall target="run-applet"/>
21.396 + </target>
21.397 + <!--
21.398 ===============
21.399 JAVADOC SECTION
21.400 ===============
21.401 @@ -1260,13 +1346,14 @@
21.402 TEST DEBUGGING SECTION
21.403 =======================
21.404 -->
21.405 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
21.406 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
21.407 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
21.408 - <j2seproject3:test-debug testClass="${test.class}"/>
21.409 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
21.410 </target>
21.411 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
21.412 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
21.413 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
21.414 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
21.415 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
21.416 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
21.417 </target>
21.418 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
21.419 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
22.1 --- a/remoting/server/web/type.web.api/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
22.2 +++ b/remoting/server/web/type.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
22.3 @@ -4,5 +4,5 @@
22.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
22.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
22.6 nbproject/build-impl.xml.data.CRC32=7d71200f
22.7 -nbproject/build-impl.xml.script.CRC32=015c92b5
22.8 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
22.9 +nbproject/build-impl.xml.script.CRC32=32e3cf59
22.10 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.54.0.46
23.1 --- a/remoting/server/web/usages.web.api/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
23.2 +++ b/remoting/server/web/usages.web.api/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
23.3 @@ -395,6 +395,11 @@
23.4 </and>
23.5 </condition>
23.6 </target>
23.7 + <target name="-init-test-properties">
23.8 + <property name="test.binaryincludes" value="<nothing>"/>
23.9 + <property name="test.binarytestincludes" value=""/>
23.10 + <property name="test.binaryexcludes" value=""/>
23.11 + </target>
23.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
23.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
23.14 <attribute default="${includes}" name="includes"/>
23.15 @@ -418,7 +423,7 @@
23.16 </sequential>
23.17 </macrodef>
23.18 </target>
23.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
23.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
23.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
23.22 <attribute default="${includes}" name="includes"/>
23.23 <attribute default="${excludes}" name="excludes"/>
23.24 @@ -432,6 +437,9 @@
23.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
23.26 <filename name="@{testincludes}"/>
23.27 </fileset>
23.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
23.29 + <filename name="${test.binarytestincludes}"/>
23.30 + </fileset>
23.31 </batchtest>
23.32 <syspropertyset>
23.33 <propertyref prefix="test-sys-prop."/>
23.34 @@ -454,42 +462,16 @@
23.35 <attribute default="" name="testmethods"/>
23.36 <element name="customize" optional="true"/>
23.37 <sequential>
23.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
23.39 - <path>
23.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
23.41 - </path>
23.42 - <chainedmapper>
23.43 - <globmapper from="*.java" to="*.class"/>
23.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
23.45 - </chainedmapper>
23.46 - </pathconvert>
23.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
23.48 - <path>
23.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
23.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
23.51 - </path>
23.52 - <chainedmapper>
23.53 - <globmapper from="*.java" to="*.class"/>
23.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
23.55 - </chainedmapper>
23.56 - </pathconvert>
23.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
23.58 - <path>
23.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
23.60 - </path>
23.61 - <chainedmapper>
23.62 - <globmapper from="*.java" to="*.class"/>
23.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
23.64 - </chainedmapper>
23.65 - </pathconvert>
23.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
23.67 <isset property="test.method"/>
23.68 </condition>
23.69 + <union id="test.set">
23.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
23.71 + <filename name="@{testincludes}"/>
23.72 + </fileset>
23.73 + </union>
23.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
23.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="usages.web.api" testname="TestNG tests" workingDir="${work.dir}">
23.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
23.77 - <filename name="${testng.testincludes}"/>
23.78 - </classfileset>
23.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="usages.web.api" testname="TestNG tests" workingDir="${work.dir}">
23.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
23.81 <propertyset>
23.82 <propertyref prefix="test-sys-prop."/>
23.83 @@ -560,39 +542,73 @@
23.84 </sequential>
23.85 </macrodef>
23.86 </target>
23.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
23.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
23.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
23.90 - <attribute default="${main.class}" name="testClass"/>
23.91 - <attribute default="" name="testMethod"/>
23.92 - <element name="customize2" optional="true"/>
23.93 + <attribute default="${includes}" name="includes"/>
23.94 + <attribute default="${excludes}" name="excludes"/>
23.95 + <attribute default="**" name="testincludes"/>
23.96 + <attribute default="" name="testmethods"/>
23.97 + <element name="customize" optional="true"/>
23.98 <sequential>
23.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
23.100 - <delete file="${test.report.file}"/>
23.101 - <mkdir dir="${build.test.results.dir}"/>
23.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
23.103 - <isset property="test.method"/>
23.104 - </condition>
23.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
23.106 - <customize>
23.107 - <arg value="@{testClass}"/>
23.108 - <arg value="${junit.methods.arg}"/>
23.109 - <arg value="showoutput=true"/>
23.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
23.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
23.112 - <customize2/>
23.113 - </customize>
23.114 - </j2seproject3:debug>
23.115 + <property name="junit.forkmode" value="perTest"/>
23.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
23.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
23.118 + <syspropertyset>
23.119 + <propertyref prefix="test-sys-prop."/>
23.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
23.121 + </syspropertyset>
23.122 + <formatter type="brief" usefile="false"/>
23.123 + <formatter type="xml"/>
23.124 + <jvmarg value="-ea"/>
23.125 + <jvmarg line="${debug-args-line}"/>
23.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
23.127 + <customize/>
23.128 + </junit>
23.129 </sequential>
23.130 </macrodef>
23.131 </target>
23.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
23.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
23.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
23.135 + <attribute default="${includes}" name="includes"/>
23.136 + <attribute default="${excludes}" name="excludes"/>
23.137 + <attribute default="**" name="testincludes"/>
23.138 + <attribute default="" name="testmethods"/>
23.139 + <element name="customize" optional="true"/>
23.140 + <sequential>
23.141 + <property name="junit.forkmode" value="perTest"/>
23.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
23.143 + <batchtest todir="${build.test.results.dir}">
23.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
23.145 + <filename name="@{testincludes}"/>
23.146 + </fileset>
23.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
23.148 + <filename name="${test.binarytestincludes}"/>
23.149 + </fileset>
23.150 + </batchtest>
23.151 + <syspropertyset>
23.152 + <propertyref prefix="test-sys-prop."/>
23.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
23.154 + </syspropertyset>
23.155 + <formatter type="brief" usefile="false"/>
23.156 + <formatter type="xml"/>
23.157 + <jvmarg value="-ea"/>
23.158 + <jvmarg line="${debug-args-line}"/>
23.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
23.160 + <customize/>
23.161 + </junit>
23.162 + </sequential>
23.163 + </macrodef>
23.164 + </target>
23.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
23.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
23.167 - <attribute default="${main.class}" name="testClass"/>
23.168 - <attribute default="" name="testMethod"/>
23.169 - <element implicit="true" name="customize2" optional="true"/>
23.170 + <attribute default="${includes}" name="includes"/>
23.171 + <attribute default="${excludes}" name="excludes"/>
23.172 + <attribute default="**" name="testincludes"/>
23.173 + <attribute default="" name="testmethods"/>
23.174 + <element implicit="true" name="customize" optional="true"/>
23.175 <sequential>
23.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
23.177 - <customize2/>
23.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
23.179 + <customize/>
23.180 </j2seproject3:junit-debug>
23.181 </sequential>
23.182 </macrodef>
23.183 @@ -625,7 +641,7 @@
23.184 </macrodef>
23.185 </target>
23.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
23.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
23.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
23.189 <attribute default="${main.class}" name="testClass"/>
23.190 <attribute default="" name="testMethod"/>
23.191 <element implicit="true" name="customize2" optional="true"/>
23.192 @@ -636,32 +652,62 @@
23.193 </sequential>
23.194 </macrodef>
23.195 </target>
23.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
23.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
23.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
23.199 + <attribute default="${includes}" name="includes"/>
23.200 + <attribute default="${excludes}" name="excludes"/>
23.201 + <attribute default="**" name="testincludes"/>
23.202 + <attribute default="" name="testmethods"/>
23.203 <attribute default="${main.class}" name="testClass"/>
23.204 <attribute default="" name="testMethod"/>
23.205 <sequential>
23.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
23.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
23.208 + <customize>
23.209 + <classpath>
23.210 + <path path="${run.test.classpath}"/>
23.211 + </classpath>
23.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
23.213 + <jvmarg line="${run.jvmargs}"/>
23.214 + <jvmarg line="${run.jvmargs.ide}"/>
23.215 + </customize>
23.216 + </j2seproject3:test-debug-impl>
23.217 + </sequential>
23.218 + </macrodef>
23.219 + </target>
23.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
23.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
23.222 + <attribute default="${includes}" name="includes"/>
23.223 + <attribute default="${excludes}" name="excludes"/>
23.224 + <attribute default="**" name="testincludes"/>
23.225 + <attribute default="" name="testmethods"/>
23.226 + <attribute default="${main.class}" name="testClass"/>
23.227 + <attribute default="" name="testMethod"/>
23.228 + <sequential>
23.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
23.230 <customize2>
23.231 <syspropertyset>
23.232 <propertyref prefix="test-sys-prop."/>
23.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
23.234 </syspropertyset>
23.235 </customize2>
23.236 - </j2seproject3:test-debug-impl>
23.237 + </j2seproject3:testng-debug-impl>
23.238 </sequential>
23.239 </macrodef>
23.240 </target>
23.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
23.242 - <target name="-profile-pre-init">
23.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
23.244 + <!--
23.245 + pre NB7.2 profiling section; consider it deprecated
23.246 + -->
23.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
23.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
23.249 <!-- Empty placeholder for easier customization. -->
23.250 <!-- You can override this target in the ../build.xml file. -->
23.251 </target>
23.252 - <target name="-profile-post-init">
23.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
23.254 <!-- Empty placeholder for easier customization. -->
23.255 <!-- You can override this target in the ../build.xml file. -->
23.256 </target>
23.257 - <target name="-profile-init-macrodef-profile">
23.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
23.259 <macrodef name="resolve">
23.260 <attribute name="name"/>
23.261 <attribute name="value"/>
23.262 @@ -693,10 +739,13 @@
23.263 </sequential>
23.264 </macrodef>
23.265 </target>
23.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
23.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
23.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
23.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
23.270 </target>
23.271 + <!--
23.272 + end of pre NB7.2 profiling section
23.273 + -->
23.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
23.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
23.276 <attribute default="${main.class}" name="name"/>
23.277 @@ -771,6 +820,7 @@
23.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
23.279 <attribute default="${main.class}" name="classname"/>
23.280 <attribute default="${run.classpath}" name="classpath"/>
23.281 + <attribute default="jvm" name="jvm"/>
23.282 <element name="customize" optional="true"/>
23.283 <sequential>
23.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
23.285 @@ -805,6 +855,9 @@
23.286 <path path="${run.classpath.without.build.classes.dir}"/>
23.287 <chainedmapper>
23.288 <flattenmapper/>
23.289 + <filtermapper>
23.290 + <replacestring from=" " to="%20"/>
23.291 + </filtermapper>
23.292 <globmapper from="*" to="lib/*"/>
23.293 </chainedmapper>
23.294 </pathconvert>
23.295 @@ -910,7 +963,7 @@
23.296 <target if="has.persistence.xml" name="-copy-persistence-xml">
23.297 <mkdir dir="${build.classes.dir}/META-INF"/>
23.298 <copy todir="${build.classes.dir}/META-INF">
23.299 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
23.300 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
23.301 </copy>
23.302 </target>
23.303 <target name="-post-compile">
23.304 @@ -1073,7 +1126,11 @@
23.305 PROFILING SECTION
23.306 =================
23.307 -->
23.308 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
23.309 + <!--
23.310 + pre NB7.2 profiler integration
23.311 + -->
23.312 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
23.313 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
23.314 <nbprofiledirect>
23.315 <classpath>
23.316 <path path="${run.classpath}"/>
23.317 @@ -1081,8 +1138,9 @@
23.318 </nbprofiledirect>
23.319 <profile/>
23.320 </target>
23.321 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
23.322 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
23.323 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
23.324 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
23.325 <nbprofiledirect>
23.326 <classpath>
23.327 <path path="${run.classpath}"/>
23.328 @@ -1090,12 +1148,8 @@
23.329 </nbprofiledirect>
23.330 <profile classname="${profile.class}"/>
23.331 </target>
23.332 - <!--
23.333 - =========================
23.334 - APPLET PROFILING SECTION
23.335 - =========================
23.336 - -->
23.337 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
23.338 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
23.339 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
23.340 <nbprofiledirect>
23.341 <classpath>
23.342 <path path="${run.classpath}"/>
23.343 @@ -1107,12 +1161,8 @@
23.344 </customize>
23.345 </profile>
23.346 </target>
23.347 - <!--
23.348 - =========================
23.349 - TESTS PROFILING SECTION
23.350 - =========================
23.351 - -->
23.352 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
23.353 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
23.354 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
23.355 <nbprofiledirect>
23.356 <classpath>
23.357 <path path="${run.test.classpath}"/>
23.358 @@ -1135,6 +1185,42 @@
23.359 </junit>
23.360 </target>
23.361 <!--
23.362 + end of pre NB72 profiling section
23.363 + -->
23.364 + <target if="netbeans.home" name="-profile-check">
23.365 + <condition property="profiler.configured">
23.366 + <or>
23.367 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
23.368 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
23.369 + </or>
23.370 + </condition>
23.371 + </target>
23.372 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
23.373 + <startprofiler/>
23.374 + <antcall target="run"/>
23.375 + </target>
23.376 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
23.377 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
23.378 + <startprofiler/>
23.379 + <antcall target="run-single"/>
23.380 + </target>
23.381 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
23.382 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
23.383 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
23.384 + <startprofiler/>
23.385 + <antcall target="test-single"/>
23.386 + </target>
23.387 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
23.388 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
23.389 + <startprofiler/>
23.390 + <antcal target="run-test-with-main"/>
23.391 + </target>
23.392 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
23.393 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
23.394 + <startprofiler/>
23.395 + <antcall target="run-applet"/>
23.396 + </target>
23.397 + <!--
23.398 ===============
23.399 JAVADOC SECTION
23.400 ===============
23.401 @@ -1260,13 +1346,14 @@
23.402 TEST DEBUGGING SECTION
23.403 =======================
23.404 -->
23.405 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
23.406 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
23.407 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
23.408 - <j2seproject3:test-debug testClass="${test.class}"/>
23.409 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
23.410 </target>
23.411 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
23.412 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
23.413 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
23.414 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
23.415 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
23.416 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
23.417 </target>
23.418 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
23.419 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
24.1 --- a/remoting/server/web/usages.web.api/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
24.2 +++ b/remoting/server/web/usages.web.api/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
24.3 @@ -4,5 +4,5 @@
24.4 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
24.5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
24.6 nbproject/build-impl.xml.data.CRC32=0ab46c18
24.7 -nbproject/build-impl.xml.script.CRC32=0fe65a54
24.8 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
24.9 +nbproject/build-impl.xml.script.CRC32=abf847c9
24.10 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.54.0.46
25.1 --- a/remoting/server/web/web.main/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
25.2 +++ b/remoting/server/web/web.main/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
25.3 @@ -395,6 +395,11 @@
25.4 </and>
25.5 </condition>
25.6 </target>
25.7 + <target name="-init-test-properties">
25.8 + <property name="test.binaryincludes" value="<nothing>"/>
25.9 + <property name="test.binarytestincludes" value=""/>
25.10 + <property name="test.binaryexcludes" value=""/>
25.11 + </target>
25.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
25.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
25.14 <attribute default="${includes}" name="includes"/>
25.15 @@ -418,7 +423,7 @@
25.16 </sequential>
25.17 </macrodef>
25.18 </target>
25.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
25.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
25.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
25.22 <attribute default="${includes}" name="includes"/>
25.23 <attribute default="${excludes}" name="excludes"/>
25.24 @@ -432,6 +437,9 @@
25.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
25.26 <filename name="@{testincludes}"/>
25.27 </fileset>
25.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
25.29 + <filename name="${test.binarytestincludes}"/>
25.30 + </fileset>
25.31 </batchtest>
25.32 <syspropertyset>
25.33 <propertyref prefix="test-sys-prop."/>
25.34 @@ -454,42 +462,16 @@
25.35 <attribute default="" name="testmethods"/>
25.36 <element name="customize" optional="true"/>
25.37 <sequential>
25.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
25.39 - <path>
25.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
25.41 - </path>
25.42 - <chainedmapper>
25.43 - <globmapper from="*.java" to="*.class"/>
25.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
25.45 - </chainedmapper>
25.46 - </pathconvert>
25.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
25.48 - <path>
25.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
25.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
25.51 - </path>
25.52 - <chainedmapper>
25.53 - <globmapper from="*.java" to="*.class"/>
25.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
25.55 - </chainedmapper>
25.56 - </pathconvert>
25.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
25.58 - <path>
25.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
25.60 - </path>
25.61 - <chainedmapper>
25.62 - <globmapper from="*.java" to="*.class"/>
25.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
25.64 - </chainedmapper>
25.65 - </pathconvert>
25.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
25.67 <isset property="test.method"/>
25.68 </condition>
25.69 + <union id="test.set">
25.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
25.71 + <filename name="@{testincludes}"/>
25.72 + </fileset>
25.73 + </union>
25.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
25.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="web.main" testname="TestNG tests" workingDir="${work.dir}">
25.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
25.77 - <filename name="${testng.testincludes}"/>
25.78 - </classfileset>
25.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="web.main" testname="TestNG tests" workingDir="${work.dir}">
25.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
25.81 <propertyset>
25.82 <propertyref prefix="test-sys-prop."/>
25.83 @@ -560,39 +542,73 @@
25.84 </sequential>
25.85 </macrodef>
25.86 </target>
25.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
25.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
25.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
25.90 - <attribute default="${main.class}" name="testClass"/>
25.91 - <attribute default="" name="testMethod"/>
25.92 - <element name="customize2" optional="true"/>
25.93 + <attribute default="${includes}" name="includes"/>
25.94 + <attribute default="${excludes}" name="excludes"/>
25.95 + <attribute default="**" name="testincludes"/>
25.96 + <attribute default="" name="testmethods"/>
25.97 + <element name="customize" optional="true"/>
25.98 <sequential>
25.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
25.100 - <delete file="${test.report.file}"/>
25.101 - <mkdir dir="${build.test.results.dir}"/>
25.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
25.103 - <isset property="test.method"/>
25.104 - </condition>
25.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
25.106 - <customize>
25.107 - <arg value="@{testClass}"/>
25.108 - <arg value="${junit.methods.arg}"/>
25.109 - <arg value="showoutput=true"/>
25.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
25.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
25.112 - <customize2/>
25.113 - </customize>
25.114 - </j2seproject3:debug>
25.115 + <property name="junit.forkmode" value="perTest"/>
25.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
25.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
25.118 + <syspropertyset>
25.119 + <propertyref prefix="test-sys-prop."/>
25.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
25.121 + </syspropertyset>
25.122 + <formatter type="brief" usefile="false"/>
25.123 + <formatter type="xml"/>
25.124 + <jvmarg value="-ea"/>
25.125 + <jvmarg line="${debug-args-line}"/>
25.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
25.127 + <customize/>
25.128 + </junit>
25.129 </sequential>
25.130 </macrodef>
25.131 </target>
25.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
25.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
25.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
25.135 + <attribute default="${includes}" name="includes"/>
25.136 + <attribute default="${excludes}" name="excludes"/>
25.137 + <attribute default="**" name="testincludes"/>
25.138 + <attribute default="" name="testmethods"/>
25.139 + <element name="customize" optional="true"/>
25.140 + <sequential>
25.141 + <property name="junit.forkmode" value="perTest"/>
25.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
25.143 + <batchtest todir="${build.test.results.dir}">
25.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
25.145 + <filename name="@{testincludes}"/>
25.146 + </fileset>
25.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
25.148 + <filename name="${test.binarytestincludes}"/>
25.149 + </fileset>
25.150 + </batchtest>
25.151 + <syspropertyset>
25.152 + <propertyref prefix="test-sys-prop."/>
25.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
25.154 + </syspropertyset>
25.155 + <formatter type="brief" usefile="false"/>
25.156 + <formatter type="xml"/>
25.157 + <jvmarg value="-ea"/>
25.158 + <jvmarg line="${debug-args-line}"/>
25.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
25.160 + <customize/>
25.161 + </junit>
25.162 + </sequential>
25.163 + </macrodef>
25.164 + </target>
25.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
25.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
25.167 - <attribute default="${main.class}" name="testClass"/>
25.168 - <attribute default="" name="testMethod"/>
25.169 - <element implicit="true" name="customize2" optional="true"/>
25.170 + <attribute default="${includes}" name="includes"/>
25.171 + <attribute default="${excludes}" name="excludes"/>
25.172 + <attribute default="**" name="testincludes"/>
25.173 + <attribute default="" name="testmethods"/>
25.174 + <element implicit="true" name="customize" optional="true"/>
25.175 <sequential>
25.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
25.177 - <customize2/>
25.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
25.179 + <customize/>
25.180 </j2seproject3:junit-debug>
25.181 </sequential>
25.182 </macrodef>
25.183 @@ -625,7 +641,7 @@
25.184 </macrodef>
25.185 </target>
25.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
25.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
25.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
25.189 <attribute default="${main.class}" name="testClass"/>
25.190 <attribute default="" name="testMethod"/>
25.191 <element implicit="true" name="customize2" optional="true"/>
25.192 @@ -636,32 +652,62 @@
25.193 </sequential>
25.194 </macrodef>
25.195 </target>
25.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
25.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
25.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
25.199 + <attribute default="${includes}" name="includes"/>
25.200 + <attribute default="${excludes}" name="excludes"/>
25.201 + <attribute default="**" name="testincludes"/>
25.202 + <attribute default="" name="testmethods"/>
25.203 <attribute default="${main.class}" name="testClass"/>
25.204 <attribute default="" name="testMethod"/>
25.205 <sequential>
25.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
25.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
25.208 + <customize>
25.209 + <classpath>
25.210 + <path path="${run.test.classpath}"/>
25.211 + </classpath>
25.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
25.213 + <jvmarg line="${run.jvmargs}"/>
25.214 + <jvmarg line="${run.jvmargs.ide}"/>
25.215 + </customize>
25.216 + </j2seproject3:test-debug-impl>
25.217 + </sequential>
25.218 + </macrodef>
25.219 + </target>
25.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
25.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
25.222 + <attribute default="${includes}" name="includes"/>
25.223 + <attribute default="${excludes}" name="excludes"/>
25.224 + <attribute default="**" name="testincludes"/>
25.225 + <attribute default="" name="testmethods"/>
25.226 + <attribute default="${main.class}" name="testClass"/>
25.227 + <attribute default="" name="testMethod"/>
25.228 + <sequential>
25.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
25.230 <customize2>
25.231 <syspropertyset>
25.232 <propertyref prefix="test-sys-prop."/>
25.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
25.234 </syspropertyset>
25.235 </customize2>
25.236 - </j2seproject3:test-debug-impl>
25.237 + </j2seproject3:testng-debug-impl>
25.238 </sequential>
25.239 </macrodef>
25.240 </target>
25.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
25.242 - <target name="-profile-pre-init">
25.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
25.244 + <!--
25.245 + pre NB7.2 profiling section; consider it deprecated
25.246 + -->
25.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
25.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
25.249 <!-- Empty placeholder for easier customization. -->
25.250 <!-- You can override this target in the ../build.xml file. -->
25.251 </target>
25.252 - <target name="-profile-post-init">
25.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
25.254 <!-- Empty placeholder for easier customization. -->
25.255 <!-- You can override this target in the ../build.xml file. -->
25.256 </target>
25.257 - <target name="-profile-init-macrodef-profile">
25.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
25.259 <macrodef name="resolve">
25.260 <attribute name="name"/>
25.261 <attribute name="value"/>
25.262 @@ -693,10 +739,13 @@
25.263 </sequential>
25.264 </macrodef>
25.265 </target>
25.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
25.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
25.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
25.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
25.270 </target>
25.271 + <!--
25.272 + end of pre NB7.2 profiling section
25.273 + -->
25.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
25.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
25.276 <attribute default="${main.class}" name="name"/>
25.277 @@ -771,6 +820,7 @@
25.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
25.279 <attribute default="${main.class}" name="classname"/>
25.280 <attribute default="${run.classpath}" name="classpath"/>
25.281 + <attribute default="jvm" name="jvm"/>
25.282 <element name="customize" optional="true"/>
25.283 <sequential>
25.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
25.285 @@ -805,6 +855,9 @@
25.286 <path path="${run.classpath.without.build.classes.dir}"/>
25.287 <chainedmapper>
25.288 <flattenmapper/>
25.289 + <filtermapper>
25.290 + <replacestring from=" " to="%20"/>
25.291 + </filtermapper>
25.292 <globmapper from="*" to="lib/*"/>
25.293 </chainedmapper>
25.294 </pathconvert>
25.295 @@ -887,6 +940,13 @@
25.296 </antcall>
25.297 <antcall target="-maybe-call-dep">
25.298 <param name="call.built.properties" value="${built-jar.properties}"/>
25.299 + <param location="${project.resolve_web_api}" name="call.subproject"/>
25.300 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
25.301 + <param name="call.target" value="jar"/>
25.302 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
25.303 + </antcall>
25.304 + <antcall target="-maybe-call-dep">
25.305 + <param name="call.built.properties" value="${built-jar.properties}"/>
25.306 <param location="${project.source_web_api}" name="call.subproject"/>
25.307 <param location="${project.source_web_api}/build.xml" name="call.script"/>
25.308 <param name="call.target" value="jar"/>
25.309 @@ -945,7 +1005,7 @@
25.310 <target if="has.persistence.xml" name="-copy-persistence-xml">
25.311 <mkdir dir="${build.classes.dir}/META-INF"/>
25.312 <copy todir="${build.classes.dir}/META-INF">
25.313 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
25.314 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
25.315 </copy>
25.316 </target>
25.317 <target name="-post-compile">
25.318 @@ -1108,7 +1168,11 @@
25.319 PROFILING SECTION
25.320 =================
25.321 -->
25.322 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
25.323 + <!--
25.324 + pre NB7.2 profiler integration
25.325 + -->
25.326 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
25.327 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
25.328 <nbprofiledirect>
25.329 <classpath>
25.330 <path path="${run.classpath}"/>
25.331 @@ -1116,8 +1180,9 @@
25.332 </nbprofiledirect>
25.333 <profile/>
25.334 </target>
25.335 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
25.336 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
25.337 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
25.338 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
25.339 <nbprofiledirect>
25.340 <classpath>
25.341 <path path="${run.classpath}"/>
25.342 @@ -1125,12 +1190,8 @@
25.343 </nbprofiledirect>
25.344 <profile classname="${profile.class}"/>
25.345 </target>
25.346 - <!--
25.347 - =========================
25.348 - APPLET PROFILING SECTION
25.349 - =========================
25.350 - -->
25.351 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
25.352 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
25.353 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
25.354 <nbprofiledirect>
25.355 <classpath>
25.356 <path path="${run.classpath}"/>
25.357 @@ -1142,12 +1203,8 @@
25.358 </customize>
25.359 </profile>
25.360 </target>
25.361 - <!--
25.362 - =========================
25.363 - TESTS PROFILING SECTION
25.364 - =========================
25.365 - -->
25.366 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
25.367 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
25.368 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
25.369 <nbprofiledirect>
25.370 <classpath>
25.371 <path path="${run.test.classpath}"/>
25.372 @@ -1170,6 +1227,42 @@
25.373 </junit>
25.374 </target>
25.375 <!--
25.376 + end of pre NB72 profiling section
25.377 + -->
25.378 + <target if="netbeans.home" name="-profile-check">
25.379 + <condition property="profiler.configured">
25.380 + <or>
25.381 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
25.382 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
25.383 + </or>
25.384 + </condition>
25.385 + </target>
25.386 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
25.387 + <startprofiler/>
25.388 + <antcall target="run"/>
25.389 + </target>
25.390 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
25.391 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
25.392 + <startprofiler/>
25.393 + <antcall target="run-single"/>
25.394 + </target>
25.395 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
25.396 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
25.397 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
25.398 + <startprofiler/>
25.399 + <antcall target="test-single"/>
25.400 + </target>
25.401 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
25.402 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
25.403 + <startprofiler/>
25.404 + <antcal target="run-test-with-main"/>
25.405 + </target>
25.406 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
25.407 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
25.408 + <startprofiler/>
25.409 + <antcall target="run-applet"/>
25.410 + </target>
25.411 + <!--
25.412 ===============
25.413 JAVADOC SECTION
25.414 ===============
25.415 @@ -1295,13 +1388,14 @@
25.416 TEST DEBUGGING SECTION
25.417 =======================
25.418 -->
25.419 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
25.420 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
25.421 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
25.422 - <j2seproject3:test-debug testClass="${test.class}"/>
25.423 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
25.424 </target>
25.425 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
25.426 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
25.427 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
25.428 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
25.429 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
25.430 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
25.431 </target>
25.432 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
25.433 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
25.434 @@ -1375,6 +1469,13 @@
25.435 </antcall>
25.436 <antcall target="-maybe-call-dep">
25.437 <param name="call.built.properties" value="${built-clean.properties}"/>
25.438 + <param location="${project.resolve_web_api}" name="call.subproject"/>
25.439 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
25.440 + <param name="call.target" value="clean"/>
25.441 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
25.442 + </antcall>
25.443 + <antcall target="-maybe-call-dep">
25.444 + <param name="call.built.properties" value="${built-clean.properties}"/>
25.445 <param location="${project.source_web_api}" name="call.subproject"/>
25.446 <param location="${project.source_web_api}/build.xml" name="call.script"/>
25.447 <param name="call.target" value="clean"/>
26.1 --- a/remoting/server/web/web.main/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
26.2 +++ b/remoting/server/web/web.main/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
26.3 @@ -3,6 +3,6 @@
26.4 build.xml.stylesheet.CRC32=28e38971@1.46.0.46
26.5 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
26.6 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
26.7 -nbproject/build-impl.xml.data.CRC32=65488914
26.8 -nbproject/build-impl.xml.script.CRC32=e7110c70
26.9 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
26.10 +nbproject/build-impl.xml.data.CRC32=5c807d62
26.11 +nbproject/build-impl.xml.script.CRC32=10caceb7
26.12 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.0.46
27.1 --- a/remoting/server/web/web.main/nbproject/project.properties Fri Nov 30 07:36:26 2012 +0100
27.2 +++ b/remoting/server/web/web.main/nbproject/project.properties Fri Nov 30 18:49:18 2012 +0100
27.3 @@ -27,26 +27,22 @@
27.4 dist.javadoc.dir=${dist.dir}/javadoc
27.5 endorsed.classpath=
27.6 excludes=
27.7 -file.reference.org-netbeans-api-java-classpath.jar=../../../../lib/org-netbeans-api-java-classpath.jar
27.8 file.reference.org-netbeans-modules-editor-util.jar=../../../../lib/org-netbeans-modules-editor-util.jar
27.9 -file.reference.org-netbeans-modules-java-hints.jar=../../../../lib/org-netbeans-modules-java-hints.jar
27.10 file.reference.org-netbeans-modules-java-lexer.jar=../../../../lib/org-netbeans-modules-java-lexer.jar
27.11 -file.reference.org-netbeans-modules-java-project.jar=../../../../lib/org-netbeans-modules-java-project.jar
27.12 file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
27.13 file.reference.org-netbeans-modules-jumpto.jar=../../../../lib/org-netbeans-modules-jumpto.jar
27.14 file.reference.org-netbeans-modules-lexer.jar=../../../../lib/org-netbeans-modules-lexer.jar
27.15 file.reference.org-netbeans-modules-masterfs.jar=../../../../lib/org-netbeans-modules-masterfs.jar
27.16 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
27.17 file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
27.18 -file.reference.org-netbeans-modules-projectapi.jar=../../../../lib/org-netbeans-modules-projectapi.jar
27.19 -file.reference.org-netbeans-spi-editor-hints.jar=../../../../lib/org-netbeans-spi-editor-hints.jar
27.20 file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
27.21 file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
27.22 file.reference.org-openide-util.jar=../../../../lib/org-openide-util.jar
27.23 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
27.24 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
27.25 includes=**
27.26 +jar.archive.disabled=${jnlp.enabled}
27.27 jar.compress=false
27.28 +jar.index=${jnlp.enabled}
27.29 javac.classpath=\
27.30 ${reference.type_web_api.jar}:\
27.31 ${reference.base_web_api.jar}:\
27.32 @@ -54,16 +50,9 @@
27.33 ${libs.javac.classpath}:\
27.34 ${libs.freemarker.classpath}:\
27.35 ${libs.lucene.classpath}:\
27.36 - ${file.reference.org-netbeans-api-java-classpath.jar}:\
27.37 - ${file.reference.org-netbeans-modules-java-hints.jar}:\
27.38 - ${file.reference.org-netbeans-modules-java-project.jar}:\
27.39 - ${file.reference.org-netbeans-modules-java-source.jar}:\
27.40 ${file.reference.org-netbeans-modules-jumpto.jar}:\
27.41 ${file.reference.org-netbeans-modules-masterfs.jar}:\
27.42 - ${file.reference.org-netbeans-modules-parsing-api.jar}:\
27.43 ${file.reference.org-netbeans-modules-parsing-lucene.jar}:\
27.44 - ${file.reference.org-netbeans-modules-projectapi.jar}:\
27.45 - ${file.reference.org-netbeans-spi-editor-hints.jar}:\
27.46 ${file.reference.org-openide-filesystems.jar}:\
27.47 ${file.reference.org-openide-util-lookup.jar}:\
27.48 ${file.reference.org-openide-util.jar}:\
27.49 @@ -75,7 +64,9 @@
27.50 ${reference.web_ui.jar}:\
27.51 ${file.reference.org-netbeans-modules-lexer.jar}:\
27.52 ${file.reference.org-netbeans-modules-java-lexer.jar}:\
27.53 - ${file.reference.org-netbeans-modules-editor-util.jar}
27.54 + ${file.reference.org-netbeans-modules-editor-util.jar}:\
27.55 + ${reference.resolve_web_api.jar}:\
27.56 + ${file.reference.org-netbeans-modules-java-source.jar}
27.57 # Space-separated list of extra javac options
27.58 javac.compilerargs=
27.59 javac.deprecation=false
27.60 @@ -100,6 +91,15 @@
27.61 javadoc.use=true
27.62 javadoc.version=false
27.63 javadoc.windowtitle=
27.64 +jnlp.codebase.type=no.codebase
27.65 +jnlp.descriptor=application
27.66 +jnlp.enabled=false
27.67 +jnlp.mixed.code=default
27.68 +jnlp.offline-allowed=false
27.69 +jnlp.signed=false
27.70 +jnlp.signing=
27.71 +jnlp.signing.alias=
27.72 +jnlp.signing.keystore=
27.73 main.class=web.main.WebMain
27.74 manifest.file=manifest.mf
27.75 meta.inf.dir=${src.dir}/META-INF
27.76 @@ -107,12 +107,14 @@
27.77 platform.active=default_platform
27.78 project.base_web_api=../base.web.api
27.79 project.nbindex_web_api=../nbindex.web.api
27.80 +project.resolve_web_api=../resolve.web.api
27.81 project.source_web_api=../source.web.api
27.82 project.type_web_api=../type.web.api
27.83 project.usages_web_api=../usages.web.api
27.84 project.web_ui=../web.ui
27.85 reference.base_web_api.jar=${project.base_web_api}/dist/base.web.api.jar
27.86 reference.nbindex_web_api.jar=${project.nbindex_web_api}/dist/nbindex.web.api.jar
27.87 +reference.resolve_web_api.jar=${project.resolve_web_api}/dist/resolve.web.api.jar
27.88 reference.source_web_api.jar=${project.source_web_api}/dist/source.web.api.jar
27.89 reference.type_web_api.jar=${project.type_web_api}/dist/type.web.api.jar
27.90 reference.usages_web_api.jar=${project.usages_web_api}/dist/usages.web.api.jar
27.91 @@ -123,7 +125,7 @@
27.92 # Space-separated list of JVM arguments used when running the project
27.93 # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
27.94 # or test-sys-prop.name=value to set system properties for unit tests):
27.95 -run.jvmargs=
27.96 +run.jvmargs=-Xmx128m -Djava.index.useMemCache=false
27.97 run.test.classpath=\
27.98 ${javac.test.classpath}:\
27.99 ${build.test.classes.dir}
28.1 --- a/remoting/server/web/web.main/nbproject/project.xml Fri Nov 30 07:36:26 2012 +0100
28.2 +++ b/remoting/server/web/web.main/nbproject/project.xml Fri Nov 30 18:49:18 2012 +0100
28.3 @@ -32,6 +32,14 @@
28.4 <id>jar</id>
28.5 </reference>
28.6 <reference>
28.7 + <foreign-project>resolve_web_api</foreign-project>
28.8 + <artifact-type>jar</artifact-type>
28.9 + <script>build.xml</script>
28.10 + <target>jar</target>
28.11 + <clean-target>clean</clean-target>
28.12 + <id>jar</id>
28.13 + </reference>
28.14 + <reference>
28.15 <foreign-project>source_web_api</foreign-project>
28.16 <artifact-type>jar</artifact-type>
28.17 <script>build.xml</script>
29.1 --- a/remoting/server/web/web.ui/nbproject/build-impl.xml Fri Nov 30 07:36:26 2012 +0100
29.2 +++ b/remoting/server/web/web.ui/nbproject/build-impl.xml Fri Nov 30 18:49:18 2012 +0100
29.3 @@ -395,6 +395,11 @@
29.4 </and>
29.5 </condition>
29.6 </target>
29.7 + <target name="-init-test-properties">
29.8 + <property name="test.binaryincludes" value="<nothing>"/>
29.9 + <property name="test.binarytestincludes" value=""/>
29.10 + <property name="test.binaryexcludes" value=""/>
29.11 + </target>
29.12 <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
29.13 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
29.14 <attribute default="${includes}" name="includes"/>
29.15 @@ -418,7 +423,7 @@
29.16 </sequential>
29.17 </macrodef>
29.18 </target>
29.19 - <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
29.20 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
29.21 <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
29.22 <attribute default="${includes}" name="includes"/>
29.23 <attribute default="${excludes}" name="excludes"/>
29.24 @@ -432,6 +437,9 @@
29.25 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.26 <filename name="@{testincludes}"/>
29.27 </fileset>
29.28 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
29.29 + <filename name="${test.binarytestincludes}"/>
29.30 + </fileset>
29.31 </batchtest>
29.32 <syspropertyset>
29.33 <propertyref prefix="test-sys-prop."/>
29.34 @@ -454,42 +462,16 @@
29.35 <attribute default="" name="testmethods"/>
29.36 <element name="customize" optional="true"/>
29.37 <sequential>
29.38 - <pathconvert pathsep="${line.separator}" property="testng.testincludes">
29.39 - <path>
29.40 - <filelist dir="${build.test.classes.dir}" files="@{testincludes}"/>
29.41 - </path>
29.42 - <chainedmapper>
29.43 - <globmapper from="*.java" to="*.class"/>
29.44 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
29.45 - </chainedmapper>
29.46 - </pathconvert>
29.47 - <pathconvert pathsep="${line.separator}" property="testng.excludes">
29.48 - <path>
29.49 - <filelist dir="${build.test.classes.dir}" files="@{excludes}"/>
29.50 - <filelist dir="${build.test.classes.dir}" files="${excludes}"/>
29.51 - </path>
29.52 - <chainedmapper>
29.53 - <globmapper from="*.java" to="*.class"/>
29.54 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
29.55 - </chainedmapper>
29.56 - </pathconvert>
29.57 - <pathconvert pathsep="${line.separator}" property="testng.includes">
29.58 - <path>
29.59 - <filelist dir="${build.test.classes.dir}" files="@{includes}"/>
29.60 - </path>
29.61 - <chainedmapper>
29.62 - <globmapper from="*.java" to="*.class"/>
29.63 - <globmapper from="${basedir}/${build.test.classes.dir}/*" to="*"/>
29.64 - </chainedmapper>
29.65 - </pathconvert>
29.66 <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
29.67 <isset property="test.method"/>
29.68 </condition>
29.69 + <union id="test.set">
29.70 + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
29.71 + <filename name="@{testincludes}"/>
29.72 + </fileset>
29.73 + </union>
29.74 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
29.75 - <testng enableAssert="true" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="web.ui" testname="TestNG tests" workingDir="${work.dir}">
29.76 - <classfileset dir="${build.test.classes.dir}" excludes="${testng.excludes}" includes="${testng.includes}">
29.77 - <filename name="${testng.testincludes}"/>
29.78 - </classfileset>
29.79 + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="web.ui" testname="TestNG tests" workingDir="${work.dir}">
29.80 <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
29.81 <propertyset>
29.82 <propertyref prefix="test-sys-prop."/>
29.83 @@ -560,39 +542,73 @@
29.84 </sequential>
29.85 </macrodef>
29.86 </target>
29.87 - <target if="${junit.available}" name="-init-macrodef-junit-debug">
29.88 + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
29.89 <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
29.90 - <attribute default="${main.class}" name="testClass"/>
29.91 - <attribute default="" name="testMethod"/>
29.92 - <element name="customize2" optional="true"/>
29.93 + <attribute default="${includes}" name="includes"/>
29.94 + <attribute default="${excludes}" name="excludes"/>
29.95 + <attribute default="**" name="testincludes"/>
29.96 + <attribute default="" name="testmethods"/>
29.97 + <element name="customize" optional="true"/>
29.98 <sequential>
29.99 - <property location="${build.test.results.dir}/TEST-@{testClass}.xml" name="test.report.file"/>
29.100 - <delete file="${test.report.file}"/>
29.101 - <mkdir dir="${build.test.results.dir}"/>
29.102 - <condition else="" property="junit.methods.arg" value="methods=@{testMethod}">
29.103 - <isset property="test.method"/>
29.104 - </condition>
29.105 - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
29.106 - <customize>
29.107 - <arg value="@{testClass}"/>
29.108 - <arg value="${junit.methods.arg}"/>
29.109 - <arg value="showoutput=true"/>
29.110 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
29.111 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
29.112 - <customize2/>
29.113 - </customize>
29.114 - </j2seproject3:debug>
29.115 + <property name="junit.forkmode" value="perTest"/>
29.116 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
29.117 + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
29.118 + <syspropertyset>
29.119 + <propertyref prefix="test-sys-prop."/>
29.120 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.121 + </syspropertyset>
29.122 + <formatter type="brief" usefile="false"/>
29.123 + <formatter type="xml"/>
29.124 + <jvmarg value="-ea"/>
29.125 + <jvmarg line="${debug-args-line}"/>
29.126 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
29.127 + <customize/>
29.128 + </junit>
29.129 </sequential>
29.130 </macrodef>
29.131 </target>
29.132 - <target depends="-init-macrodef-junit-debug" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
29.133 + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
29.134 + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
29.135 + <attribute default="${includes}" name="includes"/>
29.136 + <attribute default="${excludes}" name="excludes"/>
29.137 + <attribute default="**" name="testincludes"/>
29.138 + <attribute default="" name="testmethods"/>
29.139 + <element name="customize" optional="true"/>
29.140 + <sequential>
29.141 + <property name="junit.forkmode" value="perTest"/>
29.142 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
29.143 + <batchtest todir="${build.test.results.dir}">
29.144 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
29.145 + <filename name="@{testincludes}"/>
29.146 + </fileset>
29.147 + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
29.148 + <filename name="${test.binarytestincludes}"/>
29.149 + </fileset>
29.150 + </batchtest>
29.151 + <syspropertyset>
29.152 + <propertyref prefix="test-sys-prop."/>
29.153 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.154 + </syspropertyset>
29.155 + <formatter type="brief" usefile="false"/>
29.156 + <formatter type="xml"/>
29.157 + <jvmarg value="-ea"/>
29.158 + <jvmarg line="${debug-args-line}"/>
29.159 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
29.160 + <customize/>
29.161 + </junit>
29.162 + </sequential>
29.163 + </macrodef>
29.164 + </target>
29.165 + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
29.166 <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
29.167 - <attribute default="${main.class}" name="testClass"/>
29.168 - <attribute default="" name="testMethod"/>
29.169 - <element implicit="true" name="customize2" optional="true"/>
29.170 + <attribute default="${includes}" name="includes"/>
29.171 + <attribute default="${excludes}" name="excludes"/>
29.172 + <attribute default="**" name="testincludes"/>
29.173 + <attribute default="" name="testmethods"/>
29.174 + <element implicit="true" name="customize" optional="true"/>
29.175 <sequential>
29.176 - <j2seproject3:junit-debug testClass="@{testClass}" testMethod="@{testMethod}">
29.177 - <customize2/>
29.178 + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
29.179 + <customize/>
29.180 </j2seproject3:junit-debug>
29.181 </sequential>
29.182 </macrodef>
29.183 @@ -625,7 +641,7 @@
29.184 </macrodef>
29.185 </target>
29.186 <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
29.187 - <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
29.188 + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
29.189 <attribute default="${main.class}" name="testClass"/>
29.190 <attribute default="" name="testMethod"/>
29.191 <element implicit="true" name="customize2" optional="true"/>
29.192 @@ -636,32 +652,62 @@
29.193 </sequential>
29.194 </macrodef>
29.195 </target>
29.196 - <target depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl" name="-init-macrodef-test-debug">
29.197 + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
29.198 <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
29.199 + <attribute default="${includes}" name="includes"/>
29.200 + <attribute default="${excludes}" name="excludes"/>
29.201 + <attribute default="**" name="testincludes"/>
29.202 + <attribute default="" name="testmethods"/>
29.203 <attribute default="${main.class}" name="testClass"/>
29.204 <attribute default="" name="testMethod"/>
29.205 <sequential>
29.206 - <j2seproject3:test-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
29.207 + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
29.208 + <customize>
29.209 + <classpath>
29.210 + <path path="${run.test.classpath}"/>
29.211 + </classpath>
29.212 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
29.213 + <jvmarg line="${run.jvmargs}"/>
29.214 + <jvmarg line="${run.jvmargs.ide}"/>
29.215 + </customize>
29.216 + </j2seproject3:test-debug-impl>
29.217 + </sequential>
29.218 + </macrodef>
29.219 + </target>
29.220 + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
29.221 + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
29.222 + <attribute default="${includes}" name="includes"/>
29.223 + <attribute default="${excludes}" name="excludes"/>
29.224 + <attribute default="**" name="testincludes"/>
29.225 + <attribute default="" name="testmethods"/>
29.226 + <attribute default="${main.class}" name="testClass"/>
29.227 + <attribute default="" name="testMethod"/>
29.228 + <sequential>
29.229 + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
29.230 <customize2>
29.231 <syspropertyset>
29.232 <propertyref prefix="test-sys-prop."/>
29.233 <mapper from="test-sys-prop.*" to="*" type="glob"/>
29.234 </syspropertyset>
29.235 </customize2>
29.236 - </j2seproject3:test-debug-impl>
29.237 + </j2seproject3:testng-debug-impl>
29.238 </sequential>
29.239 </macrodef>
29.240 </target>
29.241 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
29.242 - <target name="-profile-pre-init">
29.243 + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
29.244 + <!--
29.245 + pre NB7.2 profiling section; consider it deprecated
29.246 + -->
29.247 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
29.248 + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
29.249 <!-- Empty placeholder for easier customization. -->
29.250 <!-- You can override this target in the ../build.xml file. -->
29.251 </target>
29.252 - <target name="-profile-post-init">
29.253 + <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
29.254 <!-- Empty placeholder for easier customization. -->
29.255 <!-- You can override this target in the ../build.xml file. -->
29.256 </target>
29.257 - <target name="-profile-init-macrodef-profile">
29.258 + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
29.259 <macrodef name="resolve">
29.260 <attribute name="name"/>
29.261 <attribute name="value"/>
29.262 @@ -693,10 +739,13 @@
29.263 </sequential>
29.264 </macrodef>
29.265 </target>
29.266 - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
29.267 + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
29.268 <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
29.269 <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
29.270 </target>
29.271 + <!--
29.272 + end of pre NB7.2 profiling section
29.273 + -->
29.274 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
29.275 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
29.276 <attribute default="${main.class}" name="name"/>
29.277 @@ -771,6 +820,7 @@
29.278 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
29.279 <attribute default="${main.class}" name="classname"/>
29.280 <attribute default="${run.classpath}" name="classpath"/>
29.281 + <attribute default="jvm" name="jvm"/>
29.282 <element name="customize" optional="true"/>
29.283 <sequential>
29.284 <java classname="@{classname}" dir="${work.dir}" fork="true">
29.285 @@ -805,6 +855,9 @@
29.286 <path path="${run.classpath.without.build.classes.dir}"/>
29.287 <chainedmapper>
29.288 <flattenmapper/>
29.289 + <filtermapper>
29.290 + <replacestring from=" " to="%20"/>
29.291 + </filtermapper>
29.292 <globmapper from="*" to="lib/*"/>
29.293 </chainedmapper>
29.294 </pathconvert>
29.295 @@ -878,6 +931,13 @@
29.296 <param name="call.target" value="jar"/>
29.297 <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
29.298 </antcall>
29.299 + <antcall target="-maybe-call-dep">
29.300 + <param name="call.built.properties" value="${built-jar.properties}"/>
29.301 + <param location="${project.resolve_web_api}" name="call.subproject"/>
29.302 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
29.303 + <param name="call.target" value="jar"/>
29.304 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
29.305 + </antcall>
29.306 </target>
29.307 <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
29.308 <target depends="init" name="-check-automatic-build">
29.309 @@ -910,7 +970,7 @@
29.310 <target if="has.persistence.xml" name="-copy-persistence-xml">
29.311 <mkdir dir="${build.classes.dir}/META-INF"/>
29.312 <copy todir="${build.classes.dir}/META-INF">
29.313 - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
29.314 + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
29.315 </copy>
29.316 </target>
29.317 <target name="-post-compile">
29.318 @@ -1073,7 +1133,11 @@
29.319 PROFILING SECTION
29.320 =================
29.321 -->
29.322 - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
29.323 + <!--
29.324 + pre NB7.2 profiler integration
29.325 + -->
29.326 + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
29.327 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
29.328 <nbprofiledirect>
29.329 <classpath>
29.330 <path path="${run.classpath}"/>
29.331 @@ -1081,8 +1145,9 @@
29.332 </nbprofiledirect>
29.333 <profile/>
29.334 </target>
29.335 - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
29.336 + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
29.337 <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
29.338 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
29.339 <nbprofiledirect>
29.340 <classpath>
29.341 <path path="${run.classpath}"/>
29.342 @@ -1090,12 +1155,8 @@
29.343 </nbprofiledirect>
29.344 <profile classname="${profile.class}"/>
29.345 </target>
29.346 - <!--
29.347 - =========================
29.348 - APPLET PROFILING SECTION
29.349 - =========================
29.350 - -->
29.351 - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
29.352 + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
29.353 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
29.354 <nbprofiledirect>
29.355 <classpath>
29.356 <path path="${run.classpath}"/>
29.357 @@ -1107,12 +1168,8 @@
29.358 </customize>
29.359 </profile>
29.360 </target>
29.361 - <!--
29.362 - =========================
29.363 - TESTS PROFILING SECTION
29.364 - =========================
29.365 - -->
29.366 - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
29.367 + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
29.368 + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
29.369 <nbprofiledirect>
29.370 <classpath>
29.371 <path path="${run.test.classpath}"/>
29.372 @@ -1135,6 +1192,42 @@
29.373 </junit>
29.374 </target>
29.375 <!--
29.376 + end of pre NB72 profiling section
29.377 + -->
29.378 + <target if="netbeans.home" name="-profile-check">
29.379 + <condition property="profiler.configured">
29.380 + <or>
29.381 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
29.382 + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
29.383 + </or>
29.384 + </condition>
29.385 + </target>
29.386 + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
29.387 + <startprofiler/>
29.388 + <antcall target="run"/>
29.389 + </target>
29.390 + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
29.391 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
29.392 + <startprofiler/>
29.393 + <antcall target="run-single"/>
29.394 + </target>
29.395 + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
29.396 + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
29.397 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
29.398 + <startprofiler/>
29.399 + <antcall target="test-single"/>
29.400 + </target>
29.401 + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
29.402 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
29.403 + <startprofiler/>
29.404 + <antcal target="run-test-with-main"/>
29.405 + </target>
29.406 + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
29.407 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
29.408 + <startprofiler/>
29.409 + <antcall target="run-applet"/>
29.410 + </target>
29.411 + <!--
29.412 ===============
29.413 JAVADOC SECTION
29.414 ===============
29.415 @@ -1260,13 +1353,14 @@
29.416 TEST DEBUGGING SECTION
29.417 =======================
29.418 -->
29.419 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
29.420 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
29.421 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
29.422 - <j2seproject3:test-debug testClass="${test.class}"/>
29.423 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
29.424 </target>
29.425 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test-method">
29.426 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
29.427 <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
29.428 - <j2seproject3:test-debug testClass="${test.class}" testMethod="${test.method}"/>
29.429 + <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
29.430 + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
29.431 </target>
29.432 <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
29.433 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
29.434 @@ -1331,6 +1425,13 @@
29.435 <param name="call.target" value="clean"/>
29.436 <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
29.437 </antcall>
29.438 + <antcall target="-maybe-call-dep">
29.439 + <param name="call.built.properties" value="${built-clean.properties}"/>
29.440 + <param location="${project.resolve_web_api}" name="call.subproject"/>
29.441 + <param location="${project.resolve_web_api}/build.xml" name="call.script"/>
29.442 + <param name="call.target" value="clean"/>
29.443 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
29.444 + </antcall>
29.445 </target>
29.446 <target depends="init" name="-do-clean">
29.447 <delete dir="${build.dir}"/>
30.1 --- a/remoting/server/web/web.ui/nbproject/genfiles.properties Fri Nov 30 07:36:26 2012 +0100
30.2 +++ b/remoting/server/web/web.ui/nbproject/genfiles.properties Fri Nov 30 18:49:18 2012 +0100
30.3 @@ -1,13 +1,13 @@
30.4 -build.xml.data.CRC32=a94f37d1
30.5 +build.xml.data.CRC32=ea2551e2
30.6 build.xml.script.CRC32=7ac0d4d0
30.7 -build.xml.stylesheet.CRC32=28e38971@1.51.0.46
30.8 +build.xml.stylesheet.CRC32=28e38971@1.56.0.46
30.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
30.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
30.11 <<<<<<< local
30.12 nbproject/build-impl.xml.data.CRC32=9ceb8e45
30.13 nbproject/build-impl.xml.script.CRC32=d8965d3c
30.14 =======
30.15 -nbproject/build-impl.xml.data.CRC32=a94f37d1
30.16 -nbproject/build-impl.xml.script.CRC32=7f1b6324
30.17 +nbproject/build-impl.xml.data.CRC32=ea2551e2
30.18 +nbproject/build-impl.xml.script.CRC32=46a2f2ec
30.19 >>>>>>> other
30.20 -nbproject/build-impl.xml.stylesheet.CRC32=b222b120@1.51.0.46
30.21 +nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.0.46
31.1 --- a/remoting/server/web/web.ui/nbproject/project.properties Fri Nov 30 07:36:26 2012 +0100
31.2 +++ b/remoting/server/web/web.ui/nbproject/project.properties Fri Nov 30 18:49:18 2012 +0100
31.3 @@ -27,9 +27,7 @@
31.4 dist.javadoc.dir=${dist.dir}/javadoc
31.5 endorsed.classpath=
31.6 excludes=
31.7 -file.reference.org-netbeans-api-java-classpath.jar=../../../../lib/org-netbeans-api-java-classpath.jar
31.8 file.reference.org-netbeans-modules-java-lexer.jar=../../../../lib/org-netbeans-modules-java-lexer.jar
31.9 -file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
31.10 file.reference.org-netbeans-modules-jumpto.jar=../../../../lib/org-netbeans-modules-jumpto.jar
31.11 file.reference.org-netbeans-modules-lexer.jar=../../../../lib/org-netbeans-modules-lexer.jar
31.12 file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
31.13 @@ -46,8 +44,6 @@
31.14 ${libs.jersey.classpath}:\
31.15 ${libs.freemarker.classpath}:\
31.16 ${reference.base_web_api.jar}:\
31.17 - ${file.reference.org-netbeans-api-java-classpath.jar}:\
31.18 - ${file.reference.org-netbeans-modules-java-source.jar}:\
31.19 ${file.reference.org-netbeans-modules-jumpto.jar}:\
31.20 ${file.reference.org-netbeans-modules-parsing-lucene.jar}:\
31.21 ${file.reference.org-openide-filesystems.jar}:\
31.22 @@ -55,7 +51,9 @@
31.23 ${file.reference.util-pojson.jar-1}:\
31.24 ${file.reference.org-netbeans-modules-java-lexer.jar}:\
31.25 ${file.reference.org-netbeans-modules-lexer.jar}:\
31.26 - ${file.reference.org-openide-util.jar}
31.27 + ${file.reference.org-openide-util.jar}:\
31.28 + ${reference.resolve_web_api.jar}:\
31.29 + ${libs.javac.classpath}
31.30 # Space-separated list of extra javac options
31.31 javac.compilerargs=
31.32 javac.deprecation=false
31.33 @@ -95,7 +93,9 @@
31.34 mkdist.disabled=false
31.35 platform.active=default_platform
31.36 project.base_web_api=../base.web.api
31.37 +project.resolve_web_api=../resolve.web.api
31.38 reference.base_web_api.jar=${project.base_web_api}/dist/base.web.api.jar
31.39 +reference.resolve_web_api.jar=${project.resolve_web_api}/dist/resolve.web.api.jar
31.40 run.classpath=\
31.41 ${javac.classpath}:\
31.42 ${build.classes.dir}
32.1 --- a/remoting/server/web/web.ui/nbproject/project.xml Fri Nov 30 07:36:26 2012 +0100
32.2 +++ b/remoting/server/web/web.ui/nbproject/project.xml Fri Nov 30 18:49:18 2012 +0100
32.3 @@ -23,6 +23,14 @@
32.4 <clean-target>clean</clean-target>
32.5 <id>jar</id>
32.6 </reference>
32.7 + <reference>
32.8 + <foreign-project>resolve_web_api</foreign-project>
32.9 + <artifact-type>jar</artifact-type>
32.10 + <script>build.xml</script>
32.11 + <target>jar</target>
32.12 + <clean-target>clean</clean-target>
32.13 + <id>jar</id>
32.14 + </reference>
32.15 </references>
32.16 </configuration>
32.17 </project>
33.1 --- a/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/UI.java Fri Nov 30 07:36:26 2012 +0100
33.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/UI.java Fri Nov 30 18:49:18 2012 +0100
33.3 @@ -51,12 +51,13 @@
33.4 import java.util.Collections;
33.5 import java.util.Comparator;
33.6 import java.util.HashMap;
33.7 +import java.util.Iterator;
33.8 import java.util.LinkedHashMap;
33.9 import java.util.LinkedList;
33.10 import java.util.List;
33.11 import java.util.Map;
33.12 import java.util.Map.Entry;
33.13 -import javax.ws.rs.DefaultValue;
33.14 +import java.util.concurrent.atomic.AtomicBoolean;
33.15 import javax.ws.rs.GET;
33.16 import javax.ws.rs.Path;
33.17 import javax.ws.rs.Produces;
33.18 @@ -65,11 +66,19 @@
33.19 import javax.ws.rs.core.UriInfo;
33.20 import org.codeviation.pojson.Pojson;
33.21 import org.netbeans.api.java.lexer.JavaTokenId;
33.22 +import org.netbeans.api.lexer.Token;
33.23 import org.netbeans.api.lexer.TokenHierarchy;
33.24 import org.netbeans.api.lexer.TokenSequence;
33.25 +import org.netbeans.modules.jackpot30.backend.base.CategoryStorage;
33.26 import org.netbeans.modules.jackpot30.backend.base.FreemarkerUtilities;
33.27 import org.netbeans.modules.jackpot30.backend.base.WebUtilities;
33.28 import static org.netbeans.modules.jackpot30.backend.base.WebUtilities.escapeForQuery;
33.29 +import org.netbeans.modules.jackpot30.backend.ui.highlighting.ColoringAttributes;
33.30 +import org.netbeans.modules.jackpot30.backend.ui.highlighting.ColoringAttributes.Coloring;
33.31 +import org.netbeans.modules.jackpot30.backend.ui.highlighting.SemanticHighlighter;
33.32 +import org.netbeans.modules.jackpot30.backend.ui.highlighting.TokenList;
33.33 +import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
33.34 +import org.netbeans.modules.jackpot30.resolve.api.ResolveService;
33.35
33.36 /**
33.37 *
33.38 @@ -179,30 +188,52 @@
33.39 @GET
33.40 @Path("/show")
33.41 @Produces("text/html")
33.42 - public String show(@Context UriInfo uriInfo, @QueryParam("path") String segment, @QueryParam("relative") String relative, @QueryParam("highlight") @DefaultValue("[]") String highlightSpec) throws URISyntaxException, IOException, TemplateException {
33.43 + public String show(@Context UriInfo uriInfo, @QueryParam("path") String segment, @QueryParam("relative") String relative, @QueryParam("highlight") String highlightSpec, @QueryParam("signature") String signature) throws URISyntaxException, IOException, TemplateException, InterruptedException {
33.44 String urlBase = URL_BASE_OVERRIDE != null ? URL_BASE_OVERRIDE : uriInfo.getBaseUri().toString();
33.45 URI u = new URI(urlBase + "index/source/cat?path=" + escapeForQuery(segment) + "&relative=" + escapeForQuery(relative));
33.46 String content = WebUtilities.requestStringResponse(u);
33.47 - List<Long> highlightSpans = Pojson.load(ArrayList.class, highlightSpec);
33.48 + List<Long> highlightSpans = new ArrayList<Long>();
33.49 +
33.50 + if (signature != null) {
33.51 + CompilationInfo info = ResolveService.parse(segment, relative);
33.52 + List<long[]> spans = ResolveService.usages(info, signature);
33.53 +
33.54 + for (long[] span : spans) {
33.55 + highlightSpans.add(span[0]);
33.56 + highlightSpans.add(span[1]);
33.57 + }
33.58 + }
33.59 +
33.60 + if (highlightSpec != null) {
33.61 + highlightSpans.addAll(Pojson.load(ArrayList.class, highlightSpec));
33.62 + }
33.63 +
33.64 Map<String, Object> configurationData = new HashMap<String, Object>();
33.65 - String[] highlights = colorTokens(content, highlightSpans);
33.66 + String[] highlights = colorTokens(segment, relative, content, highlightSpans);
33.67
33.68 configurationData.put("spans", highlights[0]);
33.69 configurationData.put("categories", highlights[1]);
33.70 configurationData.put("code", translate(content));
33.71 + configurationData.put("path", segment);
33.72 + configurationData.put("relative", relative);
33.73
33.74 return FreemarkerUtilities.processTemplate("org/netbeans/modules/jackpot30/backend/ui/showCode.html", configurationData);
33.75 }
33.76
33.77 - static String[] colorTokens(String content, List<Long> highlight) {
33.78 + static String[] colorTokens(String segment, String relative, String content, List<Long> highlight) throws IOException, InterruptedException {
33.79 TokenSequence<?> ts = TokenHierarchy.create(content, JavaTokenId.language()).tokenSequence();
33.80 + CompilationInfo info = ResolveService.parse(segment, relative);
33.81 + Map<Token, Coloring> semanticHighlights = SemanticHighlighter.computeHighlights(info, new TokenList(info, ts, new AtomicBoolean()));
33.82 StringBuilder spans = new StringBuilder();
33.83 StringBuilder cats = new StringBuilder();
33.84 long currentOffset = 0;
33.85 boolean cont = false;
33.86
33.87 + ts.moveStart();
33.88 +
33.89 while (cont || ts.moveNext()) {
33.90 if (spans.length() > 0) spans.append(", ");
33.91 + if (cats.length() > 0) cats.append(", ");
33.92
33.93 long endOffset = ts.offset() + ts.token().length();
33.94 boolean foundHighlight = false;
33.95 @@ -236,31 +267,25 @@
33.96 spans.append(endOffset - currentOffset);
33.97 String category = ts.token().id().primaryCategory();
33.98
33.99 - char cat;
33.100 -
33.101 - if ("keyword".equals(category)) {
33.102 - cat = 'K';
33.103 - } else if ("keyword-directive".equals(category)) {
33.104 - cat = 'K';
33.105 - } else if ("literal".equals(category)) {
33.106 - cat = 'K';
33.107 - } else if ("whitespace".equals(category)) {
33.108 - cat = 'W';
33.109 - } else if ("comment".equals(category)) {
33.110 - cat = 'C';
33.111 - } else if ("character".equals(category)) {
33.112 - cat = 'H';
33.113 - } else if ("number".equals(category)) {
33.114 - cat = 'N';
33.115 - } else if ("string".equals(category)) {
33.116 - cat = 'S';
33.117 - } else {
33.118 - cat = 'E';
33.119 + if ("keyword-directive".equals(category)) {
33.120 + category = "keyword";
33.121 }
33.122
33.123 - if (foundHighlight) cat++;
33.124 + if (foundHighlight) {
33.125 + if (!category.isEmpty()) category += " ";
33.126 + category += "highlight";
33.127 + }
33.128
33.129 - cats.append(cat);
33.130 + Coloring coloring = semanticHighlights.get(ts.token());
33.131 +
33.132 + if (coloring != null) {
33.133 + for (ColoringAttributes ca : coloring) {
33.134 + if (!category.isEmpty()) category += " ";
33.135 + category += ca.name().toLowerCase();
33.136 + }
33.137 + }
33.138 +
33.139 + cats.append(category);
33.140
33.141 currentOffset = endOffset;
33.142 }
33.143 @@ -373,6 +398,7 @@
33.144 Map<String, Object> configurationData = new HashMap<String, Object>();
33.145
33.146 configurationData.put("elementDisplayName", elementDisplayName(elementSignature)); //TODO
33.147 + configurationData.put("elementSignature", elementSignature); //TODO
33.148
33.149 List<Map<String, Object>> results = new ArrayList<Map<String, Object>>(segments2Process.size());
33.150
33.151 @@ -625,4 +651,75 @@
33.152
33.153 return originalSignature;
33.154 }
33.155 +
33.156 + @GET
33.157 + @Path("/target")
33.158 +// @Produces("text/html")
33.159 + public String target(@QueryParam("path") String segment, @QueryParam("relative") String relative, @QueryParam("position") Long position, @QueryParam("signature") String signature) throws URISyntaxException, IOException, TemplateException, InterruptedException {
33.160 + CompilationInfo info = ResolveService.parse(segment, relative);
33.161 + Object target = null;
33.162 +
33.163 + if (signature != null) {
33.164 + long[] span = ResolveService.declarationSpans(info, signature);
33.165 +
33.166 + if (span != null) {
33.167 + target = span[2];
33.168 + }
33.169 + } else {
33.170 + target = ResolveService.resolveGoToTarget(info, position);
33.171 + }
33.172 +
33.173 + Map<String, Object> result = new HashMap<String, Object>();
33.174 +
33.175 + if (target instanceof Long) {
33.176 + result.put("position", target);
33.177 + } else if (target instanceof String) {
33.178 + String targetSignature = (String) target;
33.179 + String source = ResolveService.resolveSource(segment, relative, targetSignature);
33.180 +
33.181 + result.put("signature", targetSignature);
33.182 +
33.183 + if (source != null) {
33.184 + result.put("path", segment);
33.185 + result.put("source", source);
33.186 + } else {
33.187 + String singleSource = null;
33.188 + String singleSourceSegment = null;
33.189 + boolean multipleSources = false;
33.190 + List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
33.191 +
33.192 + for (Entry<? extends CategoryStorage, ? extends Iterable<? extends String>> e : ResolveService.findSourcesContaining(targetSignature).entrySet()) {
33.193 + Map<String, Object> categoryData = new HashMap<String, Object>();
33.194 +
33.195 + categoryData.put("rootDisplayName", e.getKey().getDisplayName());
33.196 + categoryData.put("rootPath", e.getKey().getId());
33.197 + categoryData.put("files", e.getValue());
33.198 +
33.199 + if (!multipleSources) {
33.200 + Iterator<? extends String> fIt = e.getValue().iterator();
33.201 +
33.202 + if (fIt.hasNext()) {
33.203 + singleSource = fIt.next();
33.204 + singleSourceSegment = e.getKey().getId();
33.205 + }
33.206 +
33.207 + if (fIt.hasNext())
33.208 + multipleSources = true;
33.209 + }
33.210 +
33.211 + results.add(categoryData);
33.212 + }
33.213 +
33.214 + if (singleSource != null && !multipleSources) {
33.215 + //TODO: will automatically jump to the single known target - correct
33.216 + result.put("path", singleSourceSegment);
33.217 + result.put("source", singleSource);
33.218 + } else if (!results.isEmpty()) {
33.219 + result.put("targets", results);
33.220 + }
33.221 + }
33.222 + }
33.223 +
33.224 + return Pojson.save(result);
33.225 + }
33.226 }
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/ColoringAttributes.diff Fri Nov 30 18:49:18 2012 +0100
34.3 @@ -0,0 +1,4 @@
34.4 +44c44
34.5 +< package org.netbeans.modules.java.editor.semantic;
34.6 +---
34.7 +> package org.netbeans.modules.jackpot30.backend.ui.highlighting;
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/ColoringAttributes.java Fri Nov 30 18:49:18 2012 +0100
35.3 @@ -0,0 +1,191 @@
35.4 +/*
35.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 + *
35.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
35.8 + *
35.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
35.10 + * Other names may be trademarks of their respective owners.
35.11 + *
35.12 + * The contents of this file are subject to the terms of either the GNU
35.13 + * General Public License Version 2 only ("GPL") or the Common
35.14 + * Development and Distribution License("CDDL") (collectively, the
35.15 + * "License"). You may not use this file except in compliance with the
35.16 + * License. You can obtain a copy of the License at
35.17 + * http://www.netbeans.org/cddl-gplv2.html
35.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.19 + * specific language governing permissions and limitations under the
35.20 + * License. When distributing the software, include this License Header
35.21 + * Notice in each file and include the License file at
35.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
35.23 + * particular file as subject to the "Classpath" exception as provided
35.24 + * by Oracle in the GPL Version 2 section of the License file that
35.25 + * accompanied this code. If applicable, add the following below the
35.26 + * License Header, with the fields enclosed by brackets [] replaced by
35.27 + * your own identifying information:
35.28 + * "Portions Copyrighted [year] [name of copyright owner]"
35.29 + *
35.30 + * Contributor(s):
35.31 + *
35.32 + * The Original Software is NetBeans. The Initial Developer of the Original
35.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
35.34 + * Microsystems, Inc. All Rights Reserved.
35.35 + *
35.36 + * If you wish your version of this file to be governed by only the CDDL
35.37 + * or only the GPL Version 2, indicate your decision by adding
35.38 + * "[Contributor] elects to include this software in this distribution
35.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.40 + * single choice of license, a recipient has the option to distribute
35.41 + * your version of this file under either the CDDL, the GPL Version 2 or
35.42 + * to extend the choice of license to its licensees as provided above.
35.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
35.44 + * Version 2 license, then the option applies only if the new code is
35.45 + * made subject to such option by the copyright holder.
35.46 + */
35.47 +package org.netbeans.modules.jackpot30.backend.ui.highlighting;
35.48 +
35.49 +import java.util.Collection;
35.50 +import java.util.EnumSet;
35.51 +import java.util.Iterator;
35.52 +import java.util.Set;
35.53 +
35.54 +/**
35.55 + *
35.56 + * @author Jan Lahoda
35.57 + */
35.58 +public enum ColoringAttributes {
35.59 +
35.60 + UNUSED,
35.61 +
35.62 + ABSTRACT,
35.63 +
35.64 + FIELD,
35.65 + LOCAL_VARIABLE,
35.66 + PARAMETER,
35.67 + METHOD,
35.68 + CONSTRUCTOR,
35.69 + CLASS,
35.70 + INTERFACE,
35.71 + ANNOTATION_TYPE,
35.72 + ENUM,
35.73 + DEPRECATED,
35.74 + STATIC,
35.75 +
35.76 + DECLARATION,
35.77 +
35.78 + PRIVATE,
35.79 + PACKAGE_PRIVATE,
35.80 + PROTECTED,
35.81 + PUBLIC,
35.82 +
35.83 + TYPE_PARAMETER_DECLARATION,
35.84 + TYPE_PARAMETER_USE,
35.85 +
35.86 + UNDEFINED,
35.87 +
35.88 + MARK_OCCURRENCES,
35.89 +
35.90 + JAVADOC_IDENTIFIER;
35.91 +
35.92 + public static Coloring empty() {
35.93 + return new Coloring();
35.94 + }
35.95 +
35.96 + public static Coloring add(Coloring c, ColoringAttributes a) {
35.97 + Coloring ci = new Coloring();
35.98 +
35.99 + ci.value = c.value | (1 << a.ordinal());
35.100 +
35.101 + return ci;
35.102 + }
35.103 +
35.104 + public static final class Coloring implements Collection<ColoringAttributes> {
35.105 +
35.106 + private int value;
35.107 +
35.108 + private Coloring() {}
35.109 +
35.110 + public int size() {
35.111 + return Integer.bitCount(value);
35.112 + }
35.113 +
35.114 + public boolean isEmpty() {
35.115 + return value == 0;
35.116 + }
35.117 +
35.118 + public boolean contains(Object o) {
35.119 + if (o instanceof ColoringAttributes) {
35.120 + return (value & (1 << ((ColoringAttributes) o).ordinal())) !=0;
35.121 + } else {
35.122 + return false;
35.123 + }
35.124 + }
35.125 +
35.126 + public Iterator<ColoringAttributes> iterator() {
35.127 + Set<ColoringAttributes> s = EnumSet.noneOf(ColoringAttributes.class);
35.128 + for (ColoringAttributes c : ColoringAttributes.values()) {
35.129 + if (contains(c))
35.130 + s.add(c);
35.131 + }
35.132 +
35.133 + return s.iterator();
35.134 + }
35.135 +
35.136 + public Object[] toArray() {
35.137 + throw new UnsupportedOperationException("Not supported yet.");
35.138 + }
35.139 +
35.140 + public <T> T[] toArray(T[] a) {
35.141 + throw new UnsupportedOperationException("Not supported yet.");
35.142 + }
35.143 +
35.144 + public boolean add(ColoringAttributes o) {
35.145 + throw new UnsupportedOperationException("Not supported yet.");
35.146 + }
35.147 +
35.148 + public boolean remove(Object o) {
35.149 + throw new UnsupportedOperationException("Not supported yet.");
35.150 + }
35.151 +
35.152 + public boolean containsAll(Collection<?> c) {
35.153 + for (Object o : c) {
35.154 + if (!contains(o))
35.155 + return false;
35.156 + }
35.157 +
35.158 + return true;
35.159 + }
35.160 +
35.161 + public boolean addAll(Collection<? extends ColoringAttributes> c) {
35.162 + throw new UnsupportedOperationException("Not supported yet.");
35.163 + }
35.164 +
35.165 + public boolean removeAll(Collection<?> c) {
35.166 + throw new UnsupportedOperationException("Not supported yet.");
35.167 + }
35.168 +
35.169 + public boolean retainAll(Collection<?> c) {
35.170 + throw new UnsupportedOperationException("Not supported yet.");
35.171 + }
35.172 +
35.173 + public void clear() {
35.174 + throw new UnsupportedOperationException("Not supported yet.");
35.175 + }
35.176 +
35.177 + @Override
35.178 + public int hashCode() {
35.179 + return value;
35.180 + }
35.181 +
35.182 + @Override
35.183 + public boolean equals(Object obj) {
35.184 + if (obj instanceof Coloring) {
35.185 + //XXX:
35.186 + return ((Coloring) obj).value == value;
35.187 + }
35.188 +
35.189 + return false;
35.190 + }
35.191 +
35.192 +
35.193 + }
35.194 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/ColoringAttributes.java.original Fri Nov 30 18:49:18 2012 +0100
36.3 @@ -0,0 +1,191 @@
36.4 +/*
36.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
36.6 + *
36.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
36.8 + *
36.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
36.10 + * Other names may be trademarks of their respective owners.
36.11 + *
36.12 + * The contents of this file are subject to the terms of either the GNU
36.13 + * General Public License Version 2 only ("GPL") or the Common
36.14 + * Development and Distribution License("CDDL") (collectively, the
36.15 + * "License"). You may not use this file except in compliance with the
36.16 + * License. You can obtain a copy of the License at
36.17 + * http://www.netbeans.org/cddl-gplv2.html
36.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
36.19 + * specific language governing permissions and limitations under the
36.20 + * License. When distributing the software, include this License Header
36.21 + * Notice in each file and include the License file at
36.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
36.23 + * particular file as subject to the "Classpath" exception as provided
36.24 + * by Oracle in the GPL Version 2 section of the License file that
36.25 + * accompanied this code. If applicable, add the following below the
36.26 + * License Header, with the fields enclosed by brackets [] replaced by
36.27 + * your own identifying information:
36.28 + * "Portions Copyrighted [year] [name of copyright owner]"
36.29 + *
36.30 + * Contributor(s):
36.31 + *
36.32 + * The Original Software is NetBeans. The Initial Developer of the Original
36.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
36.34 + * Microsystems, Inc. All Rights Reserved.
36.35 + *
36.36 + * If you wish your version of this file to be governed by only the CDDL
36.37 + * or only the GPL Version 2, indicate your decision by adding
36.38 + * "[Contributor] elects to include this software in this distribution
36.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
36.40 + * single choice of license, a recipient has the option to distribute
36.41 + * your version of this file under either the CDDL, the GPL Version 2 or
36.42 + * to extend the choice of license to its licensees as provided above.
36.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
36.44 + * Version 2 license, then the option applies only if the new code is
36.45 + * made subject to such option by the copyright holder.
36.46 + */
36.47 +package org.netbeans.modules.java.editor.semantic;
36.48 +
36.49 +import java.util.Collection;
36.50 +import java.util.EnumSet;
36.51 +import java.util.Iterator;
36.52 +import java.util.Set;
36.53 +
36.54 +/**
36.55 + *
36.56 + * @author Jan Lahoda
36.57 + */
36.58 +public enum ColoringAttributes {
36.59 +
36.60 + UNUSED,
36.61 +
36.62 + ABSTRACT,
36.63 +
36.64 + FIELD,
36.65 + LOCAL_VARIABLE,
36.66 + PARAMETER,
36.67 + METHOD,
36.68 + CONSTRUCTOR,
36.69 + CLASS,
36.70 + INTERFACE,
36.71 + ANNOTATION_TYPE,
36.72 + ENUM,
36.73 + DEPRECATED,
36.74 + STATIC,
36.75 +
36.76 + DECLARATION,
36.77 +
36.78 + PRIVATE,
36.79 + PACKAGE_PRIVATE,
36.80 + PROTECTED,
36.81 + PUBLIC,
36.82 +
36.83 + TYPE_PARAMETER_DECLARATION,
36.84 + TYPE_PARAMETER_USE,
36.85 +
36.86 + UNDEFINED,
36.87 +
36.88 + MARK_OCCURRENCES,
36.89 +
36.90 + JAVADOC_IDENTIFIER;
36.91 +
36.92 + public static Coloring empty() {
36.93 + return new Coloring();
36.94 + }
36.95 +
36.96 + public static Coloring add(Coloring c, ColoringAttributes a) {
36.97 + Coloring ci = new Coloring();
36.98 +
36.99 + ci.value = c.value | (1 << a.ordinal());
36.100 +
36.101 + return ci;
36.102 + }
36.103 +
36.104 + public static final class Coloring implements Collection<ColoringAttributes> {
36.105 +
36.106 + private int value;
36.107 +
36.108 + private Coloring() {}
36.109 +
36.110 + public int size() {
36.111 + return Integer.bitCount(value);
36.112 + }
36.113 +
36.114 + public boolean isEmpty() {
36.115 + return value == 0;
36.116 + }
36.117 +
36.118 + public boolean contains(Object o) {
36.119 + if (o instanceof ColoringAttributes) {
36.120 + return (value & (1 << ((ColoringAttributes) o).ordinal())) !=0;
36.121 + } else {
36.122 + return false;
36.123 + }
36.124 + }
36.125 +
36.126 + public Iterator<ColoringAttributes> iterator() {
36.127 + Set<ColoringAttributes> s = EnumSet.noneOf(ColoringAttributes.class);
36.128 + for (ColoringAttributes c : ColoringAttributes.values()) {
36.129 + if (contains(c))
36.130 + s.add(c);
36.131 + }
36.132 +
36.133 + return s.iterator();
36.134 + }
36.135 +
36.136 + public Object[] toArray() {
36.137 + throw new UnsupportedOperationException("Not supported yet.");
36.138 + }
36.139 +
36.140 + public <T> T[] toArray(T[] a) {
36.141 + throw new UnsupportedOperationException("Not supported yet.");
36.142 + }
36.143 +
36.144 + public boolean add(ColoringAttributes o) {
36.145 + throw new UnsupportedOperationException("Not supported yet.");
36.146 + }
36.147 +
36.148 + public boolean remove(Object o) {
36.149 + throw new UnsupportedOperationException("Not supported yet.");
36.150 + }
36.151 +
36.152 + public boolean containsAll(Collection<?> c) {
36.153 + for (Object o : c) {
36.154 + if (!contains(o))
36.155 + return false;
36.156 + }
36.157 +
36.158 + return true;
36.159 + }
36.160 +
36.161 + public boolean addAll(Collection<? extends ColoringAttributes> c) {
36.162 + throw new UnsupportedOperationException("Not supported yet.");
36.163 + }
36.164 +
36.165 + public boolean removeAll(Collection<?> c) {
36.166 + throw new UnsupportedOperationException("Not supported yet.");
36.167 + }
36.168 +
36.169 + public boolean retainAll(Collection<?> c) {
36.170 + throw new UnsupportedOperationException("Not supported yet.");
36.171 + }
36.172 +
36.173 + public void clear() {
36.174 + throw new UnsupportedOperationException("Not supported yet.");
36.175 + }
36.176 +
36.177 + @Override
36.178 + public int hashCode() {
36.179 + return value;
36.180 + }
36.181 +
36.182 + @Override
36.183 + public boolean equals(Object obj) {
36.184 + if (obj instanceof Coloring) {
36.185 + //XXX:
36.186 + return ((Coloring) obj).value == value;
36.187 + }
36.188 +
36.189 + return false;
36.190 + }
36.191 +
36.192 +
36.193 + }
36.194 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/SemanticHighlighter.diff Fri Nov 30 18:49:18 2012 +0100
37.3 @@ -0,0 +1,354 @@
37.4 +44c44
37.5 +< package org.netbeans.modules.java.editor.semantic;
37.6 +---
37.7 +> package org.netbeans.modules.jackpot30.backend.ui.highlighting;
37.8 +84c84,86
37.9 +< import java.io.IOException;
37.10 +---
37.11 +> import com.sun.source.util.TreePathScanner;
37.12 +> import com.sun.tools.javac.tree.JCTree;
37.13 +> import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
37.14 +94,96d95
37.15 +< import java.util.concurrent.atomic.AtomicBoolean;
37.16 +< import java.util.logging.Level;
37.17 +< import java.util.logging.Logger;
37.18 +102,109d100
37.19 +< import javax.swing.SwingUtilities;
37.20 +< import javax.swing.text.Document;
37.21 +< import org.netbeans.api.java.source.CompilationInfo;
37.22 +< import org.netbeans.api.java.source.JavaParserResultTask;
37.23 +< import org.netbeans.api.java.source.JavaSource.Phase;
37.24 +< import org.netbeans.api.java.source.TreePathHandle;
37.25 +< import org.netbeans.api.java.source.TreeUtilities;
37.26 +< import org.netbeans.api.java.source.support.CancellableTreePathScanner;
37.27 +111,123c102,103
37.28 +< import org.netbeans.api.lexer.TokenHierarchy;
37.29 +< import org.netbeans.modules.editor.NbEditorUtilities;
37.30 +< import org.netbeans.modules.java.editor.imports.UnusedImports;
37.31 +< import org.netbeans.modules.java.editor.semantic.ColoringAttributes.Coloring;
37.32 +< import org.netbeans.modules.parsing.spi.Parser.Result;
37.33 +< import org.netbeans.modules.parsing.spi.Scheduler;
37.34 +< import org.netbeans.modules.parsing.spi.SchedulerEvent;
37.35 +< import org.netbeans.modules.parsing.spi.TaskIndexingMode;
37.36 +< import org.netbeans.spi.editor.highlighting.support.OffsetsBag;
37.37 +< import org.netbeans.spi.editor.hints.ErrorDescription;
37.38 +< import org.openide.filesystems.FileObject;
37.39 +< import org.openide.filesystems.FileUtil;
37.40 +< import org.openide.loaders.DataObject;
37.41 +---
37.42 +> import org.netbeans.modules.jackpot30.backend.ui.highlighting.ColoringAttributes.Coloring;
37.43 +> import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
37.44 +130,214c110
37.45 +< public class SemanticHighlighter extends JavaParserResultTask {
37.46 +<
37.47 +< public static List<TreePathHandle> computeUnusedImports(CompilationInfo info) throws IOException {
37.48 +< final List<TreePathHandle> result = new ArrayList<TreePathHandle>();
37.49 +<
37.50 +< for (TreePath unused : UnusedImports.process(info, new AtomicBoolean())) {
37.51 +< result.add(TreePathHandle.create(unused, info));
37.52 +< }
37.53 +<
37.54 +< return result;
37.55 +< }
37.56 +<
37.57 +< private FileObject file;
37.58 +< //XXX: correct rescheduling when troubles traversing token list!
37.59 +< // private SemanticHighlighterFactory fact;
37.60 +< private AtomicBoolean cancel = new AtomicBoolean();
37.61 +<
37.62 +< // SemanticHighlighter(FileObject file) {
37.63 +< // this(file, null);
37.64 +< // }
37.65 +< //
37.66 +< SemanticHighlighter(FileObject file/*, SemanticHighlighterFactory fact*/) {
37.67 +< super(Phase.RESOLVED, TaskIndexingMode.ALLOWED_DURING_SCAN);
37.68 +< this.file = file;
37.69 +< // this.fact = fact;
37.70 +< }
37.71 +<
37.72 +< @Override
37.73 +< public void run(Result result, SchedulerEvent event) {
37.74 +< CompilationInfo info = CompilationInfo.get(result);
37.75 +<
37.76 +< if (info == null) {
37.77 +< return ;
37.78 +< }
37.79 +<
37.80 +< cancel.set(false);
37.81 +<
37.82 +< final Document doc = result.getSnapshot().getSource().getDocument(false);
37.83 +<
37.84 +< if (!verifyDocument(doc)) return;
37.85 +<
37.86 +< if (process(info, doc)/* && fact != null*/) {
37.87 +< // fact.rescheduleImpl(file);
37.88 +< }
37.89 +< }
37.90 +<
37.91 +< private static boolean verifyDocument(final Document doc) {
37.92 +< if (doc == null) {
37.93 +< Logger.getLogger(SemanticHighlighter.class.getName()).log(Level.FINE, "SemanticHighlighter: Cannot get document!");
37.94 +< return false;
37.95 +< }
37.96 +<
37.97 +< final boolean[] tokenSequenceNull = new boolean[1];
37.98 +< doc.render(new Runnable() {
37.99 +< public void run() {
37.100 +< tokenSequenceNull[0] = (TokenHierarchy.get(doc).tokenSequence() == null);
37.101 +< }
37.102 +< });
37.103 +< if (tokenSequenceNull[0]) {
37.104 +< return false;
37.105 +< }
37.106 +<
37.107 +< return true;
37.108 +< }
37.109 +<
37.110 +< public void cancel() {
37.111 +< cancel.set(true);
37.112 +< }
37.113 +<
37.114 +<
37.115 +< @Override
37.116 +< public int getPriority() {
37.117 +< return 100;
37.118 +< }
37.119 +<
37.120 +< @Override
37.121 +< public Class<? extends Scheduler> getSchedulerClass() {
37.122 +< return Scheduler.EDITOR_SENSITIVE_TASK_SCHEDULER;
37.123 +< }
37.124 +<
37.125 +<
37.126 +<
37.127 +< boolean process(CompilationInfo info, final Document doc) {
37.128 +< return process(info, doc, ERROR_DESCRIPTION_SETTER);
37.129 +< }
37.130 +---
37.131 +> public class SemanticHighlighter {
37.132 +218c114
37.133 +<
37.134 +---
37.135 +>
37.136 +222c118
37.137 +<
37.138 +---
37.139 +>
37.140 +225,227c121,123
37.141 +<
37.142 +< boolean process(CompilationInfo info, final Document doc, ErrorDescriptionSetter setter) {
37.143 +< DetectorVisitor v = new DetectorVisitor(info, doc, cancel);
37.144 +---
37.145 +>
37.146 +> public static Map<Token, Coloring> computeHighlights(CompilationInfo info, TokenList tl) {
37.147 +> DetectorVisitor v = new DetectorVisitor(info, tl);
37.148 +232d127
37.149 +< List<ErrorDescription> errors = new ArrayList<ErrorDescription>();
37.150 +238,269c133
37.151 +< if (cancel.get())
37.152 +< return true;
37.153 +<
37.154 +< boolean computeUnusedImports = "text/x-java".equals(FileUtil.getMIMEType(info.getFileObject()));
37.155 +<
37.156 +< final List<TreePathHandle> allUnusedImports = computeUnusedImports ? new ArrayList<TreePathHandle>() : null;
37.157 +< OffsetsBag imports = computeUnusedImports ? new OffsetsBag(doc) : null;
37.158 +<
37.159 +< if (computeUnusedImports) {
37.160 +< Coloring unused = ColoringAttributes.add(ColoringAttributes.empty(), ColoringAttributes.UNUSED);
37.161 +< Collection<TreePath> unusedImports = UnusedImports.process(info, cancel);
37.162 +<
37.163 +< if (unusedImports == null) return true;
37.164 +<
37.165 +< for (TreePath tree : unusedImports) {
37.166 +< if (cancel.get()) {
37.167 +< return true;
37.168 +< }
37.169 +<
37.170 +< //XXX: finish
37.171 +< final int startPos = (int) info.getTrees().getSourcePositions().getStartPosition(cu, tree.getLeaf());
37.172 +< final int endPos = (int) info.getTrees().getSourcePositions().getEndPosition(cu, tree.getLeaf());
37.173 +<
37.174 +< imports.addHighlight(startPos, endPos, ColoringManager.getColoringImpl(unused));
37.175 +<
37.176 +< TreePathHandle handle = TreePathHandle.create(tree, info);
37.177 +<
37.178 +< allUnusedImports.add(handle);
37.179 +< }
37.180 +< }
37.181 +<
37.182 +< Map<Token, Coloring> oldColors = LexerBasedHighlightLayer.getLayer(SemanticHighlighter.class, doc).getColorings();
37.183 +---
37.184 +> Map<Token, Coloring> oldColors = new HashMap<Token, Coloring>();
37.185 +274,276d137
37.186 +< if (cancel.get())
37.187 +< return true;
37.188 +<
37.189 +283c144
37.190 +< if (u.type.contains(UseTypes.DECLARATION) && org.netbeans.modules.java.editor.semantic.Utilities.isPrivateElement(decl)) {
37.191 +---
37.192 +> if (u.type.contains(UseTypes.DECLARATION) && isPrivateElement(decl)) {
37.193 +319,332c180
37.194 +< if (cancel.get())
37.195 +< return true;
37.196 +<
37.197 +< if (computeUnusedImports) {
37.198 +< setter.setErrors(doc, errors, allUnusedImports);
37.199 +< setter.setHighlights(doc, imports);
37.200 +< }
37.201 +<
37.202 +< setter.setColorings(doc, newColoring, addedTokens, removedTokens.keySet());
37.203 +<
37.204 +< Logger.getLogger("TIMER").log(Level.FINE, "Semantic",
37.205 +< new Object[] {NbEditorUtilities.getFileObject(doc), System.currentTimeMillis() - start});
37.206 +<
37.207 +< return false;
37.208 +---
37.209 +> return newColoring;
37.210 +336c184
37.211 +< private boolean hasAllTypes(List<Use> uses, Collection<UseTypes> types) {
37.212 +---
37.213 +> private static boolean hasAllTypes(List<Use> uses, Collection<UseTypes> types) {
37.214 +389c237
37.215 +< private static class DetectorVisitor extends CancellableTreePathScanner<Void, EnumSet<UseTypes>> {
37.216 +---
37.217 +> private static class DetectorVisitor extends TreePathScanner<Void, EnumSet<UseTypes>> {
37.218 +391,392c239
37.219 +< private org.netbeans.api.java.source.CompilationInfo info;
37.220 +< private Document doc;
37.221 +---
37.222 +> private CompilationInfo info;
37.223 +402,404c249
37.224 +< private DetectorVisitor(org.netbeans.api.java.source.CompilationInfo info, final Document doc, AtomicBoolean cancel) {
37.225 +< super(cancel);
37.226 +<
37.227 +---
37.228 +> private DetectorVisitor(CompilationInfo info, TokenList tl) {
37.229 +406d250
37.230 +< this.doc = doc;
37.231 +411c255
37.232 +< tl = new TokenList(info, doc, cancel);
37.233 +---
37.234 +> this.tl = tl;
37.235 +601c445
37.236 +< if (Utilities.isKeyword(expr.getLeaf())) {
37.237 +---
37.238 +> if (isKeyword(expr.getLeaf())) {
37.239 +806c650
37.240 +< if (info.getTreeUtilities().isSynthetic(getCurrentPath()))
37.241 +---
37.242 +> if (isSynthetic(getCurrentPath()))
37.243 +834c678
37.244 +< if (info.getTreeUtilities().isSynthetic(getCurrentPath())) {
37.245 +---
37.246 +> if (isSynthetic(getCurrentPath())) {
37.247 +886c730
37.248 +< while (tp != null && !TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
37.249 +---
37.250 +> while (tp != null && !CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
37.251 +890c734
37.252 +< if (tp != null && TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
37.253 +---
37.254 +> if (tp != null && CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
37.255 +1003c847
37.256 +< int[] span = info.getTreeUtilities().findNameSpan(tree);
37.257 +---
37.258 +> int[] span = new int[] {((JCVariableDecl) tree).pos, ((JCVariableDecl) tree).pos + tree.getName().length()};//info.getTreeUtilities().findNameSpan(tree);
37.259 +1313,1317c1157,1160
37.260 +< public static interface ErrorDescriptionSetter {
37.261 +<
37.262 +< public void setErrors(Document doc, List<ErrorDescription> errors, List<TreePathHandle> allUnusedImports);
37.263 +< public void setHighlights(Document doc, OffsetsBag highlights);
37.264 +< public void setColorings(Document doc, Map<Token, Coloring> colorings, Set<Token> addedTokens, Set<Token> removedTokens);
37.265 +---
37.266 +>
37.267 +> //not fully correct, but should suffice now:
37.268 +> private static boolean isSynthetic(TreePath path) {
37.269 +> return ((JCTree) path.getLeaf()).pos == (-1);
37.270 +1319,1329c1162,1185
37.271 +<
37.272 +< static ErrorDescriptionSetter ERROR_DESCRIPTION_SETTER = new ErrorDescriptionSetter() {
37.273 +<
37.274 +< public void setErrors(Document doc, List<ErrorDescription> errors, List<TreePathHandle> allUnusedImports) {}
37.275 +<
37.276 +< public void setHighlights(final Document doc, final OffsetsBag highlights) {
37.277 +< SwingUtilities.invokeLater(new Runnable() {
37.278 +< public void run() {
37.279 +< getImportHighlightsBag(doc).setHighlights(highlights);
37.280 +< }
37.281 +< });
37.282 +---
37.283 +>
37.284 +> //from semantic.Utilities:
37.285 +> private static final Set<String> keywords;
37.286 +> private static final Set<String> nonCtorKeywords;
37.287 +>
37.288 +> static {
37.289 +> keywords = new HashSet<String>();
37.290 +>
37.291 +> keywords.add("true");
37.292 +> keywords.add("false");
37.293 +> keywords.add("null");
37.294 +> keywords.add("this");
37.295 +> keywords.add("super");
37.296 +> keywords.add("class");
37.297 +>
37.298 +> nonCtorKeywords = new HashSet<String>(keywords);
37.299 +> nonCtorKeywords.remove("this");
37.300 +> nonCtorKeywords.remove("super");
37.301 +>
37.302 +> }
37.303 +>
37.304 +> public static boolean isKeyword(Tree tree) {
37.305 +> if (tree.getKind() == Kind.IDENTIFIER) {
37.306 +> return keywords.contains(((IdentifierTree) tree).getName().toString());
37.307 +1331,1337c1187,1188
37.308 +<
37.309 +< public void setColorings(final Document doc, final Map<Token, Coloring> colorings, final Set<Token> addedTokens, final Set<Token> removedTokens) {
37.310 +< SwingUtilities.invokeLater(new Runnable () {
37.311 +< public void run() {
37.312 +< LexerBasedHighlightLayer.getLayer(SemanticHighlighter.class, doc).setColorings(colorings, addedTokens, removedTokens);
37.313 +< }
37.314 +< });
37.315 +---
37.316 +> if (tree.getKind() == Kind.MEMBER_SELECT) {
37.317 +> return keywords.contains(((MemberSelectTree) tree).getIdentifier().toString());
37.318 +1339d1189
37.319 +< };
37.320 +1341,1352c1191,1196
37.321 +< private static final Object KEY_UNUSED_IMPORTS = new Object();
37.322 +< static OffsetsBag getImportHighlightsBag(Document doc) {
37.323 +< OffsetsBag bag = (OffsetsBag) doc.getProperty(KEY_UNUSED_IMPORTS);
37.324 +<
37.325 +< if (bag == null) {
37.326 +< doc.putProperty(KEY_UNUSED_IMPORTS, bag = new OffsetsBag(doc));
37.327 +<
37.328 +< Object stream = doc.getProperty(Document.StreamDescriptionProperty);
37.329 +<
37.330 +< if (stream instanceof DataObject) {
37.331 +< // TimesCollector.getDefault().reportReference(((DataObject) stream).getPrimaryFile(), "ImportsHighlightsBag", "[M] Imports Highlights Bag", bag);
37.332 +< }
37.333 +---
37.334 +> return false;
37.335 +> }
37.336 +>
37.337 +> public static boolean isNonCtorKeyword(Tree tree) {
37.338 +> if (tree.getKind() == Kind.IDENTIFIER) {
37.339 +> return nonCtorKeywords.contains(((IdentifierTree) tree).getName().toString());
37.340 +1354,1355c1198,1208
37.341 +<
37.342 +< return bag;
37.343 +---
37.344 +> if (tree.getKind() == Kind.MEMBER_SELECT) {
37.345 +> return nonCtorKeywords.contains(((MemberSelectTree) tree).getIdentifier().toString());
37.346 +> }
37.347 +>
37.348 +> return false;
37.349 +> }
37.350 +>
37.351 +> private static final Set<ElementKind> LOCAL_ELEMENT_KINDS = EnumSet.of(ElementKind.PARAMETER, ElementKind.LOCAL_VARIABLE, ElementKind.EXCEPTION_PARAMETER, ElementKind.RESOURCE_VARIABLE);
37.352 +>
37.353 +> public static boolean isPrivateElement(Element el) {
37.354 +> return LOCAL_ELEMENT_KINDS.contains(el.getKind()) || el.getModifiers().contains(Modifier.PRIVATE);
37.355 +1357a1211,1212
37.356 +> //from TreeUtilities:
37.357 +> public static final Set<Kind> CLASS_TREE_KINDS = EnumSet.of(Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE);
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/SemanticHighlighter.java Fri Nov 30 18:49:18 2012 +0100
38.3 @@ -0,0 +1,1213 @@
38.4 +/*
38.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
38.6 + *
38.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
38.8 + *
38.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
38.10 + * Other names may be trademarks of their respective owners.
38.11 + *
38.12 + * The contents of this file are subject to the terms of either the GNU
38.13 + * General Public License Version 2 only ("GPL") or the Common
38.14 + * Development and Distribution License("CDDL") (collectively, the
38.15 + * "License"). You may not use this file except in compliance with the
38.16 + * License. You can obtain a copy of the License at
38.17 + * http://www.netbeans.org/cddl-gplv2.html
38.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
38.19 + * specific language governing permissions and limitations under the
38.20 + * License. When distributing the software, include this License Header
38.21 + * Notice in each file and include the License file at
38.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
38.23 + * particular file as subject to the "Classpath" exception as provided
38.24 + * by Oracle in the GPL Version 2 section of the License file that
38.25 + * accompanied this code. If applicable, add the following below the
38.26 + * License Header, with the fields enclosed by brackets [] replaced by
38.27 + * your own identifying information:
38.28 + * "Portions Copyrighted [year] [name of copyright owner]"
38.29 + *
38.30 + * Contributor(s):
38.31 + *
38.32 + * The Original Software is NetBeans. The Initial Developer of the Original
38.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
38.34 + * Microsystems, Inc. All Rights Reserved.
38.35 + *
38.36 + * If you wish your version of this file to be governed by only the CDDL
38.37 + * or only the GPL Version 2, indicate your decision by adding
38.38 + * "[Contributor] elects to include this software in this distribution
38.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
38.40 + * single choice of license, a recipient has the option to distribute
38.41 + * your version of this file under either the CDDL, the GPL Version 2 or
38.42 + * to extend the choice of license to its licensees as provided above.
38.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
38.44 + * Version 2 license, then the option applies only if the new code is
38.45 + * made subject to such option by the copyright holder.
38.46 + */
38.47 +package org.netbeans.modules.jackpot30.backend.ui.highlighting;
38.48 +
38.49 +import com.sun.source.tree.AnnotationTree;
38.50 +import com.sun.source.tree.ArrayAccessTree;
38.51 +import com.sun.source.tree.ArrayTypeTree;
38.52 +import com.sun.source.tree.AssertTree;
38.53 +import com.sun.source.tree.AssignmentTree;
38.54 +import com.sun.source.tree.BinaryTree;
38.55 +import com.sun.source.tree.CaseTree;
38.56 +import com.sun.source.tree.CatchTree;
38.57 +import com.sun.source.tree.ClassTree;
38.58 +import com.sun.source.tree.CompilationUnitTree;
38.59 +import com.sun.source.tree.CompoundAssignmentTree;
38.60 +import com.sun.source.tree.ConditionalExpressionTree;
38.61 +import com.sun.source.tree.EnhancedForLoopTree;
38.62 +import com.sun.source.tree.ExpressionStatementTree;
38.63 +import com.sun.source.tree.ExpressionTree;
38.64 +import com.sun.source.tree.ForLoopTree;
38.65 +import com.sun.source.tree.IdentifierTree;
38.66 +import com.sun.source.tree.ImportTree;
38.67 +import com.sun.source.tree.InstanceOfTree;
38.68 +import com.sun.source.tree.MemberSelectTree;
38.69 +import com.sun.source.tree.MethodInvocationTree;
38.70 +import com.sun.source.tree.MethodTree;
38.71 +import com.sun.source.tree.NewArrayTree;
38.72 +import com.sun.source.tree.NewClassTree;
38.73 +import com.sun.source.tree.ParameterizedTypeTree;
38.74 +import com.sun.source.tree.ParenthesizedTree;
38.75 +import com.sun.source.tree.ReturnTree;
38.76 +import com.sun.source.tree.ThrowTree;
38.77 +import com.sun.source.tree.Tree;
38.78 +import com.sun.source.tree.Tree.Kind;
38.79 +import com.sun.source.tree.TypeCastTree;
38.80 +import com.sun.source.tree.TypeParameterTree;
38.81 +import com.sun.source.tree.UnaryTree;
38.82 +import com.sun.source.tree.UnionTypeTree;
38.83 +import com.sun.source.tree.VariableTree;
38.84 +import com.sun.source.tree.WildcardTree;
38.85 +import com.sun.source.util.SourcePositions;
38.86 +import com.sun.source.util.TreePath;
38.87 +import com.sun.source.util.TreePathScanner;
38.88 +import com.sun.tools.javac.tree.JCTree;
38.89 +import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
38.90 +import java.util.ArrayList;
38.91 +import java.util.Collection;
38.92 +import java.util.EnumSet;
38.93 +import java.util.HashMap;
38.94 +import java.util.HashSet;
38.95 +import java.util.IdentityHashMap;
38.96 +import java.util.List;
38.97 +import java.util.Map;
38.98 +import java.util.Set;
38.99 +import javax.lang.model.element.Element;
38.100 +import javax.lang.model.element.ElementKind;
38.101 +import javax.lang.model.element.ExecutableElement;
38.102 +import javax.lang.model.element.Modifier;
38.103 +import javax.lang.model.type.TypeKind;
38.104 +import org.netbeans.api.lexer.Token;
38.105 +import org.netbeans.modules.jackpot30.backend.ui.highlighting.ColoringAttributes.Coloring;
38.106 +import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
38.107 +
38.108 +
38.109 +/**
38.110 + *
38.111 + * @author Jan Lahoda
38.112 + */
38.113 +public class SemanticHighlighter {
38.114 +
38.115 + static Coloring collection2Coloring(Collection<ColoringAttributes> attr) {
38.116 + Coloring c = ColoringAttributes.empty();
38.117 +
38.118 + for (ColoringAttributes a : attr) {
38.119 + c = ColoringAttributes.add(c, a);
38.120 + }
38.121 +
38.122 + return c;
38.123 + }
38.124 +
38.125 + public static Map<Token, Coloring> computeHighlights(CompilationInfo info, TokenList tl) {
38.126 + DetectorVisitor v = new DetectorVisitor(info, tl);
38.127 +
38.128 + long start = System.currentTimeMillis();
38.129 +
38.130 + Map<Token, Coloring> newColoring = new IdentityHashMap<Token, Coloring>();
38.131 +
38.132 + CompilationUnitTree cu = info.getCompilationUnit();
38.133 +
38.134 + v.scan(cu, null);
38.135 +
38.136 + Map<Token, Coloring> oldColors = new HashMap<Token, Coloring>();
38.137 + Map<Token, Coloring> removedTokens = new IdentityHashMap<Token, Coloring>(oldColors);
38.138 + Set<Token> addedTokens = new HashSet<Token>();
38.139 +
38.140 + for (Element decl : v.type2Uses.keySet()) {
38.141 + List<Use> uses = v.type2Uses.get(decl);
38.142 +
38.143 + for (Use u : uses) {
38.144 + if (u.spec == null)
38.145 + continue;
38.146 +
38.147 + if (u.type.contains(UseTypes.DECLARATION) && isPrivateElement(decl)) {
38.148 + if ((decl.getKind().isField() && !isSerialVersionUID(info, decl)) || isLocalVariableClosure(decl)) {
38.149 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.READ, UseTypes.WRITE))) {
38.150 + u.spec.add(ColoringAttributes.UNUSED);
38.151 + }
38.152 + }
38.153 +
38.154 + if ((decl.getKind() == ElementKind.CONSTRUCTOR && !decl.getModifiers().contains(Modifier.PRIVATE)) || decl.getKind() == ElementKind.METHOD) {
38.155 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.EXECUTE))) {
38.156 + u.spec.add(ColoringAttributes.UNUSED);
38.157 + }
38.158 + }
38.159 +
38.160 + if (decl.getKind().isClass() || decl.getKind().isInterface()) {
38.161 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.CLASS_USE))) {
38.162 + u.spec.add(ColoringAttributes.UNUSED);
38.163 + }
38.164 + }
38.165 + }
38.166 +
38.167 + Coloring c = collection2Coloring(u.spec);
38.168 +
38.169 + Token t = v.tree2Token.get(u.tree.getLeaf());
38.170 +
38.171 + if (t != null) {
38.172 + newColoring.put(t, c);
38.173 +
38.174 + Coloring oldColoring = removedTokens.remove(t);
38.175 +
38.176 + if (oldColoring == null || !oldColoring.equals(c)) {
38.177 + addedTokens.add(t);
38.178 + }
38.179 + }
38.180 + }
38.181 + }
38.182 +
38.183 + return newColoring;
38.184 + }
38.185 +
38.186 +
38.187 + private static boolean hasAllTypes(List<Use> uses, Collection<UseTypes> types) {
38.188 + EnumSet e = EnumSet.copyOf(types);
38.189 +
38.190 + for (Use u : uses) {
38.191 + if (types.isEmpty()) {
38.192 + return true;
38.193 + }
38.194 +
38.195 + types.removeAll(u.type);
38.196 + }
38.197 +
38.198 + return types.isEmpty();
38.199 + }
38.200 +
38.201 + private enum UseTypes {
38.202 + READ, WRITE, EXECUTE, DECLARATION, CLASS_USE;
38.203 + }
38.204 +
38.205 + private static boolean isLocalVariableClosure(Element el) {
38.206 + return el.getKind() == ElementKind.PARAMETER || el.getKind() == ElementKind.LOCAL_VARIABLE
38.207 + || el.getKind() == ElementKind.RESOURCE_VARIABLE || el.getKind() == ElementKind.EXCEPTION_PARAMETER;
38.208 + }
38.209 +
38.210 + /** Detects static final long SerialVersionUID
38.211 + * @return true if element is final static long serialVersionUID
38.212 + */
38.213 + private static boolean isSerialVersionUID(CompilationInfo info, Element el) {
38.214 + if (el.getKind().isField() && el.getModifiers().contains(Modifier.FINAL)
38.215 + && el.getModifiers().contains(Modifier.STATIC)
38.216 + && info.getTypes().getPrimitiveType(TypeKind.LONG).equals(el.asType())
38.217 + && el.getSimpleName().toString().equals("serialVersionUID"))
38.218 + return true;
38.219 + else
38.220 + return false;
38.221 + }
38.222 +
38.223 + private static class Use {
38.224 + private Collection<UseTypes> type;
38.225 + private TreePath tree;
38.226 + private Collection<ColoringAttributes> spec;
38.227 +
38.228 + public Use(Collection<UseTypes> type, TreePath tree, Collection<ColoringAttributes> spec) {
38.229 + this.type = type;
38.230 + this.tree = tree;
38.231 + this.spec = spec;
38.232 + }
38.233 +
38.234 + @Override
38.235 + public String toString() {
38.236 + return "Use: " + type;
38.237 + }
38.238 + }
38.239 +
38.240 + private static class DetectorVisitor extends TreePathScanner<Void, EnumSet<UseTypes>> {
38.241 +
38.242 + private CompilationInfo info;
38.243 + private Map<Element, List<Use>> type2Uses;
38.244 +
38.245 + private Map<Tree, Token> tree2Token;
38.246 + private TokenList tl;
38.247 + private long memberSelectBypass = -1;
38.248 +
38.249 + private SourcePositions sourcePositions;
38.250 + private ExecutableElement recursionDetector;
38.251 +
38.252 + private DetectorVisitor(CompilationInfo info, TokenList tl) {
38.253 + this.info = info;
38.254 + type2Uses = new HashMap<Element, List<Use>>();
38.255 +
38.256 + tree2Token = new IdentityHashMap<Tree, Token>();
38.257 +
38.258 + this.tl = tl;
38.259 +
38.260 + this.sourcePositions = info.getTrees().getSourcePositions();
38.261 +// this.pos = pos;
38.262 + }
38.263 +
38.264 + private void firstIdentifier(String name) {
38.265 + tl.firstIdentifier(getCurrentPath(), name, tree2Token);
38.266 + }
38.267 +
38.268 + @Override
38.269 + public Void visitAssignment(AssignmentTree tree, EnumSet<UseTypes> d) {
38.270 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getVariable()), EnumSet.of(UseTypes.WRITE));
38.271 +
38.272 + Tree expr = tree.getExpression();
38.273 +
38.274 + if (expr instanceof IdentifierTree) {
38.275 + TreePath tp = new TreePath(getCurrentPath(), expr);
38.276 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
38.277 + }
38.278 +
38.279 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
38.280 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
38.281 +
38.282 + return null;
38.283 + }
38.284 +
38.285 + @Override
38.286 + public Void visitCompoundAssignment(CompoundAssignmentTree tree, EnumSet<UseTypes> d) {
38.287 + Set<UseTypes> useTypes = EnumSet.of(UseTypes.WRITE);
38.288 +
38.289 + if (d != null) {
38.290 + useTypes.addAll(d);
38.291 + }
38.292 +
38.293 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getVariable()), useTypes);
38.294 +
38.295 + Tree expr = tree.getExpression();
38.296 +
38.297 + if (expr instanceof IdentifierTree) {
38.298 + TreePath tp = new TreePath(getCurrentPath(), expr);
38.299 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
38.300 + }
38.301 +
38.302 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
38.303 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
38.304 +
38.305 + return null;
38.306 + }
38.307 +
38.308 + @Override
38.309 + public Void visitReturn(ReturnTree tree, EnumSet<UseTypes> d) {
38.310 + if (tree.getExpression() instanceof IdentifierTree) {
38.311 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
38.312 + }
38.313 +
38.314 + super.visitReturn(tree, EnumSet.of(UseTypes.READ));
38.315 + return null;
38.316 + }
38.317 +
38.318 + @Override
38.319 + public Void visitMemberSelect(MemberSelectTree tree, EnumSet<UseTypes> d) {
38.320 + long memberSelectBypassLoc = memberSelectBypass;
38.321 +
38.322 + memberSelectBypass = -1;
38.323 +
38.324 + Tree expr = tree.getExpression();
38.325 +
38.326 + if (expr instanceof IdentifierTree) {
38.327 + TreePath tp = new TreePath(getCurrentPath(), expr);
38.328 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
38.329 + }
38.330 +
38.331 + Element el = info.getTrees().getElement(getCurrentPath());
38.332 +
38.333 + if (el != null && el.getKind().isField()) {
38.334 + handlePossibleIdentifier(getCurrentPath(), d == null ? EnumSet.of(UseTypes.READ) : d);
38.335 + }
38.336 +
38.337 + if (el != null && (el.getKind().isClass() || el.getKind().isInterface()) &&
38.338 + getCurrentPath().getParentPath().getLeaf().getKind() != Kind.NEW_CLASS) {
38.339 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.CLASS_USE));
38.340 + }
38.341 +
38.342 +// System.err.println("XXXX=" + tree.toString());
38.343 +// System.err.println("YYYY=" + info.getElement(tree));
38.344 +
38.345 + super.visitMemberSelect(tree, null);
38.346 +
38.347 + tl.moveToEnd(tree.getExpression());
38.348 +
38.349 + if (memberSelectBypassLoc != (-1)) {
38.350 + tl.moveToOffset(memberSelectBypassLoc);
38.351 + }
38.352 +
38.353 + firstIdentifier(tree.getIdentifier().toString());
38.354 +
38.355 + return null;
38.356 + }
38.357 +
38.358 + private void addModifiers(Element decl, Collection<ColoringAttributes> c) {
38.359 + if (decl.getModifiers().contains(Modifier.STATIC)) {
38.360 + c.add(ColoringAttributes.STATIC);
38.361 + }
38.362 +
38.363 + if (decl.getModifiers().contains(Modifier.ABSTRACT) && !decl.getKind().isInterface()) {
38.364 + c.add(ColoringAttributes.ABSTRACT);
38.365 + }
38.366 +
38.367 + boolean accessModifier = false;
38.368 +
38.369 + if (decl.getModifiers().contains(Modifier.PUBLIC)) {
38.370 + c.add(ColoringAttributes.PUBLIC);
38.371 + accessModifier = true;
38.372 + }
38.373 +
38.374 + if (decl.getModifiers().contains(Modifier.PROTECTED)) {
38.375 + c.add(ColoringAttributes.PROTECTED);
38.376 + accessModifier = true;
38.377 + }
38.378 +
38.379 + if (decl.getModifiers().contains(Modifier.PRIVATE)) {
38.380 + c.add(ColoringAttributes.PRIVATE);
38.381 + accessModifier = true;
38.382 + }
38.383 +
38.384 + if (!accessModifier && !isLocalVariableClosure(decl)) {
38.385 + c.add(ColoringAttributes.PACKAGE_PRIVATE);
38.386 + }
38.387 +
38.388 + if (info.getElements().isDeprecated(decl)) {
38.389 + c.add(ColoringAttributes.DEPRECATED);
38.390 + }
38.391 + }
38.392 +
38.393 + private Collection<ColoringAttributes> getMethodColoring(ExecutableElement mdecl, boolean nct) {
38.394 + Collection<ColoringAttributes> c = new ArrayList<ColoringAttributes>();
38.395 +
38.396 + addModifiers(mdecl, c);
38.397 +
38.398 + if (mdecl.getKind() == ElementKind.CONSTRUCTOR) {
38.399 + c.add(ColoringAttributes.CONSTRUCTOR);
38.400 +
38.401 + //#146820:
38.402 + if (nct && mdecl.getEnclosingElement() != null && info.getElements().isDeprecated(mdecl.getEnclosingElement())) {
38.403 + c.add(ColoringAttributes.DEPRECATED);
38.404 + }
38.405 + } else
38.406 + c.add(ColoringAttributes.METHOD);
38.407 +
38.408 + return c;
38.409 + }
38.410 +
38.411 + private Collection<ColoringAttributes> getVariableColoring(Element decl) {
38.412 + Collection<ColoringAttributes> c = new ArrayList<ColoringAttributes>();
38.413 +
38.414 + addModifiers(decl, c);
38.415 +
38.416 + if (decl.getKind().isField()) {
38.417 + c.add(ColoringAttributes.FIELD);
38.418 +
38.419 + return c;
38.420 + }
38.421 +
38.422 + if (decl.getKind() == ElementKind.LOCAL_VARIABLE || decl.getKind() == ElementKind.RESOURCE_VARIABLE
38.423 + || decl.getKind() == ElementKind.EXCEPTION_PARAMETER) {
38.424 + c.add(ColoringAttributes.LOCAL_VARIABLE);
38.425 +
38.426 + return c;
38.427 + }
38.428 +
38.429 + if (decl.getKind() == ElementKind.PARAMETER) {
38.430 + c.add(ColoringAttributes.PARAMETER);
38.431 +
38.432 + return c;
38.433 + }
38.434 +
38.435 + assert false;
38.436 +
38.437 + return null;
38.438 + }
38.439 +
38.440 + private static final Set<Kind> LITERALS = EnumSet.of(Kind.BOOLEAN_LITERAL, Kind.CHAR_LITERAL, Kind.DOUBLE_LITERAL, Kind.FLOAT_LITERAL, Kind.INT_LITERAL, Kind.LONG_LITERAL, Kind.STRING_LITERAL);
38.441 +
38.442 + private void handlePossibleIdentifier(TreePath expr, Collection<UseTypes> type) {
38.443 + handlePossibleIdentifier(expr, type, null, false, false);
38.444 + }
38.445 +
38.446 + private void handlePossibleIdentifier(TreePath expr, Collection<UseTypes> type, Element decl, boolean providesDecl, boolean nct) {
38.447 +
38.448 + if (isKeyword(expr.getLeaf())) {
38.449 + //ignore keywords:
38.450 + return ;
38.451 + }
38.452 +
38.453 + if (expr.getLeaf().getKind() == Kind.PRIMITIVE_TYPE) {
38.454 + //ignore primitive types:
38.455 + return ;
38.456 + }
38.457 +
38.458 + if (LITERALS.contains(expr.getLeaf().getKind())) {
38.459 + //ignore literals:
38.460 + return ;
38.461 + }
38.462 +
38.463 + decl = !providesDecl ? info.getTrees().getElement(expr) : decl;
38.464 +
38.465 + Collection<ColoringAttributes> c = null;
38.466 +
38.467 + //causes NPE later, as decl is put into list of declarations to handle:
38.468 +// if (decl == null) {
38.469 +// c = Collections.singletonList(ColoringAttributes.UNDEFINED);
38.470 +// }
38.471 +
38.472 + if (decl != null && (decl.getKind().isField() || isLocalVariableClosure(decl))) {
38.473 + c = getVariableColoring(decl);
38.474 + }
38.475 +
38.476 + if (decl != null && decl instanceof ExecutableElement) {
38.477 + c = getMethodColoring((ExecutableElement) decl, nct);
38.478 + }
38.479 +
38.480 + if (decl != null && (decl.getKind().isClass() || decl.getKind().isInterface())) {
38.481 + //class use make look like read variable access:
38.482 + if (type.contains(UseTypes.READ)) {
38.483 + type = EnumSet.copyOf(type);
38.484 + type.remove(UseTypes.READ);
38.485 + type.add(UseTypes.CLASS_USE);
38.486 + }
38.487 +
38.488 + c = new ArrayList<ColoringAttributes>();
38.489 +
38.490 + addModifiers(decl, c);
38.491 +
38.492 + switch (decl.getKind()) {
38.493 + case CLASS: c.add(ColoringAttributes.CLASS); break;
38.494 + case INTERFACE: c.add(ColoringAttributes.INTERFACE); break;
38.495 + case ANNOTATION_TYPE: c.add(ColoringAttributes.ANNOTATION_TYPE); break;
38.496 + case ENUM: c.add(ColoringAttributes.ENUM); break;
38.497 + }
38.498 + }
38.499 +
38.500 + if (decl != null && type.contains(UseTypes.DECLARATION)) {
38.501 + if (c == null) {
38.502 + c = new ArrayList<ColoringAttributes>();
38.503 + }
38.504 +
38.505 + c.add(ColoringAttributes.DECLARATION);
38.506 + }
38.507 +
38.508 + if (c != null) {
38.509 + addUse(decl, type, expr, c);
38.510 + }
38.511 + }
38.512 +
38.513 + private void addUse(Element decl, Collection<UseTypes> useTypes, TreePath t, Collection<ColoringAttributes> c) {
38.514 + if (decl == recursionDetector) {
38.515 + useTypes.remove(UseTypes.EXECUTE); //recursive execution is not use
38.516 + }
38.517 +
38.518 + List<Use> uses = type2Uses.get(decl);
38.519 +
38.520 + if (uses == null) {
38.521 + type2Uses.put(decl, uses = new ArrayList<Use>());
38.522 + }
38.523 +
38.524 + Use u = new Use(useTypes, t, c);
38.525 +
38.526 + uses.add(u);
38.527 + }
38.528 +
38.529 + @Override
38.530 + public Void visitTypeCast(TypeCastTree tree, EnumSet<UseTypes> d) {
38.531 + Tree expr = tree.getExpression();
38.532 +
38.533 + if (expr.getKind() == Kind.IDENTIFIER) {
38.534 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
38.535 + }
38.536 +
38.537 + Tree cast = tree.getType();
38.538 +
38.539 + if (cast.getKind() == Kind.IDENTIFIER) {
38.540 + handlePossibleIdentifier(new TreePath(getCurrentPath(), cast), EnumSet.of(UseTypes.READ));
38.541 + }
38.542 +
38.543 + super.visitTypeCast(tree, d);
38.544 + return null;
38.545 + }
38.546 +
38.547 + @Override
38.548 + public Void visitInstanceOf(InstanceOfTree tree, EnumSet<UseTypes> d) {
38.549 + Tree expr = tree.getExpression();
38.550 +
38.551 + if (expr instanceof IdentifierTree) {
38.552 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
38.553 + }
38.554 +
38.555 + TreePath tp = new TreePath(getCurrentPath(), tree.getType());
38.556 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.557 +
38.558 + super.visitInstanceOf(tree, null);
38.559 +
38.560 + //TODO: should be considered
38.561 + return null;
38.562 + }
38.563 +
38.564 + @Override
38.565 + public Void visitCompilationUnit(CompilationUnitTree tree, EnumSet<UseTypes> d) {
38.566 + //ignore package X.Y.Z;:
38.567 + //scan(tree.getPackageDecl(), p);
38.568 + tl.moveBefore(tree.getImports());
38.569 + scan(tree.getImports(), d);
38.570 + tl.moveBefore(tree.getPackageAnnotations());
38.571 + scan(tree.getPackageAnnotations(), d);
38.572 + tl.moveToEnd(tree.getImports());
38.573 + scan(tree.getTypeDecls(), d);
38.574 + return null;
38.575 + }
38.576 +
38.577 + private long startOf(List<? extends Tree> trees) {
38.578 + if (trees.isEmpty()) return -1;
38.579 + return sourcePositions.getStartPosition(info.getCompilationUnit(), trees.get(0));
38.580 + }
38.581 +
38.582 + private void handleMethodTypeArguments(TreePath method, List<? extends Tree> tArgs) {
38.583 + //the type arguments are before the last identifier in the select, so we should return there:
38.584 + //not very efficient, though:
38.585 + tl.moveBefore(tArgs);
38.586 +
38.587 + for (Tree expr : tArgs) {
38.588 + if (expr instanceof IdentifierTree) {
38.589 + handlePossibleIdentifier(new TreePath(method, expr), EnumSet.of(UseTypes.CLASS_USE));
38.590 + }
38.591 + }
38.592 + }
38.593 +
38.594 + @Override
38.595 + public Void visitMethodInvocation(MethodInvocationTree tree, EnumSet<UseTypes> d) {
38.596 + Tree possibleIdent = tree.getMethodSelect();
38.597 + boolean handled = false;
38.598 +
38.599 + if (possibleIdent.getKind() == Kind.IDENTIFIER) {
38.600 + //handle "this" and "super" constructors:
38.601 + String ident = ((IdentifierTree) possibleIdent).getName().toString();
38.602 +
38.603 + if ("super".equals(ident) || "this".equals(ident)) { //NOI18N
38.604 + Element resolved = info.getTrees().getElement(getCurrentPath());
38.605 +
38.606 + addUse(resolved, EnumSet.of(UseTypes.EXECUTE), null, null);
38.607 + handled = true;
38.608 + }
38.609 + }
38.610 +
38.611 + if (!handled) {
38.612 + handlePossibleIdentifier(new TreePath(getCurrentPath(), possibleIdent), EnumSet.of(UseTypes.EXECUTE));
38.613 + }
38.614 +
38.615 + List<? extends Tree> ta = tree.getTypeArguments();
38.616 + long afterTypeArguments = ta.isEmpty() ? -1 : info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), ta.get(ta.size() - 1));
38.617 +
38.618 + switch (tree.getMethodSelect().getKind()) {
38.619 + case IDENTIFIER:
38.620 + case MEMBER_SELECT:
38.621 + memberSelectBypass = afterTypeArguments;
38.622 + scan(tree.getMethodSelect(), null);
38.623 + memberSelectBypass = -1;
38.624 + break;
38.625 + default:
38.626 + //todo: log
38.627 + scan(tree.getMethodSelect(), null);
38.628 + }
38.629 +
38.630 + handleMethodTypeArguments(getCurrentPath(), ta);
38.631 +
38.632 + scan(tree.getTypeArguments(), null);
38.633 +
38.634 +// if (tree.getMethodSelect().getKind() == Kind.MEMBER_SELECT && tree2Token.get(tree.getMethodSelect()) == null) {
38.635 +//// if (ts.moveNext()) ???
38.636 +// firstIdentifier(((MemberSelectTree) tree.getMethodSelect()).getIdentifier().toString());
38.637 +// }
38.638 +
38.639 + for (Tree expr : tree.getArguments()) {
38.640 + if (expr instanceof IdentifierTree) {
38.641 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
38.642 + }
38.643 + }
38.644 +
38.645 + scan(tree.getArguments(), EnumSet.of(UseTypes.READ));
38.646 +
38.647 +// super.visitMethodInvocation(tree, null);
38.648 + return null;
38.649 + }
38.650 +
38.651 + @Override
38.652 + public Void visitIdentifier(IdentifierTree tree, EnumSet<UseTypes> d) {
38.653 + if (isSynthetic(getCurrentPath()))
38.654 + return null;
38.655 +// if ("l".equals(tree.toString())) {
38.656 +// Thread.dumpStack();
38.657 +// }
38.658 +// handlePossibleIdentifier(tree);
38.659 +// //also possible type: (like in Collections.EMPTY_LIST):
38.660 +// resolveType(tree);
38.661 +// Thread.dumpStack();
38.662 +
38.663 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
38.664 +
38.665 + if (memberSelectBypass != (-1)) {
38.666 + tl.moveToOffset(memberSelectBypass);
38.667 + memberSelectBypass = -1;
38.668 + }
38.669 +
38.670 + tl.identifierHere(tree, tree2Token);
38.671 +
38.672 + if (d != null) {
38.673 + handlePossibleIdentifier(getCurrentPath(), d);
38.674 + }
38.675 + super.visitIdentifier(tree, null);
38.676 + return null;
38.677 + }
38.678 +//
38.679 + @Override
38.680 + public Void visitMethod(MethodTree tree, EnumSet<UseTypes> d) {
38.681 + if (isSynthetic(getCurrentPath())) {
38.682 + return super.visitMethod(tree, d);
38.683 + }
38.684 +// Element decl = pi.getAttribution().getElement(tree);
38.685 +//
38.686 +// if (decl != null) {
38.687 +// assert decl instanceof ExecutableElement;
38.688 +//
38.689 +// Coloring c = getMethodColoring((ExecutableElement) decl);
38.690 +// HighlightImpl h = createHighlight(decl.getSimpleName(), tree, c, null);
38.691 +//
38.692 +// if (h != null) {
38.693 +// highlights.add(h);
38.694 +// }
38.695 +// }
38.696 +
38.697 + //#170338: constructor without modifiers:
38.698 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
38.699 +
38.700 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.DECLARATION));
38.701 +
38.702 + for (Tree t : tree.getThrows()) {
38.703 + TreePath tp = new TreePath(getCurrentPath(), t);
38.704 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.705 + }
38.706 +
38.707 + EnumSet<UseTypes> paramsUseTypes;
38.708 +
38.709 + Element el = info.getTrees().getElement(getCurrentPath());
38.710 +
38.711 + if (el != null && (el.getModifiers().contains(Modifier.ABSTRACT) || el.getModifiers().contains(Modifier.NATIVE) || !el.getModifiers().contains(Modifier.PRIVATE))) {
38.712 + paramsUseTypes = EnumSet.of(UseTypes.WRITE, UseTypes.READ);
38.713 + } else {
38.714 + paramsUseTypes = EnumSet.of(UseTypes.WRITE);
38.715 + }
38.716 +
38.717 + scan(tree.getModifiers(), null);
38.718 + tl.moveToEnd(tree.getModifiers());
38.719 + scan(tree.getTypeParameters(), null);
38.720 + tl.moveToEnd(tree.getTypeParameters());
38.721 + scan(tree.getReturnType(), EnumSet.of(UseTypes.CLASS_USE));
38.722 + tl.moveToEnd(tree.getReturnType());
38.723 +
38.724 + String name;
38.725 +
38.726 + if (tree.getReturnType() != null) {
38.727 + //method:
38.728 + name = tree.getName().toString();
38.729 + } else {
38.730 + //constructor:
38.731 + TreePath tp = getCurrentPath();
38.732 +
38.733 + while (tp != null && !CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
38.734 + tp = tp.getParentPath();
38.735 + }
38.736 +
38.737 + if (tp != null && CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
38.738 + name = ((ClassTree) tp.getLeaf()).getSimpleName().toString();
38.739 + } else {
38.740 + name = null;
38.741 + }
38.742 + }
38.743 +
38.744 + if (name != null) {
38.745 + firstIdentifier(name);
38.746 + }
38.747 +
38.748 + scan(tree.getParameters(), paramsUseTypes);
38.749 + scan(tree.getThrows(), null);
38.750 + scan(tree.getDefaultValue(), null);
38.751 +
38.752 + recursionDetector = (el != null && el.getKind() == ElementKind.METHOD) ? (ExecutableElement) el : null;
38.753 +
38.754 + scan(tree.getBody(), null);
38.755 +
38.756 + recursionDetector = null;
38.757 +
38.758 + return null;
38.759 + }
38.760 +
38.761 + @Override
38.762 + public Void visitExpressionStatement(ExpressionStatementTree tree, EnumSet<UseTypes> d) {
38.763 +// if (tree instanceof IdentifierTree) {
38.764 +// handlePossibleIdentifier(tree, EnumSet.of(UseTypes.READ));
38.765 +// }
38.766 +
38.767 + super.visitExpressionStatement(tree, null);
38.768 + return null;
38.769 + }
38.770 +
38.771 + @Override
38.772 + public Void visitParenthesized(ParenthesizedTree tree, EnumSet<UseTypes> d) {
38.773 + ExpressionTree expr = tree.getExpression();
38.774 +
38.775 + if (expr instanceof IdentifierTree) {
38.776 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
38.777 + }
38.778 +
38.779 + super.visitParenthesized(tree, d);
38.780 + return null;
38.781 + }
38.782 +
38.783 + @Override
38.784 + public Void visitEnhancedForLoop(EnhancedForLoopTree tree, EnumSet<UseTypes> d) {
38.785 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
38.786 +
38.787 + if (tree.getExpression().getKind() == Kind.IDENTIFIER)
38.788 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
38.789 +
38.790 + scan(tree.getExpression(), null);
38.791 + scan(tree.getStatement(), null);
38.792 +
38.793 + return null;
38.794 + }
38.795 +
38.796 + private boolean isStar(ImportTree tree) {
38.797 + Tree qualIdent = tree.getQualifiedIdentifier();
38.798 +
38.799 + if (qualIdent == null || qualIdent.getKind() == Kind.IDENTIFIER) {
38.800 + return false;
38.801 + }
38.802 +
38.803 + return ((MemberSelectTree) qualIdent).getIdentifier().contentEquals("*");
38.804 + }
38.805 +
38.806 + @Override
38.807 + public Void visitVariable(VariableTree tree, EnumSet<UseTypes> d) {
38.808 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
38.809 + TreePath type = new TreePath(getCurrentPath(), tree.getType());
38.810 +
38.811 + if (type.getLeaf() instanceof ArrayTypeTree) {
38.812 + type = new TreePath(type, ((ArrayTypeTree) type.getLeaf()).getType());
38.813 + }
38.814 +
38.815 + if (type.getLeaf().getKind() == Kind.IDENTIFIER)
38.816 + handlePossibleIdentifier(type, EnumSet.of(UseTypes.CLASS_USE));
38.817 +
38.818 + Collection<UseTypes> uses = null;
38.819 +
38.820 + Element e = info.getTrees().getElement(getCurrentPath());
38.821 + if (tree.getInitializer() != null) {
38.822 + uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
38.823 + if (tree.getInitializer().getKind() == Kind.IDENTIFIER)
38.824 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getInitializer()), EnumSet.of(UseTypes.READ));
38.825 + } else {
38.826 + if (e != null && e.getKind() == ElementKind.FIELD) {
38.827 + uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
38.828 + } else {
38.829 + uses = EnumSet.of(UseTypes.DECLARATION);
38.830 + }
38.831 + }
38.832 +
38.833 + if (d != null) {
38.834 + Set<UseTypes> ut = new HashSet<UseTypes>();
38.835 +
38.836 + ut.addAll(uses);
38.837 + ut.addAll(d);
38.838 +
38.839 + uses = EnumSet.copyOf(ut);
38.840 + }
38.841 +
38.842 + handlePossibleIdentifier(getCurrentPath(), uses);
38.843 +
38.844 + scan(tree.getModifiers(), null);
38.845 +
38.846 + tl.moveToEnd(tree.getModifiers());
38.847 +
38.848 + scan(tree.getType(), null);
38.849 +
38.850 + int[] span = new int[] {((JCVariableDecl) tree).pos, ((JCVariableDecl) tree).pos + tree.getName().length()};//info.getTreeUtilities().findNameSpan(tree);
38.851 + if (span != null)
38.852 + tl.moveToOffset(span[0]);
38.853 + else
38.854 + tl.moveToEnd(tree.getType());
38.855 +
38.856 +// System.err.println("tree.getName().toString()=" + tree.getName().toString());
38.857 +
38.858 + firstIdentifier(tree.getName().toString());
38.859 +
38.860 + tl.moveNext();
38.861 +
38.862 + scan(tree.getInitializer(), EnumSet.of(UseTypes.READ));
38.863 +
38.864 + return null;
38.865 + }
38.866 +
38.867 + @Override
38.868 + public Void visitAnnotation(AnnotationTree tree, EnumSet<UseTypes> d) {
38.869 +// System.err.println("tree.getType()= " + tree.toString());
38.870 +// System.err.println("tree.getType()= " + tree.getClass());
38.871 +//
38.872 + TreePath tp = new TreePath(getCurrentPath(), tree.getAnnotationType());
38.873 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.874 + super.visitAnnotation(tree, EnumSet.noneOf(UseTypes.class));
38.875 + //TODO: maybe should be considered
38.876 + return null;
38.877 + }
38.878 +
38.879 + @Override
38.880 + public Void visitNewClass(NewClassTree tree, EnumSet<UseTypes> d) {
38.881 +// if (info.getTreeUtilities().isSynthetic(getCurrentPath()))
38.882 +// return null;
38.883 +//
38.884 + Tree exp = tree.getEnclosingExpression();
38.885 + if (exp instanceof IdentifierTree) {
38.886 + handlePossibleIdentifier(new TreePath(getCurrentPath(), exp), EnumSet.of(UseTypes.READ));
38.887 + }
38.888 +
38.889 + TreePath tp;
38.890 + Tree ident = tree.getIdentifier();
38.891 +
38.892 + if (ident.getKind() == Kind.PARAMETERIZED_TYPE) {
38.893 + tp = new TreePath(new TreePath(getCurrentPath(), ident), ((ParameterizedTypeTree) ident).getType());
38.894 + } else {
38.895 + tp = new TreePath(getCurrentPath(), ident);
38.896 + }
38.897 +
38.898 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.EXECUTE), info.getTrees().getElement(getCurrentPath()), true, true);
38.899 +
38.900 + Element clazz = info.getTrees().getElement(tp);
38.901 +
38.902 + if (clazz != null) {
38.903 + addUse(clazz, EnumSet.of(UseTypes.CLASS_USE), null, null);
38.904 + }
38.905 +
38.906 + for (Tree expr : tree.getArguments()) {
38.907 + if (expr instanceof IdentifierTree) {
38.908 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
38.909 + }
38.910 + }
38.911 +
38.912 + scan(tree.getEnclosingExpression(), null);
38.913 + scan(tree.getIdentifier(), null);
38.914 + scan(tree.getTypeArguments(), null);
38.915 + scan(tree.getArguments(), EnumSet.of(UseTypes.READ));
38.916 + scan(tree.getClassBody(), null);
38.917 +
38.918 + return null;
38.919 + }
38.920 +
38.921 + @Override
38.922 + public Void visitParameterizedType(ParameterizedTypeTree tree, EnumSet<UseTypes> d) {
38.923 + boolean alreadyHandled = false;
38.924 +
38.925 + if (getCurrentPath().getParentPath().getLeaf().getKind() == Kind.NEW_CLASS) {
38.926 + NewClassTree nct = (NewClassTree) getCurrentPath().getParentPath().getLeaf();
38.927 +
38.928 + alreadyHandled = nct.getTypeArguments().contains(tree) || nct.getIdentifier() == tree;
38.929 + }
38.930 +
38.931 + if (getCurrentPath().getParentPath().getParentPath().getLeaf().getKind() == Kind.NEW_CLASS) {
38.932 + NewClassTree nct = (NewClassTree) getCurrentPath().getParentPath().getParentPath().getLeaf();
38.933 + Tree leafToTest = getCurrentPath().getParentPath().getLeaf();
38.934 +
38.935 + alreadyHandled = nct.getTypeArguments().contains(leafToTest) || nct.getIdentifier() == leafToTest;
38.936 + }
38.937 +
38.938 + if (!alreadyHandled) {
38.939 + //NewClass has already been handled as part of visitNewClass:
38.940 + TreePath tp = new TreePath(getCurrentPath(), tree.getType());
38.941 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.942 + }
38.943 +
38.944 + for (Tree t : tree.getTypeArguments()) {
38.945 + TreePath tp = new TreePath(getCurrentPath(), t);
38.946 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.947 +
38.948 +// HighlightImpl h = createHighlight("", t, TYPE_PARAMETER);
38.949 +//
38.950 +// if (h != null)
38.951 +// highlights.add(h);
38.952 + }
38.953 +
38.954 + super.visitParameterizedType(tree, null);
38.955 + return null;
38.956 + }
38.957 +
38.958 + @Override
38.959 + public Void visitBinary(BinaryTree tree, EnumSet<UseTypes> d) {
38.960 + Tree left = tree.getLeftOperand();
38.961 + Tree right = tree.getRightOperand();
38.962 +
38.963 + if (left instanceof IdentifierTree) {
38.964 + TreePath tp = new TreePath(getCurrentPath(), left);
38.965 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
38.966 + }
38.967 +
38.968 + if (right instanceof IdentifierTree) {
38.969 + TreePath tp = new TreePath(getCurrentPath(), right);
38.970 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
38.971 + }
38.972 +
38.973 + super.visitBinary(tree, EnumSet.of(UseTypes.READ));
38.974 + return null;
38.975 + }
38.976 +
38.977 + @Override
38.978 + public Void visitClass(ClassTree tree, EnumSet<UseTypes> d) {
38.979 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
38.980 + for (TypeParameterTree t : tree.getTypeParameters()) {
38.981 + for (Tree bound : t.getBounds()) {
38.982 + TreePath tp = new TreePath(new TreePath(getCurrentPath(), t), bound);
38.983 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.984 + }
38.985 + }
38.986 +
38.987 + if(getCurrentPath().getParentPath().getLeaf().getKind() != Kind.NEW_CLASS) {
38.988 + //NEW_CLASS already handeled by visitnewClass
38.989 + Tree extnds = tree.getExtendsClause();
38.990 +
38.991 + if (extnds != null) {
38.992 + TreePath tp = new TreePath(getCurrentPath(), extnds);
38.993 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.994 + }
38.995 +
38.996 + for (Tree t : tree.getImplementsClause()) {
38.997 + TreePath tp = new TreePath(getCurrentPath(), t);
38.998 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.999 + }
38.1000 + }
38.1001 +
38.1002 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.DECLARATION));
38.1003 +
38.1004 + scan(tree.getModifiers(), null);
38.1005 +
38.1006 +// System.err.println("tree.getModifiers()=" + tree.getModifiers());
38.1007 +// System.err.println("mod end=" + sourcePositions.getEndPosition(info.getCompilationUnit(), tree.getModifiers()));
38.1008 +// System.err.println("class start=" + sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
38.1009 + tl.moveToEnd(tree.getModifiers());
38.1010 + firstIdentifier(tree.getSimpleName().toString());
38.1011 +
38.1012 + //XXX:????
38.1013 + scan(tree.getTypeParameters(), null);
38.1014 + scan(tree.getExtendsClause(), null);
38.1015 + scan(tree.getImplementsClause(), null);
38.1016 +
38.1017 + ExecutableElement prevRecursionDetector = recursionDetector;
38.1018 +
38.1019 + recursionDetector = null;
38.1020 +
38.1021 + scan(tree.getMembers(), null);
38.1022 +
38.1023 + recursionDetector = prevRecursionDetector;
38.1024 +
38.1025 + //XXX: end ???
38.1026 +
38.1027 + return null;
38.1028 + }
38.1029 +
38.1030 + @Override
38.1031 + public Void visitUnary(UnaryTree tree, EnumSet<UseTypes> d) {
38.1032 + if (tree.getExpression() instanceof IdentifierTree) {
38.1033 + switch (tree.getKind()) {
38.1034 + case PREFIX_INCREMENT:
38.1035 + case PREFIX_DECREMENT:
38.1036 + case POSTFIX_INCREMENT:
38.1037 + case POSTFIX_DECREMENT:
38.1038 + Set<UseTypes> useTypes = EnumSet.of(UseTypes.WRITE);
38.1039 + if (d != null) {
38.1040 + useTypes.addAll(d);
38.1041 + }
38.1042 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), useTypes);
38.1043 + break;
38.1044 + default:
38.1045 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
38.1046 + }
38.1047 + }
38.1048 + super.visitUnary(tree, d);
38.1049 + return null;
38.1050 + }
38.1051 +
38.1052 + @Override
38.1053 + public Void visitArrayAccess(ArrayAccessTree tree, EnumSet<UseTypes> d) {
38.1054 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
38.1055 + scan(tree.getIndex(), EnumSet.of(UseTypes.READ));
38.1056 +
38.1057 + return null;
38.1058 + }
38.1059 +
38.1060 + @Override
38.1061 + public Void visitArrayType(ArrayTypeTree node, EnumSet<UseTypes> p) {
38.1062 + if (node.getType() != null) {
38.1063 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getType()), EnumSet.of(UseTypes.CLASS_USE));
38.1064 + }
38.1065 + return super.visitArrayType(node, p);
38.1066 + }
38.1067 +
38.1068 + @Override
38.1069 + public Void visitUnionType(UnionTypeTree node, EnumSet<UseTypes> p) {
38.1070 + for (Tree tree : node.getTypeAlternatives()) {
38.1071 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree), EnumSet.of(UseTypes.CLASS_USE));
38.1072 + }
38.1073 + return super.visitUnionType(node, p);
38.1074 + }
38.1075 +
38.1076 + @Override
38.1077 + public Void visitNewArray(NewArrayTree tree, EnumSet<UseTypes> d) {
38.1078 + if (tree.getType() != null) {
38.1079 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getType()), EnumSet.of(UseTypes.CLASS_USE));
38.1080 + }
38.1081 +
38.1082 + scan(tree.getType(), null);
38.1083 + scan(tree.getDimensions(), EnumSet.of(UseTypes.READ));
38.1084 + scan(tree.getInitializers(), EnumSet.of(UseTypes.READ));
38.1085 +
38.1086 + return null;
38.1087 + }
38.1088 +
38.1089 + @Override
38.1090 + public Void visitCatch(CatchTree tree, EnumSet<UseTypes> d) {
38.1091 + scan(tree.getParameter(), EnumSet.of(UseTypes.WRITE));
38.1092 + scan(tree.getBlock(), null);
38.1093 + return null;
38.1094 + }
38.1095 +
38.1096 + @Override
38.1097 + public Void visitConditionalExpression(ConditionalExpressionTree node, EnumSet<UseTypes> p) {
38.1098 + return super.visitConditionalExpression(node, EnumSet.of(UseTypes.READ));
38.1099 + }
38.1100 +
38.1101 + @Override
38.1102 + public Void visitAssert(AssertTree tree, EnumSet<UseTypes> p) {
38.1103 + if (tree.getCondition().getKind() == Kind.IDENTIFIER)
38.1104 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getCondition()), EnumSet.of(UseTypes.READ));
38.1105 + if (tree.getDetail() != null && tree.getDetail().getKind() == Kind.IDENTIFIER)
38.1106 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getDetail()), EnumSet.of(UseTypes.READ));
38.1107 +
38.1108 + return super.visitAssert(tree, EnumSet.of(UseTypes.READ));
38.1109 + }
38.1110 +
38.1111 + @Override
38.1112 + public Void visitCase(CaseTree tree, EnumSet<UseTypes> p) {
38.1113 + if (tree.getExpression() != null && tree.getExpression().getKind() == Kind.IDENTIFIER) {
38.1114 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
38.1115 + }
38.1116 +
38.1117 + return super.visitCase(tree, null);
38.1118 + }
38.1119 +
38.1120 + @Override
38.1121 + public Void visitThrow(ThrowTree tree, EnumSet<UseTypes> p) {
38.1122 + if (tree.getExpression() != null && tree.getExpression().getKind() == Kind.IDENTIFIER) {
38.1123 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
38.1124 + }
38.1125 +
38.1126 + return super.visitThrow(tree, p);
38.1127 + }
38.1128 +
38.1129 + @Override
38.1130 + public Void visitTypeParameter(TypeParameterTree tree, EnumSet<UseTypes> p) {
38.1131 + for (Tree bound : tree.getBounds()) {
38.1132 + if (bound.getKind() == Kind.IDENTIFIER) {
38.1133 + TreePath tp = new TreePath(getCurrentPath(), bound);
38.1134 +
38.1135 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
38.1136 + }
38.1137 + }
38.1138 + return super.visitTypeParameter(tree, p);
38.1139 + }
38.1140 +
38.1141 + @Override
38.1142 + public Void visitForLoop(ForLoopTree node, EnumSet<UseTypes> p) {
38.1143 + if (node.getCondition() != null && node.getCondition().getKind() == Kind.IDENTIFIER) {
38.1144 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getCondition()), EnumSet.of(UseTypes.READ));
38.1145 + }
38.1146 +
38.1147 + return super.visitForLoop(node, p);
38.1148 + }
38.1149 +
38.1150 + @Override
38.1151 + public Void visitWildcard(WildcardTree node, EnumSet<UseTypes> p) {
38.1152 + if (node.getBound() != null && node.getBound().getKind() == Kind.IDENTIFIER) {
38.1153 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getBound()), EnumSet.of(UseTypes.CLASS_USE));
38.1154 + }
38.1155 + return super.visitWildcard(node, p);
38.1156 + }
38.1157 +
38.1158 + }
38.1159 +
38.1160 +
38.1161 + //not fully correct, but should suffice now:
38.1162 + private static boolean isSynthetic(TreePath path) {
38.1163 + return ((JCTree) path.getLeaf()).pos == (-1);
38.1164 + }
38.1165 +
38.1166 + //from semantic.Utilities:
38.1167 + private static final Set<String> keywords;
38.1168 + private static final Set<String> nonCtorKeywords;
38.1169 +
38.1170 + static {
38.1171 + keywords = new HashSet<String>();
38.1172 +
38.1173 + keywords.add("true");
38.1174 + keywords.add("false");
38.1175 + keywords.add("null");
38.1176 + keywords.add("this");
38.1177 + keywords.add("super");
38.1178 + keywords.add("class");
38.1179 +
38.1180 + nonCtorKeywords = new HashSet<String>(keywords);
38.1181 + nonCtorKeywords.remove("this");
38.1182 + nonCtorKeywords.remove("super");
38.1183 +
38.1184 + }
38.1185 +
38.1186 + public static boolean isKeyword(Tree tree) {
38.1187 + if (tree.getKind() == Kind.IDENTIFIER) {
38.1188 + return keywords.contains(((IdentifierTree) tree).getName().toString());
38.1189 + }
38.1190 + if (tree.getKind() == Kind.MEMBER_SELECT) {
38.1191 + return keywords.contains(((MemberSelectTree) tree).getIdentifier().toString());
38.1192 + }
38.1193 +
38.1194 + return false;
38.1195 + }
38.1196 +
38.1197 + public static boolean isNonCtorKeyword(Tree tree) {
38.1198 + if (tree.getKind() == Kind.IDENTIFIER) {
38.1199 + return nonCtorKeywords.contains(((IdentifierTree) tree).getName().toString());
38.1200 + }
38.1201 + if (tree.getKind() == Kind.MEMBER_SELECT) {
38.1202 + return nonCtorKeywords.contains(((MemberSelectTree) tree).getIdentifier().toString());
38.1203 + }
38.1204 +
38.1205 + return false;
38.1206 + }
38.1207 +
38.1208 + private static final Set<ElementKind> LOCAL_ELEMENT_KINDS = EnumSet.of(ElementKind.PARAMETER, ElementKind.LOCAL_VARIABLE, ElementKind.EXCEPTION_PARAMETER, ElementKind.RESOURCE_VARIABLE);
38.1209 +
38.1210 + public static boolean isPrivateElement(Element el) {
38.1211 + return LOCAL_ELEMENT_KINDS.contains(el.getKind()) || el.getModifiers().contains(Modifier.PRIVATE);
38.1212 + }
38.1213 +
38.1214 + //from TreeUtilities:
38.1215 + public static final Set<Kind> CLASS_TREE_KINDS = EnumSet.of(Kind.ANNOTATION_TYPE, Kind.CLASS, Kind.ENUM, Kind.INTERFACE);
38.1216 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/SemanticHighlighter.java.original Fri Nov 30 18:49:18 2012 +0100
39.3 @@ -0,0 +1,1358 @@
39.4 +/*
39.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
39.6 + *
39.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
39.8 + *
39.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
39.10 + * Other names may be trademarks of their respective owners.
39.11 + *
39.12 + * The contents of this file are subject to the terms of either the GNU
39.13 + * General Public License Version 2 only ("GPL") or the Common
39.14 + * Development and Distribution License("CDDL") (collectively, the
39.15 + * "License"). You may not use this file except in compliance with the
39.16 + * License. You can obtain a copy of the License at
39.17 + * http://www.netbeans.org/cddl-gplv2.html
39.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
39.19 + * specific language governing permissions and limitations under the
39.20 + * License. When distributing the software, include this License Header
39.21 + * Notice in each file and include the License file at
39.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
39.23 + * particular file as subject to the "Classpath" exception as provided
39.24 + * by Oracle in the GPL Version 2 section of the License file that
39.25 + * accompanied this code. If applicable, add the following below the
39.26 + * License Header, with the fields enclosed by brackets [] replaced by
39.27 + * your own identifying information:
39.28 + * "Portions Copyrighted [year] [name of copyright owner]"
39.29 + *
39.30 + * Contributor(s):
39.31 + *
39.32 + * The Original Software is NetBeans. The Initial Developer of the Original
39.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
39.34 + * Microsystems, Inc. All Rights Reserved.
39.35 + *
39.36 + * If you wish your version of this file to be governed by only the CDDL
39.37 + * or only the GPL Version 2, indicate your decision by adding
39.38 + * "[Contributor] elects to include this software in this distribution
39.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
39.40 + * single choice of license, a recipient has the option to distribute
39.41 + * your version of this file under either the CDDL, the GPL Version 2 or
39.42 + * to extend the choice of license to its licensees as provided above.
39.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
39.44 + * Version 2 license, then the option applies only if the new code is
39.45 + * made subject to such option by the copyright holder.
39.46 + */
39.47 +package org.netbeans.modules.java.editor.semantic;
39.48 +
39.49 +import com.sun.source.tree.AnnotationTree;
39.50 +import com.sun.source.tree.ArrayAccessTree;
39.51 +import com.sun.source.tree.ArrayTypeTree;
39.52 +import com.sun.source.tree.AssertTree;
39.53 +import com.sun.source.tree.AssignmentTree;
39.54 +import com.sun.source.tree.BinaryTree;
39.55 +import com.sun.source.tree.CaseTree;
39.56 +import com.sun.source.tree.CatchTree;
39.57 +import com.sun.source.tree.ClassTree;
39.58 +import com.sun.source.tree.CompilationUnitTree;
39.59 +import com.sun.source.tree.CompoundAssignmentTree;
39.60 +import com.sun.source.tree.ConditionalExpressionTree;
39.61 +import com.sun.source.tree.EnhancedForLoopTree;
39.62 +import com.sun.source.tree.ExpressionStatementTree;
39.63 +import com.sun.source.tree.ExpressionTree;
39.64 +import com.sun.source.tree.ForLoopTree;
39.65 +import com.sun.source.tree.IdentifierTree;
39.66 +import com.sun.source.tree.ImportTree;
39.67 +import com.sun.source.tree.InstanceOfTree;
39.68 +import com.sun.source.tree.MemberSelectTree;
39.69 +import com.sun.source.tree.MethodInvocationTree;
39.70 +import com.sun.source.tree.MethodTree;
39.71 +import com.sun.source.tree.NewArrayTree;
39.72 +import com.sun.source.tree.NewClassTree;
39.73 +import com.sun.source.tree.ParameterizedTypeTree;
39.74 +import com.sun.source.tree.ParenthesizedTree;
39.75 +import com.sun.source.tree.ReturnTree;
39.76 +import com.sun.source.tree.ThrowTree;
39.77 +import com.sun.source.tree.Tree;
39.78 +import com.sun.source.tree.Tree.Kind;
39.79 +import com.sun.source.tree.TypeCastTree;
39.80 +import com.sun.source.tree.TypeParameterTree;
39.81 +import com.sun.source.tree.UnaryTree;
39.82 +import com.sun.source.tree.UnionTypeTree;
39.83 +import com.sun.source.tree.VariableTree;
39.84 +import com.sun.source.tree.WildcardTree;
39.85 +import com.sun.source.util.SourcePositions;
39.86 +import com.sun.source.util.TreePath;
39.87 +import java.io.IOException;
39.88 +import java.util.ArrayList;
39.89 +import java.util.Collection;
39.90 +import java.util.EnumSet;
39.91 +import java.util.HashMap;
39.92 +import java.util.HashSet;
39.93 +import java.util.IdentityHashMap;
39.94 +import java.util.List;
39.95 +import java.util.Map;
39.96 +import java.util.Set;
39.97 +import java.util.concurrent.atomic.AtomicBoolean;
39.98 +import java.util.logging.Level;
39.99 +import java.util.logging.Logger;
39.100 +import javax.lang.model.element.Element;
39.101 +import javax.lang.model.element.ElementKind;
39.102 +import javax.lang.model.element.ExecutableElement;
39.103 +import javax.lang.model.element.Modifier;
39.104 +import javax.lang.model.type.TypeKind;
39.105 +import javax.swing.SwingUtilities;
39.106 +import javax.swing.text.Document;
39.107 +import org.netbeans.api.java.source.CompilationInfo;
39.108 +import org.netbeans.api.java.source.JavaParserResultTask;
39.109 +import org.netbeans.api.java.source.JavaSource.Phase;
39.110 +import org.netbeans.api.java.source.TreePathHandle;
39.111 +import org.netbeans.api.java.source.TreeUtilities;
39.112 +import org.netbeans.api.java.source.support.CancellableTreePathScanner;
39.113 +import org.netbeans.api.lexer.Token;
39.114 +import org.netbeans.api.lexer.TokenHierarchy;
39.115 +import org.netbeans.modules.editor.NbEditorUtilities;
39.116 +import org.netbeans.modules.java.editor.imports.UnusedImports;
39.117 +import org.netbeans.modules.java.editor.semantic.ColoringAttributes.Coloring;
39.118 +import org.netbeans.modules.parsing.spi.Parser.Result;
39.119 +import org.netbeans.modules.parsing.spi.Scheduler;
39.120 +import org.netbeans.modules.parsing.spi.SchedulerEvent;
39.121 +import org.netbeans.modules.parsing.spi.TaskIndexingMode;
39.122 +import org.netbeans.spi.editor.highlighting.support.OffsetsBag;
39.123 +import org.netbeans.spi.editor.hints.ErrorDescription;
39.124 +import org.openide.filesystems.FileObject;
39.125 +import org.openide.filesystems.FileUtil;
39.126 +import org.openide.loaders.DataObject;
39.127 +
39.128 +
39.129 +/**
39.130 + *
39.131 + * @author Jan Lahoda
39.132 + */
39.133 +public class SemanticHighlighter extends JavaParserResultTask {
39.134 +
39.135 + public static List<TreePathHandle> computeUnusedImports(CompilationInfo info) throws IOException {
39.136 + final List<TreePathHandle> result = new ArrayList<TreePathHandle>();
39.137 +
39.138 + for (TreePath unused : UnusedImports.process(info, new AtomicBoolean())) {
39.139 + result.add(TreePathHandle.create(unused, info));
39.140 + }
39.141 +
39.142 + return result;
39.143 + }
39.144 +
39.145 + private FileObject file;
39.146 + //XXX: correct rescheduling when troubles traversing token list!
39.147 +// private SemanticHighlighterFactory fact;
39.148 + private AtomicBoolean cancel = new AtomicBoolean();
39.149 +
39.150 +// SemanticHighlighter(FileObject file) {
39.151 +// this(file, null);
39.152 +// }
39.153 +//
39.154 + SemanticHighlighter(FileObject file/*, SemanticHighlighterFactory fact*/) {
39.155 + super(Phase.RESOLVED, TaskIndexingMode.ALLOWED_DURING_SCAN);
39.156 + this.file = file;
39.157 +// this.fact = fact;
39.158 + }
39.159 +
39.160 + @Override
39.161 + public void run(Result result, SchedulerEvent event) {
39.162 + CompilationInfo info = CompilationInfo.get(result);
39.163 +
39.164 + if (info == null) {
39.165 + return ;
39.166 + }
39.167 +
39.168 + cancel.set(false);
39.169 +
39.170 + final Document doc = result.getSnapshot().getSource().getDocument(false);
39.171 +
39.172 + if (!verifyDocument(doc)) return;
39.173 +
39.174 + if (process(info, doc)/* && fact != null*/) {
39.175 +// fact.rescheduleImpl(file);
39.176 + }
39.177 + }
39.178 +
39.179 + private static boolean verifyDocument(final Document doc) {
39.180 + if (doc == null) {
39.181 + Logger.getLogger(SemanticHighlighter.class.getName()).log(Level.FINE, "SemanticHighlighter: Cannot get document!");
39.182 + return false;
39.183 + }
39.184 +
39.185 + final boolean[] tokenSequenceNull = new boolean[1];
39.186 + doc.render(new Runnable() {
39.187 + public void run() {
39.188 + tokenSequenceNull[0] = (TokenHierarchy.get(doc).tokenSequence() == null);
39.189 + }
39.190 + });
39.191 + if (tokenSequenceNull[0]) {
39.192 + return false;
39.193 + }
39.194 +
39.195 + return true;
39.196 + }
39.197 +
39.198 + public void cancel() {
39.199 + cancel.set(true);
39.200 + }
39.201 +
39.202 +
39.203 + @Override
39.204 + public int getPriority() {
39.205 + return 100;
39.206 + }
39.207 +
39.208 + @Override
39.209 + public Class<? extends Scheduler> getSchedulerClass() {
39.210 + return Scheduler.EDITOR_SENSITIVE_TASK_SCHEDULER;
39.211 + }
39.212 +
39.213 +
39.214 +
39.215 + boolean process(CompilationInfo info, final Document doc) {
39.216 + return process(info, doc, ERROR_DESCRIPTION_SETTER);
39.217 + }
39.218 +
39.219 + static Coloring collection2Coloring(Collection<ColoringAttributes> attr) {
39.220 + Coloring c = ColoringAttributes.empty();
39.221 +
39.222 + for (ColoringAttributes a : attr) {
39.223 + c = ColoringAttributes.add(c, a);
39.224 + }
39.225 +
39.226 + return c;
39.227 + }
39.228 +
39.229 + boolean process(CompilationInfo info, final Document doc, ErrorDescriptionSetter setter) {
39.230 + DetectorVisitor v = new DetectorVisitor(info, doc, cancel);
39.231 +
39.232 + long start = System.currentTimeMillis();
39.233 +
39.234 + Map<Token, Coloring> newColoring = new IdentityHashMap<Token, Coloring>();
39.235 + List<ErrorDescription> errors = new ArrayList<ErrorDescription>();
39.236 +
39.237 + CompilationUnitTree cu = info.getCompilationUnit();
39.238 +
39.239 + v.scan(cu, null);
39.240 +
39.241 + if (cancel.get())
39.242 + return true;
39.243 +
39.244 + boolean computeUnusedImports = "text/x-java".equals(FileUtil.getMIMEType(info.getFileObject()));
39.245 +
39.246 + final List<TreePathHandle> allUnusedImports = computeUnusedImports ? new ArrayList<TreePathHandle>() : null;
39.247 + OffsetsBag imports = computeUnusedImports ? new OffsetsBag(doc) : null;
39.248 +
39.249 + if (computeUnusedImports) {
39.250 + Coloring unused = ColoringAttributes.add(ColoringAttributes.empty(), ColoringAttributes.UNUSED);
39.251 + Collection<TreePath> unusedImports = UnusedImports.process(info, cancel);
39.252 +
39.253 + if (unusedImports == null) return true;
39.254 +
39.255 + for (TreePath tree : unusedImports) {
39.256 + if (cancel.get()) {
39.257 + return true;
39.258 + }
39.259 +
39.260 + //XXX: finish
39.261 + final int startPos = (int) info.getTrees().getSourcePositions().getStartPosition(cu, tree.getLeaf());
39.262 + final int endPos = (int) info.getTrees().getSourcePositions().getEndPosition(cu, tree.getLeaf());
39.263 +
39.264 + imports.addHighlight(startPos, endPos, ColoringManager.getColoringImpl(unused));
39.265 +
39.266 + TreePathHandle handle = TreePathHandle.create(tree, info);
39.267 +
39.268 + allUnusedImports.add(handle);
39.269 + }
39.270 + }
39.271 +
39.272 + Map<Token, Coloring> oldColors = LexerBasedHighlightLayer.getLayer(SemanticHighlighter.class, doc).getColorings();
39.273 + Map<Token, Coloring> removedTokens = new IdentityHashMap<Token, Coloring>(oldColors);
39.274 + Set<Token> addedTokens = new HashSet<Token>();
39.275 +
39.276 + for (Element decl : v.type2Uses.keySet()) {
39.277 + if (cancel.get())
39.278 + return true;
39.279 +
39.280 + List<Use> uses = v.type2Uses.get(decl);
39.281 +
39.282 + for (Use u : uses) {
39.283 + if (u.spec == null)
39.284 + continue;
39.285 +
39.286 + if (u.type.contains(UseTypes.DECLARATION) && org.netbeans.modules.java.editor.semantic.Utilities.isPrivateElement(decl)) {
39.287 + if ((decl.getKind().isField() && !isSerialVersionUID(info, decl)) || isLocalVariableClosure(decl)) {
39.288 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.READ, UseTypes.WRITE))) {
39.289 + u.spec.add(ColoringAttributes.UNUSED);
39.290 + }
39.291 + }
39.292 +
39.293 + if ((decl.getKind() == ElementKind.CONSTRUCTOR && !decl.getModifiers().contains(Modifier.PRIVATE)) || decl.getKind() == ElementKind.METHOD) {
39.294 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.EXECUTE))) {
39.295 + u.spec.add(ColoringAttributes.UNUSED);
39.296 + }
39.297 + }
39.298 +
39.299 + if (decl.getKind().isClass() || decl.getKind().isInterface()) {
39.300 + if (!hasAllTypes(uses, EnumSet.of(UseTypes.CLASS_USE))) {
39.301 + u.spec.add(ColoringAttributes.UNUSED);
39.302 + }
39.303 + }
39.304 + }
39.305 +
39.306 + Coloring c = collection2Coloring(u.spec);
39.307 +
39.308 + Token t = v.tree2Token.get(u.tree.getLeaf());
39.309 +
39.310 + if (t != null) {
39.311 + newColoring.put(t, c);
39.312 +
39.313 + Coloring oldColoring = removedTokens.remove(t);
39.314 +
39.315 + if (oldColoring == null || !oldColoring.equals(c)) {
39.316 + addedTokens.add(t);
39.317 + }
39.318 + }
39.319 + }
39.320 + }
39.321 +
39.322 + if (cancel.get())
39.323 + return true;
39.324 +
39.325 + if (computeUnusedImports) {
39.326 + setter.setErrors(doc, errors, allUnusedImports);
39.327 + setter.setHighlights(doc, imports);
39.328 + }
39.329 +
39.330 + setter.setColorings(doc, newColoring, addedTokens, removedTokens.keySet());
39.331 +
39.332 + Logger.getLogger("TIMER").log(Level.FINE, "Semantic",
39.333 + new Object[] {NbEditorUtilities.getFileObject(doc), System.currentTimeMillis() - start});
39.334 +
39.335 + return false;
39.336 + }
39.337 +
39.338 +
39.339 + private boolean hasAllTypes(List<Use> uses, Collection<UseTypes> types) {
39.340 + EnumSet e = EnumSet.copyOf(types);
39.341 +
39.342 + for (Use u : uses) {
39.343 + if (types.isEmpty()) {
39.344 + return true;
39.345 + }
39.346 +
39.347 + types.removeAll(u.type);
39.348 + }
39.349 +
39.350 + return types.isEmpty();
39.351 + }
39.352 +
39.353 + private enum UseTypes {
39.354 + READ, WRITE, EXECUTE, DECLARATION, CLASS_USE;
39.355 + }
39.356 +
39.357 + private static boolean isLocalVariableClosure(Element el) {
39.358 + return el.getKind() == ElementKind.PARAMETER || el.getKind() == ElementKind.LOCAL_VARIABLE
39.359 + || el.getKind() == ElementKind.RESOURCE_VARIABLE || el.getKind() == ElementKind.EXCEPTION_PARAMETER;
39.360 + }
39.361 +
39.362 + /** Detects static final long SerialVersionUID
39.363 + * @return true if element is final static long serialVersionUID
39.364 + */
39.365 + private static boolean isSerialVersionUID(CompilationInfo info, Element el) {
39.366 + if (el.getKind().isField() && el.getModifiers().contains(Modifier.FINAL)
39.367 + && el.getModifiers().contains(Modifier.STATIC)
39.368 + && info.getTypes().getPrimitiveType(TypeKind.LONG).equals(el.asType())
39.369 + && el.getSimpleName().toString().equals("serialVersionUID"))
39.370 + return true;
39.371 + else
39.372 + return false;
39.373 + }
39.374 +
39.375 + private static class Use {
39.376 + private Collection<UseTypes> type;
39.377 + private TreePath tree;
39.378 + private Collection<ColoringAttributes> spec;
39.379 +
39.380 + public Use(Collection<UseTypes> type, TreePath tree, Collection<ColoringAttributes> spec) {
39.381 + this.type = type;
39.382 + this.tree = tree;
39.383 + this.spec = spec;
39.384 + }
39.385 +
39.386 + @Override
39.387 + public String toString() {
39.388 + return "Use: " + type;
39.389 + }
39.390 + }
39.391 +
39.392 + private static class DetectorVisitor extends CancellableTreePathScanner<Void, EnumSet<UseTypes>> {
39.393 +
39.394 + private org.netbeans.api.java.source.CompilationInfo info;
39.395 + private Document doc;
39.396 + private Map<Element, List<Use>> type2Uses;
39.397 +
39.398 + private Map<Tree, Token> tree2Token;
39.399 + private TokenList tl;
39.400 + private long memberSelectBypass = -1;
39.401 +
39.402 + private SourcePositions sourcePositions;
39.403 + private ExecutableElement recursionDetector;
39.404 +
39.405 + private DetectorVisitor(org.netbeans.api.java.source.CompilationInfo info, final Document doc, AtomicBoolean cancel) {
39.406 + super(cancel);
39.407 +
39.408 + this.info = info;
39.409 + this.doc = doc;
39.410 + type2Uses = new HashMap<Element, List<Use>>();
39.411 +
39.412 + tree2Token = new IdentityHashMap<Tree, Token>();
39.413 +
39.414 + tl = new TokenList(info, doc, cancel);
39.415 +
39.416 + this.sourcePositions = info.getTrees().getSourcePositions();
39.417 +// this.pos = pos;
39.418 + }
39.419 +
39.420 + private void firstIdentifier(String name) {
39.421 + tl.firstIdentifier(getCurrentPath(), name, tree2Token);
39.422 + }
39.423 +
39.424 + @Override
39.425 + public Void visitAssignment(AssignmentTree tree, EnumSet<UseTypes> d) {
39.426 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getVariable()), EnumSet.of(UseTypes.WRITE));
39.427 +
39.428 + Tree expr = tree.getExpression();
39.429 +
39.430 + if (expr instanceof IdentifierTree) {
39.431 + TreePath tp = new TreePath(getCurrentPath(), expr);
39.432 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
39.433 + }
39.434 +
39.435 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
39.436 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
39.437 +
39.438 + return null;
39.439 + }
39.440 +
39.441 + @Override
39.442 + public Void visitCompoundAssignment(CompoundAssignmentTree tree, EnumSet<UseTypes> d) {
39.443 + Set<UseTypes> useTypes = EnumSet.of(UseTypes.WRITE);
39.444 +
39.445 + if (d != null) {
39.446 + useTypes.addAll(d);
39.447 + }
39.448 +
39.449 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getVariable()), useTypes);
39.450 +
39.451 + Tree expr = tree.getExpression();
39.452 +
39.453 + if (expr instanceof IdentifierTree) {
39.454 + TreePath tp = new TreePath(getCurrentPath(), expr);
39.455 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
39.456 + }
39.457 +
39.458 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
39.459 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
39.460 +
39.461 + return null;
39.462 + }
39.463 +
39.464 + @Override
39.465 + public Void visitReturn(ReturnTree tree, EnumSet<UseTypes> d) {
39.466 + if (tree.getExpression() instanceof IdentifierTree) {
39.467 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
39.468 + }
39.469 +
39.470 + super.visitReturn(tree, EnumSet.of(UseTypes.READ));
39.471 + return null;
39.472 + }
39.473 +
39.474 + @Override
39.475 + public Void visitMemberSelect(MemberSelectTree tree, EnumSet<UseTypes> d) {
39.476 + long memberSelectBypassLoc = memberSelectBypass;
39.477 +
39.478 + memberSelectBypass = -1;
39.479 +
39.480 + Tree expr = tree.getExpression();
39.481 +
39.482 + if (expr instanceof IdentifierTree) {
39.483 + TreePath tp = new TreePath(getCurrentPath(), expr);
39.484 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
39.485 + }
39.486 +
39.487 + Element el = info.getTrees().getElement(getCurrentPath());
39.488 +
39.489 + if (el != null && el.getKind().isField()) {
39.490 + handlePossibleIdentifier(getCurrentPath(), d == null ? EnumSet.of(UseTypes.READ) : d);
39.491 + }
39.492 +
39.493 + if (el != null && (el.getKind().isClass() || el.getKind().isInterface()) &&
39.494 + getCurrentPath().getParentPath().getLeaf().getKind() != Kind.NEW_CLASS) {
39.495 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.CLASS_USE));
39.496 + }
39.497 +
39.498 +// System.err.println("XXXX=" + tree.toString());
39.499 +// System.err.println("YYYY=" + info.getElement(tree));
39.500 +
39.501 + super.visitMemberSelect(tree, null);
39.502 +
39.503 + tl.moveToEnd(tree.getExpression());
39.504 +
39.505 + if (memberSelectBypassLoc != (-1)) {
39.506 + tl.moveToOffset(memberSelectBypassLoc);
39.507 + }
39.508 +
39.509 + firstIdentifier(tree.getIdentifier().toString());
39.510 +
39.511 + return null;
39.512 + }
39.513 +
39.514 + private void addModifiers(Element decl, Collection<ColoringAttributes> c) {
39.515 + if (decl.getModifiers().contains(Modifier.STATIC)) {
39.516 + c.add(ColoringAttributes.STATIC);
39.517 + }
39.518 +
39.519 + if (decl.getModifiers().contains(Modifier.ABSTRACT) && !decl.getKind().isInterface()) {
39.520 + c.add(ColoringAttributes.ABSTRACT);
39.521 + }
39.522 +
39.523 + boolean accessModifier = false;
39.524 +
39.525 + if (decl.getModifiers().contains(Modifier.PUBLIC)) {
39.526 + c.add(ColoringAttributes.PUBLIC);
39.527 + accessModifier = true;
39.528 + }
39.529 +
39.530 + if (decl.getModifiers().contains(Modifier.PROTECTED)) {
39.531 + c.add(ColoringAttributes.PROTECTED);
39.532 + accessModifier = true;
39.533 + }
39.534 +
39.535 + if (decl.getModifiers().contains(Modifier.PRIVATE)) {
39.536 + c.add(ColoringAttributes.PRIVATE);
39.537 + accessModifier = true;
39.538 + }
39.539 +
39.540 + if (!accessModifier && !isLocalVariableClosure(decl)) {
39.541 + c.add(ColoringAttributes.PACKAGE_PRIVATE);
39.542 + }
39.543 +
39.544 + if (info.getElements().isDeprecated(decl)) {
39.545 + c.add(ColoringAttributes.DEPRECATED);
39.546 + }
39.547 + }
39.548 +
39.549 + private Collection<ColoringAttributes> getMethodColoring(ExecutableElement mdecl, boolean nct) {
39.550 + Collection<ColoringAttributes> c = new ArrayList<ColoringAttributes>();
39.551 +
39.552 + addModifiers(mdecl, c);
39.553 +
39.554 + if (mdecl.getKind() == ElementKind.CONSTRUCTOR) {
39.555 + c.add(ColoringAttributes.CONSTRUCTOR);
39.556 +
39.557 + //#146820:
39.558 + if (nct && mdecl.getEnclosingElement() != null && info.getElements().isDeprecated(mdecl.getEnclosingElement())) {
39.559 + c.add(ColoringAttributes.DEPRECATED);
39.560 + }
39.561 + } else
39.562 + c.add(ColoringAttributes.METHOD);
39.563 +
39.564 + return c;
39.565 + }
39.566 +
39.567 + private Collection<ColoringAttributes> getVariableColoring(Element decl) {
39.568 + Collection<ColoringAttributes> c = new ArrayList<ColoringAttributes>();
39.569 +
39.570 + addModifiers(decl, c);
39.571 +
39.572 + if (decl.getKind().isField()) {
39.573 + c.add(ColoringAttributes.FIELD);
39.574 +
39.575 + return c;
39.576 + }
39.577 +
39.578 + if (decl.getKind() == ElementKind.LOCAL_VARIABLE || decl.getKind() == ElementKind.RESOURCE_VARIABLE
39.579 + || decl.getKind() == ElementKind.EXCEPTION_PARAMETER) {
39.580 + c.add(ColoringAttributes.LOCAL_VARIABLE);
39.581 +
39.582 + return c;
39.583 + }
39.584 +
39.585 + if (decl.getKind() == ElementKind.PARAMETER) {
39.586 + c.add(ColoringAttributes.PARAMETER);
39.587 +
39.588 + return c;
39.589 + }
39.590 +
39.591 + assert false;
39.592 +
39.593 + return null;
39.594 + }
39.595 +
39.596 + private static final Set<Kind> LITERALS = EnumSet.of(Kind.BOOLEAN_LITERAL, Kind.CHAR_LITERAL, Kind.DOUBLE_LITERAL, Kind.FLOAT_LITERAL, Kind.INT_LITERAL, Kind.LONG_LITERAL, Kind.STRING_LITERAL);
39.597 +
39.598 + private void handlePossibleIdentifier(TreePath expr, Collection<UseTypes> type) {
39.599 + handlePossibleIdentifier(expr, type, null, false, false);
39.600 + }
39.601 +
39.602 + private void handlePossibleIdentifier(TreePath expr, Collection<UseTypes> type, Element decl, boolean providesDecl, boolean nct) {
39.603 +
39.604 + if (Utilities.isKeyword(expr.getLeaf())) {
39.605 + //ignore keywords:
39.606 + return ;
39.607 + }
39.608 +
39.609 + if (expr.getLeaf().getKind() == Kind.PRIMITIVE_TYPE) {
39.610 + //ignore primitive types:
39.611 + return ;
39.612 + }
39.613 +
39.614 + if (LITERALS.contains(expr.getLeaf().getKind())) {
39.615 + //ignore literals:
39.616 + return ;
39.617 + }
39.618 +
39.619 + decl = !providesDecl ? info.getTrees().getElement(expr) : decl;
39.620 +
39.621 + Collection<ColoringAttributes> c = null;
39.622 +
39.623 + //causes NPE later, as decl is put into list of declarations to handle:
39.624 +// if (decl == null) {
39.625 +// c = Collections.singletonList(ColoringAttributes.UNDEFINED);
39.626 +// }
39.627 +
39.628 + if (decl != null && (decl.getKind().isField() || isLocalVariableClosure(decl))) {
39.629 + c = getVariableColoring(decl);
39.630 + }
39.631 +
39.632 + if (decl != null && decl instanceof ExecutableElement) {
39.633 + c = getMethodColoring((ExecutableElement) decl, nct);
39.634 + }
39.635 +
39.636 + if (decl != null && (decl.getKind().isClass() || decl.getKind().isInterface())) {
39.637 + //class use make look like read variable access:
39.638 + if (type.contains(UseTypes.READ)) {
39.639 + type = EnumSet.copyOf(type);
39.640 + type.remove(UseTypes.READ);
39.641 + type.add(UseTypes.CLASS_USE);
39.642 + }
39.643 +
39.644 + c = new ArrayList<ColoringAttributes>();
39.645 +
39.646 + addModifiers(decl, c);
39.647 +
39.648 + switch (decl.getKind()) {
39.649 + case CLASS: c.add(ColoringAttributes.CLASS); break;
39.650 + case INTERFACE: c.add(ColoringAttributes.INTERFACE); break;
39.651 + case ANNOTATION_TYPE: c.add(ColoringAttributes.ANNOTATION_TYPE); break;
39.652 + case ENUM: c.add(ColoringAttributes.ENUM); break;
39.653 + }
39.654 + }
39.655 +
39.656 + if (decl != null && type.contains(UseTypes.DECLARATION)) {
39.657 + if (c == null) {
39.658 + c = new ArrayList<ColoringAttributes>();
39.659 + }
39.660 +
39.661 + c.add(ColoringAttributes.DECLARATION);
39.662 + }
39.663 +
39.664 + if (c != null) {
39.665 + addUse(decl, type, expr, c);
39.666 + }
39.667 + }
39.668 +
39.669 + private void addUse(Element decl, Collection<UseTypes> useTypes, TreePath t, Collection<ColoringAttributes> c) {
39.670 + if (decl == recursionDetector) {
39.671 + useTypes.remove(UseTypes.EXECUTE); //recursive execution is not use
39.672 + }
39.673 +
39.674 + List<Use> uses = type2Uses.get(decl);
39.675 +
39.676 + if (uses == null) {
39.677 + type2Uses.put(decl, uses = new ArrayList<Use>());
39.678 + }
39.679 +
39.680 + Use u = new Use(useTypes, t, c);
39.681 +
39.682 + uses.add(u);
39.683 + }
39.684 +
39.685 + @Override
39.686 + public Void visitTypeCast(TypeCastTree tree, EnumSet<UseTypes> d) {
39.687 + Tree expr = tree.getExpression();
39.688 +
39.689 + if (expr.getKind() == Kind.IDENTIFIER) {
39.690 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
39.691 + }
39.692 +
39.693 + Tree cast = tree.getType();
39.694 +
39.695 + if (cast.getKind() == Kind.IDENTIFIER) {
39.696 + handlePossibleIdentifier(new TreePath(getCurrentPath(), cast), EnumSet.of(UseTypes.READ));
39.697 + }
39.698 +
39.699 + super.visitTypeCast(tree, d);
39.700 + return null;
39.701 + }
39.702 +
39.703 + @Override
39.704 + public Void visitInstanceOf(InstanceOfTree tree, EnumSet<UseTypes> d) {
39.705 + Tree expr = tree.getExpression();
39.706 +
39.707 + if (expr instanceof IdentifierTree) {
39.708 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
39.709 + }
39.710 +
39.711 + TreePath tp = new TreePath(getCurrentPath(), tree.getType());
39.712 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.713 +
39.714 + super.visitInstanceOf(tree, null);
39.715 +
39.716 + //TODO: should be considered
39.717 + return null;
39.718 + }
39.719 +
39.720 + @Override
39.721 + public Void visitCompilationUnit(CompilationUnitTree tree, EnumSet<UseTypes> d) {
39.722 + //ignore package X.Y.Z;:
39.723 + //scan(tree.getPackageDecl(), p);
39.724 + tl.moveBefore(tree.getImports());
39.725 + scan(tree.getImports(), d);
39.726 + tl.moveBefore(tree.getPackageAnnotations());
39.727 + scan(tree.getPackageAnnotations(), d);
39.728 + tl.moveToEnd(tree.getImports());
39.729 + scan(tree.getTypeDecls(), d);
39.730 + return null;
39.731 + }
39.732 +
39.733 + private long startOf(List<? extends Tree> trees) {
39.734 + if (trees.isEmpty()) return -1;
39.735 + return sourcePositions.getStartPosition(info.getCompilationUnit(), trees.get(0));
39.736 + }
39.737 +
39.738 + private void handleMethodTypeArguments(TreePath method, List<? extends Tree> tArgs) {
39.739 + //the type arguments are before the last identifier in the select, so we should return there:
39.740 + //not very efficient, though:
39.741 + tl.moveBefore(tArgs);
39.742 +
39.743 + for (Tree expr : tArgs) {
39.744 + if (expr instanceof IdentifierTree) {
39.745 + handlePossibleIdentifier(new TreePath(method, expr), EnumSet.of(UseTypes.CLASS_USE));
39.746 + }
39.747 + }
39.748 + }
39.749 +
39.750 + @Override
39.751 + public Void visitMethodInvocation(MethodInvocationTree tree, EnumSet<UseTypes> d) {
39.752 + Tree possibleIdent = tree.getMethodSelect();
39.753 + boolean handled = false;
39.754 +
39.755 + if (possibleIdent.getKind() == Kind.IDENTIFIER) {
39.756 + //handle "this" and "super" constructors:
39.757 + String ident = ((IdentifierTree) possibleIdent).getName().toString();
39.758 +
39.759 + if ("super".equals(ident) || "this".equals(ident)) { //NOI18N
39.760 + Element resolved = info.getTrees().getElement(getCurrentPath());
39.761 +
39.762 + addUse(resolved, EnumSet.of(UseTypes.EXECUTE), null, null);
39.763 + handled = true;
39.764 + }
39.765 + }
39.766 +
39.767 + if (!handled) {
39.768 + handlePossibleIdentifier(new TreePath(getCurrentPath(), possibleIdent), EnumSet.of(UseTypes.EXECUTE));
39.769 + }
39.770 +
39.771 + List<? extends Tree> ta = tree.getTypeArguments();
39.772 + long afterTypeArguments = ta.isEmpty() ? -1 : info.getTrees().getSourcePositions().getEndPosition(info.getCompilationUnit(), ta.get(ta.size() - 1));
39.773 +
39.774 + switch (tree.getMethodSelect().getKind()) {
39.775 + case IDENTIFIER:
39.776 + case MEMBER_SELECT:
39.777 + memberSelectBypass = afterTypeArguments;
39.778 + scan(tree.getMethodSelect(), null);
39.779 + memberSelectBypass = -1;
39.780 + break;
39.781 + default:
39.782 + //todo: log
39.783 + scan(tree.getMethodSelect(), null);
39.784 + }
39.785 +
39.786 + handleMethodTypeArguments(getCurrentPath(), ta);
39.787 +
39.788 + scan(tree.getTypeArguments(), null);
39.789 +
39.790 +// if (tree.getMethodSelect().getKind() == Kind.MEMBER_SELECT && tree2Token.get(tree.getMethodSelect()) == null) {
39.791 +//// if (ts.moveNext()) ???
39.792 +// firstIdentifier(((MemberSelectTree) tree.getMethodSelect()).getIdentifier().toString());
39.793 +// }
39.794 +
39.795 + for (Tree expr : tree.getArguments()) {
39.796 + if (expr instanceof IdentifierTree) {
39.797 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
39.798 + }
39.799 + }
39.800 +
39.801 + scan(tree.getArguments(), EnumSet.of(UseTypes.READ));
39.802 +
39.803 +// super.visitMethodInvocation(tree, null);
39.804 + return null;
39.805 + }
39.806 +
39.807 + @Override
39.808 + public Void visitIdentifier(IdentifierTree tree, EnumSet<UseTypes> d) {
39.809 + if (info.getTreeUtilities().isSynthetic(getCurrentPath()))
39.810 + return null;
39.811 +// if ("l".equals(tree.toString())) {
39.812 +// Thread.dumpStack();
39.813 +// }
39.814 +// handlePossibleIdentifier(tree);
39.815 +// //also possible type: (like in Collections.EMPTY_LIST):
39.816 +// resolveType(tree);
39.817 +// Thread.dumpStack();
39.818 +
39.819 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
39.820 +
39.821 + if (memberSelectBypass != (-1)) {
39.822 + tl.moveToOffset(memberSelectBypass);
39.823 + memberSelectBypass = -1;
39.824 + }
39.825 +
39.826 + tl.identifierHere(tree, tree2Token);
39.827 +
39.828 + if (d != null) {
39.829 + handlePossibleIdentifier(getCurrentPath(), d);
39.830 + }
39.831 + super.visitIdentifier(tree, null);
39.832 + return null;
39.833 + }
39.834 +//
39.835 + @Override
39.836 + public Void visitMethod(MethodTree tree, EnumSet<UseTypes> d) {
39.837 + if (info.getTreeUtilities().isSynthetic(getCurrentPath())) {
39.838 + return super.visitMethod(tree, d);
39.839 + }
39.840 +// Element decl = pi.getAttribution().getElement(tree);
39.841 +//
39.842 +// if (decl != null) {
39.843 +// assert decl instanceof ExecutableElement;
39.844 +//
39.845 +// Coloring c = getMethodColoring((ExecutableElement) decl);
39.846 +// HighlightImpl h = createHighlight(decl.getSimpleName(), tree, c, null);
39.847 +//
39.848 +// if (h != null) {
39.849 +// highlights.add(h);
39.850 +// }
39.851 +// }
39.852 +
39.853 + //#170338: constructor without modifiers:
39.854 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
39.855 +
39.856 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.DECLARATION));
39.857 +
39.858 + for (Tree t : tree.getThrows()) {
39.859 + TreePath tp = new TreePath(getCurrentPath(), t);
39.860 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.861 + }
39.862 +
39.863 + EnumSet<UseTypes> paramsUseTypes;
39.864 +
39.865 + Element el = info.getTrees().getElement(getCurrentPath());
39.866 +
39.867 + if (el != null && (el.getModifiers().contains(Modifier.ABSTRACT) || el.getModifiers().contains(Modifier.NATIVE) || !el.getModifiers().contains(Modifier.PRIVATE))) {
39.868 + paramsUseTypes = EnumSet.of(UseTypes.WRITE, UseTypes.READ);
39.869 + } else {
39.870 + paramsUseTypes = EnumSet.of(UseTypes.WRITE);
39.871 + }
39.872 +
39.873 + scan(tree.getModifiers(), null);
39.874 + tl.moveToEnd(tree.getModifiers());
39.875 + scan(tree.getTypeParameters(), null);
39.876 + tl.moveToEnd(tree.getTypeParameters());
39.877 + scan(tree.getReturnType(), EnumSet.of(UseTypes.CLASS_USE));
39.878 + tl.moveToEnd(tree.getReturnType());
39.879 +
39.880 + String name;
39.881 +
39.882 + if (tree.getReturnType() != null) {
39.883 + //method:
39.884 + name = tree.getName().toString();
39.885 + } else {
39.886 + //constructor:
39.887 + TreePath tp = getCurrentPath();
39.888 +
39.889 + while (tp != null && !TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
39.890 + tp = tp.getParentPath();
39.891 + }
39.892 +
39.893 + if (tp != null && TreeUtilities.CLASS_TREE_KINDS.contains(tp.getLeaf().getKind())) {
39.894 + name = ((ClassTree) tp.getLeaf()).getSimpleName().toString();
39.895 + } else {
39.896 + name = null;
39.897 + }
39.898 + }
39.899 +
39.900 + if (name != null) {
39.901 + firstIdentifier(name);
39.902 + }
39.903 +
39.904 + scan(tree.getParameters(), paramsUseTypes);
39.905 + scan(tree.getThrows(), null);
39.906 + scan(tree.getDefaultValue(), null);
39.907 +
39.908 + recursionDetector = (el != null && el.getKind() == ElementKind.METHOD) ? (ExecutableElement) el : null;
39.909 +
39.910 + scan(tree.getBody(), null);
39.911 +
39.912 + recursionDetector = null;
39.913 +
39.914 + return null;
39.915 + }
39.916 +
39.917 + @Override
39.918 + public Void visitExpressionStatement(ExpressionStatementTree tree, EnumSet<UseTypes> d) {
39.919 +// if (tree instanceof IdentifierTree) {
39.920 +// handlePossibleIdentifier(tree, EnumSet.of(UseTypes.READ));
39.921 +// }
39.922 +
39.923 + super.visitExpressionStatement(tree, null);
39.924 + return null;
39.925 + }
39.926 +
39.927 + @Override
39.928 + public Void visitParenthesized(ParenthesizedTree tree, EnumSet<UseTypes> d) {
39.929 + ExpressionTree expr = tree.getExpression();
39.930 +
39.931 + if (expr instanceof IdentifierTree) {
39.932 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
39.933 + }
39.934 +
39.935 + super.visitParenthesized(tree, d);
39.936 + return null;
39.937 + }
39.938 +
39.939 + @Override
39.940 + public Void visitEnhancedForLoop(EnhancedForLoopTree tree, EnumSet<UseTypes> d) {
39.941 + scan(tree.getVariable(), EnumSet.of(UseTypes.WRITE));
39.942 +
39.943 + if (tree.getExpression().getKind() == Kind.IDENTIFIER)
39.944 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
39.945 +
39.946 + scan(tree.getExpression(), null);
39.947 + scan(tree.getStatement(), null);
39.948 +
39.949 + return null;
39.950 + }
39.951 +
39.952 + private boolean isStar(ImportTree tree) {
39.953 + Tree qualIdent = tree.getQualifiedIdentifier();
39.954 +
39.955 + if (qualIdent == null || qualIdent.getKind() == Kind.IDENTIFIER) {
39.956 + return false;
39.957 + }
39.958 +
39.959 + return ((MemberSelectTree) qualIdent).getIdentifier().contentEquals("*");
39.960 + }
39.961 +
39.962 + @Override
39.963 + public Void visitVariable(VariableTree tree, EnumSet<UseTypes> d) {
39.964 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
39.965 + TreePath type = new TreePath(getCurrentPath(), tree.getType());
39.966 +
39.967 + if (type.getLeaf() instanceof ArrayTypeTree) {
39.968 + type = new TreePath(type, ((ArrayTypeTree) type.getLeaf()).getType());
39.969 + }
39.970 +
39.971 + if (type.getLeaf().getKind() == Kind.IDENTIFIER)
39.972 + handlePossibleIdentifier(type, EnumSet.of(UseTypes.CLASS_USE));
39.973 +
39.974 + Collection<UseTypes> uses = null;
39.975 +
39.976 + Element e = info.getTrees().getElement(getCurrentPath());
39.977 + if (tree.getInitializer() != null) {
39.978 + uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
39.979 + if (tree.getInitializer().getKind() == Kind.IDENTIFIER)
39.980 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getInitializer()), EnumSet.of(UseTypes.READ));
39.981 + } else {
39.982 + if (e != null && e.getKind() == ElementKind.FIELD) {
39.983 + uses = EnumSet.of(UseTypes.DECLARATION, UseTypes.WRITE);
39.984 + } else {
39.985 + uses = EnumSet.of(UseTypes.DECLARATION);
39.986 + }
39.987 + }
39.988 +
39.989 + if (d != null) {
39.990 + Set<UseTypes> ut = new HashSet<UseTypes>();
39.991 +
39.992 + ut.addAll(uses);
39.993 + ut.addAll(d);
39.994 +
39.995 + uses = EnumSet.copyOf(ut);
39.996 + }
39.997 +
39.998 + handlePossibleIdentifier(getCurrentPath(), uses);
39.999 +
39.1000 + scan(tree.getModifiers(), null);
39.1001 +
39.1002 + tl.moveToEnd(tree.getModifiers());
39.1003 +
39.1004 + scan(tree.getType(), null);
39.1005 +
39.1006 + int[] span = info.getTreeUtilities().findNameSpan(tree);
39.1007 + if (span != null)
39.1008 + tl.moveToOffset(span[0]);
39.1009 + else
39.1010 + tl.moveToEnd(tree.getType());
39.1011 +
39.1012 +// System.err.println("tree.getName().toString()=" + tree.getName().toString());
39.1013 +
39.1014 + firstIdentifier(tree.getName().toString());
39.1015 +
39.1016 + tl.moveNext();
39.1017 +
39.1018 + scan(tree.getInitializer(), EnumSet.of(UseTypes.READ));
39.1019 +
39.1020 + return null;
39.1021 + }
39.1022 +
39.1023 + @Override
39.1024 + public Void visitAnnotation(AnnotationTree tree, EnumSet<UseTypes> d) {
39.1025 +// System.err.println("tree.getType()= " + tree.toString());
39.1026 +// System.err.println("tree.getType()= " + tree.getClass());
39.1027 +//
39.1028 + TreePath tp = new TreePath(getCurrentPath(), tree.getAnnotationType());
39.1029 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1030 + super.visitAnnotation(tree, EnumSet.noneOf(UseTypes.class));
39.1031 + //TODO: maybe should be considered
39.1032 + return null;
39.1033 + }
39.1034 +
39.1035 + @Override
39.1036 + public Void visitNewClass(NewClassTree tree, EnumSet<UseTypes> d) {
39.1037 +// if (info.getTreeUtilities().isSynthetic(getCurrentPath()))
39.1038 +// return null;
39.1039 +//
39.1040 + Tree exp = tree.getEnclosingExpression();
39.1041 + if (exp instanceof IdentifierTree) {
39.1042 + handlePossibleIdentifier(new TreePath(getCurrentPath(), exp), EnumSet.of(UseTypes.READ));
39.1043 + }
39.1044 +
39.1045 + TreePath tp;
39.1046 + Tree ident = tree.getIdentifier();
39.1047 +
39.1048 + if (ident.getKind() == Kind.PARAMETERIZED_TYPE) {
39.1049 + tp = new TreePath(new TreePath(getCurrentPath(), ident), ((ParameterizedTypeTree) ident).getType());
39.1050 + } else {
39.1051 + tp = new TreePath(getCurrentPath(), ident);
39.1052 + }
39.1053 +
39.1054 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.EXECUTE), info.getTrees().getElement(getCurrentPath()), true, true);
39.1055 +
39.1056 + Element clazz = info.getTrees().getElement(tp);
39.1057 +
39.1058 + if (clazz != null) {
39.1059 + addUse(clazz, EnumSet.of(UseTypes.CLASS_USE), null, null);
39.1060 + }
39.1061 +
39.1062 + for (Tree expr : tree.getArguments()) {
39.1063 + if (expr instanceof IdentifierTree) {
39.1064 + handlePossibleIdentifier(new TreePath(getCurrentPath(), expr), EnumSet.of(UseTypes.READ));
39.1065 + }
39.1066 + }
39.1067 +
39.1068 + scan(tree.getEnclosingExpression(), null);
39.1069 + scan(tree.getIdentifier(), null);
39.1070 + scan(tree.getTypeArguments(), null);
39.1071 + scan(tree.getArguments(), EnumSet.of(UseTypes.READ));
39.1072 + scan(tree.getClassBody(), null);
39.1073 +
39.1074 + return null;
39.1075 + }
39.1076 +
39.1077 + @Override
39.1078 + public Void visitParameterizedType(ParameterizedTypeTree tree, EnumSet<UseTypes> d) {
39.1079 + boolean alreadyHandled = false;
39.1080 +
39.1081 + if (getCurrentPath().getParentPath().getLeaf().getKind() == Kind.NEW_CLASS) {
39.1082 + NewClassTree nct = (NewClassTree) getCurrentPath().getParentPath().getLeaf();
39.1083 +
39.1084 + alreadyHandled = nct.getTypeArguments().contains(tree) || nct.getIdentifier() == tree;
39.1085 + }
39.1086 +
39.1087 + if (getCurrentPath().getParentPath().getParentPath().getLeaf().getKind() == Kind.NEW_CLASS) {
39.1088 + NewClassTree nct = (NewClassTree) getCurrentPath().getParentPath().getParentPath().getLeaf();
39.1089 + Tree leafToTest = getCurrentPath().getParentPath().getLeaf();
39.1090 +
39.1091 + alreadyHandled = nct.getTypeArguments().contains(leafToTest) || nct.getIdentifier() == leafToTest;
39.1092 + }
39.1093 +
39.1094 + if (!alreadyHandled) {
39.1095 + //NewClass has already been handled as part of visitNewClass:
39.1096 + TreePath tp = new TreePath(getCurrentPath(), tree.getType());
39.1097 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1098 + }
39.1099 +
39.1100 + for (Tree t : tree.getTypeArguments()) {
39.1101 + TreePath tp = new TreePath(getCurrentPath(), t);
39.1102 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1103 +
39.1104 +// HighlightImpl h = createHighlight("", t, TYPE_PARAMETER);
39.1105 +//
39.1106 +// if (h != null)
39.1107 +// highlights.add(h);
39.1108 + }
39.1109 +
39.1110 + super.visitParameterizedType(tree, null);
39.1111 + return null;
39.1112 + }
39.1113 +
39.1114 + @Override
39.1115 + public Void visitBinary(BinaryTree tree, EnumSet<UseTypes> d) {
39.1116 + Tree left = tree.getLeftOperand();
39.1117 + Tree right = tree.getRightOperand();
39.1118 +
39.1119 + if (left instanceof IdentifierTree) {
39.1120 + TreePath tp = new TreePath(getCurrentPath(), left);
39.1121 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
39.1122 + }
39.1123 +
39.1124 + if (right instanceof IdentifierTree) {
39.1125 + TreePath tp = new TreePath(getCurrentPath(), right);
39.1126 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.READ));
39.1127 + }
39.1128 +
39.1129 + super.visitBinary(tree, EnumSet.of(UseTypes.READ));
39.1130 + return null;
39.1131 + }
39.1132 +
39.1133 + @Override
39.1134 + public Void visitClass(ClassTree tree, EnumSet<UseTypes> d) {
39.1135 + tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
39.1136 + for (TypeParameterTree t : tree.getTypeParameters()) {
39.1137 + for (Tree bound : t.getBounds()) {
39.1138 + TreePath tp = new TreePath(new TreePath(getCurrentPath(), t), bound);
39.1139 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1140 + }
39.1141 + }
39.1142 +
39.1143 + if(getCurrentPath().getParentPath().getLeaf().getKind() != Kind.NEW_CLASS) {
39.1144 + //NEW_CLASS already handeled by visitnewClass
39.1145 + Tree extnds = tree.getExtendsClause();
39.1146 +
39.1147 + if (extnds != null) {
39.1148 + TreePath tp = new TreePath(getCurrentPath(), extnds);
39.1149 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1150 + }
39.1151 +
39.1152 + for (Tree t : tree.getImplementsClause()) {
39.1153 + TreePath tp = new TreePath(getCurrentPath(), t);
39.1154 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1155 + }
39.1156 + }
39.1157 +
39.1158 + handlePossibleIdentifier(getCurrentPath(), EnumSet.of(UseTypes.DECLARATION));
39.1159 +
39.1160 + scan(tree.getModifiers(), null);
39.1161 +
39.1162 +// System.err.println("tree.getModifiers()=" + tree.getModifiers());
39.1163 +// System.err.println("mod end=" + sourcePositions.getEndPosition(info.getCompilationUnit(), tree.getModifiers()));
39.1164 +// System.err.println("class start=" + sourcePositions.getStartPosition(info.getCompilationUnit(), tree));
39.1165 + tl.moveToEnd(tree.getModifiers());
39.1166 + firstIdentifier(tree.getSimpleName().toString());
39.1167 +
39.1168 + //XXX:????
39.1169 + scan(tree.getTypeParameters(), null);
39.1170 + scan(tree.getExtendsClause(), null);
39.1171 + scan(tree.getImplementsClause(), null);
39.1172 +
39.1173 + ExecutableElement prevRecursionDetector = recursionDetector;
39.1174 +
39.1175 + recursionDetector = null;
39.1176 +
39.1177 + scan(tree.getMembers(), null);
39.1178 +
39.1179 + recursionDetector = prevRecursionDetector;
39.1180 +
39.1181 + //XXX: end ???
39.1182 +
39.1183 + return null;
39.1184 + }
39.1185 +
39.1186 + @Override
39.1187 + public Void visitUnary(UnaryTree tree, EnumSet<UseTypes> d) {
39.1188 + if (tree.getExpression() instanceof IdentifierTree) {
39.1189 + switch (tree.getKind()) {
39.1190 + case PREFIX_INCREMENT:
39.1191 + case PREFIX_DECREMENT:
39.1192 + case POSTFIX_INCREMENT:
39.1193 + case POSTFIX_DECREMENT:
39.1194 + Set<UseTypes> useTypes = EnumSet.of(UseTypes.WRITE);
39.1195 + if (d != null) {
39.1196 + useTypes.addAll(d);
39.1197 + }
39.1198 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), useTypes);
39.1199 + break;
39.1200 + default:
39.1201 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
39.1202 + }
39.1203 + }
39.1204 + super.visitUnary(tree, d);
39.1205 + return null;
39.1206 + }
39.1207 +
39.1208 + @Override
39.1209 + public Void visitArrayAccess(ArrayAccessTree tree, EnumSet<UseTypes> d) {
39.1210 + scan(tree.getExpression(), EnumSet.of(UseTypes.READ));
39.1211 + scan(tree.getIndex(), EnumSet.of(UseTypes.READ));
39.1212 +
39.1213 + return null;
39.1214 + }
39.1215 +
39.1216 + @Override
39.1217 + public Void visitArrayType(ArrayTypeTree node, EnumSet<UseTypes> p) {
39.1218 + if (node.getType() != null) {
39.1219 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getType()), EnumSet.of(UseTypes.CLASS_USE));
39.1220 + }
39.1221 + return super.visitArrayType(node, p);
39.1222 + }
39.1223 +
39.1224 + @Override
39.1225 + public Void visitUnionType(UnionTypeTree node, EnumSet<UseTypes> p) {
39.1226 + for (Tree tree : node.getTypeAlternatives()) {
39.1227 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree), EnumSet.of(UseTypes.CLASS_USE));
39.1228 + }
39.1229 + return super.visitUnionType(node, p);
39.1230 + }
39.1231 +
39.1232 + @Override
39.1233 + public Void visitNewArray(NewArrayTree tree, EnumSet<UseTypes> d) {
39.1234 + if (tree.getType() != null) {
39.1235 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getType()), EnumSet.of(UseTypes.CLASS_USE));
39.1236 + }
39.1237 +
39.1238 + scan(tree.getType(), null);
39.1239 + scan(tree.getDimensions(), EnumSet.of(UseTypes.READ));
39.1240 + scan(tree.getInitializers(), EnumSet.of(UseTypes.READ));
39.1241 +
39.1242 + return null;
39.1243 + }
39.1244 +
39.1245 + @Override
39.1246 + public Void visitCatch(CatchTree tree, EnumSet<UseTypes> d) {
39.1247 + scan(tree.getParameter(), EnumSet.of(UseTypes.WRITE));
39.1248 + scan(tree.getBlock(), null);
39.1249 + return null;
39.1250 + }
39.1251 +
39.1252 + @Override
39.1253 + public Void visitConditionalExpression(ConditionalExpressionTree node, EnumSet<UseTypes> p) {
39.1254 + return super.visitConditionalExpression(node, EnumSet.of(UseTypes.READ));
39.1255 + }
39.1256 +
39.1257 + @Override
39.1258 + public Void visitAssert(AssertTree tree, EnumSet<UseTypes> p) {
39.1259 + if (tree.getCondition().getKind() == Kind.IDENTIFIER)
39.1260 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getCondition()), EnumSet.of(UseTypes.READ));
39.1261 + if (tree.getDetail() != null && tree.getDetail().getKind() == Kind.IDENTIFIER)
39.1262 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getDetail()), EnumSet.of(UseTypes.READ));
39.1263 +
39.1264 + return super.visitAssert(tree, EnumSet.of(UseTypes.READ));
39.1265 + }
39.1266 +
39.1267 + @Override
39.1268 + public Void visitCase(CaseTree tree, EnumSet<UseTypes> p) {
39.1269 + if (tree.getExpression() != null && tree.getExpression().getKind() == Kind.IDENTIFIER) {
39.1270 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
39.1271 + }
39.1272 +
39.1273 + return super.visitCase(tree, null);
39.1274 + }
39.1275 +
39.1276 + @Override
39.1277 + public Void visitThrow(ThrowTree tree, EnumSet<UseTypes> p) {
39.1278 + if (tree.getExpression() != null && tree.getExpression().getKind() == Kind.IDENTIFIER) {
39.1279 + handlePossibleIdentifier(new TreePath(getCurrentPath(), tree.getExpression()), EnumSet.of(UseTypes.READ));
39.1280 + }
39.1281 +
39.1282 + return super.visitThrow(tree, p);
39.1283 + }
39.1284 +
39.1285 + @Override
39.1286 + public Void visitTypeParameter(TypeParameterTree tree, EnumSet<UseTypes> p) {
39.1287 + for (Tree bound : tree.getBounds()) {
39.1288 + if (bound.getKind() == Kind.IDENTIFIER) {
39.1289 + TreePath tp = new TreePath(getCurrentPath(), bound);
39.1290 +
39.1291 + handlePossibleIdentifier(tp, EnumSet.of(UseTypes.CLASS_USE));
39.1292 + }
39.1293 + }
39.1294 + return super.visitTypeParameter(tree, p);
39.1295 + }
39.1296 +
39.1297 + @Override
39.1298 + public Void visitForLoop(ForLoopTree node, EnumSet<UseTypes> p) {
39.1299 + if (node.getCondition() != null && node.getCondition().getKind() == Kind.IDENTIFIER) {
39.1300 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getCondition()), EnumSet.of(UseTypes.READ));
39.1301 + }
39.1302 +
39.1303 + return super.visitForLoop(node, p);
39.1304 + }
39.1305 +
39.1306 + @Override
39.1307 + public Void visitWildcard(WildcardTree node, EnumSet<UseTypes> p) {
39.1308 + if (node.getBound() != null && node.getBound().getKind() == Kind.IDENTIFIER) {
39.1309 + handlePossibleIdentifier(new TreePath(getCurrentPath(), node.getBound()), EnumSet.of(UseTypes.CLASS_USE));
39.1310 + }
39.1311 + return super.visitWildcard(node, p);
39.1312 + }
39.1313 +
39.1314 + }
39.1315 +
39.1316 + public static interface ErrorDescriptionSetter {
39.1317 +
39.1318 + public void setErrors(Document doc, List<ErrorDescription> errors, List<TreePathHandle> allUnusedImports);
39.1319 + public void setHighlights(Document doc, OffsetsBag highlights);
39.1320 + public void setColorings(Document doc, Map<Token, Coloring> colorings, Set<Token> addedTokens, Set<Token> removedTokens);
39.1321 + }
39.1322 +
39.1323 + static ErrorDescriptionSetter ERROR_DESCRIPTION_SETTER = new ErrorDescriptionSetter() {
39.1324 +
39.1325 + public void setErrors(Document doc, List<ErrorDescription> errors, List<TreePathHandle> allUnusedImports) {}
39.1326 +
39.1327 + public void setHighlights(final Document doc, final OffsetsBag highlights) {
39.1328 + SwingUtilities.invokeLater(new Runnable() {
39.1329 + public void run() {
39.1330 + getImportHighlightsBag(doc).setHighlights(highlights);
39.1331 + }
39.1332 + });
39.1333 + }
39.1334 +
39.1335 + public void setColorings(final Document doc, final Map<Token, Coloring> colorings, final Set<Token> addedTokens, final Set<Token> removedTokens) {
39.1336 + SwingUtilities.invokeLater(new Runnable () {
39.1337 + public void run() {
39.1338 + LexerBasedHighlightLayer.getLayer(SemanticHighlighter.class, doc).setColorings(colorings, addedTokens, removedTokens);
39.1339 + }
39.1340 + });
39.1341 + }
39.1342 + };
39.1343 +
39.1344 + private static final Object KEY_UNUSED_IMPORTS = new Object();
39.1345 + static OffsetsBag getImportHighlightsBag(Document doc) {
39.1346 + OffsetsBag bag = (OffsetsBag) doc.getProperty(KEY_UNUSED_IMPORTS);
39.1347 +
39.1348 + if (bag == null) {
39.1349 + doc.putProperty(KEY_UNUSED_IMPORTS, bag = new OffsetsBag(doc));
39.1350 +
39.1351 + Object stream = doc.getProperty(Document.StreamDescriptionProperty);
39.1352 +
39.1353 + if (stream instanceof DataObject) {
39.1354 +// TimesCollector.getDefault().reportReference(((DataObject) stream).getPrimaryFile(), "ImportsHighlightsBag", "[M] Imports Highlights Bag", bag);
39.1355 + }
39.1356 + }
39.1357 +
39.1358 + return bag;
39.1359 + }
39.1360 +
39.1361 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/TokenList.diff Fri Nov 30 18:49:18 2012 +0100
40.3 @@ -0,0 +1,145 @@
40.4 +31c31
40.5 +< package org.netbeans.modules.java.editor.semantic;
40.6 +---
40.7 +> package org.netbeans.modules.jackpot30.backend.ui.highlighting;
40.8 +39d38
40.9 +< import java.util.ArrayList;
40.10 +41,42d39
40.11 +< import java.util.Collections;
40.12 +< import java.util.Iterator;
40.13 +46d42
40.14 +< import javax.swing.text.Document;
40.15 +48d43
40.16 +< import org.netbeans.api.java.source.CompilationInfo;
40.17 +50,51d44
40.18 +< import org.netbeans.api.lexer.TokenHierarchy;
40.19 +< import org.netbeans.api.lexer.TokenId;
40.20 +52a46
40.21 +> import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
40.22 +62d55
40.23 +< private Document doc;
40.24 +65,66d57
40.25 +< private boolean topLevelIsJava;
40.26 +< private TokenSequence topLevel;
40.27 +69c60
40.28 +< public TokenList(CompilationInfo info, final Document doc, AtomicBoolean cancel) {
40.29 +---
40.30 +> public TokenList(CompilationInfo info, TokenSequence<?> topLevel, AtomicBoolean cancel) {
40.31 +71d61
40.32 +< this.doc = doc;
40.33 +76,77d65
40.34 +< doc.render(new Runnable() {
40.35 +< public void run() {
40.36 +81c69
40.37 +< topLevel = TokenHierarchy.get(doc).tokenSequence();
40.38 +---
40.39 +> assert topLevel.language() == JavaTokenId.language();
40.40 +83,85d70
40.41 +< topLevelIsJava = topLevel.language() == JavaTokenId.language();
40.42 +<
40.43 +< if (topLevelIsJava) {
40.44 +89,91d73
40.45 +< }
40.46 +< }
40.47 +< });
40.48 +95c77
40.49 +< final int offset = info.getSnapshot().getOriginalOffset((int) inputOffset);
40.50 +---
40.51 +> final int offset = (int) inputOffset;
40.52 +99,100d80
40.53 +< doc.render(new Runnable() {
40.54 +< public void run() {
40.55 +108,109c88
40.56 +<
40.57 +< if (topLevelIsJava) {
40.58 +---
40.59 +>
40.60 +114,148d92
40.61 +< } else {
40.62 +< Iterator<? extends TokenSequence> embeddedSeqs = null;
40.63 +< if (ts == null) {
40.64 +< List<? extends TokenSequence> seqs = new ArrayList<TokenSequence>(embeddedTokenSequences(TokenHierarchy.get(doc), offset));
40.65 +< Collections.reverse(seqs);
40.66 +< embeddedSeqs = seqs.iterator();
40.67 +< while (embeddedSeqs.hasNext()) {
40.68 +< TokenSequence tseq = embeddedSeqs.next();
40.69 +< if (tseq.language() == JavaTokenId.language()) {
40.70 +< ts = tseq;
40.71 +< break;
40.72 +< }
40.73 +< }
40.74 +< }
40.75 +<
40.76 +< while (ts != null && ts.offset() < offset) {
40.77 +< if (!ts.moveNext()) {
40.78 +< ts = null;
40.79 +< if (embeddedSeqs == null) {
40.80 +< List<? extends TokenSequence> seqs = new ArrayList<TokenSequence>(embeddedTokenSequences(TokenHierarchy.get(doc), offset));
40.81 +< Collections.reverse(seqs);
40.82 +< embeddedSeqs = seqs.iterator();
40.83 +< }
40.84 +< while (embeddedSeqs.hasNext()) {
40.85 +< TokenSequence tseq = embeddedSeqs.next();
40.86 +< if (tseq.language() == JavaTokenId.language()) {
40.87 +< ts = tseq;
40.88 +< break;
40.89 +< }
40.90 +< }
40.91 +< }
40.92 +< }
40.93 +< }
40.94 +< }
40.95 +< });
40.96 +177,178d120
40.97 +< doc.render(new Runnable() {
40.98 +< public void run() {
40.99 +196c138
40.100 +< if (name.equals(info.getTreeUtilities().decodeIdentifier(ts.token().text()).toString())) {
40.101 +---
40.102 +> if (name.equals(ts.token().text().toString())) {
40.103 +202,203d143
40.104 +< }
40.105 +< });
40.106 +207,208d146
40.107 +< doc.render(new Runnable() {
40.108 +< public void run() {
40.109 +222c160
40.110 +< if (t.id() == JavaTokenId.IDENTIFIER && tree.getName().toString().equals(info.getTreeUtilities().decodeIdentifier(t.text()).toString())) {
40.111 +---
40.112 +> if (t.id() == JavaTokenId.IDENTIFIER && tree.getName().toString().equals(t.text().toString())) {
40.113 +228,229d165
40.114 +< }
40.115 +< });
40.116 +233,234d168
40.117 +< doc.render(new Runnable() {
40.118 +< public void run() {
40.119 +249,250d182
40.120 +< offset = info.getSnapshot().getOriginalOffset(offset);
40.121 +<
40.122 +260,261d191
40.123 +< }
40.124 +< });
40.125 +265,266d194
40.126 +< doc.render(new Runnable() {
40.127 +< public void run() {
40.128 +279,298d206
40.129 +< }
40.130 +< });
40.131 +< }
40.132 +<
40.133 +< private static List<TokenSequence<?>> embeddedTokenSequences(TokenHierarchy<Document> th, int offset) {
40.134 +< TokenSequence<?> embedded = th.tokenSequence();
40.135 +< List<TokenSequence<?>> sequences = new ArrayList<TokenSequence<?>>();
40.136 +<
40.137 +< do {
40.138 +< TokenSequence<?> seq = embedded;
40.139 +< embedded = null;
40.140 +<
40.141 +< seq.move(offset);
40.142 +< if (seq.moveNext()) {
40.143 +< sequences.add(seq);
40.144 +< embedded = seq.embedded();
40.145 +< }
40.146 +< } while (embedded != null);
40.147 +<
40.148 +< return sequences;
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/TokenList.java Fri Nov 30 18:49:18 2012 +0100
41.3 @@ -0,0 +1,209 @@
41.4 +/*
41.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
41.6 + *
41.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
41.8 + *
41.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
41.10 + * Other names may be trademarks of their respective owners.
41.11 + *
41.12 + * The contents of this file are subject to the terms of either the GNU
41.13 + * General Public License Version 2 only ("GPL") or the Common
41.14 + * Development and Distribution License("CDDL") (collectively, the
41.15 + * "License"). You may not use this file except in compliance with the
41.16 + * License. You can obtain a copy of the License at
41.17 + * http://www.netbeans.org/cddl-gplv2.html
41.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
41.19 + * specific language governing permissions and limitations under the
41.20 + * License. When distributing the software, include this License Header
41.21 + * Notice in each file and include the License file at
41.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
41.23 + * particular file as subject to the "Classpath" exception as provided
41.24 + * by Oracle in the GPL Version 2 section of the License file that
41.25 + * accompanied this code. If applicable, add the following below the
41.26 + * License Header, with the fields enclosed by brackets [] replaced by
41.27 + * your own identifying information:
41.28 + * "Portions Copyrighted [year] [name of copyright owner]"
41.29 + *
41.30 + * Contributor(s):
41.31 + *
41.32 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
41.33 + */
41.34 +package org.netbeans.modules.jackpot30.backend.ui.highlighting;
41.35 +
41.36 +import com.sun.source.tree.ArrayTypeTree;
41.37 +import com.sun.source.tree.IdentifierTree;
41.38 +import com.sun.source.tree.Tree;
41.39 +import com.sun.source.tree.Tree.Kind;
41.40 +import com.sun.source.util.SourcePositions;
41.41 +import com.sun.source.util.TreePath;
41.42 +import java.util.Collection;
41.43 +import java.util.List;
41.44 +import java.util.Map;
41.45 +import java.util.concurrent.atomic.AtomicBoolean;
41.46 +import org.netbeans.api.java.lexer.JavaTokenId;
41.47 +import org.netbeans.api.lexer.Token;
41.48 +import org.netbeans.api.lexer.TokenSequence;
41.49 +import org.netbeans.modules.jackpot30.resolve.api.CompilationInfo;
41.50 +
41.51 +/**
41.52 + *
41.53 + * @author Jan Lahoda
41.54 + */
41.55 +public class TokenList {
41.56 +
41.57 + private CompilationInfo info;
41.58 + private SourcePositions sourcePositions;
41.59 + private AtomicBoolean cancel;
41.60 +
41.61 + private TokenSequence ts;
41.62 +
41.63 + public TokenList(CompilationInfo info, TokenSequence<?> topLevel, AtomicBoolean cancel) {
41.64 + this.info = info;
41.65 + this.cancel = cancel;
41.66 +
41.67 + this.sourcePositions = info.getTrees().getSourcePositions();
41.68 +
41.69 + if (TokenList.this.cancel.get())
41.70 + return ;
41.71 +
41.72 + assert topLevel.language() == JavaTokenId.language();
41.73 +
41.74 + ts = topLevel;
41.75 + ts.moveStart();
41.76 + ts.moveNext(); //XXX: what about empty document
41.77 + }
41.78 +
41.79 + public void moveToOffset(long inputOffset) {
41.80 + final int offset = (int) inputOffset;
41.81 +
41.82 + if (offset < 0)
41.83 + return ;
41.84 + if (cancel.get())
41.85 + return ;
41.86 +
41.87 + if (ts != null && !ts.isValid()) {
41.88 + cancel.set(true);
41.89 + return ;
41.90 + }
41.91 +
41.92 + while (ts.offset() < offset) {
41.93 + if (!ts.moveNext())
41.94 + return ;
41.95 + }
41.96 + }
41.97 +
41.98 + public void moveToEnd(Tree t) {
41.99 + if (t == null)
41.100 + return ;
41.101 +
41.102 + long end = sourcePositions.getEndPosition(info.getCompilationUnit(), t);
41.103 +
41.104 + if (end == (-1))
41.105 + return ;
41.106 +
41.107 + if (t.getKind() == Kind.ARRAY_TYPE) {
41.108 + moveToEnd(((ArrayTypeTree) t).getType());
41.109 + return ;
41.110 + }
41.111 + moveToOffset(end);
41.112 + }
41.113 +
41.114 + public void moveToEnd(Collection<? extends Tree> trees) {
41.115 + if (trees == null)
41.116 + return ;
41.117 +
41.118 + for (Tree t : trees) {
41.119 + moveToEnd(t);
41.120 + }
41.121 + }
41.122 +
41.123 + public void firstIdentifier(final TreePath tp, final String name, final Map<Tree, Token> tree2Token) {
41.124 + if (cancel.get())
41.125 + return ;
41.126 +
41.127 + if (ts != null && !ts.isValid()) {
41.128 + cancel.set(true);
41.129 + return ;
41.130 + }
41.131 +
41.132 + if (ts == null)
41.133 + return ;
41.134 +
41.135 + boolean next = true;
41.136 +
41.137 + while (ts.token().id() != JavaTokenId.IDENTIFIER && (next = ts.moveNext()))
41.138 + ;
41.139 +
41.140 + if (next) {
41.141 + if (name.equals(ts.token().text().toString())) {
41.142 + tree2Token.put(tp.getLeaf(), ts.token());
41.143 + } else {
41.144 +// System.err.println("looking for: " + name + ", not found");
41.145 + }
41.146 + }
41.147 + }
41.148 +
41.149 + public void identifierHere(final IdentifierTree tree, final Map<Tree, Token> tree2Token) {
41.150 + if (cancel.get())
41.151 + return ;
41.152 +
41.153 + if (ts != null && !ts.isValid()) {
41.154 + cancel.set(true);
41.155 + return ;
41.156 + }
41.157 +
41.158 + if (ts == null)
41.159 + return ;
41.160 +
41.161 + Token t = ts.token();
41.162 +
41.163 + if (t.id() == JavaTokenId.IDENTIFIER && tree.getName().toString().equals(t.text().toString())) {
41.164 + // System.err.println("visit ident 1");
41.165 + tree2Token.put(tree, ts.token());
41.166 + } else {
41.167 + // System.err.println("visit ident 2");
41.168 + }
41.169 + }
41.170 +
41.171 + public void moveBefore(final List<? extends Tree> tArgs) {
41.172 + if (cancel.get())
41.173 + return ;
41.174 +
41.175 + if (ts != null && !ts.isValid()) {
41.176 + cancel.set(true);
41.177 + return ;
41.178 + }
41.179 +
41.180 + if (ts == null)
41.181 + return ;
41.182 +
41.183 + if (!tArgs.isEmpty()) {
41.184 + int offset = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tArgs.get(0));
41.185 +
41.186 + if (offset < 0)
41.187 + return ;
41.188 +
41.189 + while (ts.offset() >= offset) {
41.190 + if (!ts.movePrevious()) {
41.191 + return;
41.192 + }
41.193 + }
41.194 + }
41.195 + }
41.196 +
41.197 + public void moveNext() {
41.198 + if (cancel.get())
41.199 + return ;
41.200 +
41.201 + if (ts != null && !ts.isValid()) {
41.202 + cancel.set(true);
41.203 + return ;
41.204 + }
41.205 +
41.206 + if (ts == null)
41.207 + return ;
41.208 +
41.209 + ts.moveNext();
41.210 + }
41.211 +
41.212 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/TokenList.java.original Fri Nov 30 18:49:18 2012 +0100
42.3 @@ -0,0 +1,301 @@
42.4 +/*
42.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
42.6 + *
42.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
42.8 + *
42.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
42.10 + * Other names may be trademarks of their respective owners.
42.11 + *
42.12 + * The contents of this file are subject to the terms of either the GNU
42.13 + * General Public License Version 2 only ("GPL") or the Common
42.14 + * Development and Distribution License("CDDL") (collectively, the
42.15 + * "License"). You may not use this file except in compliance with the
42.16 + * License. You can obtain a copy of the License at
42.17 + * http://www.netbeans.org/cddl-gplv2.html
42.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
42.19 + * specific language governing permissions and limitations under the
42.20 + * License. When distributing the software, include this License Header
42.21 + * Notice in each file and include the License file at
42.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
42.23 + * particular file as subject to the "Classpath" exception as provided
42.24 + * by Oracle in the GPL Version 2 section of the License file that
42.25 + * accompanied this code. If applicable, add the following below the
42.26 + * License Header, with the fields enclosed by brackets [] replaced by
42.27 + * your own identifying information:
42.28 + * "Portions Copyrighted [year] [name of copyright owner]"
42.29 + *
42.30 + * Contributor(s):
42.31 + *
42.32 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
42.33 + */
42.34 +package org.netbeans.modules.java.editor.semantic;
42.35 +
42.36 +import com.sun.source.tree.ArrayTypeTree;
42.37 +import com.sun.source.tree.IdentifierTree;
42.38 +import com.sun.source.tree.Tree;
42.39 +import com.sun.source.tree.Tree.Kind;
42.40 +import com.sun.source.util.SourcePositions;
42.41 +import com.sun.source.util.TreePath;
42.42 +import java.util.ArrayList;
42.43 +import java.util.Collection;
42.44 +import java.util.Collections;
42.45 +import java.util.Iterator;
42.46 +import java.util.List;
42.47 +import java.util.Map;
42.48 +import java.util.concurrent.atomic.AtomicBoolean;
42.49 +import javax.swing.text.Document;
42.50 +import org.netbeans.api.java.lexer.JavaTokenId;
42.51 +import org.netbeans.api.java.source.CompilationInfo;
42.52 +import org.netbeans.api.lexer.Token;
42.53 +import org.netbeans.api.lexer.TokenHierarchy;
42.54 +import org.netbeans.api.lexer.TokenId;
42.55 +import org.netbeans.api.lexer.TokenSequence;
42.56 +
42.57 +/**
42.58 + *
42.59 + * @author Jan Lahoda
42.60 + */
42.61 +public class TokenList {
42.62 +
42.63 + private CompilationInfo info;
42.64 + private SourcePositions sourcePositions;
42.65 + private Document doc;
42.66 + private AtomicBoolean cancel;
42.67 +
42.68 + private boolean topLevelIsJava;
42.69 + private TokenSequence topLevel;
42.70 + private TokenSequence ts;
42.71 +
42.72 + public TokenList(CompilationInfo info, final Document doc, AtomicBoolean cancel) {
42.73 + this.info = info;
42.74 + this.doc = doc;
42.75 + this.cancel = cancel;
42.76 +
42.77 + this.sourcePositions = info.getTrees().getSourcePositions();
42.78 +
42.79 + doc.render(new Runnable() {
42.80 + public void run() {
42.81 + if (TokenList.this.cancel.get())
42.82 + return ;
42.83 +
42.84 + topLevel = TokenHierarchy.get(doc).tokenSequence();
42.85 +
42.86 + topLevelIsJava = topLevel.language() == JavaTokenId.language();
42.87 +
42.88 + if (topLevelIsJava) {
42.89 + ts = topLevel;
42.90 + ts.moveStart();
42.91 + ts.moveNext(); //XXX: what about empty document
42.92 + }
42.93 + }
42.94 + });
42.95 + }
42.96 +
42.97 + public void moveToOffset(long inputOffset) {
42.98 + final int offset = info.getSnapshot().getOriginalOffset((int) inputOffset);
42.99 +
42.100 + if (offset < 0)
42.101 + return ;
42.102 + doc.render(new Runnable() {
42.103 + public void run() {
42.104 + if (cancel.get())
42.105 + return ;
42.106 +
42.107 + if (ts != null && !ts.isValid()) {
42.108 + cancel.set(true);
42.109 + return ;
42.110 + }
42.111 +
42.112 + if (topLevelIsJava) {
42.113 + while (ts.offset() < offset) {
42.114 + if (!ts.moveNext())
42.115 + return ;
42.116 + }
42.117 + } else {
42.118 + Iterator<? extends TokenSequence> embeddedSeqs = null;
42.119 + if (ts == null) {
42.120 + List<? extends TokenSequence> seqs = new ArrayList<TokenSequence>(embeddedTokenSequences(TokenHierarchy.get(doc), offset));
42.121 + Collections.reverse(seqs);
42.122 + embeddedSeqs = seqs.iterator();
42.123 + while (embeddedSeqs.hasNext()) {
42.124 + TokenSequence tseq = embeddedSeqs.next();
42.125 + if (tseq.language() == JavaTokenId.language()) {
42.126 + ts = tseq;
42.127 + break;
42.128 + }
42.129 + }
42.130 + }
42.131 +
42.132 + while (ts != null && ts.offset() < offset) {
42.133 + if (!ts.moveNext()) {
42.134 + ts = null;
42.135 + if (embeddedSeqs == null) {
42.136 + List<? extends TokenSequence> seqs = new ArrayList<TokenSequence>(embeddedTokenSequences(TokenHierarchy.get(doc), offset));
42.137 + Collections.reverse(seqs);
42.138 + embeddedSeqs = seqs.iterator();
42.139 + }
42.140 + while (embeddedSeqs.hasNext()) {
42.141 + TokenSequence tseq = embeddedSeqs.next();
42.142 + if (tseq.language() == JavaTokenId.language()) {
42.143 + ts = tseq;
42.144 + break;
42.145 + }
42.146 + }
42.147 + }
42.148 + }
42.149 + }
42.150 + }
42.151 + });
42.152 + }
42.153 +
42.154 + public void moveToEnd(Tree t) {
42.155 + if (t == null)
42.156 + return ;
42.157 +
42.158 + long end = sourcePositions.getEndPosition(info.getCompilationUnit(), t);
42.159 +
42.160 + if (end == (-1))
42.161 + return ;
42.162 +
42.163 + if (t.getKind() == Kind.ARRAY_TYPE) {
42.164 + moveToEnd(((ArrayTypeTree) t).getType());
42.165 + return ;
42.166 + }
42.167 + moveToOffset(end);
42.168 + }
42.169 +
42.170 + public void moveToEnd(Collection<? extends Tree> trees) {
42.171 + if (trees == null)
42.172 + return ;
42.173 +
42.174 + for (Tree t : trees) {
42.175 + moveToEnd(t);
42.176 + }
42.177 + }
42.178 +
42.179 + public void firstIdentifier(final TreePath tp, final String name, final Map<Tree, Token> tree2Token) {
42.180 + doc.render(new Runnable() {
42.181 + public void run() {
42.182 + if (cancel.get())
42.183 + return ;
42.184 +
42.185 + if (ts != null && !ts.isValid()) {
42.186 + cancel.set(true);
42.187 + return ;
42.188 + }
42.189 +
42.190 + if (ts == null)
42.191 + return ;
42.192 +
42.193 + boolean next = true;
42.194 +
42.195 + while (ts.token().id() != JavaTokenId.IDENTIFIER && (next = ts.moveNext()))
42.196 + ;
42.197 +
42.198 + if (next) {
42.199 + if (name.equals(info.getTreeUtilities().decodeIdentifier(ts.token().text()).toString())) {
42.200 + tree2Token.put(tp.getLeaf(), ts.token());
42.201 + } else {
42.202 +// System.err.println("looking for: " + name + ", not found");
42.203 + }
42.204 + }
42.205 + }
42.206 + });
42.207 + }
42.208 +
42.209 + public void identifierHere(final IdentifierTree tree, final Map<Tree, Token> tree2Token) {
42.210 + doc.render(new Runnable() {
42.211 + public void run() {
42.212 + if (cancel.get())
42.213 + return ;
42.214 +
42.215 + if (ts != null && !ts.isValid()) {
42.216 + cancel.set(true);
42.217 + return ;
42.218 + }
42.219 +
42.220 + if (ts == null)
42.221 + return ;
42.222 +
42.223 + Token t = ts.token();
42.224 +
42.225 + if (t.id() == JavaTokenId.IDENTIFIER && tree.getName().toString().equals(info.getTreeUtilities().decodeIdentifier(t.text()).toString())) {
42.226 + // System.err.println("visit ident 1");
42.227 + tree2Token.put(tree, ts.token());
42.228 + } else {
42.229 + // System.err.println("visit ident 2");
42.230 + }
42.231 + }
42.232 + });
42.233 + }
42.234 +
42.235 + public void moveBefore(final List<? extends Tree> tArgs) {
42.236 + doc.render(new Runnable() {
42.237 + public void run() {
42.238 + if (cancel.get())
42.239 + return ;
42.240 +
42.241 + if (ts != null && !ts.isValid()) {
42.242 + cancel.set(true);
42.243 + return ;
42.244 + }
42.245 +
42.246 + if (ts == null)
42.247 + return ;
42.248 +
42.249 + if (!tArgs.isEmpty()) {
42.250 + int offset = (int) info.getTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), tArgs.get(0));
42.251 +
42.252 + offset = info.getSnapshot().getOriginalOffset(offset);
42.253 +
42.254 + if (offset < 0)
42.255 + return ;
42.256 +
42.257 + while (ts.offset() >= offset) {
42.258 + if (!ts.movePrevious()) {
42.259 + return;
42.260 + }
42.261 + }
42.262 + }
42.263 + }
42.264 + });
42.265 + }
42.266 +
42.267 + public void moveNext() {
42.268 + doc.render(new Runnable() {
42.269 + public void run() {
42.270 + if (cancel.get())
42.271 + return ;
42.272 +
42.273 + if (ts != null && !ts.isValid()) {
42.274 + cancel.set(true);
42.275 + return ;
42.276 + }
42.277 +
42.278 + if (ts == null)
42.279 + return ;
42.280 +
42.281 + ts.moveNext();
42.282 + }
42.283 + });
42.284 + }
42.285 +
42.286 + private static List<TokenSequence<?>> embeddedTokenSequences(TokenHierarchy<Document> th, int offset) {
42.287 + TokenSequence<?> embedded = th.tokenSequence();
42.288 + List<TokenSequence<?>> sequences = new ArrayList<TokenSequence<?>>();
42.289 +
42.290 + do {
42.291 + TokenSequence<?> seq = embedded;
42.292 + embedded = null;
42.293 +
42.294 + seq.move(offset);
42.295 + if (seq.moveNext()) {
42.296 + sequences.add(seq);
42.297 + embedded = seq.embedded();
42.298 + }
42.299 + } while (embedded != null);
42.300 +
42.301 + return sequences;
42.302 + }
42.303 +
42.304 +}
43.1 --- a/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/showCode.html Fri Nov 30 07:36:26 2012 +0100
43.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/showCode.html Fri Nov 30 18:49:18 2012 +0100
43.3 @@ -3,6 +3,9 @@
43.4 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
43.5 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
43.6 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/base/jquery-ui.css" rel="stylesheet" type="text/css">
43.7 +<!-- <script type="text/javascript" src="/media/karta/space/src/jackpot30/js-frontend/public_html/jquery.min.js"></script>
43.8 + <script type="text/javascript" src="/media/karta/space/src/jackpot30/js-frontend/public_html/jquery-ui.min.js"></script>
43.9 + <link href="/media/karta/space/src/jackpot30/js-frontend/public_html/jquery-ui.css" rel="stylesheet" type="text/css">-->
43.10 <script type="text/javascript">
43.11 $(document).ready(function() {
43.12 var $codeEl = $("#code");
43.13 @@ -10,35 +13,92 @@
43.14
43.15 $codeEl.empty();
43.16
43.17 - var $highlights = "${categories}";
43.18 + var $highlights = "${categories}".split(", ");
43.19 var $spans = [${spans}];
43.20 var $current = 0;
43.21 for (var i = 0; i < $highlights.length; i++ ) {
43.22 - $codeEl.append($('<span class=' + $highlights.charAt(i) + '>' + $code.slice($current, $current+$spans[i]).replace('&', '&').replace('<', '<') + "</span>"));
43.23 + $codeEl.append($('<a id="p' + $current + '"><span class="' + $highlights[i] + '"' + ($highlights[i].indexOf("identifier") !== (-1) ? ' onclick="ic(' + $current + ')"' : '') + '>' + $code.slice($current, $current+$spans[i]).replace('&', '&').replace('<', '<') + "</span></a>"));
43.24 $current += $spans[i];
43.25 }
43.26 +
43.27 + if (!window.location.hash) {
43.28 + var $params = window.location.search.substring(1).split("&");
43.29 +
43.30 + for (var i = 0; i < $params.length; i++) {
43.31 + if ($params[i].indexOf("signature=") !== (-1)) {
43.32 + $.get('/index/ui/target?path=${path}&relative=${relative}&signature=' + unescape($params[i].substring("signature=".length)), function(data) {
43.33 + var parsedData = $.parseJSON(data);
43.34 + if ("position" in parsedData) {
43.35 + window.location.hash = "#p" + parsedData.position;
43.36 + }
43.37 +
43.38 + });
43.39 + }
43.40 + }
43.41 + } else {
43.42 + window.location.hash = window.location.hash;
43.43 + }
43.44 });
43.45 +
43.46 + function ic(pos) {
43.47 + $.get('/index/ui/target?path=${path}&relative=${relative}&position=' + pos, function(data) {
43.48 + var parsedData = $.parseJSON(data);
43.49 + if ("position" in parsedData) {
43.50 + window.location.hash = "#p" + parsedData.position;
43.51 + } else if ("source" in parsedData) {
43.52 + window.location = "/index/ui/show?path=" + parsedData.path + "&relative=" + parsedData.source + "&signature=" + parsedData.signature;
43.53 + } else if ("targets" in parsedData) {
43.54 + var popupContent = "The target element is defined in the following files:<br>";
43.55 + popupContent += "<ul>";
43.56 +
43.57 + for (var i = 0; i < parsedData.targets.length; i++) {
43.58 + var categoryData = parsedData.targets[i];
43.59 + popupContent += "<li>" + categoryData.rootDisplayName/*XXX: escape*/ + "<br>";
43.60 +
43.61 + for (var f = 0; f < categoryData.files.length; f++) {
43.62 + popupContent += "<img src='/index/icons/javaFile.png' alt='Java File'/>"
43.63 + popupContent += "<a href='/index/ui/show?path=" + categoryData.rootPath + "&relative=" + categoryData.files[i] + "&signature=" + parsedData.signature + "'>" + categoryData.files[i] + "</a><br>";
43.64 + }
43.65 +
43.66 + popupContent += "</li><br>";
43.67 + }
43.68 +
43.69 + popupContent += "</ul><br>";
43.70 + $('#popup').html(popupContent)
43.71 + .dialog({
43.72 + title: 'Show',
43.73 + width: 800 //XXX: hardcoded size
43.74 + });
43.75 + } else if ("signature" in parsedData) {
43.76 + alert("Cannot find source file for class: " + parsedData.signature.split(":")[1]);
43.77 + } else {
43.78 + alert("Cannot resolve target on this place");
43.79 + }
43.80 + });
43.81 + }
43.82 </script>
43.83 <style type="text/css">
43.84 - .K {color: #0000FF; font-weight: bold;}
43.85 - .C {color: #737373;}
43.86 - .H {color: #006F00;}
43.87 - .N {color: #780000;}
43.88 - .S {color: #99009D;}
43.89 - .E {}
43.90 - .W {}
43.91 - .L {color: #0000FF; font-weight: bold;background-color:#DDDD00;}
43.92 - .D {color: #737373;background-color:#DDDD00;}
43.93 - .I {color: #006F00;background-color:#DDDD00;}
43.94 - .O {color: #780000;background-color:#DDDD00;}
43.95 - .T {color: #99009D;background-color:#DDDD00;}
43.96 - .F {background-color:#DDDD00;}
43.97 - .X {background-color:#DDDD00;}
43.98 + .keyword {color: #0000FF; font-weight: bold;}
43.99 + .comment {color: #737373;}
43.100 + .character {color: #006F00;}
43.101 + .number {color: #780000;}
43.102 + .string {color: #99009D;}
43.103 + .identifier {}
43.104 + .identifier:hover { cursor: hand; cursor: pointer; text-decoration:underline; color:blue;}
43.105 + .whitespace {}
43.106 + .highlight {background-color:#DDDD00;}
43.107 + .constructor {font-weight: bold;}
43.108 + .method {font-weight: bold;}
43.109 + .field {color: #098618; font-weight: bold;}
43.110 + .parameter {color: #a06001;}
43.111 + .unused {color: gray;}
43.112 + .static {font-style:italic;}
43.113 </style>
43.114 </head>
43.115 <body>
43.116 <pre id="code">
43.117 ${code}
43.118 </pre>
43.119 +<div id="popup"></div>
43.120 </body>
43.121 </html>
44.1 --- a/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/usages.html Fri Nov 30 07:36:26 2012 +0100
44.2 +++ b/remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/usages.html Fri Nov 30 18:49:18 2012 +0100
44.3 @@ -11,7 +11,7 @@
44.4 <li>${rootResults.rootDisplayName?replace("&", "&")?replace("<", "<")}<br>
44.5 <#list rootResults.files as file>
44.6 <img src="/index/icons/javaFile.png" alt="Java File"/>
44.7 - <a href='/index/ui/show?path=${rootResults.rootPath}&relative=${file}'>${file}</a><br>
44.8 + <a href='/index/ui/show?path=${rootResults.rootPath}&relative=${file}&signature=${elementSignature}'>${file}</a><br>
44.9 </#list>
44.10 </li>
44.11 </#list>