1.1 --- a/.hgignore Sat Feb 18 22:14:42 2012 +0100
1.2 +++ b/.hgignore Tue Feb 21 22:37:57 2012 +0100
1.3 @@ -8,7 +8,7 @@
1.4 ^external$
1.5 .*/external$
1.6 \.old$
1.7 -^server/lib$
1.8 +^lib$
1.9 .*/nbproject-.*/private.xml
1.10 \.aux$
1.11 \.dvi$
2.1 --- a/api/build.xml Sat Feb 18 22:14:42 2012 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,23 +0,0 @@
2.4 -<?xml version="1.0" encoding="UTF-8"?>
2.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
2.6 -<!-- for some information on what you could do (e.g. targets to override). -->
2.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
2.8 -<project name="org.netbeans.modules.jackpot30.api" default="netbeans" basedir=".">
2.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.api.</description>
2.10 - <import file="nbproject/build-impl.xml"/>
2.11 - <import file="${suite.dir}/findbugs-import.xml"/>
2.12 -
2.13 - <!-- Mac -->
2.14 - <pathconvert property="retouche.javac">
2.15 - <fileset dir="${nbplatform.active.dir}">
2.16 - <filename name="java*/modules/ext/javac*.jar"/>
2.17 - </fileset>
2.18 - <fileset dir="${java.home}/../Classes" erroronmissingdir="false">
2.19 - <include name="*.jar"/>
2.20 - </fileset>
2.21 - </pathconvert>
2.22 - <echo message="${retouche.javac}"/>
2.23 - <condition property="bootclasspath.mac" value="${retouche.javac}">
2.24 - <os family="mac"/>
2.25 - </condition>
2.26 -</project>
3.1 --- a/api/manifest.mf Sat Feb 18 22:14:42 2012 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,7 +0,0 @@
3.4 -Manifest-Version: 1.0
3.5 -AutoUpdate-Show-In-Client: false
3.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.api
3.7 -OpenIDE-Module-Implementation-Version: 1
3.8 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/impl/resources/layer.xml
3.9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/impl/resources/Bundle.properties
3.10 -
4.1 --- a/api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,45 +0,0 @@
4.4 -<?xml version="1.0" encoding="UTF-8"?>
4.5 -<!--
4.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
4.7 -*** EDIT ../build.xml INSTEAD ***
4.8 --->
4.9 -<project name="org.netbeans.modules.jackpot30.api-impl" basedir="..">
4.10 - <fail message="Please build using Ant 1.7.1 or higher.">
4.11 - <condition>
4.12 - <not>
4.13 - <antversion atleast="1.7.1"/>
4.14 - </not>
4.15 - </condition>
4.16 - </fail>
4.17 - <property file="nbproject/private/suite-private.properties"/>
4.18 - <property file="nbproject/suite.properties"/>
4.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
4.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
4.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
4.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
4.23 - <attribute name="name"/>
4.24 - <attribute name="value"/>
4.25 - <sequential>
4.26 - <property name="@{name}" value="${@{value}}"/>
4.27 - </sequential>
4.28 - </macrodef>
4.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
4.30 - <attribute name="property"/>
4.31 - <attribute name="value"/>
4.32 - <sequential>
4.33 - <property name="@{property}" value="@{value}"/>
4.34 - </sequential>
4.35 - </macrodef>
4.36 - <property file="${user.properties.file}"/>
4.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
4.41 - <condition>
4.42 - <not>
4.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
4.44 - </not>
4.45 - </condition>
4.46 - </fail>
4.47 - <import file="${harness.dir}/build.xml"/>
4.48 -</project>
5.1 --- a/api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,8 +0,0 @@
5.4 -build.xml.data.CRC32=f9c1509c
5.5 -build.xml.script.CRC32=0abcaef9
5.6 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
5.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
5.9 -nbproject/build-impl.xml.data.CRC32=6500fcd0
5.10 -nbproject/build-impl.xml.script.CRC32=c4574e66
5.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
6.1 --- a/api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,3 +0,0 @@
6.4 -javac.source=1.5
6.5 -javac.compilerargs=-Xlint -Xlint:-serial
6.6 -spec.version.base=1.16.0
7.1 --- a/api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,437 +0,0 @@
7.4 -<?xml version="1.0" encoding="UTF-8"?>
7.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
7.6 - <type>org.netbeans.modules.apisupport.project</type>
7.7 - <configuration>
7.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
7.9 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
7.10 - <suite-component/>
7.11 - <module-dependencies>
7.12 - <dependency>
7.13 - <code-name-base>org.jdesktop.layout</code-name-base>
7.14 - <build-prerequisite/>
7.15 - <compile-dependency/>
7.16 - <run-dependency>
7.17 - <release-version>1</release-version>
7.18 - <specification-version>1.7.0.103</specification-version>
7.19 - </run-dependency>
7.20 - </dependency>
7.21 - <dependency>
7.22 - <code-name-base>org.netbeans.api.annotations.common</code-name-base>
7.23 - <build-prerequisite/>
7.24 - <compile-dependency/>
7.25 - <run-dependency>
7.26 - <release-version>1</release-version>
7.27 - <specification-version>1.0</specification-version>
7.28 - </run-dependency>
7.29 - </dependency>
7.30 - <dependency>
7.31 - <code-name-base>org.netbeans.api.java.classpath</code-name-base>
7.32 - <build-prerequisite/>
7.33 - <compile-dependency/>
7.34 - <run-dependency>
7.35 - <release-version>1</release-version>
7.36 - <specification-version>1.19</specification-version>
7.37 - </run-dependency>
7.38 - </dependency>
7.39 - <dependency>
7.40 - <code-name-base>org.netbeans.api.progress</code-name-base>
7.41 - <build-prerequisite/>
7.42 - <compile-dependency/>
7.43 - <run-dependency>
7.44 - <release-version>1</release-version>
7.45 - <specification-version>1.13.0.1</specification-version>
7.46 - </run-dependency>
7.47 - </dependency>
7.48 - <dependency>
7.49 - <code-name-base>org.netbeans.libs.javacapi</code-name-base>
7.50 - <build-prerequisite/>
7.51 - <compile-dependency/>
7.52 - <run-dependency>
7.53 - <specification-version>7.5.0.3</specification-version>
7.54 - </run-dependency>
7.55 - </dependency>
7.56 - <dependency>
7.57 - <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
7.58 - <build-prerequisite/>
7.59 - <compile-dependency/>
7.60 - <run-dependency>
7.61 - <release-version>1</release-version>
7.62 - <implementation-version/>
7.63 - </run-dependency>
7.64 - </dependency>
7.65 - <dependency>
7.66 - <code-name-base>org.netbeans.libs.lucene</code-name-base>
7.67 - <build-prerequisite/>
7.68 - <compile-dependency/>
7.69 - <run-dependency>
7.70 - <release-version>1-3</release-version>
7.71 - <specification-version>2.13</specification-version>
7.72 - </run-dependency>
7.73 - </dependency>
7.74 - <dependency>
7.75 - <code-name-base>org.netbeans.modules.diff</code-name-base>
7.76 - <build-prerequisite/>
7.77 - <compile-dependency/>
7.78 - <run-dependency>
7.79 - <release-version>1</release-version>
7.80 - <implementation-version/>
7.81 - </run-dependency>
7.82 - </dependency>
7.83 - <dependency>
7.84 - <code-name-base>org.netbeans.modules.editor</code-name-base>
7.85 - <build-prerequisite/>
7.86 - <compile-dependency/>
7.87 - <run-dependency>
7.88 - <release-version>3</release-version>
7.89 - <specification-version>1.56.0.5.13.6</specification-version>
7.90 - </run-dependency>
7.91 - </dependency>
7.92 - <dependency>
7.93 - <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
7.94 - <build-prerequisite/>
7.95 - <compile-dependency/>
7.96 - <run-dependency>
7.97 - <release-version>1-3</release-version>
7.98 - <specification-version>1.38.0.9.2</specification-version>
7.99 - </run-dependency>
7.100 - </dependency>
7.101 - <dependency>
7.102 - <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
7.103 - <build-prerequisite/>
7.104 - <compile-dependency/>
7.105 - <run-dependency>
7.106 - <release-version>1</release-version>
7.107 - <specification-version>1.13.0.2</specification-version>
7.108 - </run-dependency>
7.109 - </dependency>
7.110 - <dependency>
7.111 - <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
7.112 - <build-prerequisite/>
7.113 - <compile-dependency/>
7.114 - <run-dependency>
7.115 - <release-version>1</release-version>
7.116 - <specification-version>1.12</specification-version>
7.117 - </run-dependency>
7.118 - </dependency>
7.119 - <dependency>
7.120 - <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
7.121 - <build-prerequisite/>
7.122 - <compile-dependency/>
7.123 - <run-dependency>
7.124 - <release-version>1</release-version>
7.125 - <specification-version>1.25</specification-version>
7.126 - </run-dependency>
7.127 - </dependency>
7.128 - <dependency>
7.129 - <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
7.130 - <build-prerequisite/>
7.131 - <compile-dependency/>
7.132 - <run-dependency>
7.133 - <specification-version>1.0</specification-version>
7.134 - </run-dependency>
7.135 - </dependency>
7.136 - <dependency>
7.137 - <code-name-base>org.netbeans.modules.java.editor</code-name-base>
7.138 - <build-prerequisite/>
7.139 - <compile-dependency/>
7.140 - <run-dependency>
7.141 - <release-version>1</release-version>
7.142 - <implementation-version/>
7.143 - </run-dependency>
7.144 - </dependency>
7.145 - <dependency>
7.146 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
7.147 - <build-prerequisite/>
7.148 - <compile-dependency/>
7.149 - <run-dependency>
7.150 - <release-version>1</release-version>
7.151 - <implementation-version/>
7.152 - </run-dependency>
7.153 - </dependency>
7.154 - <dependency>
7.155 - <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
7.156 - <build-prerequisite/>
7.157 - <compile-dependency/>
7.158 - <run-dependency>
7.159 - <release-version>1</release-version>
7.160 - <specification-version>1.9</specification-version>
7.161 - </run-dependency>
7.162 - </dependency>
7.163 - <dependency>
7.164 - <code-name-base>org.netbeans.modules.java.platform</code-name-base>
7.165 - <build-prerequisite/>
7.166 - <compile-dependency/>
7.167 - <run-dependency>
7.168 - <release-version>1</release-version>
7.169 - <specification-version>1.12</specification-version>
7.170 - </run-dependency>
7.171 - </dependency>
7.172 - <dependency>
7.173 - <code-name-base>org.netbeans.modules.java.preprocessorbridge</code-name-base>
7.174 - <build-prerequisite/>
7.175 - <compile-dependency/>
7.176 - <run-dependency>
7.177 - <implementation-version/>
7.178 - </run-dependency>
7.179 - </dependency>
7.180 - <dependency>
7.181 - <code-name-base>org.netbeans.modules.java.source</code-name-base>
7.182 - <build-prerequisite/>
7.183 - <compile-dependency/>
7.184 - <run-dependency>
7.185 - <implementation-version/>
7.186 - </run-dependency>
7.187 - </dependency>
7.188 - <dependency>
7.189 - <code-name-base>org.netbeans.modules.lexer</code-name-base>
7.190 - <build-prerequisite/>
7.191 - <compile-dependency/>
7.192 - <run-dependency>
7.193 - <release-version>2</release-version>
7.194 - <specification-version>1.34</specification-version>
7.195 - </run-dependency>
7.196 - </dependency>
7.197 - <dependency>
7.198 - <code-name-base>org.netbeans.modules.options.api</code-name-base>
7.199 - <build-prerequisite/>
7.200 - <compile-dependency/>
7.201 - <run-dependency>
7.202 - <release-version>1</release-version>
7.203 - <specification-version>1.20</specification-version>
7.204 - </run-dependency>
7.205 - </dependency>
7.206 - <dependency>
7.207 - <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
7.208 - <build-prerequisite/>
7.209 - <compile-dependency/>
7.210 - <run-dependency>
7.211 - <release-version>1</release-version>
7.212 - <implementation-version/>
7.213 - </run-dependency>
7.214 - </dependency>
7.215 - <dependency>
7.216 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
7.217 - <build-prerequisite/>
7.218 - <compile-dependency/>
7.219 - <run-dependency>
7.220 - <release-version>1</release-version>
7.221 - <specification-version>1.24</specification-version>
7.222 - </run-dependency>
7.223 - </dependency>
7.224 - <dependency>
7.225 - <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
7.226 - <build-prerequisite/>
7.227 - <compile-dependency/>
7.228 - <run-dependency>
7.229 - <release-version>1</release-version>
7.230 - <specification-version>1.35.0.6</specification-version>
7.231 - </run-dependency>
7.232 - </dependency>
7.233 - <dependency>
7.234 - <code-name-base>org.netbeans.modules.queries</code-name-base>
7.235 - <build-prerequisite/>
7.236 - <compile-dependency/>
7.237 - <run-dependency>
7.238 - <release-version>1</release-version>
7.239 - <specification-version>1.15</specification-version>
7.240 - </run-dependency>
7.241 - </dependency>
7.242 - <dependency>
7.243 - <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
7.244 - <build-prerequisite/>
7.245 - <compile-dependency/>
7.246 - <run-dependency>
7.247 - <specification-version>1.6</specification-version>
7.248 - </run-dependency>
7.249 - </dependency>
7.250 - <dependency>
7.251 - <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
7.252 - <build-prerequisite/>
7.253 - <compile-dependency/>
7.254 - <run-dependency>
7.255 - <release-version>1</release-version>
7.256 - <specification-version>1.6</specification-version>
7.257 - </run-dependency>
7.258 - </dependency>
7.259 - <dependency>
7.260 - <code-name-base>org.netbeans.modules.sendopts</code-name-base>
7.261 - <build-prerequisite/>
7.262 - <compile-dependency/>
7.263 - <run-dependency>
7.264 - <release-version>2</release-version>
7.265 - <specification-version>2.4</specification-version>
7.266 - </run-dependency>
7.267 - </dependency>
7.268 - <dependency>
7.269 - <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
7.270 - <build-prerequisite/>
7.271 - <compile-dependency/>
7.272 - <run-dependency>
7.273 - <release-version>0-1</release-version>
7.274 - <specification-version>1.7.0.7.2</specification-version>
7.275 - </run-dependency>
7.276 - </dependency>
7.277 - <dependency>
7.278 - <code-name-base>org.openide.awt</code-name-base>
7.279 - <build-prerequisite/>
7.280 - <compile-dependency/>
7.281 - <run-dependency>
7.282 - <specification-version>7.7.0.1</specification-version>
7.283 - </run-dependency>
7.284 - </dependency>
7.285 - <dependency>
7.286 - <code-name-base>org.openide.dialogs</code-name-base>
7.287 - <build-prerequisite/>
7.288 - <compile-dependency/>
7.289 - <run-dependency>
7.290 - <specification-version>7.10</specification-version>
7.291 - </run-dependency>
7.292 - </dependency>
7.293 - <dependency>
7.294 - <code-name-base>org.openide.filesystems</code-name-base>
7.295 - <build-prerequisite/>
7.296 - <compile-dependency/>
7.297 - <run-dependency>
7.298 - <specification-version>7.21.0.1.1</specification-version>
7.299 - </run-dependency>
7.300 - </dependency>
7.301 - <dependency>
7.302 - <code-name-base>org.openide.loaders</code-name-base>
7.303 - <build-prerequisite/>
7.304 - <compile-dependency/>
7.305 - <run-dependency>
7.306 - <specification-version>7.5</specification-version>
7.307 - </run-dependency>
7.308 - </dependency>
7.309 - <dependency>
7.310 - <code-name-base>org.openide.modules</code-name-base>
7.311 - <build-prerequisite/>
7.312 - <compile-dependency/>
7.313 - <run-dependency>
7.314 - <specification-version>7.10</specification-version>
7.315 - </run-dependency>
7.316 - </dependency>
7.317 - <dependency>
7.318 - <code-name-base>org.openide.nodes</code-name-base>
7.319 - <build-prerequisite/>
7.320 - <compile-dependency/>
7.321 - <run-dependency>
7.322 - <specification-version>7.9.0.1</specification-version>
7.323 - </run-dependency>
7.324 - </dependency>
7.325 - <dependency>
7.326 - <code-name-base>org.openide.text</code-name-base>
7.327 - <build-prerequisite/>
7.328 - <compile-dependency/>
7.329 - <run-dependency>
7.330 - <specification-version>6.22</specification-version>
7.331 - </run-dependency>
7.332 - </dependency>
7.333 - <dependency>
7.334 - <code-name-base>org.openide.util</code-name-base>
7.335 - <build-prerequisite/>
7.336 - <compile-dependency/>
7.337 - <run-dependency>
7.338 - <specification-version>8.0</specification-version>
7.339 - </run-dependency>
7.340 - </dependency>
7.341 - <dependency>
7.342 - <code-name-base>org.openide.util.lookup</code-name-base>
7.343 - <build-prerequisite/>
7.344 - <compile-dependency/>
7.345 - <run-dependency>
7.346 - <specification-version>8.0.0.1</specification-version>
7.347 - </run-dependency>
7.348 - </dependency>
7.349 - <dependency>
7.350 - <code-name-base>org.openide.windows</code-name-base>
7.351 - <build-prerequisite/>
7.352 - <compile-dependency/>
7.353 - <run-dependency>
7.354 - <specification-version>6.27</specification-version>
7.355 - </run-dependency>
7.356 - </dependency>
7.357 - </module-dependencies>
7.358 - <test-dependencies>
7.359 - <test-type>
7.360 - <name>unit</name>
7.361 - <test-dependency>
7.362 - <code-name-base>org.netbeans.bootstrap</code-name-base>
7.363 - </test-dependency>
7.364 - <test-dependency>
7.365 - <code-name-base>org.netbeans.core.startup</code-name-base>
7.366 - </test-dependency>
7.367 - <test-dependency>
7.368 - <code-name-base>org.netbeans.insane</code-name-base>
7.369 - <compile-dependency/>
7.370 - </test-dependency>
7.371 - <test-dependency>
7.372 - <code-name-base>org.netbeans.libs.junit4</code-name-base>
7.373 - <compile-dependency/>
7.374 - </test-dependency>
7.375 - <test-dependency>
7.376 - <code-name-base>org.netbeans.modules.classfile</code-name-base>
7.377 - </test-dependency>
7.378 - <test-dependency>
7.379 - <code-name-base>org.netbeans.modules.defaults</code-name-base>
7.380 - </test-dependency>
7.381 - <test-dependency>
7.382 - <code-name-base>org.netbeans.modules.editor</code-name-base>
7.383 - </test-dependency>
7.384 - <test-dependency>
7.385 - <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
7.386 - </test-dependency>
7.387 - <test-dependency>
7.388 - <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
7.389 - </test-dependency>
7.390 - <test-dependency>
7.391 - <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
7.392 - </test-dependency>
7.393 - <test-dependency>
7.394 - <code-name-base>org.netbeans.modules.editor.util</code-name-base>
7.395 - </test-dependency>
7.396 - <test-dependency>
7.397 - <code-name-base>org.netbeans.modules.jackpot30.common.test</code-name-base>
7.398 - <compile-dependency/>
7.399 - </test-dependency>
7.400 - <test-dependency>
7.401 - <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
7.402 - <recursive/>
7.403 - <compile-dependency/>
7.404 - </test-dependency>
7.405 - <test-dependency>
7.406 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
7.407 - <compile-dependency/>
7.408 - </test-dependency>
7.409 - <test-dependency>
7.410 - <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
7.411 - </test-dependency>
7.412 - <test-dependency>
7.413 - <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
7.414 - </test-dependency>
7.415 - <test-dependency>
7.416 - <code-name-base>org.netbeans.modules.masterfs</code-name-base>
7.417 - </test-dependency>
7.418 - <test-dependency>
7.419 - <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
7.420 - <compile-dependency/>
7.421 - </test-dependency>
7.422 - <test-dependency>
7.423 - <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
7.424 - </test-dependency>
7.425 - <test-dependency>
7.426 - <code-name-base>org.netbeans.modules.projectui</code-name-base>
7.427 - </test-dependency>
7.428 - <test-dependency>
7.429 - <code-name-base>org.openidex.util</code-name-base>
7.430 - </test-dependency>
7.431 - </test-type>
7.432 - </test-dependencies>
7.433 - <public-packages>
7.434 - <package>org.netbeans.modules.jackpot30.spi</package>
7.435 - <package>org.netbeans.modules.jackpot30.spi.refactoring</package>
7.436 - <package>org.netbeans.modules.jackpot30.spi.support</package>
7.437 - </public-packages>
7.438 - </data>
7.439 - </configuration>
7.440 -</project>
8.1 --- a/api/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,1 +0,0 @@
8.4 -suite.dir=${basedir}/..
9.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,46 +0,0 @@
9.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.5 -#
9.6 -# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
9.7 -#
9.8 -# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.9 -# Other names may be trademarks of their respective owners.
9.10 -#
9.11 -# The contents of this file are subject to the terms of either the GNU
9.12 -# General Public License Version 2 only ("GPL") or the Common
9.13 -# Development and Distribution License("CDDL") (collectively, the
9.14 -# "License"). You may not use this file except in compliance with the
9.15 -# License. You can obtain a copy of the License at
9.16 -# http://www.netbeans.org/cddl-gplv2.html
9.17 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.18 -# specific language governing permissions and limitations under the
9.19 -# License. When distributing the software, include this License Header
9.20 -# Notice in each file and include the License file at
9.21 -# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.22 -# particular file as subject to the "Classpath" exception as provided
9.23 -# by Oracle in the GPL Version 2 section of the License file that
9.24 -# accompanied this code. If applicable, add the following below the
9.25 -# License Header, with the fields enclosed by brackets [] replaced by
9.26 -# your own identifying information:
9.27 -# "Portions Copyrighted [year] [name of copyright owner]"
9.28 -#
9.29 -# If you wish your version of this file to be governed by only the CDDL
9.30 -# or only the GPL Version 2, indicate your decision by adding
9.31 -# "[Contributor] elects to include this software in this distribution
9.32 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
9.33 -# single choice of license, a recipient has the option to distribute
9.34 -# your version of this file under either the CDDL, the GPL Version 2 or
9.35 -# to extend the choice of license to its licensees as provided above.
9.36 -# However, if you add GPL Version 2 code and therefore, elected the GPL
9.37 -# Version 2 license, then the option applies only if the new code is
9.38 -# made subject to such option by the copyright holder.
9.39 -#
9.40 -# Contributor(s):
9.41 -#
9.42 -# Portions Copyrighted 2010 Sun Microsystems, Inc.
9.43 -
9.44 -double-checked-locking=Double Checked Locking
9.45 -double-checked-locking-verify=Double Checked Locking Strict
9.46 -double-checked-locking-fix=Double Checked Locking
9.47 -new-string=New String Creation
9.48 -lambda-candidate=Find candidates for Lambda expression
9.49 -ExamplesList.pattern.contentType=text/x-javahints
10.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/Example.java Sat Feb 18 22:14:42 2012 +0100
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,83 +0,0 @@
10.4 -/*
10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 - *
10.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
10.8 - *
10.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
10.10 - * Other names may be trademarks of their respective owners.
10.11 - *
10.12 - * The contents of this file are subject to the terms of either the GNU
10.13 - * General Public License Version 2 only ("GPL") or the Common
10.14 - * Development and Distribution License("CDDL") (collectively, the
10.15 - * "License"). You may not use this file except in compliance with the
10.16 - * License. You can obtain a copy of the License at
10.17 - * http://www.netbeans.org/cddl-gplv2.html
10.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.19 - * specific language governing permissions and limitations under the
10.20 - * License. When distributing the software, include this License Header
10.21 - * Notice in each file and include the License file at
10.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
10.23 - * particular file as subject to the "Classpath" exception as provided
10.24 - * by Oracle in the GPL Version 2 section of the License file that
10.25 - * accompanied this code. If applicable, add the following below the
10.26 - * License Header, with the fields enclosed by brackets [] replaced by
10.27 - * your own identifying information:
10.28 - * "Portions Copyrighted [year] [name of copyright owner]"
10.29 - *
10.30 - * If you wish your version of this file to be governed by only the CDDL
10.31 - * or only the GPL Version 2, indicate your decision by adding
10.32 - * "[Contributor] elects to include this software in this distribution
10.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
10.34 - * single choice of license, a recipient has the option to distribute
10.35 - * your version of this file under either the CDDL, the GPL Version 2 or
10.36 - * to extend the choice of license to its licensees as provided above.
10.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
10.38 - * Version 2 license, then the option applies only if the new code is
10.39 - * made subject to such option by the copyright holder.
10.40 - *
10.41 - * Contributor(s):
10.42 - *
10.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
10.44 - */
10.45 -
10.46 -package org.netbeans.modules.jackpot30.impl.examples;
10.47 -
10.48 -import java.util.Set;
10.49 -import org.openide.util.NbBundle;
10.50 -
10.51 -/**
10.52 - *
10.53 - * @author lahvac
10.54 - */
10.55 -public class Example {
10.56 -
10.57 - private final String key;
10.58 - private final String code;
10.59 - private final Set<Option> options;
10.60 -
10.61 - Example(String key, String code, Set<Option> options) {
10.62 - this.key = key;
10.63 - this.code = code;
10.64 - this.options = options;
10.65 - }
10.66 -
10.67 - String getKey() {
10.68 - return key;
10.69 - }
10.70 -
10.71 - public String getDisplayName() {
10.72 - return NbBundle.getMessage(LoadExamples.class, key);
10.73 - }
10.74 -
10.75 - public String getCode() {
10.76 - return code;
10.77 - }
10.78 -
10.79 - public Set<Option> getOptions() {
10.80 - return options;
10.81 - }
10.82 -
10.83 - public enum Option {
10.84 - VERIFY, FIX;
10.85 - }
10.86 -}
11.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.form Sat Feb 18 22:14:42 2012 +0100
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,95 +0,0 @@
11.4 -<?xml version="1.0" encoding="UTF-8" ?>
11.5 -
11.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
11.7 - <AuxValues>
11.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
11.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
11.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
11.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
11.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
11.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
11.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
11.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
11.17 - </AuxValues>
11.18 -
11.19 - <Layout>
11.20 - <DimensionLayout dim="0">
11.21 - <Group type="103" groupAlignment="0" attributes="0">
11.22 - <Group type="102" alignment="1" attributes="0">
11.23 - <EmptySpace max="-2" attributes="0"/>
11.24 - <Group type="103" groupAlignment="1" attributes="0">
11.25 - <Component id="jScrollPane2" alignment="0" pref="376" max="32767" attributes="0"/>
11.26 - <Component id="jScrollPane1" alignment="0" pref="376" max="32767" attributes="0"/>
11.27 - <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
11.28 - </Group>
11.29 - <EmptySpace max="-2" attributes="0"/>
11.30 - </Group>
11.31 - </Group>
11.32 - </DimensionLayout>
11.33 - <DimensionLayout dim="1">
11.34 - <Group type="103" groupAlignment="0" attributes="0">
11.35 - <Group type="102" alignment="0" attributes="0">
11.36 - <EmptySpace max="-2" attributes="0"/>
11.37 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
11.38 - <EmptySpace max="-2" attributes="0"/>
11.39 - <Component id="jScrollPane1" pref="130" max="32767" attributes="0"/>
11.40 - <EmptySpace max="-2" attributes="0"/>
11.41 - <Component id="jScrollPane2" min="-2" pref="119" max="-2" attributes="0"/>
11.42 - <EmptySpace max="-2" attributes="0"/>
11.43 - </Group>
11.44 - </Group>
11.45 - </DimensionLayout>
11.46 - </Layout>
11.47 - <SubComponents>
11.48 - <Component class="javax.swing.JLabel" name="jLabel1">
11.49 - <Properties>
11.50 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
11.51 - <Connection code="convertor.getHeader()" type="code"/>
11.52 - </Property>
11.53 - </Properties>
11.54 - </Component>
11.55 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
11.56 - <AuxValues>
11.57 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
11.58 - </AuxValues>
11.59 -
11.60 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
11.61 - <SubComponents>
11.62 - <Component class="javax.swing.JList" name="list">
11.63 - <Properties>
11.64 - <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
11.65 - <StringArray count="5">
11.66 - <StringItem index="0" value="Item 1"/>
11.67 - <StringItem index="1" value="Item 2"/>
11.68 - <StringItem index="2" value="Item 3"/>
11.69 - <StringItem index="3" value="Item 4"/>
11.70 - <StringItem index="4" value="Item 5"/>
11.71 - </StringArray>
11.72 - </Property>
11.73 - </Properties>
11.74 - <Events>
11.75 - <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="listMouseClicked"/>
11.76 - <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="listValueChanged"/>
11.77 - </Events>
11.78 - </Component>
11.79 - </SubComponents>
11.80 - </Container>
11.81 - <Container class="javax.swing.JScrollPane" name="jScrollPane2">
11.82 - <AuxValues>
11.83 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
11.84 - </AuxValues>
11.85 -
11.86 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
11.87 - <SubComponents>
11.88 - <Component class="javax.swing.JEditorPane" name="pattern">
11.89 - <Properties>
11.90 - <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
11.91 - <ResourceString bundle="org/netbeans/modules/jackpot30/impl/examples/Bundle.properties" key="ExamplesList.pattern.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
11.92 - </Property>
11.93 - </Properties>
11.94 - </Component>
11.95 - </SubComponents>
11.96 - </Container>
11.97 - </SubComponents>
11.98 -</Form>
12.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.java Sat Feb 18 22:14:42 2012 +0100
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,223 +0,0 @@
12.4 -/*
12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 - *
12.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
12.8 - *
12.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
12.10 - * Other names may be trademarks of their respective owners.
12.11 - *
12.12 - * The contents of this file are subject to the terms of either the GNU
12.13 - * General Public License Version 2 only ("GPL") or the Common
12.14 - * Development and Distribution License("CDDL") (collectively, the
12.15 - * "License"). You may not use this file except in compliance with the
12.16 - * License. You can obtain a copy of the License at
12.17 - * http://www.netbeans.org/cddl-gplv2.html
12.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.19 - * specific language governing permissions and limitations under the
12.20 - * License. When distributing the software, include this License Header
12.21 - * Notice in each file and include the License file at
12.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
12.23 - * particular file as subject to the "Classpath" exception as provided
12.24 - * by Oracle in the GPL Version 2 section of the License file that
12.25 - * accompanied this code. If applicable, add the following below the
12.26 - * License Header, with the fields enclosed by brackets [] replaced by
12.27 - * your own identifying information:
12.28 - * "Portions Copyrighted [year] [name of copyright owner]"
12.29 - *
12.30 - * If you wish your version of this file to be governed by only the CDDL
12.31 - * or only the GPL Version 2, indicate your decision by adding
12.32 - * "[Contributor] elects to include this software in this distribution
12.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.34 - * single choice of license, a recipient has the option to distribute
12.35 - * your version of this file under either the CDDL, the GPL Version 2 or
12.36 - * to extend the choice of license to its licensees as provided above.
12.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
12.38 - * Version 2 license, then the option applies only if the new code is
12.39 - * made subject to such option by the copyright holder.
12.40 - *
12.41 - * Contributor(s):
12.42 - *
12.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
12.44 - */
12.45 -package org.netbeans.modules.jackpot30.impl.examples;
12.46 -
12.47 -import java.awt.Component;
12.48 -import java.awt.Dialog;
12.49 -import java.awt.Rectangle;
12.50 -import java.util.Collections;
12.51 -import java.util.Set;
12.52 -import javax.swing.DefaultListCellRenderer;
12.53 -import javax.swing.DefaultListModel;
12.54 -import javax.swing.JList;
12.55 -import javax.swing.text.BadLocationException;
12.56 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
12.57 -import org.openide.DialogDescriptor;
12.58 -import org.openide.DialogDisplayer;
12.59 -import org.openide.util.Exceptions;
12.60 -
12.61 -/**
12.62 - *
12.63 - * @author lahvac
12.64 - */
12.65 -public class ExamplesList<T> extends javax.swing.JPanel {
12.66 -
12.67 - private final DialogDescription<T> convertor;
12.68 - private final Class<T> dataClass;
12.69 -
12.70 - public ExamplesList(Iterable<? extends T> data, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
12.71 - this.convertor = convertor;
12.72 - this.dataClass = dataClass;
12.73 -
12.74 - initComponents();
12.75 -
12.76 - DefaultListModel listModel = new DefaultListModel();
12.77 -
12.78 - for (T t : data) {
12.79 - Set<Option> options = convertor.getOptions(t);
12.80 - if (!options.containsAll(require)) continue;
12.81 - if (!Collections.disjoint(options, forbidden)) continue;
12.82 -
12.83 - listModel.addElement(t);
12.84 - }
12.85 -
12.86 - list.setModel(listModel);
12.87 - list.setCellRenderer(new ExamplesRenderer());
12.88 - list.setSelectedIndex(0);
12.89 - }
12.90 -
12.91 - /** This method is called from within the constructor to
12.92 - * initialize the form.
12.93 - * WARNING: Do NOT modify this code. The content of this method is
12.94 - * always regenerated by the Form Editor.
12.95 - */
12.96 - @SuppressWarnings("unchecked")
12.97 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
12.98 - private void initComponents() {
12.99 -
12.100 - jLabel1 = new javax.swing.JLabel();
12.101 - jScrollPane1 = new javax.swing.JScrollPane();
12.102 - list = new javax.swing.JList();
12.103 - jScrollPane2 = new javax.swing.JScrollPane();
12.104 - pattern = new javax.swing.JEditorPane();
12.105 -
12.106 - jLabel1.setText(convertor.getHeader());
12.107 -
12.108 - list.setModel(new javax.swing.AbstractListModel() {
12.109 - String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
12.110 - public int getSize() { return strings.length; }
12.111 - public Object getElementAt(int i) { return strings[i]; }
12.112 - });
12.113 - list.addMouseListener(new java.awt.event.MouseAdapter() {
12.114 - public void mouseClicked(java.awt.event.MouseEvent evt) {
12.115 - listMouseClicked(evt);
12.116 - }
12.117 - });
12.118 - list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
12.119 - public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
12.120 - listValueChanged(evt);
12.121 - }
12.122 - });
12.123 - jScrollPane1.setViewportView(list);
12.124 -
12.125 - pattern.setContentType(org.openide.util.NbBundle.getMessage(ExamplesList.class, "ExamplesList.pattern.contentType")); // NOI18N
12.126 - jScrollPane2.setViewportView(pattern);
12.127 -
12.128 - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
12.129 - this.setLayout(layout);
12.130 - layout.setHorizontalGroup(
12.131 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
12.132 - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
12.133 - .addContainerGap()
12.134 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
12.135 - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
12.136 - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
12.137 - .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
12.138 - .addContainerGap())
12.139 - );
12.140 - layout.setVerticalGroup(
12.141 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
12.142 - .addGroup(layout.createSequentialGroup()
12.143 - .addContainerGap()
12.144 - .addComponent(jLabel1)
12.145 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
12.146 - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
12.147 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
12.148 - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
12.149 - .addContainerGap())
12.150 - );
12.151 - }// </editor-fold>//GEN-END:initComponents
12.152 -
12.153 - private void listMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMouseClicked
12.154 - if (evt.getClickCount() > 1) {
12.155 - desc.setValue(DialogDescriptor.OK_OPTION);
12.156 - dialog.setVisible(false);
12.157 - }
12.158 - }//GEN-LAST:event_listMouseClicked
12.159 -
12.160 - private void listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listValueChanged
12.161 - T ex = dataClass.cast(list.getSelectedValue());
12.162 -
12.163 - pattern.setText(convertor.getCode(ex));
12.164 -
12.165 - try {
12.166 - Rectangle rect = pattern.modelToView(0);
12.167 -
12.168 - if (rect != null) {
12.169 - pattern.scrollRectToVisible(rect);
12.170 - }
12.171 - } catch (BadLocationException ex1) {
12.172 - Exceptions.printStackTrace(ex1);
12.173 - }
12.174 - }//GEN-LAST:event_listValueChanged
12.175 -
12.176 - // Variables declaration - do not modify//GEN-BEGIN:variables
12.177 - private javax.swing.JLabel jLabel1;
12.178 - private javax.swing.JScrollPane jScrollPane1;
12.179 - private javax.swing.JScrollPane jScrollPane2;
12.180 - private javax.swing.JList list;
12.181 - private javax.swing.JEditorPane pattern;
12.182 - // End of variables declaration//GEN-END:variables
12.183 -
12.184 - private DialogDescriptor desc;
12.185 - private Dialog dialog;
12.186 -
12.187 - public void setDialog(DialogDescriptor desc, Dialog dialog) {
12.188 - this.desc = desc;
12.189 - this.dialog = dialog;
12.190 - }
12.191 -
12.192 - public T getSelectedExample() {
12.193 - return dataClass.cast(list.getSelectedValue());
12.194 - }
12.195 -
12.196 - private class ExamplesRenderer extends DefaultListCellRenderer {
12.197 - @Override
12.198 - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
12.199 - value = convertor.getDisplayName(dataClass.cast(value));
12.200 - return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
12.201 - }
12.202 - }
12.203 -
12.204 - public static <T> T chooseExample(Iterable<? extends T> examplesList, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
12.205 - ExamplesList<T> examples = new ExamplesList<T>(examplesList, convertor, dataClass, require, forbidden);
12.206 - DialogDescriptor dd = new DialogDescriptor(examples, convertor.getCaption(), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);
12.207 - Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
12.208 -
12.209 - examples.setDialog(dd, dialog);
12.210 - dialog.setVisible(true);
12.211 -
12.212 - if (dd.getValue() == DialogDescriptor.OK_OPTION) {
12.213 - return examples.getSelectedExample();
12.214 - }
12.215 -
12.216 - return null;
12.217 - }
12.218 -
12.219 - public interface DialogDescription<T> {
12.220 - public String getCaption();
12.221 - public String getHeader();
12.222 - public String getDisplayName(T t);
12.223 - public String getCode(T t);
12.224 - public Set<Option> getOptions(T t);
12.225 - }
12.226 -}
13.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamples.java Sat Feb 18 22:14:42 2012 +0100
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,135 +0,0 @@
13.4 -/*
13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 - *
13.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
13.8 - *
13.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
13.10 - * Other names may be trademarks of their respective owners.
13.11 - *
13.12 - * The contents of this file are subject to the terms of either the GNU
13.13 - * General Public License Version 2 only ("GPL") or the Common
13.14 - * Development and Distribution License("CDDL") (collectively, the
13.15 - * "License"). You may not use this file except in compliance with the
13.16 - * License. You can obtain a copy of the License at
13.17 - * http://www.netbeans.org/cddl-gplv2.html
13.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.19 - * specific language governing permissions and limitations under the
13.20 - * License. When distributing the software, include this License Header
13.21 - * Notice in each file and include the License file at
13.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
13.23 - * particular file as subject to the "Classpath" exception as provided
13.24 - * by Oracle in the GPL Version 2 section of the License file that
13.25 - * accompanied this code. If applicable, add the following below the
13.26 - * License Header, with the fields enclosed by brackets [] replaced by
13.27 - * your own identifying information:
13.28 - * "Portions Copyrighted [year] [name of copyright owner]"
13.29 - *
13.30 - * If you wish your version of this file to be governed by only the CDDL
13.31 - * or only the GPL Version 2, indicate your decision by adding
13.32 - * "[Contributor] elects to include this software in this distribution
13.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.34 - * single choice of license, a recipient has the option to distribute
13.35 - * your version of this file under either the CDDL, the GPL Version 2 or
13.36 - * to extend the choice of license to its licensees as provided above.
13.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
13.38 - * Version 2 license, then the option applies only if the new code is
13.39 - * made subject to such option by the copyright holder.
13.40 - *
13.41 - * Contributor(s):
13.42 - *
13.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
13.44 - */
13.45 -
13.46 -package org.netbeans.modules.jackpot30.impl.examples;
13.47 -
13.48 -import java.io.File;
13.49 -import java.io.IOException;
13.50 -import java.io.InputStream;
13.51 -import java.util.Collections;
13.52 -import java.util.EnumSet;
13.53 -import java.util.LinkedList;
13.54 -import java.util.List;
13.55 -import java.util.Set;
13.56 -import java.util.regex.Pattern;
13.57 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
13.58 -import org.openide.filesystems.FileUtil;
13.59 -import org.openide.modules.InstalledFileLocator;
13.60 -import org.openide.util.Exceptions;
13.61 -
13.62 -/**
13.63 - *
13.64 - * @author lahvac
13.65 - */
13.66 -public class LoadExamples {
13.67 -
13.68 - public static Iterable<? extends Example> loadExamples() {
13.69 - return loadExamples("examples.list");
13.70 - }
13.71 -
13.72 - private static final Pattern EXAMPLE_SPLIT = Pattern.compile("^%%", Pattern.MULTILINE);
13.73 -
13.74 - static Iterable<? extends Example> loadExamples(String examplesListName) {
13.75 - String examplesList = loadToString(examplesListName);
13.76 -
13.77 - if (examplesList == null) return Collections.emptyList();
13.78 -
13.79 - List<Example> examples = new LinkedList<Example>();
13.80 -
13.81 - for (String exampleName : examplesList.split("\n")) {
13.82 - if (exampleName.isEmpty()) continue;
13.83 -
13.84 - String exampleCode = loadToString(exampleName);
13.85 -
13.86 - for (String oneExample : EXAMPLE_SPLIT.split(exampleCode)) {
13.87 - if (oneExample.isEmpty()) continue;
13.88 -
13.89 - String[] parts = oneExample.split("\n", 2);
13.90 - String key = null;
13.91 - Set<Option> options = EnumSet.noneOf(Option.class);
13.92 -
13.93 - for (String option : parts[0].split(",")) {
13.94 - if (option.startsWith("example=")) {
13.95 - key = option.substring("example=".length());
13.96 - continue;
13.97 - }
13.98 -
13.99 - options.add(Option.valueOf(option.toUpperCase()));
13.100 - }
13.101 -
13.102 - examples.add(new Example(key, parts[1], options));
13.103 - }
13.104 - }
13.105 -
13.106 - return examples;
13.107 - }
13.108 -
13.109 - private static String loadToString(String name) {
13.110 - InputStream examplesList = null;
13.111 -
13.112 - try {
13.113 - examplesList = LoadExamples.class.getResourceAsStream(name);
13.114 -
13.115 - if (examplesList == null) return null;
13.116 -
13.117 - StringBuilder result = new StringBuilder();
13.118 - int read;
13.119 -
13.120 - while ((read = examplesList.read()) != (-1)) {
13.121 - result.append((char) read);
13.122 - }
13.123 -
13.124 - return result.toString();
13.125 - } catch (IOException ex) {
13.126 - Exceptions.printStackTrace(ex);
13.127 - return null;
13.128 - } finally {
13.129 - if (examplesList != null) {
13.130 - try {
13.131 - examplesList.close();
13.132 - } catch (IOException ex) {
13.133 - Exceptions.printStackTrace(ex);
13.134 - }
13.135 - }
13.136 - }
13.137 - }
13.138 -}
14.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/double-checked-locking.example Sat Feb 18 22:14:42 2012 +0100
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,33 +0,0 @@
14.4 -%%example=double-checked-locking
14.5 -if ($var == null) {
14.6 - $preinit$;
14.7 - synchronized ($lock) {
14.8 - if ($var == null) {
14.9 - $s2$;
14.10 - }
14.11 - }
14.12 -}
14.13 -%%example=double-checked-locking-verify,verify
14.14 -if ($var == null) {
14.15 - $preinit$;
14.16 - synchronized ($lock) {
14.17 - if ($var == null) {
14.18 - $s2$;
14.19 - }
14.20 - }
14.21 -} :: !hasModifier($var, Modifier.VOLATILE);;
14.22 -%%example=double-checked-locking-fix,verify,fix
14.23 -if ($var == null) {
14.24 - $preinit$;
14.25 - synchronized ($lock) {
14.26 - if ($var == null) {
14.27 - $s2$;
14.28 - }
14.29 - }
14.30 -} :: !hasModifier($var, Modifier.VOLATILE)
14.31 -=>
14.32 -synchronized ($lock) {
14.33 - if ($var == null) {
14.34 - $s2$;
14.35 - }
14.36 -};;
15.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/examples.list Sat Feb 18 22:14:42 2012 +0100
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,3 +0,0 @@
15.4 -double-checked-locking.example
15.5 -new-string.example
15.6 -lambda-candidate.example
16.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/lambda-candidate.example Sat Feb 18 22:14:42 2012 +0100
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,6 +0,0 @@
16.4 -%%example=lambda-candidate
16.5 -new $type() {
16.6 - $mods$ $resultType $methodName($args$) {
16.7 - $statements$;
16.8 - }
16.9 -}
17.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/examples/new-string.example Sat Feb 18 22:14:42 2012 +0100
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,5 +0,0 @@
17.4 -%%example=new-string,verify
17.5 -new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)");;
17.6 -%%example=new-string,verify,fix
17.7 -new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)")
17.8 -=> $orig;;
18.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicates.java Sat Feb 18 22:14:42 2012 +0100
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,379 +0,0 @@
18.4 -/*
18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 - *
18.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
18.8 - *
18.9 - * The contents of this file are subject to the terms of either the GNU
18.10 - * General Public License Version 2 only ("GPL") or the Common
18.11 - * Development and Distribution License("CDDL") (collectively, the
18.12 - * "License"). You may not use this file except in compliance with the
18.13 - * License. You can obtain a copy of the License at
18.14 - * http://www.netbeans.org/cddl-gplv2.html
18.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.16 - * specific language governing permissions and limitations under the
18.17 - * License. When distributing the software, include this License Header
18.18 - * Notice in each file and include the License file at
18.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18.20 - * particular file as subject to the "Classpath" exception as provided
18.21 - * by Sun in the GPL Version 2 section of the License file that
18.22 - * accompanied this code. If applicable, add the following below the
18.23 - * License Header, with the fields enclosed by brackets [] replaced by
18.24 - * your own identifying information:
18.25 - * "Portions Copyrighted [year] [name of copyright owner]"
18.26 - *
18.27 - * If you wish your version of this file to be governed by only the CDDL
18.28 - * or only the GPL Version 2, indicate your decision by adding
18.29 - * "[Contributor] elects to include this software in this distribution
18.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
18.31 - * single choice of license, a recipient has the option to distribute
18.32 - * your version of this file under either the CDDL, the GPL Version 2 or
18.33 - * to extend the choice of license to its licensees as provided above.
18.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
18.35 - * Version 2 license, then the option applies only if the new code is
18.36 - * made subject to such option by the copyright holder.
18.37 - *
18.38 - * Contributor(s):
18.39 - *
18.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
18.41 - */
18.42 -
18.43 -package org.netbeans.modules.jackpot30.impl.hints;
18.44 -
18.45 -import com.sun.source.tree.BlockTree;
18.46 -import com.sun.source.tree.ExpressionTree;
18.47 -import com.sun.source.tree.NewClassTree;
18.48 -import com.sun.source.tree.StatementTree;
18.49 -import com.sun.source.tree.Tree;
18.50 -import com.sun.source.tree.Tree.Kind;
18.51 -import com.sun.source.tree.VariableTree;
18.52 -import com.sun.source.util.TreePath;
18.53 -import java.util.Collection;
18.54 -import java.util.Collections;
18.55 -import java.util.EnumSet;
18.56 -import java.util.Set;
18.57 -import javax.lang.model.type.ErrorType;
18.58 -import javax.lang.model.type.TypeKind;
18.59 -import javax.lang.model.type.TypeMirror;
18.60 -import javax.swing.SwingUtilities;
18.61 -import org.netbeans.api.java.lexer.JavaTokenId;
18.62 -import org.netbeans.api.java.source.CancellableTask;
18.63 -import org.netbeans.api.java.source.CompilationController;
18.64 -import org.netbeans.api.java.source.CompilationInfo;
18.65 -import org.netbeans.api.java.source.JavaSource;
18.66 -import org.netbeans.api.java.source.JavaSource.Phase;
18.67 -import org.netbeans.api.java.source.JavaSource.Priority;
18.68 -import org.netbeans.api.java.source.JavaSourceTaskFactory;
18.69 -import org.netbeans.api.java.source.Task;
18.70 -import org.netbeans.api.java.source.TreePathHandle;
18.71 -import org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory;
18.72 -import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
18.73 -import org.netbeans.api.lexer.TokenSequence;
18.74 -import org.netbeans.modules.jackpot30.impl.refactoring.FindDuplicatesRefactoringUI;
18.75 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
18.76 -import org.netbeans.modules.java.hints.jackpot.impl.batch.Scopes;
18.77 -import org.netbeans.modules.refactoring.spi.ui.UI;
18.78 -import org.netbeans.spi.editor.hints.ChangeInfo;
18.79 -import org.netbeans.spi.editor.hints.ErrorDescription;
18.80 -import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
18.81 -import org.netbeans.spi.editor.hints.Fix;
18.82 -import org.netbeans.spi.editor.hints.HintsController;
18.83 -import org.netbeans.spi.editor.hints.Severity;
18.84 -import org.openide.filesystems.FileObject;
18.85 -import org.openide.util.lookup.ServiceProvider;
18.86 -
18.87 -/**
18.88 - *
18.89 - * @author lahvac
18.90 - */
18.91 -public class ExplicitFindDuplicates implements CancellableTask<CompilationInfo> {
18.92 -
18.93 - public void run(CompilationInfo info) throws Exception {
18.94 - Collection<? extends ErrorDescription> eds = computeErrorDescription(info);
18.95 -
18.96 - if (eds == null) {
18.97 - eds = Collections.emptyList();
18.98 - }
18.99 -
18.100 - HintsController.setErrors(info.getFileObject(), ExplicitFindDuplicates.class.getName(), eds);
18.101 - }
18.102 -
18.103 - private Collection<? extends ErrorDescription> computeErrorDescription(CompilationInfo info) throws Exception {
18.104 - int[] span = SelectionAwareJavaSourceTaskFactory.getLastSelection(info.getFileObject());
18.105 -
18.106 - if (span == null) {
18.107 - return null;
18.108 - }
18.109 -
18.110 - TreePath selection = selectionForExpressionHack(info, span[0], span[1]);
18.111 -
18.112 - if (selection == null) {
18.113 - if (selectionForStatementsHack(info, span[0], span[1], new int[2]) == null) {
18.114 - return null;
18.115 - }
18.116 - }
18.117 -
18.118 - Fix f = new FixImpl(info.getFileObject(), span[0], span[1]);
18.119 - int caret = CaretAwareJavaSourceTaskFactory.getLastPosition(info.getFileObject());
18.120 - ErrorDescription ed = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, "Look for Duplicates", Collections.singletonList(f), info.getFileObject(), caret, caret);
18.121 -
18.122 - return Collections.singletonList(ed);
18.123 - }
18.124 -
18.125 - public void cancel() {
18.126 - //XXX
18.127 - }
18.128 -
18.129 - static Tree resolveAndGeneralizePattern(CompilationInfo info, int start, int end) {
18.130 - TreePath selection = selectionForExpressionHack(info, start, end);
18.131 -
18.132 - if (selection == null) {
18.133 - int[] statementSpan = new int[2];
18.134 - TreePathHandle statementSelection = selectionForStatementsHack(info, start, end, statementSpan);
18.135 -
18.136 - if (statementSelection == null) {
18.137 - return null;
18.138 - }
18.139 -
18.140 - selection = statementSelection.resolve(info);
18.141 -
18.142 - if (selection == null) {
18.143 - return null; //XXX
18.144 - }
18.145 -
18.146 - return Utilities.generalizePattern(info, selection, statementSpan[0], statementSpan[1]);
18.147 - } else {
18.148 - return Utilities.generalizePattern(info, selection);
18.149 - }
18.150 - }
18.151 -
18.152 - private static final class FixImpl implements Fix {
18.153 -
18.154 - private final FileObject file;
18.155 - private final int start;
18.156 - private final int end;
18.157 -
18.158 - public FixImpl(FileObject file, int start, int end) {
18.159 - this.file = file;
18.160 - this.start = start;
18.161 - this.end = end;
18.162 - }
18.163 -
18.164 - public String getText() {
18.165 - return "Look for Duplicates in Opened Projects";
18.166 - }
18.167 -
18.168 - public ChangeInfo implement() throws Exception {
18.169 - JavaSource.forFileObject(file).runUserActionTask(new Task<CompilationController>() {
18.170 - public void run(CompilationController cc) throws Exception {
18.171 - cc.toPhase(Phase.RESOLVED);
18.172 -
18.173 - Tree generalized = resolveAndGeneralizePattern(cc, start, end);
18.174 -
18.175 - if (generalized == null) {
18.176 - return ;
18.177 - }
18.178 -
18.179 - final String pattern = generalized.toString(); //XXX
18.180 -
18.181 - SwingUtilities.invokeLater(new Runnable() {
18.182 - public void run() {
18.183 - UI.openRefactoringUI(new FindDuplicatesRefactoringUI(pattern, Scopes.allOpenedProjectsScope()));
18.184 - }
18.185 - });
18.186 - }
18.187 - }, true);
18.188 -
18.189 - return null;
18.190 - }
18.191 -
18.192 - }
18.193 -
18.194 - private static final Set<TypeKind> NOT_ACCEPTED_TYPES = EnumSet.of(TypeKind.NONE, TypeKind.OTHER);
18.195 -
18.196 - static TreePath selectionForExpressionHack(CompilationInfo info, int start, int end) {
18.197 - return validateSelection(info, start, end, NOT_ACCEPTED_TYPES);
18.198 - }
18.199 -
18.200 - static TreePathHandle selectionForStatementsHack(CompilationInfo info, int start, int end, int[] outSpan) {
18.201 - return validateSelectionForIntroduceMethod(info, start, end, outSpan);
18.202 - }
18.203 -
18.204 - private static final Set<JavaTokenId> WHITESPACES = EnumSet.of(JavaTokenId.WHITESPACE, JavaTokenId.BLOCK_COMMENT, JavaTokenId.LINE_COMMENT, JavaTokenId.JAVADOC_COMMENT);
18.205 - static int[] ignoreWhitespaces(CompilationInfo ci, int start, int end) {
18.206 - TokenSequence<JavaTokenId> ts = ci.getTokenHierarchy().tokenSequence(JavaTokenId.language());
18.207 -
18.208 - if (ts == null) {
18.209 - return new int[] {start, end};
18.210 - }
18.211 -
18.212 - ts.move(start);
18.213 -
18.214 - if (ts.moveNext()) {
18.215 - boolean wasMoveNext = true;
18.216 -
18.217 - while (WHITESPACES.contains(ts.token().id()) && (wasMoveNext = ts.moveNext()))
18.218 - ;
18.219 -
18.220 - if (wasMoveNext && ts.offset() > start)
18.221 - start = ts.offset();
18.222 - }
18.223 -
18.224 - ts.move(end);
18.225 -
18.226 - while (ts.movePrevious() && WHITESPACES.contains(ts.token().id()) && ts.offset() < end)
18.227 - end = ts.offset();
18.228 -
18.229 - return new int[] {start, end};
18.230 - }
18.231 -
18.232 - private static boolean isInsideClass(TreePath tp) {
18.233 - while (tp != null) {
18.234 - if (tp.getLeaf().getKind() == Kind.CLASS)
18.235 - return true;
18.236 -
18.237 - tp = tp.getParentPath();
18.238 - }
18.239 -
18.240 - return false;
18.241 - }
18.242 -
18.243 - private static TreePath validateSelection(CompilationInfo ci, int start, int end, Set<TypeKind> ignoredTypes) {
18.244 - TreePath tp = ci.getTreeUtilities().pathFor((start + end) / 2 + 1);
18.245 -
18.246 - for ( ; tp != null; tp = tp.getParentPath()) {
18.247 - Tree leaf = tp.getLeaf();
18.248 -
18.249 - if (!ExpressionTree.class.isAssignableFrom(leaf.getKind().asInterface()))
18.250 - continue;
18.251 -
18.252 - long treeStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), leaf);
18.253 - long treeEnd = ci.getTrees().getSourcePositions().getEndPosition(ci.getCompilationUnit(), leaf);
18.254 -
18.255 - if (treeStart != start || treeEnd != end) {
18.256 - continue;
18.257 - }
18.258 -
18.259 - TypeMirror type = ci.getTrees().getTypeMirror(tp);
18.260 -
18.261 - if (type != null && type.getKind() == TypeKind.ERROR) {
18.262 - type = ci.getTrees().getOriginalType((ErrorType) type);
18.263 - }
18.264 -
18.265 - if (type == null || ignoredTypes.contains(type.getKind()))
18.266 - continue;
18.267 -
18.268 - if(tp.getLeaf().getKind() == Kind.ASSIGNMENT)
18.269 - continue;
18.270 -
18.271 - if (tp.getLeaf().getKind() == Kind.ANNOTATION)
18.272 - continue;
18.273 -
18.274 - if (!isInsideClass(tp))
18.275 - return null;
18.276 -
18.277 - TreePath candidate = tp;
18.278 -
18.279 - tp = tp.getParentPath();
18.280 -
18.281 - while (tp != null) {
18.282 - switch (tp.getLeaf().getKind()) {
18.283 - case VARIABLE:
18.284 - VariableTree vt = (VariableTree) tp.getLeaf();
18.285 - if (vt.getInitializer() == leaf) {
18.286 - return candidate;
18.287 - } else {
18.288 - return null;
18.289 - }
18.290 - case NEW_CLASS:
18.291 - NewClassTree nct = (NewClassTree) tp.getLeaf();
18.292 -
18.293 - if (nct.getIdentifier().equals(candidate.getLeaf())) { //avoid disabling hint ie inside of anonymous class higher in treepath
18.294 - for (Tree p : nct.getArguments()) {
18.295 - if (p == leaf) {
18.296 - return candidate;
18.297 - }
18.298 - }
18.299 -
18.300 - return null;
18.301 - }
18.302 - }
18.303 -
18.304 - leaf = tp.getLeaf();
18.305 - tp = tp.getParentPath();
18.306 - }
18.307 -
18.308 - return candidate;
18.309 - }
18.310 -
18.311 - return null;
18.312 - }
18.313 -
18.314 - private static TreePathHandle validateSelectionForIntroduceMethod(CompilationInfo ci, int start, int end, int[] statementsSpan) {
18.315 - int[] span = ignoreWhitespaces(ci, Math.min(start, end), Math.max(start, end));
18.316 -
18.317 - start = span[0];
18.318 - end = span[1];
18.319 -
18.320 - if (start >= end)
18.321 - return null;
18.322 -
18.323 - TreePath tpStart = ci.getTreeUtilities().pathFor(start);
18.324 - TreePath tpEnd = ci.getTreeUtilities().pathFor(end);
18.325 -
18.326 - if (tpStart.getLeaf() != tpEnd.getLeaf() || tpStart.getLeaf().getKind() != Kind.BLOCK) {
18.327 - //??? not in the same block:
18.328 - return null;
18.329 - }
18.330 -
18.331 - int from = -1;
18.332 - int to = -1;
18.333 -
18.334 - BlockTree block = (BlockTree) tpStart.getLeaf();
18.335 - int index = 0;
18.336 -
18.337 - for (StatementTree s : block.getStatements()) {
18.338 - long sStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), s);
18.339 -
18.340 - if (sStart == start) {
18.341 - from = index;
18.342 - }
18.343 -
18.344 - if (end < sStart && to == (-1)) {
18.345 - to = index - 1;
18.346 - }
18.347 -
18.348 - index++;
18.349 - }
18.350 -
18.351 - if (from == (-1)) {
18.352 - return null;
18.353 - }
18.354 -
18.355 - if (to == (-1))
18.356 - to = block.getStatements().size() - 1;
18.357 -
18.358 - if (to < from) {
18.359 - return null;
18.360 - }
18.361 -
18.362 - statementsSpan[0] = from;
18.363 - statementsSpan[1] = to;
18.364 -
18.365 - return TreePathHandle.create(tpStart, ci);
18.366 - }
18.367 -
18.368 - @ServiceProvider(service=JavaSourceTaskFactory.class)
18.369 - public static final class FactoryImpl extends SelectionAwareJavaSourceTaskFactory {
18.370 -
18.371 - public FactoryImpl() {
18.372 - super(Phase.RESOLVED, Priority.LOW);
18.373 - }
18.374 -
18.375 - @Override
18.376 - protected CancellableTask<CompilationInfo> createTask(FileObject file) {
18.377 - return new ExplicitFindDuplicates();
18.378 - }
18.379 -
18.380 - }
18.381 -
18.382 -}
19.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/resources/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,40 +0,0 @@
19.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
19.5 -#
19.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
19.7 -#
19.8 -# The contents of this file are subject to the terms of either the GNU
19.9 -# General Public License Version 2 only ("GPL") or the Common
19.10 -# Development and Distribution License("CDDL") (collectively, the
19.11 -# "License"). You may not use this file except in compliance with the
19.12 -# License. You can obtain a copy of the License at
19.13 -# http://www.netbeans.org/cddl-gplv2.html
19.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19.15 -# specific language governing permissions and limitations under the
19.16 -# License. When distributing the software, include this License Header
19.17 -# Notice in each file and include the License file at
19.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19.19 -# particular file as subject to the "Classpath" exception as provided
19.20 -# by Sun in the GPL Version 2 section of the License file that
19.21 -# accompanied this code. If applicable, add the following below the
19.22 -# License Header, with the fields enclosed by brackets [] replaced by
19.23 -# your own identifying information:
19.24 -# "Portions Copyrighted [year] [name of copyright owner]"
19.25 -#
19.26 -# If you wish your version of this file to be governed by only the CDDL
19.27 -# or only the GPL Version 2, indicate your decision by adding
19.28 -# "[Contributor] elects to include this software in this distribution
19.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
19.30 -# single choice of license, a recipient has the option to distribute
19.31 -# your version of this file under either the CDDL, the GPL Version 2 or
19.32 -# to extend the choice of license to its licensees as provided above.
19.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
19.34 -# Version 2 license, then the option applies only if the new code is
19.35 -# made subject to such option by the copyright holder.
19.36 -#
19.37 -# Contributor(s):
19.38 -#
19.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
19.40 -
19.41 -Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance=Apply Pattern
19.42 -Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance=Find Pattern Occurrences
19.43 -OpenIDE-Module-Name=Jackpot 3.0 API
20.1 Binary file api/src/org/netbeans/modules/jackpot30/impl/resources/examples_icon.png has changed
21.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/resources/layer.xml Sat Feb 18 22:14:42 2012 +0100
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,68 +0,0 @@
21.4 -<?xml version="1.0" encoding="UTF-8"?>
21.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
21.6 -<filesystem>
21.7 - <folder name="Actions">
21.8 - <folder name="Refactoring">
21.9 - <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance">
21.10 - <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.duplicates.GlobalFindDuplicates"/>
21.11 - <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.duplicates.Bundle#CTL_GlobalFindDuplicates"/>
21.12 - <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
21.13 - <attr name="noIconInMenu" boolvalue="false"/>
21.14 - </file>
21.15 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance">
21.16 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
21.17 - <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.ApplyPatternAction"/>
21.18 - <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_ApplyPatternAction"/>
21.19 - <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
21.20 - <attr name="noIconInMenu" boolvalue="false"/>
21.21 - </file>
21.22 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance">
21.23 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
21.24 - <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.FindOccurrencesAction"/>
21.25 - <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_FindOccurrencesAction"/>
21.26 - <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
21.27 - <attr name="noIconInMenu" boolvalue="false"/>
21.28 - </file>
21.29 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance">
21.30 - <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.UpgradeAction"/>
21.31 - <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.Bundle#CTL_UpgradeAction"/>
21.32 - <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
21.33 - <attr name="noIconInMenu" boolvalue="false"/>
21.34 - </file>
21.35 - </folder>
21.36 - </folder>
21.37 -
21.38 - <!--XXX:-->
21.39 - <folder name="Menu">
21.40 - <folder name="Edit">
21.41 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.shadow">
21.42 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance"/>
21.43 - <attr name="position" intvalue="2250"/>
21.44 - </file>
21.45 - </folder>
21.46 - <folder name="Refactoring">
21.47 - <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.shadow">
21.48 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance"/>
21.49 - <attr name="position" intvalue="2300"/>
21.50 - </file>
21.51 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.shadow">
21.52 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance"/>
21.53 - <attr name="position" intvalue="2200"/>
21.54 - </file>
21.55 - <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.shadow">
21.56 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance"/>
21.57 - <attr name="position" intvalue="2187"/>
21.58 - </file>
21.59 - </folder>
21.60 - </folder>
21.61 -
21.62 - <folder name="Editors">
21.63 - <folder name="text">
21.64 - <folder name="x-java">
21.65 - <file name="org-netbeans-modules-jackpot30-impl-hints-HintsInvoker$FactoryImpl.instance"/>
21.66 - <file name="org-netbeans-modules-jackpot30-impl-indexing-CustomIndexerImpl$CustomIndexerFactoryImpl.instance"/>
21.67 - <file name="org-netbeans-modules-jackpot30-impl-duplicates-indexing-DuplicatesCustomIndexerImpl$FactoryImpl.instance"/>
21.68 - </folder>
21.69 - </folder>
21.70 - </folder>
21.71 -</filesystem>
22.1 Binary file api/src/org/netbeans/modules/jackpot30/impl/resources/recent_icon.png has changed
23.1 --- a/api/src/org/netbeans/modules/jackpot30/spi/Hacks.java Sat Feb 18 22:14:42 2012 +0100
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,89 +0,0 @@
23.4 -/*
23.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
23.6 - *
23.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23.8 - *
23.9 - * The contents of this file are subject to the terms of either the GNU
23.10 - * General Public License Version 2 only ("GPL") or the Common
23.11 - * Development and Distribution License("CDDL") (collectively, the
23.12 - * "License"). You may not use this file except in compliance with the
23.13 - * License. You can obtain a copy of the License at
23.14 - * http://www.netbeans.org/cddl-gplv2.html
23.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
23.16 - * specific language governing permissions and limitations under the
23.17 - * License. When distributing the software, include this License Header
23.18 - * Notice in each file and include the License file at
23.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
23.20 - * particular file as subject to the "Classpath" exception as provided
23.21 - * by Sun in the GPL Version 2 section of the License file that
23.22 - * accompanied this code. If applicable, add the following below the
23.23 - * License Header, with the fields enclosed by brackets [] replaced by
23.24 - * your own identifying information:
23.25 - * "Portions Copyrighted [year] [name of copyright owner]"
23.26 - *
23.27 - * If you wish your version of this file to be governed by only the CDDL
23.28 - * or only the GPL Version 2, indicate your decision by adding
23.29 - * "[Contributor] elects to include this software in this distribution
23.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
23.31 - * single choice of license, a recipient has the option to distribute
23.32 - * your version of this file under either the CDDL, the GPL Version 2 or
23.33 - * to extend the choice of license to its licensees as provided above.
23.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
23.35 - * Version 2 license, then the option applies only if the new code is
23.36 - * made subject to such option by the copyright holder.
23.37 - *
23.38 - * Contributor(s):
23.39 - *
23.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
23.41 - */
23.42 -
23.43 -package org.netbeans.modules.jackpot30.spi;
23.44 -
23.45 -import com.sun.source.util.TreePath;
23.46 -import java.util.ArrayList;
23.47 -import java.util.Collections;
23.48 -import java.util.LinkedList;
23.49 -import java.util.List;
23.50 -import java.util.Set;
23.51 -import java.util.concurrent.atomic.AtomicBoolean;
23.52 -import java.util.prefs.Preferences;
23.53 -import org.netbeans.api.java.source.WorkingCopy;
23.54 -import org.netbeans.api.project.Project;
23.55 -import org.netbeans.modules.java.hints.jackpot.impl.MessageImpl;
23.56 -import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchUtilities;
23.57 -import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
23.58 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
23.59 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
23.60 -import org.netbeans.spi.editor.hints.ErrorDescription;
23.61 -import org.openide.util.Exceptions;
23.62 -
23.63 -/**
23.64 - *
23.65 - * @author lahvac
23.66 - */
23.67 -public class Hacks {
23.68 -
23.69 - public static interface HintPreferencesProvider {
23.70 - public Preferences findPreferences(HintMetadata hm);
23.71 - }
23.72 -
23.73 - public static void findHintsAndApplyFixes(WorkingCopy copy, Iterable<? extends HintDescription> hints, TreePath on, AtomicBoolean cancel) {
23.74 - HintsInvoker inv = new HintsInvoker(copy, cancel);
23.75 - List<ErrorDescription> errs = new ArrayList<ErrorDescription>(inv.computeHints(copy, hints));
23.76 - List<MessageImpl> problems = new LinkedList<MessageImpl>();
23.77 -
23.78 - try {
23.79 - if (BatchUtilities.applyFixes(copy, Collections.<Project, Set<String>>emptyMap(), errs, problems)) {
23.80 - throw new IllegalStateException();
23.81 - }
23.82 - } catch (IllegalStateException ex) {
23.83 - Exceptions.printStackTrace(ex);
23.84 - } catch (Exception ex) {
23.85 - Exceptions.printStackTrace(ex);
23.86 - }
23.87 -
23.88 - if (!problems.isEmpty()) {
23.89 - throw new IllegalStateException(problems.get(0).text);
23.90 - }
23.91 - }
23.92 -}
24.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/TestBase.java Sat Feb 18 22:14:42 2012 +0100
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,120 +0,0 @@
24.4 -/*
24.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
24.6 - *
24.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
24.8 - *
24.9 - * The contents of this file are subject to the terms of either the GNU
24.10 - * General Public License Version 2 only ("GPL") or the Common
24.11 - * Development and Distribution License("CDDL") (collectively, the
24.12 - * "License"). You may not use this file except in compliance with the
24.13 - * License. You can obtain a copy of the License at
24.14 - * http://www.netbeans.org/cddl-gplv2.html
24.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
24.16 - * specific language governing permissions and limitations under the
24.17 - * License. When distributing the software, include this License Header
24.18 - * Notice in each file and include the License file at
24.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
24.20 - * particular file as subject to the "Classpath" exception as provided
24.21 - * by Sun in the GPL Version 2 section of the License file that
24.22 - * accompanied this code. If applicable, add the following below the
24.23 - * License Header, with the fields enclosed by brackets [] replaced by
24.24 - * your own identifying information:
24.25 - * "Portions Copyrighted [year] [name of copyright owner]"
24.26 - *
24.27 - * If you wish your version of this file to be governed by only the CDDL
24.28 - * or only the GPL Version 2, indicate your decision by adding
24.29 - * "[Contributor] elects to include this software in this distribution
24.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
24.31 - * single choice of license, a recipient has the option to distribute
24.32 - * your version of this file under either the CDDL, the GPL Version 2 or
24.33 - * to extend the choice of license to its licensees as provided above.
24.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
24.35 - * Version 2 license, then the option applies only if the new code is
24.36 - * made subject to such option by the copyright holder.
24.37 - *
24.38 - * Contributor(s):
24.39 - *
24.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
24.41 - */
24.42 -
24.43 -package org.netbeans.modules.jackpot30.impl;
24.44 -
24.45 -import java.io.File;
24.46 -import javax.swing.text.Document;
24.47 -import org.netbeans.api.java.lexer.JavaTokenId;
24.48 -import org.netbeans.api.java.source.CompilationInfo;
24.49 -import org.netbeans.api.java.source.JavaSource;
24.50 -import org.netbeans.api.java.source.JavaSource.Phase;
24.51 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
24.52 -import org.netbeans.api.java.source.TestUtilities;
24.53 -import org.netbeans.api.lexer.Language;
24.54 -import org.netbeans.junit.NbTestCase;
24.55 -import org.netbeans.modules.java.source.TreeLoader;
24.56 -import org.openide.cookies.EditorCookie;
24.57 -import org.openide.filesystems.FileObject;
24.58 -import org.openide.filesystems.FileUtil;
24.59 -import org.openide.loaders.DataObject;
24.60 -
24.61 -/**
24.62 - *
24.63 - * @author Jan Lahoda
24.64 - */
24.65 -public class TestBase extends NbTestCase {
24.66 -
24.67 - public TestBase(String name) {
24.68 - super(name);
24.69 - }
24.70 -
24.71 - @Override
24.72 - protected void setUp() throws Exception {
24.73 - super.setUp();
24.74 - SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
24.75 - TreeLoader.DISABLE_CONFINEMENT_TEST = true;
24.76 - }
24.77 -
24.78 - protected void prepareTest(String fileName, String code) throws Exception {
24.79 - clearWorkDir();
24.80 -
24.81 - FileUtil.refreshFor(File.listRoots());
24.82 -
24.83 - FileObject workFO = FileUtil.toFileObject(getWorkDir());
24.84 -
24.85 - assertNotNull(workFO);
24.86 -
24.87 - workFO.refresh();
24.88 -
24.89 - sourceRoot = workFO.createFolder("src");
24.90 - FileObject buildRoot = workFO.createFolder("build");
24.91 - FileObject cache = workFO.createFolder("cache");
24.92 -
24.93 - FileObject data = FileUtil.createData(sourceRoot, fileName);
24.94 - File dataFile = FileUtil.toFile(data);
24.95 -
24.96 - assertNotNull(dataFile);
24.97 -
24.98 - TestUtilities.copyStringToFile(dataFile, code);
24.99 -
24.100 - SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
24.101 -
24.102 - DataObject od = DataObject.find(data);
24.103 - EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
24.104 -
24.105 - assertNotNull(ec);
24.106 -
24.107 - doc = ec.openDocument();
24.108 - doc.putProperty(Language.class, JavaTokenId.language());
24.109 -
24.110 - JavaSource js = JavaSource.forFileObject(data);
24.111 -
24.112 - assertNotNull(js);
24.113 -
24.114 - info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
24.115 -
24.116 - assertNotNull(info);
24.117 - }
24.118 -
24.119 - protected FileObject sourceRoot;
24.120 - protected CompilationInfo info;
24.121 - protected Document doc;
24.122 -
24.123 -}
25.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamplesTest.java Sat Feb 18 22:14:42 2012 +0100
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,71 +0,0 @@
25.4 -/*
25.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
25.6 - *
25.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
25.8 - *
25.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
25.10 - * Other names may be trademarks of their respective owners.
25.11 - *
25.12 - * The contents of this file are subject to the terms of either the GNU
25.13 - * General Public License Version 2 only ("GPL") or the Common
25.14 - * Development and Distribution License("CDDL") (collectively, the
25.15 - * "License"). You may not use this file except in compliance with the
25.16 - * License. You can obtain a copy of the License at
25.17 - * http://www.netbeans.org/cddl-gplv2.html
25.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
25.19 - * specific language governing permissions and limitations under the
25.20 - * License. When distributing the software, include this License Header
25.21 - * Notice in each file and include the License file at
25.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
25.23 - * particular file as subject to the "Classpath" exception as provided
25.24 - * by Oracle in the GPL Version 2 section of the License file that
25.25 - * accompanied this code. If applicable, add the following below the
25.26 - * License Header, with the fields enclosed by brackets [] replaced by
25.27 - * your own identifying information:
25.28 - * "Portions Copyrighted [year] [name of copyright owner]"
25.29 - *
25.30 - * If you wish your version of this file to be governed by only the CDDL
25.31 - * or only the GPL Version 2, indicate your decision by adding
25.32 - * "[Contributor] elects to include this software in this distribution
25.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
25.34 - * single choice of license, a recipient has the option to distribute
25.35 - * your version of this file under either the CDDL, the GPL Version 2 or
25.36 - * to extend the choice of license to its licensees as provided above.
25.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
25.38 - * Version 2 license, then the option applies only if the new code is
25.39 - * made subject to such option by the copyright holder.
25.40 - *
25.41 - * Contributor(s):
25.42 - *
25.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
25.44 - */
25.45 -
25.46 -package org.netbeans.modules.jackpot30.impl.examples;
25.47 -
25.48 -import java.util.Arrays;
25.49 -import java.util.LinkedList;
25.50 -import java.util.List;
25.51 -import org.netbeans.junit.NbTestCase;
25.52 -import static org.junit.Assert.*;
25.53 -
25.54 -/**
25.55 - *
25.56 - * @author lahvac
25.57 - */
25.58 -public class LoadExamplesTest extends NbTestCase {
25.59 -
25.60 - public LoadExamplesTest(String name) {
25.61 - super(name);
25.62 - }
25.63 -
25.64 - public void testLoadExamples() {
25.65 - List<String> actual = new LinkedList<String>();
25.66 -
25.67 - for (Example e : LoadExamples.loadExamples("test-examples.list")) {
25.68 - actual.add("" + e.getKey() + ":" + e.getOptions() + ":" + e.getCode());
25.69 - }
25.70 -
25.71 - assertEquals(Arrays.asList("key1:[]:EX1\n", "key2:[VERIFY, FIX]:EX2\n", "key3:[FIX]:EX3\n"), actual);
25.72 - }
25.73 -
25.74 -}
25.75 \ No newline at end of file
26.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-example1.example Sat Feb 18 22:14:42 2012 +0100
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,6 +0,0 @@
26.4 -%%example=key1
26.5 -EX1
26.6 -%%example=key2,verify,fix
26.7 -EX2
26.8 -%%example=key3,fix
26.9 -EX3
27.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-examples.list Sat Feb 18 22:14:42 2012 +0100
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,1 +0,0 @@
27.4 -test-example1.example
28.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicatesTest.java Sat Feb 18 22:14:42 2012 +0100
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,138 +0,0 @@
28.4 -/*
28.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
28.6 - *
28.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
28.8 - *
28.9 - * The contents of this file are subject to the terms of either the GNU
28.10 - * General Public License Version 2 only ("GPL") or the Common
28.11 - * Development and Distribution License("CDDL") (collectively, the
28.12 - * "License"). You may not use this file except in compliance with the
28.13 - * License. You can obtain a copy of the License at
28.14 - * http://www.netbeans.org/cddl-gplv2.html
28.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
28.16 - * specific language governing permissions and limitations under the
28.17 - * License. When distributing the software, include this License Header
28.18 - * Notice in each file and include the License file at
28.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
28.20 - * particular file as subject to the "Classpath" exception as provided
28.21 - * by Sun in the GPL Version 2 section of the License file that
28.22 - * accompanied this code. If applicable, add the following below the
28.23 - * License Header, with the fields enclosed by brackets [] replaced by
28.24 - * your own identifying information:
28.25 - * "Portions Copyrighted [year] [name of copyright owner]"
28.26 - *
28.27 - * If you wish your version of this file to be governed by only the CDDL
28.28 - * or only the GPL Version 2, indicate your decision by adding
28.29 - * "[Contributor] elects to include this software in this distribution
28.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
28.31 - * single choice of license, a recipient has the option to distribute
28.32 - * your version of this file under either the CDDL, the GPL Version 2 or
28.33 - * to extend the choice of license to its licensees as provided above.
28.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
28.35 - * Version 2 license, then the option applies only if the new code is
28.36 - * made subject to such option by the copyright holder.
28.37 - *
28.38 - * Contributor(s):
28.39 - *
28.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
28.41 - */
28.42 -
28.43 -package org.netbeans.modules.jackpot30.impl.hints;
28.44 -
28.45 -import com.sun.source.tree.Tree;
28.46 -import com.sun.tools.javac.tree.JCTree;
28.47 -import java.util.regex.Pattern;
28.48 -import org.netbeans.modules.jackpot30.impl.TestBase;
28.49 -import org.netbeans.modules.java.source.pretty.VeryPretty;
28.50 -import org.netbeans.modules.java.source.save.DiffContext;
28.51 -
28.52 -/**
28.53 - *
28.54 - * @author lahvac
28.55 - */
28.56 -public class ExplicitFindDuplicatesTest extends TestBase {
28.57 -
28.58 - public ExplicitFindDuplicatesTest(String name) {
28.59 - super(name);
28.60 - }
28.61 -
28.62 - public void testLocalVariablesGeneralization() throws Exception {
28.63 - performGeneralizationTest("package test;\n" +
28.64 - "public class Test {\n" +
28.65 - " private void test() {\n" +
28.66 - " |int i = 0;\n" +
28.67 - " i++;\n" +
28.68 - " int j = i;|\n" +
28.69 - " }\n" +
28.70 - "}\n" +
28.71 - "",
28.72 - "{\n" +
28.73 - " $s0$;\n" +
28.74 - " int $0 = 0;\n" +
28.75 - " $0++;\n" +
28.76 - " int $1 = $0;\n" +
28.77 - " $s1$;\n" +
28.78 - "}");
28.79 - }
28.80 -
28.81 - public void testSingleStatementPattern() throws Exception {
28.82 - performGeneralizationTest("package test;\n" +
28.83 - "public class Test {\n" +
28.84 - " private void test() {\n" +
28.85 - " int i = 0;\n" +
28.86 - " |i++;|\n" +
28.87 - " int j = i;\n" +
28.88 - " }\n" +
28.89 - "}\n" +
28.90 - "",
28.91 - "$0++;");
28.92 - }
28.93 -
28.94 - public void testExpressionPattern() throws Exception {
28.95 - performGeneralizationTest("package test;\n" +
28.96 - "public class Test {\n" +
28.97 - " private void test() {\n" +
28.98 - " int i = 0;\n" +
28.99 - " i++;\n" +
28.100 - " int j = |i|;\n" +
28.101 - " }\n" +
28.102 - "}\n" +
28.103 - "",
28.104 - "$0");
28.105 - }
28.106 -
28.107 - public void testVoidMethod() throws Exception {
28.108 - performGeneralizationTest("package test;\n" +
28.109 - "public class Test {\n" +
28.110 - " private void test() {\n" +
28.111 - " |System.err.println()|;\n" +
28.112 - " }\n" +
28.113 - "}\n" +
28.114 - "",
28.115 - "System.err.println()");
28.116 - }
28.117 -
28.118 - private void performGeneralizationTest(String code, String generalized) throws Exception {
28.119 - String[] split = code.split(Pattern.quote("|"));
28.120 -
28.121 - assertEquals(3, split.length);
28.122 -
28.123 - int start = split[0].length();
28.124 - int end = split[1].length() + start;
28.125 -
28.126 - code = split[0] + split[1] + split[2];
28.127 -
28.128 - prepareTest("test/Test.java", code);
28.129 -
28.130 - Tree generalizedTree = ExplicitFindDuplicates.resolveAndGeneralizePattern(info, start, end);
28.131 - VeryPretty vp = new VeryPretty(new DiffContext(info));
28.132 -
28.133 - vp.print((JCTree) generalizedTree);
28.134 -
28.135 - String repr = vp.toString();
28.136 -
28.137 - assertEquals(generalized.replaceAll("[ \n\t]+", " "),
28.138 - repr.replaceAll("[ \n\t]+", " "));
28.139 - }
28.140 -
28.141 -}
28.142 \ No newline at end of file
29.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/BulkSearchPerformance.java Sat Feb 18 22:14:42 2012 +0100
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,226 +0,0 @@
29.4 -/*
29.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.6 - *
29.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29.8 - *
29.9 - * The contents of this file are subject to the terms of either the GNU
29.10 - * General Public License Version 2 only ("GPL") or the Common
29.11 - * Development and Distribution License("CDDL") (collectively, the
29.12 - * "License"). You may not use this file except in compliance with the
29.13 - * License. You can obtain a copy of the License at
29.14 - * http://www.netbeans.org/cddl-gplv2.html
29.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.16 - * specific language governing permissions and limitations under the
29.17 - * License. When distributing the software, include this License Header
29.18 - * Notice in each file and include the License file at
29.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
29.20 - * particular file as subject to the "Classpath" exception as provided
29.21 - * by Sun in the GPL Version 2 section of the License file that
29.22 - * accompanied this code. If applicable, add the following below the
29.23 - * License Header, with the fields enclosed by brackets [] replaced by
29.24 - * your own identifying information:
29.25 - * "Portions Copyrighted [year] [name of copyright owner]"
29.26 - *
29.27 - * If you wish your version of this file to be governed by only the CDDL
29.28 - * or only the GPL Version 2, indicate your decision by adding
29.29 - * "[Contributor] elects to include this software in this distribution
29.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
29.31 - * single choice of license, a recipient has the option to distribute
29.32 - * your version of this file under either the CDDL, the GPL Version 2 or
29.33 - * to extend the choice of license to its licensees as provided above.
29.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
29.35 - * Version 2 license, then the option applies only if the new code is
29.36 - * made subject to such option by the copyright holder.
29.37 - *
29.38 - * Contributor(s):
29.39 - *
29.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
29.41 - */
29.42 -
29.43 -package org.netbeans.modules.jackpot30.impl.pm;
29.44 -
29.45 -import com.sun.source.util.TreePath;
29.46 -import java.io.ByteArrayInputStream;
29.47 -import java.io.ByteArrayOutputStream;
29.48 -import java.io.File;
29.49 -import java.io.IOException;
29.50 -import java.util.LinkedList;
29.51 -import java.util.List;
29.52 -import org.netbeans.api.java.source.ClasspathInfo;
29.53 -import org.netbeans.api.java.source.CompilationController;
29.54 -import org.netbeans.api.java.source.JavaSource;
29.55 -import org.netbeans.api.java.source.JavaSource.Phase;
29.56 -import org.netbeans.api.java.source.Task;
29.57 -import org.netbeans.junit.NbTestCase;
29.58 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
29.59 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
29.60 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
29.61 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
29.62 -import org.netbeans.modules.java.hints.jackpot.impl.pm.CopyFinderBasedBulkSearch;
29.63 -import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
29.64 -import org.openide.filesystems.FileObject;
29.65 -import org.openide.filesystems.FileUtil;
29.66 -
29.67 -/**
29.68 - *
29.69 - * @author lahvac
29.70 - */
29.71 -public class BulkSearchPerformance extends NbTestCase {
29.72 -
29.73 - public BulkSearchPerformance(String name) {
29.74 - super(name);
29.75 - }
29.76 -
29.77 - public void testPerformance() throws Exception {
29.78 - File root = new File("/media/karta/space/src/nb-main/uml");
29.79 - List<FileObject> files = new LinkedList<FileObject>();
29.80 -
29.81 - gatherFiles(FileUtil.toFileObject(root), files);
29.82 -
29.83 - String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
29.84 -
29.85 - for (int c = 0; c < 5; c++) {
29.86 - performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.87 - performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.88 - }
29.89 -
29.90 - performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.91 - long nfa1 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.92 - performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.93 - long cf1 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.94 -
29.95 - performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.96 - long nfa2 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.97 - performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.98 - long cf2 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.99 -
29.100 - System.err.println("nfa1=" + nfa1);
29.101 - System.err.println("cf1=" + cf1);
29.102 - System.err.println("nfa2=" + nfa2);
29.103 - System.err.println("cf2=" + cf2);
29.104 -
29.105 - System.err.println("perf (cf1/nfa1): " + ((1000 * cf1 / nfa1) /10.0) + "%");
29.106 - System.err.println("perf (cf2/nfa2): " + ((1000 * cf2 / nfa2) /10.0) + "%");
29.107 - }
29.108 -
29.109 - public void testIndexingPerformance() throws Exception {
29.110 - File root = new File("/media/karta/space/src/nb-main/uml");
29.111 -// File root = new File("/media/karta/space/src/nb-main/contrib/javahints");
29.112 - List<FileObject> files = new LinkedList<FileObject>();
29.113 -
29.114 - gatherFiles(FileUtil.toFileObject(root), files);
29.115 -
29.116 - String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
29.117 -
29.118 - for (int c = 0; c < 5; c++) {
29.119 - performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.120 -// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.121 - }
29.122 -
29.123 - performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.124 - long[] nfa1 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.125 -// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.126 -// long cf1 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.127 -
29.128 - performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.129 - long[] nfa2 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
29.130 -// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.131 -// long cf2 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
29.132 -
29.133 - System.err.println("i.nfa1=" + nfa1[0]);
29.134 - System.err.println("m.nfa1=" + nfa1[1]);
29.135 -// System.err.println("cf1=" + cf1);
29.136 - System.err.println("i.nfa2=" + nfa2[0]);
29.137 - System.err.println("m.nfa2=" + nfa2[1]);
29.138 -// System.err.println("cf2=" + cf2);
29.139 -
29.140 -// System.err.println("perf i.(nfa1/regexp1): " + ((1000 * nfa1[0] / regexp1[0]) /10.0) + "%");
29.141 -// System.err.println("perf m.(nfa1/regexp1): " + ((1000 * nfa1[1] / regexp1[1]) /10.0) + "%");
29.142 -// System.err.println("perf i.(nfa2/regexp2): " + ((1000 * nfa2[0] / regexp2[0]) /10.0) + "%");
29.143 -// System.err.println("perf m.(nfa2/regexp2): " + ((1000 * nfa2[1] / regexp2[1]) /10.0) + "%");
29.144 -// System.err.println("perf (cf1/regexp1): " + ((1000 * cf1 / regexp1) /10.0) + "%");
29.145 -// System.err.println("perf (cf2/regexp2): " + ((1000 * cf2 / regexp2) /10.0) + "%");
29.146 - }
29.147 -
29.148 - private long performPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
29.149 - ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
29.150 -
29.151 - final BulkPattern[] bulkPattern = new BulkPattern[1];
29.152 - JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
29.153 -
29.154 - public void run(CompilationController parameter) throws Exception {
29.155 - bulkPattern[0] = search.create(parameter, pattern);
29.156 - }
29.157 - }, true);
29.158 -
29.159 - long start = System.currentTimeMillis();
29.160 - JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
29.161 -
29.162 - public void run(CompilationController parameter) throws Exception {
29.163 - if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
29.164 - return;
29.165 -
29.166 - search.match(parameter, new TreePath(parameter.getCompilationUnit()), bulkPattern[0]);
29.167 - }
29.168 - }, true);
29.169 - long end = System.currentTimeMillis();
29.170 -
29.171 - return end - start;
29.172 - }
29.173 -
29.174 - private long[] performIndexingPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
29.175 - final List<byte[]> index = new LinkedList<byte[]>();
29.176 - long[] result = new long[2];
29.177 - ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
29.178 -
29.179 - final BulkPattern[] bulkPattern = new BulkPattern[1];
29.180 - JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
29.181 -
29.182 - public void run(CompilationController parameter) throws Exception {
29.183 - bulkPattern[0] = search.create(parameter, pattern);
29.184 - }
29.185 - }, true);
29.186 -
29.187 - long start = System.currentTimeMillis();
29.188 - JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
29.189 -
29.190 - public void run(CompilationController parameter) throws Exception {
29.191 - if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
29.192 - return;
29.193 -
29.194 - ByteArrayOutputStream out = new ByteArrayOutputStream();
29.195 - EncodingContext ec = new EncodingContext(out, false);
29.196 - search.encode(parameter.getCompilationUnit(), ec);
29.197 -
29.198 - index.add(out.toByteArray());
29.199 - }
29.200 - }, true);
29.201 - long end = System.currentTimeMillis();
29.202 -
29.203 - result[0] = end - start;
29.204 -
29.205 - start = System.currentTimeMillis();
29.206 -
29.207 - for (byte[] data : index) {
29.208 - search.matches(new ByteArrayInputStream(data), bulkPattern[0]);
29.209 - }
29.210 -
29.211 - end = System.currentTimeMillis();
29.212 -
29.213 - result[1] = end - start;
29.214 -
29.215 - return result;
29.216 - }
29.217 -
29.218 - private static void gatherFiles(FileObject root, List<FileObject> files) {
29.219 - if ("java".equals(root.getExt())) {
29.220 - files.add(root);
29.221 - }
29.222 -
29.223 - if (root.isFolder()) {
29.224 - for (FileObject c : root.getChildren()) {
29.225 - gatherFiles(c, files);
29.226 - }
29.227 - }
29.228 - }
29.229 -}
30.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/IndexBulkTest.java Sat Feb 18 22:14:42 2012 +0100
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,182 +0,0 @@
30.4 -/*
30.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
30.6 - *
30.7 - * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
30.8 - *
30.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
30.10 - * Other names may be trademarks of their respective owners.
30.11 - *
30.12 - * The contents of this file are subject to the terms of either the GNU
30.13 - * General Public License Version 2 only ("GPL") or the Common
30.14 - * Development and Distribution License("CDDL") (collectively, the
30.15 - * "License"). You may not use this file except in compliance with the
30.16 - * License. You can obtain a copy of the License at
30.17 - * http://www.netbeans.org/cddl-gplv2.html
30.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
30.19 - * specific language governing permissions and limitations under the
30.20 - * License. When distributing the software, include this License Header
30.21 - * Notice in each file and include the License file at
30.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
30.23 - * particular file as subject to the "Classpath" exception as provided
30.24 - * by Oracle in the GPL Version 2 section of the License file that
30.25 - * accompanied this code. If applicable, add the following below the
30.26 - * License Header, with the fields enclosed by brackets [] replaced by
30.27 - * your own identifying information:
30.28 - * "Portions Copyrighted [year] [name of copyright owner]"
30.29 - *
30.30 - * If you wish your version of this file to be governed by only the CDDL
30.31 - * or only the GPL Version 2, indicate your decision by adding
30.32 - * "[Contributor] elects to include this software in this distribution
30.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
30.34 - * single choice of license, a recipient has the option to distribute
30.35 - * your version of this file under either the CDDL, the GPL Version 2 or
30.36 - * to extend the choice of license to its licensees as provided above.
30.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
30.38 - * Version 2 license, then the option applies only if the new code is
30.39 - * made subject to such option by the copyright holder.
30.40 - *
30.41 - * Contributor(s):
30.42 - *
30.43 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
30.44 - */
30.45 -
30.46 -package org.netbeans.modules.jackpot30.impl.pm;
30.47 -
30.48 -import com.sun.source.tree.Tree;
30.49 -import com.sun.source.util.TreePath;
30.50 -import java.io.IOException;
30.51 -import java.io.InputStream;
30.52 -import java.io.Reader;
30.53 -import java.util.Collection;
30.54 -import java.util.Collections;
30.55 -import java.util.Map;
30.56 -import org.apache.lucene.analysis.Analyzer;
30.57 -import org.apache.lucene.analysis.TokenStream;
30.58 -import org.apache.lucene.index.IndexReader;
30.59 -import org.apache.lucene.index.IndexWriter.MaxFieldLength;
30.60 -import org.apache.lucene.store.Directory;
30.61 -import org.apache.lucene.store.RAMDirectory;
30.62 -import org.netbeans.api.java.source.CompilationInfo;
30.63 -import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex;
30.64 -import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
30.65 -import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
30.66 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
30.67 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
30.68 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
30.69 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearchTestPerformer;
30.70 -import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
30.71 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
30.72 -
30.73 -/**
30.74 - *
30.75 - * @author lahvac
30.76 - */
30.77 -public class IndexBulkTest extends BulkSearchTestPerformer {
30.78 -
30.79 - public IndexBulkTest(String name) {
30.80 - super(name);
30.81 - }
30.82 -
30.83 -// public static TestSuite suite() {
30.84 -// NbTestSuite r = new NbTestSuite();
30.85 -//
30.86 -// r.addTest(new NFABasedBulkSearchTest("testField1"));
30.87 -// r.addTest(new NFABasedBulkSearchTest("testField2"));
30.88 -//
30.89 -// return r;
30.90 -// }
30.91 -
30.92 - @Override
30.93 - protected BulkSearch createSearch() {
30.94 - return new BulkSearchImpl(false);
30.95 - }
30.96 -
30.97 - private static class BulkSearchImpl extends BulkSearch {
30.98 -
30.99 - public BulkSearchImpl(boolean requiresLightweightVerification) {
30.100 - super(requiresLightweightVerification);
30.101 - }
30.102 -
30.103 - @Override
30.104 - public Map<String, Collection<TreePath>> match(CompilationInfo info, TreePath toSearch, BulkPattern pattern, Map<String, Long> timeLog) {
30.105 - try {
30.106 - IndexImpl ii = new IndexImpl();
30.107 - IndexWriter writer = ii.openForWriting();
30.108 -
30.109 - writer.record(toSearch.getCompilationUnit().getSourceFile().toUri().toURL(), toSearch.getCompilationUnit(), null);
30.110 - writer.close();
30.111 -
30.112 - if (!ii.findCandidates(pattern).isEmpty()) {
30.113 - return new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog);
30.114 - } else {
30.115 - assertTrue(new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog).isEmpty());
30.116 - return Collections.emptyMap();
30.117 - }
30.118 - } catch (IOException ex) {
30.119 - throw new IllegalStateException(ex);
30.120 - }
30.121 - }
30.122 -
30.123 - @Override
30.124 - public boolean matches(InputStream encoded, BulkPattern pattern) {
30.125 - return new NFABasedBulkSearch().matches(encoded, pattern);
30.126 - }
30.127 -
30.128 - @Override
30.129 - public boolean matches(CompilationInfo info, TreePath toSearch, BulkPattern pattern) {
30.130 - return new NFABasedBulkSearch().matches(info, toSearch, pattern);
30.131 - }
30.132 -
30.133 - @Override
30.134 - public void encode(Tree tree, EncodingContext ctx) {
30.135 - new NFABasedBulkSearch().encode(tree, ctx);
30.136 - }
30.137 -
30.138 - @Override
30.139 - public BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints) {
30.140 - return new NFABasedBulkSearch().create(code, patterns, additionalConstraints);
30.141 - }
30.142 -
30.143 - @Override
30.144 - public Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern pattern) {
30.145 - return new NFABasedBulkSearch().matchesWithFrequencies(encoded, pattern);
30.146 - }
30.147 - }
30.148 -
30.149 - private static final class IndexImpl extends AbstractLuceneIndex {
30.150 -
30.151 - private final Directory dir = new RAMDirectory();
30.152 -
30.153 - public IndexImpl() {
30.154 - super(0, false, true);
30.155 - }
30.156 -
30.157 - @Override
30.158 - protected IndexReader createReader() throws IOException {
30.159 - return IndexReader.open(dir, true);
30.160 - }
30.161 -
30.162 - @Override
30.163 - protected org.apache.lucene.index.IndexWriter createWriter() throws IOException {
30.164 - return new org.apache.lucene.index.IndexWriter(dir, new NoAnalyzer(), MaxFieldLength.UNLIMITED);
30.165 - }
30.166 -
30.167 - @Override
30.168 - public IndexInfo getIndexInfo() {
30.169 - return IndexInfo.empty();
30.170 - }
30.171 -
30.172 - @Override
30.173 - protected void storeIndexInfo(IndexInfo info) throws IOException {}
30.174 - }
30.175 -
30.176 - private static final class NoAnalyzer extends Analyzer {
30.177 -
30.178 - @Override
30.179 - public TokenStream tokenStream(String string, Reader reader) {
30.180 - throw new UnsupportedOperationException("Should not be called");
30.181 - }
30.182 -
30.183 - }
30.184 -
30.185 -}
31.1 --- a/api/test/unit/src/org/netbeans/modules/jackpot30/spi/refactoring/JackpotBasedRefactoringTestBase.java Sat Feb 18 22:14:42 2012 +0100
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,198 +0,0 @@
31.4 -/*
31.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
31.6 - *
31.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
31.8 - *
31.9 - * The contents of this file are subject to the terms of either the GNU
31.10 - * General Public License Version 2 only ("GPL") or the Common
31.11 - * Development and Distribution License("CDDL") (collectively, the
31.12 - * "License"). You may not use this file except in compliance with the
31.13 - * License. You can obtain a copy of the License at
31.14 - * http://www.netbeans.org/cddl-gplv2.html
31.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
31.16 - * specific language governing permissions and limitations under the
31.17 - * License. When distributing the software, include this License Header
31.18 - * Notice in each file and include the License file at
31.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
31.20 - * particular file as subject to the "Classpath" exception as provided
31.21 - * by Sun in the GPL Version 2 section of the License file that
31.22 - * accompanied this code. If applicable, add the following below the
31.23 - * License Header, with the fields enclosed by brackets [] replaced by
31.24 - * your own identifying information:
31.25 - * "Portions Copyrighted [year] [name of copyright owner]"
31.26 - *
31.27 - * If you wish your version of this file to be governed by only the CDDL
31.28 - * or only the GPL Version 2, indicate your decision by adding
31.29 - * "[Contributor] elects to include this software in this distribution
31.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
31.31 - * single choice of license, a recipient has the option to distribute
31.32 - * your version of this file under either the CDDL, the GPL Version 2 or
31.33 - * to extend the choice of license to its licensees as provided above.
31.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
31.35 - * Version 2 license, then the option applies only if the new code is
31.36 - * made subject to such option by the copyright holder.
31.37 - *
31.38 - * Contributor(s):
31.39 - *
31.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
31.41 - */
31.42 -
31.43 -package org.netbeans.modules.jackpot30.spi.refactoring;
31.44 -
31.45 -import java.io.IOException;
31.46 -import java.util.Collections;
31.47 -import org.netbeans.api.editor.mimelookup.MimePath;
31.48 -import org.netbeans.api.java.classpath.ClassPath;
31.49 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
31.50 -import org.netbeans.api.java.source.SourceUtils;
31.51 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
31.52 -import org.netbeans.api.java.source.TestUtilities;
31.53 -import org.netbeans.api.project.Project;
31.54 -import org.netbeans.api.project.ProjectManager;
31.55 -import org.netbeans.core.startup.Main;
31.56 -import org.netbeans.junit.NbTestCase;
31.57 -import org.netbeans.modules.java.JavaDataLoader;
31.58 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
31.59 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
31.60 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
31.61 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
31.62 -import org.netbeans.modules.parsing.impl.indexing.Util;
31.63 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
31.64 -import org.netbeans.spi.java.classpath.ClassPathProvider;
31.65 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
31.66 -import org.netbeans.spi.project.ProjectFactory;
31.67 -import org.netbeans.spi.project.ProjectState;
31.68 -import org.openide.filesystems.FileObject;
31.69 -import org.openide.filesystems.FileUtil;
31.70 -import org.openide.util.Lookup;
31.71 -import org.openide.util.lookup.Lookups;
31.72 -import org.openide.util.lookup.ServiceProvider;
31.73 -
31.74 -/**
31.75 - *
31.76 - * @author lahvac
31.77 - */
31.78 -public class JackpotBasedRefactoringTestBase extends NbTestCase {
31.79 -
31.80 - public JackpotBasedRefactoringTestBase(String name) {
31.81 - super(name);
31.82 - }
31.83 -
31.84 - protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
31.85 - for (FileObject c : sourceRoot.getChildren()) {
31.86 - c.delete();
31.87 - }
31.88 -
31.89 - for (File f : files) {
31.90 - FileObject fo = FileUtil.createData(sourceRoot, f.filename);
31.91 - TestUtilities.copyStringToFile(fo, f.content);
31.92 - }
31.93 -
31.94 - SourceUtils.waitScanFinished();
31.95 - }
31.96 -
31.97 - protected static void assertContent(FileObject sourceRoot, File... files) throws Exception {
31.98 - for (File f : files) {
31.99 - FileObject fo = sourceRoot.getFileObject(f.filename);
31.100 -
31.101 - assertNotNull(f.filename, fo);
31.102 -
31.103 - assertEquals(f.content.replaceAll("[ \t\n]+", " "), TestUtilities.copyFileToString(FileUtil.toFile(fo)).replaceAll("[ \t\n]+", " "));
31.104 - }
31.105 - }
31.106 -
31.107 - protected static final class File {
31.108 - public final String filename;
31.109 - public final String content;
31.110 -
31.111 - public File(String filename, String content) {
31.112 - this.filename = filename;
31.113 - this.content = content;
31.114 - }
31.115 - }
31.116 -
31.117 - protected FileObject src;
31.118 - protected Project prj;
31.119 -
31.120 - @Override
31.121 - protected void setUp() throws Exception {
31.122 - SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[] {
31.123 - new ClassPathProvider() {
31.124 - public ClassPath findClassPath(FileObject file, String type) {
31.125 - if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
31.126 - if (ClassPath.BOOT.equals(type)) {
31.127 - return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
31.128 - }
31.129 - if (ClassPath.COMPILE.equals(type)) {
31.130 - return ClassPathSupport.createClassPath(new FileObject[0]);
31.131 - }
31.132 - if (ClassPath.SOURCE.equals(type)) {
31.133 - return ClassPathSupport.createClassPath(src);
31.134 - }
31.135 - }
31.136 -
31.137 - return null;
31.138 - }
31.139 - },
31.140 - new ProjectFactory() {
31.141 - public boolean isProject(FileObject projectDirectory) {
31.142 - return src == projectDirectory;
31.143 - }
31.144 - public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
31.145 - if (!isProject(projectDirectory)) return null;
31.146 - return new Project() {
31.147 - public FileObject getProjectDirectory() {
31.148 - return projectDirectory;
31.149 - }
31.150 - public Lookup getLookup() {
31.151 - return Lookup.EMPTY;
31.152 - }
31.153 - };
31.154 - }
31.155 - public void saveProject(Project project) throws IOException, ClassCastException {}
31.156 - },
31.157 - JavaDataLoader.getLoader(JavaDataLoader.class),
31.158 - });
31.159 - Main.initializeURLFactory();
31.160 - org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
31.161 - prepareTest();
31.162 - org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
31.163 - MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
31.164 - GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
31.165 - RepositoryUpdater.getDefault().start(true);
31.166 - super.setUp();
31.167 - }
31.168 -
31.169 - @Override
31.170 - protected void tearDown() throws Exception {
31.171 - super.tearDown();
31.172 - org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
31.173 - prj = null;
31.174 - }
31.175 -
31.176 - private void prepareTest() throws Exception {
31.177 - FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
31.178 -
31.179 - src = FileUtil.createFolder(workdir, "src");
31.180 -
31.181 - FileObject cache = FileUtil.createFolder(workdir, "cache");
31.182 -
31.183 - CacheFolder.setCacheFolder(cache);
31.184 - }
31.185 -
31.186 - @ServiceProvider(service=MimeDataProvider.class)
31.187 - public static final class MimeDataProviderImpl implements MimeDataProvider {
31.188 -
31.189 - private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
31.190 -
31.191 - public Lookup getLookup(MimePath mimePath) {
31.192 - if ("text/x-java".equals(mimePath.getPath())) {
31.193 - return L;
31.194 - }
31.195 -
31.196 - return null;
31.197 - }
31.198 -
31.199 - }
31.200 -
31.201 -}
32.1 --- a/bridges/apisupport/bridge/org/netbeans/modules/jackpot30/apisupport/bridgeimpl/ProjectDependencyUpgraderImpl.java Sat Feb 18 22:14:42 2012 +0100
32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
32.3 @@ -1,157 +0,0 @@
32.4 -/*
32.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
32.6 - *
32.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
32.8 - *
32.9 - * The contents of this file are subject to the terms of either the GNU
32.10 - * General Public License Version 2 only ("GPL") or the Common
32.11 - * Development and Distribution License("CDDL") (collectively, the
32.12 - * "License"). You may not use this file except in compliance with the
32.13 - * License. You can obtain a copy of the License at
32.14 - * http://www.netbeans.org/cddl-gplv2.html
32.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
32.16 - * specific language governing permissions and limitations under the
32.17 - * License. When distributing the software, include this License Header
32.18 - * Notice in each file and include the License file at
32.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
32.20 - * particular file as subject to the "Classpath" exception as provided
32.21 - * by Sun in the GPL Version 2 section of the License file that
32.22 - * accompanied this code. If applicable, add the following below the
32.23 - * License Header, with the fields enclosed by brackets [] replaced by
32.24 - * your own identifying information:
32.25 - * "Portions Copyrighted [year] [name of copyright owner]"
32.26 - *
32.27 - * If you wish your version of this file to be governed by only the CDDL
32.28 - * or only the GPL Version 2, indicate your decision by adding
32.29 - * "[Contributor] elects to include this software in this distribution
32.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
32.31 - * single choice of license, a recipient has the option to distribute
32.32 - * your version of this file under either the CDDL, the GPL Version 2 or
32.33 - * to extend the choice of license to its licensees as provided above.
32.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
32.35 - * Version 2 license, then the option applies only if the new code is
32.36 - * made subject to such option by the copyright holder.
32.37 - *
32.38 - * Contributor(s):
32.39 - *
32.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
32.41 - */
32.42 -package org.netbeans.modules.jackpot30.apisupport.bridgeimpl;
32.43 -
32.44 -import java.io.IOException;
32.45 -import org.netbeans.api.project.FileOwnerQuery;
32.46 -import org.netbeans.api.project.Project;
32.47 -import org.netbeans.api.project.ProjectManager;
32.48 -import org.netbeans.api.project.ProjectUtils;
32.49 -import org.netbeans.modules.apisupport.project.ModuleDependency;
32.50 -import org.netbeans.modules.apisupport.project.NbModuleProject;
32.51 -import org.netbeans.modules.apisupport.project.ProjectXMLManager;
32.52 -import org.netbeans.modules.apisupport.project.ProjectXMLManager.CyclicDependencyException;
32.53 -import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
32.54 -import org.netbeans.modules.apisupport.project.universe.ModuleEntry;
32.55 -import org.netbeans.modules.jackpot30.apisupport.Utilities;
32.56 -import org.netbeans.modules.jackpot30.apisupport.Utilities.ParsedDependency;
32.57 -import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
32.58 -import org.openide.filesystems.FileObject;
32.59 -import org.openide.modules.SpecificationVersion;
32.60 -import org.openide.util.Exceptions;
32.61 -
32.62 -/**
32.63 - *
32.64 - * @author lahvac
32.65 - */
32.66 -public class ProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
32.67 -
32.68 - public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
32.69 - NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
32.70 -
32.71 - if (currentNbModule == null) {
32.72 - return false;
32.73 - }
32.74 -
32.75 - Project referedProject = FileOwnerQuery.getOwner(depFO);
32.76 -
32.77 - if (referedProject == null) {
32.78 - return false;
32.79 - }
32.80 -
32.81 - NbModuleProject referedNbProject = referedProject.getLookup().lookup(NbModuleProject.class);
32.82 -
32.83 - if (referedNbProject == null) {
32.84 - return false;
32.85 - }
32.86 -
32.87 - return ensureDependency(currentProject, referedNbProject.getCodeNameBase(), ProjectUtils.getInformation(referedProject).getDisplayName(), null, spec, canShowUI);
32.88 - }
32.89 -
32.90 - private boolean ensureDependency(Project currentProject, String cnb, String displayName, String releaseVersion, SpecificationVersion spec, final boolean canShowUI) {
32.91 - NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
32.92 -
32.93 - if (currentNbModule == null) {
32.94 - return false;
32.95 - }
32.96 -
32.97 - try {
32.98 - NbModuleProject currentNbModuleProject = currentProject.getLookup().lookup(NbModuleProject.class);
32.99 -
32.100 - if (currentNbModuleProject == null) {
32.101 - return false;
32.102 - }
32.103 -
32.104 - ProjectXMLManager m = new ProjectXMLManager(currentNbModuleProject);
32.105 - ModuleDependency dep = m.getModuleDependency(cnb);
32.106 -
32.107 - if (dep == null) {
32.108 - if (showDependencyUpgradeDialog(currentProject, displayName, null, spec, false, canShowUI)) {
32.109 - ModuleEntry me = currentNbModuleProject.getModuleList().getEntry(cnb);
32.110 - ModuleDependency nue = new ModuleDependency(me,
32.111 - releaseVersion != null ? releaseVersion : me.getReleaseVersion(),
32.112 - spec != null ? spec.toString() : me.getSpecificationVersion(),
32.113 - true,
32.114 - false);
32.115 -
32.116 - m.addDependency(nue);
32.117 - ProjectManager.getDefault().saveProject(currentProject);
32.118 - }
32.119 -
32.120 - return true;
32.121 - }
32.122 -
32.123 - if (dep.getSpecificationVersion() == null) {
32.124 - //impl.dep?
32.125 - return false;
32.126 - }
32.127 -
32.128 - SpecificationVersion currentDep = new SpecificationVersion(dep.getSpecificationVersion());
32.129 -
32.130 - if (spec != null && (currentDep == null || currentDep.compareTo(spec) < 0)) {
32.131 - if (showDependencyUpgradeDialog(currentProject, displayName, new SpecificationVersion(dep.getSpecificationVersion()), spec, false, canShowUI)) {
32.132 - ModuleDependency nue = new ModuleDependency(dep.getModuleEntry(),
32.133 - releaseVersion != null ? releaseVersion : dep.getReleaseVersion(),
32.134 - spec.toString(),
32.135 - dep.hasCompileDependency(),
32.136 - dep.hasImplementationDependency());
32.137 -
32.138 - m.editDependency(dep, nue);
32.139 - ProjectManager.getDefault().saveProject(currentProject);
32.140 - }
32.141 -
32.142 - return true;
32.143 - }
32.144 - } catch (CyclicDependencyException ex) {
32.145 - Exceptions.printStackTrace(ex);
32.146 - } catch (IOException ex) {
32.147 - Exceptions.printStackTrace(ex);
32.148 - }
32.149 -
32.150 - return false;
32.151 - }
32.152 -
32.153 - @Override
32.154 - public boolean ensureDependency(Project p, String specification, boolean canShowUI) {
32.155 - ParsedDependency dep = Utilities.parseDependency(specification);
32.156 -
32.157 - return ensureDependency(p, dep.cnb, /*TODO: may null and that could put display name their*/specification, dep.releaseVersion, dep.specVersion, canShowUI);
32.158 - }
32.159 -
32.160 -}
33.1 --- a/bridges/apisupport/build.xml Sat Feb 18 22:14:42 2012 +0100
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,25 +0,0 @@
33.4 -<?xml version="1.0" encoding="UTF-8"?>
33.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
33.6 -<!-- for some information on what you could do (e.g. targets to override). -->
33.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
33.8 -<project name="org.netbeans.modules.jackpot30.apisupport" default="netbeans" basedir=".">
33.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.apisupport.</description>
33.10 - <import file="nbproject/build-impl.xml"/>
33.11 - <import file="${suite.dir}/findbugs-import.xml"/>
33.12 - <target name="netbeans-extra" depends="init">
33.13 - <mkdir dir="build/bridgeclasses"/>
33.14 - <javac srcdir="bridge" destdir="build/bridgeclasses" source="1.6" target="1.6" debug="true" deprecation="true">
33.15 - <classpath>
33.16 - <path refid="cp"/>
33.17 - <pathelement location="${cluster}/modules/${code.name.base.dashes}.jar"/>
33.18 - </classpath>
33.19 - </javac>
33.20 - <copy todir="build/bridgeclasses">
33.21 - <fileset dir="bridge" excludes="${jar-excludes}"/>
33.22 - </copy>
33.23 - <mkdir dir="${cluster}/modules/ext"/>
33.24 - <jar jarfile="${cluster}/modules/ext/${code.name.base.dashes}.jar" compress="false">
33.25 - <fileset dir="build/bridgeclasses"/>
33.26 - </jar>
33.27 - </target>
33.28 -</project>
34.1 --- a/bridges/apisupport/manifest.mf Sat Feb 18 22:14:42 2012 +0100
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,6 +0,0 @@
34.4 -Manifest-Version: 1.0
34.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.apisupport
34.6 -OpenIDE-Module-Implementation-Version: 1
34.7 -OpenIDE-Module-Install: org/netbeans/modules/jackpot30/apisupport/Installer.class
34.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/apisupport/Bundle.properties
34.9 -
35.1 --- a/bridges/apisupport/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,45 +0,0 @@
35.4 -<?xml version="1.0" encoding="UTF-8"?>
35.5 -<!--
35.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
35.7 -*** EDIT ../build.xml INSTEAD ***
35.8 --->
35.9 -<project name="org.netbeans.modules.jackpot30.apisupport-impl" basedir="..">
35.10 - <fail message="Please build using Ant 1.7.1 or higher.">
35.11 - <condition>
35.12 - <not>
35.13 - <antversion atleast="1.7.1"/>
35.14 - </not>
35.15 - </condition>
35.16 - </fail>
35.17 - <property file="nbproject/private/suite-private.properties"/>
35.18 - <property file="nbproject/suite.properties"/>
35.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
35.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
35.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
35.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
35.23 - <attribute name="name"/>
35.24 - <attribute name="value"/>
35.25 - <sequential>
35.26 - <property name="@{name}" value="${@{value}}"/>
35.27 - </sequential>
35.28 - </macrodef>
35.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
35.30 - <attribute name="property"/>
35.31 - <attribute name="value"/>
35.32 - <sequential>
35.33 - <property name="@{property}" value="@{value}"/>
35.34 - </sequential>
35.35 - </macrodef>
35.36 - <property file="${user.properties.file}"/>
35.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
35.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
35.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
35.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
35.41 - <condition>
35.42 - <not>
35.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
35.44 - </not>
35.45 - </condition>
35.46 - </fail>
35.47 - <import file="${harness.dir}/build.xml"/>
35.48 -</project>
36.1 --- a/bridges/apisupport/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,8 +0,0 @@
36.4 -build.xml.data.CRC32=c45369e1
36.5 -build.xml.script.CRC32=a2cc69eb
36.6 -build.xml.stylesheet.CRC32=79c3b980@1.40
36.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
36.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
36.9 -nbproject/build-impl.xml.data.CRC32=e186a96e
36.10 -nbproject/build-impl.xml.script.CRC32=83dd2c27
36.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
37.1 --- a/bridges/apisupport/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,5 +0,0 @@
37.4 -is.eager=true
37.5 -javac.source=1.5
37.6 -javac.compilerargs=-Xlint -Xlint:-serial
37.7 -extra.module.files=modules/ext/org-netbeans-modules-jackpot30-apisupport.jar
37.8 -spec.version.base=1.16
38.1 --- a/bridges/apisupport/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,85 +0,0 @@
38.4 -<?xml version="1.0" encoding="UTF-8"?>
38.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
38.6 - <type>org.netbeans.modules.apisupport.project</type>
38.7 - <configuration>
38.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
38.9 - <code-name-base>org.netbeans.modules.jackpot30.apisupport</code-name-base>
38.10 - <suite-component/>
38.11 - <module-dependencies>
38.12 - <dependency>
38.13 - <code-name-base>org.netbeans.modules.apisupport.ant</code-name-base>
38.14 - <build-prerequisite/>
38.15 - <compile-dependency/>
38.16 - </dependency>
38.17 - <dependency>
38.18 - <code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
38.19 - <build-prerequisite/>
38.20 - <compile-dependency/>
38.21 - </dependency>
38.22 - <dependency>
38.23 - <code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
38.24 - <run-dependency>
38.25 - <release-version>1</release-version>
38.26 - </run-dependency>
38.27 - </dependency>
38.28 - <dependency>
38.29 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
38.30 - <build-prerequisite/>
38.31 - <compile-dependency/>
38.32 - <run-dependency>
38.33 - <release-version>1</release-version>
38.34 - <implementation-version/>
38.35 - </run-dependency>
38.36 - </dependency>
38.37 - <dependency>
38.38 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
38.39 - <build-prerequisite/>
38.40 - <compile-dependency/>
38.41 - <run-dependency>
38.42 - <release-version>1</release-version>
38.43 - <specification-version>1.29</specification-version>
38.44 - </run-dependency>
38.45 - </dependency>
38.46 - <dependency>
38.47 - <code-name-base>org.openide.filesystems</code-name-base>
38.48 - <build-prerequisite/>
38.49 - <compile-dependency/>
38.50 - <run-dependency>
38.51 - <specification-version>7.33.0.1.1</specification-version>
38.52 - </run-dependency>
38.53 - </dependency>
38.54 - <dependency>
38.55 - <code-name-base>org.openide.modules</code-name-base>
38.56 - <build-prerequisite/>
38.57 - <compile-dependency/>
38.58 - <run-dependency>
38.59 - <specification-version>7.14</specification-version>
38.60 - </run-dependency>
38.61 - </dependency>
38.62 - <dependency>
38.63 - <code-name-base>org.openide.util</code-name-base>
38.64 - <build-prerequisite/>
38.65 - <compile-dependency/>
38.66 - <run-dependency>
38.67 - <specification-version>7.32.0.1</specification-version>
38.68 - </run-dependency>
38.69 - </dependency>
38.70 - <dependency>
38.71 - <code-name-base>org.openide.util.lookup</code-name-base>
38.72 - <build-prerequisite/>
38.73 - <compile-dependency/>
38.74 - <run-dependency>
38.75 - <specification-version>8.2</specification-version>
38.76 - </run-dependency>
38.77 - </dependency>
38.78 - </module-dependencies>
38.79 - <public-packages/>
38.80 - <extra-compilation-unit>
38.81 - <package-root>bridge</package-root>
38.82 - <classpath>${module.classpath}:${cluster}/modules/${code.name.base.dashes}.jar</classpath>
38.83 - <built-to>build/bridgeclasses</built-to>
38.84 - <built-to>${cluster}/modules/ext/${code.name.base.dashes}.jar</built-to>
38.85 - </extra-compilation-unit>
38.86 - </data>
38.87 - </configuration>
38.88 -</project>
39.1 --- a/bridges/apisupport/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
39.3 @@ -1,1 +0,0 @@
39.4 -suite.dir=${basedir}/../..
40.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/APIProjectDependencyUpgraderImpl.java Sat Feb 18 22:14:42 2012 +0100
40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
40.3 @@ -1,127 +0,0 @@
40.4 -/*
40.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
40.6 - *
40.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
40.8 - *
40.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
40.10 - * Other names may be trademarks of their respective owners.
40.11 - *
40.12 - * The contents of this file are subject to the terms of either the GNU General
40.13 - * Public License Version 2 only ("GPL") or the Common Development and
40.14 - * Distribution License("CDDL") (collectively, the "License"). You may not use
40.15 - * this file except in compliance with the License. You can obtain a copy of the
40.16 - * License at http://www.netbeans.org/cddl-gplv2.html or
40.17 - * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
40.18 - * governing permissions and limitations under the License. When distributing
40.19 - * the software, include this License Header Notice in each file and include the
40.20 - * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
40.21 - * particular file as subject to the "Classpath" exception as provided by Oracle
40.22 - * in the GPL Version 2 section of the License file that accompanied this code.
40.23 - * If applicable, add the following below the License Header, with the fields
40.24 - * enclosed by brackets [] replaced by your own identifying information:
40.25 - * "Portions Copyrighted [year] [name of copyright owner]"
40.26 - *
40.27 - * If you wish your version of this file to be governed by only the CDDL or only
40.28 - * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
40.29 - * include this software in this distribution under the [CDDL or GPL Version 2]
40.30 - * license." If you do not indicate a single choice of license, a recipient has
40.31 - * the option to distribute your version of this file under either the CDDL, the
40.32 - * GPL Version 2 or to extend the choice of license to its licensees as provided
40.33 - * above. However, if you add GPL Version 2 code and therefore, elected the GPL
40.34 - * Version 2 license, then the option applies only if the new code is made
40.35 - * subject to such option by the copyright holder.
40.36 - *
40.37 - * Contributor(s):
40.38 - *
40.39 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
40.40 - */
40.41 -package org.netbeans.modules.jackpot30.apisupport;
40.42 -
40.43 -import java.io.IOException;
40.44 -import org.netbeans.api.project.FileOwnerQuery;
40.45 -import org.netbeans.api.project.Project;
40.46 -import org.netbeans.api.project.ProjectManager;
40.47 -import org.netbeans.api.project.ProjectUtils;
40.48 -import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
40.49 -import org.netbeans.modules.jackpot30.apisupport.Utilities.ParsedDependency;
40.50 -import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
40.51 -import org.openide.filesystems.FileObject;
40.52 -import org.openide.modules.SpecificationVersion;
40.53 -import org.openide.util.Exceptions;
40.54 -import org.openide.util.lookup.ServiceProvider;
40.55 -
40.56 -/**
40.57 - *
40.58 - * @author lahvac
40.59 - */
40.60 -public class APIProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
40.61 -
40.62 - public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
40.63 - NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
40.64 -
40.65 - if (currentNbModule == null) {
40.66 - return false;
40.67 - }
40.68 -
40.69 - Project referedProject = FileOwnerQuery.getOwner(depFO);
40.70 -
40.71 - if (referedProject == null) {
40.72 - return false;
40.73 - }
40.74 -
40.75 - NbModuleProvider referedNbProject = referedProject.getLookup().lookup(NbModuleProvider.class);
40.76 -
40.77 - if (referedNbProject == null) {
40.78 - return false;
40.79 - }
40.80 -
40.81 - return ensureDependency(currentProject, referedNbProject.getCodeNameBase(), ProjectUtils.getInformation(referedProject).getDisplayName(), null, spec, canShowUI);
40.82 - }
40.83 -
40.84 - private boolean ensureDependency(Project currentProject, String cnb, String displayName, String releaseVersion, SpecificationVersion spec, final boolean canShowUI) {
40.85 - NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
40.86 -
40.87 - if (currentNbModule == null) {
40.88 - return false;
40.89 - }
40.90 -
40.91 - try {
40.92 - if (!currentNbModule.hasDependency(cnb)) {
40.93 - if (showDependencyUpgradeDialog(currentProject, displayName, null, spec, false, canShowUI)) {
40.94 - currentNbModule.addDependency(cnb, releaseVersion, spec, true);
40.95 - ProjectManager.getDefault().saveProject(currentProject);
40.96 - }
40.97 -
40.98 - return true;
40.99 - }
40.100 -
40.101 - SpecificationVersion currentDep = currentNbModule.getDependencyVersion(cnb);
40.102 -
40.103 - if (currentDep == null) {
40.104 - //impl.dep?
40.105 - return false;
40.106 - }
40.107 -
40.108 - if (spec != null && (currentDep == null || currentDep.compareTo(spec) < 0)) {
40.109 - if (showDependencyUpgradeDialog(currentProject, displayName, currentDep, spec, false, canShowUI)) {
40.110 - currentNbModule.addDependency(cnb, releaseVersion, spec, true);
40.111 - ProjectManager.getDefault().saveProject(currentProject);
40.112 - }
40.113 -
40.114 - return true;
40.115 - }
40.116 - } catch (IOException ex) {
40.117 - Exceptions.printStackTrace(ex);
40.118 - }
40.119 -
40.120 - return false;
40.121 - }
40.122 -
40.123 - @Override
40.124 - public boolean ensureDependency(Project p, String specification, boolean canShowUI) {
40.125 - ParsedDependency dep = Utilities.parseDependency(specification);
40.126 -
40.127 - return ensureDependency(p, dep.cnb, /*TODO: may null and that could put display name their*/specification, dep.releaseVersion, dep.specVersion, canShowUI);
40.128 - }
40.129 -
40.130 -}
41.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
41.3 @@ -1,1 +0,0 @@
41.4 -OpenIDE-Module-Name=Jackpot 3.0 APISupport Bridge
42.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/HackyProjectDependencyUpgraderImpl.java Sat Feb 18 22:14:42 2012 +0100
42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
42.3 @@ -1,107 +0,0 @@
42.4 -/*
42.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
42.6 - *
42.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
42.8 - *
42.9 - * The contents of this file are subject to the terms of either the GNU
42.10 - * General Public License Version 2 only ("GPL") or the Common
42.11 - * Development and Distribution License("CDDL") (collectively, the
42.12 - * "License"). You may not use this file except in compliance with the
42.13 - * License. You can obtain a copy of the License at
42.14 - * http://www.netbeans.org/cddl-gplv2.html
42.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
42.16 - * specific language governing permissions and limitations under the
42.17 - * License. When distributing the software, include this License Header
42.18 - * Notice in each file and include the License file at
42.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
42.20 - * particular file as subject to the "Classpath" exception as provided
42.21 - * by Sun in the GPL Version 2 section of the License file that
42.22 - * accompanied this code. If applicable, add the following below the
42.23 - * License Header, with the fields enclosed by brackets [] replaced by
42.24 - * your own identifying information:
42.25 - * "Portions Copyrighted [year] [name of copyright owner]"
42.26 - *
42.27 - * If you wish your version of this file to be governed by only the CDDL
42.28 - * or only the GPL Version 2, indicate your decision by adding
42.29 - * "[Contributor] elects to include this software in this distribution
42.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
42.31 - * single choice of license, a recipient has the option to distribute
42.32 - * your version of this file under either the CDDL, the GPL Version 2 or
42.33 - * to extend the choice of license to its licensees as provided above.
42.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
42.35 - * Version 2 license, then the option applies only if the new code is
42.36 - * made subject to such option by the copyright holder.
42.37 - *
42.38 - * Contributor(s):
42.39 - *
42.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
42.41 - */
42.42 -
42.43 -package org.netbeans.modules.jackpot30.apisupport;
42.44 -
42.45 -import java.io.File;
42.46 -import java.net.MalformedURLException;
42.47 -import java.net.URL;
42.48 -import java.net.URLClassLoader;
42.49 -import org.netbeans.api.project.Project;
42.50 -//import org.netbeans.modules.apisupport.project.api.DependencyUpdater;
42.51 -import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
42.52 -import org.openide.filesystems.FileObject;
42.53 -import org.openide.modules.InstalledFileLocator;
42.54 -import org.openide.modules.SpecificationVersion;
42.55 -import org.openide.util.Exceptions;
42.56 -import org.openide.util.Lookup;
42.57 -import org.openide.util.lookup.ServiceProvider;
42.58 -
42.59 -/**
42.60 - *
42.61 - * @author lahvac
42.62 - */
42.63 -public class HackyProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
42.64 -
42.65 - public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
42.66 - File lib = InstalledFileLocator.getDefault().locate("modules/ext/org-netbeans-modules-jackpot30-apisupport.jar", null, false);
42.67 -
42.68 - ClassLoader scl = Lookup.getDefault().lookup(ClassLoader.class);
42.69 - try {
42.70 - URLClassLoader l = new URLClassLoader(new URL[]{lib.toURI().toURL()}, scl);
42.71 - Class<?> u = Class.forName("org.netbeans.modules.jackpot30.apisupport.bridgeimpl.ProjectDependencyUpgraderImpl", false, l);
42.72 -
42.73 - return ((ProjectDependencyUpgrader) u.newInstance()).ensureDependency(currentProject, depFO, spec, canShowUI);
42.74 - } catch (InstantiationException ex) {
42.75 - Exceptions.printStackTrace(ex);
42.76 - } catch (IllegalAccessException ex) {
42.77 - Exceptions.printStackTrace(ex);
42.78 - } catch (ClassNotFoundException ex) {
42.79 - Exceptions.printStackTrace(ex);
42.80 - } catch (MalformedURLException ex) {
42.81 - Exceptions.printStackTrace(ex);
42.82 - }
42.83 -
42.84 - return false;
42.85 - }
42.86 -
42.87 - @Override
42.88 - public boolean ensureDependency(Project p, String specification, boolean b) {
42.89 - File lib = InstalledFileLocator.getDefault().locate("modules/ext/org-netbeans-modules-jackpot30-apisupport.jar", null, false);
42.90 -
42.91 - ClassLoader scl = Lookup.getDefault().lookup(ClassLoader.class);
42.92 - try {
42.93 - URLClassLoader l = new URLClassLoader(new URL[]{lib.toURI().toURL()}, scl);
42.94 - Class<?> u = Class.forName("org.netbeans.modules.jackpot30.apisupport.bridgeimpl.ProjectDependencyUpgraderImpl", false, l);
42.95 -
42.96 - return ((ProjectDependencyUpgrader) u.newInstance()).ensureDependency(p, specification, b);
42.97 - } catch (InstantiationException ex) {
42.98 - Exceptions.printStackTrace(ex);
42.99 - } catch (IllegalAccessException ex) {
42.100 - Exceptions.printStackTrace(ex);
42.101 - } catch (ClassNotFoundException ex) {
42.102 - Exceptions.printStackTrace(ex);
42.103 - } catch (MalformedURLException ex) {
42.104 - Exceptions.printStackTrace(ex);
42.105 - }
42.106 -
42.107 - return false;
42.108 - }
42.109 -
42.110 -}
43.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Installer.java Sat Feb 18 22:14:42 2012 +0100
43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
43.3 @@ -1,70 +0,0 @@
43.4 -/*
43.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
43.6 - *
43.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
43.8 - *
43.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
43.10 - * Other names may be trademarks of their respective owners.
43.11 - *
43.12 - * The contents of this file are subject to the terms of either the GNU General
43.13 - * Public License Version 2 only ("GPL") or the Common Development and
43.14 - * Distribution License("CDDL") (collectively, the "License"). You may not use
43.15 - * this file except in compliance with the License. You can obtain a copy of the
43.16 - * License at http://www.netbeans.org/cddl-gplv2.html or
43.17 - * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
43.18 - * governing permissions and limitations under the License. When distributing
43.19 - * the software, include this License Header Notice in each file and include the
43.20 - * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
43.21 - * particular file as subject to the "Classpath" exception as provided by Oracle
43.22 - * in the GPL Version 2 section of the License file that accompanied this code.
43.23 - * If applicable, add the following below the License Header, with the fields
43.24 - * enclosed by brackets [] replaced by your own identifying information:
43.25 - * "Portions Copyrighted [year] [name of copyright owner]"
43.26 - *
43.27 - * If you wish your version of this file to be governed by only the CDDL or only
43.28 - * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
43.29 - * include this software in this distribution under the [CDDL or GPL Version 2]
43.30 - * license." If you do not indicate a single choice of license, a recipient has
43.31 - * the option to distribute your version of this file under either the CDDL, the
43.32 - * GPL Version 2 or to extend the choice of license to its licensees as provided
43.33 - * above. However, if you add GPL Version 2 code and therefore, elected the GPL
43.34 - * Version 2 license, then the option applies only if the new code is made
43.35 - * subject to such option by the copyright holder.
43.36 - *
43.37 - * Contributor(s):
43.38 - *
43.39 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
43.40 - */
43.41 -package org.netbeans.modules.jackpot30.apisupport;
43.42 -
43.43 -import java.lang.reflect.Field;
43.44 -import java.lang.reflect.Method;
43.45 -import java.util.Set;
43.46 -import org.openide.modules.ModuleInstall;
43.47 -
43.48 -public class Installer extends ModuleInstall {
43.49 -
43.50 - @Override
43.51 - @SuppressWarnings("unchecked")
43.52 - public void validate() throws IllegalStateException {
43.53 - try {
43.54 - java.lang.Class main = java.lang.Class.forName("org.netbeans.core.startup.Main", false, //NOI18N
43.55 - Thread.currentThread().getContextClassLoader());
43.56 - Method getModuleSystem = main.getMethod("getModuleSystem", new Class[0]); //NOI18N
43.57 - Object moduleSystem = getModuleSystem.invoke(null, new Object[0]);
43.58 - Method getManager = moduleSystem.getClass().getMethod("getManager", new Class[0]); //NOI18N
43.59 - Object moduleManager = getManager.invoke(moduleSystem, new Object[0]);
43.60 - Method moduleMeth = moduleManager.getClass().getMethod("get", new Class[] {String.class}); //NOI18N
43.61 - Object persistence = moduleMeth.invoke(moduleManager, "org.netbeans.modules.apisupport.project"); //NOI18N
43.62 - if (persistence != null) {
43.63 - Field frField = persistence.getClass().getSuperclass().getDeclaredField("friendNames"); //NOI18N
43.64 - frField.setAccessible(true);
43.65 - Set friends = (Set)frField.get(persistence);
43.66 - friends.add("org.netbeans.modules.jackpot30.apisupport"); //NOI18N
43.67 - }
43.68 - } catch (Exception ex) {
43.69 - new IllegalStateException("Cannot fix dependencies for org.netbeans.modules.jackpot30.apisupport.", ex); //NOI18N
43.70 - }
43.71 - super.validate();
43.72 - }
43.73 -}
44.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/ProjectDependencyUpgraderMultiplexor.java Sat Feb 18 22:14:42 2012 +0100
44.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
44.3 @@ -1,63 +0,0 @@
44.4 -/*
44.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
44.6 - *
44.7 - * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
44.8 - *
44.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
44.10 - * Other names may be trademarks of their respective owners.
44.11 - *
44.12 - * The contents of this file are subject to the terms of either the GNU General
44.13 - * Public License Version 2 only ("GPL") or the Common Development and
44.14 - * Distribution License("CDDL") (collectively, the "License"). You may not use
44.15 - * this file except in compliance with the License. You can obtain a copy of the
44.16 - * License at http://www.netbeans.org/cddl-gplv2.html or
44.17 - * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
44.18 - * governing permissions and limitations under the License. When distributing
44.19 - * the software, include this License Header Notice in each file and include the
44.20 - * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
44.21 - * particular file as subject to the "Classpath" exception as provided by Oracle
44.22 - * in the GPL Version 2 section of the License file that accompanied this code.
44.23 - * If applicable, add the following below the License Header, with the fields
44.24 - * enclosed by brackets [] replaced by your own identifying information:
44.25 - * "Portions Copyrighted [year] [name of copyright owner]"
44.26 - *
44.27 - * If you wish your version of this file to be governed by only the CDDL or only
44.28 - * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
44.29 - * include this software in this distribution under the [CDDL or GPL Version 2]
44.30 - * license." If you do not indicate a single choice of license, a recipient has
44.31 - * the option to distribute your version of this file under either the CDDL, the
44.32 - * GPL Version 2 or to extend the choice of license to its licensees as provided
44.33 - * above. However, if you add GPL Version 2 code and therefore, elected the GPL
44.34 - * Version 2 license, then the option applies only if the new code is made
44.35 - * subject to such option by the copyright holder.
44.36 - *
44.37 - * Contributor(s):
44.38 - *
44.39 - * Portions Copyrighted 2011 Sun Microsystems, Inc.
44.40 - */
44.41 -package org.netbeans.modules.jackpot30.apisupport;
44.42 -
44.43 -import org.netbeans.api.project.Project;
44.44 -import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
44.45 -import org.openide.filesystems.FileObject;
44.46 -import org.openide.modules.SpecificationVersion;
44.47 -import org.openide.util.lookup.ServiceProvider;
44.48 -
44.49 -/**
44.50 - *
44.51 - * @author lahvac
44.52 - */
44.53 -@ServiceProvider(service=ProjectDependencyUpgrader.class)
44.54 -public class ProjectDependencyUpgraderMultiplexor extends ProjectDependencyUpgrader {
44.55 -
44.56 - @Override
44.57 - public boolean ensureDependency(Project p, FileObject dep, SpecificationVersion spec, boolean canShowUI) {
44.58 - return Utilities.UPGRADER.ensureDependency(p, dep, spec, canShowUI);
44.59 - }
44.60 -
44.61 - @Override
44.62 - public boolean ensureDependency(Project p, String specification, boolean b) {
44.63 - return Utilities.UPGRADER.ensureDependency(p, specification, b);
44.64 - }
44.65 -
44.66 -}
45.1 --- a/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Utilities.java Sat Feb 18 22:14:42 2012 +0100
45.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
45.3 @@ -1,88 +0,0 @@
45.4 -/*
45.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
45.6 - *
45.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
45.8 - *
45.9 - * The contents of this file are subject to the terms of either the GNU
45.10 - * General Public License Version 2 only ("GPL") or the Common
45.11 - * Development and Distribution License("CDDL") (collectively, the
45.12 - * "License"). You may not use this file except in compliance with the
45.13 - * License. You can obtain a copy of the License at
45.14 - * http://www.netbeans.org/cddl-gplv2.html
45.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
45.16 - * specific language governing permissions and limitations under the
45.17 - * License. When distributing the software, include this License Header
45.18 - * Notice in each file and include the License file at
45.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
45.20 - * particular file as subject to the "Classpath" exception as provided
45.21 - * by Sun in the GPL Version 2 section of the License file that
45.22 - * accompanied this code. If applicable, add the following below the
45.23 - * License Header, with the fields enclosed by brackets [] replaced by
45.24 - * your own identifying information:
45.25 - * "Portions Copyrighted [year] [name of copyright owner]"
45.26 - *
45.27 - * If you wish your version of this file to be governed by only the CDDL
45.28 - * or only the GPL Version 2, indicate your decision by adding
45.29 - * "[Contributor] elects to include this software in this distribution
45.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
45.31 - * single choice of license, a recipient has the option to distribute
45.32 - * your version of this file under either the CDDL, the GPL Version 2 or
45.33 - * to extend the choice of license to its licensees as provided above.
45.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
45.35 - * Version 2 license, then the option applies only if the new code is
45.36 - * made subject to such option by the copyright holder.
45.37 - *
45.38 - * Contributor(s):
45.39 - *
45.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
45.41 - */
45.42 -
45.43 -package org.netbeans.modules.jackpot30.apisupport;
45.44 -
45.45 -import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
45.46 -import org.openide.modules.SpecificationVersion;
45.47 -
45.48 -/**
45.49 - *
45.50 - * @author lahvac
45.51 - */
45.52 -public class Utilities {
45.53 -
45.54 - public static final ProjectDependencyUpgrader UPGRADER = Boolean.getBoolean("jackpot.upgrade.apisupport.use.api") ? new APIProjectDependencyUpgraderImpl() : new HackyProjectDependencyUpgraderImpl();
45.55 -
45.56 - public static ParsedDependency parseDependency(String spec) {
45.57 - String cnb;
45.58 - String releaseVersion;
45.59 - SpecificationVersion specVersion;
45.60 -
45.61 - String[] spaceSplit = spec.split(" ");
45.62 - String[] slashSplit = spaceSplit[0].split(" ");
45.63 -
45.64 - cnb = slashSplit[0];
45.65 -
45.66 - if (slashSplit.length > 1) {
45.67 - releaseVersion = slashSplit[1];
45.68 - } else {
45.69 - releaseVersion = null;
45.70 - }
45.71 -
45.72 - if (spaceSplit.length > 1) {
45.73 - specVersion = new SpecificationVersion(spaceSplit[1]);//XXX verify correct format
45.74 - } else {
45.75 - specVersion = null;
45.76 - }
45.77 -
45.78 - return new ParsedDependency(cnb, releaseVersion, specVersion);
45.79 - }
45.80 -
45.81 - public static class ParsedDependency {
45.82 - public final String cnb;
45.83 - public final String releaseVersion;
45.84 - public final SpecificationVersion specVersion;
45.85 - public ParsedDependency(String cnb, String releaseVersion, SpecificationVersion specVersion) {
45.86 - this.cnb = cnb;
45.87 - this.releaseVersion = releaseVersion;
45.88 - this.specVersion = specVersion;
45.89 - }
45.90 - }
45.91 -}
46.1 --- a/bridges/refactoring/build.xml Sat Feb 18 22:14:42 2012 +0100
46.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
46.3 @@ -1,9 +0,0 @@
46.4 -<?xml version="1.0" encoding="UTF-8"?>
46.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
46.6 -<!-- for some information on what you could do (e.g. targets to override). -->
46.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
46.8 -<project name="org.netbeans.modules.jackpot30.refactoring" default="netbeans" basedir=".">
46.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.refactoring.</description>
46.10 - <import file="nbproject/build-impl.xml"/>
46.11 - <import file="${suite.dir}/findbugs-import.xml"/>
46.12 -</project>
47.1 --- a/bridges/refactoring/manifest.mf Sat Feb 18 22:14:42 2012 +0100
47.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
47.3 @@ -1,6 +0,0 @@
47.4 -Manifest-Version: 1.0
47.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.refactoring
47.6 -OpenIDE-Module-Implementation-Version: 1
47.7 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/refactoring/layer.xml
47.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/refactoring/Bundle.properties
47.9 -
48.1 --- a/bridges/refactoring/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
48.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
48.3 @@ -1,45 +0,0 @@
48.4 -<?xml version="1.0" encoding="UTF-8"?>
48.5 -<!--
48.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
48.7 -*** EDIT ../build.xml INSTEAD ***
48.8 --->
48.9 -<project name="org.netbeans.modules.jackpot30.refactoring-impl" basedir="..">
48.10 - <fail message="Please build using Ant 1.7.1 or higher.">
48.11 - <condition>
48.12 - <not>
48.13 - <antversion atleast="1.7.1"/>
48.14 - </not>
48.15 - </condition>
48.16 - </fail>
48.17 - <property file="nbproject/private/suite-private.properties"/>
48.18 - <property file="nbproject/suite.properties"/>
48.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
48.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
48.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
48.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
48.23 - <attribute name="name"/>
48.24 - <attribute name="value"/>
48.25 - <sequential>
48.26 - <property name="@{name}" value="${@{value}}"/>
48.27 - </sequential>
48.28 - </macrodef>
48.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
48.30 - <attribute name="property"/>
48.31 - <attribute name="value"/>
48.32 - <sequential>
48.33 - <property name="@{property}" value="@{value}"/>
48.34 - </sequential>
48.35 - </macrodef>
48.36 - <property file="${user.properties.file}"/>
48.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
48.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
48.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
48.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
48.41 - <condition>
48.42 - <not>
48.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
48.44 - </not>
48.45 - </condition>
48.46 - </fail>
48.47 - <import file="${harness.dir}/build.xml"/>
48.48 -</project>
49.1 --- a/bridges/refactoring/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
49.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
49.3 @@ -1,8 +0,0 @@
49.4 -build.xml.data.CRC32=46e4f14a
49.5 -build.xml.script.CRC32=4a0f84c4
49.6 -build.xml.stylesheet.CRC32=79c3b980@1.39
49.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
49.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
49.9 -nbproject/build-impl.xml.data.CRC32=2e452477
49.10 -nbproject/build-impl.xml.script.CRC32=fd9920c9
49.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
50.1 --- a/bridges/refactoring/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
50.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
50.3 @@ -1,4 +0,0 @@
50.4 -is.eager=true
50.5 -javac.source=1.6
50.6 -javac.compilerargs=-Xlint -Xlint:-serial
50.7 -spec.version.base=1.16.0
51.1 --- a/bridges/refactoring/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
51.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
51.3 @@ -1,199 +0,0 @@
51.4 -<?xml version="1.0" encoding="UTF-8"?>
51.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
51.6 - <type>org.netbeans.modules.apisupport.project</type>
51.7 - <configuration>
51.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
51.9 - <code-name-base>org.netbeans.modules.jackpot30.refactoring</code-name-base>
51.10 - <suite-component/>
51.11 - <module-dependencies>
51.12 - <dependency>
51.13 - <code-name-base>org.netbeans.api.annotations.common</code-name-base>
51.14 - <build-prerequisite/>
51.15 - <compile-dependency/>
51.16 - <run-dependency>
51.17 - <release-version>1</release-version>
51.18 - <specification-version>1.4</specification-version>
51.19 - </run-dependency>
51.20 - </dependency>
51.21 - <dependency>
51.22 - <code-name-base>org.netbeans.api.java.classpath</code-name-base>
51.23 - <build-prerequisite/>
51.24 - <compile-dependency/>
51.25 - <run-dependency>
51.26 - <release-version>1</release-version>
51.27 - <specification-version>1.24</specification-version>
51.28 - </run-dependency>
51.29 - </dependency>
51.30 - <dependency>
51.31 - <code-name-base>org.netbeans.libs.javacapi</code-name-base>
51.32 - <build-prerequisite/>
51.33 - <compile-dependency/>
51.34 - <run-dependency>
51.35 - <specification-version>0.12.0.1</specification-version>
51.36 - </run-dependency>
51.37 - </dependency>
51.38 - <dependency>
51.39 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
51.40 - <build-prerequisite/>
51.41 - <compile-dependency/>
51.42 - <run-dependency>
51.43 - <specification-version>1.12</specification-version>
51.44 - </run-dependency>
51.45 - </dependency>
51.46 - <dependency>
51.47 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
51.48 - <build-prerequisite/>
51.49 - <compile-dependency/>
51.50 - <run-dependency>
51.51 - <release-version>1</release-version>
51.52 - <implementation-version/>
51.53 - </run-dependency>
51.54 - </dependency>
51.55 - <dependency>
51.56 - <code-name-base>org.netbeans.modules.java.source</code-name-base>
51.57 - <build-prerequisite/>
51.58 - <compile-dependency/>
51.59 - <run-dependency>
51.60 - <specification-version>0.57.0.9.8.4</specification-version>
51.61 - </run-dependency>
51.62 - </dependency>
51.63 - <dependency>
51.64 - <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
51.65 - <build-prerequisite/>
51.66 - <compile-dependency/>
51.67 - <run-dependency>
51.68 - <release-version>1</release-version>
51.69 - <specification-version>1.26.0.1.19</specification-version>
51.70 - </run-dependency>
51.71 - </dependency>
51.72 - <dependency>
51.73 - <code-name-base>org.netbeans.modules.queries</code-name-base>
51.74 - <build-prerequisite/>
51.75 - <compile-dependency/>
51.76 - <run-dependency>
51.77 - <release-version>1</release-version>
51.78 - <specification-version>1.18</specification-version>
51.79 - </run-dependency>
51.80 - </dependency>
51.81 - <dependency>
51.82 - <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
51.83 - <build-prerequisite/>
51.84 - <compile-dependency/>
51.85 - <run-dependency>
51.86 - <specification-version>1.10</specification-version>
51.87 - </run-dependency>
51.88 - </dependency>
51.89 - <dependency>
51.90 - <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
51.91 - <build-prerequisite/>
51.92 - <compile-dependency/>
51.93 - <run-dependency>
51.94 - <release-version>1</release-version>
51.95 - <implementation-version/>
51.96 - </run-dependency>
51.97 - </dependency>
51.98 - <dependency>
51.99 - <code-name-base>org.openide.awt</code-name-base>
51.100 - <build-prerequisite/>
51.101 - <compile-dependency/>
51.102 - <run-dependency>
51.103 - <specification-version>7.23</specification-version>
51.104 - </run-dependency>
51.105 - </dependency>
51.106 - <dependency>
51.107 - <code-name-base>org.openide.filesystems</code-name-base>
51.108 - <build-prerequisite/>
51.109 - <compile-dependency/>
51.110 - <run-dependency>
51.111 - <specification-version>7.36</specification-version>
51.112 - </run-dependency>
51.113 - </dependency>
51.114 - <dependency>
51.115 - <code-name-base>org.openide.loaders</code-name-base>
51.116 - <build-prerequisite/>
51.117 - <compile-dependency/>
51.118 - <run-dependency>
51.119 - <specification-version>7.16</specification-version>
51.120 - </run-dependency>
51.121 - </dependency>
51.122 - <dependency>
51.123 - <code-name-base>org.openide.nodes</code-name-base>
51.124 - <build-prerequisite/>
51.125 - <compile-dependency/>
51.126 - <run-dependency>
51.127 - <specification-version>7.16</specification-version>
51.128 - </run-dependency>
51.129 - </dependency>
51.130 - <dependency>
51.131 - <code-name-base>org.openide.text</code-name-base>
51.132 - <build-prerequisite/>
51.133 - <compile-dependency/>
51.134 - <run-dependency>
51.135 - <specification-version>6.29</specification-version>
51.136 - </run-dependency>
51.137 - </dependency>
51.138 - <dependency>
51.139 - <code-name-base>org.openide.util</code-name-base>
51.140 - <build-prerequisite/>
51.141 - <compile-dependency/>
51.142 - <run-dependency>
51.143 - <specification-version>8.2</specification-version>
51.144 - </run-dependency>
51.145 - </dependency>
51.146 - <dependency>
51.147 - <code-name-base>org.openide.util.lookup</code-name-base>
51.148 - <build-prerequisite/>
51.149 - <compile-dependency/>
51.150 - <run-dependency>
51.151 - <specification-version>8.2</specification-version>
51.152 - </run-dependency>
51.153 - </dependency>
51.154 - <dependency>
51.155 - <code-name-base>org.openide.windows</code-name-base>
51.156 - <build-prerequisite/>
51.157 - <compile-dependency/>
51.158 - <run-dependency>
51.159 - <specification-version>6.33</specification-version>
51.160 - </run-dependency>
51.161 - </dependency>
51.162 - </module-dependencies>
51.163 - <test-dependencies>
51.164 - <test-type>
51.165 - <name>unit</name>
51.166 - <test-dependency>
51.167 - <code-name-base>org.netbeans.libs.junit4</code-name-base>
51.168 - <compile-dependency/>
51.169 - </test-dependency>
51.170 - <test-dependency>
51.171 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
51.172 - <recursive/>
51.173 - <compile-dependency/>
51.174 - <test/>
51.175 - </test-dependency>
51.176 - <test-dependency>
51.177 - <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
51.178 - <compile-dependency/>
51.179 - </test-dependency>
51.180 - <test-dependency>
51.181 - <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
51.182 - <compile-dependency/>
51.183 - </test-dependency>
51.184 - <test-dependency>
51.185 - <code-name-base>org.netbeans.modules.junit</code-name-base>
51.186 - <compile-dependency/>
51.187 - </test-dependency>
51.188 - <test-dependency>
51.189 - <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
51.190 - <recursive/>
51.191 - <compile-dependency/>
51.192 - </test-dependency>
51.193 - <test-dependency>
51.194 - <code-name-base>org.netbeans.modules.projectui</code-name-base>
51.195 - <compile-dependency/>
51.196 - </test-dependency>
51.197 - </test-type>
51.198 - </test-dependencies>
51.199 - <public-packages/>
51.200 - </data>
51.201 - </configuration>
51.202 -</project>
52.1 --- a/bridges/refactoring/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
52.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
52.3 @@ -1,1 +0,0 @@
52.4 -suite.dir=${basedir}/../..
53.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
53.3 @@ -1,4 +0,0 @@
53.4 -OpenIDE-Module-Name=Jackpot 3.0 Refactoring Bridge
53.5 -GenerateScriptPanel.generate.text=Generate Jackpot script for automatic upgrade
53.6 -GenerateScriptPanel.makePrivate.text=Make existing element private
53.7 -GenerateScriptPanel.deprecate.text=Deprecate existing element
54.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ExtraData.java Sat Feb 18 22:14:42 2012 +0100
54.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
54.3 @@ -1,58 +0,0 @@
54.4 -/*
54.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
54.6 - *
54.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
54.8 - *
54.9 - * The contents of this file are subject to the terms of either the GNU
54.10 - * General Public License Version 2 only ("GPL") or the Common
54.11 - * Development and Distribution License("CDDL") (collectively, the
54.12 - * "License"). You may not use this file except in compliance with the
54.13 - * License. You can obtain a copy of the License at
54.14 - * http://www.netbeans.org/cddl-gplv2.html
54.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
54.16 - * specific language governing permissions and limitations under the
54.17 - * License. When distributing the software, include this License Header
54.18 - * Notice in each file and include the License file at
54.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
54.20 - * particular file as subject to the "Classpath" exception as provided
54.21 - * by Sun in the GPL Version 2 section of the License file that
54.22 - * accompanied this code. If applicable, add the following below the
54.23 - * License Header, with the fields enclosed by brackets [] replaced by
54.24 - * your own identifying information:
54.25 - * "Portions Copyrighted [year] [name of copyright owner]"
54.26 - *
54.27 - * If you wish your version of this file to be governed by only the CDDL
54.28 - * or only the GPL Version 2, indicate your decision by adding
54.29 - * "[Contributor] elects to include this software in this distribution
54.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
54.31 - * single choice of license, a recipient has the option to distribute
54.32 - * your version of this file under either the CDDL, the GPL Version 2 or
54.33 - * to extend the choice of license to its licensees as provided above.
54.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
54.35 - * Version 2 license, then the option applies only if the new code is
54.36 - * made subject to such option by the copyright holder.
54.37 - *
54.38 - * Contributor(s):
54.39 - *
54.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
54.41 - */
54.42 -
54.43 -package org.netbeans.modules.jackpot30.refactoring;
54.44 -
54.45 -/**
54.46 - *
54.47 - * @author lahvac
54.48 - */
54.49 -public final class ExtraData {
54.50 -
54.51 - public final boolean generateUpgradeScript;
54.52 - public final boolean makeOriginalPrivate;
54.53 - public final boolean makeOriginalDeprecated;
54.54 -
54.55 - public ExtraData(boolean generateUpgradeScript, boolean makeOriginalPrivate, boolean makeOriginalDeprecated) {
54.56 - this.generateUpgradeScript = generateUpgradeScript;
54.57 - this.makeOriginalPrivate = makeOriginalPrivate;
54.58 - this.makeOriginalDeprecated = makeOriginalDeprecated;
54.59 - }
54.60 -
54.61 -}
55.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.form Sat Feb 18 22:14:42 2012 +0100
55.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
55.3 @@ -1,77 +0,0 @@
55.4 -<?xml version="1.0" encoding="UTF-8" ?>
55.5 -
55.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
55.7 - <AuxValues>
55.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
55.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
55.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
55.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
55.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
55.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
55.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
55.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
55.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
55.17 - </AuxValues>
55.18 -
55.19 - <Layout>
55.20 - <DimensionLayout dim="0">
55.21 - <Group type="103" groupAlignment="0" attributes="0">
55.22 - <Group type="102" attributes="0">
55.23 - <Group type="103" groupAlignment="0" attributes="0">
55.24 - <Group type="102" alignment="0" attributes="0">
55.25 - <EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
55.26 - <Group type="103" groupAlignment="0" attributes="0">
55.27 - <Component id="deprecate" alignment="0" min="-2" max="-2" attributes="0"/>
55.28 - <Component id="makePrivate" alignment="0" min="-2" max="-2" attributes="0"/>
55.29 - </Group>
55.30 - </Group>
55.31 - <Group type="102" alignment="0" attributes="0">
55.32 - <EmptySpace max="-2" attributes="0"/>
55.33 - <Component id="generate" min="-2" max="-2" attributes="0"/>
55.34 - </Group>
55.35 - </Group>
55.36 - <EmptySpace pref="79" max="32767" attributes="0"/>
55.37 - </Group>
55.38 - </Group>
55.39 - </DimensionLayout>
55.40 - <DimensionLayout dim="1">
55.41 - <Group type="103" groupAlignment="0" attributes="0">
55.42 - <Group type="102" alignment="0" attributes="0">
55.43 - <EmptySpace max="-2" attributes="0"/>
55.44 - <Component id="generate" min="-2" max="-2" attributes="0"/>
55.45 - <EmptySpace max="-2" attributes="0"/>
55.46 - <Component id="makePrivate" min="-2" max="-2" attributes="0"/>
55.47 - <EmptySpace max="-2" attributes="0"/>
55.48 - <Component id="deprecate" min="-2" max="-2" attributes="0"/>
55.49 - <EmptySpace pref="223" max="32767" attributes="0"/>
55.50 - </Group>
55.51 - </Group>
55.52 - </DimensionLayout>
55.53 - </Layout>
55.54 - <SubComponents>
55.55 - <Component class="javax.swing.JCheckBox" name="generate">
55.56 - <Properties>
55.57 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55.58 - <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.generate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
55.59 - </Property>
55.60 - </Properties>
55.61 - <Events>
55.62 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateActionPerformed"/>
55.63 - </Events>
55.64 - </Component>
55.65 - <Component class="javax.swing.JCheckBox" name="makePrivate">
55.66 - <Properties>
55.67 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55.68 - <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.makePrivate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
55.69 - </Property>
55.70 - </Properties>
55.71 - </Component>
55.72 - <Component class="javax.swing.JCheckBox" name="deprecate">
55.73 - <Properties>
55.74 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55.75 - <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.deprecate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
55.76 - </Property>
55.77 - </Properties>
55.78 - </Component>
55.79 - </SubComponents>
55.80 -</Form>
56.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.java Sat Feb 18 22:14:42 2012 +0100
56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
56.3 @@ -1,174 +0,0 @@
56.4 -/*
56.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
56.6 - *
56.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
56.8 - *
56.9 - * The contents of this file are subject to the terms of either the GNU
56.10 - * General Public License Version 2 only ("GPL") or the Common
56.11 - * Development and Distribution License("CDDL") (collectively, the
56.12 - * "License"). You may not use this file except in compliance with the
56.13 - * License. You can obtain a copy of the License at
56.14 - * http://www.netbeans.org/cddl-gplv2.html
56.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
56.16 - * specific language governing permissions and limitations under the
56.17 - * License. When distributing the software, include this License Header
56.18 - * Notice in each file and include the License file at
56.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
56.20 - * particular file as subject to the "Classpath" exception as provided
56.21 - * by Sun in the GPL Version 2 section of the License file that
56.22 - * accompanied this code. If applicable, add the following below the
56.23 - * License Header, with the fields enclosed by brackets [] replaced by
56.24 - * your own identifying information:
56.25 - * "Portions Copyrighted [year] [name of copyright owner]"
56.26 - *
56.27 - * If you wish your version of this file to be governed by only the CDDL
56.28 - * or only the GPL Version 2, indicate your decision by adding
56.29 - * "[Contributor] elects to include this software in this distribution
56.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
56.31 - * single choice of license, a recipient has the option to distribute
56.32 - * your version of this file under either the CDDL, the GPL Version 2 or
56.33 - * to extend the choice of license to its licensees as provided above.
56.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
56.35 - * Version 2 license, then the option applies only if the new code is
56.36 - * made subject to such option by the copyright holder.
56.37 - *
56.38 - * Contributor(s):
56.39 - *
56.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
56.41 - */
56.42 -package org.netbeans.modules.jackpot30.refactoring;
56.43 -
56.44 -import java.util.prefs.Preferences;
56.45 -import org.openide.util.NbPreferences;
56.46 -
56.47 -/**
56.48 - *
56.49 - * @author lahvac
56.50 - */
56.51 -public class GenerateScriptPanel extends javax.swing.JPanel {
56.52 -
56.53 - private final boolean supported;
56.54 -
56.55 - public GenerateScriptPanel(boolean supported) {
56.56 - this.supported = supported;
56.57 - initComponents();
56.58 - loadDefaults();
56.59 - }
56.60 -
56.61 - /** This method is called from within the constructor to
56.62 - * initialize the form.
56.63 - * WARNING: Do NOT modify this code. The content of this method is
56.64 - * always regenerated by the Form Editor.
56.65 - */
56.66 - @SuppressWarnings("unchecked")
56.67 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
56.68 - private void initComponents() {
56.69 -
56.70 - generate = new javax.swing.JCheckBox();
56.71 - makePrivate = new javax.swing.JCheckBox();
56.72 - deprecate = new javax.swing.JCheckBox();
56.73 -
56.74 - generate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.generate.text")); // NOI18N
56.75 - generate.addActionListener(new java.awt.event.ActionListener() {
56.76 - public void actionPerformed(java.awt.event.ActionEvent evt) {
56.77 - generateActionPerformed(evt);
56.78 - }
56.79 - });
56.80 -
56.81 - makePrivate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.makePrivate.text")); // NOI18N
56.82 -
56.83 - deprecate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.deprecate.text")); // NOI18N
56.84 -
56.85 - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
56.86 - this.setLayout(layout);
56.87 - layout.setHorizontalGroup(
56.88 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
56.89 - .addGroup(layout.createSequentialGroup()
56.90 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
56.91 - .addGroup(layout.createSequentialGroup()
56.92 - .addGap(29, 29, 29)
56.93 - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
56.94 - .addComponent(deprecate)
56.95 - .addComponent(makePrivate)))
56.96 - .addGroup(layout.createSequentialGroup()
56.97 - .addContainerGap()
56.98 - .addComponent(generate)))
56.99 - .addContainerGap(79, Short.MAX_VALUE))
56.100 - );
56.101 - layout.setVerticalGroup(
56.102 - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
56.103 - .addGroup(layout.createSequentialGroup()
56.104 - .addContainerGap()
56.105 - .addComponent(generate)
56.106 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
56.107 - .addComponent(makePrivate)
56.108 - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
56.109 - .addComponent(deprecate)
56.110 - .addContainerGap(223, Short.MAX_VALUE))
56.111 - );
56.112 - }// </editor-fold>//GEN-END:initComponents
56.113 -
56.114 - private void generateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateActionPerformed
56.115 - updateState();
56.116 - }//GEN-LAST:event_generateActionPerformed
56.117 -
56.118 - private static final String KEY_DO_GENERATE_SCRIPT = "generate-script";
56.119 - private static final boolean DEF_DO_GENERATE_SCRIPT = true;
56.120 - private static final String KEY_MAKE_PRIVATE = "make-private";
56.121 - private static final boolean DEF_MAKE_PRIVATE = true;
56.122 - private static final String KEY_DEPRECATE = "deprecate";
56.123 - private static final boolean DEF_DEPRECATE = false;
56.124 -
56.125 - private Preferences getPreferencesStorage() {
56.126 - return NbPreferences.forModule(GenerateScriptPanel.class).node(GenerateScriptPanel.class.getSimpleName());
56.127 - }
56.128 -
56.129 - private void loadDefaults() {
56.130 - if (supported) {
56.131 - Preferences p = getPreferencesStorage();
56.132 - generate.setSelected(p.getBoolean(KEY_DO_GENERATE_SCRIPT, DEF_DO_GENERATE_SCRIPT));
56.133 - makePrivate.setSelected(p.getBoolean(KEY_MAKE_PRIVATE, DEF_MAKE_PRIVATE));
56.134 - deprecate.setSelected(p.getBoolean(KEY_DEPRECATE, DEF_DEPRECATE));
56.135 - } else {
56.136 - generate.setSelected(false);
56.137 - makePrivate.setSelected(false);
56.138 - deprecate.setSelected(false);
56.139 - }
56.140 -
56.141 - updateState();
56.142 - }
56.143 -
56.144 - public void saveDefaults() {
56.145 - Preferences p = getPreferencesStorage();
56.146 - boolean doGenerate = generate.isSelected();
56.147 -
56.148 - p.putBoolean(KEY_DO_GENERATE_SCRIPT, doGenerate);
56.149 -
56.150 - if (doGenerate) {
56.151 - p.putBoolean(KEY_MAKE_PRIVATE, makePrivate.isSelected());
56.152 - p.putBoolean(KEY_DEPRECATE, deprecate.isSelected());
56.153 - }
56.154 - }
56.155 -
56.156 - private void updateState() {
56.157 - if (supported) {
56.158 - generate.setEnabled(true);
56.159 - makePrivate.setEnabled(generate.isSelected());
56.160 - deprecate.setEnabled(generate.isSelected());
56.161 - } else {
56.162 - generate.setEnabled(false);
56.163 - makePrivate.setEnabled(false);
56.164 - deprecate.setEnabled(false);
56.165 - }
56.166 - }
56.167 -
56.168 - // Variables declaration - do not modify//GEN-BEGIN:variables
56.169 - private javax.swing.JCheckBox deprecate;
56.170 - private javax.swing.JCheckBox generate;
56.171 - private javax.swing.JCheckBox makePrivate;
56.172 - // End of variables declaration//GEN-END:variables
56.173 -
56.174 - public ExtraData getData() {
56.175 - return new ExtraData(generate.isSelected(), makePrivate.isSelected(), deprecate.isSelected());
56.176 - }
56.177 -}
57.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringActionsProviderExt.java Sat Feb 18 22:14:42 2012 +0100
57.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
57.3 @@ -1,238 +0,0 @@
57.4 -/*
57.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
57.6 - *
57.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
57.8 - *
57.9 - * The contents of this file are subject to the terms of either the GNU
57.10 - * General Public License Version 2 only ("GPL") or the Common
57.11 - * Development and Distribution License("CDDL") (collectively, the
57.12 - * "License"). You may not use this file except in compliance with the
57.13 - * License. You can obtain a copy of the License at
57.14 - * http://www.netbeans.org/cddl-gplv2.html
57.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
57.16 - * specific language governing permissions and limitations under the
57.17 - * License. When distributing the software, include this License Header
57.18 - * Notice in each file and include the License file at
57.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
57.20 - * particular file as subject to the "Classpath" exception as provided
57.21 - * by Sun in the GPL Version 2 section of the License file that
57.22 - * accompanied this code. If applicable, add the following below the
57.23 - * License Header, with the fields enclosed by brackets [] replaced by
57.24 - * your own identifying information:
57.25 - * "Portions Copyrighted [year] [name of copyright owner]"
57.26 - *
57.27 - * If you wish your version of this file to be governed by only the CDDL
57.28 - * or only the GPL Version 2, indicate your decision by adding
57.29 - * "[Contributor] elects to include this software in this distribution
57.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
57.31 - * single choice of license, a recipient has the option to distribute
57.32 - * your version of this file under either the CDDL, the GPL Version 2 or
57.33 - * to extend the choice of license to its licensees as provided above.
57.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
57.35 - * Version 2 license, then the option applies only if the new code is
57.36 - * made subject to such option by the copyright holder.
57.37 - *
57.38 - * Contributor(s):
57.39 - *
57.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
57.41 - */
57.42 -package org.netbeans.modules.jackpot30.refactoring;
57.43 -
57.44 -import java.util.Collection;
57.45 -import java.util.HashSet;
57.46 -import java.util.logging.Logger;
57.47 -import javax.lang.model.element.Element;
57.48 -import javax.lang.model.element.ElementKind;
57.49 -import javax.lang.model.element.ExecutableElement;
57.50 -import javax.lang.model.element.VariableElement;
57.51 -import javax.lang.model.type.TypeKind;
57.52 -import org.netbeans.api.java.source.CompilationInfo;
57.53 -import org.netbeans.api.java.source.TreePathHandle;
57.54 -import org.netbeans.api.java.source.ui.ScanDialog;
57.55 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringUI;
57.56 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringUI;
57.57 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
57.58 -import org.netbeans.modules.refactoring.java.RefactoringUtils;
57.59 -import org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider;
57.60 -import org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider;
57.61 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
57.62 -import org.openide.cookies.EditorCookie;
57.63 -import org.openide.filesystems.FileObject;
57.64 -import org.openide.loaders.DataObject;
57.65 -import org.openide.nodes.Node;
57.66 -import org.openide.text.CloneableEditorSupport;
57.67 -import org.openide.util.Lookup;
57.68 -import org.openide.util.lookup.ServiceProvider;
57.69 -import org.openide.windows.TopComponent;
57.70 -
57.71 -
57.72 -/**
57.73 - *
57.74 - * @author lahvac
57.75 - */
57.76 -@ServiceProvider(service=ActionsImplementationProvider.class, supersedes="org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider")
57.77 -public class RefactoringActionsProviderExt extends RefactoringActionsProvider {
57.78 -
57.79 - private static RefactoringUI doReplaceConstructorImpl(TreePathHandle selectedElement, CompilationInfo info) {
57.80 - Element selected = selectedElement.resolveElement(info);
57.81 - if (selected==null) {
57.82 -// logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
57.83 - return null;
57.84 - }
57.85 - if (selected.getKind() == ElementKind.CONSTRUCTOR) {
57.86 - return new ReplaceConstructorRefactoringUI(selectedElement);
57.87 - }
57.88 -
57.89 - return null;
57.90 - }
57.91 -
57.92 - public static void doReplaceConstructor(final Lookup lookup) {
57.93 - Runnable task;
57.94 - EditorCookie ec = lookup.lookup(EditorCookie.class);
57.95 - if (isFromEditor(ec)) {
57.96 - task = new TextComponentTask(ec) {
57.97 - @Override
57.98 - protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
57.99 - return doReplaceConstructorImpl(selectedElement, info);
57.100 - }
57.101 - };
57.102 - } else {
57.103 - task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
57.104 -
57.105 - RefactoringUI ui;
57.106 -
57.107 - @Override
57.108 - protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
57.109 - ui = doReplaceConstructorImpl(handle, javac);
57.110 - }
57.111 -
57.112 - @Override
57.113 - protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
57.114 - return ui;
57.115 - }
57.116 -
57.117 - };
57.118 - }
57.119 -
57.120 - ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
57.121 - }
57.122 -
57.123 - private static RefactoringUI doInvertBooleanImpl(TreePathHandle selectedElement, CompilationInfo info) {
57.124 - Element selected = selectedElement.resolveElement(info);
57.125 - if (selected==null) {
57.126 -// logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
57.127 - return null;
57.128 - }
57.129 - if (selected.getKind().isField() && ((VariableElement) selected).asType().getKind() == TypeKind.BOOLEAN) {
57.130 - return new InvertBooleanRefactoringUI(selectedElement, ((VariableElement) selected).getSimpleName().toString());
57.131 - }
57.132 - if (selected.getKind() == ElementKind.METHOD && ((ExecutableElement) selected).getReturnType().getKind() == TypeKind.BOOLEAN) {
57.133 - return new InvertBooleanRefactoringUI(selectedElement, ((ExecutableElement) selected).getSimpleName().toString());
57.134 - }
57.135 -
57.136 - return null;
57.137 - }
57.138 -
57.139 - public static void doInvertBoolean(final Lookup lookup) {
57.140 - Runnable task;
57.141 - EditorCookie ec = lookup.lookup(EditorCookie.class);
57.142 - if (isFromEditor(ec)) {
57.143 - task = new TextComponentTask(ec) {
57.144 - @Override
57.145 - protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
57.146 - return doInvertBooleanImpl(selectedElement, info);
57.147 - }
57.148 - };
57.149 - } else {
57.150 - task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
57.151 -
57.152 - RefactoringUI ui;
57.153 -
57.154 - @Override
57.155 - protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
57.156 - ui = doInvertBooleanImpl(handle, javac);
57.157 - }
57.158 -
57.159 - @Override
57.160 - protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
57.161 - return ui;
57.162 - }
57.163 -
57.164 - };
57.165 - }
57.166 -
57.167 - ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
57.168 - }
57.169 -
57.170 -// static String getActionName(Action action) {
57.171 -// String arg = (String) action.getValue(Action.NAME);
57.172 -// arg = arg.replace("&", ""); // NOI18N
57.173 -// return arg.replace("...", ""); // NOI18N
57.174 -// }
57.175 -
57.176 -
57.177 - public static boolean canReplaceConstructor(Lookup lookup) {
57.178 - return canRefactor(lookup);
57.179 - }
57.180 -
57.181 - public static boolean canInvertBoolean(Lookup lookup) {
57.182 - return canRefactor(lookup);
57.183 - }
57.184 -
57.185 - private static boolean canRefactor(Lookup lookup) {
57.186 - Collection<? extends Node> nodes = new HashSet<Node>(lookup.lookupAll(Node.class));
57.187 - if(nodes.size() != 1)
57.188 - return false;
57.189 - Node node = nodes.iterator().next();
57.190 - TreePathHandle tph = node.getLookup().lookup(TreePathHandle.class);
57.191 - if (tph != null) {
57.192 - return RefactoringUtils.isRefactorable(tph.getFileObject());
57.193 - }
57.194 - DataObject dObj = node.getCookie(DataObject.class);
57.195 - if(null == dObj)
57.196 - return false;
57.197 - FileObject fileObj = dObj.getPrimaryFile();
57.198 - if(null == fileObj || !RefactoringUtils.isRefactorable(fileObj))
57.199 - return false;
57.200 -
57.201 - EditorCookie ec = lookup.lookup(EditorCookie.class);
57.202 - if (isFromEditor(ec)) {
57.203 - return true;
57.204 - }
57.205 - return false;
57.206 - }
57.207 -
57.208 - @Override
57.209 - protected RefactoringUI wrap(RefactoringUI orig) {
57.210 - if (orig.getRefactoring() instanceof RenameRefactoring) {
57.211 - return new RenameRefactoringWrapper(orig, ((RenameRefactoring) orig.getRefactoring()));
57.212 - }
57.213 -
57.214 - return super.wrap(orig);
57.215 - }
57.216 -
57.217 -
57.218 - //XXX: copied from RefactoringActionsProvider:\
57.219 - static boolean isFromEditor(EditorCookie ec) {
57.220 - if (ec != null && ec.getOpenedPanes() != null) {
57.221 - TopComponent activetc = TopComponent.getRegistry().getActivated();
57.222 - if (activetc instanceof CloneableEditorSupport.Pane) {
57.223 - return true;
57.224 - }
57.225 - }
57.226 - return false;
57.227 - }
57.228 -
57.229 - static boolean nodeHandle(Lookup lookup) {
57.230 - Node n = lookup.lookup(Node.class);
57.231 - if (n!=null) {
57.232 - if (n.getLookup().lookup(TreePathHandle.class)!=null)
57.233 - return true;
57.234 - }
57.235 - return false;
57.236 - }
57.237 -
57.238 - private static Logger logger() {
57.239 - return Logger.getLogger(RefactoringActionsProvider.class.getName());
57.240 - }
57.241 -}
58.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringElementImpl.java Sat Feb 18 22:14:42 2012 +0100
58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
58.3 @@ -1,227 +0,0 @@
58.4 -/*
58.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
58.6 - *
58.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
58.8 - *
58.9 - * The contents of this file are subject to the terms of either the GNU
58.10 - * General Public License Version 2 only ("GPL") or the Common
58.11 - * Development and Distribution License("CDDL") (collectively, the
58.12 - * "License"). You may not use this file except in compliance with the
58.13 - * License. You can obtain a copy of the License at
58.14 - * http://www.netbeans.org/cddl-gplv2.html
58.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
58.16 - * specific language governing permissions and limitations under the
58.17 - * License. When distributing the software, include this License Header
58.18 - * Notice in each file and include the License file at
58.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
58.20 - * particular file as subject to the "Classpath" exception as provided
58.21 - * by Sun in the GPL Version 2 section of the License file that
58.22 - * accompanied this code. If applicable, add the following below the
58.23 - * License Header, with the fields enclosed by brackets [] replaced by
58.24 - * your own identifying information:
58.25 - * "Portions Copyrighted [year] [name of copyright owner]"
58.26 - *
58.27 - * If you wish your version of this file to be governed by only the CDDL
58.28 - * or only the GPL Version 2, indicate your decision by adding
58.29 - * "[Contributor] elects to include this software in this distribution
58.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
58.31 - * single choice of license, a recipient has the option to distribute
58.32 - * your version of this file under either the CDDL, the GPL Version 2 or
58.33 - * to extend the choice of license to its licensees as provided above.
58.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
58.35 - * Version 2 license, then the option applies only if the new code is
58.36 - * made subject to such option by the copyright holder.
58.37 - *
58.38 - * Contributor(s):
58.39 - *
58.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
58.41 - */
58.42 -
58.43 -package org.netbeans.modules.jackpot30.refactoring;
58.44 -
58.45 -import java.io.File;
58.46 -import java.io.FileInputStream;
58.47 -import java.io.IOException;
58.48 -import java.io.InputStreamReader;
58.49 -import java.io.OutputStreamWriter;
58.50 -import java.io.Reader;
58.51 -import java.io.Writer;
58.52 -import java.nio.charset.Charset;
58.53 -import org.netbeans.api.queries.FileEncodingQuery;
58.54 -import org.netbeans.modules.refactoring.spi.BackupFacility;
58.55 -import org.netbeans.modules.refactoring.spi.BackupFacility.Handle;
58.56 -import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImplementation;
58.57 -import org.openide.filesystems.FileObject;
58.58 -import org.openide.filesystems.FileUtil;
58.59 -import org.openide.text.PositionBounds;
58.60 -import org.openide.util.Exceptions;
58.61 -import org.openide.util.Lookup;
58.62 -
58.63 -/**
58.64 - *
58.65 - * @author lahvac
58.66 - */
58.67 -public class RefactoringElementImpl extends SimpleRefactoringElementImplementation {
58.68 -
58.69 - private final File target;
58.70 - private final String rule;
58.71 -
58.72 - public RefactoringElementImpl(File target, String rule) {
58.73 - this.target = target;
58.74 - this.rule = rule;
58.75 - }
58.76 -
58.77 - @Override
58.78 - public String getText() {
58.79 - return "Jackpot 3.0 rule";
58.80 - }
58.81 -
58.82 - @Override
58.83 - public String getDisplayText() {
58.84 - return "Jackpot 3.0 rule";
58.85 - }
58.86 -
58.87 - private Handle backup;
58.88 -
58.89 - @Override
58.90 - public void performChange() {
58.91 - try {
58.92 - FileObject fo = FileUtil.toFileObject(target);
58.93 - Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
58.94 - String current;
58.95 -
58.96 - if (fo != null) {
58.97 - backup = BackupFacility.getDefault().backup(fo);
58.98 - current = read(target, encoding).toString();
58.99 - } else {
58.100 - if (!target.exists()) {
58.101 - backup = new Handle() {
58.102 - @Override
58.103 - public void restore() throws IOException {
58.104 - FileObject fo = FileUtil.toFileObject(target);
58.105 -
58.106 - fo.delete();
58.107 - }
58.108 - };
58.109 - current = "";
58.110 - } else {
58.111 - //XXX: log
58.112 - current = read(target, encoding).toString();
58.113 - }
58.114 - }
58.115 -
58.116 - current += rule;
58.117 - current += "\n";
58.118 -
58.119 - write(target, encoding, current);
58.120 - } catch (IOException ex) {
58.121 - Exceptions.printStackTrace(ex);
58.122 - }
58.123 - }
58.124 -
58.125 - @Override
58.126 - public void undoChange() {
58.127 - if (backup != null) {
58.128 - try {
58.129 - backup.restore();
58.130 - } catch (IOException ex) {
58.131 - Exceptions.printStackTrace(ex);
58.132 - }
58.133 - }
58.134 - backup = null;
58.135 - }
58.136 -
58.137 - @Override
58.138 - protected String getNewFileContent() {
58.139 - try {
58.140 - Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
58.141 - String current;
58.142 -
58.143 - if (!target.exists()) {
58.144 - current = "";
58.145 - } else {
58.146 - //XXX: log
58.147 - current = read(target, encoding).toString();
58.148 - }
58.149 -
58.150 - current += rule;
58.151 - current += "\n";
58.152 -
58.153 - return current;
58.154 - } catch (IOException ex) {
58.155 - Exceptions.printStackTrace(ex);
58.156 - return null;
58.157 - }
58.158 - }
58.159 -
58.160 - @Override
58.161 - public Lookup getLookup() {
58.162 - return Lookup.EMPTY;
58.163 - }
58.164 -
58.165 - @Override
58.166 - public FileObject getParentFile() {
58.167 - File f = target;
58.168 -
58.169 - while (true) {
58.170 - FileObject fo = FileUtil.toFileObject(f);
58.171 -
58.172 - if (fo != null) {
58.173 - return fo;
58.174 - }
58.175 -
58.176 - f = f.getParentFile();
58.177 - }
58.178 - }
58.179 -
58.180 - @Override
58.181 - public PositionBounds getPosition() {
58.182 - //XXX:
58.183 - return null;
58.184 - }
58.185 -
58.186 - private CharSequence read(File f, Charset encoding) throws IOException {
58.187 - Reader in = null;
58.188 - StringBuilder result = new StringBuilder();
58.189 -
58.190 - try {
58.191 - in = new InputStreamReader(new FileInputStream(f), encoding);
58.192 -
58.193 - int r;
58.194 -
58.195 - while ((r = in.read()) != (-1)) {
58.196 - result.append((char) r);
58.197 - }
58.198 - } finally {
58.199 - if (in != null) {
58.200 - try {
58.201 - in.close();
58.202 - } catch (IOException ex) {
58.203 - Exceptions.printStackTrace(ex);
58.204 - }
58.205 - }
58.206 - }
58.207 -
58.208 - return result;
58.209 - }
58.210 -
58.211 - private void write(File f, Charset encoding, CharSequence text) throws IOException {
58.212 - Writer out = null;
58.213 -
58.214 - try {
58.215 - FileObject fo = FileUtil.createData(f);
58.216 - out = new OutputStreamWriter(fo.getOutputStream(), encoding);
58.217 -
58.218 - out.write(text.toString());
58.219 - } finally {
58.220 - if (out != null) {
58.221 - try {
58.222 - out.close();
58.223 - } catch (IOException ex) {
58.224 - Exceptions.printStackTrace(ex);
58.225 - }
58.226 - }
58.227 - }
58.228 - }
58.229 -
58.230 -}
59.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringPluginFactoryImpl.java Sat Feb 18 22:14:42 2012 +0100
59.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
59.3 @@ -1,75 +0,0 @@
59.4 -/*
59.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
59.6 - *
59.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
59.8 - *
59.9 - * The contents of this file are subject to the terms of either the GNU
59.10 - * General Public License Version 2 only ("GPL") or the Common
59.11 - * Development and Distribution License("CDDL") (collectively, the
59.12 - * "License"). You may not use this file except in compliance with the
59.13 - * License. You can obtain a copy of the License at
59.14 - * http://www.netbeans.org/cddl-gplv2.html
59.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
59.16 - * specific language governing permissions and limitations under the
59.17 - * License. When distributing the software, include this License Header
59.18 - * Notice in each file and include the License file at
59.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
59.20 - * particular file as subject to the "Classpath" exception as provided
59.21 - * by Sun in the GPL Version 2 section of the License file that
59.22 - * accompanied this code. If applicable, add the following below the
59.23 - * License Header, with the fields enclosed by brackets [] replaced by
59.24 - * your own identifying information:
59.25 - * "Portions Copyrighted [year] [name of copyright owner]"
59.26 - *
59.27 - * If you wish your version of this file to be governed by only the CDDL
59.28 - * or only the GPL Version 2, indicate your decision by adding
59.29 - * "[Contributor] elects to include this software in this distribution
59.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
59.31 - * single choice of license, a recipient has the option to distribute
59.32 - * your version of this file under either the CDDL, the GPL Version 2 or
59.33 - * to extend the choice of license to its licensees as provided above.
59.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
59.35 - * Version 2 license, then the option applies only if the new code is
59.36 - * made subject to such option by the copyright holder.
59.37 - *
59.38 - * Contributor(s):
59.39 - *
59.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
59.41 - */
59.42 -
59.43 -package org.netbeans.modules.jackpot30.refactoring;
59.44 -
59.45 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoring;
59.46 -import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringPluginImpl;
59.47 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoring;
59.48 -import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringPluginImpl;
59.49 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
59.50 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
59.51 -import org.netbeans.modules.refactoring.spi.RefactoringPlugin;
59.52 -import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory;
59.53 -import org.openide.util.lookup.ServiceProvider;
59.54 -
59.55 -/**
59.56 - *
59.57 - * @author Jan Lahoda
59.58 - */
59.59 -@ServiceProvider(service=RefactoringPluginFactory.class)
59.60 -public class RefactoringPluginFactoryImpl implements RefactoringPluginFactory {
59.61 -
59.62 - public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
59.63 - if (refactoring instanceof RenameRefactoring) {
59.64 - return new RenameRefactoringPluginImpl((RenameRefactoring) refactoring);
59.65 - }
59.66 -
59.67 - if (refactoring instanceof ReplaceConstructorRefactoring) {
59.68 - return new ReplaceConstructorRefactoringPluginImpl((ReplaceConstructorRefactoring) refactoring);
59.69 - }
59.70 -
59.71 - if (refactoring instanceof InvertBooleanRefactoring) {
59.72 - return new InvertBooleanRefactoringPluginImpl((InvertBooleanRefactoring) refactoring);
59.73 - }
59.74 -
59.75 - return null;
59.76 - }
59.77 -
59.78 -}
60.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImpl.java Sat Feb 18 22:14:42 2012 +0100
60.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
60.3 @@ -1,209 +0,0 @@
60.4 -/*
60.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
60.6 - *
60.7 - * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
60.8 - *
60.9 - * The contents of this file are subject to the terms of either the GNU
60.10 - * General Public License Version 2 only ("GPL") or the Common
60.11 - * Development and Distribution License("CDDL") (collectively, the
60.12 - * "License"). You may not use this file except in compliance with the
60.13 - * License. You can obtain a copy of the License at
60.14 - * http://www.netbeans.org/cddl-gplv2.html
60.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
60.16 - * specific language governing permissions and limitations under the
60.17 - * License. When distributing the software, include this License Header
60.18 - * Notice in each file and include the License file at
60.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
60.20 - * particular file as subject to the "Classpath" exception as provided
60.21 - * by Sun in the GPL Version 2 section of the License file that
60.22 - * accompanied this code. If applicable, add the following below the
60.23 - * License Header, with the fields enclosed by brackets [] replaced by
60.24 - * your own identifying information:
60.25 - * "Portions Copyrighted [year] [name of copyright owner]"
60.26 - *
60.27 - * If you wish your version of this file to be governed by only the CDDL
60.28 - * or only the GPL Version 2, indicate your decision by adding
60.29 - * "[Contributor] elects to include this software in this distribution
60.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
60.31 - * single choice of license, a recipient has the option to distribute
60.32 - * your version of this file under either the CDDL, the GPL Version 2 or
60.33 - * to extend the choice of license to its licensees as provided above.
60.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
60.35 - * Version 2 license, then the option applies only if the new code is
60.36 - * made subject to such option by the copyright holder.
60.37 - *
60.38 - * Contributor(s):
60.39 - *
60.40 - * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
60.41 - */
60.42 -
60.43 -package org.netbeans.modules.jackpot30.refactoring;
60.44 -
60.45 -import com.sun.source.tree.BlockTree;
60.46 -import com.sun.source.tree.ClassTree;
60.47 -import com.sun.source.tree.ExpressionTree;
60.48 -import com.sun.source.tree.MethodInvocationTree;
60.49 -import com.sun.source.tree.MethodTree;
60.50 -import com.sun.source.tree.ModifiersTree;
60.51 -import com.sun.source.tree.StatementTree;
60.52 -import com.sun.source.tree.VariableTree;
60.53 -import com.sun.source.util.TreePath;
60.54 -import java.io.File;
60.55 -import java.util.Collections;
60.56 -import java.util.EnumSet;
60.57 -import java.util.LinkedList;
60.58 -import java.util.List;
60.59 -import java.util.Set;
60.60 -import javax.lang.model.element.Element;
60.61 -import javax.lang.model.element.ElementKind;
60.62 -import javax.lang.model.element.ExecutableElement;
60.63 -import javax.lang.model.element.Modifier;
60.64 -import javax.lang.model.element.TypeElement;
60.65 -import javax.lang.model.type.TypeKind;
60.66 -import org.netbeans.api.java.source.CancellableTask;
60.67 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
60.68 -import org.netbeans.api.java.source.JavaSource;
60.69 -import org.netbeans.api.java.source.TreeMaker;
60.70 -import org.netbeans.api.java.source.TreePathHandle;
60.71 -import org.netbeans.api.java.source.WorkingCopy;
60.72 -import org.netbeans.modules.refactoring.api.Problem;
60.73 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
60.74 -import org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin;
60.75 -import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
60.76 -import org.openide.filesystems.FileObject;
60.77 -import org.openide.filesystems.FileUtil;
60.78 -import org.openide.util.Lookup;
60.79 -
60.80 -/**
60.81 - *
60.82 - * @author Jan Lahoda
60.83 - */
60.84 -public class RenameRefactoringPluginImpl extends JavaRefactoringPlugin {
60.85 -
60.86 - private final RenameRefactoring rr;
60.87 -
60.88 - public RenameRefactoringPluginImpl(RenameRefactoring rr) {
60.89 - this.rr = rr;
60.90 - }
60.91 -
60.92 - @Override
60.93 - public Problem preCheck() {
60.94 - return null;
60.95 - }
60.96 -
60.97 - @Override
60.98 - public Problem checkParameters() {
60.99 - return null;
60.100 - }
60.101 -
60.102 - @Override
60.103 - public Problem fastCheckParameters() {
60.104 - return null;
60.105 - }
60.106 -
60.107 - @Override
60.108 - public void cancelRequest() {
60.109 - }
60.110 -
60.111 - public Problem prepare(final RefactoringElementsBag refactoringElements) {
60.112 - final ExtraData data = rr.getContext().lookup(ExtraData.class);
60.113 -
60.114 - if (data == null || !data.generateUpgradeScript) {
60.115 - return null;
60.116 - }
60.117 -
60.118 - Lookup source = rr.getRefactoringSource();
60.119 - final TreePathHandle toRename = source.lookup(TreePathHandle.class);
60.120 -
60.121 - if (toRename == null) {
60.122 - return null;
60.123 - }
60.124 -
60.125 - JavaSource js = JavaSource.forFileObject(toRename.getFileObject());
60.126 -
60.127 - if (js != null) {
60.128 - CancellableTask<WorkingCopy> work = new CancellableTask<WorkingCopy>() {
60.129 - public void run(WorkingCopy parameter) throws Exception {
60.130 - parameter.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
60.131 - TreePath tp = toRename.resolve(parameter);
60.132 -
60.133 - if (tp == null) {
60.134 - return ;
60.135 - }
60.136 -
60.137 - Element e = parameter.getTrees().getElement(tp);
60.138 -
60.139 - if (e == null || e.getKind() != ElementKind.METHOD) {
60.140 - return ;
60.141 - }
60.142 -
60.143 - MethodTree m = (MethodTree) tp.getLeaf();
60.144 - ClassTree ct = (ClassTree) tp.getParentPath().getLeaf();
60.145 -
60.146 - TreeMaker make = parameter.getTreeMaker();
60.147 -
60.148 - List<ExpressionTree> args = new LinkedList<ExpressionTree>();
60.149 -
60.150 - for (VariableTree vt : m.getParameters()) {
60.151 - args.add(make.Identifier(vt.getName()));
60.152 - }
60.153 -
60.154 - MethodInvocationTree mit = make.MethodInvocation(Collections.<ExpressionTree>emptyList(), make.Identifier(rr.getNewName()), args);
60.155 -
60.156 - StatementTree invoke;
60.157 -
60.158 - if (((ExecutableElement) e).getReturnType().getKind() == TypeKind.VOID) {
60.159 - invoke = make.ExpressionStatement(mit);
60.160 - } else {
60.161 - invoke = make.Return(mit);
60.162 - }
60.163 -
60.164 - BlockTree body = make.Block(Collections.<StatementTree>singletonList(invoke), false);
60.165 -// ModifiersTree mods = make.addModifiersAnnotation(m.getModifiers(), constructTransformation(parameter, make, rr.getNewName(), (ExecutableElement) e));
60.166 - ModifiersTree mods = m.getModifiers();
60.167 -
60.168 - if (data.makeOriginalDeprecated) {
60.169 - mods = make.addModifiersAnnotation(mods, make.Annotation(make.QualIdent(parameter.getElements().getTypeElement("java.lang.Deprecated")), Collections.<ExpressionTree>emptyList()));
60.170 - }
60.171 -
60.172 - if (data.makeOriginalPrivate) {
60.173 - Set<Modifier> modSet = EnumSet.noneOf(Modifier.class);
60.174 -
60.175 - modSet.addAll(mods.getFlags());
60.176 - modSet.removeAll(EnumSet.of(Modifier.PUBLIC, Modifier.PROTECTED));
60.177 - modSet.add(Modifier.PRIVATE);
60.178 -
60.179 - mods = make.Modifiers(modSet, mods.getAnnotations());
60.180 - }
60.181 -
60.182 - MethodTree nue = make.Method(mods, m.getName(), m.getReturnType(), m.getTypeParameters(), m.getParameters(), m.getThrows(), body, null);
60.183 -
60.184 - ClassTree nueClass = make.insertClassMember(ct, ct.getMembers().indexOf(m), nue);
60.185 -
60.186 - parameter.rewrite(ct, nueClass);
60.187 -
60.188 - FileObject root = parameter.getClasspathInfo().getClassPath(PathKind.SOURCE).findOwnerRoot(parameter.getFileObject());
60.189 -
60.190 - if (root != null) {
60.191 - File f = FileUtil.toFile(root);
60.192 - String rule = ScriptGenerator.constructRenameRule(parameter, rr.getNewName(), e);
60.193 - File ruleFile = new File(f, "META-INF/upgrade/" + ((TypeElement) e.getEnclosingElement()).getQualifiedName().toString() + ".hint");
60.194 -
60.195 - refactoringElements.add(rr, new RefactoringElementImpl( ruleFile, rule));
60.196 - }
60.197 - }
60.198 - public void cancel() {}
60.199 - };
60.200 -
60.201 - createAndAddElements(Collections.singleton(toRename.getFileObject()), work, refactoringElements, rr);
60.202 - }
60.203 -
60.204 - return null;
60.205 - }
60.206 -
60.207 - @Override
60.208 - protected JavaSource getJavaSource(Phase p) {
60.209 - return null;
60.210 - }
60.211 -
60.212 -}
61.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringWrapper.java Sat Feb 18 22:14:42 2012 +0100
61.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
61.3 @@ -1,162 +0,0 @@
61.4 -/*
61.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
61.6 - *
61.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
61.8 - *
61.9 - * The contents of this file are subject to the terms of either the GNU
61.10 - * General Public License Version 2 only ("GPL") or the Common
61.11 - * Development and Distribution License("CDDL") (collectively, the
61.12 - * "License"). You may not use this file except in compliance with the
61.13 - * License. You can obtain a copy of the License at
61.14 - * http://www.netbeans.org/cddl-gplv2.html
61.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
61.16 - * specific language governing permissions and limitations under the
61.17 - * License. When distributing the software, include this License Header
61.18 - * Notice in each file and include the License file at
61.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
61.20 - * particular file as subject to the "Classpath" exception as provided
61.21 - * by Sun in the GPL Version 2 section of the License file that
61.22 - * accompanied this code. If applicable, add the following below the
61.23 - * License Header, with the fields enclosed by brackets [] replaced by
61.24 - * your own identifying information:
61.25 - * "Portions Copyrighted [year] [name of copyright owner]"
61.26 - *
61.27 - * If you wish your version of this file to be governed by only the CDDL
61.28 - * or only the GPL Version 2, indicate your decision by adding
61.29 - * "[Contributor] elects to include this software in this distribution
61.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
61.31 - * single choice of license, a recipient has the option to distribute
61.32 - * your version of this file under either the CDDL, the GPL Version 2 or
61.33 - * to extend the choice of license to its licensees as provided above.
61.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
61.35 - * Version 2 license, then the option applies only if the new code is
61.36 - * made subject to such option by the copyright holder.
61.37 - *
61.38 - * Contributor(s):
61.39 - *
61.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
61.41 - */
61.42 -
61.43 -package org.netbeans.modules.jackpot30.refactoring;
61.44 -
61.45 -import com.sun.source.tree.Tree.Kind;
61.46 -import java.awt.BorderLayout;
61.47 -import java.awt.Component;
61.48 -import javax.swing.JComponent;
61.49 -import javax.swing.JPanel;
61.50 -import javax.swing.border.EmptyBorder;
61.51 -import javax.swing.event.ChangeListener;
61.52 -import org.netbeans.api.java.source.TreePathHandle;
61.53 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
61.54 -import org.netbeans.modules.refactoring.api.Problem;
61.55 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
61.56 -import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
61.57 -import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
61.58 -import org.openide.util.HelpCtx;
61.59 -import org.openide.util.Lookup;
61.60 -
61.61 -/**
61.62 - *
61.63 - * @author lahvac
61.64 - */
61.65 -public class RenameRefactoringWrapper implements RefactoringUI {
61.66 -
61.67 - private final RefactoringUI delegate;
61.68 - private final RenameRefactoring refactoring;
61.69 -
61.70 - public RenameRefactoringWrapper(RefactoringUI delegate, RenameRefactoring refactoring) {
61.71 - this.delegate = delegate;
61.72 - this.refactoring = refactoring;
61.73 - }
61.74 -
61.75 - @Override
61.76 - public String getName() {
61.77 - return delegate.getName();
61.78 - }
61.79 -
61.80 - @Override
61.81 - public String getDescription() {
61.82 - return delegate.getDescription();
61.83 - }
61.84 -
61.85 - @Override
61.86 - public boolean isQuery() {
61.87 - return delegate.isQuery();
61.88 - }
61.89 -
61.90 - private GenerateScriptPanel gsp;
61.91 - private CustomRefactoringPanel crp;
61.92 -
61.93 - @Override
61.94 - public CustomRefactoringPanel getPanel(ChangeListener parent) {
61.95 - if (crp == null) {
61.96 - Lookup source = refactoring.getRefactoringSource();
61.97 - TreePathHandle toRename = source.lookup(TreePathHandle.class);
61.98 -
61.99 - gsp = new GenerateScriptPanel(toRename != null && toRename.getKind() == Kind.METHOD);
61.100 - crp = new CustomRefactoringPanelImpl(gsp, delegate.getPanel(parent));
61.101 - }
61.102 -
61.103 - return crp;
61.104 - }
61.105 -
61.106 - @Override
61.107 - public Problem setParameters() {
61.108 - gsp.saveDefaults();
61.109 - refactoring.getContext().add(gsp.getData());
61.110 - return delegate.setParameters();
61.111 - }
61.112 -
61.113 - @Override
61.114 - public Problem checkParameters() {
61.115 - return delegate.checkParameters();
61.116 - }
61.117 -
61.118 - @Override
61.119 - public boolean hasParameters() {
61.120 - return true;
61.121 - }
61.122 -
61.123 - @Override
61.124 - public AbstractRefactoring getRefactoring() {
61.125 - return refactoring;
61.126 - }
61.127 -
61.128 - @Override
61.129 - public HelpCtx getHelpCtx() {
61.130 - return delegate.getHelpCtx();
61.131 - }
61.132 -
61.133 - private static final class CustomRefactoringPanelImpl implements CustomRefactoringPanel {
61.134 - private final CustomRefactoringPanel delegate;
61.135 - private final JComponent component;
61.136 - public CustomRefactoringPanelImpl(final GenerateScriptPanel panel, CustomRefactoringPanel delegate) {
61.137 - this.delegate = delegate;
61.138 - final Component delegateComponent = delegate.getComponent();
61.139 - this.component = new JPanel(new BorderLayout()) {
61.140 - {
61.141 - add(delegateComponent, BorderLayout.CENTER);
61.142 - panel.setBorder(new EmptyBorder(0, 5, 0, 0));
61.143 - add(panel, BorderLayout.SOUTH);
61.144 - delegateComponent.requestFocus();
61.145 - }
61.146 - @Override
61.147 - public void requestFocus() {
61.148 - delegateComponent.requestFocus();
61.149 - }
61.150 - };
61.151 - }
61.152 -
61.153 - @Override
61.154 - public void initialize() {
61.155 - delegate.initialize();
61.156 - }
61.157 -
61.158 - @Override
61.159 - public Component getComponent() {
61.160 - return component;
61.161 - }
61.162 -
61.163 - }
61.164 -
61.165 -}
62.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ScriptGenerator.java Sat Feb 18 22:14:42 2012 +0100
62.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
62.3 @@ -1,113 +0,0 @@
62.4 -/*
62.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
62.6 - *
62.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
62.8 - *
62.9 - * The contents of this file are subject to the terms of either the GNU
62.10 - * General Public License Version 2 only ("GPL") or the Common
62.11 - * Development and Distribution License("CDDL") (collectively, the
62.12 - * "License"). You may not use this file except in compliance with the
62.13 - * License. You can obtain a copy of the License at
62.14 - * http://www.netbeans.org/cddl-gplv2.html
62.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
62.16 - * specific language governing permissions and limitations under the
62.17 - * License. When distributing the software, include this License Header
62.18 - * Notice in each file and include the License file at
62.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
62.20 - * particular file as subject to the "Classpath" exception as provided
62.21 - * by Sun in the GPL Version 2 section of the License file that
62.22 - * accompanied this code. If applicable, add the following below the
62.23 - * License Header, with the fields enclosed by brackets [] replaced by
62.24 - * your own identifying information:
62.25 - * "Portions Copyrighted [year] [name of copyright owner]"
62.26 - *
62.27 - * If you wish your version of this file to be governed by only the CDDL
62.28 - * or only the GPL Version 2, indicate your decision by adding
62.29 - * "[Contributor] elects to include this software in this distribution
62.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
62.31 - * single choice of license, a recipient has the option to distribute
62.32 - * your version of this file under either the CDDL, the GPL Version 2 or
62.33 - * to extend the choice of license to its licensees as provided above.
62.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
62.35 - * Version 2 license, then the option applies only if the new code is
62.36 - * made subject to such option by the copyright holder.
62.37 - *
62.38 - * Contributor(s):
62.39 - *
62.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
62.41 - */
62.42 -
62.43 -package org.netbeans.modules.jackpot30.refactoring;
62.44 -
62.45 -import javax.lang.model.element.Element;
62.46 -import javax.lang.model.element.ExecutableElement;
62.47 -import javax.lang.model.element.Modifier;
62.48 -import javax.lang.model.element.TypeElement;
62.49 -import javax.lang.model.element.VariableElement;
62.50 -import org.netbeans.api.annotations.common.NonNull;
62.51 -import org.netbeans.api.java.source.WorkingCopy;
62.52 -
62.53 -/**
62.54 - *
62.55 - * @author lahvac
62.56 - */
62.57 -public class ScriptGenerator {
62.58 -
62.59 - public static @NonNull String constructRenameRule(@NonNull WorkingCopy wc, @NonNull String newName, @NonNull Element original) {
62.60 - switch (original.getKind()) {
62.61 - case METHOD: return constructRenameRule(wc, newName, (ExecutableElement) original);
62.62 - default: throw new UnsupportedOperationException();
62.63 - }
62.64 - }
62.65 -
62.66 - private static String constructRenameRule(WorkingCopy wc, String newName, ExecutableElement method) {
62.67 - //XXX: type parameters?
62.68 - StringBuilder pattern = new StringBuilder();
62.69 - StringBuilder constraints = new StringBuilder();
62.70 - StringBuilder target = new StringBuilder();
62.71 -
62.72 - TypeElement clazz = (TypeElement) method.getEnclosingElement();
62.73 -
62.74 - if (method.getModifiers().contains(Modifier.STATIC)) {
62.75 - pattern.append(clazz.getQualifiedName().toString()).append(".");
62.76 - target.append(clazz.getQualifiedName().toString()).append(".");
62.77 - } else {
62.78 - pattern.append("$0.");
62.79 - constraints.append(" :: $0 instanceof " + clazz.getQualifiedName().toString());
62.80 - target.append("$0.");
62.81 - }
62.82 -
62.83 - pattern.append(method.getSimpleName().toString());
62.84 - target.append(newName);
62.85 - pattern.append("(");
62.86 - target.append("(");
62.87 -
62.88 - int count = 1;
62.89 -
62.90 - for (VariableElement p : method.getParameters()) {
62.91 - if (count++ > 1) {
62.92 - pattern.append(", ");
62.93 - target.append(", ");
62.94 - }
62.95 -
62.96 - String name = "$" + p.getSimpleName().toString();
62.97 -
62.98 - pattern.append(name);
62.99 - target.append(name);
62.100 -
62.101 - if (constraints.length() == 0) {
62.102 - constraints.append(" :: ");
62.103 - } else {
62.104 - constraints.append(" && ");
62.105 - }
62.106 -
62.107 - constraints.append(name).append(" instanceof ").append(p.asType());
62.108 - }
62.109 -
62.110 - pattern.append(")");
62.111 - target.append(")");
62.112 -
62.113 - return " " + pattern + constraints + "\n=> " + target + "\n;;";
62.114 - }
62.115 -
62.116 -}
63.1 --- a/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/layer.xml Sat Feb 18 22:14:42 2012 +0100
63.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
63.3 @@ -1,34 +0,0 @@
63.4 -<?xml version="1.0" encoding="UTF-8"?>
63.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
63.6 -<filesystem>
63.7 - <folder name="Actions">
63.8 - <folder name="Refactoring">
63.9 - <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance">
63.10 - <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorAction.create"/>
63.11 - </file>
63.12 - <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance">
63.13 - <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanAction.create"/>
63.14 - </file>
63.15 - </folder>
63.16 - </folder>
63.17 - <folder name="Menu">
63.18 - <folder name="Refactoring">
63.19 - <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorAfter.instance">
63.20 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
63.21 - <attr name="position" intvalue="2175"/>
63.22 - </file>
63.23 - <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorBefore.instance">
63.24 - <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
63.25 - <attr name="position" intvalue="2125"/>
63.26 - </file>
63.27 - <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.shadow">
63.28 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance"/>
63.29 - <attr name="position" intvalue="2150"/>
63.30 - </file>
63.31 - <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.shadow">
63.32 - <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance"/>
63.33 - <attr name="position" intvalue="2152"/>
63.34 - </file>
63.35 - </folder>
63.36 - </folder>
63.37 -</filesystem>
64.1 --- a/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RefactoringTestBase.java Sat Feb 18 22:14:42 2012 +0100
64.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
64.3 @@ -1,251 +0,0 @@
64.4 -/*
64.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
64.6 - *
64.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
64.8 - *
64.9 - * The contents of this file are subject to the terms of either the GNU
64.10 - * General Public License Version 2 only ("GPL") or the Common
64.11 - * Development and Distribution License("CDDL") (collectively, the
64.12 - * "License"). You may not use this file except in compliance with the
64.13 - * License. You can obtain a copy of the License at
64.14 - * http://www.netbeans.org/cddl-gplv2.html
64.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
64.16 - * specific language governing permissions and limitations under the
64.17 - * License. When distributing the software, include this License Header
64.18 - * Notice in each file and include the License file at
64.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
64.20 - * particular file as subject to the "Classpath" exception as provided
64.21 - * by Sun in the GPL Version 2 section of the License file that
64.22 - * accompanied this code. If applicable, add the following below the
64.23 - * License Header, with the fields enclosed by brackets [] replaced by
64.24 - * your own identifying information:
64.25 - * "Portions Copyrighted [year] [name of copyright owner]"
64.26 - *
64.27 - * If you wish your version of this file to be governed by only the CDDL
64.28 - * or only the GPL Version 2, indicate your decision by adding
64.29 - * "[Contributor] elects to include this software in this distribution
64.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
64.31 - * single choice of license, a recipient has the option to distribute
64.32 - * your version of this file under either the CDDL, the GPL Version 2 or
64.33 - * to extend the choice of license to its licensees as provided above.
64.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
64.35 - * Version 2 license, then the option applies only if the new code is
64.36 - * made subject to such option by the copyright holder.
64.37 - *
64.38 - * Contributor(s):
64.39 - *
64.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
64.41 - */
64.42 -package org.netbeans.modules.jackpot30.refactoring;
64.43 -
64.44 -import java.io.IOException;
64.45 -import java.util.Arrays;
64.46 -import java.util.Collections;
64.47 -import java.util.HashMap;
64.48 -import java.util.HashSet;
64.49 -import java.util.LinkedList;
64.50 -import java.util.List;
64.51 -import java.util.Map;
64.52 -import java.util.Set;
64.53 -import org.netbeans.api.editor.mimelookup.MimePath;
64.54 -import org.netbeans.api.java.classpath.ClassPath;
64.55 -import org.netbeans.api.java.classpath.GlobalPathRegistry;
64.56 -import org.netbeans.api.java.source.SourceUtils;
64.57 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
64.58 -import org.netbeans.api.java.source.TestUtilities;
64.59 -import org.netbeans.api.project.Project;
64.60 -import org.netbeans.api.project.ProjectManager;
64.61 -import org.netbeans.core.startup.Main;
64.62 -import org.netbeans.junit.NbTestCase;
64.63 -import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
64.64 -import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
64.65 -import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
64.66 -import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
64.67 -import org.netbeans.modules.refactoring.api.AbstractRefactoring;
64.68 -import org.netbeans.modules.refactoring.api.RefactoringSession;
64.69 -import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
64.70 -import org.netbeans.spi.java.classpath.ClassPathProvider;
64.71 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
64.72 -import org.netbeans.spi.project.ProjectFactory;
64.73 -import org.netbeans.spi.project.ProjectState;
64.74 -import org.openide.filesystems.FileObject;
64.75 -import org.openide.filesystems.FileUtil;
64.76 -import org.openide.util.Lookup;
64.77 -import org.openide.util.lookup.Lookups;
64.78 -import org.openide.util.lookup.ServiceProvider;
64.79 -
64.80 -public class RefactoringTestBase extends NbTestCase {
64.81 -
64.82 - public RefactoringTestBase(String name) {
64.83 - super(name);
64.84 - }
64.85 -
64.86 - protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
64.87 - for (FileObject c : sourceRoot.getChildren()) {
64.88 - c.delete();
64.89 - }
64.90 -
64.91 - for (File f : files) {
64.92 - FileObject fo = FileUtil.createData(sourceRoot, f.filename);
64.93 - TestUtilities.copyStringToFile(fo, f.content);
64.94 - }
64.95 -
64.96 - SourceUtils.waitScanFinished();
64.97 - }
64.98 -
64.99 - protected static final class File {
64.100 - public final String filename;
64.101 - public final String content;
64.102 -
64.103 - public File(String filename, String content) {
64.104 - this.filename = filename;
64.105 - this.content = content;
64.106 - }
64.107 - }
64.108 -
64.109 - protected FileObject src;
64.110 - protected Project prj;
64.111 -
64.112 - @Override
64.113 - protected void setUp() throws Exception {
64.114 - SourceUtilsTestUtil.prepareTest(new String[0], new Object[] {
64.115 - new ClassPathProvider() {
64.116 - public ClassPath findClassPath(FileObject file, String type) {
64.117 - if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
64.118 - if (ClassPath.BOOT.equals(type)) {
64.119 - return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
64.120 - }
64.121 - if (ClassPath.COMPILE.equals(type)) {
64.122 - return ClassPathSupport.createClassPath(new FileObject[0]);
64.123 - }
64.124 - if (ClassPath.SOURCE.equals(type)) {
64.125 - return ClassPathSupport.createClassPath(src);
64.126 - }
64.127 - }
64.128 -
64.129 - return null;
64.130 - }
64.131 - },
64.132 - new ProjectFactory() {
64.133 - public boolean isProject(FileObject projectDirectory) {
64.134 - return src == projectDirectory;
64.135 - }
64.136 - public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
64.137 - if (!isProject(projectDirectory)) return null;
64.138 - return new Project() {
64.139 - public FileObject getProjectDirectory() {
64.140 - return projectDirectory;
64.141 - }
64.142 - public Lookup getLookup() {
64.143 - return Lookup.EMPTY;
64.144 - }
64.145 - };
64.146 - }
64.147 - public void saveProject(Project project) throws IOException, ClassCastException {}
64.148 - }
64.149 - });
64.150 - Main.initializeURLFactory();
64.151 - org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
64.152 - prepareTest();
64.153 - org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
64.154 - MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
64.155 - GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
64.156 - RepositoryUpdater.getDefault().start(true);
64.157 - super.setUp();
64.158 - }
64.159 -
64.160 - @Override
64.161 - protected void tearDown() throws Exception {
64.162 - super.tearDown();
64.163 - org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
64.164 - prj = null;
64.165 - }
64.166 -
64.167 - private void prepareTest() throws Exception {
64.168 - FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
64.169 -
64.170 - src = FileUtil.createFolder(workdir, "src");
64.171 -
64.172 - FileObject cache = FileUtil.createFolder(workdir, "cache");
64.173 -
64.174 - CacheFolder.setCacheFolder(cache);
64.175 - }
64.176 -
64.177 - protected void performRefactoring(AbstractRefactoring r, File... verify) throws IOException {
64.178 - Map<FileObject, String> originalContent = new HashMap<FileObject, String>();
64.179 -
64.180 - for (FileObject file : recursive(src)) {
64.181 - originalContent.put(file, readFile(file));
64.182 - }
64.183 -
64.184 - RefactoringSession rs = RefactoringSession.create("Session");
64.185 -
64.186 - r.prepare(rs);
64.187 -
64.188 - assertNull(rs.doRefactoring(true));
64.189 -
64.190 -// IndexingManager.getDefault().refreshIndex(src.getURL(), null);
64.191 -// SourceUtils.waitScanFinished();
64.192 -// assertEquals(false, TaskCache.getDefault().isInError(src, true));
64.193 -
64.194 - for (File v : verify) {
64.195 - FileObject file = src.getFileObject(v.filename);
64.196 -
64.197 - assertNotNull(v.filename, file);
64.198 -
64.199 - String content = readFile(file);
64.200 -
64.201 - assertEquals(v.content.replaceAll("[ \n\t]+", " "), content.replaceAll("[ \n\t]+", " "));
64.202 - }
64.203 -
64.204 - rs.undoRefactoring(true);
64.205 -
64.206 - for (FileObject file : recursive(src)) {
64.207 - String content = originalContent.remove(file);
64.208 -
64.209 - assertNotNull(FileUtil.getFileDisplayName(file), content);
64.210 - assertEquals(content, readFile(file));
64.211 - }
64.212 -
64.213 - assertTrue(originalContent.toString(), originalContent.isEmpty());
64.214 - }
64.215 -
64.216 - private String readFile(FileObject file) throws IOException {
64.217 - return TestUtilities.copyFileToString(FileUtil.toFile(file));
64.218 - }
64.219 -
64.220 - private static Iterable<? extends FileObject> recursive(FileObject r) {
64.221 - Set<FileObject> result = new HashSet<FileObject>();
64.222 - List<FileObject> queue = new LinkedList<FileObject>();
64.223 -
64.224 - queue.add(r);
64.225 -
64.226 - while (!queue.isEmpty()) {
64.227 - FileObject c = queue.remove(0);
64.228 -
64.229 - if (c.isData()) {
64.230 - result.add(c);
64.231 - } else {
64.232 - queue.addAll(Arrays.asList(c.getChildren()));
64.233 - }
64.234 - }
64.235 -
64.236 - return result;
64.237 - }
64.238 -
64.239 - @ServiceProvider(service=MimeDataProvider.class)
64.240 - public static final class MimeDataProviderImpl implements MimeDataProvider {
64.241 -
64.242 - private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
64.243 -
64.244 - public Lookup getLookup(MimePath mimePath) {
64.245 - if ("text/x-java".equals(mimePath.getPath())) {
64.246 - return L;
64.247 - }
64.248 -
64.249 - return null;
64.250 - }
64.251 -
64.252 - }
64.253 -
64.254 -}
65.1 --- a/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImplTest.java Sat Feb 18 22:14:42 2012 +0100
65.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
65.3 @@ -1,111 +0,0 @@
65.4 -/*
65.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
65.6 - *
65.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
65.8 - *
65.9 - * The contents of this file are subject to the terms of either the GNU
65.10 - * General Public License Version 2 only ("GPL") or the Common
65.11 - * Development and Distribution License("CDDL") (collectively, the
65.12 - * "License"). You may not use this file except in compliance with the
65.13 - * License. You can obtain a copy of the License at
65.14 - * http://www.netbeans.org/cddl-gplv2.html
65.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
65.16 - * specific language governing permissions and limitations under the
65.17 - * License. When distributing the software, include this License Header
65.18 - * Notice in each file and include the License file at
65.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
65.20 - * particular file as subject to the "Classpath" exception as provided
65.21 - * by Sun in the GPL Version 2 section of the License file that
65.22 - * accompanied this code. If applicable, add the following below the
65.23 - * License Header, with the fields enclosed by brackets [] replaced by
65.24 - * your own identifying information:
65.25 - * "Portions Copyrighted [year] [name of copyright owner]"
65.26 - *
65.27 - * If you wish your version of this file to be governed by only the CDDL
65.28 - * or only the GPL Version 2, indicate your decision by adding
65.29 - * "[Contributor] elects to include this software in this distribution
65.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
65.31 - * single choice of license, a recipient has the option to distribute
65.32 - * your version of this file under either the CDDL, the GPL Version 2 or
65.33 - * to extend the choice of license to its licensees as provided above.
65.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
65.35 - * Version 2 license, then the option applies only if the new code is
65.36 - * made subject to such option by the copyright holder.
65.37 - *
65.38 - * Contributor(s):
65.39 - *
65.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
65.41 - */
65.42 -package org.netbeans.modules.jackpot30.refactoring;
65.43 -
65.44 -import com.sun.source.tree.ClassTree;
65.45 -import com.sun.source.tree.CompilationUnitTree;
65.46 -import com.sun.source.tree.MethodTree;
65.47 -import com.sun.source.util.TreePath;
65.48 -import org.netbeans.api.java.source.CompilationController;
65.49 -import org.netbeans.api.java.source.JavaSource;
65.50 -import org.netbeans.api.java.source.Task;
65.51 -import org.netbeans.api.java.source.TreePathHandle;
65.52 -import org.netbeans.modules.refactoring.api.RenameRefactoring;
65.53 -import org.openide.util.lookup.Lookups;
65.54 -
65.55 -public class RenameRefactoringPluginImplTest extends RefactoringTestBase {
65.56 -
65.57 - public RenameRefactoringPluginImplTest(String name) {
65.58 - super(name);
65.59 - }
65.60 -
65.61 - public void testSimple1() throws Exception {
65.62 - writeFilesAndWaitForScan(src,
65.63 - new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"));
65.64 - final RenameRefactoring[] r = new RenameRefactoring[1];
65.65 -
65.66 - JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
65.67 -
65.68 - public void run(CompilationController parameter) throws Exception {
65.69 - parameter.toPhase(JavaSource.Phase.RESOLVED);
65.70 - CompilationUnitTree cut = parameter.getCompilationUnit();
65.71 -
65.72 - MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
65.73 -
65.74 - TreePath tp = TreePath.getPath(cut, var);
65.75 - r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
65.76 - }
65.77 - }, true);
65.78 -
65.79 - r[0].setNewName("foo");
65.80 - r[0].getContext().add(new ExtraData(true, true, true));
65.81 -
65.82 - performRefactoring(r[0],
65.83 - new File("t/A.java", "package t; public class A { @Deprecated private void test() { foo(); } public void foo() { } }"),
65.84 - new File("META-INF/upgrade/t.A.hint", " $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
65.85 - }
65.86 -
65.87 - public void testSimple2() throws Exception {
65.88 - writeFilesAndWaitForScan(src,
65.89 - new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"),
65.90 - new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; "));
65.91 - final RenameRefactoring[] r = new RenameRefactoring[1];
65.92 -
65.93 - JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
65.94 -
65.95 - public void run(CompilationController parameter) throws Exception {
65.96 - parameter.toPhase(JavaSource.Phase.RESOLVED);
65.97 - CompilationUnitTree cut = parameter.getCompilationUnit();
65.98 -
65.99 - MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
65.100 -
65.101 - TreePath tp = TreePath.getPath(cut, var);
65.102 - r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
65.103 - }
65.104 - }, true);
65.105 -
65.106 - r[0].setNewName("foo");
65.107 - r[0].getContext().add(new ExtraData(true, /*XXX: false will fail badly here!!*/true, false));
65.108 -
65.109 - performRefactoring(r[0],
65.110 - new File("t/A.java", "package t; public class A { private void test() { foo(); } public void foo() { } }"),
65.111 - new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
65.112 - }
65.113 -
65.114 -}
66.1 --- a/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/ScriptGeneratorTest.java Sat Feb 18 22:14:42 2012 +0100
66.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
66.3 @@ -1,135 +0,0 @@
66.4 -/*
66.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
66.6 - *
66.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
66.8 - *
66.9 - * The contents of this file are subject to the terms of either the GNU
66.10 - * General Public License Version 2 only ("GPL") or the Common
66.11 - * Development and Distribution License("CDDL") (collectively, the
66.12 - * "License"). You may not use this file except in compliance with the
66.13 - * License. You can obtain a copy of the License at
66.14 - * http://www.netbeans.org/cddl-gplv2.html
66.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
66.16 - * specific language governing permissions and limitations under the
66.17 - * License. When distributing the software, include this License Header
66.18 - * Notice in each file and include the License file at
66.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
66.20 - * particular file as subject to the "Classpath" exception as provided
66.21 - * by Sun in the GPL Version 2 section of the License file that
66.22 - * accompanied this code. If applicable, add the following below the
66.23 - * License Header, with the fields enclosed by brackets [] replaced by
66.24 - * your own identifying information:
66.25 - * "Portions Copyrighted [year] [name of copyright owner]"
66.26 - *
66.27 - * If you wish your version of this file to be governed by only the CDDL
66.28 - * or only the GPL Version 2, indicate your decision by adding
66.29 - * "[Contributor] elects to include this software in this distribution
66.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
66.31 - * single choice of license, a recipient has the option to distribute
66.32 - * your version of this file under either the CDDL, the GPL Version 2 or
66.33 - * to extend the choice of license to its licensees as provided above.
66.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
66.35 - * Version 2 license, then the option applies only if the new code is
66.36 - * made subject to such option by the copyright holder.
66.37 - *
66.38 - * Contributor(s):
66.39 - *
66.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
66.41 - */
66.42 -
66.43 -package org.netbeans.modules.jackpot30.refactoring;
66.44 -
66.45 -import com.sun.source.util.TreePath;
66.46 -import java.util.regex.Pattern;
66.47 -import javax.lang.model.element.Element;
66.48 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
66.49 -import org.netbeans.modules.jackpot30.impl.TestBase;
66.50 -
66.51 -/**
66.52 - *
66.53 - * @author lahvac
66.54 - */
66.55 -public class ScriptGeneratorTest extends TestBase {
66.56 -
66.57 - public ScriptGeneratorTest(String testName) {
66.58 - super(testName);
66.59 - }
66.60 -
66.61 - @Override
66.62 - protected void setUp() throws Exception {
66.63 - SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
66.64 - super.setUp();
66.65 - }
66.66 -
66.67 - public void testInstanceMethod() throws Exception {
66.68 - performTest("package test;\n" +
66.69 - "public class Test {\n" +
66.70 - " public void te|st() {}" +
66.71 - "}\n",
66.72 - "foo",
66.73 - " $0.test() :: $0 instanceof test.Test\n" +
66.74 - "=> $0.foo()\n" +
66.75 - ";;");
66.76 - }
66.77 -
66.78 - public void testInstanceMethodParam() throws Exception {
66.79 - performTest("package test;\n" +
66.80 - "public class Test {\n" +
66.81 - " public void te|st(int i) {}" +
66.82 - "}\n",
66.83 - "foo",
66.84 - " $0.test($i) :: $0 instanceof test.Test && $i instanceof int\n" +
66.85 - "=> $0.foo($i)\n" +
66.86 - ";;");
66.87 - }
66.88 -
66.89 - public void testStaticMethod() throws Exception {
66.90 - performTest("package test;\n" +
66.91 - "public class Test {\n" +
66.92 - " public static void te|st() {}" +
66.93 - "}\n",
66.94 - "foo",
66.95 - " test.Test.test()\n" +
66.96 - "=> test.Test.foo()\n" +
66.97 - ";;");
66.98 - }
66.99 -
66.100 - public void testStaticMethodParam() throws Exception {
66.101 - performTest("package test;\n" +
66.102 - "public class Test {\n" +
66.103 - " public static void te|st(int i) {}" +
66.104 - "}\n",
66.105 - "foo",
66.106 - " test.Test.test($i) :: $i instanceof int\n" +
66.107 - "=> test.Test.foo($i)\n" +
66.108 - ";;");
66.109 - }
66.110 -
66.111 - public void testMultipleParameters183659() throws Exception {
66.112 - performTest("package test;\n" +
66.113 - "public class Test {\n" +
66.114 - " public void te|st(int i, int j) {}" +
66.115 - "}\n",
66.116 - "foo",
66.117 - " $0.test($i, $j) :: $0 instanceof test.Test && $i instanceof int && $j instanceof int\n" +
66.118 - "=> $0.foo($i, $j)\n" +
66.119 - ";;");
66.120 - }
66.121 -
66.122 - private void performTest(String code, String newName, String script) throws Exception {
66.123 - assertEquals(2, code.split(Pattern.quote("|")).length);
66.124 -
66.125 - int pos = code.indexOf('|');
66.126 -
66.127 - code = code.substring(0, pos) + code.substring(pos + 1);
66.128 -
66.129 - prepareTest("test/Test.java", code);
66.130 -
66.131 - TreePath path = info.getTreeUtilities().pathFor(pos);
66.132 - Element el = info.getTrees().getElement(path);
66.133 -
66.134 - assertNotNull(el);
66.135 -
66.136 - assertEquals(script, ScriptGenerator.constructRenameRule(null, newName, el));
66.137 - }
66.138 -}
67.1 --- a/build.xml Sat Feb 18 22:14:42 2012 +0100
67.2 +++ b/build.xml Tue Feb 21 22:37:57 2012 +0100
67.3 @@ -3,7 +3,7 @@
67.4 <!-- for some information on what you could do (e.g. targets to override). -->
67.5 <!-- If you delete this file and reopen the project it will be recreated. -->
67.6 <project name="jackpot30" basedir=".">
67.7 - <description>Builds the module suite jackpot30.</description>
67.8 +<!-- <description>Builds the module suite jackpot30.</description>
67.9 <import file="nbproject/build-impl.xml"/>
67.10
67.11 <property name="server.modules" value="server/indexer:server/web.api" />
67.12 @@ -52,7 +52,7 @@
67.13
67.14 <target name="test-subprojects">
67.15 <subant target="test" buildpath="${subprojects}" inheritall="false"/>
67.16 - </target>
67.17 + </target>-->
67.18
67.19 <!-- <target name="coverage-report" depends="testcoverage-suite.coverage-report">
67.20 <subant target="test" buildpath="${server.modules}" inheritall="false"/>
68.1 --- a/cmdline/compiler/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
68.2 +++ b/cmdline/compiler/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
68.3 @@ -3,6 +3,6 @@
68.4 build.xml.stylesheet.CRC32=79c3b980@1.33
68.5 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
68.6 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
68.7 -nbproject/build-impl.xml.data.CRC32=536100ea
68.8 +nbproject/build-impl.xml.data.CRC32=801ac3aa
68.9 nbproject/build-impl.xml.script.CRC32=64f6fe95
68.10 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
68.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
69.1 --- a/cmdline/compiler/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
69.2 +++ b/cmdline/compiler/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
69.3 @@ -60,7 +60,7 @@
69.4 </run-dependency>
69.5 </dependency>
69.6 <dependency>
69.7 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
69.8 + <code-name-base>org.netbeans.modules.jackpot30.indexing</code-name-base>
69.9 <build-prerequisite/>
69.10 <compile-dependency/>
69.11 <run-dependency>
69.12 @@ -103,6 +103,14 @@
69.13 </run-dependency>
69.14 </dependency>
69.15 <dependency>
69.16 + <code-name-base>org.netbeans.modules.java.preprocessorbridge</code-name-base>
69.17 + <build-prerequisite/>
69.18 + <compile-dependency/>
69.19 + <run-dependency>
69.20 + <implementation-version/>
69.21 + </run-dependency>
69.22 + </dependency>
69.23 + <dependency>
69.24 <code-name-base>org.netbeans.modules.java.source</code-name-base>
69.25 <build-prerequisite/>
69.26 <compile-dependency/>
70.1 --- a/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessing.java Sat Feb 18 22:14:42 2012 +0100
70.2 +++ b/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/HintsAnnotationProcessing.java Tue Feb 21 22:37:57 2012 +0100
70.3 @@ -60,11 +60,10 @@
70.4 import javax.tools.Diagnostic.Kind;
70.5 import javax.tools.FileObject;
70.6 import javax.tools.StandardLocation;
70.7 -import org.netbeans.api.java.classpath.ClassPath;
70.8 import org.netbeans.api.java.source.ClasspathInfo.PathKind;
70.9 import org.netbeans.api.java.source.CompilationInfoHack;
70.10 import org.netbeans.api.java.source.ModificationResult;
70.11 -import org.netbeans.modules.jackpot30.impl.batch.BatchUtilities;
70.12 +import org.netbeans.modules.jackpot30.indexing.batch.BatchUtilities;
70.13 import org.netbeans.modules.java.hints.declarative.DeclarativeHintRegistry;
70.14 import org.netbeans.modules.java.hints.jackpot.impl.JavaFixImpl;
70.15 import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
70.16 @@ -155,7 +154,7 @@
70.17 List<HintDescription> hintDescriptions = new LinkedList<HintDescription>(hardCodedHints);
70.18
70.19 if (isEnabled(processingEnv, CLASSPATH_HINTS_ENABLE)) {
70.20 - hintDescriptions.addAll(new LinkedList<HintDescription>(Utilities.listClassPathHints(new HashSet<ClassPath>(Arrays.asList(info.getClasspathInfo().getClassPath(PathKind.COMPILE), info.getClasspathInfo().getClassPath(PathKind.SOURCE))))));
70.21 + hintDescriptions.addAll(new LinkedList<HintDescription>(Utilities.listClassPathHints(Collections.singleton(info.getClasspathInfo().getClassPath(PathKind.SOURCE)), Collections.singleton(info.getClasspathInfo().getClassPath(PathKind.COMPILE)))));
70.22 }
70.23
70.24 boolean applyCPHints = isEnabled(processingEnv, CLASSPATH_HINTS_FIXES_ENABLE);
71.1 --- a/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/IndexingAnnotationProcessor.java Sat Feb 18 22:14:42 2012 +0100
71.2 +++ b/cmdline/compiler/src/org/netbeans/modules/jackpot30/compiler/IndexingAnnotationProcessor.java Tue Feb 21 22:37:57 2012 +0100
71.3 @@ -41,6 +41,7 @@
71.4 import com.sun.source.tree.MemberSelectTree;
71.5 import com.sun.source.tree.Tree;
71.6 import com.sun.source.tree.Tree.Kind;
71.7 +import com.sun.source.util.Trees;
71.8 import java.io.File;
71.9 import java.io.IOException;
71.10 import java.net.URL;
71.11 @@ -52,19 +53,18 @@
71.12 import java.util.Set;
71.13 import javax.annotation.processing.ProcessingEnvironment;
71.14 import javax.tools.Diagnostic;
71.15 -import org.netbeans.api.annotations.common.NonNull;
71.16 -import org.netbeans.api.annotations.common.NullAllowed;
71.17 import org.netbeans.api.java.source.ClasspathInfo.PathKind;
71.18 -import org.netbeans.api.java.source.CompilationInfo;
71.19 import org.netbeans.api.java.source.CompilationInfoHack;
71.20 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
71.21 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
71.22 -import org.netbeans.modules.jackpot30.impl.indexing.Index.AttributionWrapper;
71.23 -import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
71.24 +import org.netbeans.modules.jackpot30.indexing.index.Indexer;
71.25 +import org.netbeans.modules.java.preprocessorbridge.spi.JavaIndexerPlugin;
71.26 import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
71.27 +import org.netbeans.modules.parsing.impl.indexing.FileObjectIndexable;
71.28 +import org.netbeans.modules.parsing.impl.indexing.SPIAccessor;
71.29 import org.openide.filesystems.FileObject;
71.30 import org.openide.filesystems.FileUtil;
71.31 import org.openide.util.Exceptions;
71.32 +import org.openide.util.Lookup;
71.33 +import org.openide.util.lookup.Lookups;
71.34 import org.openide.util.lookup.ServiceProvider;
71.35
71.36 /**
71.37 @@ -85,7 +85,7 @@
71.38 )));
71.39
71.40 private boolean enabled;
71.41 - private Map<FileObject, Writers> writers;
71.42 + private Map<FileObject, JavaIndexerPlugin> writers;
71.43
71.44 @Override
71.45 protected boolean initialize(ProcessingEnvironment processingEnv) {
71.46 @@ -102,7 +102,7 @@
71.47 FileUtil.refreshFor(cache.getParentFile());
71.48 CacheFolder.setCacheFolder(FileUtil.toFileObject(cache));
71.49
71.50 - writers = new HashMap<FileObject, Writers>();
71.51 + writers = new HashMap<FileObject, JavaIndexerPlugin>();
71.52
71.53 return true;
71.54 }
71.55 @@ -143,13 +143,16 @@
71.56 }
71.57 }
71.58
71.59 - Writers w = writers.get(root);
71.60 + JavaIndexerPlugin w = writers.get(root);
71.61 + URL sourceRoot = root.toURL();
71.62
71.63 if (w == null) {
71.64 - writers.put(root, w = new Writers(root.getURL()));
71.65 + writers.put(root, w = new Indexer.FactoryImpl().create(sourceRoot, Indexer.resolveCacheFolder(sourceRoot)));
71.66 }
71.67 +
71.68 + Lookup services = Lookups.fixed(processingEnv.getElementUtils(), processingEnv.getTypeUtils(), Trees.instance(processingEnv));
71.69
71.70 - w.record(info);
71.71 + w.process(info.getCompilationUnit(), SPIAccessor.getInstance().create(new FileObjectIndexable(root, info.getFileObject())), services);
71.72 } catch (IOException ex) {
71.73 Exceptions.printStackTrace(ex);
71.74 }
71.75 @@ -159,12 +162,8 @@
71.76 protected void finish() {
71.77 if (!enabled) return;
71.78
71.79 - for (Writers w : writers.values()) {
71.80 - try {
71.81 - w.close();
71.82 - } catch (IOException ex) {
71.83 - Exceptions.printStackTrace(ex);
71.84 - }
71.85 + for (JavaIndexerPlugin w : writers.values()) {
71.86 + w.finish();
71.87 }
71.88
71.89 writers = null;
71.90 @@ -175,31 +174,4 @@
71.91 return OPTIONS;
71.92 }
71.93
71.94 - static final class Writers {
71.95 - private final @NonNull IndexWriter w;
71.96 - private final @NullAllowed DuplicatesIndex.IndexWriter dw;
71.97 -
71.98 - public Writers(URL src) throws IOException {
71.99 - w = FileBasedIndex.get(src).openForWriting();
71.100 - //duplicates index does not currently work:
71.101 -// dw = DuplicatesIndex.get(src).openForWriting();
71.102 - dw = null;
71.103 - }
71.104 -
71.105 - public void record(CompilationInfo info) throws IOException {
71.106 - w.record(info.getFileObject().getURL(), info.getCompilationUnit(), new AttributionWrapper(info));
71.107 -
71.108 - if (dw != null) {
71.109 - dw.record(info, info.getFileObject().getURL(), info.getCompilationUnit());
71.110 - }
71.111 - }
71.112 -
71.113 - public void close() throws IOException {
71.114 - w.close();
71.115 -
71.116 - if (dw != null) {
71.117 - dw.close();
71.118 - }
71.119 - }
71.120 - }
71.121 }
72.1 --- a/cmdline/compiler/test/unit/src/org/netbeans/modules/jackpot30/compiler/IndexingAnnotationProcessorTest.java Sat Feb 18 22:14:42 2012 +0100
72.2 +++ b/cmdline/compiler/test/unit/src/org/netbeans/modules/jackpot30/compiler/IndexingAnnotationProcessorTest.java Tue Feb 21 22:37:57 2012 +0100
72.3 @@ -46,10 +46,11 @@
72.4 import org.netbeans.api.java.source.CompilationController;
72.5 import org.netbeans.api.java.source.JavaSource;
72.6 import org.netbeans.api.java.source.Task;
72.7 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
72.8 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
72.9 +import org.netbeans.modules.jackpot30.indexing.index.IndexQuery;
72.10 import org.netbeans.modules.java.hints.declarative.Hacks;
72.11 import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
72.12 +import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
72.13 +import org.openide.filesystems.FileUtil;
72.14
72.15 /**
72.16 *
72.17 @@ -64,7 +65,7 @@
72.18 protected void setUp() throws Exception {
72.19 super.setUp();
72.20 cache = new File(workDir, "cache");
72.21 - Cache.setStandaloneCacheRoot(cache);
72.22 + CacheFolder.setCacheFolder(FileUtil.createFolder(cache));
72.23 }
72.24
72.25 private File cache;
72.26 @@ -109,7 +110,7 @@
72.27
72.28 JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
72.29 public void run(CompilationController parameter) throws Exception {
72.30 - real.addAll(FileBasedIndex.get(src.toURI().toURL()).findCandidates(BulkSearch.getDefault().create(parameter, patterns)));
72.31 + real.addAll(IndexQuery.open(src.toURI().toURL()).findCandidates(BulkSearch.getDefault().create(parameter, patterns)));
72.32 }
72.33 }, true);
72.34
73.1 --- a/cmdline/lib/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
73.2 +++ b/cmdline/lib/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
73.3 @@ -60,14 +60,6 @@
73.4 </run-dependency>
73.5 </dependency>
73.6 <dependency>
73.7 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
73.8 - <build-prerequisite/>
73.9 - <compile-dependency/>
73.10 - <run-dependency>
73.11 - <implementation-version/>
73.12 - </run-dependency>
73.13 - </dependency>
73.14 - <dependency>
73.15 <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
73.16 <build-prerequisite/>
73.17 <compile-dependency/>
73.18 @@ -189,6 +181,10 @@
73.19 <compile-dependency/>
73.20 </test-dependency>
73.21 <test-dependency>
73.22 + <code-name-base>org.netbeans.modules.jackpot30.common</code-name-base>
73.23 + <compile-dependency/>
73.24 + </test-dependency>
73.25 + <test-dependency>
73.26 <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
73.27 <recursive/>
73.28 <compile-dependency/>
74.1 --- a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java Sat Feb 18 22:14:42 2012 +0100
74.2 +++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java Tue Feb 21 22:37:57 2012 +0100
74.3 @@ -75,11 +75,12 @@
74.4 import org.netbeans.modules.classfile.ClassName;
74.5 import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.JavaMimeResolver;
74.6 import org.netbeans.modules.jackpot30.cmdline.lib.StandaloneTools.RepositoryImpl;
74.7 -import org.netbeans.modules.jackpot30.spi.Hacks.HintPreferencesProvider;
74.8 +import org.netbeans.modules.jackpot30.common.api.IndexAccess;
74.9 import org.netbeans.modules.java.hints.declarative.DeclarativeHintRegistry;
74.10 import org.netbeans.modules.java.hints.jackpot.code.CodeHintProviderImpl;
74.11 import org.netbeans.modules.java.hints.jackpot.code.FSWrapper;
74.12 import org.netbeans.modules.java.hints.jackpot.impl.Utilities.SPI;
74.13 +import org.netbeans.modules.java.hints.jackpot.refactoring.Hacks.HintPreferencesProvider;
74.14 import org.netbeans.modules.java.hints.jackpot.spi.ClassPathBasedHintProvider;
74.15 import org.netbeans.modules.java.hints.jackpot.spi.HintProvider;
74.16 import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
74.17 @@ -414,6 +415,7 @@
74.18 "org.netbeans.core.NbLoaderPool",
74.19 "org.netbeans.core.startup.preferences.PreferencesProviderImpl",
74.20 "org.netbeans.modules.java.platform.DefaultJavaPlatformProvider",
74.21 + IndexAccess.class.getName(),
74.22
74.23 "com.sun.tools.javac.resources.compiler",
74.24 "com.sun.tools.javac.resources.javac",
74.25 @@ -435,7 +437,8 @@
74.26 "org.netbeans.modules.openide.util.PreferencesProvider",
74.27 HintPreferencesProvider.class.getName(),
74.28 ClassPathBasedHintProvider.class.getName(),
74.29 - "org.openide.filesystems.MIMEResolver"
74.30 + "org.openide.filesystems.MIMEResolver",
74.31 + IndexAccess.class.getName()
74.32 ));
74.33
74.34 private static final Set<String> RESOURCES = new HashSet<String>(Arrays.asList(
75.1 --- a/cmdline/nbproject/platform.properties Sat Feb 18 22:14:42 2012 +0100
75.2 +++ b/cmdline/nbproject/platform.properties Tue Feb 21 22:37:57 2012 +0100
75.3 @@ -10,9 +10,14 @@
75.4 ${nbplatform.active.dir}/platform:\
75.5 ${nbplatform.active.dir}/profiler:\
75.6 ${nbplatform.active.dir}/websvccommon:\
75.7 - ../build/cluster:\
75.8 ../borrowedtests/build/cluster:\
75.9 - ../remoting/ide/build/cluster
75.10 + ../remoting/ide/build/cluster:\
75.11 + ../language/ide/build/cluster:\
75.12 + ../remoting/common/build/cluster
75.13 +extcluster.../language/ide/build/cluster.javadoc=
75.14 +extcluster.../language/ide/build/cluster.sources=
75.15 +extcluster.../remoting/common/build/cluster.javadoc=
75.16 +extcluster.../remoting/common/build/cluster.sources=
75.17 extcluster.../remoting/ide/build/cluster.javadoc=
75.18 extcluster.../remoting/ide/build/cluster.sources=
75.19 -nbplatform.active=default
75.20 +nbplatform.active=trunk
76.1 --- a/cmdline/tool/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
76.2 +++ b/cmdline/tool/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
76.3 @@ -3,6 +3,6 @@
76.4 build.xml.stylesheet.CRC32=a56c6a5b@1.44
76.5 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
76.6 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
76.7 -nbproject/build-impl.xml.data.CRC32=af581875
76.8 +nbproject/build-impl.xml.data.CRC32=de70a26b
76.9 nbproject/build-impl.xml.script.CRC32=08f1fb11
76.10 nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
77.1 --- a/cmdline/tool/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
77.2 +++ b/cmdline/tool/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
77.3 @@ -1,6 +1,6 @@
77.4 javac.source=1.6
77.5 javac.compilerargs=-Xlint -Xlint:-serial
77.6 -cp.extra=../../server/lib/jopt-simple/jopt-simple-3.2.jar
77.7 +cp.extra=../../lib/jopt-simple/jopt-simple-3.2.jar
77.8 spec.version.base=1.16.0
77.9 test.timeout=6000000
77.10 bootclasspath.prepend=${basedir}/../../server/lib/javac/javac-api-nb-7.0-b07.jar
78.1 --- a/cmdline/tool/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
78.2 +++ b/cmdline/tool/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
78.3 @@ -61,7 +61,7 @@
78.4 </run-dependency>
78.5 </dependency>
78.6 <dependency>
78.7 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
78.8 + <code-name-base>org.netbeans.modules.jackpot30.indexing</code-name-base>
78.9 <build-prerequisite/>
78.10 <compile-dependency/>
78.11 <run-dependency>
78.12 @@ -250,11 +250,6 @@
78.13 <test/>
78.14 </test-dependency>
78.15 <test-dependency>
78.16 - <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
78.17 - <recursive/>
78.18 - <compile-dependency/>
78.19 - </test-dependency>
78.20 - <test-dependency>
78.21 <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
78.22 <compile-dependency/>
78.23 </test-dependency>
79.1 --- a/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java Sat Feb 18 22:14:42 2012 +0100
79.2 +++ b/cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java Tue Feb 21 22:37:57 2012 +0100
79.3 @@ -209,17 +209,17 @@
79.4 ClassPath bootCP = createClassPath(parsed.has(bootclasspath) ? parsed.valuesOf(bootclasspath) : null, createDefaultBootClassPath());
79.5 ClassPath compileCP = createClassPath(parsed.has(classpath) ? parsed.valuesOf(classpath) : null, ClassPath.EMPTY);
79.6 ClassPath sourceCP = createClassPath(parsed.has(sourcepath) ? parsed.valuesOf(sourcepath) : null, ClassPathSupport.createClassPath(roots.toArray(new FileObject[0])));
79.7 - ClassPath hintsCP = ClassPathSupport.createProxyClassPath(bootCP, compileCP, sourceCP);
79.8 + ClassPath binaryCP = ClassPathSupport.createProxyClassPath(bootCP, compileCP);
79.9
79.10 if (parsed.has("list")) {
79.11 - printHints(hintsCP);
79.12 + printHints(sourceCP, binaryCP);
79.13 return 0;
79.14 }
79.15
79.16 if (parsed.has(hint)) {
79.17 - hints = findHints(hintsCP, parsed.valueOf(hint));
79.18 + hints = findHints(sourceCP, binaryCP, parsed.valueOf(hint));
79.19 } else {
79.20 - hints = allHints(hintsCP);
79.21 + hints = allHints(sourceCP, binaryCP);
79.22 }
79.23
79.24 if (!hints.iterator().hasNext()) {
79.25 @@ -297,24 +297,24 @@
79.26 return 0;
79.27 }
79.28
79.29 - private static Map<HintMetadata, Collection<? extends HintDescription>> listHints(ClassPath from) {
79.30 + private static Map<HintMetadata, Collection<? extends HintDescription>> listHints(ClassPath sourceFrom, ClassPath binaryFrom) {
79.31 Map<HintMetadata, Collection<? extends HintDescription>> result = new HashMap<HintMetadata, Collection<? extends HintDescription>>();
79.32
79.33 for (Map.Entry<HintMetadata, Collection<? extends HintDescription>> entry: RulesManager.getInstance().allHints.entrySet()) {
79.34 result.put(entry.getKey(), entry.getValue());
79.35 }
79.36
79.37 - for (Map.Entry<? extends HintMetadata, ? extends Collection<? extends HintDescription>> entry: org.netbeans.modules.java.hints.jackpot.impl.refactoring.Utilities.sortByMetadata(Utilities.listClassPathHints(Collections.singleton(from))).entrySet()) {
79.38 + for (Map.Entry<? extends HintMetadata, ? extends Collection<? extends HintDescription>> entry: org.netbeans.modules.java.hints.jackpot.impl.refactoring.Utilities.sortByMetadata(Utilities.listClassPathHints(Collections.singleton(sourceFrom), Collections.singleton(binaryFrom))).entrySet()) {
79.39 result.put(entry.getKey(), entry.getValue());
79.40 }
79.41
79.42 return result;
79.43 }
79.44
79.45 - private static Iterable<? extends HintDescription> findHints(ClassPath from, String name) {
79.46 + private static Iterable<? extends HintDescription> findHints(ClassPath sourceFrom, ClassPath binaryFrom, String name) {
79.47 List<HintDescription> descs = new LinkedList<HintDescription>();
79.48
79.49 - for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(from).entrySet()) {
79.50 + for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(sourceFrom, binaryFrom).entrySet()) {
79.51 if (e.getKey().displayName.equals(name)) {
79.52 descs.addAll(e.getValue());
79.53 }
79.54 @@ -323,10 +323,10 @@
79.55 return descs;
79.56 }
79.57
79.58 - private static Iterable<? extends HintDescription> allHints(ClassPath from) {
79.59 + private static Iterable<? extends HintDescription> allHints(ClassPath sourceFrom, ClassPath binaryFrom) {
79.60 List<HintDescription> descs = new LinkedList<HintDescription>();
79.61
79.62 - for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(from).entrySet()) {
79.63 + for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(sourceFrom, binaryFrom).entrySet()) {
79.64 if (e.getKey().kind != Kind.HINT) continue;
79.65 if (!e.getKey().enabled) continue;
79.66 descs.addAll(e.getValue());
79.67 @@ -396,7 +396,7 @@
79.68 outS = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out)));
79.69
79.70 for (ModificationResult mr : diffs) {
79.71 - org.netbeans.modules.jackpot30.impl.batch.BatchUtilities.exportDiff(mr, null, outS);
79.72 + org.netbeans.modules.jackpot30.indexing.batch.BatchUtilities.exportDiff(mr, null, outS);
79.73 }
79.74 } finally {
79.75 try {
79.76 @@ -412,10 +412,10 @@
79.77 }
79.78 }
79.79
79.80 - private static void printHints(ClassPath from) throws IOException {
79.81 + private static void printHints(ClassPath sourceFrom, ClassPath binaryFrom) throws IOException {
79.82 Set<String> hints = new TreeSet<String>();
79.83
79.84 - for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(from).entrySet()) {
79.85 + for (Entry<HintMetadata, Collection<? extends HintDescription>> e : listHints(sourceFrom, binaryFrom).entrySet()) {
79.86 hints.add(e.getKey().displayName);
79.87 }
79.88
80.1 --- a/help/build.xml Sat Feb 18 22:14:42 2012 +0100
80.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
80.3 @@ -1,48 +0,0 @@
80.4 -<?xml version="1.0" encoding="UTF-8"?>
80.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
80.6 -<!-- for some information on what you could do (e.g. targets to override). -->
80.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
80.8 -<project name="org.netbeans.modules.jackpot30.help" default="netbeans" basedir=".">
80.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.help.</description>
80.10 - <import file="nbproject/build-impl.xml"/>
80.11 - <import file="${suite.dir}/findbugs-import.xml"/>
80.12 -
80.13 - <target name="help-init">
80.14 - <property environment="ENV." />
80.15 - <condition property="hasLaTeX2HTML">
80.16 - <available file="latex2html" filepath="${ENV.PATH}" />
80.17 - </condition>
80.18 - </target>
80.19 -
80.20 - <target name="compile-help" depends="help-init" if="hasLaTeX2HTML">
80.21 - <mkdir dir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
80.22 -
80.23 - <copy file="jackpot30-helpset.xml" todir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
80.24 -
80.25 - <exec executable="latex2html">
80.26 - <arg value="-antialias" />
80.27 - <arg value="-antialias_text" />
80.28 - <arg value="-dir" />
80.29 - <arg value="build/help/org/netbeans/modules/jackpot30/help/docs" />
80.30 - <arg value="jackpot30-help.tex" />
80.31 - </exec>
80.32 -
80.33 - <java classname="org.netbeans.modules.jackpot30.help.CreateMap"
80.34 - classpath="build/classes">
80.35 - <arg value="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
80.36 - </java>
80.37 -
80.38 - <mkdir dir="${suite.dir}/build/cluster/modules/docs" />
80.39 -
80.40 - <jar destfile="${suite.dir}/build/cluster/modules/docs/org-netbeans-modules-jackpot30-help.jar" basedir="${basedir}/build/help">
80.41 -
80.42 - </jar>
80.43 - </target>
80.44 -
80.45 - <target name="compile" depends="projectized-common.compile,compile-help" />
80.46 -
80.47 - <target name="test" />
80.48 - <target name="test-coverage" />
80.49 - <target name="coverage-report" />
80.50 -
80.51 -</project>
81.1 --- a/help/jackpot30-help.tex Sat Feb 18 22:14:42 2012 +0100
81.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
81.3 @@ -1,119 +0,0 @@
81.4 -\documentclass{article}
81.5 -\usepackage{verbdef}
81.6 -\usepackage{hyperref}
81.7 -
81.8 -\verbdef\simplevariable=$[0-9A-Za-z_]+=
81.9 -\verbdef\statementvariable=$[0-9A-Za-z_]+;=
81.10 -\verbdef\multipletreevariable=$[0-9A-Za-z_]+$=
81.11 -\verbdef\multiplestatementvariable=$[0-9A-Za-z_]+$;=
81.12 -\verbdef\wholepattern=$_=
81.13 -\verbdef\reserved=$$[0-9A-Za-z_]+=
81.14 -
81.15 -\begin{document}
81.16 -
81.17 -\section{Rules Language}
81.18 -
81.19 -\subsection{Basic Structure}
81.20 -
81.21 -The rules file consists of any number of transformation rules.
81.22 -The rule is defined as follows:
81.23 -\begin{verbatim}
81.24 - <pattern>
81.25 -=> <fix-pattern>
81.26 -=> <fix-pattern>
81.27 -;;
81.28 -\end{verbatim}
81.29 -
81.30 -Each occurrence of \verb=<pattern>= in the source code can be rewritten to one
81.31 -of the \verb=<fix-pattern>=s. For example, the following transformation rule:
81.32 -\begin{verbatim}
81.33 - $1 == null
81.34 -=> null == $1
81.35 -;;
81.36 -\end{verbatim}
81.37 -
81.38 -will rewrite the following code:
81.39 -\begin{verbatim}
81.40 -if (a == null) {
81.41 - System.err.println("a is null");
81.42 -}
81.43 -\end{verbatim}
81.44 -to:
81.45 -\begin{verbatim}
81.46 -if (null == a) {
81.47 - System.err.println("a is null");
81.48 -}
81.49 -\end{verbatim}
81.50 -
81.51 -Note: \verb=$1$= is a variable, explained \hyperref{below}{in Section~}{variables}{}.
81.52 -
81.53 -Note: batch refactoring will typically use only the first applicable fix patterns
81.54 -of each applicable rule.
81.55 -
81.56 -\subsection{Patterns}
81.57 -
81.58 -The pattern is a Java expression, statement or several statements.
81.59 -All references to classes in the pattern need to be resolvable, i.e. either fully
81.60 -qualified names need to be used, or the custom import section must be used
81.61 -(see \hyperref{Custom Imports}{Section~}{custom-import}{}).
81.62 -
81.63 -TODO: equivalence - static elements are checked only against themselves, blocks with
81.64 -one statement considered equivalent to single statement.
81.65 -
81.66 -Note: variable declaration is a Java statement.
81.67 -
81.68 -\subsection{Variables}
81.69 -
81.70 -Variables start with the dollar sign (\verb=$=). In the pattern, first occurrences
81.71 -of a variable is bound to the actual sub-tree that appears in the code. Second and
81.72 -following occurrences of the variable the actual sub-tree is verified against the subtree
81.73 -bound to the variable. The pattern occurs in the text only if the actual sub-tree
81.74 -matches the sub-tree bound to the variable. In the fix pattern, all occurrences of
81.75 -the variables are replaced with the tree(s) bound to the respective variables.
81.76 -
81.77 -The forms of the variables are:
81.78 -\begin{description}
81.79 -\item[\simplevariable]{any expression}
81.80 -\item[\statementvariable]{any statement}
81.81 -\item[\multipletreevariable]{any number of sub-trees (except statements - see next definition)}
81.82 -\item[\multiplestatementvariable]{any number of statements}
81.83 -\item[\wholepattern]{for patterns undefined, for fixes and conditions automatically bound to the current matched region}
81.84 -\item[\reserved]{reserved -- do not use}
81.85 -\end{description}
81.86 -
81.87 -\subsection{Conditions}
81.88 -
81.89 -Both the search and fix patterns may specify additional conditions. These conditions
81.90 -are specified after \verb=::=. Currently, the conditions have the following
81.91 -limitations:
81.92 -
81.93 -\begin{verbatim}
81.94 - $1.isDirectory() :: $1 instanceof java.io.File
81.95 -=> !$1.isFile()
81.96 -;;
81.97 -\end{verbatim}
81.98 -
81.99 -will rewrite the following code:
81.100 -\begin{verbatim}
81.101 -java.io.File testFile = new java.io.File("/tmp");
81.102 -if (testFile.isDirectory()) {
81.103 - System.err.println("/tmp is a directory");
81.104 -}
81.105 -\end{verbatim}
81.106 -to:
81.107 -\begin{verbatim}
81.108 -java.io.File testFile = new java.io.File("/tmp");
81.109 -if (!testFile.isFile()) {
81.110 - System.err.println("/tmp is a directory");
81.111 -}
81.112 -\end{verbatim}
81.113 -
81.114 -\subsection{Display Names and Localization}
81.115 -
81.116 -\subsection{Custom Conditions}
81.117 -
81.118 -\subsection{Custom Import}
81.119 -
81.120 -\subsection{Options}
81.121 -
81.122 -\end{document}
82.1 --- a/help/jackpot30-helpset.xml Sat Feb 18 22:14:42 2012 +0100
82.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
82.3 @@ -1,31 +0,0 @@
82.4 -<?xml version="1.0" encoding="UTF-8"?>
82.5 -<!--
82.6 -To change this template, choose Tools | Templates
82.7 -and open the template in the editor.
82.8 --->
82.9 -<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
82.10 -<helpset version="2.0">
82.11 - <title>Jackpot 3.0 Help</title>
82.12 - <maps>
82.13 - <homeID>jackpot30.about</homeID>
82.14 - <mapref location="jackpot30-map.xml"/>
82.15 - </maps>
82.16 - <view mergetype="javax.help.AppendMerge">
82.17 - <name>TOC</name>
82.18 - <label>Table of Contents</label>
82.19 - <type>javax.help.TOCView</type>
82.20 - <data>jackpot30-toc.xml</data>
82.21 - </view>
82.22 -<!-- <view mergetype="javax.help.AppendMerge">
82.23 - <name>Index</name>
82.24 - <label>Index</label>
82.25 - <type>javax.help.IndexView</type>
82.26 - <data>dsaf-idx.xml</data>
82.27 - </view>-->
82.28 -<!-- <view>
82.29 - <name>Search</name>
82.30 - <label>Search</label>
82.31 - <type>javax.help.SearchView</type>
82.32 - <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
82.33 - </view>-->
82.34 -</helpset>
83.1 --- a/help/manifest.mf Sat Feb 18 22:14:42 2012 +0100
83.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
83.3 @@ -1,7 +0,0 @@
83.4 -Manifest-Version: 1.0
83.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.help
83.6 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/help/layer.xml
83.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/help/Bundle.properties
83.8 -OpenIDE-Module-Specification-Version: 1.16
83.9 -OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
83.10 -Class-Path: docs/org-netbeans-modules-jackpot30-help.jar
84.1 --- a/help/nbproject-help.tex/build-settings.properties Sat Feb 18 22:14:42 2012 +0100
84.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
84.3 @@ -1,3 +0,0 @@
84.4 -build-configuration-name=latexdvips
84.5 -
84.6 -mainfile=../jackpot30-help.tex
85.1 --- a/help/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
85.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
85.3 @@ -1,45 +0,0 @@
85.4 -<?xml version="1.0" encoding="UTF-8"?>
85.5 -<!--
85.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
85.7 -*** EDIT ../build.xml INSTEAD ***
85.8 --->
85.9 -<project name="org.netbeans.modules.jackpot30.help-impl" basedir="..">
85.10 - <fail message="Please build using Ant 1.7.1 or higher.">
85.11 - <condition>
85.12 - <not>
85.13 - <antversion atleast="1.7.1"/>
85.14 - </not>
85.15 - </condition>
85.16 - </fail>
85.17 - <property file="nbproject/private/suite-private.properties"/>
85.18 - <property file="nbproject/suite.properties"/>
85.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
85.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
85.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
85.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
85.23 - <attribute name="name"/>
85.24 - <attribute name="value"/>
85.25 - <sequential>
85.26 - <property name="@{name}" value="${@{value}}"/>
85.27 - </sequential>
85.28 - </macrodef>
85.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
85.30 - <attribute name="property"/>
85.31 - <attribute name="value"/>
85.32 - <sequential>
85.33 - <property name="@{property}" value="@{value}"/>
85.34 - </sequential>
85.35 - </macrodef>
85.36 - <property file="${user.properties.file}"/>
85.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
85.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
85.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
85.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
85.41 - <condition>
85.42 - <not>
85.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
85.44 - </not>
85.45 - </condition>
85.46 - </fail>
85.47 - <import file="${harness.dir}/build.xml"/>
85.48 -</project>
86.1 --- a/help/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
86.3 @@ -1,8 +0,0 @@
86.4 -build.xml.data.CRC32=ffaf56d3
86.5 -build.xml.script.CRC32=12cad5e6
86.6 -build.xml.stylesheet.CRC32=79c3b980@1.29.0.7
86.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
86.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
86.9 -nbproject/build-impl.xml.data.CRC32=ffaf56d3
86.10 -nbproject/build-impl.xml.script.CRC32=68ad079b
86.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.43
87.1 --- a/help/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
87.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
87.3 @@ -1,2 +0,0 @@
87.4 -javac.source=1.5
87.5 -javac.compilerargs=-Xlint -Xlint:-serial
88.1 --- a/help/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
88.3 @@ -1,12 +0,0 @@
88.4 -<?xml version="1.0" encoding="UTF-8"?>
88.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
88.6 - <type>org.netbeans.modules.apisupport.project</type>
88.7 - <configuration>
88.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
88.9 - <code-name-base>org.netbeans.modules.jackpot30.help</code-name-base>
88.10 - <suite-component/>
88.11 - <module-dependencies/>
88.12 - <public-packages/>
88.13 - </data>
88.14 - </configuration>
88.15 -</project>
89.1 --- a/help/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
89.3 @@ -1,1 +0,0 @@
89.4 -suite.dir=${basedir}/..
90.1 --- a/help/src/org/netbeans/modules/jackpot30/help/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
90.3 @@ -1,38 +0,0 @@
90.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
90.5 -#
90.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
90.7 -#
90.8 -# The contents of this file are subject to the terms of either the GNU
90.9 -# General Public License Version 2 only ("GPL") or the Common
90.10 -# Development and Distribution License("CDDL") (collectively, the
90.11 -# "License"). You may not use this file except in compliance with the
90.12 -# License. You can obtain a copy of the License at
90.13 -# http://www.netbeans.org/cddl-gplv2.html
90.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
90.15 -# specific language governing permissions and limitations under the
90.16 -# License. When distributing the software, include this License Header
90.17 -# Notice in each file and include the License file at
90.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
90.19 -# particular file as subject to the "Classpath" exception as provided
90.20 -# by Sun in the GPL Version 2 section of the License file that
90.21 -# accompanied this code. If applicable, add the following below the
90.22 -# License Header, with the fields enclosed by brackets [] replaced by
90.23 -# your own identifying information:
90.24 -# "Portions Copyrighted [year] [name of copyright owner]"
90.25 -#
90.26 -# If you wish your version of this file to be governed by only the CDDL
90.27 -# or only the GPL Version 2, indicate your decision by adding
90.28 -# "[Contributor] elects to include this software in this distribution
90.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
90.30 -# single choice of license, a recipient has the option to distribute
90.31 -# your version of this file under either the CDDL, the GPL Version 2 or
90.32 -# to extend the choice of license to its licensees as provided above.
90.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
90.34 -# Version 2 license, then the option applies only if the new code is
90.35 -# made subject to such option by the copyright holder.
90.36 -#
90.37 -# Contributor(s):
90.38 -#
90.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
90.40 -
90.41 -OpenIDE-Module-Name=Jackpot 3.0 Help
91.1 --- a/help/src/org/netbeans/modules/jackpot30/help/CreateMap.java Sat Feb 18 22:14:42 2012 +0100
91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
91.3 @@ -1,196 +0,0 @@
91.4 -/*
91.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
91.6 - *
91.7 - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
91.8 - *
91.9 - * The contents of this file are subject to the terms of either the GNU
91.10 - * General Public License Version 2 only ("GPL") or the Common
91.11 - * Development and Distribution License("CDDL") (collectively, the
91.12 - * "License"). You may not use this file except in compliance with the
91.13 - * License. You can obtain a copy of the License at
91.14 - * http://www.netbeans.org/cddl-gplv2.html
91.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
91.16 - * specific language governing permissions and limitations under the
91.17 - * License. When distributing the software, include this License Header
91.18 - * Notice in each file and include the License file at
91.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
91.20 - * particular file as subject to the "Classpath" exception as provided
91.21 - * by Sun in the GPL Version 2 section of the License file that
91.22 - * accompanied this code. If applicable, add the following below the
91.23 - * License Header, with the fields enclosed by brackets [] replaced by
91.24 - * your own identifying information:
91.25 - * "Portions Copyrighted [year] [name of copyright owner]"
91.26 - *
91.27 - * Contributor(s):
91.28 - *
91.29 - * The Original Software is the LaTeX module.
91.30 - * The Initial Developer of the Original Software is Jan Lahoda.
91.31 - * Portions created by Jan Lahoda_ are Copyright (C) 2002-2009.
91.32 - * All Rights Reserved.
91.33 - *
91.34 - * If you wish your version of this file to be governed by only the CDDL
91.35 - * or only the GPL Version 2, indicate your decision by adding
91.36 - * "[Contributor] elects to include this software in this distribution
91.37 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
91.38 - * single choice of license, a recipient has the option to distribute
91.39 - * your version of this file under either the CDDL, the GPL Version 2 or
91.40 - * to extend the choice of license to its licensees as provided above.
91.41 - * However, if you add GPL Version 2 code and therefore, elected the GPL
91.42 - * Version 2 license, then the option applies only if the new code is
91.43 - * made subject to such option by the copyright holder.
91.44 - *
91.45 - * Contributor(s): Jan Lahoda.
91.46 - */
91.47 -package org.netbeans.modules.jackpot30.help;
91.48 -
91.49 -import java.io.BufferedReader;
91.50 -import java.io.File;
91.51 -import java.io.FileReader;
91.52 -import java.io.FileWriter;
91.53 -import java.io.IOException;
91.54 -import java.io.PrintWriter;
91.55 -import java.util.HashMap;
91.56 -import java.util.Map;
91.57 -
91.58 -/**
91.59 - *
91.60 - * @author Jan Lahoda
91.61 - */
91.62 -public class CreateMap {
91.63 -
91.64 - public CreateMap() {}
91.65 -
91.66 - /**
91.67 - * @param args the command line arguments
91.68 - */
91.69 - public static void main(String[] args) throws IOException {
91.70 - if (args.length != 1) {
91.71 - System.err.println("Incorrect number of arguments, one argument containing the location of the base dir is required.");
91.72 - return ;
91.73 - }
91.74 -
91.75 - File baseDir = new File(args[0]);
91.76 -
91.77 - if (!baseDir.exists()) {
91.78 - System.err.println(baseDir.getAbsolutePath() + " does not exist.");
91.79 - return ;
91.80 - }
91.81 -
91.82 - if (!baseDir.isDirectory()) {
91.83 - System.err.println(baseDir.getAbsolutePath() + " is not a directory.");
91.84 - return ;
91.85 - }
91.86 -
91.87 - File in = new File(baseDir, "labels.pl");
91.88 - File out = new File(baseDir, "jackpot30-map.xml");
91.89 -
91.90 - Map<String, String> map = createMapFile(in, out);
91.91 -
91.92 - File outTOC = new File(baseDir, "jackpot30-toc.xml");
91.93 - File inTOC = new File(baseDir, "jackpot30-help.html");
91.94 -
91.95 - createTOC(inTOC, outTOC, map);
91.96 - }
91.97 -
91.98 - private static Map<String, String> createMapFile(File in, File out) throws IOException {
91.99 - BufferedReader input = new BufferedReader(new FileReader(in));
91.100 - PrintWriter output = new PrintWriter(new FileWriter(out));
91.101 - Map<String, String> map = new HashMap<String, String>();
91.102 -
91.103 - output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
91.104 - output.println();
91.105 - output.println("<!DOCTYPE map");
91.106 - output.println(" PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN\"");
91.107 - output.println(" \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/map_1_0.dtd\">");
91.108 - output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/map_1_0.dtd\"-->");
91.109 - output.println();
91.110 - output.println("<map version=\"1.0\">");
91.111 -
91.112 - output.println("<mapID target=\"jackpot30.default\" url=\"jackpot30-help.html\" />");
91.113 -
91.114 - String line = null;
91.115 - String actualKey = null;
91.116 -
91.117 - while ((line = input.readLine()) != null) {
91.118 - if (line.startsWith("$key")) {
91.119 - actualKey = line.split("/")[1];
91.120 - actualKey = "jackpot30." + actualKey.replace(':', '.');
91.121 - }
91.122 -
91.123 - if (line.startsWith("$external_labels")) {
91.124 - String url = line.split("\\|")[1];
91.125 -
91.126 - output.print("<mapID target=\"");
91.127 - output.print(actualKey);
91.128 - output.print("\" url=\"");
91.129 - output.print(url);
91.130 - output.println("\"/>");
91.131 -
91.132 - map.put(url, actualKey);
91.133 -
91.134 - actualKey = null;
91.135 - }
91.136 - }
91.137 -
91.138 - output.println("</map>");
91.139 - output.close();
91.140 - input.close();
91.141 -
91.142 - return map;
91.143 - }
91.144 -
91.145 - private static void createTOC(File in, File out, Map<String, String> map) throws IOException {
91.146 - BufferedReader input = new BufferedReader(new FileReader(in));
91.147 - PrintWriter output = new PrintWriter(new FileWriter(out));
91.148 -
91.149 - String line = null;
91.150 - boolean noStop = false;
91.151 -
91.152 - output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
91.153 - output.println();
91.154 - output.println("<!DOCTYPE toc");
91.155 - output.println(" PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN\"");
91.156 - output.println(" \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/toc_1_0.dtd\">");
91.157 - output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/toc_1_0.dtd\"-->");
91.158 - output.println();
91.159 - output.println("<toc version=\"1.0\">");
91.160 -
91.161 - while ((line = input.readLine()) != null && line.indexOf("<!--Table of Child-Links-->") == (-1))
91.162 - ;
91.163 -
91.164 - output.println("<tocitem text=\"Jackpot 3.0 Support Help\" target=\"jackpot30.default\">");
91.165 - while ((line = input.readLine()) != null && line.indexOf("<!--End of Table of Child-Links-->") == (-1)) {
91.166 - if (line.startsWith("<UL ")) {
91.167 - noStop = true;
91.168 - continue;
91.169 - }
91.170 -
91.171 - if (line.indexOf("HREF=\"") != (-1)) {
91.172 - if (noStop) {
91.173 - noStop = false;
91.174 - } else {
91.175 - output.println("</tocitem>");
91.176 - }
91.177 -
91.178 - String file = line.split("\"")[1];
91.179 - String name = line.split(">")[1].split("<")[0];
91.180 -
91.181 - output.println("<tocitem text=\"" + name + "\" target=\"" + (map.get(file) != null ? map.get(file) : "test") + "\">");
91.182 -
91.183 - continue;
91.184 - }
91.185 -
91.186 - if (line.startsWith("</UL>") && !noStop) {
91.187 - output.println("</tocitem>");
91.188 - continue;
91.189 - }
91.190 - }
91.191 -
91.192 - output.println("</tocitem>");
91.193 -
91.194 - output.println("</toc>");
91.195 -
91.196 - output.close();
91.197 - input.close();
91.198 - }
91.199 -}
92.1 --- a/help/src/org/netbeans/modules/jackpot30/help/jackpot30-helpset.xml Sat Feb 18 22:14:42 2012 +0100
92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
92.3 @@ -1,3 +0,0 @@
92.4 -<?xml version="1.0" encoding="UTF-8"?>
92.5 -<!DOCTYPE helpsetref PUBLIC "-//NetBeans//DTD JavaHelp Help Set Reference 1.0//EN" "http://www.netbeans.org/dtds/helpsetref-1_0.dtd">
92.6 -<helpsetref url="nbdocs:/org/netbeans/modules/jackpot30/help/docs/jackpot30-helpset.xml" />
93.1 --- a/help/src/org/netbeans/modules/jackpot30/help/layer.xml Sat Feb 18 22:14:42 2012 +0100
93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
93.3 @@ -1,11 +0,0 @@
93.4 -<?xml version="1.0" encoding="UTF-8"?>
93.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
93.6 -<filesystem>
93.7 - <folder name="Services">
93.8 - <folder name="JavaHelp">
93.9 - <file name="jackpot30-helpset.xml" url="jackpot30-helpset.xml">
93.10 - <attr name="position" intvalue="3456"/>
93.11 - </file>
93.12 - </folder>
93.13 - </folder>
93.14 -</filesystem>
94.1 --- a/hintsimpl/build.xml Sat Feb 18 22:14:42 2012 +0100
94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
94.3 @@ -1,11 +0,0 @@
94.4 -<?xml version="1.0" encoding="UTF-8"?>
94.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
94.6 -<!-- for some information on what you could do (e.g. targets to override). -->
94.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
94.8 -<project name="org.netbeans.modules.jackpot30.hintsimpl" default="netbeans" basedir=".">
94.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.hintsimpl.</description>
94.10 - <import file="nbproject/build-impl.xml"/>
94.11 - <import file="${suite.dir}/findbugs-import.xml"/>
94.12 - <target name="test-coverage" />
94.13 - <target name="coverage-report" />
94.14 -</project>
95.1 --- a/hintsimpl/manifest.mf Sat Feb 18 22:14:42 2012 +0100
95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
95.3 @@ -1,7 +0,0 @@
95.4 -Manifest-Version: 1.0
95.5 -AutoUpdate-Show-In-Client: false
95.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.hintsimpl
95.7 -OpenIDE-Module-Implementation-Version: 1
95.8 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/hintsimpl/layer.xml
95.9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
95.10 -
96.1 --- a/hintsimpl/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
96.3 @@ -1,45 +0,0 @@
96.4 -<?xml version="1.0" encoding="UTF-8"?>
96.5 -<!--
96.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
96.7 -*** EDIT ../build.xml INSTEAD ***
96.8 --->
96.9 -<project name="org.netbeans.modules.jackpot30.hintsimpl-impl" basedir="..">
96.10 - <fail message="Please build using Ant 1.7.1 or higher.">
96.11 - <condition>
96.12 - <not>
96.13 - <antversion atleast="1.7.1"/>
96.14 - </not>
96.15 - </condition>
96.16 - </fail>
96.17 - <property file="nbproject/private/suite-private.properties"/>
96.18 - <property file="nbproject/suite.properties"/>
96.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
96.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
96.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
96.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
96.23 - <attribute name="name"/>
96.24 - <attribute name="value"/>
96.25 - <sequential>
96.26 - <property name="@{name}" value="${@{value}}"/>
96.27 - </sequential>
96.28 - </macrodef>
96.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
96.30 - <attribute name="property"/>
96.31 - <attribute name="value"/>
96.32 - <sequential>
96.33 - <property name="@{property}" value="@{value}"/>
96.34 - </sequential>
96.35 - </macrodef>
96.36 - <property file="${user.properties.file}"/>
96.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
96.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
96.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
96.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
96.41 - <condition>
96.42 - <not>
96.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
96.44 - </not>
96.45 - </condition>
96.46 - </fail>
96.47 - <import file="${harness.dir}/build.xml"/>
96.48 -</project>
97.1 --- a/hintsimpl/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
97.3 @@ -1,8 +0,0 @@
97.4 -build.xml.data.CRC32=772824b9
97.5 -build.xml.script.CRC32=ef577a91
97.6 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
97.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
97.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
97.9 -nbproject/build-impl.xml.data.CRC32=2dfd5d11
97.10 -nbproject/build-impl.xml.script.CRC32=9204f652
97.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
98.1 --- a/hintsimpl/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
98.3 @@ -1,4 +0,0 @@
98.4 -javac.source=1.5
98.5 -javac.compilerargs=-Xlint -Xlint:-serial
98.6 -project.license=cddl-netbeans-sun
98.7 -spec.version.base=1.16.0
99.1 --- a/hintsimpl/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
99.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
99.3 @@ -1,276 +0,0 @@
99.4 -<?xml version="1.0" encoding="UTF-8"?>
99.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
99.6 - <type>org.netbeans.modules.apisupport.project</type>
99.7 - <configuration>
99.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
99.9 - <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
99.10 - <suite-component/>
99.11 - <module-dependencies>
99.12 - <dependency>
99.13 - <code-name-base>org.jdesktop.layout</code-name-base>
99.14 - <build-prerequisite/>
99.15 - <compile-dependency/>
99.16 - <run-dependency>
99.17 - <release-version>1</release-version>
99.18 - <specification-version>1.7.0.103</specification-version>
99.19 - </run-dependency>
99.20 - </dependency>
99.21 - <dependency>
99.22 - <code-name-base>org.netbeans.api.java.classpath</code-name-base>
99.23 - <build-prerequisite/>
99.24 - <compile-dependency/>
99.25 - <run-dependency>
99.26 - <release-version>1</release-version>
99.27 - <specification-version>1.19</specification-version>
99.28 - </run-dependency>
99.29 - </dependency>
99.30 - <dependency>
99.31 - <code-name-base>org.netbeans.api.progress</code-name-base>
99.32 - <build-prerequisite/>
99.33 - <compile-dependency/>
99.34 - <run-dependency>
99.35 - <release-version>1</release-version>
99.36 - <specification-version>1.13.0.1</specification-version>
99.37 - </run-dependency>
99.38 - </dependency>
99.39 - <dependency>
99.40 - <code-name-base>org.netbeans.libs.javacapi</code-name-base>
99.41 - <build-prerequisite/>
99.42 - <compile-dependency/>
99.43 - <run-dependency>
99.44 - <specification-version>0.8.0.1</specification-version>
99.45 - </run-dependency>
99.46 - </dependency>
99.47 - <dependency>
99.48 - <code-name-base>org.netbeans.modules.editor</code-name-base>
99.49 - <build-prerequisite/>
99.50 - <compile-dependency/>
99.51 - <run-dependency>
99.52 - <release-version>3</release-version>
99.53 - <specification-version>1.42.0.3.9.2</specification-version>
99.54 - </run-dependency>
99.55 - </dependency>
99.56 - <dependency>
99.57 - <code-name-base>org.netbeans.modules.editor.guards</code-name-base>
99.58 - <build-prerequisite/>
99.59 - <compile-dependency/>
99.60 - <run-dependency>
99.61 - <release-version>1</release-version>
99.62 - <specification-version>1.3</specification-version>
99.63 - </run-dependency>
99.64 - </dependency>
99.65 - <dependency>
99.66 - <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
99.67 - <build-prerequisite/>
99.68 - <compile-dependency/>
99.69 - <run-dependency>
99.70 - <release-version>1-3</release-version>
99.71 - <specification-version>1.38.0.9.2</specification-version>
99.72 - </run-dependency>
99.73 - </dependency>
99.74 - <dependency>
99.75 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
99.76 - <build-prerequisite/>
99.77 - <compile-dependency/>
99.78 - <run-dependency>
99.79 - <specification-version>1.0</specification-version>
99.80 - </run-dependency>
99.81 - </dependency>
99.82 - <dependency>
99.83 - <code-name-base>org.netbeans.modules.java.editor</code-name-base>
99.84 - <run-dependency>
99.85 - <release-version>1</release-version>
99.86 - <specification-version>2.22</specification-version>
99.87 - </run-dependency>
99.88 - </dependency>
99.89 - <dependency>
99.90 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
99.91 - <build-prerequisite/>
99.92 - <compile-dependency/>
99.93 - <run-dependency>
99.94 - <release-version>1</release-version>
99.95 - <implementation-version/>
99.96 - </run-dependency>
99.97 - </dependency>
99.98 - <dependency>
99.99 - <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
99.100 - <build-prerequisite/>
99.101 - <compile-dependency/>
99.102 - <run-dependency>
99.103 - <release-version>1</release-version>
99.104 - <specification-version>1.5</specification-version>
99.105 - </run-dependency>
99.106 - </dependency>
99.107 - <dependency>
99.108 - <code-name-base>org.netbeans.modules.java.source</code-name-base>
99.109 - <build-prerequisite/>
99.110 - <compile-dependency/>
99.111 - <run-dependency>
99.112 - <specification-version>0.53</specification-version>
99.113 - </run-dependency>
99.114 - </dependency>
99.115 - <dependency>
99.116 - <code-name-base>org.netbeans.modules.lexer</code-name-base>
99.117 - <build-prerequisite/>
99.118 - <compile-dependency/>
99.119 - <run-dependency>
99.120 - <release-version>2</release-version>
99.121 - <specification-version>1.30.0.1</specification-version>
99.122 - </run-dependency>
99.123 - </dependency>
99.124 - <dependency>
99.125 - <code-name-base>org.netbeans.modules.options.api</code-name-base>
99.126 - <build-prerequisite/>
99.127 - <compile-dependency/>
99.128 - <run-dependency>
99.129 - <release-version>1</release-version>
99.130 - <specification-version>1.12</specification-version>
99.131 - </run-dependency>
99.132 - </dependency>
99.133 - <dependency>
99.134 - <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
99.135 - <build-prerequisite/>
99.136 - <compile-dependency/>
99.137 - <run-dependency>
99.138 - <release-version>1</release-version>
99.139 - <specification-version>1.12.1</specification-version>
99.140 - </run-dependency>
99.141 - </dependency>
99.142 - <dependency>
99.143 - <code-name-base>org.netbeans.modules.projectapi</code-name-base>
99.144 - <build-prerequisite/>
99.145 - <compile-dependency/>
99.146 - <run-dependency>
99.147 - <release-version>1</release-version>
99.148 - <specification-version>1.24</specification-version>
99.149 - </run-dependency>
99.150 - </dependency>
99.151 - <dependency>
99.152 - <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
99.153 - <build-prerequisite/>
99.154 - <compile-dependency/>
99.155 - <run-dependency>
99.156 - <release-version>1</release-version>
99.157 - <specification-version>1.34.0.6</specification-version>
99.158 - </run-dependency>
99.159 - </dependency>
99.160 - <dependency>
99.161 - <code-name-base>org.netbeans.modules.sendopts</code-name-base>
99.162 - <build-prerequisite/>
99.163 - <compile-dependency/>
99.164 - <run-dependency>
99.165 - <release-version>2</release-version>
99.166 - <specification-version>2.4</specification-version>
99.167 - </run-dependency>
99.168 - </dependency>
99.169 - <dependency>
99.170 - <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
99.171 - <build-prerequisite/>
99.172 - <compile-dependency/>
99.173 - <run-dependency>
99.174 - <release-version>0-1</release-version>
99.175 - <specification-version>1.7.0.7.2</specification-version>
99.176 - </run-dependency>
99.177 - </dependency>
99.178 - <dependency>
99.179 - <code-name-base>org.netbeans.spi.tasklist</code-name-base>
99.180 - <build-prerequisite/>
99.181 - <compile-dependency/>
99.182 - <run-dependency>
99.183 - <release-version>1</release-version>
99.184 - <specification-version>1.4.0.1</specification-version>
99.185 - </run-dependency>
99.186 - </dependency>
99.187 - <dependency>
99.188 - <code-name-base>org.openide.awt</code-name-base>
99.189 - <build-prerequisite/>
99.190 - <compile-dependency/>
99.191 - <run-dependency>
99.192 - <specification-version>7.7.0.1</specification-version>
99.193 - </run-dependency>
99.194 - </dependency>
99.195 - <dependency>
99.196 - <code-name-base>org.openide.dialogs</code-name-base>
99.197 - <build-prerequisite/>
99.198 - <compile-dependency/>
99.199 - <run-dependency>
99.200 - <specification-version>7.10</specification-version>
99.201 - </run-dependency>
99.202 - </dependency>
99.203 - <dependency>
99.204 - <code-name-base>org.openide.filesystems</code-name-base>
99.205 - <build-prerequisite/>
99.206 - <compile-dependency/>
99.207 - <run-dependency>
99.208 - <specification-version>7.21.0.1.1</specification-version>
99.209 - </run-dependency>
99.210 - </dependency>
99.211 - <dependency>
99.212 - <code-name-base>org.openide.loaders</code-name-base>
99.213 - <build-prerequisite/>
99.214 - <compile-dependency/>
99.215 - <run-dependency>
99.216 - <specification-version>7.5</specification-version>
99.217 - </run-dependency>
99.218 - </dependency>
99.219 - <dependency>
99.220 - <code-name-base>org.openide.nodes</code-name-base>
99.221 - <build-prerequisite/>
99.222 - <compile-dependency/>
99.223 - <run-dependency>
99.224 - <specification-version>7.9.0.1</specification-version>
99.225 - </run-dependency>
99.226 - </dependency>
99.227 - <dependency>
99.228 - <code-name-base>org.openide.text</code-name-base>
99.229 - <build-prerequisite/>
99.230 - <compile-dependency/>
99.231 - <run-dependency>
99.232 - <specification-version>6.22</specification-version>
99.233 - </run-dependency>
99.234 - </dependency>
99.235 - <dependency>
99.236 - <code-name-base>org.openide.util</code-name-base>
99.237 - <build-prerequisite/>
99.238 - <compile-dependency/>
99.239 - <run-dependency>
99.240 - <specification-version>7.22.0.1</specification-version>
99.241 - </run-dependency>
99.242 - </dependency>
99.243 - <dependency>
99.244 - <code-name-base>org.openide.windows</code-name-base>
99.245 - <build-prerequisite/>
99.246 - <compile-dependency/>
99.247 - <run-dependency>
99.248 - <specification-version>6.26</specification-version>
99.249 - </run-dependency>
99.250 - </dependency>
99.251 - </module-dependencies>
99.252 - <test-dependencies>
99.253 - <test-type>
99.254 - <name>unit</name>
99.255 - <test-dependency>
99.256 - <code-name-base>org.netbeans.libs.junit4</code-name-base>
99.257 - <compile-dependency/>
99.258 - </test-dependency>
99.259 - <test-dependency>
99.260 - <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
99.261 - <recursive/>
99.262 - <compile-dependency/>
99.263 - </test-dependency>
99.264 - <test-dependency>
99.265 - <code-name-base>org.netbeans.modules.java.hints.declarative.test</code-name-base>
99.266 - <recursive/>
99.267 - <compile-dependency/>
99.268 - </test-dependency>
99.269 - <test-dependency>
99.270 - <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
99.271 - <recursive/>
99.272 - <compile-dependency/>
99.273 - </test-dependency>
99.274 - </test-type>
99.275 - </test-dependencies>
99.276 - <public-packages/>
99.277 - </data>
99.278 - </configuration>
99.279 -</project>
100.1 --- a/hintsimpl/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
100.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
100.3 @@ -1,1 +0,0 @@
100.4 -suite.dir=${basedir}/..
101.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
101.3 @@ -1,38 +0,0 @@
101.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
101.5 -#
101.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
101.7 -#
101.8 -# The contents of this file are subject to the terms of either the GNU
101.9 -# General Public License Version 2 only ("GPL") or the Common
101.10 -# Development and Distribution License("CDDL") (collectively, the
101.11 -# "License"). You may not use this file except in compliance with the
101.12 -# License. You can obtain a copy of the License at
101.13 -# http://www.netbeans.org/cddl-gplv2.html
101.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
101.15 -# specific language governing permissions and limitations under the
101.16 -# License. When distributing the software, include this License Header
101.17 -# Notice in each file and include the License file at
101.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
101.19 -# particular file as subject to the "Classpath" exception as provided
101.20 -# by Sun in the GPL Version 2 section of the License file that
101.21 -# accompanied this code. If applicable, add the following below the
101.22 -# License Header, with the fields enclosed by brackets [] replaced by
101.23 -# your own identifying information:
101.24 -# "Portions Copyrighted [year] [name of copyright owner]"
101.25 -#
101.26 -# If you wish your version of this file to be governed by only the CDDL
101.27 -# or only the GPL Version 2, indicate your decision by adding
101.28 -# "[Contributor] elects to include this software in this distribution
101.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
101.30 -# single choice of license, a recipient has the option to distribute
101.31 -# your version of this file under either the CDDL, the GPL Version 2 or
101.32 -# to extend the choice of license to its licensees as provided above.
101.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
101.34 -# Version 2 license, then the option applies only if the new code is
101.35 -# made subject to such option by the copyright holder.
101.36 -#
101.37 -# Contributor(s):
101.38 -#
101.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
101.40 -
101.41 -OpenIDE-Module-Name=Hints Impl
102.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.hint Sat Feb 18 22:14:42 2012 +0100
102.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
102.3 @@ -1,37 +0,0 @@
102.4 -{ $1$;
102.5 -$0.readLock();
102.6 -$stmts$;
102.7 -$0.readUnlock();
102.8 -$2$;
102.9 -}
102.10 -:: $0 instanceof javax.swing.text.AbstractDocument
102.11 -=>
102.12 -{ $1$;
102.13 -$0.readLock();
102.14 -try {
102.15 - $stmts$;
102.16 -} finally {
102.17 - $0.readUnlock();
102.18 -}
102.19 -$2$;
102.20 -}
102.21 -;;
102.22 -
102.23 -{ $1$;
102.24 -$0.writeLock();
102.25 -$stmts$;
102.26 -$0.writeUnlock();
102.27 -$2$;
102.28 -}
102.29 -:: $0 instanceof javax.swing.text.AbstractDocument
102.30 -=>
102.31 -{ $1$;
102.32 -$0.writeLock();
102.33 -try {
102.34 - $stmts$;
102.35 -} finally {
102.36 - $0.writeUnlock();
102.37 -}
102.38 -$2$;
102.39 -}
102.40 -;;
103.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/assert2if.hint Sat Feb 18 22:14:42 2012 +0100
103.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
103.3 @@ -1,4 +0,0 @@
103.4 -'Use of assert':
103.5 -assert $1 : $2; :: $1 instanceof boolean && $2 instanceof java.lang.Object
103.6 - => if (!$1) throw new IllegalStateException($2);
103.7 - ;;
104.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.hint Sat Feb 18 22:14:42 2012 +0100
104.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
104.3 @@ -1,14 +0,0 @@
104.4 -'Double checked locking':
104.5 -if ($var == null) {
104.6 - synchronized ($lock) {
104.7 - if ($var == null) {
104.8 - $s2$;
104.9 - }
104.10 - }
104.11 -} :: !hasModifier($var, Modifier.VOLATILE)
104.12 -=>
104.13 -synchronized ($lock) {
104.14 - if ($var == null) {
104.15 - $s2$;
104.16 - }
104.17 -};;
105.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.hint Sat Feb 18 22:14:42 2012 +0100
105.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
105.3 @@ -1,7 +0,0 @@
105.4 -if ($a) return $b; else return $c; => return $a ? $b : $c; ;;
105.5 -if ($a) $ret = $b; else $ret = $c; => $ret = $a ? $b : $c; ;;
105.6 -if ($a) $b=$c; else if ($a2) $b = $d; => $b = $a ? $c : $a2 ? $d : $b; ;;
105.7 -$a ? ($T)$b : ($T)$c => ($T)($a ? $b : $c) ;;
105.8 -//the following hint causes BulkSearch to be extremelly slow:
105.9 -//{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; } => { $p$; $T $v = $a ? $b : $c; $q$; } ;;
105.10 -
106.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.hint Sat Feb 18 22:14:42 2012 +0100
106.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
106.3 @@ -1,43 +0,0 @@
106.4 -'Convert to Enhanced For':
106.5 -for(int $i = 0; $i < $array.length; $i++) {
106.6 - $T $var = ($T) $array[$i];
106.7 - $stmts$;
106.8 -} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
106.9 -=>
106.10 -for($T $var : $array) {
106.11 - $stmts$;
106.12 -}
106.13 -;;
106.14 -
106.15 -'Convert to Enhanced For':
106.16 -for(int $i = 0; $i < $array.length; $i++) {
106.17 - $T $var = $array[$i];
106.18 - $stmts$;
106.19 -} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
106.20 -=>
106.21 -for($T $var : $array) {
106.22 - $stmts$;
106.23 -}
106.24 -;;
106.25 -
106.26 -'Convert to Enhanced For':
106.27 -for($I $i = $iterable.iterator(); $i.hasNext();) {
106.28 - $T $var = ($T)$i.next();
106.29 - $stmts$;
106.30 -} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
106.31 -=>
106.32 -for($T $var : $iterable) {
106.33 - $stmts$;
106.34 -}
106.35 -;;
106.36 -
106.37 -'Convert to Enhanced For':
106.38 -for($I $i = $iterable.iterator(); $i.hasNext();) {
106.39 - $T $var = $i.next();
106.40 - $stmts$;
106.41 -} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
106.42 -=>
106.43 -for($T $var : $iterable) {
106.44 - $stmts$;
106.45 -}
106.46 -;;
107.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
107.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
107.3 @@ -1,7 +0,0 @@
107.4 -DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
107.5 -DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
107.6 -DN_jdk7_upgrade=To JDK7
107.7 -DN_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
107.8 -DESC_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
107.9 -DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings ignoring the eq operator
107.10 -DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings, ignoring the == operator
108.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/SafeConvertToSwitchString.java Sat Feb 18 22:14:42 2012 +0100
108.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
108.3 @@ -1,80 +0,0 @@
108.4 -/*
108.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
108.6 - *
108.7 - * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
108.8 - *
108.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
108.10 - * Other names may be trademarks of their respective owners.
108.11 - *
108.12 - * The contents of this file are subject to the terms of either the GNU
108.13 - * General Public License Version 2 only ("GPL") or the Common
108.14 - * Development and Distribution License("CDDL") (collectively, the
108.15 - * "License"). You may not use this file except in compliance with the
108.16 - * License. You can obtain a copy of the License at
108.17 - * http://www.netbeans.org/cddl-gplv2.html
108.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
108.19 - * specific language governing permissions and limitations under the
108.20 - * License. When distributing the software, include this License Header
108.21 - * Notice in each file and include the License file at
108.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
108.23 - * particular file as subject to the "Classpath" exception as provided
108.24 - * by Oracle in the GPL Version 2 section of the License file that
108.25 - * accompanied this code. If applicable, add the following below the
108.26 - * License Header, with the fields enclosed by brackets [] replaced by
108.27 - * your own identifying information:
108.28 - * "Portions Copyrighted [year] [name of copyright owner]"
108.29 - *
108.30 - * If you wish your version of this file to be governed by only the CDDL
108.31 - * or only the GPL Version 2, indicate your decision by adding
108.32 - * "[Contributor] elects to include this software in this distribution
108.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
108.34 - * single choice of license, a recipient has the option to distribute
108.35 - * your version of this file under either the CDDL, the GPL Version 2 or
108.36 - * to extend the choice of license to its licensees as provided above.
108.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
108.38 - * Version 2 license, then the option applies only if the new code is
108.39 - * made subject to such option by the copyright holder.
108.40 - *
108.41 - * Contributor(s):
108.42 - *
108.43 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
108.44 - */
108.45 -
108.46 -package org.netbeans.modules.jackpot30.hintsimpl.jdk7;
108.47 -
108.48 -import java.util.List;
108.49 -import java.util.prefs.Preferences;
108.50 -import org.netbeans.modules.java.hints.jackpot.code.spi.Hint;
108.51 -import org.netbeans.modules.java.hints.jackpot.code.spi.TriggerPattern;
108.52 -import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
108.53 -import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
108.54 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata.Options;
108.55 -import org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch;
108.56 -import org.netbeans.modules.java.hints.options.HintsSettings;
108.57 -import org.netbeans.spi.editor.hints.ErrorDescription;
108.58 -
108.59 -/**
108.60 - *
108.61 - * @author lahvac
108.62 - */
108.63 -@Hint(category="rules15",enabled=false, options=Options.NON_GUI)
108.64 -public class SafeConvertToSwitchString {
108.65 -
108.66 - static final String KEY_ALSO_EQ = "also-equals";
108.67 - static final boolean DEF_ALSO_EQ = true;
108.68 -
108.69 - @TriggerPattern(value="if ($cond) $body; else $else;")
108.70 - public static List<ErrorDescription> hint(HintContext ctx) {
108.71 - Preferences prefs = RulesManager.getPreferences("org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch", HintsSettings.getCurrentProfileId());
108.72 - boolean old = prefs.getBoolean(KEY_ALSO_EQ, DEF_ALSO_EQ);
108.73 -
108.74 - prefs.putBoolean(KEY_ALSO_EQ, false);
108.75 -
108.76 - try {
108.77 - return ConvertToStringSwitch.hint(ctx);
108.78 - } finally {
108.79 - prefs.putBoolean(KEY_ALSO_EQ, old);
108.80 - }
108.81 - }
108.82 -
108.83 -}
109.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.hint Sat Feb 18 22:14:42 2012 +0100
109.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
109.3 @@ -1,99 +0,0 @@
109.4 -<!hint="java.util.Objects">
109.5 -//java.util.Objects.equals:
109.6 -($1 == null) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.7 -=>java.util.Objects.equals($1, $2)
109.8 -;;
109.9 -
109.10 -(null == $1) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.11 -=>java.util.Objects.equals($1, $2)
109.12 -;;
109.13 -
109.14 -($1 == null) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.15 -=>java.util.Objects.equals($1, $2)
109.16 -;;
109.17 -
109.18 -(null == $1) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.19 -=>java.util.Objects.equals($1, $2)
109.20 -;;
109.21 -
109.22 -$1 != $2 && ($1 == null || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.23 -=>java.util.Objects.equals($1, $2)
109.24 -;;
109.25 -
109.26 -$1 != $2 && (null == $1 || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.27 -=>java.util.Objects.equals($1, $2)
109.28 -;;
109.29 -
109.30 -($1 == null) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.31 -=>java.util.Objects.equals($1, $2)
109.32 -;;
109.33 -
109.34 -(null == $1) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.35 -=>java.util.Objects.equals($1, $2)
109.36 -;;
109.37 -
109.38 -($1 == null) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.39 -=>java.util.Objects.equals($1, $2)
109.40 -;;
109.41 -
109.42 -(null == $1) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.43 -=>java.util.Objects.equals($1, $2)
109.44 -;;
109.45 -
109.46 -($1 != null) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.47 -=>java.util.Objects.equals($1, $2)
109.48 -;;
109.49 -
109.50 -(null != $1) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.51 -=>java.util.Objects.equals($1, $2)
109.52 -;;
109.53 -
109.54 -($1 != null) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.55 -=>java.util.Objects.equals($1, $2)
109.56 -;;
109.57 -
109.58 -(null != $1) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.59 -=>java.util.Objects.equals($1, $2)
109.60 -;;
109.61 -
109.62 -$1 == $2 && ($1 == null || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.63 -=>java.util.Objects.equals($1, $2)
109.64 -;;
109.65 -
109.66 -$1 == $2 && (null == $1 || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
109.67 -=>java.util.Objects.equals($1, $2)
109.68 -;;
109.69 -
109.70 -//java.util.Objects.hashCode:
109.71 -$1 != null ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
109.72 -=>java.util.Objects.hashCode($1)
109.73 -;;
109.74 -
109.75 -null != $1 ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
109.76 -=>java.util.Objects.hashCode($1)
109.77 -;;
109.78 -
109.79 -$1 == null ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
109.80 -=>java.util.Objects.hashCode($1)
109.81 -;;
109.82 -
109.83 -null == $1 ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
109.84 -=>java.util.Objects.hashCode($1)
109.85 -;;
109.86 -
109.87 -//java.util.Objects.toString:
109.88 -$1 != null ? $1.toString() : $def :: $1 instanceof java.lang.Object
109.89 -=>java.util.Objects.toString($1, $def)
109.90 -;;
109.91 -
109.92 -null != $1 ? $1.toString() : $def :: $1 instanceof java.lang.Object
109.93 -=>java.util.Objects.toString($1, $def)
109.94 -;;
109.95 -
109.96 -$1 == null ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
109.97 -=>java.util.Objects.hashCode($1, $def)
109.98 -;;
109.99 -
109.100 -null == $1 ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
109.101 -=>java.util.Objects.hashCode($1, $def)
109.102 -;;
110.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/jdk7.upgrade Sat Feb 18 22:14:42 2012 +0100
110.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
110.3 @@ -1,12 +0,0 @@
110.4 -{
110.5 - "upgradeName" : "jdk7_upgrade",
110.6 - "bundle" : "org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle",
110.7 - "hints" : [
110.8 - "org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint",
110.9 - "org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch",
110.10 - "org.netbeans.modules.java.hints.jdk.ConvertToARM",
110.11 - "org.netbeans.modules.java.hints.jdk.JoinCatches",
110.12 - "org.netbeans.modules.java.hints.jdk.UseSpecificCatch",
110.13 - "java.util.Objects"
110.14 - ]
110.15 -}
111.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/layer.xml Sat Feb 18 22:14:42 2012 +0100
111.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
111.3 @@ -1,63 +0,0 @@
111.4 -<?xml version="1.0" encoding="UTF-8"?>
111.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
111.6 -<!--
111.7 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
111.8 -
111.9 -Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
111.10 -
111.11 -
111.12 -The contents of this file are subject to the terms of either the GNU
111.13 -General Public License Version 2 only ("GPL") or the Common
111.14 -Development and Distribution License("CDDL") (collectively, the
111.15 -"License"). You may not use this file except in compliance with the
111.16 -License. You can obtain a copy of the License at
111.17 -http://www.netbeans.org/cddl-gplv2.html
111.18 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
111.19 -specific language governing permissions and limitations under the
111.20 -License. When distributing the software, include this License Header
111.21 -Notice in each file and include the License file at
111.22 -nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
111.23 -particular file as subject to the "Classpath" exception as provided
111.24 -by Sun in the GPL Version 2 section of the License file that
111.25 -accompanied this code. If applicable, add the following below the
111.26 -License Header, with the fields enclosed by brackets [] replaced by
111.27 -your own identifying information:
111.28 -"Portions Copyrighted [year] [name of copyright owner]"
111.29 -
111.30 -Contributor(s):
111.31 -
111.32 -The Original Software is NetBeans. The Initial Developer of the Original
111.33 -Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
111.34 -Microsystems, Inc. All Rights Reserved.
111.35 -
111.36 -If you wish your version of this file to be governed by only the CDDL
111.37 -or only the GPL Version 2, indicate your decision by adding
111.38 -"[Contributor] elects to include this software in this distribution
111.39 -under the [CDDL or GPL Version 2] license." If you do not indicate a
111.40 -single choice of license, a recipient has the option to distribute
111.41 -your version of this file under either the CDDL, the GPL Version 2 or
111.42 -to extend the choice of license to its licensees as provided above.
111.43 -However, if you add GPL Version 2 code and therefore, elected the GPL
111.44 -Version 2 license, then the option applies only if the new code is
111.45 -made subject to such option by the copyright holder.
111.46 --->
111.47 -<filesystem>
111.48 -
111.49 - <folder name="org-netbeans-modules-java-hints">
111.50 - <folder name="declarative">
111.51 - <file name="Bundle.properties" url="jdk7/Bundle.properties" /> <!--XXX-->
111.52 - <file name="assert2if.hint" url="assert2if.hint" />
111.53 - <file name="variable-decl-assignment.hint" url="variable-decl-assignment.hint" />
111.54 - <file name="double-checked-locking.hint" url="double-checked-locking.hint" />
111.55 - <file name="sync-on-non-final.hint" url="sync-on-non-final.hint" />
111.56 - <file name="abstract-document.hint" url="abstract-document.hint" />
111.57 - <file name="AddConditionals.hint" url="jackpot/AddConditionals.hint" />
111.58 - <file name="EnhancedFor.hint" url="jackpot/EnhancedFor.hint" />
111.59 - <file name="java.util.Objects.hint" url="jdk7/java.util.Objects.hint" />
111.60 - </folder>
111.61 - <folder name="upgrades">
111.62 - <file name="jdk7.upgrade" url="jdk7/jdk7.upgrade" />
111.63 - </folder>
111.64 - </folder>
111.65 -
111.66 -</filesystem>
112.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/sync-on-non-final.hint Sat Feb 18 22:14:42 2012 +0100
112.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
112.3 @@ -1,5 +0,0 @@
112.4 -'Synchronizing on non-final field':
112.5 -synchronized($var) {
112.6 - $stmts$;
112.7 -} :: !hasModifier($var, Modifier.FINAL) && elementKindMatches($var, ElementKind.FIELD)
112.8 -;;
113.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/variable-decl-assignment.hint Sat Feb 18 22:14:42 2012 +0100
113.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
113.3 @@ -1,4 +0,0 @@
113.4 -'Separated variable declaration and assignment':
113.5 -{ $1 $2; $2 = $3; }
113.6 - => { $1 $2 = $3; }
113.7 - ;;
114.1 --- a/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.hint Sat Feb 18 22:14:42 2012 +0100
114.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
114.3 @@ -1,31 +0,0 @@
114.4 -'Wrong string comparison':
114.5 -$left == $right :: $left instanceof java.lang.String
114.6 - && $right instanceof java.lang.String
114.7 - && !isNullLiteral($left)
114.8 - && !isNullLiteral($right)
114.9 -=>$left == null ? $right == null : $left.equals($right)
114.10 -=>$left.equals($right)
114.11 -;;
114.12 -
114.13 -'Wrong string comparison':
114.14 -$left != $right :: $left instanceof java.lang.String
114.15 - && $right instanceof java.lang.String
114.16 - && !isNullLiteral($left)
114.17 - && !isNullLiteral($right)
114.18 - && !acceptGenerated($left, $right)
114.19 -=>!($left == null ? $right == null : $left.equals($right))
114.20 -=>!$left.equals($right)
114.21 -;;
114.22 -
114.23 -<?
114.24 -private boolean acceptGenerated(Variable left, Variable right) {
114.25 - Variable parent = left;
114.26 -
114.27 - while ((parent = context.parent(parent)) != null) {
114.28 - if (matcher.matches(parent, "$left != $right && ($left == null || $left.equals($right))"))
114.29 - return true;
114.30 - }
114.31 -
114.32 - return false;
114.33 -}
114.34 -?>
115.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/HintsTest.java Sat Feb 18 22:14:42 2012 +0100
115.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
115.3 @@ -1,55 +0,0 @@
115.4 -/*
115.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
115.6 - *
115.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
115.8 - *
115.9 - * The contents of this file are subject to the terms of either the GNU
115.10 - * General Public License Version 2 only ("GPL") or the Common
115.11 - * Development and Distribution License("CDDL") (collectively, the
115.12 - * "License"). You may not use this file except in compliance with the
115.13 - * License. You can obtain a copy of the License at
115.14 - * http://www.netbeans.org/cddl-gplv2.html
115.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
115.16 - * specific language governing permissions and limitations under the
115.17 - * License. When distributing the software, include this License Header
115.18 - * Notice in each file and include the License file at
115.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
115.20 - * particular file as subject to the "Classpath" exception as provided
115.21 - * by Sun in the GPL Version 2 section of the License file that
115.22 - * accompanied this code. If applicable, add the following below the
115.23 - * License Header, with the fields enclosed by brackets [] replaced by
115.24 - * your own identifying information:
115.25 - * "Portions Copyrighted [year] [name of copyright owner]"
115.26 - *
115.27 - * If you wish your version of this file to be governed by only the CDDL
115.28 - * or only the GPL Version 2, indicate your decision by adding
115.29 - * "[Contributor] elects to include this software in this distribution
115.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
115.31 - * single choice of license, a recipient has the option to distribute
115.32 - * your version of this file under either the CDDL, the GPL Version 2 or
115.33 - * to extend the choice of license to its licensees as provided above.
115.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
115.35 - * Version 2 license, then the option applies only if the new code is
115.36 - * made subject to such option by the copyright holder.
115.37 - *
115.38 - * Contributor(s):
115.39 - *
115.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
115.41 - */
115.42 -
115.43 -package org.netbeans.modules.jackpot30.hintsimpl;
115.44 -
115.45 -import junit.framework.TestSuite;
115.46 -import org.netbeans.modules.java.hints.declarative.test.api.DeclarativeHintsTestBase;
115.47 -
115.48 -/**
115.49 - *
115.50 - * @author lahvac
115.51 - */
115.52 -public class HintsTest extends DeclarativeHintsTestBase {
115.53 -
115.54 - public static TestSuite suite() {
115.55 - return suite(HintsTest.class);
115.56 - }
115.57 -
115.58 -}
116.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.test Sat Feb 18 22:14:42 2012 +0100
116.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
116.3 @@ -1,46 +0,0 @@
116.4 -%%TestCase simple-readlock
116.5 -package test;
116.6 -import javax.swing.text.AbstractDocument;
116.7 -public class Test {
116.8 - private void test(AbstractDocument d) {
116.9 - d.readLock();
116.10 - System.err.println(d.getText(0, d.getLength()));
116.11 - d.readUnlock();
116.12 - }
116.13 -}
116.14 -%%=>
116.15 -package test;
116.16 -import javax.swing.text.AbstractDocument;
116.17 -public class Test {
116.18 - private void test(AbstractDocument d) {
116.19 - d.readLock();
116.20 - try {
116.21 - System.err.println(d.getText(0, d.getLength()));
116.22 - } finally {
116.23 - d.readUnlock();
116.24 - }
116.25 - }
116.26 -}
116.27 -%%TestCase simple-writelock
116.28 -package test;
116.29 -import javax.swing.text.AbstractDocument;
116.30 -public class Test {
116.31 - private void test(AbstractDocument d) {
116.32 - d.writeLock();
116.33 - System.err.println(d.getText(0, d.getLength()));
116.34 - d.writeUnlock();
116.35 - }
116.36 -}
116.37 -%%=>
116.38 -package test;
116.39 -import javax.swing.text.AbstractDocument;
116.40 -public class Test {
116.41 - private void test(AbstractDocument d) {
116.42 - d.writeLock();
116.43 - try {
116.44 - System.err.println(d.getText(0, d.getLength()));
116.45 - } finally {
116.46 - d.writeUnlock();
116.47 - }
116.48 - }
116.49 -}
117.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.test Sat Feb 18 22:14:42 2012 +0100
117.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
117.3 @@ -1,46 +0,0 @@
117.4 -%%TestCase simple
117.5 -package test;
117.6 -public class Test {
117.7 - private static Object TEST;
117.8 - public static Object get() {
117.9 - if (TEST == null) {
117.10 - synchronized (Test.class) {
117.11 - if (TEST == null) {
117.12 - TEST = new Object();
117.13 - }
117.14 - }
117.15 - }
117.16 -
117.17 - return TEST;
117.18 - }
117.19 -}
117.20 -%%=>
117.21 -package test;
117.22 -public class Test {
117.23 - private static Object TEST;
117.24 - public static Object get() {
117.25 - synchronized (Test.class) {
117.26 - if (TEST == null) {
117.27 - TEST = new Object();
117.28 - }
117.29 - }
117.30 -
117.31 - return TEST;
117.32 - }
117.33 -}
117.34 -%%TestCase volatile
117.35 -package test;
117.36 -public class Test {
117.37 - private static volatile Object TEST;
117.38 - public static Object get() {
117.39 - if (TEST == null) {
117.40 - synchronized (Test.class) {
117.41 - if (TEST == null) {
117.42 - TEST = new Object();
117.43 - }
117.44 - }
117.45 - }
117.46 -
117.47 - return TEST;
117.48 - }
117.49 -}
118.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.test Sat Feb 18 22:14:42 2012 +0100
118.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
118.3 @@ -1,87 +0,0 @@
118.4 -%%TestCase simple-return
118.5 -package test;
118.6 -public class Test {
118.7 - public int test(boolean b) {
118.8 - if (b)
118.9 - return 1;
118.10 - else
118.11 - return 2;
118.12 - }
118.13 -}
118.14 -%%=>
118.15 -package test;
118.16 -public class Test {
118.17 - public int test(boolean b) {
118.18 - return b ? 1 : 2;
118.19 - }
118.20 -}
118.21 -%%TestCase blocks-return
118.22 -package test;
118.23 -public class Test {
118.24 - public int test(boolean b) {
118.25 - if (b) {
118.26 - return 1;
118.27 - } else {
118.28 - return 2;
118.29 - }
118.30 - }
118.31 -}
118.32 -%%=>
118.33 -package test;
118.34 -public class Test {
118.35 - public int test(boolean b) {
118.36 - return b ? 1 : 2;
118.37 - }
118.38 -}
118.39 -%%TestCase simple-assignment
118.40 -package test;
118.41 -public class Test {
118.42 - public void test(boolean b) {
118.43 - int q = 3;
118.44 - if (b)
118.45 - q = 1;
118.46 - else
118.47 - q = 2;
118.48 - }
118.49 -}
118.50 -%%=>
118.51 -package test;
118.52 -public class Test {
118.53 - public void test(boolean b) {
118.54 - int q = 3;
118.55 - q = b ? 1 : 2;
118.56 - }
118.57 -}
118.58 -%%TestCase simplify-conditional-with-casts
118.59 -package test;
118.60 -public class Test {
118.61 - public void test(boolean b, Object o1, Object o2) {
118.62 - String s = b ? (String) o1 : (String) o2;
118.63 - }
118.64 -}
118.65 -%%=>
118.66 -package test;
118.67 -public class Test {
118.68 - public void test(boolean b, Object o1, Object o2) {
118.69 - String s = (String) (b ? o1 : o2);
118.70 - }
118.71 -}
118.72 -%%TestCase simplify-with-declaration
118.73 -package test;
118.74 -public class Test {
118.75 - public void test(boolean b) {
118.76 - int q;
118.77 - if (b)
118.78 - q = 1;
118.79 - else
118.80 - q = 2;
118.81 - }
118.82 -}
118.83 -%%=>
118.84 -package test;
118.85 -public class Test {
118.86 - public void test(boolean b) {
118.87 - int q;
118.88 - q = b ? 1 : 2;
118.89 - }
118.90 -}
119.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.test Sat Feb 18 22:14:42 2012 +0100
119.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
119.3 @@ -1,64 +0,0 @@
119.4 -%%TestCase simple-array
119.5 -package test;
119.6 -public class Test {
119.7 - private void test() {
119.8 - String[] a = new String[2];
119.9 -
119.10 - for (int c = 0; c < a.length; c++) {
119.11 - String s = a[c];
119.12 - System.err.println(s);
119.13 - }
119.14 - }
119.15 -}
119.16 -%%=>
119.17 -package test;
119.18 -public class Test {
119.19 - private void test() {
119.20 - String[] a = new String[2];
119.21 - for (String s : a) {
119.22 - System.err.println(s);
119.23 - }
119.24 - }
119.25 -}
119.26 -%%TestCase simple-iterable
119.27 -package test;
119.28 -import java.util.Iterator;
119.29 -public class Test {
119.30 - private void test(Iterable iterable) {
119.31 - for (Iterator it = iterable.iterator(); it.hasNext();) {
119.32 - String s = (String) it.next();
119.33 - System.err.println(s);
119.34 - }
119.35 - }
119.36 -}
119.37 -%%=>
119.38 -package test;
119.39 -import java.util.Iterator;
119.40 -public class Test {
119.41 - private void test(Iterable iterable) {
119.42 - for (String s : iterable) {
119.43 - System.err.println(s);
119.44 - }
119.45 - }
119.46 -}
119.47 -%%TestCase generified-iterable
119.48 -package test;
119.49 -import java.util.Iterator;
119.50 -public class Test {
119.51 - private void test(Iterable<? extends String> iterable) {
119.52 - for (Iterator<? extends String> it = iterable.iterator(); it.hasNext();) {
119.53 - String s = it.next();
119.54 - System.err.println(s);
119.55 - }
119.56 - }
119.57 -}
119.58 -%%=>
119.59 -package test;
119.60 -import java.util.Iterator;
119.61 -public class Test {
119.62 - private void test(Iterable<? extends String> iterable) {
119.63 - for (String s : iterable) {
119.64 - System.err.println(s);
119.65 - }
119.66 - }
119.67 -}
120.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.test Sat Feb 18 22:14:42 2012 +0100
120.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
120.3 @@ -1,68 +0,0 @@
120.4 -%%TestCase positive-equals-1 DISABLED
120.5 -package test;
120.6 -public class Test {
120.7 - private boolean test(Object o1, Object o2) {
120.8 - return (o1 == null) ? (o2 != null) : !o1.equals(o2);
120.9 - }
120.10 -}
120.11 -%%=>
120.12 -package test;
120.13 -
120.14 -import java.util.Objects;
120.15 -
120.16 -public class Test {
120.17 - private boolean test(Object o1, Object o2) {
120.18 - return Objects.equals(o1, o2);
120.19 - }
120.20 -}
120.21 -%%TestCase positive-equals-2 DISABLED
120.22 -package test;
120.23 -public class Test {
120.24 - private boolean test(Object o1, Object o2) {
120.25 - return o1 != o2 && (o1 == null || !o1.equals(o2));
120.26 - }
120.27 -}
120.28 -%%=>
120.29 -package test;
120.30 -
120.31 -import java.util.Objects;
120.32 -
120.33 -public class Test {
120.34 - private boolean test(Object o1, Object o2) {
120.35 - return Objects.equals(o1, o2);
120.36 - }
120.37 -}
120.38 -%%TestCase positive-hashcode-1 DISABLED
120.39 -package test;
120.40 -public class Test {
120.41 - private boolean test(Object o1) {
120.42 - return (o1 != null ? o1.hashCode() : 0);
120.43 - }
120.44 -}
120.45 -%%=>
120.46 -package test;
120.47 -
120.48 -import java.util.Objects;
120.49 -
120.50 -public class Test {
120.51 - private boolean test(Object o1) {
120.52 - return Objects.hashCode(o1);
120.53 - }
120.54 -}
120.55 -%%TestCase positive-hashcode-2 DISABLED
120.56 -package test;
120.57 -public class Test {
120.58 - private boolean test(Object o1) {
120.59 - return o1 != null ? o1.hashCode() : 0;
120.60 - }
120.61 -}
120.62 -%%=>
120.63 -package test;
120.64 -
120.65 -import java.util.Objects;
120.66 -
120.67 -public class Test {
120.68 - private boolean test(Object o1) {
120.69 - return Objects.hashCode(o1);
120.70 - }
120.71 -}
121.1 --- a/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.test Sat Feb 18 22:14:42 2012 +0100
121.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
121.3 @@ -1,56 +0,0 @@
121.4 -%%TestCase simple
121.5 -package test;
121.6 -public class Test {
121.7 - public static boolean get(String s1, String s2) {
121.8 - return s1 == s2;
121.9 - }
121.10 -}
121.11 -%%=>
121.12 -package test;
121.13 -public class Test {
121.14 - public static boolean get(String s1, String s2) {
121.15 - return s1 == null ? s2 == null : s1.equals(s2);
121.16 - }
121.17 -}
121.18 -%%=>
121.19 -package test;
121.20 -public class Test {
121.21 - public static boolean get(String s1, String s2) {
121.22 - return s1.equals(s2);
121.23 - }
121.24 -}
121.25 -%%TestCase neg
121.26 -package test;
121.27 -public class Test {
121.28 - public static boolean get(String s1, String s2) {
121.29 - return s1 != s2;
121.30 - }
121.31 -}
121.32 -%%=>
121.33 -package test;
121.34 -public class Test {
121.35 - public static boolean get(String s1, String s2) {
121.36 - return !(s1 == null ? s2 == null : s1.equals(s2));
121.37 - }
121.38 -}
121.39 -%%=>
121.40 -package test;
121.41 -public class Test {
121.42 - public static boolean get(String s1, String s2) {
121.43 - return !s1.equals(s2);
121.44 - }
121.45 -}
121.46 -%%TestCase neg-accept
121.47 -package test;
121.48 -public class Test {
121.49 - public static boolean get(String s1, String s2) {
121.50 - return s1 != s2 && (s1 == null || s1.equals(s2));
121.51 - }
121.52 -}
121.53 -%%TestCase null
121.54 -package test;
121.55 -public class Test {
121.56 - public static boolean get(String s1, String s2) {
121.57 - return s1 == null;
121.58 - }
121.59 -}
122.1 --- a/kit/build.xml Sat Feb 18 22:14:42 2012 +0100
122.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
122.3 @@ -1,13 +0,0 @@
122.4 -<?xml version="1.0" encoding="UTF-8"?>
122.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
122.6 -<!-- for some information on what you could do (e.g. targets to override). -->
122.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
122.8 -<project name="org.netbeans.modules.jackpot30.kit" default="netbeans" basedir=".">
122.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.kit.</description>
122.10 - <import file="nbproject/build-impl.xml"/>
122.11 -
122.12 - <target name="test" />
122.13 - <target name="test-coverage" />
122.14 - <target name="coverage-report" />
122.15 - <target name="findbugs" />
122.16 -</project>
123.1 --- a/kit/manifest.mf Sat Feb 18 22:14:42 2012 +0100
123.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
123.3 @@ -1,5 +0,0 @@
123.4 -Manifest-Version: 1.0
123.5 -OpenIDE-Module: org.netbeans.modules.jackpot30.kit
123.6 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/kit/Bundle.properties
123.7 -OpenIDE-Module-Specification-Version: 1.16
123.8 -
124.1 --- a/kit/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
124.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
124.3 @@ -1,45 +0,0 @@
124.4 -<?xml version="1.0" encoding="UTF-8"?>
124.5 -<!--
124.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
124.7 -*** EDIT ../build.xml INSTEAD ***
124.8 --->
124.9 -<project name="org.netbeans.modules.jackpot30.kit-impl" basedir="..">
124.10 - <fail message="Please build using Ant 1.7.1 or higher.">
124.11 - <condition>
124.12 - <not>
124.13 - <antversion atleast="1.7.1"/>
124.14 - </not>
124.15 - </condition>
124.16 - </fail>
124.17 - <property file="nbproject/private/suite-private.properties"/>
124.18 - <property file="nbproject/suite.properties"/>
124.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
124.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
124.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
124.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
124.23 - <attribute name="name"/>
124.24 - <attribute name="value"/>
124.25 - <sequential>
124.26 - <property name="@{name}" value="${@{value}}"/>
124.27 - </sequential>
124.28 - </macrodef>
124.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
124.30 - <attribute name="property"/>
124.31 - <attribute name="value"/>
124.32 - <sequential>
124.33 - <property name="@{property}" value="@{value}"/>
124.34 - </sequential>
124.35 - </macrodef>
124.36 - <property file="${user.properties.file}"/>
124.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
124.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
124.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
124.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
124.41 - <condition>
124.42 - <not>
124.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
124.44 - </not>
124.45 - </condition>
124.46 - </fail>
124.47 - <import file="${harness.dir}/build.xml"/>
124.48 -</project>
125.1 --- a/kit/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
125.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
125.3 @@ -1,8 +0,0 @@
125.4 -build.xml.data.CRC32=719584a7
125.5 -build.xml.script.CRC32=6c4da9a3
125.6 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
125.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
125.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
125.9 -nbproject/build-impl.xml.data.CRC32=ff5fa2e9
125.10 -nbproject/build-impl.xml.script.CRC32=c129207c
125.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
126.1 --- a/kit/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
126.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
126.3 @@ -1,2 +0,0 @@
126.4 -javac.source=1.5
126.5 -javac.compilerargs=-Xlint -Xlint:-serial
127.1 --- a/kit/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
127.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
127.3 @@ -1,33 +0,0 @@
127.4 -<?xml version="1.0" encoding="UTF-8"?>
127.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
127.6 - <type>org.netbeans.modules.apisupport.project</type>
127.7 - <configuration>
127.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
127.9 - <code-name-base>org.netbeans.modules.jackpot30.kit</code-name-base>
127.10 - <suite-component/>
127.11 - <module-dependencies>
127.12 - <dependency>
127.13 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
127.14 - <build-prerequisite/>
127.15 - <compile-dependency/>
127.16 - <run-dependency>
127.17 - <specification-version>1.16</specification-version>
127.18 - </run-dependency>
127.19 - </dependency>
127.20 - <dependency>
127.21 - <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
127.22 - <run-dependency>
127.23 - <specification-version>1.16</specification-version>
127.24 - </run-dependency>
127.25 - </dependency>
127.26 - <dependency>
127.27 - <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
127.28 - <run-dependency>
127.29 - <specification-version>1.16</specification-version>
127.30 - </run-dependency>
127.31 - </dependency>
127.32 - </module-dependencies>
127.33 - <public-packages/>
127.34 - </data>
127.35 - </configuration>
127.36 -</project>
128.1 --- a/kit/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
128.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
128.3 @@ -1,1 +0,0 @@
128.4 -suite.dir=${basedir}/..
129.1 --- a/kit/src/org/netbeans/modules/jackpot30/kit/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
129.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
129.3 @@ -1,38 +0,0 @@
129.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
129.5 -#
129.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
129.7 -#
129.8 -# The contents of this file are subject to the terms of either the GNU
129.9 -# General Public License Version 2 only ("GPL") or the Common
129.10 -# Development and Distribution License("CDDL") (collectively, the
129.11 -# "License"). You may not use this file except in compliance with the
129.12 -# License. You can obtain a copy of the License at
129.13 -# http://www.netbeans.org/cddl-gplv2.html
129.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
129.15 -# specific language governing permissions and limitations under the
129.16 -# License. When distributing the software, include this License Header
129.17 -# Notice in each file and include the License file at
129.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
129.19 -# particular file as subject to the "Classpath" exception as provided
129.20 -# by Sun in the GPL Version 2 section of the License file that
129.21 -# accompanied this code. If applicable, add the following below the
129.22 -# License Header, with the fields enclosed by brackets [] replaced by
129.23 -# your own identifying information:
129.24 -# "Portions Copyrighted [year] [name of copyright owner]"
129.25 -#
129.26 -# If you wish your version of this file to be governed by only the CDDL
129.27 -# or only the GPL Version 2, indicate your decision by adding
129.28 -# "[Contributor] elects to include this software in this distribution
129.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
129.30 -# single choice of license, a recipient has the option to distribute
129.31 -# your version of this file under either the CDDL, the GPL Version 2 or
129.32 -# to extend the choice of license to its licensees as provided above.
129.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
129.34 -# Version 2 license, then the option applies only if the new code is
129.35 -# made subject to such option by the copyright holder.
129.36 -#
129.37 -# Contributor(s):
129.38 -#
129.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
129.40 -
129.41 -OpenIDE-Module-Name=Jackpot 3.0
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
130.2 +++ b/language/ide/bridges/apisupport/bridge/org/netbeans/modules/jackpot30/apisupport/bridgeimpl/ProjectDependencyUpgraderImpl.java Tue Feb 21 22:37:57 2012 +0100
130.3 @@ -0,0 +1,157 @@
130.4 +/*
130.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
130.6 + *
130.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
130.8 + *
130.9 + * The contents of this file are subject to the terms of either the GNU
130.10 + * General Public License Version 2 only ("GPL") or the Common
130.11 + * Development and Distribution License("CDDL") (collectively, the
130.12 + * "License"). You may not use this file except in compliance with the
130.13 + * License. You can obtain a copy of the License at
130.14 + * http://www.netbeans.org/cddl-gplv2.html
130.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
130.16 + * specific language governing permissions and limitations under the
130.17 + * License. When distributing the software, include this License Header
130.18 + * Notice in each file and include the License file at
130.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
130.20 + * particular file as subject to the "Classpath" exception as provided
130.21 + * by Sun in the GPL Version 2 section of the License file that
130.22 + * accompanied this code. If applicable, add the following below the
130.23 + * License Header, with the fields enclosed by brackets [] replaced by
130.24 + * your own identifying information:
130.25 + * "Portions Copyrighted [year] [name of copyright owner]"
130.26 + *
130.27 + * If you wish your version of this file to be governed by only the CDDL
130.28 + * or only the GPL Version 2, indicate your decision by adding
130.29 + * "[Contributor] elects to include this software in this distribution
130.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
130.31 + * single choice of license, a recipient has the option to distribute
130.32 + * your version of this file under either the CDDL, the GPL Version 2 or
130.33 + * to extend the choice of license to its licensees as provided above.
130.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
130.35 + * Version 2 license, then the option applies only if the new code is
130.36 + * made subject to such option by the copyright holder.
130.37 + *
130.38 + * Contributor(s):
130.39 + *
130.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
130.41 + */
130.42 +package org.netbeans.modules.jackpot30.apisupport.bridgeimpl;
130.43 +
130.44 +import java.io.IOException;
130.45 +import org.netbeans.api.project.FileOwnerQuery;
130.46 +import org.netbeans.api.project.Project;
130.47 +import org.netbeans.api.project.ProjectManager;
130.48 +import org.netbeans.api.project.ProjectUtils;
130.49 +import org.netbeans.modules.apisupport.project.ModuleDependency;
130.50 +import org.netbeans.modules.apisupport.project.NbModuleProject;
130.51 +import org.netbeans.modules.apisupport.project.ProjectXMLManager;
130.52 +import org.netbeans.modules.apisupport.project.ProjectXMLManager.CyclicDependencyException;
130.53 +import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
130.54 +import org.netbeans.modules.apisupport.project.universe.ModuleEntry;
130.55 +import org.netbeans.modules.jackpot30.apisupport.Utilities;
130.56 +import org.netbeans.modules.jackpot30.apisupport.Utilities.ParsedDependency;
130.57 +import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
130.58 +import org.openide.filesystems.FileObject;
130.59 +import org.openide.modules.SpecificationVersion;
130.60 +import org.openide.util.Exceptions;
130.61 +
130.62 +/**
130.63 + *
130.64 + * @author lahvac
130.65 + */
130.66 +public class ProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
130.67 +
130.68 + public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
130.69 + NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
130.70 +
130.71 + if (currentNbModule == null) {
130.72 + return false;
130.73 + }
130.74 +
130.75 + Project referedProject = FileOwnerQuery.getOwner(depFO);
130.76 +
130.77 + if (referedProject == null) {
130.78 + return false;
130.79 + }
130.80 +
130.81 + NbModuleProject referedNbProject = referedProject.getLookup().lookup(NbModuleProject.class);
130.82 +
130.83 + if (referedNbProject == null) {
130.84 + return false;
130.85 + }
130.86 +
130.87 + return ensureDependency(currentProject, referedNbProject.getCodeNameBase(), ProjectUtils.getInformation(referedProject).getDisplayName(), null, spec, canShowUI);
130.88 + }
130.89 +
130.90 + private boolean ensureDependency(Project currentProject, String cnb, String displayName, String releaseVersion, SpecificationVersion spec, final boolean canShowUI) {
130.91 + NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
130.92 +
130.93 + if (currentNbModule == null) {
130.94 + return false;
130.95 + }
130.96 +
130.97 + try {
130.98 + NbModuleProject currentNbModuleProject = currentProject.getLookup().lookup(NbModuleProject.class);
130.99 +
130.100 + if (currentNbModuleProject == null) {
130.101 + return false;
130.102 + }
130.103 +
130.104 + ProjectXMLManager m = new ProjectXMLManager(currentNbModuleProject);
130.105 + ModuleDependency dep = m.getModuleDependency(cnb);
130.106 +
130.107 + if (dep == null) {
130.108 + if (showDependencyUpgradeDialog(currentProject, displayName, null, spec, false, canShowUI)) {
130.109 + ModuleEntry me = currentNbModuleProject.getModuleList().getEntry(cnb);
130.110 + ModuleDependency nue = new ModuleDependency(me,
130.111 + releaseVersion != null ? releaseVersion : me.getReleaseVersion(),
130.112 + spec != null ? spec.toString() : me.getSpecificationVersion(),
130.113 + true,
130.114 + false);
130.115 +
130.116 + m.addDependency(nue);
130.117 + ProjectManager.getDefault().saveProject(currentProject);
130.118 + }
130.119 +
130.120 + return true;
130.121 + }
130.122 +
130.123 + if (dep.getSpecificationVersion() == null) {
130.124 + //impl.dep?
130.125 + return false;
130.126 + }
130.127 +
130.128 + SpecificationVersion currentDep = new SpecificationVersion(dep.getSpecificationVersion());
130.129 +
130.130 + if (spec != null && (currentDep == null || currentDep.compareTo(spec) < 0)) {
130.131 + if (showDependencyUpgradeDialog(currentProject, displayName, new SpecificationVersion(dep.getSpecificationVersion()), spec, false, canShowUI)) {
130.132 + ModuleDependency nue = new ModuleDependency(dep.getModuleEntry(),
130.133 + releaseVersion != null ? releaseVersion : dep.getReleaseVersion(),
130.134 + spec.toString(),
130.135 + dep.hasCompileDependency(),
130.136 + dep.hasImplementationDependency());
130.137 +
130.138 + m.editDependency(dep, nue);
130.139 + ProjectManager.getDefault().saveProject(currentProject);
130.140 + }
130.141 +
130.142 + return true;
130.143 + }
130.144 + } catch (CyclicDependencyException ex) {
130.145 + Exceptions.printStackTrace(ex);
130.146 + } catch (IOException ex) {
130.147 + Exceptions.printStackTrace(ex);
130.148 + }
130.149 +
130.150 + return false;
130.151 + }
130.152 +
130.153 + @Override
130.154 + public boolean ensureDependency(Project p, String specification, boolean canShowUI) {
130.155 + ParsedDependency dep = Utilities.parseDependency(specification);
130.156 +
130.157 + return ensureDependency(p, dep.cnb, /*TODO: may null and that could put display name their*/specification, dep.releaseVersion, dep.specVersion, canShowUI);
130.158 + }
130.159 +
130.160 +}
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131.2 +++ b/language/ide/bridges/apisupport/build.xml Tue Feb 21 22:37:57 2012 +0100
131.3 @@ -0,0 +1,25 @@
131.4 +<?xml version="1.0" encoding="UTF-8"?>
131.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
131.6 +<!-- for some information on what you could do (e.g. targets to override). -->
131.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
131.8 +<project name="org.netbeans.modules.jackpot30.apisupport" default="netbeans" basedir=".">
131.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.apisupport.</description>
131.10 + <import file="nbproject/build-impl.xml"/>
131.11 + <import file="${suite.dir}/../../findbugs-import.xml"/>
131.12 + <target name="netbeans-extra" depends="init">
131.13 + <mkdir dir="build/bridgeclasses"/>
131.14 + <javac srcdir="bridge" destdir="build/bridgeclasses" source="1.6" target="1.6" debug="true" deprecation="true">
131.15 + <classpath>
131.16 + <path refid="cp"/>
131.17 + <pathelement location="${cluster}/modules/${code.name.base.dashes}.jar"/>
131.18 + </classpath>
131.19 + </javac>
131.20 + <copy todir="build/bridgeclasses">
131.21 + <fileset dir="bridge" excludes="${jar-excludes}"/>
131.22 + </copy>
131.23 + <mkdir dir="${cluster}/modules/ext"/>
131.24 + <jar jarfile="${cluster}/modules/ext/${code.name.base.dashes}.jar" compress="false">
131.25 + <fileset dir="build/bridgeclasses"/>
131.26 + </jar>
131.27 + </target>
131.28 +</project>
132.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
132.2 +++ b/language/ide/bridges/apisupport/manifest.mf Tue Feb 21 22:37:57 2012 +0100
132.3 @@ -0,0 +1,6 @@
132.4 +Manifest-Version: 1.0
132.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.apisupport
132.6 +OpenIDE-Module-Implementation-Version: 1
132.7 +OpenIDE-Module-Install: org/netbeans/modules/jackpot30/apisupport/Installer.class
132.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/apisupport/Bundle.properties
132.9 +
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133.2 +++ b/language/ide/bridges/apisupport/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
133.3 @@ -0,0 +1,45 @@
133.4 +<?xml version="1.0" encoding="UTF-8"?>
133.5 +<!--
133.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
133.7 +*** EDIT ../build.xml INSTEAD ***
133.8 +-->
133.9 +<project name="org.netbeans.modules.jackpot30.apisupport-impl" basedir="..">
133.10 + <fail message="Please build using Ant 1.7.1 or higher.">
133.11 + <condition>
133.12 + <not>
133.13 + <antversion atleast="1.7.1"/>
133.14 + </not>
133.15 + </condition>
133.16 + </fail>
133.17 + <property file="nbproject/private/suite-private.properties"/>
133.18 + <property file="nbproject/suite.properties"/>
133.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
133.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
133.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
133.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
133.23 + <attribute name="name"/>
133.24 + <attribute name="value"/>
133.25 + <sequential>
133.26 + <property name="@{name}" value="${@{value}}"/>
133.27 + </sequential>
133.28 + </macrodef>
133.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
133.30 + <attribute name="property"/>
133.31 + <attribute name="value"/>
133.32 + <sequential>
133.33 + <property name="@{property}" value="@{value}"/>
133.34 + </sequential>
133.35 + </macrodef>
133.36 + <property file="${user.properties.file}"/>
133.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
133.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
133.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
133.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
133.41 + <condition>
133.42 + <not>
133.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
133.44 + </not>
133.45 + </condition>
133.46 + </fail>
133.47 + <import file="${harness.dir}/build.xml"/>
133.48 +</project>
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
134.2 +++ b/language/ide/bridges/apisupport/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
134.3 @@ -0,0 +1,8 @@
134.4 +build.xml.data.CRC32=c45369e1
134.5 +build.xml.script.CRC32=a2cc69eb
134.6 +build.xml.stylesheet.CRC32=79c3b980@1.40
134.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
134.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
134.9 +nbproject/build-impl.xml.data.CRC32=e186a96e
134.10 +nbproject/build-impl.xml.script.CRC32=83dd2c27
134.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
135.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
135.2 +++ b/language/ide/bridges/apisupport/nbproject/platform.properties Tue Feb 21 22:37:57 2012 +0100
135.3 @@ -0,0 +1,16 @@
135.4 +cluster.path=\
135.5 + ${nbplatform.active.dir}/apisupport:\
135.6 + ${nbplatform.active.dir}/harness:\
135.7 + ${nbplatform.active.dir}/ide:\
135.8 + ${nbplatform.active.dir}/java:\
135.9 + ${nbplatform.active.dir}/nb:\
135.10 + ${nbplatform.active.dir}/platform:\
135.11 + ${nbplatform.active.dir}/profiler:\
135.12 + ${nbplatform.active.dir}/websvccommon:\
135.13 + ../../remoting/common/build/cluster:\
135.14 + ../../remoting/ide/build/cluster
135.15 +extcluster.../../remoting/ide/build/cluster.javadoc=
135.16 +extcluster.../../remoting/ide/build/cluster.sources=../../remoting/ide
135.17 +extcluster.../remoting/common/build/cluster.javadoc=
135.18 +extcluster.../remoting/common/build/cluster.sources=../../remoting/common
135.19 +nbplatform.active=default
136.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
136.2 +++ b/language/ide/bridges/apisupport/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
136.3 @@ -0,0 +1,5 @@
136.4 +is.eager=true
136.5 +javac.source=1.5
136.6 +javac.compilerargs=-Xlint -Xlint:-serial
136.7 +extra.module.files=modules/ext/org-netbeans-modules-jackpot30-apisupport.jar
136.8 +spec.version.base=1.16
137.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
137.2 +++ b/language/ide/bridges/apisupport/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
137.3 @@ -0,0 +1,85 @@
137.4 +<?xml version="1.0" encoding="UTF-8"?>
137.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
137.6 + <type>org.netbeans.modules.apisupport.project</type>
137.7 + <configuration>
137.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
137.9 + <code-name-base>org.netbeans.modules.jackpot30.apisupport</code-name-base>
137.10 + <suite-component/>
137.11 + <module-dependencies>
137.12 + <dependency>
137.13 + <code-name-base>org.netbeans.modules.apisupport.ant</code-name-base>
137.14 + <build-prerequisite/>
137.15 + <compile-dependency/>
137.16 + </dependency>
137.17 + <dependency>
137.18 + <code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
137.19 + <build-prerequisite/>
137.20 + <compile-dependency/>
137.21 + </dependency>
137.22 + <dependency>
137.23 + <code-name-base>org.netbeans.modules.apisupport.project</code-name-base>
137.24 + <run-dependency>
137.25 + <release-version>1</release-version>
137.26 + </run-dependency>
137.27 + </dependency>
137.28 + <dependency>
137.29 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
137.30 + <build-prerequisite/>
137.31 + <compile-dependency/>
137.32 + <run-dependency>
137.33 + <release-version>1</release-version>
137.34 + <implementation-version/>
137.35 + </run-dependency>
137.36 + </dependency>
137.37 + <dependency>
137.38 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
137.39 + <build-prerequisite/>
137.40 + <compile-dependency/>
137.41 + <run-dependency>
137.42 + <release-version>1</release-version>
137.43 + <specification-version>1.29</specification-version>
137.44 + </run-dependency>
137.45 + </dependency>
137.46 + <dependency>
137.47 + <code-name-base>org.openide.filesystems</code-name-base>
137.48 + <build-prerequisite/>
137.49 + <compile-dependency/>
137.50 + <run-dependency>
137.51 + <specification-version>7.33.0.1.1</specification-version>
137.52 + </run-dependency>
137.53 + </dependency>
137.54 + <dependency>
137.55 + <code-name-base>org.openide.modules</code-name-base>
137.56 + <build-prerequisite/>
137.57 + <compile-dependency/>
137.58 + <run-dependency>
137.59 + <specification-version>7.14</specification-version>
137.60 + </run-dependency>
137.61 + </dependency>
137.62 + <dependency>
137.63 + <code-name-base>org.openide.util</code-name-base>
137.64 + <build-prerequisite/>
137.65 + <compile-dependency/>
137.66 + <run-dependency>
137.67 + <specification-version>7.32.0.1</specification-version>
137.68 + </run-dependency>
137.69 + </dependency>
137.70 + <dependency>
137.71 + <code-name-base>org.openide.util.lookup</code-name-base>
137.72 + <build-prerequisite/>
137.73 + <compile-dependency/>
137.74 + <run-dependency>
137.75 + <specification-version>8.2</specification-version>
137.76 + </run-dependency>
137.77 + </dependency>
137.78 + </module-dependencies>
137.79 + <public-packages/>
137.80 + <extra-compilation-unit>
137.81 + <package-root>bridge</package-root>
137.82 + <classpath>${module.classpath}:${cluster}/modules/${code.name.base.dashes}.jar</classpath>
137.83 + <built-to>build/bridgeclasses</built-to>
137.84 + <built-to>${cluster}/modules/ext/${code.name.base.dashes}.jar</built-to>
137.85 + </extra-compilation-unit>
137.86 + </data>
137.87 + </configuration>
137.88 +</project>
138.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
138.2 +++ b/language/ide/bridges/apisupport/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
138.3 @@ -0,0 +1,1 @@
138.4 +suite.dir=${basedir}/../..
139.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
139.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/APIProjectDependencyUpgraderImpl.java Tue Feb 21 22:37:57 2012 +0100
139.3 @@ -0,0 +1,127 @@
139.4 +/*
139.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
139.6 + *
139.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
139.8 + *
139.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
139.10 + * Other names may be trademarks of their respective owners.
139.11 + *
139.12 + * The contents of this file are subject to the terms of either the GNU General
139.13 + * Public License Version 2 only ("GPL") or the Common Development and
139.14 + * Distribution License("CDDL") (collectively, the "License"). You may not use
139.15 + * this file except in compliance with the License. You can obtain a copy of the
139.16 + * License at http://www.netbeans.org/cddl-gplv2.html or
139.17 + * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
139.18 + * governing permissions and limitations under the License. When distributing
139.19 + * the software, include this License Header Notice in each file and include the
139.20 + * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
139.21 + * particular file as subject to the "Classpath" exception as provided by Oracle
139.22 + * in the GPL Version 2 section of the License file that accompanied this code.
139.23 + * If applicable, add the following below the License Header, with the fields
139.24 + * enclosed by brackets [] replaced by your own identifying information:
139.25 + * "Portions Copyrighted [year] [name of copyright owner]"
139.26 + *
139.27 + * If you wish your version of this file to be governed by only the CDDL or only
139.28 + * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
139.29 + * include this software in this distribution under the [CDDL or GPL Version 2]
139.30 + * license." If you do not indicate a single choice of license, a recipient has
139.31 + * the option to distribute your version of this file under either the CDDL, the
139.32 + * GPL Version 2 or to extend the choice of license to its licensees as provided
139.33 + * above. However, if you add GPL Version 2 code and therefore, elected the GPL
139.34 + * Version 2 license, then the option applies only if the new code is made
139.35 + * subject to such option by the copyright holder.
139.36 + *
139.37 + * Contributor(s):
139.38 + *
139.39 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
139.40 + */
139.41 +package org.netbeans.modules.jackpot30.apisupport;
139.42 +
139.43 +import java.io.IOException;
139.44 +import org.netbeans.api.project.FileOwnerQuery;
139.45 +import org.netbeans.api.project.Project;
139.46 +import org.netbeans.api.project.ProjectManager;
139.47 +import org.netbeans.api.project.ProjectUtils;
139.48 +import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
139.49 +import org.netbeans.modules.jackpot30.apisupport.Utilities.ParsedDependency;
139.50 +import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
139.51 +import org.openide.filesystems.FileObject;
139.52 +import org.openide.modules.SpecificationVersion;
139.53 +import org.openide.util.Exceptions;
139.54 +import org.openide.util.lookup.ServiceProvider;
139.55 +
139.56 +/**
139.57 + *
139.58 + * @author lahvac
139.59 + */
139.60 +public class APIProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
139.61 +
139.62 + public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
139.63 + NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
139.64 +
139.65 + if (currentNbModule == null) {
139.66 + return false;
139.67 + }
139.68 +
139.69 + Project referedProject = FileOwnerQuery.getOwner(depFO);
139.70 +
139.71 + if (referedProject == null) {
139.72 + return false;
139.73 + }
139.74 +
139.75 + NbModuleProvider referedNbProject = referedProject.getLookup().lookup(NbModuleProvider.class);
139.76 +
139.77 + if (referedNbProject == null) {
139.78 + return false;
139.79 + }
139.80 +
139.81 + return ensureDependency(currentProject, referedNbProject.getCodeNameBase(), ProjectUtils.getInformation(referedProject).getDisplayName(), null, spec, canShowUI);
139.82 + }
139.83 +
139.84 + private boolean ensureDependency(Project currentProject, String cnb, String displayName, String releaseVersion, SpecificationVersion spec, final boolean canShowUI) {
139.85 + NbModuleProvider currentNbModule = currentProject.getLookup().lookup(NbModuleProvider.class);
139.86 +
139.87 + if (currentNbModule == null) {
139.88 + return false;
139.89 + }
139.90 +
139.91 + try {
139.92 + if (!currentNbModule.hasDependency(cnb)) {
139.93 + if (showDependencyUpgradeDialog(currentProject, displayName, null, spec, false, canShowUI)) {
139.94 + currentNbModule.addDependency(cnb, releaseVersion, spec, true);
139.95 + ProjectManager.getDefault().saveProject(currentProject);
139.96 + }
139.97 +
139.98 + return true;
139.99 + }
139.100 +
139.101 + SpecificationVersion currentDep = currentNbModule.getDependencyVersion(cnb);
139.102 +
139.103 + if (currentDep == null) {
139.104 + //impl.dep?
139.105 + return false;
139.106 + }
139.107 +
139.108 + if (spec != null && (currentDep == null || currentDep.compareTo(spec) < 0)) {
139.109 + if (showDependencyUpgradeDialog(currentProject, displayName, currentDep, spec, false, canShowUI)) {
139.110 + currentNbModule.addDependency(cnb, releaseVersion, spec, true);
139.111 + ProjectManager.getDefault().saveProject(currentProject);
139.112 + }
139.113 +
139.114 + return true;
139.115 + }
139.116 + } catch (IOException ex) {
139.117 + Exceptions.printStackTrace(ex);
139.118 + }
139.119 +
139.120 + return false;
139.121 + }
139.122 +
139.123 + @Override
139.124 + public boolean ensureDependency(Project p, String specification, boolean canShowUI) {
139.125 + ParsedDependency dep = Utilities.parseDependency(specification);
139.126 +
139.127 + return ensureDependency(p, dep.cnb, /*TODO: may null and that could put display name their*/specification, dep.releaseVersion, dep.specVersion, canShowUI);
139.128 + }
139.129 +
139.130 +}
140.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
140.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
140.3 @@ -0,0 +1,1 @@
140.4 +OpenIDE-Module-Name=Jackpot 3.0 APISupport Bridge
141.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
141.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/HackyProjectDependencyUpgraderImpl.java Tue Feb 21 22:37:57 2012 +0100
141.3 @@ -0,0 +1,107 @@
141.4 +/*
141.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
141.6 + *
141.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
141.8 + *
141.9 + * The contents of this file are subject to the terms of either the GNU
141.10 + * General Public License Version 2 only ("GPL") or the Common
141.11 + * Development and Distribution License("CDDL") (collectively, the
141.12 + * "License"). You may not use this file except in compliance with the
141.13 + * License. You can obtain a copy of the License at
141.14 + * http://www.netbeans.org/cddl-gplv2.html
141.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
141.16 + * specific language governing permissions and limitations under the
141.17 + * License. When distributing the software, include this License Header
141.18 + * Notice in each file and include the License file at
141.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
141.20 + * particular file as subject to the "Classpath" exception as provided
141.21 + * by Sun in the GPL Version 2 section of the License file that
141.22 + * accompanied this code. If applicable, add the following below the
141.23 + * License Header, with the fields enclosed by brackets [] replaced by
141.24 + * your own identifying information:
141.25 + * "Portions Copyrighted [year] [name of copyright owner]"
141.26 + *
141.27 + * If you wish your version of this file to be governed by only the CDDL
141.28 + * or only the GPL Version 2, indicate your decision by adding
141.29 + * "[Contributor] elects to include this software in this distribution
141.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
141.31 + * single choice of license, a recipient has the option to distribute
141.32 + * your version of this file under either the CDDL, the GPL Version 2 or
141.33 + * to extend the choice of license to its licensees as provided above.
141.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
141.35 + * Version 2 license, then the option applies only if the new code is
141.36 + * made subject to such option by the copyright holder.
141.37 + *
141.38 + * Contributor(s):
141.39 + *
141.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
141.41 + */
141.42 +
141.43 +package org.netbeans.modules.jackpot30.apisupport;
141.44 +
141.45 +import java.io.File;
141.46 +import java.net.MalformedURLException;
141.47 +import java.net.URL;
141.48 +import java.net.URLClassLoader;
141.49 +import org.netbeans.api.project.Project;
141.50 +//import org.netbeans.modules.apisupport.project.api.DependencyUpdater;
141.51 +import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
141.52 +import org.openide.filesystems.FileObject;
141.53 +import org.openide.modules.InstalledFileLocator;
141.54 +import org.openide.modules.SpecificationVersion;
141.55 +import org.openide.util.Exceptions;
141.56 +import org.openide.util.Lookup;
141.57 +import org.openide.util.lookup.ServiceProvider;
141.58 +
141.59 +/**
141.60 + *
141.61 + * @author lahvac
141.62 + */
141.63 +public class HackyProjectDependencyUpgraderImpl extends ProjectDependencyUpgrader {
141.64 +
141.65 + public boolean ensureDependency(Project currentProject, FileObject depFO, SpecificationVersion spec, final boolean canShowUI) {
141.66 + File lib = InstalledFileLocator.getDefault().locate("modules/ext/org-netbeans-modules-jackpot30-apisupport.jar", null, false);
141.67 +
141.68 + ClassLoader scl = Lookup.getDefault().lookup(ClassLoader.class);
141.69 + try {
141.70 + URLClassLoader l = new URLClassLoader(new URL[]{lib.toURI().toURL()}, scl);
141.71 + Class<?> u = Class.forName("org.netbeans.modules.jackpot30.apisupport.bridgeimpl.ProjectDependencyUpgraderImpl", false, l);
141.72 +
141.73 + return ((ProjectDependencyUpgrader) u.newInstance()).ensureDependency(currentProject, depFO, spec, canShowUI);
141.74 + } catch (InstantiationException ex) {
141.75 + Exceptions.printStackTrace(ex);
141.76 + } catch (IllegalAccessException ex) {
141.77 + Exceptions.printStackTrace(ex);
141.78 + } catch (ClassNotFoundException ex) {
141.79 + Exceptions.printStackTrace(ex);
141.80 + } catch (MalformedURLException ex) {
141.81 + Exceptions.printStackTrace(ex);
141.82 + }
141.83 +
141.84 + return false;
141.85 + }
141.86 +
141.87 + @Override
141.88 + public boolean ensureDependency(Project p, String specification, boolean b) {
141.89 + File lib = InstalledFileLocator.getDefault().locate("modules/ext/org-netbeans-modules-jackpot30-apisupport.jar", null, false);
141.90 +
141.91 + ClassLoader scl = Lookup.getDefault().lookup(ClassLoader.class);
141.92 + try {
141.93 + URLClassLoader l = new URLClassLoader(new URL[]{lib.toURI().toURL()}, scl);
141.94 + Class<?> u = Class.forName("org.netbeans.modules.jackpot30.apisupport.bridgeimpl.ProjectDependencyUpgraderImpl", false, l);
141.95 +
141.96 + return ((ProjectDependencyUpgrader) u.newInstance()).ensureDependency(p, specification, b);
141.97 + } catch (InstantiationException ex) {
141.98 + Exceptions.printStackTrace(ex);
141.99 + } catch (IllegalAccessException ex) {
141.100 + Exceptions.printStackTrace(ex);
141.101 + } catch (ClassNotFoundException ex) {
141.102 + Exceptions.printStackTrace(ex);
141.103 + } catch (MalformedURLException ex) {
141.104 + Exceptions.printStackTrace(ex);
141.105 + }
141.106 +
141.107 + return false;
141.108 + }
141.109 +
141.110 +}
142.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
142.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Installer.java Tue Feb 21 22:37:57 2012 +0100
142.3 @@ -0,0 +1,70 @@
142.4 +/*
142.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
142.6 + *
142.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
142.8 + *
142.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
142.10 + * Other names may be trademarks of their respective owners.
142.11 + *
142.12 + * The contents of this file are subject to the terms of either the GNU General
142.13 + * Public License Version 2 only ("GPL") or the Common Development and
142.14 + * Distribution License("CDDL") (collectively, the "License"). You may not use
142.15 + * this file except in compliance with the License. You can obtain a copy of the
142.16 + * License at http://www.netbeans.org/cddl-gplv2.html or
142.17 + * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
142.18 + * governing permissions and limitations under the License. When distributing
142.19 + * the software, include this License Header Notice in each file and include the
142.20 + * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
142.21 + * particular file as subject to the "Classpath" exception as provided by Oracle
142.22 + * in the GPL Version 2 section of the License file that accompanied this code.
142.23 + * If applicable, add the following below the License Header, with the fields
142.24 + * enclosed by brackets [] replaced by your own identifying information:
142.25 + * "Portions Copyrighted [year] [name of copyright owner]"
142.26 + *
142.27 + * If you wish your version of this file to be governed by only the CDDL or only
142.28 + * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
142.29 + * include this software in this distribution under the [CDDL or GPL Version 2]
142.30 + * license." If you do not indicate a single choice of license, a recipient has
142.31 + * the option to distribute your version of this file under either the CDDL, the
142.32 + * GPL Version 2 or to extend the choice of license to its licensees as provided
142.33 + * above. However, if you add GPL Version 2 code and therefore, elected the GPL
142.34 + * Version 2 license, then the option applies only if the new code is made
142.35 + * subject to such option by the copyright holder.
142.36 + *
142.37 + * Contributor(s):
142.38 + *
142.39 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
142.40 + */
142.41 +package org.netbeans.modules.jackpot30.apisupport;
142.42 +
142.43 +import java.lang.reflect.Field;
142.44 +import java.lang.reflect.Method;
142.45 +import java.util.Set;
142.46 +import org.openide.modules.ModuleInstall;
142.47 +
142.48 +public class Installer extends ModuleInstall {
142.49 +
142.50 + @Override
142.51 + @SuppressWarnings("unchecked")
142.52 + public void validate() throws IllegalStateException {
142.53 + try {
142.54 + java.lang.Class main = java.lang.Class.forName("org.netbeans.core.startup.Main", false, //NOI18N
142.55 + Thread.currentThread().getContextClassLoader());
142.56 + Method getModuleSystem = main.getMethod("getModuleSystem", new Class[0]); //NOI18N
142.57 + Object moduleSystem = getModuleSystem.invoke(null, new Object[0]);
142.58 + Method getManager = moduleSystem.getClass().getMethod("getManager", new Class[0]); //NOI18N
142.59 + Object moduleManager = getManager.invoke(moduleSystem, new Object[0]);
142.60 + Method moduleMeth = moduleManager.getClass().getMethod("get", new Class[] {String.class}); //NOI18N
142.61 + Object persistence = moduleMeth.invoke(moduleManager, "org.netbeans.modules.apisupport.project"); //NOI18N
142.62 + if (persistence != null) {
142.63 + Field frField = persistence.getClass().getSuperclass().getDeclaredField("friendNames"); //NOI18N
142.64 + frField.setAccessible(true);
142.65 + Set friends = (Set)frField.get(persistence);
142.66 + friends.add("org.netbeans.modules.jackpot30.apisupport"); //NOI18N
142.67 + }
142.68 + } catch (Exception ex) {
142.69 + new IllegalStateException("Cannot fix dependencies for org.netbeans.modules.jackpot30.apisupport.", ex); //NOI18N
142.70 + }
142.71 + super.validate();
142.72 + }
142.73 +}
143.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
143.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/ProjectDependencyUpgraderMultiplexor.java Tue Feb 21 22:37:57 2012 +0100
143.3 @@ -0,0 +1,63 @@
143.4 +/*
143.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
143.6 + *
143.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
143.8 + *
143.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
143.10 + * Other names may be trademarks of their respective owners.
143.11 + *
143.12 + * The contents of this file are subject to the terms of either the GNU General
143.13 + * Public License Version 2 only ("GPL") or the Common Development and
143.14 + * Distribution License("CDDL") (collectively, the "License"). You may not use
143.15 + * this file except in compliance with the License. You can obtain a copy of the
143.16 + * License at http://www.netbeans.org/cddl-gplv2.html or
143.17 + * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
143.18 + * governing permissions and limitations under the License. When distributing
143.19 + * the software, include this License Header Notice in each file and include the
143.20 + * License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
143.21 + * particular file as subject to the "Classpath" exception as provided by Oracle
143.22 + * in the GPL Version 2 section of the License file that accompanied this code.
143.23 + * If applicable, add the following below the License Header, with the fields
143.24 + * enclosed by brackets [] replaced by your own identifying information:
143.25 + * "Portions Copyrighted [year] [name of copyright owner]"
143.26 + *
143.27 + * If you wish your version of this file to be governed by only the CDDL or only
143.28 + * the GPL Version 2, indicate your decision by adding "[Contributor] elects to
143.29 + * include this software in this distribution under the [CDDL or GPL Version 2]
143.30 + * license." If you do not indicate a single choice of license, a recipient has
143.31 + * the option to distribute your version of this file under either the CDDL, the
143.32 + * GPL Version 2 or to extend the choice of license to its licensees as provided
143.33 + * above. However, if you add GPL Version 2 code and therefore, elected the GPL
143.34 + * Version 2 license, then the option applies only if the new code is made
143.35 + * subject to such option by the copyright holder.
143.36 + *
143.37 + * Contributor(s):
143.38 + *
143.39 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
143.40 + */
143.41 +package org.netbeans.modules.jackpot30.apisupport;
143.42 +
143.43 +import org.netbeans.api.project.Project;
143.44 +import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
143.45 +import org.openide.filesystems.FileObject;
143.46 +import org.openide.modules.SpecificationVersion;
143.47 +import org.openide.util.lookup.ServiceProvider;
143.48 +
143.49 +/**
143.50 + *
143.51 + * @author lahvac
143.52 + */
143.53 +@ServiceProvider(service=ProjectDependencyUpgrader.class)
143.54 +public class ProjectDependencyUpgraderMultiplexor extends ProjectDependencyUpgrader {
143.55 +
143.56 + @Override
143.57 + public boolean ensureDependency(Project p, FileObject dep, SpecificationVersion spec, boolean canShowUI) {
143.58 + return Utilities.UPGRADER.ensureDependency(p, dep, spec, canShowUI);
143.59 + }
143.60 +
143.61 + @Override
143.62 + public boolean ensureDependency(Project p, String specification, boolean b) {
143.63 + return Utilities.UPGRADER.ensureDependency(p, specification, b);
143.64 + }
143.65 +
143.66 +}
144.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
144.2 +++ b/language/ide/bridges/apisupport/src/org/netbeans/modules/jackpot30/apisupport/Utilities.java Tue Feb 21 22:37:57 2012 +0100
144.3 @@ -0,0 +1,88 @@
144.4 +/*
144.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
144.6 + *
144.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
144.8 + *
144.9 + * The contents of this file are subject to the terms of either the GNU
144.10 + * General Public License Version 2 only ("GPL") or the Common
144.11 + * Development and Distribution License("CDDL") (collectively, the
144.12 + * "License"). You may not use this file except in compliance with the
144.13 + * License. You can obtain a copy of the License at
144.14 + * http://www.netbeans.org/cddl-gplv2.html
144.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
144.16 + * specific language governing permissions and limitations under the
144.17 + * License. When distributing the software, include this License Header
144.18 + * Notice in each file and include the License file at
144.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
144.20 + * particular file as subject to the "Classpath" exception as provided
144.21 + * by Sun in the GPL Version 2 section of the License file that
144.22 + * accompanied this code. If applicable, add the following below the
144.23 + * License Header, with the fields enclosed by brackets [] replaced by
144.24 + * your own identifying information:
144.25 + * "Portions Copyrighted [year] [name of copyright owner]"
144.26 + *
144.27 + * If you wish your version of this file to be governed by only the CDDL
144.28 + * or only the GPL Version 2, indicate your decision by adding
144.29 + * "[Contributor] elects to include this software in this distribution
144.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
144.31 + * single choice of license, a recipient has the option to distribute
144.32 + * your version of this file under either the CDDL, the GPL Version 2 or
144.33 + * to extend the choice of license to its licensees as provided above.
144.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
144.35 + * Version 2 license, then the option applies only if the new code is
144.36 + * made subject to such option by the copyright holder.
144.37 + *
144.38 + * Contributor(s):
144.39 + *
144.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
144.41 + */
144.42 +
144.43 +package org.netbeans.modules.jackpot30.apisupport;
144.44 +
144.45 +import org.netbeans.modules.java.hints.jackpot.spi.ProjectDependencyUpgrader;
144.46 +import org.openide.modules.SpecificationVersion;
144.47 +
144.48 +/**
144.49 + *
144.50 + * @author lahvac
144.51 + */
144.52 +public class Utilities {
144.53 +
144.54 + public static final ProjectDependencyUpgrader UPGRADER = Boolean.getBoolean("jackpot.upgrade.apisupport.use.api") ? new APIProjectDependencyUpgraderImpl() : new HackyProjectDependencyUpgraderImpl();
144.55 +
144.56 + public static ParsedDependency parseDependency(String spec) {
144.57 + String cnb;
144.58 + String releaseVersion;
144.59 + SpecificationVersion specVersion;
144.60 +
144.61 + String[] spaceSplit = spec.split(" ");
144.62 + String[] slashSplit = spaceSplit[0].split(" ");
144.63 +
144.64 + cnb = slashSplit[0];
144.65 +
144.66 + if (slashSplit.length > 1) {
144.67 + releaseVersion = slashSplit[1];
144.68 + } else {
144.69 + releaseVersion = null;
144.70 + }
144.71 +
144.72 + if (spaceSplit.length > 1) {
144.73 + specVersion = new SpecificationVersion(spaceSplit[1]);//XXX verify correct format
144.74 + } else {
144.75 + specVersion = null;
144.76 + }
144.77 +
144.78 + return new ParsedDependency(cnb, releaseVersion, specVersion);
144.79 + }
144.80 +
144.81 + public static class ParsedDependency {
144.82 + public final String cnb;
144.83 + public final String releaseVersion;
144.84 + public final SpecificationVersion specVersion;
144.85 + public ParsedDependency(String cnb, String releaseVersion, SpecificationVersion specVersion) {
144.86 + this.cnb = cnb;
144.87 + this.releaseVersion = releaseVersion;
144.88 + this.specVersion = specVersion;
144.89 + }
144.90 + }
144.91 +}
145.1 --- a/language/ide/indexing/src/org/netbeans/modules/jackpot30/indexing/index/IndexQuery.java Sat Feb 18 22:14:42 2012 +0100
145.2 +++ b/language/ide/indexing/src/org/netbeans/modules/jackpot30/indexing/index/IndexQuery.java Tue Feb 21 22:37:57 2012 +0100
145.3 @@ -246,8 +246,7 @@
145.4 }
145.5
145.6 public static IndexQuery open(URL sourceRoot) throws IOException {
145.7 - FileObject dataFolder = CacheFolder.getDataFolder(sourceRoot);
145.8 - FileObject cacheFO = dataFolder.getFileObject(JavaIndex.NAME + "/" + JavaIndex.VERSION + "/" + Indexer.INDEX_NAME);
145.9 + FileObject cacheFO = Indexer.resolveCacheFolder(sourceRoot).getFileObject(Indexer.INDEX_NAME);
145.10 File cache = cacheFO != null ? FileUtil.toFile(cacheFO) : null;
145.11
145.12 return new LocalIndexQuery(cache);
146.1 --- a/language/ide/indexing/src/org/netbeans/modules/jackpot30/indexing/index/Indexer.java Sat Feb 18 22:14:42 2012 +0100
146.2 +++ b/language/ide/indexing/src/org/netbeans/modules/jackpot30/indexing/index/Indexer.java Tue Feb 21 22:37:57 2012 +0100
146.3 @@ -71,8 +71,11 @@
146.4 import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
146.5 import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
146.6 import org.netbeans.modules.java.preprocessorbridge.spi.JavaIndexerPlugin;
146.7 +import org.netbeans.modules.java.source.indexing.JavaIndex;
146.8 +import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
146.9 import org.netbeans.modules.parsing.spi.indexing.Indexable;
146.10 import org.openide.filesystems.FileObject;
146.11 +import org.openide.filesystems.FileUtil;
146.12 import org.openide.util.Exceptions;
146.13 import org.openide.util.Lookup;
146.14
146.15 @@ -219,6 +222,12 @@
146.16 }
146.17 }
146.18
146.19 + public static @NonNull FileObject resolveCacheFolder(@NonNull URL sourceRoot) throws IOException {
146.20 + FileObject dataFolder = CacheFolder.getDataFolder(sourceRoot);
146.21 +
146.22 + return FileUtil.createFolder(dataFolder, JavaIndex.NAME + "/" + JavaIndex.VERSION);
146.23 + }
146.24 +
146.25 @MimeRegistration(mimeType="text/x-java", service=Factory.class)
146.26 public static final class FactoryImpl implements Factory {
146.27
147.1 --- a/language/ide/nbproject/platform.properties Sat Feb 18 22:14:42 2012 +0100
147.2 +++ b/language/ide/nbproject/platform.properties Tue Feb 21 22:37:57 2012 +0100
147.3 @@ -13,4 +13,4 @@
147.4 extcluster.../../remoting/ide/build/cluster.sources=../../remoting/ide
147.5 extcluster.../remoting/common/build/cluster.javadoc=
147.6 extcluster.../remoting/common/build/cluster.sources=../../remoting/common
147.7 -nbplatform.active=default
147.8 +nbplatform.active=trunk
148.1 --- a/language/ide/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
148.2 +++ b/language/ide/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
148.3 @@ -1,5 +1,7 @@
148.4 modules=\
148.5 ${project.org.netbeans.modules.jackpot30.indexing}:\
148.6 - ${project.org.netbeans.modules.jackpot30.ui}
148.7 + ${project.org.netbeans.modules.jackpot30.ui}:\
148.8 + ${project.org.netbeans.modules.jackpot30.apisupport}
148.9 +project.org.netbeans.modules.jackpot30.apisupport=bridges/apisupport
148.10 project.org.netbeans.modules.jackpot30.indexing=indexing
148.11 project.org.netbeans.modules.jackpot30.ui=ui
149.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
149.2 +++ b/lib/download.xml Tue Feb 21 22:37:57 2012 +0100
149.3 @@ -0,0 +1,88 @@
149.4 +<project name="download" default="download">
149.5 + <target name="download" depends="copy-from-platform">
149.6 + <property name="imported.basedir" value="${basedir}"/>
149.7 +
149.8 + <macrodef name="download">
149.9 + <attribute name="url"/>
149.10 + <attribute name="target"/>
149.11 + <sequential>
149.12 + <antcall target="-download" inheritAll="false">
149.13 + <param name="url" value="@{url}" />
149.14 + <param name="target" value="@{target}" />
149.15 + <param name="imported.basedir" value="${imported.basedir}" />
149.16 + </antcall>
149.17 + </sequential>
149.18 + </macrodef>
149.19 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1.jar" target="jersey-1.1/jersey-client-1.0.1.jar"/>
149.20 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1-javadoc.jar" target="jersey-1.1/jersey-client-1.0.1-javadoc.jar"/>
149.21 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1-sources.jar" target="jersey-1.1/jersey-client-1.0.1-sources.jar"/>
149.22 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1.jar" target="jersey-1.1/jersey-core-1.0.1.jar"/>
149.23 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1-javadoc.jar" target="jersey-1.1/jersey-core-1.0.1-javadoc.jar"/>
149.24 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1-sources.jar" target="jersey-1.1/jersey-core-1.0.1-sources.jar"/>
149.25 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1.jar" target="jersey-1.1/jersey-server-1.0.1.jar"/>
149.26 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1-javadoc.jar" target="jersey-1.1/jersey-server-1.0.1-javadoc.jar"/>
149.27 + <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1-sources.jar" target="jersey-1.1/jersey-server-1.0.1-sources.jar"/>
149.28 + <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.8.6.3/grizzly-servlet-webserver-1.8.6.3.jar" target="jersey-1.1/grizzly-servlet-webserver-1.8.6.3.jar"/>
149.29 +<!-- <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.14/grizzly-servlet-webserver-1.9.14-javadoc.jar" target="jersey-1.1/grizzly-servlet-webserver-1.9.14-javadoc.jar"/>-->
149.30 +<!-- <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.14/grizzly-servlet-webserver-1.9.14-sources.jar" target="jersey-1.1/grizzly-servlet-webserver-1.9.14-sources.jar"/>-->
149.31 + <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar" target="jersey-1.1/jsr311-api-1.0.jar"/>
149.32 + <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0-javadoc.jar" target="jersey-1.1/jsr311-api-1.0-javadoc.jar"/>
149.33 + <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0-sources.jar" target="jersey-1.1/jsr311-api-1.0-sources.jar"/>
149.34 + <download url="http://repo2.maven.org/maven2/asm/asm-all/3.1/asm-all-3.1.jar" target="jersey-1.1/asm-all-3.1.jar"/>
149.35 + <download url="http://repo2.maven.org/maven2/asm/asm-all/3.1/asm-all-3.1-sources.jar" target="jersey-1.1/asm-all-3.1-sources.jar"/>
149.36 +
149.37 + <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0.jar" target="lucene-3.5.0/lucene-core-3.5.0.jar" />
149.38 + <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0-javadoc.jar" target="lucene-3.5.0/lucene-core-3.5.0-javadoc.jar" />
149.39 + <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0-sources.jar" target="lucene-3.5.0/lucene-core-3.5.0-sources.jar" />
149.40 +
149.41 + <download url="http://repo1.maven.org/maven2/junit/junit/4.5/junit-4.5.jar" target="junit_4/junit-4.5.jar" />
149.42 + <download url="http://switch.dl.sourceforge.net/project/junit/junit/4.5/junit4.5.zip" target="junit_4/junit-4.5-api.zip" />
149.43 + <download url="http://repo1.maven.org/maven2/junit/junit/4.5/junit-4.5-sources.jar" target="junit_4/junit-4.5-src.jar" />
149.44 +
149.45 + <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar" target="junit/junit-3.8.2.jar" />
149.46 + <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2-javadoc.jar" target="junit/junit-3.8.2-javadoc.jar" />
149.47 + <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2-sources.jar" target="junit/junit-3.8.2-sources.jar" />
149.48 +
149.49 + <download url="http://cdn.bitbucket.org/jlahoda/jackpot30/downloads/org-netbeans-modules-java-j2seproject-copylibstask.jar" target="CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar" />
149.50 +
149.51 + <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/org/freemarker/freemarker/2.3.16/freemarker-2.3.16.jar" target="freemarker/freemarker-2.3.16.jar" />
149.52 +
149.53 + <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2.jar" target="jopt-simple/jopt-simple-3.2.jar" />
149.54 + <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2-sources.jar" target="jopt-simple/jopt-simple-3.2-sources.jar" />
149.55 + <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2-javadoc.jar" target="jopt-simple/jopt-simple-3.2-javadoc.jar" />
149.56 + </target>
149.57 +
149.58 + <target name="-download-check-exists">
149.59 + <available property="file.exists" file="${imported.basedir}/lib/${target}"/>
149.60 + </target>
149.61 +
149.62 + <target name="-download" depends="-download-check-exists" unless="file.exists">
149.63 + <dirname property="dir" file="${imported.basedir}/${target}" />
149.64 + <mkdir dir="${dir}" />
149.65 + <get src="${url}" dest="${imported.basedir}/${target}" usetimestamp="true"/>
149.66 + </target>
149.67 +
149.68 + <target name="-prepare-imported-basedir-property">
149.69 + <dirname property="imported.basedir" file="${ant.file.download}"/>
149.70 + </target>
149.71 + <target name="-post-init" depends="-prepare-imported-basedir-property,download"/>
149.72 +
149.73 + <target name="copy-from-platform">
149.74 + <fail unless="nbplatform.active.dir" />
149.75 + <copy file="${nbplatform.active.dir}/java/modules/org-netbeans-modules-java-source.jar" todir="." />
149.76 + <copy file="${nbplatform.active.dir}/java/modules/org-netbeans-modules-java-hints.jar" todir="." />
149.77 + <copy file="${nbplatform.active.dir}/platform/core/org-openide-filesystems.jar" todir="." />
149.78 + <copy file="${nbplatform.active.dir}/platform/lib/org-openide-util.jar" todir="." />
149.79 + <copy file="${nbplatform.active.dir}/platform/lib/org-openide-util-lookup.jar" todir="." />
149.80 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-spi-editor-hints.jar" todir="." />
149.81 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-api-java-classpath.jar" todir="." />
149.82 + <copy file="${nbplatform.active.dir}/java/modules/ext/javac-api-nb-7.0-b07.jar" todir="javac" />
149.83 + <copy file="${nbplatform.active.dir}/java/modules/ext/javac-impl-nb-7.0-b07.jar" todir="javac" />
149.84 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-modules-jumpto.jar" todir="." />
149.85 + <copy file="${nbplatform.active.dir}/platform/modules/org-netbeans-modules-masterfs.jar" todir="." />
149.86 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-modules-parsing-lucene.jar" todir="." />
149.87 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-modules-parsing-api.jar" todir="." />
149.88 + <copy file="${nbplatform.active.dir}/ide/modules/org-netbeans-modules-projectapi.jar" todir="." />
149.89 + <copy file="${nbplatform.active.dir}/java/modules/org-netbeans-modules-java-project.jar" todir="." />
149.90 + </target>
149.91 +</project>
150.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
150.2 +++ b/lib/nblibraries.properties Tue Feb 21 22:37:57 2012 +0100
150.3 @@ -0,0 +1,50 @@
150.4 +libs.jopt-simple.classpath=\
150.5 + ${base}/jopt-simple/jopt-simple-3.2.jar
150.6 +libs.jopt-simple.javadoc=\
150.7 + ${base}/jopt-simple/jopt-simple-3.2-javadoc.jar!//
150.8 +libs.jopt-simple.src=\
150.9 + ${base}/jopt-simple/jopt-simple-3.2-sources.jar
150.10 +libs.junit.classpath=\
150.11 + ${base}/junit/junit-3.8.2.jar
150.12 +libs.junit.javadoc=\
150.13 + ${base}/junit/junit-3.8.2-api.zip
150.14 +libs.junit_4.classpath=\
150.15 + ${base}/junit_4/junit-4.5.jar
150.16 +libs.junit_4.javadoc=\
150.17 + ${base}/junit_4/junit-4.5-api.zip
150.18 +libs.junit_4.src=\
150.19 + ${base}/junit_4/junit-4.5-src.jar
150.20 +libs.CopyLibs.classpath=\
150.21 + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
150.22 +libs.jersey.classpath=\
150.23 + ${base}/jersey-1.1/grizzly-servlet-webserver-1.8.6.3.jar:\
150.24 + ${base}/jersey-1.1/jersey-client-1.0.1.jar:\
150.25 + ${base}/jersey-1.1/jersey-core-1.0.1.jar:\
150.26 + ${base}/jersey-1.1/jersey-server-1.0.1.jar:\
150.27 + ${base}/jersey-1.1/asm-all-3.1.jar:\
150.28 + ${base}/jersey-1.1/jsr311-api-1.0.jar
150.29 +libs.jersey.src=\
150.30 + ${base}/jersey-1.1/jersey-client-1.0.1-sources.jar:\
150.31 + ${base}/jersey-1.1/jersey-core-1.0.1-sources.jar:\
150.32 + ${base}/jersey-1.1/jersey-server-1.0.1-sources.jar:\
150.33 + ${base}/jersey-1.1/asm-all-3.1-sources.jar:\
150.34 + ${base}/jersey-1.1/jsr311-api-1.0-sources.jar
150.35 +libs.lucene.classpath=\
150.36 + ${base}/lucene-3.5.0/lucene-core-3.5.0.jar
150.37 +libs.jersey.javadoc=\
150.38 + ${base}/jersey-1.1/jersey-client-1.0.1-javadoc.jar!//:\
150.39 + ${base}/jersey-1.1/jersey-core-1.0.1-javadoc.jar!//:\
150.40 + ${base}/jersey-1.1/jersey-server-1.0.1-javadoc.jar!//:\
150.41 + ${base}/jersey-1.1/jsr311-api-1.0-javadoc.jar!//
150.42 +libs.lucene.javadoc=\
150.43 + ${base}/lucene-3.5.0/lucene-core-3.5.0-javadoc.jar!//
150.44 +libs.lucene.src=\
150.45 + ${base}/lucene-3.5.0/lucene-core-3.5.0-sources.jar
150.46 +libs.javac.classpath=\
150.47 + ${base}/javac/javac-api-nb-7.0-b07.jar:\
150.48 + ${base}/javac/javac-impl-nb-7.0-b07.jar
150.49 +libs.freemarker.classpath=\
150.50 + ${base}/freemarker/freemarker-2.3.16.jar
150.51 +libs.freemarker.src=\
150.52 + ${base}/freemarker/freemarker-src.zip
150.53 +
151.1 --- a/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
151.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
151.3 @@ -1,56 +0,0 @@
151.4 -<?xml version="1.0" encoding="UTF-8"?>
151.5 -<!--
151.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
151.7 -*** EDIT ../build.xml INSTEAD ***
151.8 --->
151.9 -<project name="jackpot30-impl" basedir=".." xmlns:sproject="http://www.netbeans.org/ns/nb-module-suite-project/1">
151.10 - <fail message="Please build using Ant 1.7.1 or higher.">
151.11 - <condition>
151.12 - <not>
151.13 - <antversion atleast="1.7.1"/>
151.14 - </not>
151.15 - </condition>
151.16 - </fail>
151.17 - <property file="nbproject/private/platform-private.properties"/>
151.18 - <property file="nbproject/platform.properties"/>
151.19 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
151.20 - <attribute name="name"/>
151.21 - <attribute name="value"/>
151.22 - <sequential>
151.23 - <property name="@{name}" value="${@{value}}"/>
151.24 - </sequential>
151.25 - </macrodef>
151.26 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
151.27 - <attribute name="property"/>
151.28 - <attribute name="value"/>
151.29 - <sequential>
151.30 - <property name="@{property}" value="@{value}"/>
151.31 - </sequential>
151.32 - </macrodef>
151.33 - <property file="${user.properties.file}"/>
151.34 - <sproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
151.35 - <sproject:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
151.36 - <sproject:evalprops property="cluster.path.evaluated" value="${cluster.path}"/>
151.37 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
151.38 - <condition>
151.39 - <not>
151.40 - <contains string="${cluster.path.evaluated}" substring="platform"/>
151.41 - </not>
151.42 - </condition>
151.43 - </fail>
151.44 - <fail message="Cannot find NetBeans build harness. ${line.separator}Check that nbplatform.${nbplatform.active}.netbeans.dest.dir and nbplatform.${nbplatform.active}.harness.dir are defined. ${line.separator}On a developer machine these are normally defined in ${user.properties.file}=${netbeans.user}/build.properties ${line.separator}but for automated builds you should pass these properties to Ant explicitly.">
151.45 - <condition>
151.46 - <not>
151.47 - <available type="dir" file="${harness.dir}"/>
151.48 - </not>
151.49 - </condition>
151.50 - </fail>
151.51 - <fail message="Cannot find NetBeans build harness. ${line.separator}Check that nbplatform.${nbplatform.active}.netbeans.dest.dir and nbplatform.${nbplatform.active}.harness.dir are defined. ${line.separator}On a developer machine these are normally defined in ${user.properties.file}=${netbeans.user}/build.properties ${line.separator}but for automated builds you should pass these properties to Ant explicitly.">
151.52 - <condition>
151.53 - <not>
151.54 - <available type="dir" file="${harness.dir}"/>
151.55 - </not>
151.56 - </condition>
151.57 - </fail>
151.58 - <import file="${harness.dir}/suite.xml"/>
151.59 -</project>
152.1 --- a/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
152.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
152.3 @@ -1,11 +0,0 @@
152.4 -build.xml.data.CRC32=89e14acc
152.5 -build.xml.script.CRC32=35d4b33f
152.6 -build.xml.stylesheet.CRC32=531c622b@1.28.0.7
152.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
152.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
152.9 -nbproject/build-impl.xml.data.CRC32=89e14acc
152.10 -nbproject/build-impl.xml.script.CRC32=8f595034
152.11 -nbproject/build-impl.xml.stylesheet.CRC32=56de960a@1.38
152.12 -nbproject/platform.xml.data.CRC32=89e14acc
152.13 -nbproject/platform.xml.script.CRC32=db9e1f43
152.14 -nbproject/platform.xml.stylesheet.CRC32=df8ac4dd@2.46
153.1 --- a/nbproject/platform.properties Sat Feb 18 22:14:42 2012 +0100
153.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
153.3 @@ -1,16 +0,0 @@
153.4 -cluster.path=\
153.5 - ${nbplatform.active.dir}/apisupport:\
153.6 - ${nbplatform.active.dir}/harness:\
153.7 - ${nbplatform.active.dir}/ide:\
153.8 - ${nbplatform.active.dir}/java:\
153.9 - ${nbplatform.active.dir}/nb:\
153.10 - ${nbplatform.active.dir}/platform:\
153.11 - ${nbplatform.active.dir}/profiler:\
153.12 - ${nbplatform.active.dir}/websvccommon:\
153.13 - remoting/ide/build/cluster:\
153.14 - remoting/common/build/cluster
153.15 -extcluster.remoting/common/build/cluster.javadoc=
153.16 -extcluster.remoting/common/build/cluster.sources=remoting/common
153.17 -extcluster.remoting/ide/build/cluster.javadoc=
153.18 -extcluster.remoting/ide/build/cluster.sources=remoting/ide
153.19 -nbplatform.active=default
154.1 --- a/nbproject/platform.xml Sat Feb 18 22:14:42 2012 +0100
154.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
154.3 @@ -1,34 +0,0 @@
154.4 -<?xml version="1.0" encoding="UTF-8"?>
154.5 -<project name="platform" default="download" basedir="..">
154.6 - <condition property="download.required">
154.7 - <and>
154.8 - <not>
154.9 - <available file="${harness.dir}/suite.xml"/>
154.10 - </not>
154.11 - <isset property="bootstrap.url"/>
154.12 - <isset property="autoupdate.catalog.url"/>
154.13 - </and>
154.14 - </condition>
154.15 - <target name="download" if="download.required">
154.16 - <mkdir dir="${harness.dir}"/>
154.17 - <pathconvert pathsep="|" property="download.clusters">
154.18 - <mapper type="flatten"/>
154.19 - <path path="${cluster.path}"/>
154.20 - </pathconvert>
154.21 - <property name="disabled.modules" value=""/>
154.22 - <pathconvert property="module.includes" pathsep="">
154.23 - <mapper type="glob" from="${basedir}${file.separator}*" to="(?!\Q*\E)"/>
154.24 - <path>
154.25 - <filelist files="${disabled.modules}" dir="."/>
154.26 - </path>
154.27 - </pathconvert>
154.28 - <echo message="Downloading clusters ${download.clusters}"/>
154.29 - <property name="tasks.jar" location="${java.io.tmpdir}/tasks.jar"/>
154.30 - <get src="${bootstrap.url}" dest="${tasks.jar}" usetimestamp="true" verbose="true"/>
154.31 - <taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${tasks.jar}"/>
154.32 - <autoupdate installdir="${nbplatform.active.dir}" updatecenter="${autoupdate.catalog.url}">
154.33 - <modules includes="${module.includes}.*" clusters="${download.clusters}"/>
154.34 - <modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>
154.35 - </autoupdate>
154.36 - </target>
154.37 -</project>
155.1 --- a/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
155.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
155.3 @@ -1,17 +0,0 @@
155.4 -modules=\
155.5 - ${project.org.netbeans.modules.jackpot30.hintsimpl}:\
155.6 - ${project.org.netbeans.modules.jackpot30.api}:\
155.7 - ${project.org.netbeans.modules.jackpot30.transformers}:\
155.8 - ${project.org.netbeans.modules.jackpot30.kit}:\
155.9 - ${project.org.netbeans.modules.jackpot30.help}:\
155.10 - ${project.org.netbeans.modules.jackpot30.refactoring}:\
155.11 - ${project.org.netbeans.modules.jackpot30.apisupport}
155.12 -project.org.netbeans.modules.jackpot30.api=api
155.13 -project.org.netbeans.modules.jackpot30.apisupport=bridges/apisupport
155.14 -project.org.netbeans.modules.jackpot30.help=help
155.15 -project.org.netbeans.modules.jackpot30.hintsimpl=hintsimpl
155.16 -project.org.netbeans.modules.jackpot30.kit=kit
155.17 -project.org.netbeans.modules.jackpot30.refactoring=bridges/refactoring
155.18 -project.org.netbeans.modules.jackpot30.transformers=transformer
155.19 -
155.20 -project.license=cddl-netbeans-sun
156.1 --- a/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
156.2 +++ b/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
156.3 @@ -1,9 +1,30 @@
156.4 <?xml version="1.0" encoding="UTF-8"?>
156.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
156.6 - <type>org.netbeans.modules.apisupport.project.suite</type>
156.7 +<project xmlns="http://www.netbeans.org/ns/project/1" xmlns:ns1="null" xmlns:ns2="null">
156.8 + <type>org.netbeans.modules.ant.freeform</type>
156.9 <configuration>
156.10 - <data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1">
156.11 + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
156.12 + <!-- Do not use Project Properties customizer when editing this file manually. -->
156.13 <name>jackpot30</name>
156.14 - </data>
156.15 + <properties/>
156.16 + <ide-actions/>
156.17 + <view>
156.18 + <items>
156.19 + <source-file>
156.20 + <location>build.xml</location>
156.21 + </source-file>
156.22 + </items>
156.23 + <context-menu/>
156.24 + </view>
156.25 + <subprojects>
156.26 + <project>cmdline</project>
156.27 + <project>duplicates/ide</project>
156.28 + <project>language/ide</project>
156.29 + <project>remoting/common</project>
156.30 + <project>remoting/ide</project>
156.31 + <project>remoting/server/hudson</project>
156.32 + <project>remoting/server/indexer</project>
156.33 + <project>remoting/server/web/web.main</project>
156.34 + </subprojects>
156.35 + </general-data>
156.36 </configuration>
156.37 </project>
157.1 --- a/overlays/netbeans Sat Feb 18 22:14:42 2012 +0100
157.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
157.3 @@ -1,307 +0,0 @@
157.4 -diff --git a/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
157.5 -new file mode 100644
157.6 ---- /dev/null
157.7 -+++ b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
157.8 -@@ -0,0 +1,23 @@
157.9 -+'FileObject.getPackageNameExt(char, char) is deprecated':
157.10 -+ $0.getPackageNameExt('/', '.') :: $0 instanceof org.openide.FileObject
157.11 -+=> $0.getPath()
157.12 -+;;
157.13 -+'FileObject.getPackageNameExt(char, char) is deprecated':
157.14 -+ $0.getPackageNameExt($1, '.') :: $0 instanceof org.openide.FileObject && $1 instanceof char
157.15 -+=> $0.getPath().replace('/', $1)
157.16 -+;;
157.17 -+
157.18 -+'FileObject.isReadOnly() is deprecated':
157.19 -+ $0.isReadOnly() :: $0 instanceof org.openide.FileObject
157.20 -+=> !$0.canWrite()
157.21 -+;;
157.22 -+
157.23 -+'Repository.getDefaultFileSystem()':
157.24 -+ org.openide.filesystems.Repository.getDefault.getDefaultFileSystem()
157.25 -+=> org.openide.filesystems.FileUtil.getConfigRoot()
157.26 -+;;
157.27 -+
157.28 -+'Repository.getDefaultFileSystem()':
157.29 -+ org.openide.filesystems.Repository.getDefault.getDefaultFileSystem().findResource($path) :: $path instanceof java.lang.String
157.30 -+=> org.openide.filesystems.FileUtil.getConfigFile($path)
157.31 -+;;
157.32 -diff --git a/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
157.33 -new file mode 100644
157.34 ---- /dev/null
157.35 -+++ b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
157.36 -@@ -0,0 +1,3 @@
157.37 -+'DataObject.getCookie is obsolette':
157.38 -+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
157.39 -+ => $this.getLookup().lookup($1) ;;
157.40 -diff --git a/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
157.41 -new file mode 100644
157.42 ---- /dev/null
157.43 -+++ b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
157.44 -@@ -0,0 +1,3 @@
157.45 -+'Node.getCookie is obsolette':
157.46 -+$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
157.47 -+ => $this.getLookup().lookup($1) ;;
157.48 -diff --git a/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
157.49 -new file mode 100644
157.50 ---- /dev/null
157.51 -+++ b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
157.52 -@@ -0,0 +1,12 @@
157.53 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
157.54 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
157.55 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
157.56 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT, $1) ;;
157.57 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
157.58 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
157.59 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE) ;;
157.60 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE) ;;
157.61 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
157.62 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT) ;;
157.63 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
157.64 -+'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
157.65 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
157.66 -new file mode 100644
157.67 ---- /dev/null
157.68 -+++ b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
157.69 -@@ -0,0 +1,104 @@
157.70 -+'ErrorManager.notify is deprecated':
157.71 -+$this.notify(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.72 -+ =>org.openide.util.Exceptions.printStackTrace($1)
157.73 -+ ;;
157.74 -+
157.75 -+'ErrorManager.notify is deprecated':
157.76 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.77 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
157.78 -+ ;;
157.79 -+
157.80 -+'ErrorManager.notify is deprecated':
157.81 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.82 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
157.83 -+ ;;
157.84 -+
157.85 -+'ErrorManager.notify is deprecated':
157.86 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.87 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, null, $1)
157.88 -+ ;;
157.89 -+
157.90 -+'ErrorManager.notify is deprecated':
157.91 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.92 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
157.93 -+ ;;
157.94 -+
157.95 -+'ErrorManager.notify is deprecated':
157.96 -+org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.97 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
157.98 -+ ;;
157.99 -+
157.100 -+'ErrorManager.notify is deprecated':
157.101 -+$this.notify($1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
157.102 -+ =>org.openide.util.Exceptions.printStackTrace($1)
157.103 -+ ;;
157.104 -+
157.105 -+'ErrorManager.log is deprecated':
157.106 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.107 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, $1)
157.108 -+ ;;
157.109 -+
157.110 -+'ErrorManager.log is deprecated':
157.111 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.ERROR, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.112 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
157.113 -+ ;;
157.114 -+
157.115 -+'ErrorManager.log is deprecated':
157.116 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.117 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
157.118 -+ ;;
157.119 -+
157.120 -+'ErrorManager.log is deprecated':
157.121 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.122 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
157.123 -+ ;;
157.124 -+
157.125 -+'ErrorManager.log is deprecated':
157.126 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.127 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
157.128 -+ ;;
157.129 -+
157.130 -+'ErrorManager.log is deprecated':
157.131 -+org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.132 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
157.133 -+ ;;
157.134 -+
157.135 -+'ErrorManager.log is deprecated':
157.136 -+org.openide.ErrorManager.getDefault().log($1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.137 -+ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
157.138 -+ ;;
157.139 -+
157.140 -+'ErrorManager.isLoggable is deprecated':
157.141 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.UNKNOWN) :: $this instanceof org.openide.ErrorManager
157.142 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.INFO)
157.143 -+ ;;
157.144 -+
157.145 -+'ErrorManager.isLoggable is deprecated':
157.146 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.ERROR) :: $this instanceof org.openide.ErrorManager
157.147 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
157.148 -+ ;;
157.149 -+
157.150 -+'ErrorManager.isLoggable is deprecated':
157.151 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.EXCEPTION) :: $this instanceof org.openide.ErrorManager
157.152 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
157.153 -+ ;;
157.154 -+
157.155 -+'ErrorManager.isLoggable is deprecated':
157.156 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.INFORMATIONAL) :: $this instanceof org.openide.ErrorManager
157.157 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.FINE)
157.158 -+ ;;
157.159 -+
157.160 -+'ErrorManager.isLoggable is deprecated':
157.161 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.USER) :: $this instanceof org.openide.ErrorManager
157.162 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
157.163 -+ ;;
157.164 -+
157.165 -+'ErrorManager.isLoggable is deprecated':
157.166 -+org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.WARNING) :: $this instanceof org.openide.ErrorManager
157.167 -+ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
157.168 -+ ;;
157.169 -+
157.170 -+'ErrorManager.annotate is deprecated':
157.171 -+$this.annotate($1, $2) :: $1 instanceof java.lang.Throwable && $2 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
157.172 -+ =>org.openide.util.Exceptions.attachLocalizedMessage($1, $2)
157.173 -+ ;;
157.174 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
157.175 -new file mode 100644
157.176 ---- /dev/null
157.177 -+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
157.178 -@@ -0,0 +1,17 @@
157.179 -+'Lookup.lookupAll can be used instead':
157.180 -+$0.lookup(new org.openide.util.Lookup.Template($1)).allInstances() :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class
157.181 -+=>
157.182 -+$0.lookupAll($1)
157.183 -+;;
157.184 -+
157.185 -+'Lookup.lookupResult can be used instead':
157.186 -+$0.lookup(new org.openide.util.Lookup.Template($1)) :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class && !parentMatches("$_.allInstances()")
157.187 -+=>
157.188 -+$0.lookupResult($1)
157.189 -+;;
157.190 -+
157.191 -+'Lookup.Template() is deprecated':
157.192 -+new org.openide.util.Lookup.Template()
157.193 -+=>
157.194 -+new org.openide.util.Lookup.Template(java.lang.Object.class)
157.195 -+;;
157.196 -diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
157.197 -new file mode 100644
157.198 ---- /dev/null
157.199 -+++ b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
157.200 -@@ -0,0 +1,19 @@
157.201 -+'Utilities.mergeImages is deprecated':
157.202 -+ org.openide.util.Utilities.mergeImages($1, $2, $3, $4) :: $1 instanceof java.awt.Image && $2 instanceof java.awt.Image && $3 instanceof int && $4 instanceof int
157.203 -+=> org.openide.util.ImageUtilities.mergeImages($1, $2, $3, $4)
157.204 -+;;
157.205 -+
157.206 -+'Utilities.loadImage is deprecated':
157.207 -+ org.openide.util.Utilities.loadImage($1) :: $1 instanceof String
157.208 -+=> org.openide.util.ImageUtilities.loadImage($1)
157.209 -+;;
157.210 -+
157.211 -+'Utilities.icon2Image is deprecated':
157.212 -+ org.openide.util.Utilities.icon2Image($1) :: $1 instanceof javax.swing.Icon
157.213 -+=> org.openide.util.ImageUtilities.icon2Image($1)
157.214 -+;;
157.215 -+
157.216 -+'Utilities.image2Icon can be used instead of new ImageIcon':
157.217 -+ new javax.swing.ImageIcon($1) :: $1 instanceof java.awt.Image
157.218 -+=> org.openide.util.ImageUtilities.image2Icon($1)
157.219 -+;;
157.220 -diff --git a/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
157.221 -new file mode 100644
157.222 ---- /dev/null
157.223 -+++ b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
157.224 -@@ -0,0 +1,86 @@
157.225 -+%%TestCase mergeImages1
157.226 -+package test;
157.227 -+import java.awt.Image;
157.228 -+import org.openide.util.Utilities;
157.229 -+public class Test {
157.230 -+ private void test() {
157.231 -+ Image i1 = null, i2 = null;
157.232 -+ Utilities.mergeImages(i1, i2, -9, 34);
157.233 -+ }
157.234 -+}
157.235 -+%%=>
157.236 -+package test;
157.237 -+import java.awt.Image;
157.238 -+import org.openide.util.ImageUtilities;
157.239 -+import org.openide.util.Utilities;
157.240 -+public class Test {
157.241 -+ private void test() {
157.242 -+ Image i1 = null, i2 = null;
157.243 -+ ImageUtilities.mergeImages(i1, i2, -9, 34);
157.244 -+ }
157.245 -+}
157.246 -+%%TestCase loadImage1
157.247 -+package test;
157.248 -+import java.awt.Image;
157.249 -+import org.openide.util.Utilities;
157.250 -+public class Test {
157.251 -+ private void test() {
157.252 -+ Utilities.loadImage("foobar");
157.253 -+ }
157.254 -+}
157.255 -+%%=>
157.256 -+package test;
157.257 -+import java.awt.Image;
157.258 -+import org.openide.util.ImageUtilities;
157.259 -+import org.openide.util.Utilities;
157.260 -+public class Test {
157.261 -+ private void test() {
157.262 -+ ImageUtilities.loadImage("foobar");
157.263 -+ }
157.264 -+}
157.265 -+%%TestCase icon2Image1
157.266 -+package test;
157.267 -+import javax.swing.Icon;
157.268 -+import org.openide.util.Utilities;
157.269 -+public class Test {
157.270 -+ private void test() {
157.271 -+ Icon i = null;
157.272 -+ Utilities.icon2Image(i);
157.273 -+ }
157.274 -+}
157.275 -+%%=>
157.276 -+package test;
157.277 -+import javax.swing.Icon;
157.278 -+import org.openide.util.ImageUtilities;
157.279 -+import org.openide.util.Utilities;
157.280 -+public class Test {
157.281 -+ private void test() {
157.282 -+ Icon i = null;
157.283 -+ ImageUtilities.icon2Image(i);
157.284 -+ }
157.285 -+}
157.286 -+%%TestCase image2Icon1
157.287 -+package test;
157.288 -+import java.awt.Image;
157.289 -+import javax.swing.Icon;
157.290 -+import javax.swing.ImageIcon;
157.291 -+import org.openide.util.Utilities;
157.292 -+public class Test {
157.293 -+ private void test() {
157.294 -+ Image img = null;
157.295 -+ Icon i = new ImageIcon(img);
157.296 -+ }
157.297 -+}
157.298 -+%%=>
157.299 -+package test;
157.300 -+import java.awt.Image;
157.301 -+import javax.swing.Icon;
157.302 -+import javax.swing.ImageIcon;
157.303 -+import org.openide.util.ImageUtilities;
157.304 -+import org.openide.util.Utilities;
157.305 -+public class Test {
157.306 -+ private void test() {
157.307 -+ Image img = null;
157.308 -+ Icon i = ImageUtilities.image2Icon(img);
157.309 -+ }
157.310 -+}
158.1 --- a/remoting/server/web/base.web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
158.2 +++ b/remoting/server/web/base.web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
158.3 @@ -43,7 +43,7 @@
158.4 <property file="nbproject/private/private.properties"/>
158.5 </target>
158.6 <target name="-pre-init-libraries">
158.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
158.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
158.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
158.10 <pathconvert dirsep="/" property="libraries.dir">
158.11 <path path="${libraries.dir.nativedirsep}"/>
159.1 --- a/remoting/server/web/base.web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
159.2 +++ b/remoting/server/web/base.web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
159.3 @@ -1,8 +1,8 @@
159.4 -build.xml.data.CRC32=274e0636
159.5 +build.xml.data.CRC32=8d18f2d6
159.6 build.xml.script.CRC32=f51e627e
159.7 -build.xml.stylesheet.CRC32=28e38971@1.45.0.45
159.8 +build.xml.stylesheet.CRC32=28e38971@1.51.0.46
159.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
159.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
159.11 -nbproject/build-impl.xml.data.CRC32=274e0636
159.12 -nbproject/build-impl.xml.script.CRC32=09b2e35a
159.13 +nbproject/build-impl.xml.data.CRC32=8d18f2d6
159.14 +nbproject/build-impl.xml.script.CRC32=53f8b1ba
159.15 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
160.1 --- a/remoting/server/web/base.web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
160.2 +++ b/remoting/server/web/base.web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
160.3 @@ -1,5 +1,6 @@
160.4 annotation.processing.enabled=true
160.5 annotation.processing.enabled.in.editor=false
160.6 +annotation.processing.processors.list=
160.7 annotation.processing.run.all.processors=true
160.8 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
160.9 application.title=base.web.api
160.10 @@ -26,11 +27,11 @@
160.11 dist.javadoc.dir=${dist.dir}/javadoc
160.12 endorsed.classpath=
160.13 excludes=
160.14 -file.reference.org-netbeans-modules-java-source.jar=../../../../server/lib/org-netbeans-modules-java-source.jar
160.15 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../server/lib/org-netbeans-modules-parsing-api.jar
160.16 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
160.17 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
160.18 -file.reference.org-openide-util-lookup.jar=../../../../server/lib/org-openide-util-lookup.jar
160.19 +file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
160.20 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
160.21 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
160.22 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
160.23 +file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
160.24 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
160.25 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
160.26 includes=**
161.1 --- a/remoting/server/web/base.web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
161.2 +++ b/remoting/server/web/base.web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
161.3 @@ -12,7 +12,7 @@
161.4 </test-roots>
161.5 </data>
161.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
161.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
161.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
161.9 </libraries>
161.10 </configuration>
161.11 </project>
162.1 --- a/remoting/server/web/nbindex.web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
162.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
162.3 @@ -43,7 +43,7 @@
162.4 <property file="nbproject/private/private.properties"/>
162.5 </target>
162.6 <target name="-pre-init-libraries">
162.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
162.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
162.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
162.10 <pathconvert dirsep="/" property="libraries.dir">
162.11 <path path="${libraries.dir.nativedirsep}"/>
163.1 --- a/remoting/server/web/nbindex.web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
163.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
163.3 @@ -1,8 +1,8 @@
163.4 -build.xml.data.CRC32=a5bf9572
163.5 +build.xml.data.CRC32=0e5c43eb
163.6 build.xml.script.CRC32=db0f33ed
163.7 -build.xml.stylesheet.CRC32=28e38971@1.46.0.46
163.8 +build.xml.stylesheet.CRC32=28e38971@1.51.0.46
163.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
163.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
163.11 -nbproject/build-impl.xml.data.CRC32=a5bf9572
163.12 -nbproject/build-impl.xml.script.CRC32=d24bbf32
163.13 +nbproject/build-impl.xml.data.CRC32=0e5c43eb
163.14 +nbproject/build-impl.xml.script.CRC32=b73dc5e9
163.15 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
164.1 --- a/remoting/server/web/nbindex.web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
164.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
164.3 @@ -25,10 +25,10 @@
164.4 dist.jar=${dist.dir}/nbindex.web.api.jar
164.5 dist.javadoc.dir=${dist.dir}/javadoc
164.6 excludes=
164.7 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../server/lib/org-netbeans-modules-parsing-api.jar
164.8 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
164.9 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
164.10 -file.reference.org-openide-util.jar=../../../../server/lib/org-openide-util.jar
164.11 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
164.12 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
164.13 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
164.14 +file.reference.org-openide-util.jar=../../../../lib/org-openide-util.jar
164.15 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
164.16 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
164.17 includes=**
165.1 --- a/remoting/server/web/nbindex.web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
165.2 +++ b/remoting/server/web/nbindex.web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
165.3 @@ -12,7 +12,7 @@
165.4 </test-roots>
165.5 </data>
165.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
165.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
165.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
165.9 </libraries>
165.10 <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
165.11 <reference>
166.1 --- a/remoting/server/web/source.web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
166.2 +++ b/remoting/server/web/source.web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
166.3 @@ -43,7 +43,7 @@
166.4 <property file="nbproject/private/private.properties"/>
166.5 </target>
166.6 <target name="-pre-init-libraries">
166.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
166.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
166.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
166.10 <pathconvert dirsep="/" property="libraries.dir">
166.11 <path path="${libraries.dir.nativedirsep}"/>
167.1 --- a/remoting/server/web/source.web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
167.2 +++ b/remoting/server/web/source.web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
167.3 @@ -1,8 +1,8 @@
167.4 -build.xml.data.CRC32=6ff1c131
167.5 +build.xml.data.CRC32=52865c72
167.6 build.xml.script.CRC32=d7df2170
167.7 -build.xml.stylesheet.CRC32=28e38971@1.45.0.45
167.8 +build.xml.stylesheet.CRC32=28e38971@1.51.0.46
167.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
167.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
167.11 -nbproject/build-impl.xml.data.CRC32=6ff1c131
167.12 -nbproject/build-impl.xml.script.CRC32=903707b8
167.13 +nbproject/build-impl.xml.data.CRC32=52865c72
167.14 +nbproject/build-impl.xml.script.CRC32=0980b7a4
167.15 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
168.1 --- a/remoting/server/web/source.web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
168.2 +++ b/remoting/server/web/source.web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
168.3 @@ -25,9 +25,9 @@
168.4 dist.jar=${dist.dir}/source.web.api.jar
168.5 dist.javadoc.dir=${dist.dir}/javadoc
168.6 excludes=
168.7 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../server/lib/org-netbeans-modules-parsing-api.jar
168.8 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
168.9 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
168.10 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
168.11 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
168.12 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
168.13 includes=**
168.14 jar.compress=false
168.15 javac.classpath=\
169.1 --- a/remoting/server/web/source.web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
169.2 +++ b/remoting/server/web/source.web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
169.3 @@ -12,7 +12,7 @@
169.4 </test-roots>
169.5 </data>
169.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
169.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
169.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
169.9 </libraries>
169.10 <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
169.11 <reference>
170.1 --- a/remoting/server/web/type.web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
170.2 +++ b/remoting/server/web/type.web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
170.3 @@ -43,7 +43,7 @@
170.4 <property file="nbproject/private/private.properties"/>
170.5 </target>
170.6 <target name="-pre-init-libraries">
170.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
170.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
170.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
170.10 <pathconvert dirsep="/" property="libraries.dir">
170.11 <path path="${libraries.dir.nativedirsep}"/>
171.1 --- a/remoting/server/web/type.web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
171.2 +++ b/remoting/server/web/type.web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
171.3 @@ -1,8 +1,8 @@
171.4 -build.xml.data.CRC32=9ceb8e45
171.5 +build.xml.data.CRC32=7d71200f
171.6 build.xml.script.CRC32=583d72ad
171.7 -build.xml.stylesheet.CRC32=28e38971@1.45.0.45
171.8 +build.xml.stylesheet.CRC32=28e38971@1.51.0.46
171.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
171.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
171.11 -nbproject/build-impl.xml.data.CRC32=9ceb8e45
171.12 -nbproject/build-impl.xml.script.CRC32=d8965d3c
171.13 +nbproject/build-impl.xml.data.CRC32=7d71200f
171.14 +nbproject/build-impl.xml.script.CRC32=3fd5bf71
171.15 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
172.1 --- a/remoting/server/web/type.web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
172.2 +++ b/remoting/server/web/type.web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
172.3 @@ -26,11 +26,11 @@
172.4 dist.javadoc.dir=${dist.dir}/javadoc
172.5 endorsed.classpath=
172.6 excludes=
172.7 -file.reference.org-netbeans-api-java-classpath.jar=../../../../server/lib/org-netbeans-api-java-classpath.jar
172.8 -file.reference.org-netbeans-modules-java-source.jar=../../../../server/lib/org-netbeans-modules-java-source.jar
172.9 -file.reference.org-netbeans-modules-jumpto.jar=../../../../server/lib/org-netbeans-modules-jumpto.jar
172.10 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
172.11 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
172.12 +file.reference.org-netbeans-api-java-classpath.jar=../../../../lib/org-netbeans-api-java-classpath.jar
172.13 +file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
172.14 +file.reference.org-netbeans-modules-jumpto.jar=../../../../lib/org-netbeans-modules-jumpto.jar
172.15 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
172.16 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
172.17 file.reference.util-commons.jar-1=../../../ide/api/external/util-commons.jar
172.18 file.reference.util-pojson.jar-1=../../../ide/api/external/util-pojson.jar
172.19 includes=**
173.1 --- a/remoting/server/web/type.web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
173.2 +++ b/remoting/server/web/type.web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
173.3 @@ -12,7 +12,7 @@
173.4 </test-roots>
173.5 </data>
173.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
173.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
173.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
173.9 </libraries>
173.10 <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
173.11 <reference>
174.1 --- a/remoting/server/web/usages.web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
174.2 +++ b/remoting/server/web/usages.web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
174.3 @@ -43,7 +43,7 @@
174.4 <property file="nbproject/private/private.properties"/>
174.5 </target>
174.6 <target name="-pre-init-libraries">
174.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
174.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
174.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
174.10 <pathconvert dirsep="/" property="libraries.dir">
174.11 <path path="${libraries.dir.nativedirsep}"/>
175.1 --- a/remoting/server/web/usages.web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
175.2 +++ b/remoting/server/web/usages.web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
175.3 @@ -1,8 +1,8 @@
175.4 -build.xml.data.CRC32=9115199c
175.5 +build.xml.data.CRC32=0ab46c18
175.6 build.xml.script.CRC32=3bd67ab1
175.7 -build.xml.stylesheet.CRC32=28e38971@1.45.0.45
175.8 +build.xml.stylesheet.CRC32=28e38971@1.51.0.46
175.9 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
175.10 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
175.11 -nbproject/build-impl.xml.data.CRC32=9115199c
175.12 -nbproject/build-impl.xml.script.CRC32=9892c5ea
175.13 +nbproject/build-impl.xml.data.CRC32=0ab46c18
175.14 +nbproject/build-impl.xml.script.CRC32=b8043472
175.15 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
176.1 --- a/remoting/server/web/usages.web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
176.2 +++ b/remoting/server/web/usages.web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
176.3 @@ -25,9 +25,9 @@
176.4 dist.jar=${dist.dir}/usages.web.api.jar
176.5 dist.javadoc.dir=${dist.dir}/javadoc
176.6 excludes=
176.7 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../server/lib/org-netbeans-modules-parsing-api.jar
176.8 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
176.9 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
176.10 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
176.11 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
176.12 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
176.13 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
176.14 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
176.15 includes=**
177.1 --- a/remoting/server/web/usages.web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
177.2 +++ b/remoting/server/web/usages.web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
177.3 @@ -12,7 +12,7 @@
177.4 </test-roots>
177.5 </data>
177.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
177.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
177.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
177.9 </libraries>
177.10 <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
177.11 <reference>
178.1 --- a/remoting/server/web/web.main/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
178.2 +++ b/remoting/server/web/web.main/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
178.3 @@ -43,7 +43,7 @@
178.4 <property file="nbproject/private/private.properties"/>
178.5 </target>
178.6 <target name="-pre-init-libraries">
178.7 - <property location="../../../../server/lib/nblibraries.properties" name="libraries.path"/>
178.8 + <property location="../../../../lib/nblibraries.properties" name="libraries.path"/>
178.9 <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
178.10 <pathconvert dirsep="/" property="libraries.dir">
178.11 <path path="${libraries.dir.nativedirsep}"/>
179.1 --- a/remoting/server/web/web.main/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
179.2 +++ b/remoting/server/web/web.main/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
179.3 @@ -3,6 +3,6 @@
179.4 build.xml.stylesheet.CRC32=28e38971@1.46.0.46
179.5 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
179.6 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
179.7 -nbproject/build-impl.xml.data.CRC32=f536def6
179.8 -nbproject/build-impl.xml.script.CRC32=690bede7
179.9 +nbproject/build-impl.xml.data.CRC32=e98004c7
179.10 +nbproject/build-impl.xml.script.CRC32=7c935a2a
179.11 nbproject/build-impl.xml.stylesheet.CRC32=96b566c0@1.51.0.46
180.1 --- a/remoting/server/web/web.main/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
180.2 +++ b/remoting/server/web/web.main/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
180.3 @@ -1,5 +1,6 @@
180.4 annotation.processing.enabled=true
180.5 annotation.processing.enabled.in.editor=false
180.6 +annotation.processing.processors.list=
180.7 annotation.processing.run.all.processors=true
180.8 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
180.9 application.title=web.main
180.10 @@ -26,20 +27,19 @@
180.11 dist.javadoc.dir=${dist.dir}/javadoc
180.12 endorsed.classpath=
180.13 excludes=
180.14 -file.reference.org-netbeans-api-java-classpath.jar=../../../../server/lib/org-netbeans-api-java-classpath.jar
180.15 -file.reference.org-netbeans-modules-java-hints.jar=../../../../server/lib/org-netbeans-modules-java-hints.jar
180.16 -file.reference.org-netbeans-modules-java-project.jar=../../../../server/lib/org-netbeans-modules-java-project.jar
180.17 -file.reference.org-netbeans-modules-java-source.jar=../../../../server/lib/org-netbeans-modules-java-source.jar
180.18 -file.reference.org-netbeans-modules-jumpto.jar=../../../../server/lib/org-netbeans-modules-jumpto.jar
180.19 -file.reference.org-netbeans-modules-masterfs.jar=../../../../server/lib/org-netbeans-modules-masterfs.jar
180.20 -file.reference.org-netbeans-modules-parsing-api.jar=../../../../server/lib/org-netbeans-modules-parsing-api.jar
180.21 -file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../server/lib/org-netbeans-modules-parsing-lucene.jar
180.22 -file.reference.org-netbeans-modules-projectapi.jar=../../../../server/lib/org-netbeans-modules-projectapi.jar
180.23 -file.reference.org-netbeans-modules-sendopts.jar=../../../../server/lib/org-netbeans-modules-sendopts.jar
180.24 -file.reference.org-netbeans-spi-editor-hints.jar=../../../../server/lib/org-netbeans-spi-editor-hints.jar
180.25 -file.reference.org-openide-filesystems.jar=../../../../server/lib/org-openide-filesystems.jar
180.26 -file.reference.org-openide-util-lookup.jar=../../../../server/lib/org-openide-util-lookup.jar
180.27 -file.reference.org-openide-util.jar=../../../../server/lib/org-openide-util.jar
180.28 +file.reference.org-netbeans-api-java-classpath.jar=../../../../lib/org-netbeans-api-java-classpath.jar
180.29 +file.reference.org-netbeans-modules-java-hints.jar=../../../../lib/org-netbeans-modules-java-hints.jar
180.30 +file.reference.org-netbeans-modules-java-project.jar=../../../../lib/org-netbeans-modules-java-project.jar
180.31 +file.reference.org-netbeans-modules-java-source.jar=../../../../lib/org-netbeans-modules-java-source.jar
180.32 +file.reference.org-netbeans-modules-jumpto.jar=../../../../lib/org-netbeans-modules-jumpto.jar
180.33 +file.reference.org-netbeans-modules-masterfs.jar=../../../../lib/org-netbeans-modules-masterfs.jar
180.34 +file.reference.org-netbeans-modules-parsing-api.jar=../../../../lib/org-netbeans-modules-parsing-api.jar
180.35 +file.reference.org-netbeans-modules-parsing-lucene.jar=../../../../lib/org-netbeans-modules-parsing-lucene.jar
180.36 +file.reference.org-netbeans-modules-projectapi.jar=../../../../lib/org-netbeans-modules-projectapi.jar
180.37 +file.reference.org-netbeans-spi-editor-hints.jar=../../../../lib/org-netbeans-spi-editor-hints.jar
180.38 +file.reference.org-openide-filesystems.jar=../../../../lib/org-openide-filesystems.jar
180.39 +file.reference.org-openide-util-lookup.jar=../../../../lib/org-openide-util-lookup.jar
180.40 +file.reference.org-openide-util.jar=../../../../lib/org-openide-util.jar
180.41 file.reference.util-commons.jar=../../../ide/api/external/util-commons.jar
180.42 file.reference.util-pojson.jar=../../../ide/api/external/util-pojson.jar
180.43 includes=**
180.44 @@ -60,7 +60,6 @@
180.45 ${file.reference.org-netbeans-modules-parsing-api.jar}:\
180.46 ${file.reference.org-netbeans-modules-parsing-lucene.jar}:\
180.47 ${file.reference.org-netbeans-modules-projectapi.jar}:\
180.48 - ${file.reference.org-netbeans-modules-sendopts.jar}:\
180.49 ${file.reference.org-netbeans-spi-editor-hints.jar}:\
180.50 ${file.reference.org-openide-filesystems.jar}:\
180.51 ${file.reference.org-openide-util-lookup.jar}:\
181.1 --- a/remoting/server/web/web.main/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
181.2 +++ b/remoting/server/web/web.main/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
181.3 @@ -12,7 +12,7 @@
181.4 </test-roots>
181.5 </data>
181.6 <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
181.7 - <definitions>../../../../server/lib/nblibraries.properties</definitions>
181.8 + <definitions>../../../../lib/nblibraries.properties</definitions>
181.9 </libraries>
181.10 <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
181.11 <reference>
182.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
182.2 +++ b/sandbox/old-modules/api/build.xml Tue Feb 21 22:37:57 2012 +0100
182.3 @@ -0,0 +1,23 @@
182.4 +<?xml version="1.0" encoding="UTF-8"?>
182.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
182.6 +<!-- for some information on what you could do (e.g. targets to override). -->
182.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
182.8 +<project name="org.netbeans.modules.jackpot30.api" default="netbeans" basedir=".">
182.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.api.</description>
182.10 + <import file="nbproject/build-impl.xml"/>
182.11 + <import file="${suite.dir}/findbugs-import.xml"/>
182.12 +
182.13 + <!-- Mac -->
182.14 + <pathconvert property="retouche.javac">
182.15 + <fileset dir="${nbplatform.active.dir}">
182.16 + <filename name="java*/modules/ext/javac*.jar"/>
182.17 + </fileset>
182.18 + <fileset dir="${java.home}/../Classes" erroronmissingdir="false">
182.19 + <include name="*.jar"/>
182.20 + </fileset>
182.21 + </pathconvert>
182.22 + <echo message="${retouche.javac}"/>
182.23 + <condition property="bootclasspath.mac" value="${retouche.javac}">
182.24 + <os family="mac"/>
182.25 + </condition>
182.26 +</project>
183.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
183.2 +++ b/sandbox/old-modules/api/manifest.mf Tue Feb 21 22:37:57 2012 +0100
183.3 @@ -0,0 +1,7 @@
183.4 +Manifest-Version: 1.0
183.5 +AutoUpdate-Show-In-Client: false
183.6 +OpenIDE-Module: org.netbeans.modules.jackpot30.api
183.7 +OpenIDE-Module-Implementation-Version: 1
183.8 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/impl/resources/layer.xml
183.9 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/impl/resources/Bundle.properties
183.10 +
184.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
184.2 +++ b/sandbox/old-modules/api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
184.3 @@ -0,0 +1,45 @@
184.4 +<?xml version="1.0" encoding="UTF-8"?>
184.5 +<!--
184.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
184.7 +*** EDIT ../build.xml INSTEAD ***
184.8 +-->
184.9 +<project name="org.netbeans.modules.jackpot30.api-impl" basedir="..">
184.10 + <fail message="Please build using Ant 1.7.1 or higher.">
184.11 + <condition>
184.12 + <not>
184.13 + <antversion atleast="1.7.1"/>
184.14 + </not>
184.15 + </condition>
184.16 + </fail>
184.17 + <property file="nbproject/private/suite-private.properties"/>
184.18 + <property file="nbproject/suite.properties"/>
184.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
184.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
184.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
184.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
184.23 + <attribute name="name"/>
184.24 + <attribute name="value"/>
184.25 + <sequential>
184.26 + <property name="@{name}" value="${@{value}}"/>
184.27 + </sequential>
184.28 + </macrodef>
184.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
184.30 + <attribute name="property"/>
184.31 + <attribute name="value"/>
184.32 + <sequential>
184.33 + <property name="@{property}" value="@{value}"/>
184.34 + </sequential>
184.35 + </macrodef>
184.36 + <property file="${user.properties.file}"/>
184.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
184.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
184.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
184.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
184.41 + <condition>
184.42 + <not>
184.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
184.44 + </not>
184.45 + </condition>
184.46 + </fail>
184.47 + <import file="${harness.dir}/build.xml"/>
184.48 +</project>
185.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
185.2 +++ b/sandbox/old-modules/api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
185.3 @@ -0,0 +1,8 @@
185.4 +build.xml.data.CRC32=f9c1509c
185.5 +build.xml.script.CRC32=0abcaef9
185.6 +build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
185.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
185.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
185.9 +nbproject/build-impl.xml.data.CRC32=6500fcd0
185.10 +nbproject/build-impl.xml.script.CRC32=c4574e66
185.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
186.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
186.2 +++ b/sandbox/old-modules/api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
186.3 @@ -0,0 +1,3 @@
186.4 +javac.source=1.5
186.5 +javac.compilerargs=-Xlint -Xlint:-serial
186.6 +spec.version.base=1.16.0
187.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
187.2 +++ b/sandbox/old-modules/api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
187.3 @@ -0,0 +1,437 @@
187.4 +<?xml version="1.0" encoding="UTF-8"?>
187.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
187.6 + <type>org.netbeans.modules.apisupport.project</type>
187.7 + <configuration>
187.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
187.9 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
187.10 + <suite-component/>
187.11 + <module-dependencies>
187.12 + <dependency>
187.13 + <code-name-base>org.jdesktop.layout</code-name-base>
187.14 + <build-prerequisite/>
187.15 + <compile-dependency/>
187.16 + <run-dependency>
187.17 + <release-version>1</release-version>
187.18 + <specification-version>1.7.0.103</specification-version>
187.19 + </run-dependency>
187.20 + </dependency>
187.21 + <dependency>
187.22 + <code-name-base>org.netbeans.api.annotations.common</code-name-base>
187.23 + <build-prerequisite/>
187.24 + <compile-dependency/>
187.25 + <run-dependency>
187.26 + <release-version>1</release-version>
187.27 + <specification-version>1.0</specification-version>
187.28 + </run-dependency>
187.29 + </dependency>
187.30 + <dependency>
187.31 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
187.32 + <build-prerequisite/>
187.33 + <compile-dependency/>
187.34 + <run-dependency>
187.35 + <release-version>1</release-version>
187.36 + <specification-version>1.19</specification-version>
187.37 + </run-dependency>
187.38 + </dependency>
187.39 + <dependency>
187.40 + <code-name-base>org.netbeans.api.progress</code-name-base>
187.41 + <build-prerequisite/>
187.42 + <compile-dependency/>
187.43 + <run-dependency>
187.44 + <release-version>1</release-version>
187.45 + <specification-version>1.13.0.1</specification-version>
187.46 + </run-dependency>
187.47 + </dependency>
187.48 + <dependency>
187.49 + <code-name-base>org.netbeans.libs.javacapi</code-name-base>
187.50 + <build-prerequisite/>
187.51 + <compile-dependency/>
187.52 + <run-dependency>
187.53 + <specification-version>7.5.0.3</specification-version>
187.54 + </run-dependency>
187.55 + </dependency>
187.56 + <dependency>
187.57 + <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
187.58 + <build-prerequisite/>
187.59 + <compile-dependency/>
187.60 + <run-dependency>
187.61 + <release-version>1</release-version>
187.62 + <implementation-version/>
187.63 + </run-dependency>
187.64 + </dependency>
187.65 + <dependency>
187.66 + <code-name-base>org.netbeans.libs.lucene</code-name-base>
187.67 + <build-prerequisite/>
187.68 + <compile-dependency/>
187.69 + <run-dependency>
187.70 + <release-version>1-3</release-version>
187.71 + <specification-version>2.13</specification-version>
187.72 + </run-dependency>
187.73 + </dependency>
187.74 + <dependency>
187.75 + <code-name-base>org.netbeans.modules.diff</code-name-base>
187.76 + <build-prerequisite/>
187.77 + <compile-dependency/>
187.78 + <run-dependency>
187.79 + <release-version>1</release-version>
187.80 + <implementation-version/>
187.81 + </run-dependency>
187.82 + </dependency>
187.83 + <dependency>
187.84 + <code-name-base>org.netbeans.modules.editor</code-name-base>
187.85 + <build-prerequisite/>
187.86 + <compile-dependency/>
187.87 + <run-dependency>
187.88 + <release-version>3</release-version>
187.89 + <specification-version>1.56.0.5.13.6</specification-version>
187.90 + </run-dependency>
187.91 + </dependency>
187.92 + <dependency>
187.93 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
187.94 + <build-prerequisite/>
187.95 + <compile-dependency/>
187.96 + <run-dependency>
187.97 + <release-version>1-3</release-version>
187.98 + <specification-version>1.38.0.9.2</specification-version>
187.99 + </run-dependency>
187.100 + </dependency>
187.101 + <dependency>
187.102 + <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
187.103 + <build-prerequisite/>
187.104 + <compile-dependency/>
187.105 + <run-dependency>
187.106 + <release-version>1</release-version>
187.107 + <specification-version>1.13.0.2</specification-version>
187.108 + </run-dependency>
187.109 + </dependency>
187.110 + <dependency>
187.111 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
187.112 + <build-prerequisite/>
187.113 + <compile-dependency/>
187.114 + <run-dependency>
187.115 + <release-version>1</release-version>
187.116 + <specification-version>1.12</specification-version>
187.117 + </run-dependency>
187.118 + </dependency>
187.119 + <dependency>
187.120 + <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
187.121 + <build-prerequisite/>
187.122 + <compile-dependency/>
187.123 + <run-dependency>
187.124 + <release-version>1</release-version>
187.125 + <specification-version>1.25</specification-version>
187.126 + </run-dependency>
187.127 + </dependency>
187.128 + <dependency>
187.129 + <code-name-base>org.netbeans.modules.jackpot30.remoting.api</code-name-base>
187.130 + <build-prerequisite/>
187.131 + <compile-dependency/>
187.132 + <run-dependency>
187.133 + <specification-version>1.0</specification-version>
187.134 + </run-dependency>
187.135 + </dependency>
187.136 + <dependency>
187.137 + <code-name-base>org.netbeans.modules.java.editor</code-name-base>
187.138 + <build-prerequisite/>
187.139 + <compile-dependency/>
187.140 + <run-dependency>
187.141 + <release-version>1</release-version>
187.142 + <implementation-version/>
187.143 + </run-dependency>
187.144 + </dependency>
187.145 + <dependency>
187.146 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
187.147 + <build-prerequisite/>
187.148 + <compile-dependency/>
187.149 + <run-dependency>
187.150 + <release-version>1</release-version>
187.151 + <implementation-version/>
187.152 + </run-dependency>
187.153 + </dependency>
187.154 + <dependency>
187.155 + <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
187.156 + <build-prerequisite/>
187.157 + <compile-dependency/>
187.158 + <run-dependency>
187.159 + <release-version>1</release-version>
187.160 + <specification-version>1.9</specification-version>
187.161 + </run-dependency>
187.162 + </dependency>
187.163 + <dependency>
187.164 + <code-name-base>org.netbeans.modules.java.platform</code-name-base>
187.165 + <build-prerequisite/>
187.166 + <compile-dependency/>
187.167 + <run-dependency>
187.168 + <release-version>1</release-version>
187.169 + <specification-version>1.12</specification-version>
187.170 + </run-dependency>
187.171 + </dependency>
187.172 + <dependency>
187.173 + <code-name-base>org.netbeans.modules.java.preprocessorbridge</code-name-base>
187.174 + <build-prerequisite/>
187.175 + <compile-dependency/>
187.176 + <run-dependency>
187.177 + <implementation-version/>
187.178 + </run-dependency>
187.179 + </dependency>
187.180 + <dependency>
187.181 + <code-name-base>org.netbeans.modules.java.source</code-name-base>
187.182 + <build-prerequisite/>
187.183 + <compile-dependency/>
187.184 + <run-dependency>
187.185 + <implementation-version/>
187.186 + </run-dependency>
187.187 + </dependency>
187.188 + <dependency>
187.189 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
187.190 + <build-prerequisite/>
187.191 + <compile-dependency/>
187.192 + <run-dependency>
187.193 + <release-version>2</release-version>
187.194 + <specification-version>1.34</specification-version>
187.195 + </run-dependency>
187.196 + </dependency>
187.197 + <dependency>
187.198 + <code-name-base>org.netbeans.modules.options.api</code-name-base>
187.199 + <build-prerequisite/>
187.200 + <compile-dependency/>
187.201 + <run-dependency>
187.202 + <release-version>1</release-version>
187.203 + <specification-version>1.20</specification-version>
187.204 + </run-dependency>
187.205 + </dependency>
187.206 + <dependency>
187.207 + <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
187.208 + <build-prerequisite/>
187.209 + <compile-dependency/>
187.210 + <run-dependency>
187.211 + <release-version>1</release-version>
187.212 + <implementation-version/>
187.213 + </run-dependency>
187.214 + </dependency>
187.215 + <dependency>
187.216 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
187.217 + <build-prerequisite/>
187.218 + <compile-dependency/>
187.219 + <run-dependency>
187.220 + <release-version>1</release-version>
187.221 + <specification-version>1.24</specification-version>
187.222 + </run-dependency>
187.223 + </dependency>
187.224 + <dependency>
187.225 + <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
187.226 + <build-prerequisite/>
187.227 + <compile-dependency/>
187.228 + <run-dependency>
187.229 + <release-version>1</release-version>
187.230 + <specification-version>1.35.0.6</specification-version>
187.231 + </run-dependency>
187.232 + </dependency>
187.233 + <dependency>
187.234 + <code-name-base>org.netbeans.modules.queries</code-name-base>
187.235 + <build-prerequisite/>
187.236 + <compile-dependency/>
187.237 + <run-dependency>
187.238 + <release-version>1</release-version>
187.239 + <specification-version>1.15</specification-version>
187.240 + </run-dependency>
187.241 + </dependency>
187.242 + <dependency>
187.243 + <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
187.244 + <build-prerequisite/>
187.245 + <compile-dependency/>
187.246 + <run-dependency>
187.247 + <specification-version>1.6</specification-version>
187.248 + </run-dependency>
187.249 + </dependency>
187.250 + <dependency>
187.251 + <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
187.252 + <build-prerequisite/>
187.253 + <compile-dependency/>
187.254 + <run-dependency>
187.255 + <release-version>1</release-version>
187.256 + <specification-version>1.6</specification-version>
187.257 + </run-dependency>
187.258 + </dependency>
187.259 + <dependency>
187.260 + <code-name-base>org.netbeans.modules.sendopts</code-name-base>
187.261 + <build-prerequisite/>
187.262 + <compile-dependency/>
187.263 + <run-dependency>
187.264 + <release-version>2</release-version>
187.265 + <specification-version>2.4</specification-version>
187.266 + </run-dependency>
187.267 + </dependency>
187.268 + <dependency>
187.269 + <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
187.270 + <build-prerequisite/>
187.271 + <compile-dependency/>
187.272 + <run-dependency>
187.273 + <release-version>0-1</release-version>
187.274 + <specification-version>1.7.0.7.2</specification-version>
187.275 + </run-dependency>
187.276 + </dependency>
187.277 + <dependency>
187.278 + <code-name-base>org.openide.awt</code-name-base>
187.279 + <build-prerequisite/>
187.280 + <compile-dependency/>
187.281 + <run-dependency>
187.282 + <specification-version>7.7.0.1</specification-version>
187.283 + </run-dependency>
187.284 + </dependency>
187.285 + <dependency>
187.286 + <code-name-base>org.openide.dialogs</code-name-base>
187.287 + <build-prerequisite/>
187.288 + <compile-dependency/>
187.289 + <run-dependency>
187.290 + <specification-version>7.10</specification-version>
187.291 + </run-dependency>
187.292 + </dependency>
187.293 + <dependency>
187.294 + <code-name-base>org.openide.filesystems</code-name-base>
187.295 + <build-prerequisite/>
187.296 + <compile-dependency/>
187.297 + <run-dependency>
187.298 + <specification-version>7.21.0.1.1</specification-version>
187.299 + </run-dependency>
187.300 + </dependency>
187.301 + <dependency>
187.302 + <code-name-base>org.openide.loaders</code-name-base>
187.303 + <build-prerequisite/>
187.304 + <compile-dependency/>
187.305 + <run-dependency>
187.306 + <specification-version>7.5</specification-version>
187.307 + </run-dependency>
187.308 + </dependency>
187.309 + <dependency>
187.310 + <code-name-base>org.openide.modules</code-name-base>
187.311 + <build-prerequisite/>
187.312 + <compile-dependency/>
187.313 + <run-dependency>
187.314 + <specification-version>7.10</specification-version>
187.315 + </run-dependency>
187.316 + </dependency>
187.317 + <dependency>
187.318 + <code-name-base>org.openide.nodes</code-name-base>
187.319 + <build-prerequisite/>
187.320 + <compile-dependency/>
187.321 + <run-dependency>
187.322 + <specification-version>7.9.0.1</specification-version>
187.323 + </run-dependency>
187.324 + </dependency>
187.325 + <dependency>
187.326 + <code-name-base>org.openide.text</code-name-base>
187.327 + <build-prerequisite/>
187.328 + <compile-dependency/>
187.329 + <run-dependency>
187.330 + <specification-version>6.22</specification-version>
187.331 + </run-dependency>
187.332 + </dependency>
187.333 + <dependency>
187.334 + <code-name-base>org.openide.util</code-name-base>
187.335 + <build-prerequisite/>
187.336 + <compile-dependency/>
187.337 + <run-dependency>
187.338 + <specification-version>8.0</specification-version>
187.339 + </run-dependency>
187.340 + </dependency>
187.341 + <dependency>
187.342 + <code-name-base>org.openide.util.lookup</code-name-base>
187.343 + <build-prerequisite/>
187.344 + <compile-dependency/>
187.345 + <run-dependency>
187.346 + <specification-version>8.0.0.1</specification-version>
187.347 + </run-dependency>
187.348 + </dependency>
187.349 + <dependency>
187.350 + <code-name-base>org.openide.windows</code-name-base>
187.351 + <build-prerequisite/>
187.352 + <compile-dependency/>
187.353 + <run-dependency>
187.354 + <specification-version>6.27</specification-version>
187.355 + </run-dependency>
187.356 + </dependency>
187.357 + </module-dependencies>
187.358 + <test-dependencies>
187.359 + <test-type>
187.360 + <name>unit</name>
187.361 + <test-dependency>
187.362 + <code-name-base>org.netbeans.bootstrap</code-name-base>
187.363 + </test-dependency>
187.364 + <test-dependency>
187.365 + <code-name-base>org.netbeans.core.startup</code-name-base>
187.366 + </test-dependency>
187.367 + <test-dependency>
187.368 + <code-name-base>org.netbeans.insane</code-name-base>
187.369 + <compile-dependency/>
187.370 + </test-dependency>
187.371 + <test-dependency>
187.372 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
187.373 + <compile-dependency/>
187.374 + </test-dependency>
187.375 + <test-dependency>
187.376 + <code-name-base>org.netbeans.modules.classfile</code-name-base>
187.377 + </test-dependency>
187.378 + <test-dependency>
187.379 + <code-name-base>org.netbeans.modules.defaults</code-name-base>
187.380 + </test-dependency>
187.381 + <test-dependency>
187.382 + <code-name-base>org.netbeans.modules.editor</code-name-base>
187.383 + </test-dependency>
187.384 + <test-dependency>
187.385 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
187.386 + </test-dependency>
187.387 + <test-dependency>
187.388 + <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
187.389 + </test-dependency>
187.390 + <test-dependency>
187.391 + <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
187.392 + </test-dependency>
187.393 + <test-dependency>
187.394 + <code-name-base>org.netbeans.modules.editor.util</code-name-base>
187.395 + </test-dependency>
187.396 + <test-dependency>
187.397 + <code-name-base>org.netbeans.modules.jackpot30.common.test</code-name-base>
187.398 + <compile-dependency/>
187.399 + </test-dependency>
187.400 + <test-dependency>
187.401 + <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
187.402 + <recursive/>
187.403 + <compile-dependency/>
187.404 + </test-dependency>
187.405 + <test-dependency>
187.406 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
187.407 + <compile-dependency/>
187.408 + </test-dependency>
187.409 + <test-dependency>
187.410 + <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
187.411 + </test-dependency>
187.412 + <test-dependency>
187.413 + <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
187.414 + </test-dependency>
187.415 + <test-dependency>
187.416 + <code-name-base>org.netbeans.modules.masterfs</code-name-base>
187.417 + </test-dependency>
187.418 + <test-dependency>
187.419 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
187.420 + <compile-dependency/>
187.421 + </test-dependency>
187.422 + <test-dependency>
187.423 + <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
187.424 + </test-dependency>
187.425 + <test-dependency>
187.426 + <code-name-base>org.netbeans.modules.projectui</code-name-base>
187.427 + </test-dependency>
187.428 + <test-dependency>
187.429 + <code-name-base>org.openidex.util</code-name-base>
187.430 + </test-dependency>
187.431 + </test-type>
187.432 + </test-dependencies>
187.433 + <public-packages>
187.434 + <package>org.netbeans.modules.jackpot30.spi</package>
187.435 + <package>org.netbeans.modules.jackpot30.spi.refactoring</package>
187.436 + <package>org.netbeans.modules.jackpot30.spi.support</package>
187.437 + </public-packages>
187.438 + </data>
187.439 + </configuration>
187.440 +</project>
188.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
188.2 +++ b/sandbox/old-modules/api/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
188.3 @@ -0,0 +1,1 @@
188.4 +suite.dir=${basedir}/..
189.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
189.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
189.3 @@ -0,0 +1,46 @@
189.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
189.5 +#
189.6 +# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
189.7 +#
189.8 +# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
189.9 +# Other names may be trademarks of their respective owners.
189.10 +#
189.11 +# The contents of this file are subject to the terms of either the GNU
189.12 +# General Public License Version 2 only ("GPL") or the Common
189.13 +# Development and Distribution License("CDDL") (collectively, the
189.14 +# "License"). You may not use this file except in compliance with the
189.15 +# License. You can obtain a copy of the License at
189.16 +# http://www.netbeans.org/cddl-gplv2.html
189.17 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
189.18 +# specific language governing permissions and limitations under the
189.19 +# License. When distributing the software, include this License Header
189.20 +# Notice in each file and include the License file at
189.21 +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
189.22 +# particular file as subject to the "Classpath" exception as provided
189.23 +# by Oracle in the GPL Version 2 section of the License file that
189.24 +# accompanied this code. If applicable, add the following below the
189.25 +# License Header, with the fields enclosed by brackets [] replaced by
189.26 +# your own identifying information:
189.27 +# "Portions Copyrighted [year] [name of copyright owner]"
189.28 +#
189.29 +# If you wish your version of this file to be governed by only the CDDL
189.30 +# or only the GPL Version 2, indicate your decision by adding
189.31 +# "[Contributor] elects to include this software in this distribution
189.32 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
189.33 +# single choice of license, a recipient has the option to distribute
189.34 +# your version of this file under either the CDDL, the GPL Version 2 or
189.35 +# to extend the choice of license to its licensees as provided above.
189.36 +# However, if you add GPL Version 2 code and therefore, elected the GPL
189.37 +# Version 2 license, then the option applies only if the new code is
189.38 +# made subject to such option by the copyright holder.
189.39 +#
189.40 +# Contributor(s):
189.41 +#
189.42 +# Portions Copyrighted 2010 Sun Microsystems, Inc.
189.43 +
189.44 +double-checked-locking=Double Checked Locking
189.45 +double-checked-locking-verify=Double Checked Locking Strict
189.46 +double-checked-locking-fix=Double Checked Locking
189.47 +new-string=New String Creation
189.48 +lambda-candidate=Find candidates for Lambda expression
189.49 +ExamplesList.pattern.contentType=text/x-javahints
190.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
190.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/Example.java Tue Feb 21 22:37:57 2012 +0100
190.3 @@ -0,0 +1,83 @@
190.4 +/*
190.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
190.6 + *
190.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
190.8 + *
190.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
190.10 + * Other names may be trademarks of their respective owners.
190.11 + *
190.12 + * The contents of this file are subject to the terms of either the GNU
190.13 + * General Public License Version 2 only ("GPL") or the Common
190.14 + * Development and Distribution License("CDDL") (collectively, the
190.15 + * "License"). You may not use this file except in compliance with the
190.16 + * License. You can obtain a copy of the License at
190.17 + * http://www.netbeans.org/cddl-gplv2.html
190.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
190.19 + * specific language governing permissions and limitations under the
190.20 + * License. When distributing the software, include this License Header
190.21 + * Notice in each file and include the License file at
190.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
190.23 + * particular file as subject to the "Classpath" exception as provided
190.24 + * by Oracle in the GPL Version 2 section of the License file that
190.25 + * accompanied this code. If applicable, add the following below the
190.26 + * License Header, with the fields enclosed by brackets [] replaced by
190.27 + * your own identifying information:
190.28 + * "Portions Copyrighted [year] [name of copyright owner]"
190.29 + *
190.30 + * If you wish your version of this file to be governed by only the CDDL
190.31 + * or only the GPL Version 2, indicate your decision by adding
190.32 + * "[Contributor] elects to include this software in this distribution
190.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
190.34 + * single choice of license, a recipient has the option to distribute
190.35 + * your version of this file under either the CDDL, the GPL Version 2 or
190.36 + * to extend the choice of license to its licensees as provided above.
190.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
190.38 + * Version 2 license, then the option applies only if the new code is
190.39 + * made subject to such option by the copyright holder.
190.40 + *
190.41 + * Contributor(s):
190.42 + *
190.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
190.44 + */
190.45 +
190.46 +package org.netbeans.modules.jackpot30.impl.examples;
190.47 +
190.48 +import java.util.Set;
190.49 +import org.openide.util.NbBundle;
190.50 +
190.51 +/**
190.52 + *
190.53 + * @author lahvac
190.54 + */
190.55 +public class Example {
190.56 +
190.57 + private final String key;
190.58 + private final String code;
190.59 + private final Set<Option> options;
190.60 +
190.61 + Example(String key, String code, Set<Option> options) {
190.62 + this.key = key;
190.63 + this.code = code;
190.64 + this.options = options;
190.65 + }
190.66 +
190.67 + String getKey() {
190.68 + return key;
190.69 + }
190.70 +
190.71 + public String getDisplayName() {
190.72 + return NbBundle.getMessage(LoadExamples.class, key);
190.73 + }
190.74 +
190.75 + public String getCode() {
190.76 + return code;
190.77 + }
190.78 +
190.79 + public Set<Option> getOptions() {
190.80 + return options;
190.81 + }
190.82 +
190.83 + public enum Option {
190.84 + VERIFY, FIX;
190.85 + }
190.86 +}
191.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
191.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.form Tue Feb 21 22:37:57 2012 +0100
191.3 @@ -0,0 +1,95 @@
191.4 +<?xml version="1.0" encoding="UTF-8" ?>
191.5 +
191.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
191.7 + <AuxValues>
191.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
191.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
191.10 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
191.11 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
191.12 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
191.13 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
191.14 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
191.15 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
191.16 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
191.17 + </AuxValues>
191.18 +
191.19 + <Layout>
191.20 + <DimensionLayout dim="0">
191.21 + <Group type="103" groupAlignment="0" attributes="0">
191.22 + <Group type="102" alignment="1" attributes="0">
191.23 + <EmptySpace max="-2" attributes="0"/>
191.24 + <Group type="103" groupAlignment="1" attributes="0">
191.25 + <Component id="jScrollPane2" alignment="0" pref="376" max="32767" attributes="0"/>
191.26 + <Component id="jScrollPane1" alignment="0" pref="376" max="32767" attributes="0"/>
191.27 + <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
191.28 + </Group>
191.29 + <EmptySpace max="-2" attributes="0"/>
191.30 + </Group>
191.31 + </Group>
191.32 + </DimensionLayout>
191.33 + <DimensionLayout dim="1">
191.34 + <Group type="103" groupAlignment="0" attributes="0">
191.35 + <Group type="102" alignment="0" attributes="0">
191.36 + <EmptySpace max="-2" attributes="0"/>
191.37 + <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
191.38 + <EmptySpace max="-2" attributes="0"/>
191.39 + <Component id="jScrollPane1" pref="130" max="32767" attributes="0"/>
191.40 + <EmptySpace max="-2" attributes="0"/>
191.41 + <Component id="jScrollPane2" min="-2" pref="119" max="-2" attributes="0"/>
191.42 + <EmptySpace max="-2" attributes="0"/>
191.43 + </Group>
191.44 + </Group>
191.45 + </DimensionLayout>
191.46 + </Layout>
191.47 + <SubComponents>
191.48 + <Component class="javax.swing.JLabel" name="jLabel1">
191.49 + <Properties>
191.50 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
191.51 + <Connection code="convertor.getHeader()" type="code"/>
191.52 + </Property>
191.53 + </Properties>
191.54 + </Component>
191.55 + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
191.56 + <AuxValues>
191.57 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
191.58 + </AuxValues>
191.59 +
191.60 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
191.61 + <SubComponents>
191.62 + <Component class="javax.swing.JList" name="list">
191.63 + <Properties>
191.64 + <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
191.65 + <StringArray count="5">
191.66 + <StringItem index="0" value="Item 1"/>
191.67 + <StringItem index="1" value="Item 2"/>
191.68 + <StringItem index="2" value="Item 3"/>
191.69 + <StringItem index="3" value="Item 4"/>
191.70 + <StringItem index="4" value="Item 5"/>
191.71 + </StringArray>
191.72 + </Property>
191.73 + </Properties>
191.74 + <Events>
191.75 + <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="listMouseClicked"/>
191.76 + <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="listValueChanged"/>
191.77 + </Events>
191.78 + </Component>
191.79 + </SubComponents>
191.80 + </Container>
191.81 + <Container class="javax.swing.JScrollPane" name="jScrollPane2">
191.82 + <AuxValues>
191.83 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
191.84 + </AuxValues>
191.85 +
191.86 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
191.87 + <SubComponents>
191.88 + <Component class="javax.swing.JEditorPane" name="pattern">
191.89 + <Properties>
191.90 + <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
191.91 + <ResourceString bundle="org/netbeans/modules/jackpot30/impl/examples/Bundle.properties" key="ExamplesList.pattern.contentType" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
191.92 + </Property>
191.93 + </Properties>
191.94 + </Component>
191.95 + </SubComponents>
191.96 + </Container>
191.97 + </SubComponents>
191.98 +</Form>
192.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
192.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/ExamplesList.java Tue Feb 21 22:37:57 2012 +0100
192.3 @@ -0,0 +1,223 @@
192.4 +/*
192.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
192.6 + *
192.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
192.8 + *
192.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
192.10 + * Other names may be trademarks of their respective owners.
192.11 + *
192.12 + * The contents of this file are subject to the terms of either the GNU
192.13 + * General Public License Version 2 only ("GPL") or the Common
192.14 + * Development and Distribution License("CDDL") (collectively, the
192.15 + * "License"). You may not use this file except in compliance with the
192.16 + * License. You can obtain a copy of the License at
192.17 + * http://www.netbeans.org/cddl-gplv2.html
192.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
192.19 + * specific language governing permissions and limitations under the
192.20 + * License. When distributing the software, include this License Header
192.21 + * Notice in each file and include the License file at
192.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
192.23 + * particular file as subject to the "Classpath" exception as provided
192.24 + * by Oracle in the GPL Version 2 section of the License file that
192.25 + * accompanied this code. If applicable, add the following below the
192.26 + * License Header, with the fields enclosed by brackets [] replaced by
192.27 + * your own identifying information:
192.28 + * "Portions Copyrighted [year] [name of copyright owner]"
192.29 + *
192.30 + * If you wish your version of this file to be governed by only the CDDL
192.31 + * or only the GPL Version 2, indicate your decision by adding
192.32 + * "[Contributor] elects to include this software in this distribution
192.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
192.34 + * single choice of license, a recipient has the option to distribute
192.35 + * your version of this file under either the CDDL, the GPL Version 2 or
192.36 + * to extend the choice of license to its licensees as provided above.
192.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
192.38 + * Version 2 license, then the option applies only if the new code is
192.39 + * made subject to such option by the copyright holder.
192.40 + *
192.41 + * Contributor(s):
192.42 + *
192.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
192.44 + */
192.45 +package org.netbeans.modules.jackpot30.impl.examples;
192.46 +
192.47 +import java.awt.Component;
192.48 +import java.awt.Dialog;
192.49 +import java.awt.Rectangle;
192.50 +import java.util.Collections;
192.51 +import java.util.Set;
192.52 +import javax.swing.DefaultListCellRenderer;
192.53 +import javax.swing.DefaultListModel;
192.54 +import javax.swing.JList;
192.55 +import javax.swing.text.BadLocationException;
192.56 +import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
192.57 +import org.openide.DialogDescriptor;
192.58 +import org.openide.DialogDisplayer;
192.59 +import org.openide.util.Exceptions;
192.60 +
192.61 +/**
192.62 + *
192.63 + * @author lahvac
192.64 + */
192.65 +public class ExamplesList<T> extends javax.swing.JPanel {
192.66 +
192.67 + private final DialogDescription<T> convertor;
192.68 + private final Class<T> dataClass;
192.69 +
192.70 + public ExamplesList(Iterable<? extends T> data, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
192.71 + this.convertor = convertor;
192.72 + this.dataClass = dataClass;
192.73 +
192.74 + initComponents();
192.75 +
192.76 + DefaultListModel listModel = new DefaultListModel();
192.77 +
192.78 + for (T t : data) {
192.79 + Set<Option> options = convertor.getOptions(t);
192.80 + if (!options.containsAll(require)) continue;
192.81 + if (!Collections.disjoint(options, forbidden)) continue;
192.82 +
192.83 + listModel.addElement(t);
192.84 + }
192.85 +
192.86 + list.setModel(listModel);
192.87 + list.setCellRenderer(new ExamplesRenderer());
192.88 + list.setSelectedIndex(0);
192.89 + }
192.90 +
192.91 + /** This method is called from within the constructor to
192.92 + * initialize the form.
192.93 + * WARNING: Do NOT modify this code. The content of this method is
192.94 + * always regenerated by the Form Editor.
192.95 + */
192.96 + @SuppressWarnings("unchecked")
192.97 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
192.98 + private void initComponents() {
192.99 +
192.100 + jLabel1 = new javax.swing.JLabel();
192.101 + jScrollPane1 = new javax.swing.JScrollPane();
192.102 + list = new javax.swing.JList();
192.103 + jScrollPane2 = new javax.swing.JScrollPane();
192.104 + pattern = new javax.swing.JEditorPane();
192.105 +
192.106 + jLabel1.setText(convertor.getHeader());
192.107 +
192.108 + list.setModel(new javax.swing.AbstractListModel() {
192.109 + String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
192.110 + public int getSize() { return strings.length; }
192.111 + public Object getElementAt(int i) { return strings[i]; }
192.112 + });
192.113 + list.addMouseListener(new java.awt.event.MouseAdapter() {
192.114 + public void mouseClicked(java.awt.event.MouseEvent evt) {
192.115 + listMouseClicked(evt);
192.116 + }
192.117 + });
192.118 + list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
192.119 + public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
192.120 + listValueChanged(evt);
192.121 + }
192.122 + });
192.123 + jScrollPane1.setViewportView(list);
192.124 +
192.125 + pattern.setContentType(org.openide.util.NbBundle.getMessage(ExamplesList.class, "ExamplesList.pattern.contentType")); // NOI18N
192.126 + jScrollPane2.setViewportView(pattern);
192.127 +
192.128 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
192.129 + this.setLayout(layout);
192.130 + layout.setHorizontalGroup(
192.131 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
192.132 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
192.133 + .addContainerGap()
192.134 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
192.135 + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
192.136 + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
192.137 + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
192.138 + .addContainerGap())
192.139 + );
192.140 + layout.setVerticalGroup(
192.141 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
192.142 + .addGroup(layout.createSequentialGroup()
192.143 + .addContainerGap()
192.144 + .addComponent(jLabel1)
192.145 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
192.146 + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
192.147 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
192.148 + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
192.149 + .addContainerGap())
192.150 + );
192.151 + }// </editor-fold>//GEN-END:initComponents
192.152 +
192.153 + private void listMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMouseClicked
192.154 + if (evt.getClickCount() > 1) {
192.155 + desc.setValue(DialogDescriptor.OK_OPTION);
192.156 + dialog.setVisible(false);
192.157 + }
192.158 + }//GEN-LAST:event_listMouseClicked
192.159 +
192.160 + private void listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listValueChanged
192.161 + T ex = dataClass.cast(list.getSelectedValue());
192.162 +
192.163 + pattern.setText(convertor.getCode(ex));
192.164 +
192.165 + try {
192.166 + Rectangle rect = pattern.modelToView(0);
192.167 +
192.168 + if (rect != null) {
192.169 + pattern.scrollRectToVisible(rect);
192.170 + }
192.171 + } catch (BadLocationException ex1) {
192.172 + Exceptions.printStackTrace(ex1);
192.173 + }
192.174 + }//GEN-LAST:event_listValueChanged
192.175 +
192.176 + // Variables declaration - do not modify//GEN-BEGIN:variables
192.177 + private javax.swing.JLabel jLabel1;
192.178 + private javax.swing.JScrollPane jScrollPane1;
192.179 + private javax.swing.JScrollPane jScrollPane2;
192.180 + private javax.swing.JList list;
192.181 + private javax.swing.JEditorPane pattern;
192.182 + // End of variables declaration//GEN-END:variables
192.183 +
192.184 + private DialogDescriptor desc;
192.185 + private Dialog dialog;
192.186 +
192.187 + public void setDialog(DialogDescriptor desc, Dialog dialog) {
192.188 + this.desc = desc;
192.189 + this.dialog = dialog;
192.190 + }
192.191 +
192.192 + public T getSelectedExample() {
192.193 + return dataClass.cast(list.getSelectedValue());
192.194 + }
192.195 +
192.196 + private class ExamplesRenderer extends DefaultListCellRenderer {
192.197 + @Override
192.198 + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
192.199 + value = convertor.getDisplayName(dataClass.cast(value));
192.200 + return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
192.201 + }
192.202 + }
192.203 +
192.204 + public static <T> T chooseExample(Iterable<? extends T> examplesList, DialogDescription<T> convertor, Class<T> dataClass, Set<Option> require, Set<Option> forbidden) {
192.205 + ExamplesList<T> examples = new ExamplesList<T>(examplesList, convertor, dataClass, require, forbidden);
192.206 + DialogDescriptor dd = new DialogDescriptor(examples, convertor.getCaption(), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);
192.207 + Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
192.208 +
192.209 + examples.setDialog(dd, dialog);
192.210 + dialog.setVisible(true);
192.211 +
192.212 + if (dd.getValue() == DialogDescriptor.OK_OPTION) {
192.213 + return examples.getSelectedExample();
192.214 + }
192.215 +
192.216 + return null;
192.217 + }
192.218 +
192.219 + public interface DialogDescription<T> {
192.220 + public String getCaption();
192.221 + public String getHeader();
192.222 + public String getDisplayName(T t);
192.223 + public String getCode(T t);
192.224 + public Set<Option> getOptions(T t);
192.225 + }
192.226 +}
193.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
193.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamples.java Tue Feb 21 22:37:57 2012 +0100
193.3 @@ -0,0 +1,135 @@
193.4 +/*
193.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
193.6 + *
193.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
193.8 + *
193.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
193.10 + * Other names may be trademarks of their respective owners.
193.11 + *
193.12 + * The contents of this file are subject to the terms of either the GNU
193.13 + * General Public License Version 2 only ("GPL") or the Common
193.14 + * Development and Distribution License("CDDL") (collectively, the
193.15 + * "License"). You may not use this file except in compliance with the
193.16 + * License. You can obtain a copy of the License at
193.17 + * http://www.netbeans.org/cddl-gplv2.html
193.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
193.19 + * specific language governing permissions and limitations under the
193.20 + * License. When distributing the software, include this License Header
193.21 + * Notice in each file and include the License file at
193.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
193.23 + * particular file as subject to the "Classpath" exception as provided
193.24 + * by Oracle in the GPL Version 2 section of the License file that
193.25 + * accompanied this code. If applicable, add the following below the
193.26 + * License Header, with the fields enclosed by brackets [] replaced by
193.27 + * your own identifying information:
193.28 + * "Portions Copyrighted [year] [name of copyright owner]"
193.29 + *
193.30 + * If you wish your version of this file to be governed by only the CDDL
193.31 + * or only the GPL Version 2, indicate your decision by adding
193.32 + * "[Contributor] elects to include this software in this distribution
193.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
193.34 + * single choice of license, a recipient has the option to distribute
193.35 + * your version of this file under either the CDDL, the GPL Version 2 or
193.36 + * to extend the choice of license to its licensees as provided above.
193.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
193.38 + * Version 2 license, then the option applies only if the new code is
193.39 + * made subject to such option by the copyright holder.
193.40 + *
193.41 + * Contributor(s):
193.42 + *
193.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
193.44 + */
193.45 +
193.46 +package org.netbeans.modules.jackpot30.impl.examples;
193.47 +
193.48 +import java.io.File;
193.49 +import java.io.IOException;
193.50 +import java.io.InputStream;
193.51 +import java.util.Collections;
193.52 +import java.util.EnumSet;
193.53 +import java.util.LinkedList;
193.54 +import java.util.List;
193.55 +import java.util.Set;
193.56 +import java.util.regex.Pattern;
193.57 +import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
193.58 +import org.openide.filesystems.FileUtil;
193.59 +import org.openide.modules.InstalledFileLocator;
193.60 +import org.openide.util.Exceptions;
193.61 +
193.62 +/**
193.63 + *
193.64 + * @author lahvac
193.65 + */
193.66 +public class LoadExamples {
193.67 +
193.68 + public static Iterable<? extends Example> loadExamples() {
193.69 + return loadExamples("examples.list");
193.70 + }
193.71 +
193.72 + private static final Pattern EXAMPLE_SPLIT = Pattern.compile("^%%", Pattern.MULTILINE);
193.73 +
193.74 + static Iterable<? extends Example> loadExamples(String examplesListName) {
193.75 + String examplesList = loadToString(examplesListName);
193.76 +
193.77 + if (examplesList == null) return Collections.emptyList();
193.78 +
193.79 + List<Example> examples = new LinkedList<Example>();
193.80 +
193.81 + for (String exampleName : examplesList.split("\n")) {
193.82 + if (exampleName.isEmpty()) continue;
193.83 +
193.84 + String exampleCode = loadToString(exampleName);
193.85 +
193.86 + for (String oneExample : EXAMPLE_SPLIT.split(exampleCode)) {
193.87 + if (oneExample.isEmpty()) continue;
193.88 +
193.89 + String[] parts = oneExample.split("\n", 2);
193.90 + String key = null;
193.91 + Set<Option> options = EnumSet.noneOf(Option.class);
193.92 +
193.93 + for (String option : parts[0].split(",")) {
193.94 + if (option.startsWith("example=")) {
193.95 + key = option.substring("example=".length());
193.96 + continue;
193.97 + }
193.98 +
193.99 + options.add(Option.valueOf(option.toUpperCase()));
193.100 + }
193.101 +
193.102 + examples.add(new Example(key, parts[1], options));
193.103 + }
193.104 + }
193.105 +
193.106 + return examples;
193.107 + }
193.108 +
193.109 + private static String loadToString(String name) {
193.110 + InputStream examplesList = null;
193.111 +
193.112 + try {
193.113 + examplesList = LoadExamples.class.getResourceAsStream(name);
193.114 +
193.115 + if (examplesList == null) return null;
193.116 +
193.117 + StringBuilder result = new StringBuilder();
193.118 + int read;
193.119 +
193.120 + while ((read = examplesList.read()) != (-1)) {
193.121 + result.append((char) read);
193.122 + }
193.123 +
193.124 + return result.toString();
193.125 + } catch (IOException ex) {
193.126 + Exceptions.printStackTrace(ex);
193.127 + return null;
193.128 + } finally {
193.129 + if (examplesList != null) {
193.130 + try {
193.131 + examplesList.close();
193.132 + } catch (IOException ex) {
193.133 + Exceptions.printStackTrace(ex);
193.134 + }
193.135 + }
193.136 + }
193.137 + }
193.138 +}
194.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
194.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/double-checked-locking.example Tue Feb 21 22:37:57 2012 +0100
194.3 @@ -0,0 +1,33 @@
194.4 +%%example=double-checked-locking
194.5 +if ($var == null) {
194.6 + $preinit$;
194.7 + synchronized ($lock) {
194.8 + if ($var == null) {
194.9 + $s2$;
194.10 + }
194.11 + }
194.12 +}
194.13 +%%example=double-checked-locking-verify,verify
194.14 +if ($var == null) {
194.15 + $preinit$;
194.16 + synchronized ($lock) {
194.17 + if ($var == null) {
194.18 + $s2$;
194.19 + }
194.20 + }
194.21 +} :: !hasModifier($var, Modifier.VOLATILE);;
194.22 +%%example=double-checked-locking-fix,verify,fix
194.23 +if ($var == null) {
194.24 + $preinit$;
194.25 + synchronized ($lock) {
194.26 + if ($var == null) {
194.27 + $s2$;
194.28 + }
194.29 + }
194.30 +} :: !hasModifier($var, Modifier.VOLATILE)
194.31 +=>
194.32 +synchronized ($lock) {
194.33 + if ($var == null) {
194.34 + $s2$;
194.35 + }
194.36 +};;
195.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
195.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/examples.list Tue Feb 21 22:37:57 2012 +0100
195.3 @@ -0,0 +1,3 @@
195.4 +double-checked-locking.example
195.5 +new-string.example
195.6 +lambda-candidate.example
196.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
196.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/lambda-candidate.example Tue Feb 21 22:37:57 2012 +0100
196.3 @@ -0,0 +1,6 @@
196.4 +%%example=lambda-candidate
196.5 +new $type() {
196.6 + $mods$ $resultType $methodName($args$) {
196.7 + $statements$;
196.8 + }
196.9 +}
197.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
197.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/examples/new-string.example Tue Feb 21 22:37:57 2012 +0100
197.3 @@ -0,0 +1,5 @@
197.4 +%%example=new-string,verify
197.5 +new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)");;
197.6 +%%example=new-string,verify,fix
197.7 +new String($orig) :: $orig instanceof String && !matchesAny($orig, "$o.substring($s)", "$o.substring($s, $e)")
197.8 +=> $orig;;
198.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
198.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicates.java Tue Feb 21 22:37:57 2012 +0100
198.3 @@ -0,0 +1,379 @@
198.4 +/*
198.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
198.6 + *
198.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
198.8 + *
198.9 + * The contents of this file are subject to the terms of either the GNU
198.10 + * General Public License Version 2 only ("GPL") or the Common
198.11 + * Development and Distribution License("CDDL") (collectively, the
198.12 + * "License"). You may not use this file except in compliance with the
198.13 + * License. You can obtain a copy of the License at
198.14 + * http://www.netbeans.org/cddl-gplv2.html
198.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
198.16 + * specific language governing permissions and limitations under the
198.17 + * License. When distributing the software, include this License Header
198.18 + * Notice in each file and include the License file at
198.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
198.20 + * particular file as subject to the "Classpath" exception as provided
198.21 + * by Sun in the GPL Version 2 section of the License file that
198.22 + * accompanied this code. If applicable, add the following below the
198.23 + * License Header, with the fields enclosed by brackets [] replaced by
198.24 + * your own identifying information:
198.25 + * "Portions Copyrighted [year] [name of copyright owner]"
198.26 + *
198.27 + * If you wish your version of this file to be governed by only the CDDL
198.28 + * or only the GPL Version 2, indicate your decision by adding
198.29 + * "[Contributor] elects to include this software in this distribution
198.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
198.31 + * single choice of license, a recipient has the option to distribute
198.32 + * your version of this file under either the CDDL, the GPL Version 2 or
198.33 + * to extend the choice of license to its licensees as provided above.
198.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
198.35 + * Version 2 license, then the option applies only if the new code is
198.36 + * made subject to such option by the copyright holder.
198.37 + *
198.38 + * Contributor(s):
198.39 + *
198.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
198.41 + */
198.42 +
198.43 +package org.netbeans.modules.jackpot30.impl.hints;
198.44 +
198.45 +import com.sun.source.tree.BlockTree;
198.46 +import com.sun.source.tree.ExpressionTree;
198.47 +import com.sun.source.tree.NewClassTree;
198.48 +import com.sun.source.tree.StatementTree;
198.49 +import com.sun.source.tree.Tree;
198.50 +import com.sun.source.tree.Tree.Kind;
198.51 +import com.sun.source.tree.VariableTree;
198.52 +import com.sun.source.util.TreePath;
198.53 +import java.util.Collection;
198.54 +import java.util.Collections;
198.55 +import java.util.EnumSet;
198.56 +import java.util.Set;
198.57 +import javax.lang.model.type.ErrorType;
198.58 +import javax.lang.model.type.TypeKind;
198.59 +import javax.lang.model.type.TypeMirror;
198.60 +import javax.swing.SwingUtilities;
198.61 +import org.netbeans.api.java.lexer.JavaTokenId;
198.62 +import org.netbeans.api.java.source.CancellableTask;
198.63 +import org.netbeans.api.java.source.CompilationController;
198.64 +import org.netbeans.api.java.source.CompilationInfo;
198.65 +import org.netbeans.api.java.source.JavaSource;
198.66 +import org.netbeans.api.java.source.JavaSource.Phase;
198.67 +import org.netbeans.api.java.source.JavaSource.Priority;
198.68 +import org.netbeans.api.java.source.JavaSourceTaskFactory;
198.69 +import org.netbeans.api.java.source.Task;
198.70 +import org.netbeans.api.java.source.TreePathHandle;
198.71 +import org.netbeans.api.java.source.support.CaretAwareJavaSourceTaskFactory;
198.72 +import org.netbeans.api.java.source.support.SelectionAwareJavaSourceTaskFactory;
198.73 +import org.netbeans.api.lexer.TokenSequence;
198.74 +import org.netbeans.modules.jackpot30.impl.refactoring.FindDuplicatesRefactoringUI;
198.75 +import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
198.76 +import org.netbeans.modules.java.hints.jackpot.impl.batch.Scopes;
198.77 +import org.netbeans.modules.refactoring.spi.ui.UI;
198.78 +import org.netbeans.spi.editor.hints.ChangeInfo;
198.79 +import org.netbeans.spi.editor.hints.ErrorDescription;
198.80 +import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
198.81 +import org.netbeans.spi.editor.hints.Fix;
198.82 +import org.netbeans.spi.editor.hints.HintsController;
198.83 +import org.netbeans.spi.editor.hints.Severity;
198.84 +import org.openide.filesystems.FileObject;
198.85 +import org.openide.util.lookup.ServiceProvider;
198.86 +
198.87 +/**
198.88 + *
198.89 + * @author lahvac
198.90 + */
198.91 +public class ExplicitFindDuplicates implements CancellableTask<CompilationInfo> {
198.92 +
198.93 + public void run(CompilationInfo info) throws Exception {
198.94 + Collection<? extends ErrorDescription> eds = computeErrorDescription(info);
198.95 +
198.96 + if (eds == null) {
198.97 + eds = Collections.emptyList();
198.98 + }
198.99 +
198.100 + HintsController.setErrors(info.getFileObject(), ExplicitFindDuplicates.class.getName(), eds);
198.101 + }
198.102 +
198.103 + private Collection<? extends ErrorDescription> computeErrorDescription(CompilationInfo info) throws Exception {
198.104 + int[] span = SelectionAwareJavaSourceTaskFactory.getLastSelection(info.getFileObject());
198.105 +
198.106 + if (span == null) {
198.107 + return null;
198.108 + }
198.109 +
198.110 + TreePath selection = selectionForExpressionHack(info, span[0], span[1]);
198.111 +
198.112 + if (selection == null) {
198.113 + if (selectionForStatementsHack(info, span[0], span[1], new int[2]) == null) {
198.114 + return null;
198.115 + }
198.116 + }
198.117 +
198.118 + Fix f = new FixImpl(info.getFileObject(), span[0], span[1]);
198.119 + int caret = CaretAwareJavaSourceTaskFactory.getLastPosition(info.getFileObject());
198.120 + ErrorDescription ed = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, "Look for Duplicates", Collections.singletonList(f), info.getFileObject(), caret, caret);
198.121 +
198.122 + return Collections.singletonList(ed);
198.123 + }
198.124 +
198.125 + public void cancel() {
198.126 + //XXX
198.127 + }
198.128 +
198.129 + static Tree resolveAndGeneralizePattern(CompilationInfo info, int start, int end) {
198.130 + TreePath selection = selectionForExpressionHack(info, start, end);
198.131 +
198.132 + if (selection == null) {
198.133 + int[] statementSpan = new int[2];
198.134 + TreePathHandle statementSelection = selectionForStatementsHack(info, start, end, statementSpan);
198.135 +
198.136 + if (statementSelection == null) {
198.137 + return null;
198.138 + }
198.139 +
198.140 + selection = statementSelection.resolve(info);
198.141 +
198.142 + if (selection == null) {
198.143 + return null; //XXX
198.144 + }
198.145 +
198.146 + return Utilities.generalizePattern(info, selection, statementSpan[0], statementSpan[1]);
198.147 + } else {
198.148 + return Utilities.generalizePattern(info, selection);
198.149 + }
198.150 + }
198.151 +
198.152 + private static final class FixImpl implements Fix {
198.153 +
198.154 + private final FileObject file;
198.155 + private final int start;
198.156 + private final int end;
198.157 +
198.158 + public FixImpl(FileObject file, int start, int end) {
198.159 + this.file = file;
198.160 + this.start = start;
198.161 + this.end = end;
198.162 + }
198.163 +
198.164 + public String getText() {
198.165 + return "Look for Duplicates in Opened Projects";
198.166 + }
198.167 +
198.168 + public ChangeInfo implement() throws Exception {
198.169 + JavaSource.forFileObject(file).runUserActionTask(new Task<CompilationController>() {
198.170 + public void run(CompilationController cc) throws Exception {
198.171 + cc.toPhase(Phase.RESOLVED);
198.172 +
198.173 + Tree generalized = resolveAndGeneralizePattern(cc, start, end);
198.174 +
198.175 + if (generalized == null) {
198.176 + return ;
198.177 + }
198.178 +
198.179 + final String pattern = generalized.toString(); //XXX
198.180 +
198.181 + SwingUtilities.invokeLater(new Runnable() {
198.182 + public void run() {
198.183 + UI.openRefactoringUI(new FindDuplicatesRefactoringUI(pattern, Scopes.allOpenedProjectsScope()));
198.184 + }
198.185 + });
198.186 + }
198.187 + }, true);
198.188 +
198.189 + return null;
198.190 + }
198.191 +
198.192 + }
198.193 +
198.194 + private static final Set<TypeKind> NOT_ACCEPTED_TYPES = EnumSet.of(TypeKind.NONE, TypeKind.OTHER);
198.195 +
198.196 + static TreePath selectionForExpressionHack(CompilationInfo info, int start, int end) {
198.197 + return validateSelection(info, start, end, NOT_ACCEPTED_TYPES);
198.198 + }
198.199 +
198.200 + static TreePathHandle selectionForStatementsHack(CompilationInfo info, int start, int end, int[] outSpan) {
198.201 + return validateSelectionForIntroduceMethod(info, start, end, outSpan);
198.202 + }
198.203 +
198.204 + private static final Set<JavaTokenId> WHITESPACES = EnumSet.of(JavaTokenId.WHITESPACE, JavaTokenId.BLOCK_COMMENT, JavaTokenId.LINE_COMMENT, JavaTokenId.JAVADOC_COMMENT);
198.205 + static int[] ignoreWhitespaces(CompilationInfo ci, int start, int end) {
198.206 + TokenSequence<JavaTokenId> ts = ci.getTokenHierarchy().tokenSequence(JavaTokenId.language());
198.207 +
198.208 + if (ts == null) {
198.209 + return new int[] {start, end};
198.210 + }
198.211 +
198.212 + ts.move(start);
198.213 +
198.214 + if (ts.moveNext()) {
198.215 + boolean wasMoveNext = true;
198.216 +
198.217 + while (WHITESPACES.contains(ts.token().id()) && (wasMoveNext = ts.moveNext()))
198.218 + ;
198.219 +
198.220 + if (wasMoveNext && ts.offset() > start)
198.221 + start = ts.offset();
198.222 + }
198.223 +
198.224 + ts.move(end);
198.225 +
198.226 + while (ts.movePrevious() && WHITESPACES.contains(ts.token().id()) && ts.offset() < end)
198.227 + end = ts.offset();
198.228 +
198.229 + return new int[] {start, end};
198.230 + }
198.231 +
198.232 + private static boolean isInsideClass(TreePath tp) {
198.233 + while (tp != null) {
198.234 + if (tp.getLeaf().getKind() == Kind.CLASS)
198.235 + return true;
198.236 +
198.237 + tp = tp.getParentPath();
198.238 + }
198.239 +
198.240 + return false;
198.241 + }
198.242 +
198.243 + private static TreePath validateSelection(CompilationInfo ci, int start, int end, Set<TypeKind> ignoredTypes) {
198.244 + TreePath tp = ci.getTreeUtilities().pathFor((start + end) / 2 + 1);
198.245 +
198.246 + for ( ; tp != null; tp = tp.getParentPath()) {
198.247 + Tree leaf = tp.getLeaf();
198.248 +
198.249 + if (!ExpressionTree.class.isAssignableFrom(leaf.getKind().asInterface()))
198.250 + continue;
198.251 +
198.252 + long treeStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), leaf);
198.253 + long treeEnd = ci.getTrees().getSourcePositions().getEndPosition(ci.getCompilationUnit(), leaf);
198.254 +
198.255 + if (treeStart != start || treeEnd != end) {
198.256 + continue;
198.257 + }
198.258 +
198.259 + TypeMirror type = ci.getTrees().getTypeMirror(tp);
198.260 +
198.261 + if (type != null && type.getKind() == TypeKind.ERROR) {
198.262 + type = ci.getTrees().getOriginalType((ErrorType) type);
198.263 + }
198.264 +
198.265 + if (type == null || ignoredTypes.contains(type.getKind()))
198.266 + continue;
198.267 +
198.268 + if(tp.getLeaf().getKind() == Kind.ASSIGNMENT)
198.269 + continue;
198.270 +
198.271 + if (tp.getLeaf().getKind() == Kind.ANNOTATION)
198.272 + continue;
198.273 +
198.274 + if (!isInsideClass(tp))
198.275 + return null;
198.276 +
198.277 + TreePath candidate = tp;
198.278 +
198.279 + tp = tp.getParentPath();
198.280 +
198.281 + while (tp != null) {
198.282 + switch (tp.getLeaf().getKind()) {
198.283 + case VARIABLE:
198.284 + VariableTree vt = (VariableTree) tp.getLeaf();
198.285 + if (vt.getInitializer() == leaf) {
198.286 + return candidate;
198.287 + } else {
198.288 + return null;
198.289 + }
198.290 + case NEW_CLASS:
198.291 + NewClassTree nct = (NewClassTree) tp.getLeaf();
198.292 +
198.293 + if (nct.getIdentifier().equals(candidate.getLeaf())) { //avoid disabling hint ie inside of anonymous class higher in treepath
198.294 + for (Tree p : nct.getArguments()) {
198.295 + if (p == leaf) {
198.296 + return candidate;
198.297 + }
198.298 + }
198.299 +
198.300 + return null;
198.301 + }
198.302 + }
198.303 +
198.304 + leaf = tp.getLeaf();
198.305 + tp = tp.getParentPath();
198.306 + }
198.307 +
198.308 + return candidate;
198.309 + }
198.310 +
198.311 + return null;
198.312 + }
198.313 +
198.314 + private static TreePathHandle validateSelectionForIntroduceMethod(CompilationInfo ci, int start, int end, int[] statementsSpan) {
198.315 + int[] span = ignoreWhitespaces(ci, Math.min(start, end), Math.max(start, end));
198.316 +
198.317 + start = span[0];
198.318 + end = span[1];
198.319 +
198.320 + if (start >= end)
198.321 + return null;
198.322 +
198.323 + TreePath tpStart = ci.getTreeUtilities().pathFor(start);
198.324 + TreePath tpEnd = ci.getTreeUtilities().pathFor(end);
198.325 +
198.326 + if (tpStart.getLeaf() != tpEnd.getLeaf() || tpStart.getLeaf().getKind() != Kind.BLOCK) {
198.327 + //??? not in the same block:
198.328 + return null;
198.329 + }
198.330 +
198.331 + int from = -1;
198.332 + int to = -1;
198.333 +
198.334 + BlockTree block = (BlockTree) tpStart.getLeaf();
198.335 + int index = 0;
198.336 +
198.337 + for (StatementTree s : block.getStatements()) {
198.338 + long sStart = ci.getTrees().getSourcePositions().getStartPosition(ci.getCompilationUnit(), s);
198.339 +
198.340 + if (sStart == start) {
198.341 + from = index;
198.342 + }
198.343 +
198.344 + if (end < sStart && to == (-1)) {
198.345 + to = index - 1;
198.346 + }
198.347 +
198.348 + index++;
198.349 + }
198.350 +
198.351 + if (from == (-1)) {
198.352 + return null;
198.353 + }
198.354 +
198.355 + if (to == (-1))
198.356 + to = block.getStatements().size() - 1;
198.357 +
198.358 + if (to < from) {
198.359 + return null;
198.360 + }
198.361 +
198.362 + statementsSpan[0] = from;
198.363 + statementsSpan[1] = to;
198.364 +
198.365 + return TreePathHandle.create(tpStart, ci);
198.366 + }
198.367 +
198.368 + @ServiceProvider(service=JavaSourceTaskFactory.class)
198.369 + public static final class FactoryImpl extends SelectionAwareJavaSourceTaskFactory {
198.370 +
198.371 + public FactoryImpl() {
198.372 + super(Phase.RESOLVED, Priority.LOW);
198.373 + }
198.374 +
198.375 + @Override
198.376 + protected CancellableTask<CompilationInfo> createTask(FileObject file) {
198.377 + return new ExplicitFindDuplicates();
198.378 + }
198.379 +
198.380 + }
198.381 +
198.382 +}
199.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
199.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
199.3 @@ -0,0 +1,40 @@
199.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
199.5 +#
199.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
199.7 +#
199.8 +# The contents of this file are subject to the terms of either the GNU
199.9 +# General Public License Version 2 only ("GPL") or the Common
199.10 +# Development and Distribution License("CDDL") (collectively, the
199.11 +# "License"). You may not use this file except in compliance with the
199.12 +# License. You can obtain a copy of the License at
199.13 +# http://www.netbeans.org/cddl-gplv2.html
199.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
199.15 +# specific language governing permissions and limitations under the
199.16 +# License. When distributing the software, include this License Header
199.17 +# Notice in each file and include the License file at
199.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
199.19 +# particular file as subject to the "Classpath" exception as provided
199.20 +# by Sun in the GPL Version 2 section of the License file that
199.21 +# accompanied this code. If applicable, add the following below the
199.22 +# License Header, with the fields enclosed by brackets [] replaced by
199.23 +# your own identifying information:
199.24 +# "Portions Copyrighted [year] [name of copyright owner]"
199.25 +#
199.26 +# If you wish your version of this file to be governed by only the CDDL
199.27 +# or only the GPL Version 2, indicate your decision by adding
199.28 +# "[Contributor] elects to include this software in this distribution
199.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
199.30 +# single choice of license, a recipient has the option to distribute
199.31 +# your version of this file under either the CDDL, the GPL Version 2 or
199.32 +# to extend the choice of license to its licensees as provided above.
199.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
199.34 +# Version 2 license, then the option applies only if the new code is
199.35 +# made subject to such option by the copyright holder.
199.36 +#
199.37 +# Contributor(s):
199.38 +#
199.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
199.40 +
199.41 +Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance=Apply Pattern
199.42 +Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance=Find Pattern Occurrences
199.43 +OpenIDE-Module-Name=Jackpot 3.0 API
200.1 Binary file sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/examples_icon.png has changed
201.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
201.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/layer.xml Tue Feb 21 22:37:57 2012 +0100
201.3 @@ -0,0 +1,68 @@
201.4 +<?xml version="1.0" encoding="UTF-8"?>
201.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
201.6 +<filesystem>
201.7 + <folder name="Actions">
201.8 + <folder name="Refactoring">
201.9 + <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance">
201.10 + <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.duplicates.GlobalFindDuplicates"/>
201.11 + <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.duplicates.Bundle#CTL_GlobalFindDuplicates"/>
201.12 + <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
201.13 + <attr name="noIconInMenu" boolvalue="false"/>
201.14 + </file>
201.15 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance">
201.16 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
201.17 + <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.ApplyPatternAction"/>
201.18 + <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_ApplyPatternAction"/>
201.19 + <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
201.20 + <attr name="noIconInMenu" boolvalue="false"/>
201.21 + </file>
201.22 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance">
201.23 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.jackpot30.impl.resources.Bundle"/>
201.24 + <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.FindOccurrencesAction"/>
201.25 + <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.Bundle#CTL_FindOccurrencesAction"/>
201.26 + <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
201.27 + <attr name="noIconInMenu" boolvalue="false"/>
201.28 + </file>
201.29 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance">
201.30 + <attr name="delegate" newvalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.UpgradeAction"/>
201.31 + <attr name="displayName" bundlevalue="org.netbeans.modules.jackpot30.impl.refactoring.upgrade.Bundle#CTL_UpgradeAction"/>
201.32 + <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
201.33 + <attr name="noIconInMenu" boolvalue="false"/>
201.34 + </file>
201.35 + </folder>
201.36 + </folder>
201.37 +
201.38 + <!--XXX:-->
201.39 + <folder name="Menu">
201.40 + <folder name="Edit">
201.41 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.shadow">
201.42 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-FindOccurrencesAction.instance"/>
201.43 + <attr name="position" intvalue="2250"/>
201.44 + </file>
201.45 + </folder>
201.46 + <folder name="Refactoring">
201.47 + <file name="org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.shadow">
201.48 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-duplicates-GlobalFindDuplicates.instance"/>
201.49 + <attr name="position" intvalue="2300"/>
201.50 + </file>
201.51 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.shadow">
201.52 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-ApplyPatternAction.instance"/>
201.53 + <attr name="position" intvalue="2200"/>
201.54 + </file>
201.55 + <file name="org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.shadow">
201.56 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-impl-refactoring-upgrade-UpgradeAction.instance"/>
201.57 + <attr name="position" intvalue="2187"/>
201.58 + </file>
201.59 + </folder>
201.60 + </folder>
201.61 +
201.62 + <folder name="Editors">
201.63 + <folder name="text">
201.64 + <folder name="x-java">
201.65 + <file name="org-netbeans-modules-jackpot30-impl-hints-HintsInvoker$FactoryImpl.instance"/>
201.66 + <file name="org-netbeans-modules-jackpot30-impl-indexing-CustomIndexerImpl$CustomIndexerFactoryImpl.instance"/>
201.67 + <file name="org-netbeans-modules-jackpot30-impl-duplicates-indexing-DuplicatesCustomIndexerImpl$FactoryImpl.instance"/>
201.68 + </folder>
201.69 + </folder>
201.70 + </folder>
201.71 +</filesystem>
202.1 Binary file sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/impl/resources/recent_icon.png has changed
203.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
203.2 +++ b/sandbox/old-modules/api/src/org/netbeans/modules/jackpot30/spi/Hacks.java Tue Feb 21 22:37:57 2012 +0100
203.3 @@ -0,0 +1,89 @@
203.4 +/*
203.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
203.6 + *
203.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
203.8 + *
203.9 + * The contents of this file are subject to the terms of either the GNU
203.10 + * General Public License Version 2 only ("GPL") or the Common
203.11 + * Development and Distribution License("CDDL") (collectively, the
203.12 + * "License"). You may not use this file except in compliance with the
203.13 + * License. You can obtain a copy of the License at
203.14 + * http://www.netbeans.org/cddl-gplv2.html
203.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
203.16 + * specific language governing permissions and limitations under the
203.17 + * License. When distributing the software, include this License Header
203.18 + * Notice in each file and include the License file at
203.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
203.20 + * particular file as subject to the "Classpath" exception as provided
203.21 + * by Sun in the GPL Version 2 section of the License file that
203.22 + * accompanied this code. If applicable, add the following below the
203.23 + * License Header, with the fields enclosed by brackets [] replaced by
203.24 + * your own identifying information:
203.25 + * "Portions Copyrighted [year] [name of copyright owner]"
203.26 + *
203.27 + * If you wish your version of this file to be governed by only the CDDL
203.28 + * or only the GPL Version 2, indicate your decision by adding
203.29 + * "[Contributor] elects to include this software in this distribution
203.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
203.31 + * single choice of license, a recipient has the option to distribute
203.32 + * your version of this file under either the CDDL, the GPL Version 2 or
203.33 + * to extend the choice of license to its licensees as provided above.
203.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
203.35 + * Version 2 license, then the option applies only if the new code is
203.36 + * made subject to such option by the copyright holder.
203.37 + *
203.38 + * Contributor(s):
203.39 + *
203.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
203.41 + */
203.42 +
203.43 +package org.netbeans.modules.jackpot30.spi;
203.44 +
203.45 +import com.sun.source.util.TreePath;
203.46 +import java.util.ArrayList;
203.47 +import java.util.Collections;
203.48 +import java.util.LinkedList;
203.49 +import java.util.List;
203.50 +import java.util.Set;
203.51 +import java.util.concurrent.atomic.AtomicBoolean;
203.52 +import java.util.prefs.Preferences;
203.53 +import org.netbeans.api.java.source.WorkingCopy;
203.54 +import org.netbeans.api.project.Project;
203.55 +import org.netbeans.modules.java.hints.jackpot.impl.MessageImpl;
203.56 +import org.netbeans.modules.java.hints.jackpot.impl.batch.BatchUtilities;
203.57 +import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
203.58 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
203.59 +import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
203.60 +import org.netbeans.spi.editor.hints.ErrorDescription;
203.61 +import org.openide.util.Exceptions;
203.62 +
203.63 +/**
203.64 + *
203.65 + * @author lahvac
203.66 + */
203.67 +public class Hacks {
203.68 +
203.69 + public static interface HintPreferencesProvider {
203.70 + public Preferences findPreferences(HintMetadata hm);
203.71 + }
203.72 +
203.73 + public static void findHintsAndApplyFixes(WorkingCopy copy, Iterable<? extends HintDescription> hints, TreePath on, AtomicBoolean cancel) {
203.74 + HintsInvoker inv = new HintsInvoker(copy, cancel);
203.75 + List<ErrorDescription> errs = new ArrayList<ErrorDescription>(inv.computeHints(copy, hints));
203.76 + List<MessageImpl> problems = new LinkedList<MessageImpl>();
203.77 +
203.78 + try {
203.79 + if (BatchUtilities.applyFixes(copy, Collections.<Project, Set<String>>emptyMap(), errs, problems)) {
203.80 + throw new IllegalStateException();
203.81 + }
203.82 + } catch (IllegalStateException ex) {
203.83 + Exceptions.printStackTrace(ex);
203.84 + } catch (Exception ex) {
203.85 + Exceptions.printStackTrace(ex);
203.86 + }
203.87 +
203.88 + if (!problems.isEmpty()) {
203.89 + throw new IllegalStateException(problems.get(0).text);
203.90 + }
203.91 + }
203.92 +}
204.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
204.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/TestBase.java Tue Feb 21 22:37:57 2012 +0100
204.3 @@ -0,0 +1,120 @@
204.4 +/*
204.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
204.6 + *
204.7 + * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
204.8 + *
204.9 + * The contents of this file are subject to the terms of either the GNU
204.10 + * General Public License Version 2 only ("GPL") or the Common
204.11 + * Development and Distribution License("CDDL") (collectively, the
204.12 + * "License"). You may not use this file except in compliance with the
204.13 + * License. You can obtain a copy of the License at
204.14 + * http://www.netbeans.org/cddl-gplv2.html
204.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
204.16 + * specific language governing permissions and limitations under the
204.17 + * License. When distributing the software, include this License Header
204.18 + * Notice in each file and include the License file at
204.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
204.20 + * particular file as subject to the "Classpath" exception as provided
204.21 + * by Sun in the GPL Version 2 section of the License file that
204.22 + * accompanied this code. If applicable, add the following below the
204.23 + * License Header, with the fields enclosed by brackets [] replaced by
204.24 + * your own identifying information:
204.25 + * "Portions Copyrighted [year] [name of copyright owner]"
204.26 + *
204.27 + * If you wish your version of this file to be governed by only the CDDL
204.28 + * or only the GPL Version 2, indicate your decision by adding
204.29 + * "[Contributor] elects to include this software in this distribution
204.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
204.31 + * single choice of license, a recipient has the option to distribute
204.32 + * your version of this file under either the CDDL, the GPL Version 2 or
204.33 + * to extend the choice of license to its licensees as provided above.
204.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
204.35 + * Version 2 license, then the option applies only if the new code is
204.36 + * made subject to such option by the copyright holder.
204.37 + *
204.38 + * Contributor(s):
204.39 + *
204.40 + * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
204.41 + */
204.42 +
204.43 +package org.netbeans.modules.jackpot30.impl;
204.44 +
204.45 +import java.io.File;
204.46 +import javax.swing.text.Document;
204.47 +import org.netbeans.api.java.lexer.JavaTokenId;
204.48 +import org.netbeans.api.java.source.CompilationInfo;
204.49 +import org.netbeans.api.java.source.JavaSource;
204.50 +import org.netbeans.api.java.source.JavaSource.Phase;
204.51 +import org.netbeans.api.java.source.SourceUtilsTestUtil;
204.52 +import org.netbeans.api.java.source.TestUtilities;
204.53 +import org.netbeans.api.lexer.Language;
204.54 +import org.netbeans.junit.NbTestCase;
204.55 +import org.netbeans.modules.java.source.TreeLoader;
204.56 +import org.openide.cookies.EditorCookie;
204.57 +import org.openide.filesystems.FileObject;
204.58 +import org.openide.filesystems.FileUtil;
204.59 +import org.openide.loaders.DataObject;
204.60 +
204.61 +/**
204.62 + *
204.63 + * @author Jan Lahoda
204.64 + */
204.65 +public class TestBase extends NbTestCase {
204.66 +
204.67 + public TestBase(String name) {
204.68 + super(name);
204.69 + }
204.70 +
204.71 + @Override
204.72 + protected void setUp() throws Exception {
204.73 + super.setUp();
204.74 + SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
204.75 + TreeLoader.DISABLE_CONFINEMENT_TEST = true;
204.76 + }
204.77 +
204.78 + protected void prepareTest(String fileName, String code) throws Exception {
204.79 + clearWorkDir();
204.80 +
204.81 + FileUtil.refreshFor(File.listRoots());
204.82 +
204.83 + FileObject workFO = FileUtil.toFileObject(getWorkDir());
204.84 +
204.85 + assertNotNull(workFO);
204.86 +
204.87 + workFO.refresh();
204.88 +
204.89 + sourceRoot = workFO.createFolder("src");
204.90 + FileObject buildRoot = workFO.createFolder("build");
204.91 + FileObject cache = workFO.createFolder("cache");
204.92 +
204.93 + FileObject data = FileUtil.createData(sourceRoot, fileName);
204.94 + File dataFile = FileUtil.toFile(data);
204.95 +
204.96 + assertNotNull(dataFile);
204.97 +
204.98 + TestUtilities.copyStringToFile(dataFile, code);
204.99 +
204.100 + SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
204.101 +
204.102 + DataObject od = DataObject.find(data);
204.103 + EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
204.104 +
204.105 + assertNotNull(ec);
204.106 +
204.107 + doc = ec.openDocument();
204.108 + doc.putProperty(Language.class, JavaTokenId.language());
204.109 +
204.110 + JavaSource js = JavaSource.forFileObject(data);
204.111 +
204.112 + assertNotNull(js);
204.113 +
204.114 + info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
204.115 +
204.116 + assertNotNull(info);
204.117 + }
204.118 +
204.119 + protected FileObject sourceRoot;
204.120 + protected CompilationInfo info;
204.121 + protected Document doc;
204.122 +
204.123 +}
205.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
205.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/LoadExamplesTest.java Tue Feb 21 22:37:57 2012 +0100
205.3 @@ -0,0 +1,71 @@
205.4 +/*
205.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
205.6 + *
205.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
205.8 + *
205.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
205.10 + * Other names may be trademarks of their respective owners.
205.11 + *
205.12 + * The contents of this file are subject to the terms of either the GNU
205.13 + * General Public License Version 2 only ("GPL") or the Common
205.14 + * Development and Distribution License("CDDL") (collectively, the
205.15 + * "License"). You may not use this file except in compliance with the
205.16 + * License. You can obtain a copy of the License at
205.17 + * http://www.netbeans.org/cddl-gplv2.html
205.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
205.19 + * specific language governing permissions and limitations under the
205.20 + * License. When distributing the software, include this License Header
205.21 + * Notice in each file and include the License file at
205.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
205.23 + * particular file as subject to the "Classpath" exception as provided
205.24 + * by Oracle in the GPL Version 2 section of the License file that
205.25 + * accompanied this code. If applicable, add the following below the
205.26 + * License Header, with the fields enclosed by brackets [] replaced by
205.27 + * your own identifying information:
205.28 + * "Portions Copyrighted [year] [name of copyright owner]"
205.29 + *
205.30 + * If you wish your version of this file to be governed by only the CDDL
205.31 + * or only the GPL Version 2, indicate your decision by adding
205.32 + * "[Contributor] elects to include this software in this distribution
205.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
205.34 + * single choice of license, a recipient has the option to distribute
205.35 + * your version of this file under either the CDDL, the GPL Version 2 or
205.36 + * to extend the choice of license to its licensees as provided above.
205.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
205.38 + * Version 2 license, then the option applies only if the new code is
205.39 + * made subject to such option by the copyright holder.
205.40 + *
205.41 + * Contributor(s):
205.42 + *
205.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
205.44 + */
205.45 +
205.46 +package org.netbeans.modules.jackpot30.impl.examples;
205.47 +
205.48 +import java.util.Arrays;
205.49 +import java.util.LinkedList;
205.50 +import java.util.List;
205.51 +import org.netbeans.junit.NbTestCase;
205.52 +import static org.junit.Assert.*;
205.53 +
205.54 +/**
205.55 + *
205.56 + * @author lahvac
205.57 + */
205.58 +public class LoadExamplesTest extends NbTestCase {
205.59 +
205.60 + public LoadExamplesTest(String name) {
205.61 + super(name);
205.62 + }
205.63 +
205.64 + public void testLoadExamples() {
205.65 + List<String> actual = new LinkedList<String>();
205.66 +
205.67 + for (Example e : LoadExamples.loadExamples("test-examples.list")) {
205.68 + actual.add("" + e.getKey() + ":" + e.getOptions() + ":" + e.getCode());
205.69 + }
205.70 +
205.71 + assertEquals(Arrays.asList("key1:[]:EX1\n", "key2:[VERIFY, FIX]:EX2\n", "key3:[FIX]:EX3\n"), actual);
205.72 + }
205.73 +
205.74 +}
205.75 \ No newline at end of file
206.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
206.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-example1.example Tue Feb 21 22:37:57 2012 +0100
206.3 @@ -0,0 +1,6 @@
206.4 +%%example=key1
206.5 +EX1
206.6 +%%example=key2,verify,fix
206.7 +EX2
206.8 +%%example=key3,fix
206.9 +EX3
207.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
207.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/examples/test-examples.list Tue Feb 21 22:37:57 2012 +0100
207.3 @@ -0,0 +1,1 @@
207.4 +test-example1.example
208.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
208.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/hints/ExplicitFindDuplicatesTest.java Tue Feb 21 22:37:57 2012 +0100
208.3 @@ -0,0 +1,138 @@
208.4 +/*
208.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
208.6 + *
208.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
208.8 + *
208.9 + * The contents of this file are subject to the terms of either the GNU
208.10 + * General Public License Version 2 only ("GPL") or the Common
208.11 + * Development and Distribution License("CDDL") (collectively, the
208.12 + * "License"). You may not use this file except in compliance with the
208.13 + * License. You can obtain a copy of the License at
208.14 + * http://www.netbeans.org/cddl-gplv2.html
208.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
208.16 + * specific language governing permissions and limitations under the
208.17 + * License. When distributing the software, include this License Header
208.18 + * Notice in each file and include the License file at
208.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
208.20 + * particular file as subject to the "Classpath" exception as provided
208.21 + * by Sun in the GPL Version 2 section of the License file that
208.22 + * accompanied this code. If applicable, add the following below the
208.23 + * License Header, with the fields enclosed by brackets [] replaced by
208.24 + * your own identifying information:
208.25 + * "Portions Copyrighted [year] [name of copyright owner]"
208.26 + *
208.27 + * If you wish your version of this file to be governed by only the CDDL
208.28 + * or only the GPL Version 2, indicate your decision by adding
208.29 + * "[Contributor] elects to include this software in this distribution
208.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
208.31 + * single choice of license, a recipient has the option to distribute
208.32 + * your version of this file under either the CDDL, the GPL Version 2 or
208.33 + * to extend the choice of license to its licensees as provided above.
208.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
208.35 + * Version 2 license, then the option applies only if the new code is
208.36 + * made subject to such option by the copyright holder.
208.37 + *
208.38 + * Contributor(s):
208.39 + *
208.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
208.41 + */
208.42 +
208.43 +package org.netbeans.modules.jackpot30.impl.hints;
208.44 +
208.45 +import com.sun.source.tree.Tree;
208.46 +import com.sun.tools.javac.tree.JCTree;
208.47 +import java.util.regex.Pattern;
208.48 +import org.netbeans.modules.jackpot30.impl.TestBase;
208.49 +import org.netbeans.modules.java.source.pretty.VeryPretty;
208.50 +import org.netbeans.modules.java.source.save.DiffContext;
208.51 +
208.52 +/**
208.53 + *
208.54 + * @author lahvac
208.55 + */
208.56 +public class ExplicitFindDuplicatesTest extends TestBase {
208.57 +
208.58 + public ExplicitFindDuplicatesTest(String name) {
208.59 + super(name);
208.60 + }
208.61 +
208.62 + public void testLocalVariablesGeneralization() throws Exception {
208.63 + performGeneralizationTest("package test;\n" +
208.64 + "public class Test {\n" +
208.65 + " private void test() {\n" +
208.66 + " |int i = 0;\n" +
208.67 + " i++;\n" +
208.68 + " int j = i;|\n" +
208.69 + " }\n" +
208.70 + "}\n" +
208.71 + "",
208.72 + "{\n" +
208.73 + " $s0$;\n" +
208.74 + " int $0 = 0;\n" +
208.75 + " $0++;\n" +
208.76 + " int $1 = $0;\n" +
208.77 + " $s1$;\n" +
208.78 + "}");
208.79 + }
208.80 +
208.81 + public void testSingleStatementPattern() throws Exception {
208.82 + performGeneralizationTest("package test;\n" +
208.83 + "public class Test {\n" +
208.84 + " private void test() {\n" +
208.85 + " int i = 0;\n" +
208.86 + " |i++;|\n" +
208.87 + " int j = i;\n" +
208.88 + " }\n" +
208.89 + "}\n" +
208.90 + "",
208.91 + "$0++;");
208.92 + }
208.93 +
208.94 + public void testExpressionPattern() throws Exception {
208.95 + performGeneralizationTest("package test;\n" +
208.96 + "public class Test {\n" +
208.97 + " private void test() {\n" +
208.98 + " int i = 0;\n" +
208.99 + " i++;\n" +
208.100 + " int j = |i|;\n" +
208.101 + " }\n" +
208.102 + "}\n" +
208.103 + "",
208.104 + "$0");
208.105 + }
208.106 +
208.107 + public void testVoidMethod() throws Exception {
208.108 + performGeneralizationTest("package test;\n" +
208.109 + "public class Test {\n" +
208.110 + " private void test() {\n" +
208.111 + " |System.err.println()|;\n" +
208.112 + " }\n" +
208.113 + "}\n" +
208.114 + "",
208.115 + "System.err.println()");
208.116 + }
208.117 +
208.118 + private void performGeneralizationTest(String code, String generalized) throws Exception {
208.119 + String[] split = code.split(Pattern.quote("|"));
208.120 +
208.121 + assertEquals(3, split.length);
208.122 +
208.123 + int start = split[0].length();
208.124 + int end = split[1].length() + start;
208.125 +
208.126 + code = split[0] + split[1] + split[2];
208.127 +
208.128 + prepareTest("test/Test.java", code);
208.129 +
208.130 + Tree generalizedTree = ExplicitFindDuplicates.resolveAndGeneralizePattern(info, start, end);
208.131 + VeryPretty vp = new VeryPretty(new DiffContext(info));
208.132 +
208.133 + vp.print((JCTree) generalizedTree);
208.134 +
208.135 + String repr = vp.toString();
208.136 +
208.137 + assertEquals(generalized.replaceAll("[ \n\t]+", " "),
208.138 + repr.replaceAll("[ \n\t]+", " "));
208.139 + }
208.140 +
208.141 +}
208.142 \ No newline at end of file
209.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
209.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/BulkSearchPerformance.java Tue Feb 21 22:37:57 2012 +0100
209.3 @@ -0,0 +1,226 @@
209.4 +/*
209.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
209.6 + *
209.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
209.8 + *
209.9 + * The contents of this file are subject to the terms of either the GNU
209.10 + * General Public License Version 2 only ("GPL") or the Common
209.11 + * Development and Distribution License("CDDL") (collectively, the
209.12 + * "License"). You may not use this file except in compliance with the
209.13 + * License. You can obtain a copy of the License at
209.14 + * http://www.netbeans.org/cddl-gplv2.html
209.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
209.16 + * specific language governing permissions and limitations under the
209.17 + * License. When distributing the software, include this License Header
209.18 + * Notice in each file and include the License file at
209.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
209.20 + * particular file as subject to the "Classpath" exception as provided
209.21 + * by Sun in the GPL Version 2 section of the License file that
209.22 + * accompanied this code. If applicable, add the following below the
209.23 + * License Header, with the fields enclosed by brackets [] replaced by
209.24 + * your own identifying information:
209.25 + * "Portions Copyrighted [year] [name of copyright owner]"
209.26 + *
209.27 + * If you wish your version of this file to be governed by only the CDDL
209.28 + * or only the GPL Version 2, indicate your decision by adding
209.29 + * "[Contributor] elects to include this software in this distribution
209.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
209.31 + * single choice of license, a recipient has the option to distribute
209.32 + * your version of this file under either the CDDL, the GPL Version 2 or
209.33 + * to extend the choice of license to its licensees as provided above.
209.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
209.35 + * Version 2 license, then the option applies only if the new code is
209.36 + * made subject to such option by the copyright holder.
209.37 + *
209.38 + * Contributor(s):
209.39 + *
209.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
209.41 + */
209.42 +
209.43 +package org.netbeans.modules.jackpot30.impl.pm;
209.44 +
209.45 +import com.sun.source.util.TreePath;
209.46 +import java.io.ByteArrayInputStream;
209.47 +import java.io.ByteArrayOutputStream;
209.48 +import java.io.File;
209.49 +import java.io.IOException;
209.50 +import java.util.LinkedList;
209.51 +import java.util.List;
209.52 +import org.netbeans.api.java.source.ClasspathInfo;
209.53 +import org.netbeans.api.java.source.CompilationController;
209.54 +import org.netbeans.api.java.source.JavaSource;
209.55 +import org.netbeans.api.java.source.JavaSource.Phase;
209.56 +import org.netbeans.api.java.source.Task;
209.57 +import org.netbeans.junit.NbTestCase;
209.58 +import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
209.59 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
209.60 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
209.61 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
209.62 +import org.netbeans.modules.java.hints.jackpot.impl.pm.CopyFinderBasedBulkSearch;
209.63 +import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
209.64 +import org.openide.filesystems.FileObject;
209.65 +import org.openide.filesystems.FileUtil;
209.66 +
209.67 +/**
209.68 + *
209.69 + * @author lahvac
209.70 + */
209.71 +public class BulkSearchPerformance extends NbTestCase {
209.72 +
209.73 + public BulkSearchPerformance(String name) {
209.74 + super(name);
209.75 + }
209.76 +
209.77 + public void testPerformance() throws Exception {
209.78 + File root = new File("/media/karta/space/src/nb-main/uml");
209.79 + List<FileObject> files = new LinkedList<FileObject>();
209.80 +
209.81 + gatherFiles(FileUtil.toFileObject(root), files);
209.82 +
209.83 + String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
209.84 +
209.85 + for (int c = 0; c < 5; c++) {
209.86 + performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.87 + performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.88 + }
209.89 +
209.90 + performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.91 + long nfa1 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.92 + performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.93 + long cf1 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.94 +
209.95 + performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.96 + long nfa2 = performPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.97 + performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.98 + long cf2 = performPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.99 +
209.100 + System.err.println("nfa1=" + nfa1);
209.101 + System.err.println("cf1=" + cf1);
209.102 + System.err.println("nfa2=" + nfa2);
209.103 + System.err.println("cf2=" + cf2);
209.104 +
209.105 + System.err.println("perf (cf1/nfa1): " + ((1000 * cf1 / nfa1) /10.0) + "%");
209.106 + System.err.println("perf (cf2/nfa2): " + ((1000 * cf2 / nfa2) /10.0) + "%");
209.107 + }
209.108 +
209.109 + public void testIndexingPerformance() throws Exception {
209.110 + File root = new File("/media/karta/space/src/nb-main/uml");
209.111 +// File root = new File("/media/karta/space/src/nb-main/contrib/javahints");
209.112 + List<FileObject> files = new LinkedList<FileObject>();
209.113 +
209.114 + gatherFiles(FileUtil.toFileObject(root), files);
209.115 +
209.116 + String[] patterns = new String[] {"$1.isDirectory()", "new ImageIcon()"};
209.117 +
209.118 + for (int c = 0; c < 5; c++) {
209.119 + performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.120 +// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.121 + }
209.122 +
209.123 + performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.124 + long[] nfa1 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.125 +// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.126 +// long cf1 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.127 +
209.128 + performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.129 + long[] nfa2 = performIndexingPerformanceTest(files, new NFABasedBulkSearch(), patterns);
209.130 +// performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.131 +// long cf2 = performIndexingPerformanceTest(files, new CopyFinderBasedBulkSearch(), patterns);
209.132 +
209.133 + System.err.println("i.nfa1=" + nfa1[0]);
209.134 + System.err.println("m.nfa1=" + nfa1[1]);
209.135 +// System.err.println("cf1=" + cf1);
209.136 + System.err.println("i.nfa2=" + nfa2[0]);
209.137 + System.err.println("m.nfa2=" + nfa2[1]);
209.138 +// System.err.println("cf2=" + cf2);
209.139 +
209.140 +// System.err.println("perf i.(nfa1/regexp1): " + ((1000 * nfa1[0] / regexp1[0]) /10.0) + "%");
209.141 +// System.err.println("perf m.(nfa1/regexp1): " + ((1000 * nfa1[1] / regexp1[1]) /10.0) + "%");
209.142 +// System.err.println("perf i.(nfa2/regexp2): " + ((1000 * nfa2[0] / regexp2[0]) /10.0) + "%");
209.143 +// System.err.println("perf m.(nfa2/regexp2): " + ((1000 * nfa2[1] / regexp2[1]) /10.0) + "%");
209.144 +// System.err.println("perf (cf1/regexp1): " + ((1000 * cf1 / regexp1) /10.0) + "%");
209.145 +// System.err.println("perf (cf2/regexp2): " + ((1000 * cf2 / regexp2) /10.0) + "%");
209.146 + }
209.147 +
209.148 + private long performPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
209.149 + ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
209.150 +
209.151 + final BulkPattern[] bulkPattern = new BulkPattern[1];
209.152 + JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
209.153 +
209.154 + public void run(CompilationController parameter) throws Exception {
209.155 + bulkPattern[0] = search.create(parameter, pattern);
209.156 + }
209.157 + }, true);
209.158 +
209.159 + long start = System.currentTimeMillis();
209.160 + JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
209.161 +
209.162 + public void run(CompilationController parameter) throws Exception {
209.163 + if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
209.164 + return;
209.165 +
209.166 + search.match(parameter, new TreePath(parameter.getCompilationUnit()), bulkPattern[0]);
209.167 + }
209.168 + }, true);
209.169 + long end = System.currentTimeMillis();
209.170 +
209.171 + return end - start;
209.172 + }
209.173 +
209.174 + private long[] performIndexingPerformanceTest(List<FileObject> files, final BulkSearch search, final String... pattern) throws IOException {
209.175 + final List<byte[]> index = new LinkedList<byte[]>();
209.176 + long[] result = new long[2];
209.177 + ClasspathInfo cpInfo = Utilities.createUniversalCPInfo();
209.178 +
209.179 + final BulkPattern[] bulkPattern = new BulkPattern[1];
209.180 + JavaSource.create(cpInfo).runUserActionTask(new Task<CompilationController>() {
209.181 +
209.182 + public void run(CompilationController parameter) throws Exception {
209.183 + bulkPattern[0] = search.create(parameter, pattern);
209.184 + }
209.185 + }, true);
209.186 +
209.187 + long start = System.currentTimeMillis();
209.188 + JavaSource.create(cpInfo, files).runUserActionTask(new Task<CompilationController>() {
209.189 +
209.190 + public void run(CompilationController parameter) throws Exception {
209.191 + if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
209.192 + return;
209.193 +
209.194 + ByteArrayOutputStream out = new ByteArrayOutputStream();
209.195 + EncodingContext ec = new EncodingContext(out, false);
209.196 + search.encode(parameter.getCompilationUnit(), ec);
209.197 +
209.198 + index.add(out.toByteArray());
209.199 + }
209.200 + }, true);
209.201 + long end = System.currentTimeMillis();
209.202 +
209.203 + result[0] = end - start;
209.204 +
209.205 + start = System.currentTimeMillis();
209.206 +
209.207 + for (byte[] data : index) {
209.208 + search.matches(new ByteArrayInputStream(data), bulkPattern[0]);
209.209 + }
209.210 +
209.211 + end = System.currentTimeMillis();
209.212 +
209.213 + result[1] = end - start;
209.214 +
209.215 + return result;
209.216 + }
209.217 +
209.218 + private static void gatherFiles(FileObject root, List<FileObject> files) {
209.219 + if ("java".equals(root.getExt())) {
209.220 + files.add(root);
209.221 + }
209.222 +
209.223 + if (root.isFolder()) {
209.224 + for (FileObject c : root.getChildren()) {
209.225 + gatherFiles(c, files);
209.226 + }
209.227 + }
209.228 + }
209.229 +}
210.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
210.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/impl/pm/IndexBulkTest.java Tue Feb 21 22:37:57 2012 +0100
210.3 @@ -0,0 +1,182 @@
210.4 +/*
210.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
210.6 + *
210.7 + * Copyright 2009-2010 Oracle and/or its affiliates. All rights reserved.
210.8 + *
210.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
210.10 + * Other names may be trademarks of their respective owners.
210.11 + *
210.12 + * The contents of this file are subject to the terms of either the GNU
210.13 + * General Public License Version 2 only ("GPL") or the Common
210.14 + * Development and Distribution License("CDDL") (collectively, the
210.15 + * "License"). You may not use this file except in compliance with the
210.16 + * License. You can obtain a copy of the License at
210.17 + * http://www.netbeans.org/cddl-gplv2.html
210.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
210.19 + * specific language governing permissions and limitations under the
210.20 + * License. When distributing the software, include this License Header
210.21 + * Notice in each file and include the License file at
210.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
210.23 + * particular file as subject to the "Classpath" exception as provided
210.24 + * by Oracle in the GPL Version 2 section of the License file that
210.25 + * accompanied this code. If applicable, add the following below the
210.26 + * License Header, with the fields enclosed by brackets [] replaced by
210.27 + * your own identifying information:
210.28 + * "Portions Copyrighted [year] [name of copyright owner]"
210.29 + *
210.30 + * If you wish your version of this file to be governed by only the CDDL
210.31 + * or only the GPL Version 2, indicate your decision by adding
210.32 + * "[Contributor] elects to include this software in this distribution
210.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
210.34 + * single choice of license, a recipient has the option to distribute
210.35 + * your version of this file under either the CDDL, the GPL Version 2 or
210.36 + * to extend the choice of license to its licensees as provided above.
210.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
210.38 + * Version 2 license, then the option applies only if the new code is
210.39 + * made subject to such option by the copyright holder.
210.40 + *
210.41 + * Contributor(s):
210.42 + *
210.43 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
210.44 + */
210.45 +
210.46 +package org.netbeans.modules.jackpot30.impl.pm;
210.47 +
210.48 +import com.sun.source.tree.Tree;
210.49 +import com.sun.source.util.TreePath;
210.50 +import java.io.IOException;
210.51 +import java.io.InputStream;
210.52 +import java.io.Reader;
210.53 +import java.util.Collection;
210.54 +import java.util.Collections;
210.55 +import java.util.Map;
210.56 +import org.apache.lucene.analysis.Analyzer;
210.57 +import org.apache.lucene.analysis.TokenStream;
210.58 +import org.apache.lucene.index.IndexReader;
210.59 +import org.apache.lucene.index.IndexWriter.MaxFieldLength;
210.60 +import org.apache.lucene.store.Directory;
210.61 +import org.apache.lucene.store.RAMDirectory;
210.62 +import org.netbeans.api.java.source.CompilationInfo;
210.63 +import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex;
210.64 +import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
210.65 +import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
210.66 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
210.67 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
210.68 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.EncodingContext;
210.69 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearchTestPerformer;
210.70 +import org.netbeans.modules.java.hints.jackpot.impl.pm.NFABasedBulkSearch;
210.71 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
210.72 +
210.73 +/**
210.74 + *
210.75 + * @author lahvac
210.76 + */
210.77 +public class IndexBulkTest extends BulkSearchTestPerformer {
210.78 +
210.79 + public IndexBulkTest(String name) {
210.80 + super(name);
210.81 + }
210.82 +
210.83 +// public static TestSuite suite() {
210.84 +// NbTestSuite r = new NbTestSuite();
210.85 +//
210.86 +// r.addTest(new NFABasedBulkSearchTest("testField1"));
210.87 +// r.addTest(new NFABasedBulkSearchTest("testField2"));
210.88 +//
210.89 +// return r;
210.90 +// }
210.91 +
210.92 + @Override
210.93 + protected BulkSearch createSearch() {
210.94 + return new BulkSearchImpl(false);
210.95 + }
210.96 +
210.97 + private static class BulkSearchImpl extends BulkSearch {
210.98 +
210.99 + public BulkSearchImpl(boolean requiresLightweightVerification) {
210.100 + super(requiresLightweightVerification);
210.101 + }
210.102 +
210.103 + @Override
210.104 + public Map<String, Collection<TreePath>> match(CompilationInfo info, TreePath toSearch, BulkPattern pattern, Map<String, Long> timeLog) {
210.105 + try {
210.106 + IndexImpl ii = new IndexImpl();
210.107 + IndexWriter writer = ii.openForWriting();
210.108 +
210.109 + writer.record(toSearch.getCompilationUnit().getSourceFile().toUri().toURL(), toSearch.getCompilationUnit(), null);
210.110 + writer.close();
210.111 +
210.112 + if (!ii.findCandidates(pattern).isEmpty()) {
210.113 + return new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog);
210.114 + } else {
210.115 + assertTrue(new NFABasedBulkSearch().match(info, toSearch, pattern, timeLog).isEmpty());
210.116 + return Collections.emptyMap();
210.117 + }
210.118 + } catch (IOException ex) {
210.119 + throw new IllegalStateException(ex);
210.120 + }
210.121 + }
210.122 +
210.123 + @Override
210.124 + public boolean matches(InputStream encoded, BulkPattern pattern) {
210.125 + return new NFABasedBulkSearch().matches(encoded, pattern);
210.126 + }
210.127 +
210.128 + @Override
210.129 + public boolean matches(CompilationInfo info, TreePath toSearch, BulkPattern pattern) {
210.130 + return new NFABasedBulkSearch().matches(info, toSearch, pattern);
210.131 + }
210.132 +
210.133 + @Override
210.134 + public void encode(Tree tree, EncodingContext ctx) {
210.135 + new NFABasedBulkSearch().encode(tree, ctx);
210.136 + }
210.137 +
210.138 + @Override
210.139 + public BulkPattern create(Collection<? extends String> code, Collection<? extends Tree> patterns, Collection<? extends AdditionalQueryConstraints> additionalConstraints) {
210.140 + return new NFABasedBulkSearch().create(code, patterns, additionalConstraints);
210.141 + }
210.142 +
210.143 + @Override
210.144 + public Map<String, Integer> matchesWithFrequencies(InputStream encoded, BulkPattern pattern) {
210.145 + return new NFABasedBulkSearch().matchesWithFrequencies(encoded, pattern);
210.146 + }
210.147 + }
210.148 +
210.149 + private static final class IndexImpl extends AbstractLuceneIndex {
210.150 +
210.151 + private final Directory dir = new RAMDirectory();
210.152 +
210.153 + public IndexImpl() {
210.154 + super(0, false, true);
210.155 + }
210.156 +
210.157 + @Override
210.158 + protected IndexReader createReader() throws IOException {
210.159 + return IndexReader.open(dir, true);
210.160 + }
210.161 +
210.162 + @Override
210.163 + protected org.apache.lucene.index.IndexWriter createWriter() throws IOException {
210.164 + return new org.apache.lucene.index.IndexWriter(dir, new NoAnalyzer(), MaxFieldLength.UNLIMITED);
210.165 + }
210.166 +
210.167 + @Override
210.168 + public IndexInfo getIndexInfo() {
210.169 + return IndexInfo.empty();
210.170 + }
210.171 +
210.172 + @Override
210.173 + protected void storeIndexInfo(IndexInfo info) throws IOException {}
210.174 + }
210.175 +
210.176 + private static final class NoAnalyzer extends Analyzer {
210.177 +
210.178 + @Override
210.179 + public TokenStream tokenStream(String string, Reader reader) {
210.180 + throw new UnsupportedOperationException("Should not be called");
210.181 + }
210.182 +
210.183 + }
210.184 +
210.185 +}
211.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
211.2 +++ b/sandbox/old-modules/api/test/unit/src/org/netbeans/modules/jackpot30/spi/refactoring/JackpotBasedRefactoringTestBase.java Tue Feb 21 22:37:57 2012 +0100
211.3 @@ -0,0 +1,198 @@
211.4 +/*
211.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
211.6 + *
211.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
211.8 + *
211.9 + * The contents of this file are subject to the terms of either the GNU
211.10 + * General Public License Version 2 only ("GPL") or the Common
211.11 + * Development and Distribution License("CDDL") (collectively, the
211.12 + * "License"). You may not use this file except in compliance with the
211.13 + * License. You can obtain a copy of the License at
211.14 + * http://www.netbeans.org/cddl-gplv2.html
211.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
211.16 + * specific language governing permissions and limitations under the
211.17 + * License. When distributing the software, include this License Header
211.18 + * Notice in each file and include the License file at
211.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
211.20 + * particular file as subject to the "Classpath" exception as provided
211.21 + * by Sun in the GPL Version 2 section of the License file that
211.22 + * accompanied this code. If applicable, add the following below the
211.23 + * License Header, with the fields enclosed by brackets [] replaced by
211.24 + * your own identifying information:
211.25 + * "Portions Copyrighted [year] [name of copyright owner]"
211.26 + *
211.27 + * If you wish your version of this file to be governed by only the CDDL
211.28 + * or only the GPL Version 2, indicate your decision by adding
211.29 + * "[Contributor] elects to include this software in this distribution
211.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
211.31 + * single choice of license, a recipient has the option to distribute
211.32 + * your version of this file under either the CDDL, the GPL Version 2 or
211.33 + * to extend the choice of license to its licensees as provided above.
211.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
211.35 + * Version 2 license, then the option applies only if the new code is
211.36 + * made subject to such option by the copyright holder.
211.37 + *
211.38 + * Contributor(s):
211.39 + *
211.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
211.41 + */
211.42 +
211.43 +package org.netbeans.modules.jackpot30.spi.refactoring;
211.44 +
211.45 +import java.io.IOException;
211.46 +import java.util.Collections;
211.47 +import org.netbeans.api.editor.mimelookup.MimePath;
211.48 +import org.netbeans.api.java.classpath.ClassPath;
211.49 +import org.netbeans.api.java.classpath.GlobalPathRegistry;
211.50 +import org.netbeans.api.java.source.SourceUtils;
211.51 +import org.netbeans.api.java.source.SourceUtilsTestUtil;
211.52 +import org.netbeans.api.java.source.TestUtilities;
211.53 +import org.netbeans.api.project.Project;
211.54 +import org.netbeans.api.project.ProjectManager;
211.55 +import org.netbeans.core.startup.Main;
211.56 +import org.netbeans.junit.NbTestCase;
211.57 +import org.netbeans.modules.java.JavaDataLoader;
211.58 +import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
211.59 +import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
211.60 +import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
211.61 +import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
211.62 +import org.netbeans.modules.parsing.impl.indexing.Util;
211.63 +import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
211.64 +import org.netbeans.spi.java.classpath.ClassPathProvider;
211.65 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
211.66 +import org.netbeans.spi.project.ProjectFactory;
211.67 +import org.netbeans.spi.project.ProjectState;
211.68 +import org.openide.filesystems.FileObject;
211.69 +import org.openide.filesystems.FileUtil;
211.70 +import org.openide.util.Lookup;
211.71 +import org.openide.util.lookup.Lookups;
211.72 +import org.openide.util.lookup.ServiceProvider;
211.73 +
211.74 +/**
211.75 + *
211.76 + * @author lahvac
211.77 + */
211.78 +public class JackpotBasedRefactoringTestBase extends NbTestCase {
211.79 +
211.80 + public JackpotBasedRefactoringTestBase(String name) {
211.81 + super(name);
211.82 + }
211.83 +
211.84 + protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
211.85 + for (FileObject c : sourceRoot.getChildren()) {
211.86 + c.delete();
211.87 + }
211.88 +
211.89 + for (File f : files) {
211.90 + FileObject fo = FileUtil.createData(sourceRoot, f.filename);
211.91 + TestUtilities.copyStringToFile(fo, f.content);
211.92 + }
211.93 +
211.94 + SourceUtils.waitScanFinished();
211.95 + }
211.96 +
211.97 + protected static void assertContent(FileObject sourceRoot, File... files) throws Exception {
211.98 + for (File f : files) {
211.99 + FileObject fo = sourceRoot.getFileObject(f.filename);
211.100 +
211.101 + assertNotNull(f.filename, fo);
211.102 +
211.103 + assertEquals(f.content.replaceAll("[ \t\n]+", " "), TestUtilities.copyFileToString(FileUtil.toFile(fo)).replaceAll("[ \t\n]+", " "));
211.104 + }
211.105 + }
211.106 +
211.107 + protected static final class File {
211.108 + public final String filename;
211.109 + public final String content;
211.110 +
211.111 + public File(String filename, String content) {
211.112 + this.filename = filename;
211.113 + this.content = content;
211.114 + }
211.115 + }
211.116 +
211.117 + protected FileObject src;
211.118 + protected Project prj;
211.119 +
211.120 + @Override
211.121 + protected void setUp() throws Exception {
211.122 + SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[] {
211.123 + new ClassPathProvider() {
211.124 + public ClassPath findClassPath(FileObject file, String type) {
211.125 + if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
211.126 + if (ClassPath.BOOT.equals(type)) {
211.127 + return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
211.128 + }
211.129 + if (ClassPath.COMPILE.equals(type)) {
211.130 + return ClassPathSupport.createClassPath(new FileObject[0]);
211.131 + }
211.132 + if (ClassPath.SOURCE.equals(type)) {
211.133 + return ClassPathSupport.createClassPath(src);
211.134 + }
211.135 + }
211.136 +
211.137 + return null;
211.138 + }
211.139 + },
211.140 + new ProjectFactory() {
211.141 + public boolean isProject(FileObject projectDirectory) {
211.142 + return src == projectDirectory;
211.143 + }
211.144 + public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
211.145 + if (!isProject(projectDirectory)) return null;
211.146 + return new Project() {
211.147 + public FileObject getProjectDirectory() {
211.148 + return projectDirectory;
211.149 + }
211.150 + public Lookup getLookup() {
211.151 + return Lookup.EMPTY;
211.152 + }
211.153 + };
211.154 + }
211.155 + public void saveProject(Project project) throws IOException, ClassCastException {}
211.156 + },
211.157 + JavaDataLoader.getLoader(JavaDataLoader.class),
211.158 + });
211.159 + Main.initializeURLFactory();
211.160 + org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
211.161 + prepareTest();
211.162 + org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
211.163 + MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
211.164 + GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
211.165 + RepositoryUpdater.getDefault().start(true);
211.166 + super.setUp();
211.167 + }
211.168 +
211.169 + @Override
211.170 + protected void tearDown() throws Exception {
211.171 + super.tearDown();
211.172 + org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
211.173 + prj = null;
211.174 + }
211.175 +
211.176 + private void prepareTest() throws Exception {
211.177 + FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
211.178 +
211.179 + src = FileUtil.createFolder(workdir, "src");
211.180 +
211.181 + FileObject cache = FileUtil.createFolder(workdir, "cache");
211.182 +
211.183 + CacheFolder.setCacheFolder(cache);
211.184 + }
211.185 +
211.186 + @ServiceProvider(service=MimeDataProvider.class)
211.187 + public static final class MimeDataProviderImpl implements MimeDataProvider {
211.188 +
211.189 + private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
211.190 +
211.191 + public Lookup getLookup(MimePath mimePath) {
211.192 + if ("text/x-java".equals(mimePath.getPath())) {
211.193 + return L;
211.194 + }
211.195 +
211.196 + return null;
211.197 + }
211.198 +
211.199 + }
211.200 +
211.201 +}
212.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
212.2 +++ b/sandbox/old-modules/bridges/refactoring/build.xml Tue Feb 21 22:37:57 2012 +0100
212.3 @@ -0,0 +1,9 @@
212.4 +<?xml version="1.0" encoding="UTF-8"?>
212.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
212.6 +<!-- for some information on what you could do (e.g. targets to override). -->
212.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
212.8 +<project name="org.netbeans.modules.jackpot30.refactoring" default="netbeans" basedir=".">
212.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.refactoring.</description>
212.10 + <import file="nbproject/build-impl.xml"/>
212.11 + <import file="${suite.dir}/findbugs-import.xml"/>
212.12 +</project>
213.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
213.2 +++ b/sandbox/old-modules/bridges/refactoring/manifest.mf Tue Feb 21 22:37:57 2012 +0100
213.3 @@ -0,0 +1,6 @@
213.4 +Manifest-Version: 1.0
213.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.refactoring
213.6 +OpenIDE-Module-Implementation-Version: 1
213.7 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/refactoring/layer.xml
213.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/refactoring/Bundle.properties
213.9 +
214.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
214.2 +++ b/sandbox/old-modules/bridges/refactoring/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
214.3 @@ -0,0 +1,45 @@
214.4 +<?xml version="1.0" encoding="UTF-8"?>
214.5 +<!--
214.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
214.7 +*** EDIT ../build.xml INSTEAD ***
214.8 +-->
214.9 +<project name="org.netbeans.modules.jackpot30.refactoring-impl" basedir="..">
214.10 + <fail message="Please build using Ant 1.7.1 or higher.">
214.11 + <condition>
214.12 + <not>
214.13 + <antversion atleast="1.7.1"/>
214.14 + </not>
214.15 + </condition>
214.16 + </fail>
214.17 + <property file="nbproject/private/suite-private.properties"/>
214.18 + <property file="nbproject/suite.properties"/>
214.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
214.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
214.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
214.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
214.23 + <attribute name="name"/>
214.24 + <attribute name="value"/>
214.25 + <sequential>
214.26 + <property name="@{name}" value="${@{value}}"/>
214.27 + </sequential>
214.28 + </macrodef>
214.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
214.30 + <attribute name="property"/>
214.31 + <attribute name="value"/>
214.32 + <sequential>
214.33 + <property name="@{property}" value="@{value}"/>
214.34 + </sequential>
214.35 + </macrodef>
214.36 + <property file="${user.properties.file}"/>
214.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
214.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
214.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
214.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
214.41 + <condition>
214.42 + <not>
214.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
214.44 + </not>
214.45 + </condition>
214.46 + </fail>
214.47 + <import file="${harness.dir}/build.xml"/>
214.48 +</project>
215.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
215.2 +++ b/sandbox/old-modules/bridges/refactoring/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
215.3 @@ -0,0 +1,8 @@
215.4 +build.xml.data.CRC32=46e4f14a
215.5 +build.xml.script.CRC32=4a0f84c4
215.6 +build.xml.stylesheet.CRC32=79c3b980@1.39
215.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
215.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
215.9 +nbproject/build-impl.xml.data.CRC32=2e452477
215.10 +nbproject/build-impl.xml.script.CRC32=fd9920c9
215.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.49
216.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
216.2 +++ b/sandbox/old-modules/bridges/refactoring/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
216.3 @@ -0,0 +1,4 @@
216.4 +is.eager=true
216.5 +javac.source=1.6
216.6 +javac.compilerargs=-Xlint -Xlint:-serial
216.7 +spec.version.base=1.16.0
217.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
217.2 +++ b/sandbox/old-modules/bridges/refactoring/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
217.3 @@ -0,0 +1,199 @@
217.4 +<?xml version="1.0" encoding="UTF-8"?>
217.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
217.6 + <type>org.netbeans.modules.apisupport.project</type>
217.7 + <configuration>
217.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
217.9 + <code-name-base>org.netbeans.modules.jackpot30.refactoring</code-name-base>
217.10 + <suite-component/>
217.11 + <module-dependencies>
217.12 + <dependency>
217.13 + <code-name-base>org.netbeans.api.annotations.common</code-name-base>
217.14 + <build-prerequisite/>
217.15 + <compile-dependency/>
217.16 + <run-dependency>
217.17 + <release-version>1</release-version>
217.18 + <specification-version>1.4</specification-version>
217.19 + </run-dependency>
217.20 + </dependency>
217.21 + <dependency>
217.22 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
217.23 + <build-prerequisite/>
217.24 + <compile-dependency/>
217.25 + <run-dependency>
217.26 + <release-version>1</release-version>
217.27 + <specification-version>1.24</specification-version>
217.28 + </run-dependency>
217.29 + </dependency>
217.30 + <dependency>
217.31 + <code-name-base>org.netbeans.libs.javacapi</code-name-base>
217.32 + <build-prerequisite/>
217.33 + <compile-dependency/>
217.34 + <run-dependency>
217.35 + <specification-version>0.12.0.1</specification-version>
217.36 + </run-dependency>
217.37 + </dependency>
217.38 + <dependency>
217.39 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
217.40 + <build-prerequisite/>
217.41 + <compile-dependency/>
217.42 + <run-dependency>
217.43 + <specification-version>1.12</specification-version>
217.44 + </run-dependency>
217.45 + </dependency>
217.46 + <dependency>
217.47 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
217.48 + <build-prerequisite/>
217.49 + <compile-dependency/>
217.50 + <run-dependency>
217.51 + <release-version>1</release-version>
217.52 + <implementation-version/>
217.53 + </run-dependency>
217.54 + </dependency>
217.55 + <dependency>
217.56 + <code-name-base>org.netbeans.modules.java.source</code-name-base>
217.57 + <build-prerequisite/>
217.58 + <compile-dependency/>
217.59 + <run-dependency>
217.60 + <specification-version>0.57.0.9.8.4</specification-version>
217.61 + </run-dependency>
217.62 + </dependency>
217.63 + <dependency>
217.64 + <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
217.65 + <build-prerequisite/>
217.66 + <compile-dependency/>
217.67 + <run-dependency>
217.68 + <release-version>1</release-version>
217.69 + <specification-version>1.26.0.1.19</specification-version>
217.70 + </run-dependency>
217.71 + </dependency>
217.72 + <dependency>
217.73 + <code-name-base>org.netbeans.modules.queries</code-name-base>
217.74 + <build-prerequisite/>
217.75 + <compile-dependency/>
217.76 + <run-dependency>
217.77 + <release-version>1</release-version>
217.78 + <specification-version>1.18</specification-version>
217.79 + </run-dependency>
217.80 + </dependency>
217.81 + <dependency>
217.82 + <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
217.83 + <build-prerequisite/>
217.84 + <compile-dependency/>
217.85 + <run-dependency>
217.86 + <specification-version>1.10</specification-version>
217.87 + </run-dependency>
217.88 + </dependency>
217.89 + <dependency>
217.90 + <code-name-base>org.netbeans.modules.refactoring.java</code-name-base>
217.91 + <build-prerequisite/>
217.92 + <compile-dependency/>
217.93 + <run-dependency>
217.94 + <release-version>1</release-version>
217.95 + <implementation-version/>
217.96 + </run-dependency>
217.97 + </dependency>
217.98 + <dependency>
217.99 + <code-name-base>org.openide.awt</code-name-base>
217.100 + <build-prerequisite/>
217.101 + <compile-dependency/>
217.102 + <run-dependency>
217.103 + <specification-version>7.23</specification-version>
217.104 + </run-dependency>
217.105 + </dependency>
217.106 + <dependency>
217.107 + <code-name-base>org.openide.filesystems</code-name-base>
217.108 + <build-prerequisite/>
217.109 + <compile-dependency/>
217.110 + <run-dependency>
217.111 + <specification-version>7.36</specification-version>
217.112 + </run-dependency>
217.113 + </dependency>
217.114 + <dependency>
217.115 + <code-name-base>org.openide.loaders</code-name-base>
217.116 + <build-prerequisite/>
217.117 + <compile-dependency/>
217.118 + <run-dependency>
217.119 + <specification-version>7.16</specification-version>
217.120 + </run-dependency>
217.121 + </dependency>
217.122 + <dependency>
217.123 + <code-name-base>org.openide.nodes</code-name-base>
217.124 + <build-prerequisite/>
217.125 + <compile-dependency/>
217.126 + <run-dependency>
217.127 + <specification-version>7.16</specification-version>
217.128 + </run-dependency>
217.129 + </dependency>
217.130 + <dependency>
217.131 + <code-name-base>org.openide.text</code-name-base>
217.132 + <build-prerequisite/>
217.133 + <compile-dependency/>
217.134 + <run-dependency>
217.135 + <specification-version>6.29</specification-version>
217.136 + </run-dependency>
217.137 + </dependency>
217.138 + <dependency>
217.139 + <code-name-base>org.openide.util</code-name-base>
217.140 + <build-prerequisite/>
217.141 + <compile-dependency/>
217.142 + <run-dependency>
217.143 + <specification-version>8.2</specification-version>
217.144 + </run-dependency>
217.145 + </dependency>
217.146 + <dependency>
217.147 + <code-name-base>org.openide.util.lookup</code-name-base>
217.148 + <build-prerequisite/>
217.149 + <compile-dependency/>
217.150 + <run-dependency>
217.151 + <specification-version>8.2</specification-version>
217.152 + </run-dependency>
217.153 + </dependency>
217.154 + <dependency>
217.155 + <code-name-base>org.openide.windows</code-name-base>
217.156 + <build-prerequisite/>
217.157 + <compile-dependency/>
217.158 + <run-dependency>
217.159 + <specification-version>6.33</specification-version>
217.160 + </run-dependency>
217.161 + </dependency>
217.162 + </module-dependencies>
217.163 + <test-dependencies>
217.164 + <test-type>
217.165 + <name>unit</name>
217.166 + <test-dependency>
217.167 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
217.168 + <compile-dependency/>
217.169 + </test-dependency>
217.170 + <test-dependency>
217.171 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
217.172 + <recursive/>
217.173 + <compile-dependency/>
217.174 + <test/>
217.175 + </test-dependency>
217.176 + <test-dependency>
217.177 + <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
217.178 + <compile-dependency/>
217.179 + </test-dependency>
217.180 + <test-dependency>
217.181 + <code-name-base>org.netbeans.modules.java.hints.declarative</code-name-base>
217.182 + <compile-dependency/>
217.183 + </test-dependency>
217.184 + <test-dependency>
217.185 + <code-name-base>org.netbeans.modules.junit</code-name-base>
217.186 + <compile-dependency/>
217.187 + </test-dependency>
217.188 + <test-dependency>
217.189 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
217.190 + <recursive/>
217.191 + <compile-dependency/>
217.192 + </test-dependency>
217.193 + <test-dependency>
217.194 + <code-name-base>org.netbeans.modules.projectui</code-name-base>
217.195 + <compile-dependency/>
217.196 + </test-dependency>
217.197 + </test-type>
217.198 + </test-dependencies>
217.199 + <public-packages/>
217.200 + </data>
217.201 + </configuration>
217.202 +</project>
218.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
218.2 +++ b/sandbox/old-modules/bridges/refactoring/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
218.3 @@ -0,0 +1,1 @@
218.4 +suite.dir=${basedir}/../..
219.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
219.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
219.3 @@ -0,0 +1,4 @@
219.4 +OpenIDE-Module-Name=Jackpot 3.0 Refactoring Bridge
219.5 +GenerateScriptPanel.generate.text=Generate Jackpot script for automatic upgrade
219.6 +GenerateScriptPanel.makePrivate.text=Make existing element private
219.7 +GenerateScriptPanel.deprecate.text=Deprecate existing element
220.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
220.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ExtraData.java Tue Feb 21 22:37:57 2012 +0100
220.3 @@ -0,0 +1,58 @@
220.4 +/*
220.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
220.6 + *
220.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
220.8 + *
220.9 + * The contents of this file are subject to the terms of either the GNU
220.10 + * General Public License Version 2 only ("GPL") or the Common
220.11 + * Development and Distribution License("CDDL") (collectively, the
220.12 + * "License"). You may not use this file except in compliance with the
220.13 + * License. You can obtain a copy of the License at
220.14 + * http://www.netbeans.org/cddl-gplv2.html
220.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
220.16 + * specific language governing permissions and limitations under the
220.17 + * License. When distributing the software, include this License Header
220.18 + * Notice in each file and include the License file at
220.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
220.20 + * particular file as subject to the "Classpath" exception as provided
220.21 + * by Sun in the GPL Version 2 section of the License file that
220.22 + * accompanied this code. If applicable, add the following below the
220.23 + * License Header, with the fields enclosed by brackets [] replaced by
220.24 + * your own identifying information:
220.25 + * "Portions Copyrighted [year] [name of copyright owner]"
220.26 + *
220.27 + * If you wish your version of this file to be governed by only the CDDL
220.28 + * or only the GPL Version 2, indicate your decision by adding
220.29 + * "[Contributor] elects to include this software in this distribution
220.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
220.31 + * single choice of license, a recipient has the option to distribute
220.32 + * your version of this file under either the CDDL, the GPL Version 2 or
220.33 + * to extend the choice of license to its licensees as provided above.
220.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
220.35 + * Version 2 license, then the option applies only if the new code is
220.36 + * made subject to such option by the copyright holder.
220.37 + *
220.38 + * Contributor(s):
220.39 + *
220.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
220.41 + */
220.42 +
220.43 +package org.netbeans.modules.jackpot30.refactoring;
220.44 +
220.45 +/**
220.46 + *
220.47 + * @author lahvac
220.48 + */
220.49 +public final class ExtraData {
220.50 +
220.51 + public final boolean generateUpgradeScript;
220.52 + public final boolean makeOriginalPrivate;
220.53 + public final boolean makeOriginalDeprecated;
220.54 +
220.55 + public ExtraData(boolean generateUpgradeScript, boolean makeOriginalPrivate, boolean makeOriginalDeprecated) {
220.56 + this.generateUpgradeScript = generateUpgradeScript;
220.57 + this.makeOriginalPrivate = makeOriginalPrivate;
220.58 + this.makeOriginalDeprecated = makeOriginalDeprecated;
220.59 + }
220.60 +
220.61 +}
221.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
221.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.form Tue Feb 21 22:37:57 2012 +0100
221.3 @@ -0,0 +1,77 @@
221.4 +<?xml version="1.0" encoding="UTF-8" ?>
221.5 +
221.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
221.7 + <AuxValues>
221.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
221.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
221.10 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
221.11 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
221.12 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
221.13 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
221.14 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
221.15 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
221.16 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
221.17 + </AuxValues>
221.18 +
221.19 + <Layout>
221.20 + <DimensionLayout dim="0">
221.21 + <Group type="103" groupAlignment="0" attributes="0">
221.22 + <Group type="102" attributes="0">
221.23 + <Group type="103" groupAlignment="0" attributes="0">
221.24 + <Group type="102" alignment="0" attributes="0">
221.25 + <EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
221.26 + <Group type="103" groupAlignment="0" attributes="0">
221.27 + <Component id="deprecate" alignment="0" min="-2" max="-2" attributes="0"/>
221.28 + <Component id="makePrivate" alignment="0" min="-2" max="-2" attributes="0"/>
221.29 + </Group>
221.30 + </Group>
221.31 + <Group type="102" alignment="0" attributes="0">
221.32 + <EmptySpace max="-2" attributes="0"/>
221.33 + <Component id="generate" min="-2" max="-2" attributes="0"/>
221.34 + </Group>
221.35 + </Group>
221.36 + <EmptySpace pref="79" max="32767" attributes="0"/>
221.37 + </Group>
221.38 + </Group>
221.39 + </DimensionLayout>
221.40 + <DimensionLayout dim="1">
221.41 + <Group type="103" groupAlignment="0" attributes="0">
221.42 + <Group type="102" alignment="0" attributes="0">
221.43 + <EmptySpace max="-2" attributes="0"/>
221.44 + <Component id="generate" min="-2" max="-2" attributes="0"/>
221.45 + <EmptySpace max="-2" attributes="0"/>
221.46 + <Component id="makePrivate" min="-2" max="-2" attributes="0"/>
221.47 + <EmptySpace max="-2" attributes="0"/>
221.48 + <Component id="deprecate" min="-2" max="-2" attributes="0"/>
221.49 + <EmptySpace pref="223" max="32767" attributes="0"/>
221.50 + </Group>
221.51 + </Group>
221.52 + </DimensionLayout>
221.53 + </Layout>
221.54 + <SubComponents>
221.55 + <Component class="javax.swing.JCheckBox" name="generate">
221.56 + <Properties>
221.57 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
221.58 + <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.generate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
221.59 + </Property>
221.60 + </Properties>
221.61 + <Events>
221.62 + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateActionPerformed"/>
221.63 + </Events>
221.64 + </Component>
221.65 + <Component class="javax.swing.JCheckBox" name="makePrivate">
221.66 + <Properties>
221.67 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
221.68 + <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.makePrivate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
221.69 + </Property>
221.70 + </Properties>
221.71 + </Component>
221.72 + <Component class="javax.swing.JCheckBox" name="deprecate">
221.73 + <Properties>
221.74 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
221.75 + <ResourceString bundle="org/netbeans/modules/jackpot30/refactoring/Bundle.properties" key="GenerateScriptPanel.deprecate.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
221.76 + </Property>
221.77 + </Properties>
221.78 + </Component>
221.79 + </SubComponents>
221.80 +</Form>
222.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
222.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/GenerateScriptPanel.java Tue Feb 21 22:37:57 2012 +0100
222.3 @@ -0,0 +1,174 @@
222.4 +/*
222.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
222.6 + *
222.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
222.8 + *
222.9 + * The contents of this file are subject to the terms of either the GNU
222.10 + * General Public License Version 2 only ("GPL") or the Common
222.11 + * Development and Distribution License("CDDL") (collectively, the
222.12 + * "License"). You may not use this file except in compliance with the
222.13 + * License. You can obtain a copy of the License at
222.14 + * http://www.netbeans.org/cddl-gplv2.html
222.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
222.16 + * specific language governing permissions and limitations under the
222.17 + * License. When distributing the software, include this License Header
222.18 + * Notice in each file and include the License file at
222.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
222.20 + * particular file as subject to the "Classpath" exception as provided
222.21 + * by Sun in the GPL Version 2 section of the License file that
222.22 + * accompanied this code. If applicable, add the following below the
222.23 + * License Header, with the fields enclosed by brackets [] replaced by
222.24 + * your own identifying information:
222.25 + * "Portions Copyrighted [year] [name of copyright owner]"
222.26 + *
222.27 + * If you wish your version of this file to be governed by only the CDDL
222.28 + * or only the GPL Version 2, indicate your decision by adding
222.29 + * "[Contributor] elects to include this software in this distribution
222.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
222.31 + * single choice of license, a recipient has the option to distribute
222.32 + * your version of this file under either the CDDL, the GPL Version 2 or
222.33 + * to extend the choice of license to its licensees as provided above.
222.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
222.35 + * Version 2 license, then the option applies only if the new code is
222.36 + * made subject to such option by the copyright holder.
222.37 + *
222.38 + * Contributor(s):
222.39 + *
222.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
222.41 + */
222.42 +package org.netbeans.modules.jackpot30.refactoring;
222.43 +
222.44 +import java.util.prefs.Preferences;
222.45 +import org.openide.util.NbPreferences;
222.46 +
222.47 +/**
222.48 + *
222.49 + * @author lahvac
222.50 + */
222.51 +public class GenerateScriptPanel extends javax.swing.JPanel {
222.52 +
222.53 + private final boolean supported;
222.54 +
222.55 + public GenerateScriptPanel(boolean supported) {
222.56 + this.supported = supported;
222.57 + initComponents();
222.58 + loadDefaults();
222.59 + }
222.60 +
222.61 + /** This method is called from within the constructor to
222.62 + * initialize the form.
222.63 + * WARNING: Do NOT modify this code. The content of this method is
222.64 + * always regenerated by the Form Editor.
222.65 + */
222.66 + @SuppressWarnings("unchecked")
222.67 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
222.68 + private void initComponents() {
222.69 +
222.70 + generate = new javax.swing.JCheckBox();
222.71 + makePrivate = new javax.swing.JCheckBox();
222.72 + deprecate = new javax.swing.JCheckBox();
222.73 +
222.74 + generate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.generate.text")); // NOI18N
222.75 + generate.addActionListener(new java.awt.event.ActionListener() {
222.76 + public void actionPerformed(java.awt.event.ActionEvent evt) {
222.77 + generateActionPerformed(evt);
222.78 + }
222.79 + });
222.80 +
222.81 + makePrivate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.makePrivate.text")); // NOI18N
222.82 +
222.83 + deprecate.setText(org.openide.util.NbBundle.getMessage(GenerateScriptPanel.class, "GenerateScriptPanel.deprecate.text")); // NOI18N
222.84 +
222.85 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
222.86 + this.setLayout(layout);
222.87 + layout.setHorizontalGroup(
222.88 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222.89 + .addGroup(layout.createSequentialGroup()
222.90 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222.91 + .addGroup(layout.createSequentialGroup()
222.92 + .addGap(29, 29, 29)
222.93 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222.94 + .addComponent(deprecate)
222.95 + .addComponent(makePrivate)))
222.96 + .addGroup(layout.createSequentialGroup()
222.97 + .addContainerGap()
222.98 + .addComponent(generate)))
222.99 + .addContainerGap(79, Short.MAX_VALUE))
222.100 + );
222.101 + layout.setVerticalGroup(
222.102 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222.103 + .addGroup(layout.createSequentialGroup()
222.104 + .addContainerGap()
222.105 + .addComponent(generate)
222.106 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
222.107 + .addComponent(makePrivate)
222.108 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
222.109 + .addComponent(deprecate)
222.110 + .addContainerGap(223, Short.MAX_VALUE))
222.111 + );
222.112 + }// </editor-fold>//GEN-END:initComponents
222.113 +
222.114 + private void generateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateActionPerformed
222.115 + updateState();
222.116 + }//GEN-LAST:event_generateActionPerformed
222.117 +
222.118 + private static final String KEY_DO_GENERATE_SCRIPT = "generate-script";
222.119 + private static final boolean DEF_DO_GENERATE_SCRIPT = true;
222.120 + private static final String KEY_MAKE_PRIVATE = "make-private";
222.121 + private static final boolean DEF_MAKE_PRIVATE = true;
222.122 + private static final String KEY_DEPRECATE = "deprecate";
222.123 + private static final boolean DEF_DEPRECATE = false;
222.124 +
222.125 + private Preferences getPreferencesStorage() {
222.126 + return NbPreferences.forModule(GenerateScriptPanel.class).node(GenerateScriptPanel.class.getSimpleName());
222.127 + }
222.128 +
222.129 + private void loadDefaults() {
222.130 + if (supported) {
222.131 + Preferences p = getPreferencesStorage();
222.132 + generate.setSelected(p.getBoolean(KEY_DO_GENERATE_SCRIPT, DEF_DO_GENERATE_SCRIPT));
222.133 + makePrivate.setSelected(p.getBoolean(KEY_MAKE_PRIVATE, DEF_MAKE_PRIVATE));
222.134 + deprecate.setSelected(p.getBoolean(KEY_DEPRECATE, DEF_DEPRECATE));
222.135 + } else {
222.136 + generate.setSelected(false);
222.137 + makePrivate.setSelected(false);
222.138 + deprecate.setSelected(false);
222.139 + }
222.140 +
222.141 + updateState();
222.142 + }
222.143 +
222.144 + public void saveDefaults() {
222.145 + Preferences p = getPreferencesStorage();
222.146 + boolean doGenerate = generate.isSelected();
222.147 +
222.148 + p.putBoolean(KEY_DO_GENERATE_SCRIPT, doGenerate);
222.149 +
222.150 + if (doGenerate) {
222.151 + p.putBoolean(KEY_MAKE_PRIVATE, makePrivate.isSelected());
222.152 + p.putBoolean(KEY_DEPRECATE, deprecate.isSelected());
222.153 + }
222.154 + }
222.155 +
222.156 + private void updateState() {
222.157 + if (supported) {
222.158 + generate.setEnabled(true);
222.159 + makePrivate.setEnabled(generate.isSelected());
222.160 + deprecate.setEnabled(generate.isSelected());
222.161 + } else {
222.162 + generate.setEnabled(false);
222.163 + makePrivate.setEnabled(false);
222.164 + deprecate.setEnabled(false);
222.165 + }
222.166 + }
222.167 +
222.168 + // Variables declaration - do not modify//GEN-BEGIN:variables
222.169 + private javax.swing.JCheckBox deprecate;
222.170 + private javax.swing.JCheckBox generate;
222.171 + private javax.swing.JCheckBox makePrivate;
222.172 + // End of variables declaration//GEN-END:variables
222.173 +
222.174 + public ExtraData getData() {
222.175 + return new ExtraData(generate.isSelected(), makePrivate.isSelected(), deprecate.isSelected());
222.176 + }
222.177 +}
223.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
223.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringActionsProviderExt.java Tue Feb 21 22:37:57 2012 +0100
223.3 @@ -0,0 +1,238 @@
223.4 +/*
223.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
223.6 + *
223.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
223.8 + *
223.9 + * The contents of this file are subject to the terms of either the GNU
223.10 + * General Public License Version 2 only ("GPL") or the Common
223.11 + * Development and Distribution License("CDDL") (collectively, the
223.12 + * "License"). You may not use this file except in compliance with the
223.13 + * License. You can obtain a copy of the License at
223.14 + * http://www.netbeans.org/cddl-gplv2.html
223.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
223.16 + * specific language governing permissions and limitations under the
223.17 + * License. When distributing the software, include this License Header
223.18 + * Notice in each file and include the License file at
223.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
223.20 + * particular file as subject to the "Classpath" exception as provided
223.21 + * by Sun in the GPL Version 2 section of the License file that
223.22 + * accompanied this code. If applicable, add the following below the
223.23 + * License Header, with the fields enclosed by brackets [] replaced by
223.24 + * your own identifying information:
223.25 + * "Portions Copyrighted [year] [name of copyright owner]"
223.26 + *
223.27 + * If you wish your version of this file to be governed by only the CDDL
223.28 + * or only the GPL Version 2, indicate your decision by adding
223.29 + * "[Contributor] elects to include this software in this distribution
223.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
223.31 + * single choice of license, a recipient has the option to distribute
223.32 + * your version of this file under either the CDDL, the GPL Version 2 or
223.33 + * to extend the choice of license to its licensees as provided above.
223.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
223.35 + * Version 2 license, then the option applies only if the new code is
223.36 + * made subject to such option by the copyright holder.
223.37 + *
223.38 + * Contributor(s):
223.39 + *
223.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
223.41 + */
223.42 +package org.netbeans.modules.jackpot30.refactoring;
223.43 +
223.44 +import java.util.Collection;
223.45 +import java.util.HashSet;
223.46 +import java.util.logging.Logger;
223.47 +import javax.lang.model.element.Element;
223.48 +import javax.lang.model.element.ElementKind;
223.49 +import javax.lang.model.element.ExecutableElement;
223.50 +import javax.lang.model.element.VariableElement;
223.51 +import javax.lang.model.type.TypeKind;
223.52 +import org.netbeans.api.java.source.CompilationInfo;
223.53 +import org.netbeans.api.java.source.TreePathHandle;
223.54 +import org.netbeans.api.java.source.ui.ScanDialog;
223.55 +import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringUI;
223.56 +import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringUI;
223.57 +import org.netbeans.modules.refactoring.api.RenameRefactoring;
223.58 +import org.netbeans.modules.refactoring.java.RefactoringUtils;
223.59 +import org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider;
223.60 +import org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider;
223.61 +import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
223.62 +import org.openide.cookies.EditorCookie;
223.63 +import org.openide.filesystems.FileObject;
223.64 +import org.openide.loaders.DataObject;
223.65 +import org.openide.nodes.Node;
223.66 +import org.openide.text.CloneableEditorSupport;
223.67 +import org.openide.util.Lookup;
223.68 +import org.openide.util.lookup.ServiceProvider;
223.69 +import org.openide.windows.TopComponent;
223.70 +
223.71 +
223.72 +/**
223.73 + *
223.74 + * @author lahvac
223.75 + */
223.76 +@ServiceProvider(service=ActionsImplementationProvider.class, supersedes="org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider")
223.77 +public class RefactoringActionsProviderExt extends RefactoringActionsProvider {
223.78 +
223.79 + private static RefactoringUI doReplaceConstructorImpl(TreePathHandle selectedElement, CompilationInfo info) {
223.80 + Element selected = selectedElement.resolveElement(info);
223.81 + if (selected==null) {
223.82 +// logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
223.83 + return null;
223.84 + }
223.85 + if (selected.getKind() == ElementKind.CONSTRUCTOR) {
223.86 + return new ReplaceConstructorRefactoringUI(selectedElement);
223.87 + }
223.88 +
223.89 + return null;
223.90 + }
223.91 +
223.92 + public static void doReplaceConstructor(final Lookup lookup) {
223.93 + Runnable task;
223.94 + EditorCookie ec = lookup.lookup(EditorCookie.class);
223.95 + if (isFromEditor(ec)) {
223.96 + task = new TextComponentTask(ec) {
223.97 + @Override
223.98 + protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
223.99 + return doReplaceConstructorImpl(selectedElement, info);
223.100 + }
223.101 + };
223.102 + } else {
223.103 + task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
223.104 +
223.105 + RefactoringUI ui;
223.106 +
223.107 + @Override
223.108 + protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
223.109 + ui = doReplaceConstructorImpl(handle, javac);
223.110 + }
223.111 +
223.112 + @Override
223.113 + protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
223.114 + return ui;
223.115 + }
223.116 +
223.117 + };
223.118 + }
223.119 +
223.120 + ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
223.121 + }
223.122 +
223.123 + private static RefactoringUI doInvertBooleanImpl(TreePathHandle selectedElement, CompilationInfo info) {
223.124 + Element selected = selectedElement.resolveElement(info);
223.125 + if (selected==null) {
223.126 +// logger().log(Level.INFO, "doRename: " + selectedElement, new NullPointerException("selected")); // NOI18N
223.127 + return null;
223.128 + }
223.129 + if (selected.getKind().isField() && ((VariableElement) selected).asType().getKind() == TypeKind.BOOLEAN) {
223.130 + return new InvertBooleanRefactoringUI(selectedElement, ((VariableElement) selected).getSimpleName().toString());
223.131 + }
223.132 + if (selected.getKind() == ElementKind.METHOD && ((ExecutableElement) selected).getReturnType().getKind() == TypeKind.BOOLEAN) {
223.133 + return new InvertBooleanRefactoringUI(selectedElement, ((ExecutableElement) selected).getSimpleName().toString());
223.134 + }
223.135 +
223.136 + return null;
223.137 + }
223.138 +
223.139 + public static void doInvertBoolean(final Lookup lookup) {
223.140 + Runnable task;
223.141 + EditorCookie ec = lookup.lookup(EditorCookie.class);
223.142 + if (isFromEditor(ec)) {
223.143 + task = new TextComponentTask(ec) {
223.144 + @Override
223.145 + protected RefactoringUI createRefactoringUI(TreePathHandle selectedElement,int startOffset,int endOffset, final CompilationInfo info) {
223.146 + return doInvertBooleanImpl(selectedElement, info);
223.147 + }
223.148 + };
223.149 + } else {
223.150 + task = new TreePathHandleTask(new HashSet<Node>(lookup.lookupAll(Node.class)), true) {
223.151 +
223.152 + RefactoringUI ui;
223.153 +
223.154 + @Override
223.155 + protected void treePathHandleResolved(TreePathHandle handle, CompilationInfo javac) {
223.156 + ui = doInvertBooleanImpl(handle, javac);
223.157 + }
223.158 +
223.159 + @Override
223.160 + protected RefactoringUI createRefactoringUI(Collection<TreePathHandle> handles) {
223.161 + return ui;
223.162 + }
223.163 +
223.164 + };
223.165 + }
223.166 +
223.167 + ScanDialog.runWhenScanFinished(task, "Remove Constructor");//getActionName(RefactoringActionsFactory.renameAction()));
223.168 + }
223.169 +
223.170 +// static String getActionName(Action action) {
223.171 +// String arg = (String) action.getValue(Action.NAME);
223.172 +// arg = arg.replace("&", ""); // NOI18N
223.173 +// return arg.replace("...", ""); // NOI18N
223.174 +// }
223.175 +
223.176 +
223.177 + public static boolean canReplaceConstructor(Lookup lookup) {
223.178 + return canRefactor(lookup);
223.179 + }
223.180 +
223.181 + public static boolean canInvertBoolean(Lookup lookup) {
223.182 + return canRefactor(lookup);
223.183 + }
223.184 +
223.185 + private static boolean canRefactor(Lookup lookup) {
223.186 + Collection<? extends Node> nodes = new HashSet<Node>(lookup.lookupAll(Node.class));
223.187 + if(nodes.size() != 1)
223.188 + return false;
223.189 + Node node = nodes.iterator().next();
223.190 + TreePathHandle tph = node.getLookup().lookup(TreePathHandle.class);
223.191 + if (tph != null) {
223.192 + return RefactoringUtils.isRefactorable(tph.getFileObject());
223.193 + }
223.194 + DataObject dObj = node.getCookie(DataObject.class);
223.195 + if(null == dObj)
223.196 + return false;
223.197 + FileObject fileObj = dObj.getPrimaryFile();
223.198 + if(null == fileObj || !RefactoringUtils.isRefactorable(fileObj))
223.199 + return false;
223.200 +
223.201 + EditorCookie ec = lookup.lookup(EditorCookie.class);
223.202 + if (isFromEditor(ec)) {
223.203 + return true;
223.204 + }
223.205 + return false;
223.206 + }
223.207 +
223.208 + @Override
223.209 + protected RefactoringUI wrap(RefactoringUI orig) {
223.210 + if (orig.getRefactoring() instanceof RenameRefactoring) {
223.211 + return new RenameRefactoringWrapper(orig, ((RenameRefactoring) orig.getRefactoring()));
223.212 + }
223.213 +
223.214 + return super.wrap(orig);
223.215 + }
223.216 +
223.217 +
223.218 + //XXX: copied from RefactoringActionsProvider:\
223.219 + static boolean isFromEditor(EditorCookie ec) {
223.220 + if (ec != null && ec.getOpenedPanes() != null) {
223.221 + TopComponent activetc = TopComponent.getRegistry().getActivated();
223.222 + if (activetc instanceof CloneableEditorSupport.Pane) {
223.223 + return true;
223.224 + }
223.225 + }
223.226 + return false;
223.227 + }
223.228 +
223.229 + static boolean nodeHandle(Lookup lookup) {
223.230 + Node n = lookup.lookup(Node.class);
223.231 + if (n!=null) {
223.232 + if (n.getLookup().lookup(TreePathHandle.class)!=null)
223.233 + return true;
223.234 + }
223.235 + return false;
223.236 + }
223.237 +
223.238 + private static Logger logger() {
223.239 + return Logger.getLogger(RefactoringActionsProvider.class.getName());
223.240 + }
223.241 +}
224.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
224.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringElementImpl.java Tue Feb 21 22:37:57 2012 +0100
224.3 @@ -0,0 +1,227 @@
224.4 +/*
224.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
224.6 + *
224.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
224.8 + *
224.9 + * The contents of this file are subject to the terms of either the GNU
224.10 + * General Public License Version 2 only ("GPL") or the Common
224.11 + * Development and Distribution License("CDDL") (collectively, the
224.12 + * "License"). You may not use this file except in compliance with the
224.13 + * License. You can obtain a copy of the License at
224.14 + * http://www.netbeans.org/cddl-gplv2.html
224.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
224.16 + * specific language governing permissions and limitations under the
224.17 + * License. When distributing the software, include this License Header
224.18 + * Notice in each file and include the License file at
224.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
224.20 + * particular file as subject to the "Classpath" exception as provided
224.21 + * by Sun in the GPL Version 2 section of the License file that
224.22 + * accompanied this code. If applicable, add the following below the
224.23 + * License Header, with the fields enclosed by brackets [] replaced by
224.24 + * your own identifying information:
224.25 + * "Portions Copyrighted [year] [name of copyright owner]"
224.26 + *
224.27 + * If you wish your version of this file to be governed by only the CDDL
224.28 + * or only the GPL Version 2, indicate your decision by adding
224.29 + * "[Contributor] elects to include this software in this distribution
224.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
224.31 + * single choice of license, a recipient has the option to distribute
224.32 + * your version of this file under either the CDDL, the GPL Version 2 or
224.33 + * to extend the choice of license to its licensees as provided above.
224.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
224.35 + * Version 2 license, then the option applies only if the new code is
224.36 + * made subject to such option by the copyright holder.
224.37 + *
224.38 + * Contributor(s):
224.39 + *
224.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
224.41 + */
224.42 +
224.43 +package org.netbeans.modules.jackpot30.refactoring;
224.44 +
224.45 +import java.io.File;
224.46 +import java.io.FileInputStream;
224.47 +import java.io.IOException;
224.48 +import java.io.InputStreamReader;
224.49 +import java.io.OutputStreamWriter;
224.50 +import java.io.Reader;
224.51 +import java.io.Writer;
224.52 +import java.nio.charset.Charset;
224.53 +import org.netbeans.api.queries.FileEncodingQuery;
224.54 +import org.netbeans.modules.refactoring.spi.BackupFacility;
224.55 +import org.netbeans.modules.refactoring.spi.BackupFacility.Handle;
224.56 +import org.netbeans.modules.refactoring.spi.SimpleRefactoringElementImplementation;
224.57 +import org.openide.filesystems.FileObject;
224.58 +import org.openide.filesystems.FileUtil;
224.59 +import org.openide.text.PositionBounds;
224.60 +import org.openide.util.Exceptions;
224.61 +import org.openide.util.Lookup;
224.62 +
224.63 +/**
224.64 + *
224.65 + * @author lahvac
224.66 + */
224.67 +public class RefactoringElementImpl extends SimpleRefactoringElementImplementation {
224.68 +
224.69 + private final File target;
224.70 + private final String rule;
224.71 +
224.72 + public RefactoringElementImpl(File target, String rule) {
224.73 + this.target = target;
224.74 + this.rule = rule;
224.75 + }
224.76 +
224.77 + @Override
224.78 + public String getText() {
224.79 + return "Jackpot 3.0 rule";
224.80 + }
224.81 +
224.82 + @Override
224.83 + public String getDisplayText() {
224.84 + return "Jackpot 3.0 rule";
224.85 + }
224.86 +
224.87 + private Handle backup;
224.88 +
224.89 + @Override
224.90 + public void performChange() {
224.91 + try {
224.92 + FileObject fo = FileUtil.toFileObject(target);
224.93 + Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
224.94 + String current;
224.95 +
224.96 + if (fo != null) {
224.97 + backup = BackupFacility.getDefault().backup(fo);
224.98 + current = read(target, encoding).toString();
224.99 + } else {
224.100 + if (!target.exists()) {
224.101 + backup = new Handle() {
224.102 + @Override
224.103 + public void restore() throws IOException {
224.104 + FileObject fo = FileUtil.toFileObject(target);
224.105 +
224.106 + fo.delete();
224.107 + }
224.108 + };
224.109 + current = "";
224.110 + } else {
224.111 + //XXX: log
224.112 + current = read(target, encoding).toString();
224.113 + }
224.114 + }
224.115 +
224.116 + current += rule;
224.117 + current += "\n";
224.118 +
224.119 + write(target, encoding, current);
224.120 + } catch (IOException ex) {
224.121 + Exceptions.printStackTrace(ex);
224.122 + }
224.123 + }
224.124 +
224.125 + @Override
224.126 + public void undoChange() {
224.127 + if (backup != null) {
224.128 + try {
224.129 + backup.restore();
224.130 + } catch (IOException ex) {
224.131 + Exceptions.printStackTrace(ex);
224.132 + }
224.133 + }
224.134 + backup = null;
224.135 + }
224.136 +
224.137 + @Override
224.138 + protected String getNewFileContent() {
224.139 + try {
224.140 + Charset encoding = FileEncodingQuery.getEncoding(getParentFile());
224.141 + String current;
224.142 +
224.143 + if (!target.exists()) {
224.144 + current = "";
224.145 + } else {
224.146 + //XXX: log
224.147 + current = read(target, encoding).toString();
224.148 + }
224.149 +
224.150 + current += rule;
224.151 + current += "\n";
224.152 +
224.153 + return current;
224.154 + } catch (IOException ex) {
224.155 + Exceptions.printStackTrace(ex);
224.156 + return null;
224.157 + }
224.158 + }
224.159 +
224.160 + @Override
224.161 + public Lookup getLookup() {
224.162 + return Lookup.EMPTY;
224.163 + }
224.164 +
224.165 + @Override
224.166 + public FileObject getParentFile() {
224.167 + File f = target;
224.168 +
224.169 + while (true) {
224.170 + FileObject fo = FileUtil.toFileObject(f);
224.171 +
224.172 + if (fo != null) {
224.173 + return fo;
224.174 + }
224.175 +
224.176 + f = f.getParentFile();
224.177 + }
224.178 + }
224.179 +
224.180 + @Override
224.181 + public PositionBounds getPosition() {
224.182 + //XXX:
224.183 + return null;
224.184 + }
224.185 +
224.186 + private CharSequence read(File f, Charset encoding) throws IOException {
224.187 + Reader in = null;
224.188 + StringBuilder result = new StringBuilder();
224.189 +
224.190 + try {
224.191 + in = new InputStreamReader(new FileInputStream(f), encoding);
224.192 +
224.193 + int r;
224.194 +
224.195 + while ((r = in.read()) != (-1)) {
224.196 + result.append((char) r);
224.197 + }
224.198 + } finally {
224.199 + if (in != null) {
224.200 + try {
224.201 + in.close();
224.202 + } catch (IOException ex) {
224.203 + Exceptions.printStackTrace(ex);
224.204 + }
224.205 + }
224.206 + }
224.207 +
224.208 + return result;
224.209 + }
224.210 +
224.211 + private void write(File f, Charset encoding, CharSequence text) throws IOException {
224.212 + Writer out = null;
224.213 +
224.214 + try {
224.215 + FileObject fo = FileUtil.createData(f);
224.216 + out = new OutputStreamWriter(fo.getOutputStream(), encoding);
224.217 +
224.218 + out.write(text.toString());
224.219 + } finally {
224.220 + if (out != null) {
224.221 + try {
224.222 + out.close();
224.223 + } catch (IOException ex) {
224.224 + Exceptions.printStackTrace(ex);
224.225 + }
224.226 + }
224.227 + }
224.228 + }
224.229 +
224.230 +}
225.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
225.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RefactoringPluginFactoryImpl.java Tue Feb 21 22:37:57 2012 +0100
225.3 @@ -0,0 +1,75 @@
225.4 +/*
225.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
225.6 + *
225.7 + * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
225.8 + *
225.9 + * The contents of this file are subject to the terms of either the GNU
225.10 + * General Public License Version 2 only ("GPL") or the Common
225.11 + * Development and Distribution License("CDDL") (collectively, the
225.12 + * "License"). You may not use this file except in compliance with the
225.13 + * License. You can obtain a copy of the License at
225.14 + * http://www.netbeans.org/cddl-gplv2.html
225.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
225.16 + * specific language governing permissions and limitations under the
225.17 + * License. When distributing the software, include this License Header
225.18 + * Notice in each file and include the License file at
225.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
225.20 + * particular file as subject to the "Classpath" exception as provided
225.21 + * by Sun in the GPL Version 2 section of the License file that
225.22 + * accompanied this code. If applicable, add the following below the
225.23 + * License Header, with the fields enclosed by brackets [] replaced by
225.24 + * your own identifying information:
225.25 + * "Portions Copyrighted [year] [name of copyright owner]"
225.26 + *
225.27 + * If you wish your version of this file to be governed by only the CDDL
225.28 + * or only the GPL Version 2, indicate your decision by adding
225.29 + * "[Contributor] elects to include this software in this distribution
225.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
225.31 + * single choice of license, a recipient has the option to distribute
225.32 + * your version of this file under either the CDDL, the GPL Version 2 or
225.33 + * to extend the choice of license to its licensees as provided above.
225.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
225.35 + * Version 2 license, then the option applies only if the new code is
225.36 + * made subject to such option by the copyright holder.
225.37 + *
225.38 + * Contributor(s):
225.39 + *
225.40 + * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
225.41 + */
225.42 +
225.43 +package org.netbeans.modules.jackpot30.refactoring;
225.44 +
225.45 +import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoring;
225.46 +import org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanRefactoringPluginImpl;
225.47 +import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoring;
225.48 +import org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorRefactoringPluginImpl;
225.49 +import org.netbeans.modules.refactoring.api.AbstractRefactoring;
225.50 +import org.netbeans.modules.refactoring.api.RenameRefactoring;
225.51 +import org.netbeans.modules.refactoring.spi.RefactoringPlugin;
225.52 +import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory;
225.53 +import org.openide.util.lookup.ServiceProvider;
225.54 +
225.55 +/**
225.56 + *
225.57 + * @author Jan Lahoda
225.58 + */
225.59 +@ServiceProvider(service=RefactoringPluginFactory.class)
225.60 +public class RefactoringPluginFactoryImpl implements RefactoringPluginFactory {
225.61 +
225.62 + public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
225.63 + if (refactoring instanceof RenameRefactoring) {
225.64 + return new RenameRefactoringPluginImpl((RenameRefactoring) refactoring);
225.65 + }
225.66 +
225.67 + if (refactoring instanceof ReplaceConstructorRefactoring) {
225.68 + return new ReplaceConstructorRefactoringPluginImpl((ReplaceConstructorRefactoring) refactoring);
225.69 + }
225.70 +
225.71 + if (refactoring instanceof InvertBooleanRefactoring) {
225.72 + return new InvertBooleanRefactoringPluginImpl((InvertBooleanRefactoring) refactoring);
225.73 + }
225.74 +
225.75 + return null;
225.76 + }
225.77 +
225.78 +}
226.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
226.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImpl.java Tue Feb 21 22:37:57 2012 +0100
226.3 @@ -0,0 +1,209 @@
226.4 +/*
226.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
226.6 + *
226.7 + * Copyright 2008-2010 Sun Microsystems, Inc. All rights reserved.
226.8 + *
226.9 + * The contents of this file are subject to the terms of either the GNU
226.10 + * General Public License Version 2 only ("GPL") or the Common
226.11 + * Development and Distribution License("CDDL") (collectively, the
226.12 + * "License"). You may not use this file except in compliance with the
226.13 + * License. You can obtain a copy of the License at
226.14 + * http://www.netbeans.org/cddl-gplv2.html
226.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
226.16 + * specific language governing permissions and limitations under the
226.17 + * License. When distributing the software, include this License Header
226.18 + * Notice in each file and include the License file at
226.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
226.20 + * particular file as subject to the "Classpath" exception as provided
226.21 + * by Sun in the GPL Version 2 section of the License file that
226.22 + * accompanied this code. If applicable, add the following below the
226.23 + * License Header, with the fields enclosed by brackets [] replaced by
226.24 + * your own identifying information:
226.25 + * "Portions Copyrighted [year] [name of copyright owner]"
226.26 + *
226.27 + * If you wish your version of this file to be governed by only the CDDL
226.28 + * or only the GPL Version 2, indicate your decision by adding
226.29 + * "[Contributor] elects to include this software in this distribution
226.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
226.31 + * single choice of license, a recipient has the option to distribute
226.32 + * your version of this file under either the CDDL, the GPL Version 2 or
226.33 + * to extend the choice of license to its licensees as provided above.
226.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
226.35 + * Version 2 license, then the option applies only if the new code is
226.36 + * made subject to such option by the copyright holder.
226.37 + *
226.38 + * Contributor(s):
226.39 + *
226.40 + * Portions Copyrighted 2008-2010 Sun Microsystems, Inc.
226.41 + */
226.42 +
226.43 +package org.netbeans.modules.jackpot30.refactoring;
226.44 +
226.45 +import com.sun.source.tree.BlockTree;
226.46 +import com.sun.source.tree.ClassTree;
226.47 +import com.sun.source.tree.ExpressionTree;
226.48 +import com.sun.source.tree.MethodInvocationTree;
226.49 +import com.sun.source.tree.MethodTree;
226.50 +import com.sun.source.tree.ModifiersTree;
226.51 +import com.sun.source.tree.StatementTree;
226.52 +import com.sun.source.tree.VariableTree;
226.53 +import com.sun.source.util.TreePath;
226.54 +import java.io.File;
226.55 +import java.util.Collections;
226.56 +import java.util.EnumSet;
226.57 +import java.util.LinkedList;
226.58 +import java.util.List;
226.59 +import java.util.Set;
226.60 +import javax.lang.model.element.Element;
226.61 +import javax.lang.model.element.ElementKind;
226.62 +import javax.lang.model.element.ExecutableElement;
226.63 +import javax.lang.model.element.Modifier;
226.64 +import javax.lang.model.element.TypeElement;
226.65 +import javax.lang.model.type.TypeKind;
226.66 +import org.netbeans.api.java.source.CancellableTask;
226.67 +import org.netbeans.api.java.source.ClasspathInfo.PathKind;
226.68 +import org.netbeans.api.java.source.JavaSource;
226.69 +import org.netbeans.api.java.source.TreeMaker;
226.70 +import org.netbeans.api.java.source.TreePathHandle;
226.71 +import org.netbeans.api.java.source.WorkingCopy;
226.72 +import org.netbeans.modules.refactoring.api.Problem;
226.73 +import org.netbeans.modules.refactoring.api.RenameRefactoring;
226.74 +import org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin;
226.75 +import org.netbeans.modules.refactoring.spi.RefactoringElementsBag;
226.76 +import org.openide.filesystems.FileObject;
226.77 +import org.openide.filesystems.FileUtil;
226.78 +import org.openide.util.Lookup;
226.79 +
226.80 +/**
226.81 + *
226.82 + * @author Jan Lahoda
226.83 + */
226.84 +public class RenameRefactoringPluginImpl extends JavaRefactoringPlugin {
226.85 +
226.86 + private final RenameRefactoring rr;
226.87 +
226.88 + public RenameRefactoringPluginImpl(RenameRefactoring rr) {
226.89 + this.rr = rr;
226.90 + }
226.91 +
226.92 + @Override
226.93 + public Problem preCheck() {
226.94 + return null;
226.95 + }
226.96 +
226.97 + @Override
226.98 + public Problem checkParameters() {
226.99 + return null;
226.100 + }
226.101 +
226.102 + @Override
226.103 + public Problem fastCheckParameters() {
226.104 + return null;
226.105 + }
226.106 +
226.107 + @Override
226.108 + public void cancelRequest() {
226.109 + }
226.110 +
226.111 + public Problem prepare(final RefactoringElementsBag refactoringElements) {
226.112 + final ExtraData data = rr.getContext().lookup(ExtraData.class);
226.113 +
226.114 + if (data == null || !data.generateUpgradeScript) {
226.115 + return null;
226.116 + }
226.117 +
226.118 + Lookup source = rr.getRefactoringSource();
226.119 + final TreePathHandle toRename = source.lookup(TreePathHandle.class);
226.120 +
226.121 + if (toRename == null) {
226.122 + return null;
226.123 + }
226.124 +
226.125 + JavaSource js = JavaSource.forFileObject(toRename.getFileObject());
226.126 +
226.127 + if (js != null) {
226.128 + CancellableTask<WorkingCopy> work = new CancellableTask<WorkingCopy>() {
226.129 + public void run(WorkingCopy parameter) throws Exception {
226.130 + parameter.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
226.131 + TreePath tp = toRename.resolve(parameter);
226.132 +
226.133 + if (tp == null) {
226.134 + return ;
226.135 + }
226.136 +
226.137 + Element e = parameter.getTrees().getElement(tp);
226.138 +
226.139 + if (e == null || e.getKind() != ElementKind.METHOD) {
226.140 + return ;
226.141 + }
226.142 +
226.143 + MethodTree m = (MethodTree) tp.getLeaf();
226.144 + ClassTree ct = (ClassTree) tp.getParentPath().getLeaf();
226.145 +
226.146 + TreeMaker make = parameter.getTreeMaker();
226.147 +
226.148 + List<ExpressionTree> args = new LinkedList<ExpressionTree>();
226.149 +
226.150 + for (VariableTree vt : m.getParameters()) {
226.151 + args.add(make.Identifier(vt.getName()));
226.152 + }
226.153 +
226.154 + MethodInvocationTree mit = make.MethodInvocation(Collections.<ExpressionTree>emptyList(), make.Identifier(rr.getNewName()), args);
226.155 +
226.156 + StatementTree invoke;
226.157 +
226.158 + if (((ExecutableElement) e).getReturnType().getKind() == TypeKind.VOID) {
226.159 + invoke = make.ExpressionStatement(mit);
226.160 + } else {
226.161 + invoke = make.Return(mit);
226.162 + }
226.163 +
226.164 + BlockTree body = make.Block(Collections.<StatementTree>singletonList(invoke), false);
226.165 +// ModifiersTree mods = make.addModifiersAnnotation(m.getModifiers(), constructTransformation(parameter, make, rr.getNewName(), (ExecutableElement) e));
226.166 + ModifiersTree mods = m.getModifiers();
226.167 +
226.168 + if (data.makeOriginalDeprecated) {
226.169 + mods = make.addModifiersAnnotation(mods, make.Annotation(make.QualIdent(parameter.getElements().getTypeElement("java.lang.Deprecated")), Collections.<ExpressionTree>emptyList()));
226.170 + }
226.171 +
226.172 + if (data.makeOriginalPrivate) {
226.173 + Set<Modifier> modSet = EnumSet.noneOf(Modifier.class);
226.174 +
226.175 + modSet.addAll(mods.getFlags());
226.176 + modSet.removeAll(EnumSet.of(Modifier.PUBLIC, Modifier.PROTECTED));
226.177 + modSet.add(Modifier.PRIVATE);
226.178 +
226.179 + mods = make.Modifiers(modSet, mods.getAnnotations());
226.180 + }
226.181 +
226.182 + MethodTree nue = make.Method(mods, m.getName(), m.getReturnType(), m.getTypeParameters(), m.getParameters(), m.getThrows(), body, null);
226.183 +
226.184 + ClassTree nueClass = make.insertClassMember(ct, ct.getMembers().indexOf(m), nue);
226.185 +
226.186 + parameter.rewrite(ct, nueClass);
226.187 +
226.188 + FileObject root = parameter.getClasspathInfo().getClassPath(PathKind.SOURCE).findOwnerRoot(parameter.getFileObject());
226.189 +
226.190 + if (root != null) {
226.191 + File f = FileUtil.toFile(root);
226.192 + String rule = ScriptGenerator.constructRenameRule(parameter, rr.getNewName(), e);
226.193 + File ruleFile = new File(f, "META-INF/upgrade/" + ((TypeElement) e.getEnclosingElement()).getQualifiedName().toString() + ".hint");
226.194 +
226.195 + refactoringElements.add(rr, new RefactoringElementImpl( ruleFile, rule));
226.196 + }
226.197 + }
226.198 + public void cancel() {}
226.199 + };
226.200 +
226.201 + createAndAddElements(Collections.singleton(toRename.getFileObject()), work, refactoringElements, rr);
226.202 + }
226.203 +
226.204 + return null;
226.205 + }
226.206 +
226.207 + @Override
226.208 + protected JavaSource getJavaSource(Phase p) {
226.209 + return null;
226.210 + }
226.211 +
226.212 +}
227.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
227.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringWrapper.java Tue Feb 21 22:37:57 2012 +0100
227.3 @@ -0,0 +1,162 @@
227.4 +/*
227.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
227.6 + *
227.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
227.8 + *
227.9 + * The contents of this file are subject to the terms of either the GNU
227.10 + * General Public License Version 2 only ("GPL") or the Common
227.11 + * Development and Distribution License("CDDL") (collectively, the
227.12 + * "License"). You may not use this file except in compliance with the
227.13 + * License. You can obtain a copy of the License at
227.14 + * http://www.netbeans.org/cddl-gplv2.html
227.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
227.16 + * specific language governing permissions and limitations under the
227.17 + * License. When distributing the software, include this License Header
227.18 + * Notice in each file and include the License file at
227.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
227.20 + * particular file as subject to the "Classpath" exception as provided
227.21 + * by Sun in the GPL Version 2 section of the License file that
227.22 + * accompanied this code. If applicable, add the following below the
227.23 + * License Header, with the fields enclosed by brackets [] replaced by
227.24 + * your own identifying information:
227.25 + * "Portions Copyrighted [year] [name of copyright owner]"
227.26 + *
227.27 + * If you wish your version of this file to be governed by only the CDDL
227.28 + * or only the GPL Version 2, indicate your decision by adding
227.29 + * "[Contributor] elects to include this software in this distribution
227.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
227.31 + * single choice of license, a recipient has the option to distribute
227.32 + * your version of this file under either the CDDL, the GPL Version 2 or
227.33 + * to extend the choice of license to its licensees as provided above.
227.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
227.35 + * Version 2 license, then the option applies only if the new code is
227.36 + * made subject to such option by the copyright holder.
227.37 + *
227.38 + * Contributor(s):
227.39 + *
227.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
227.41 + */
227.42 +
227.43 +package org.netbeans.modules.jackpot30.refactoring;
227.44 +
227.45 +import com.sun.source.tree.Tree.Kind;
227.46 +import java.awt.BorderLayout;
227.47 +import java.awt.Component;
227.48 +import javax.swing.JComponent;
227.49 +import javax.swing.JPanel;
227.50 +import javax.swing.border.EmptyBorder;
227.51 +import javax.swing.event.ChangeListener;
227.52 +import org.netbeans.api.java.source.TreePathHandle;
227.53 +import org.netbeans.modules.refactoring.api.AbstractRefactoring;
227.54 +import org.netbeans.modules.refactoring.api.Problem;
227.55 +import org.netbeans.modules.refactoring.api.RenameRefactoring;
227.56 +import org.netbeans.modules.refactoring.spi.ui.CustomRefactoringPanel;
227.57 +import org.netbeans.modules.refactoring.spi.ui.RefactoringUI;
227.58 +import org.openide.util.HelpCtx;
227.59 +import org.openide.util.Lookup;
227.60 +
227.61 +/**
227.62 + *
227.63 + * @author lahvac
227.64 + */
227.65 +public class RenameRefactoringWrapper implements RefactoringUI {
227.66 +
227.67 + private final RefactoringUI delegate;
227.68 + private final RenameRefactoring refactoring;
227.69 +
227.70 + public RenameRefactoringWrapper(RefactoringUI delegate, RenameRefactoring refactoring) {
227.71 + this.delegate = delegate;
227.72 + this.refactoring = refactoring;
227.73 + }
227.74 +
227.75 + @Override
227.76 + public String getName() {
227.77 + return delegate.getName();
227.78 + }
227.79 +
227.80 + @Override
227.81 + public String getDescription() {
227.82 + return delegate.getDescription();
227.83 + }
227.84 +
227.85 + @Override
227.86 + public boolean isQuery() {
227.87 + return delegate.isQuery();
227.88 + }
227.89 +
227.90 + private GenerateScriptPanel gsp;
227.91 + private CustomRefactoringPanel crp;
227.92 +
227.93 + @Override
227.94 + public CustomRefactoringPanel getPanel(ChangeListener parent) {
227.95 + if (crp == null) {
227.96 + Lookup source = refactoring.getRefactoringSource();
227.97 + TreePathHandle toRename = source.lookup(TreePathHandle.class);
227.98 +
227.99 + gsp = new GenerateScriptPanel(toRename != null && toRename.getKind() == Kind.METHOD);
227.100 + crp = new CustomRefactoringPanelImpl(gsp, delegate.getPanel(parent));
227.101 + }
227.102 +
227.103 + return crp;
227.104 + }
227.105 +
227.106 + @Override
227.107 + public Problem setParameters() {
227.108 + gsp.saveDefaults();
227.109 + refactoring.getContext().add(gsp.getData());
227.110 + return delegate.setParameters();
227.111 + }
227.112 +
227.113 + @Override
227.114 + public Problem checkParameters() {
227.115 + return delegate.checkParameters();
227.116 + }
227.117 +
227.118 + @Override
227.119 + public boolean hasParameters() {
227.120 + return true;
227.121 + }
227.122 +
227.123 + @Override
227.124 + public AbstractRefactoring getRefactoring() {
227.125 + return refactoring;
227.126 + }
227.127 +
227.128 + @Override
227.129 + public HelpCtx getHelpCtx() {
227.130 + return delegate.getHelpCtx();
227.131 + }
227.132 +
227.133 + private static final class CustomRefactoringPanelImpl implements CustomRefactoringPanel {
227.134 + private final CustomRefactoringPanel delegate;
227.135 + private final JComponent component;
227.136 + public CustomRefactoringPanelImpl(final GenerateScriptPanel panel, CustomRefactoringPanel delegate) {
227.137 + this.delegate = delegate;
227.138 + final Component delegateComponent = delegate.getComponent();
227.139 + this.component = new JPanel(new BorderLayout()) {
227.140 + {
227.141 + add(delegateComponent, BorderLayout.CENTER);
227.142 + panel.setBorder(new EmptyBorder(0, 5, 0, 0));
227.143 + add(panel, BorderLayout.SOUTH);
227.144 + delegateComponent.requestFocus();
227.145 + }
227.146 + @Override
227.147 + public void requestFocus() {
227.148 + delegateComponent.requestFocus();
227.149 + }
227.150 + };
227.151 + }
227.152 +
227.153 + @Override
227.154 + public void initialize() {
227.155 + delegate.initialize();
227.156 + }
227.157 +
227.158 + @Override
227.159 + public Component getComponent() {
227.160 + return component;
227.161 + }
227.162 +
227.163 + }
227.164 +
227.165 +}
228.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
228.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/ScriptGenerator.java Tue Feb 21 22:37:57 2012 +0100
228.3 @@ -0,0 +1,113 @@
228.4 +/*
228.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
228.6 + *
228.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
228.8 + *
228.9 + * The contents of this file are subject to the terms of either the GNU
228.10 + * General Public License Version 2 only ("GPL") or the Common
228.11 + * Development and Distribution License("CDDL") (collectively, the
228.12 + * "License"). You may not use this file except in compliance with the
228.13 + * License. You can obtain a copy of the License at
228.14 + * http://www.netbeans.org/cddl-gplv2.html
228.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
228.16 + * specific language governing permissions and limitations under the
228.17 + * License. When distributing the software, include this License Header
228.18 + * Notice in each file and include the License file at
228.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
228.20 + * particular file as subject to the "Classpath" exception as provided
228.21 + * by Sun in the GPL Version 2 section of the License file that
228.22 + * accompanied this code. If applicable, add the following below the
228.23 + * License Header, with the fields enclosed by brackets [] replaced by
228.24 + * your own identifying information:
228.25 + * "Portions Copyrighted [year] [name of copyright owner]"
228.26 + *
228.27 + * If you wish your version of this file to be governed by only the CDDL
228.28 + * or only the GPL Version 2, indicate your decision by adding
228.29 + * "[Contributor] elects to include this software in this distribution
228.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
228.31 + * single choice of license, a recipient has the option to distribute
228.32 + * your version of this file under either the CDDL, the GPL Version 2 or
228.33 + * to extend the choice of license to its licensees as provided above.
228.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
228.35 + * Version 2 license, then the option applies only if the new code is
228.36 + * made subject to such option by the copyright holder.
228.37 + *
228.38 + * Contributor(s):
228.39 + *
228.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
228.41 + */
228.42 +
228.43 +package org.netbeans.modules.jackpot30.refactoring;
228.44 +
228.45 +import javax.lang.model.element.Element;
228.46 +import javax.lang.model.element.ExecutableElement;
228.47 +import javax.lang.model.element.Modifier;
228.48 +import javax.lang.model.element.TypeElement;
228.49 +import javax.lang.model.element.VariableElement;
228.50 +import org.netbeans.api.annotations.common.NonNull;
228.51 +import org.netbeans.api.java.source.WorkingCopy;
228.52 +
228.53 +/**
228.54 + *
228.55 + * @author lahvac
228.56 + */
228.57 +public class ScriptGenerator {
228.58 +
228.59 + public static @NonNull String constructRenameRule(@NonNull WorkingCopy wc, @NonNull String newName, @NonNull Element original) {
228.60 + switch (original.getKind()) {
228.61 + case METHOD: return constructRenameRule(wc, newName, (ExecutableElement) original);
228.62 + default: throw new UnsupportedOperationException();
228.63 + }
228.64 + }
228.65 +
228.66 + private static String constructRenameRule(WorkingCopy wc, String newName, ExecutableElement method) {
228.67 + //XXX: type parameters?
228.68 + StringBuilder pattern = new StringBuilder();
228.69 + StringBuilder constraints = new StringBuilder();
228.70 + StringBuilder target = new StringBuilder();
228.71 +
228.72 + TypeElement clazz = (TypeElement) method.getEnclosingElement();
228.73 +
228.74 + if (method.getModifiers().contains(Modifier.STATIC)) {
228.75 + pattern.append(clazz.getQualifiedName().toString()).append(".");
228.76 + target.append(clazz.getQualifiedName().toString()).append(".");
228.77 + } else {
228.78 + pattern.append("$0.");
228.79 + constraints.append(" :: $0 instanceof " + clazz.getQualifiedName().toString());
228.80 + target.append("$0.");
228.81 + }
228.82 +
228.83 + pattern.append(method.getSimpleName().toString());
228.84 + target.append(newName);
228.85 + pattern.append("(");
228.86 + target.append("(");
228.87 +
228.88 + int count = 1;
228.89 +
228.90 + for (VariableElement p : method.getParameters()) {
228.91 + if (count++ > 1) {
228.92 + pattern.append(", ");
228.93 + target.append(", ");
228.94 + }
228.95 +
228.96 + String name = "$" + p.getSimpleName().toString();
228.97 +
228.98 + pattern.append(name);
228.99 + target.append(name);
228.100 +
228.101 + if (constraints.length() == 0) {
228.102 + constraints.append(" :: ");
228.103 + } else {
228.104 + constraints.append(" && ");
228.105 + }
228.106 +
228.107 + constraints.append(name).append(" instanceof ").append(p.asType());
228.108 + }
228.109 +
228.110 + pattern.append(")");
228.111 + target.append(")");
228.112 +
228.113 + return " " + pattern + constraints + "\n=> " + target + "\n;;";
228.114 + }
228.115 +
228.116 +}
229.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
229.2 +++ b/sandbox/old-modules/bridges/refactoring/src/org/netbeans/modules/jackpot30/refactoring/layer.xml Tue Feb 21 22:37:57 2012 +0100
229.3 @@ -0,0 +1,34 @@
229.4 +<?xml version="1.0" encoding="UTF-8"?>
229.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
229.6 +<filesystem>
229.7 + <folder name="Actions">
229.8 + <folder name="Refactoring">
229.9 + <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance">
229.10 + <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.noconstructor.ReplaceConstructorAction.create"/>
229.11 + </file>
229.12 + <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance">
229.13 + <attr name="instanceCreate" methodvalue="org.netbeans.modules.jackpot30.refactoring.invertboolean.InvertBooleanAction.create"/>
229.14 + </file>
229.15 + </folder>
229.16 + </folder>
229.17 + <folder name="Menu">
229.18 + <folder name="Refactoring">
229.19 + <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorAfter.instance">
229.20 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
229.21 + <attr name="position" intvalue="2175"/>
229.22 + </file>
229.23 + <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction-separatorBefore.instance">
229.24 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
229.25 + <attr name="position" intvalue="2125"/>
229.26 + </file>
229.27 + <file name="org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.shadow">
229.28 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-noconstructor-ReplaceConstructorAction.instance"/>
229.29 + <attr name="position" intvalue="2150"/>
229.30 + </file>
229.31 + <file name="org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.shadow">
229.32 + <attr name="originalFile" stringvalue="Actions/Refactoring/org-netbeans-modules-jackpot30-refactoring-invertboolean-InvertBooleanAction.instance"/>
229.33 + <attr name="position" intvalue="2152"/>
229.34 + </file>
229.35 + </folder>
229.36 + </folder>
229.37 +</filesystem>
230.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
230.2 +++ b/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RefactoringTestBase.java Tue Feb 21 22:37:57 2012 +0100
230.3 @@ -0,0 +1,251 @@
230.4 +/*
230.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
230.6 + *
230.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
230.8 + *
230.9 + * The contents of this file are subject to the terms of either the GNU
230.10 + * General Public License Version 2 only ("GPL") or the Common
230.11 + * Development and Distribution License("CDDL") (collectively, the
230.12 + * "License"). You may not use this file except in compliance with the
230.13 + * License. You can obtain a copy of the License at
230.14 + * http://www.netbeans.org/cddl-gplv2.html
230.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
230.16 + * specific language governing permissions and limitations under the
230.17 + * License. When distributing the software, include this License Header
230.18 + * Notice in each file and include the License file at
230.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
230.20 + * particular file as subject to the "Classpath" exception as provided
230.21 + * by Sun in the GPL Version 2 section of the License file that
230.22 + * accompanied this code. If applicable, add the following below the
230.23 + * License Header, with the fields enclosed by brackets [] replaced by
230.24 + * your own identifying information:
230.25 + * "Portions Copyrighted [year] [name of copyright owner]"
230.26 + *
230.27 + * If you wish your version of this file to be governed by only the CDDL
230.28 + * or only the GPL Version 2, indicate your decision by adding
230.29 + * "[Contributor] elects to include this software in this distribution
230.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
230.31 + * single choice of license, a recipient has the option to distribute
230.32 + * your version of this file under either the CDDL, the GPL Version 2 or
230.33 + * to extend the choice of license to its licensees as provided above.
230.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
230.35 + * Version 2 license, then the option applies only if the new code is
230.36 + * made subject to such option by the copyright holder.
230.37 + *
230.38 + * Contributor(s):
230.39 + *
230.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
230.41 + */
230.42 +package org.netbeans.modules.jackpot30.refactoring;
230.43 +
230.44 +import java.io.IOException;
230.45 +import java.util.Arrays;
230.46 +import java.util.Collections;
230.47 +import java.util.HashMap;
230.48 +import java.util.HashSet;
230.49 +import java.util.LinkedList;
230.50 +import java.util.List;
230.51 +import java.util.Map;
230.52 +import java.util.Set;
230.53 +import org.netbeans.api.editor.mimelookup.MimePath;
230.54 +import org.netbeans.api.java.classpath.ClassPath;
230.55 +import org.netbeans.api.java.classpath.GlobalPathRegistry;
230.56 +import org.netbeans.api.java.source.SourceUtils;
230.57 +import org.netbeans.api.java.source.SourceUtilsTestUtil;
230.58 +import org.netbeans.api.java.source.TestUtilities;
230.59 +import org.netbeans.api.project.Project;
230.60 +import org.netbeans.api.project.ProjectManager;
230.61 +import org.netbeans.core.startup.Main;
230.62 +import org.netbeans.junit.NbTestCase;
230.63 +import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
230.64 +import org.netbeans.modules.parsing.impl.indexing.CacheFolder;
230.65 +import org.netbeans.modules.parsing.impl.indexing.MimeTypes;
230.66 +import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater;
230.67 +import org.netbeans.modules.refactoring.api.AbstractRefactoring;
230.68 +import org.netbeans.modules.refactoring.api.RefactoringSession;
230.69 +import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
230.70 +import org.netbeans.spi.java.classpath.ClassPathProvider;
230.71 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
230.72 +import org.netbeans.spi.project.ProjectFactory;
230.73 +import org.netbeans.spi.project.ProjectState;
230.74 +import org.openide.filesystems.FileObject;
230.75 +import org.openide.filesystems.FileUtil;
230.76 +import org.openide.util.Lookup;
230.77 +import org.openide.util.lookup.Lookups;
230.78 +import org.openide.util.lookup.ServiceProvider;
230.79 +
230.80 +public class RefactoringTestBase extends NbTestCase {
230.81 +
230.82 + public RefactoringTestBase(String name) {
230.83 + super(name);
230.84 + }
230.85 +
230.86 + protected static void writeFilesAndWaitForScan(FileObject sourceRoot, File... files) throws Exception {
230.87 + for (FileObject c : sourceRoot.getChildren()) {
230.88 + c.delete();
230.89 + }
230.90 +
230.91 + for (File f : files) {
230.92 + FileObject fo = FileUtil.createData(sourceRoot, f.filename);
230.93 + TestUtilities.copyStringToFile(fo, f.content);
230.94 + }
230.95 +
230.96 + SourceUtils.waitScanFinished();
230.97 + }
230.98 +
230.99 + protected static final class File {
230.100 + public final String filename;
230.101 + public final String content;
230.102 +
230.103 + public File(String filename, String content) {
230.104 + this.filename = filename;
230.105 + this.content = content;
230.106 + }
230.107 + }
230.108 +
230.109 + protected FileObject src;
230.110 + protected Project prj;
230.111 +
230.112 + @Override
230.113 + protected void setUp() throws Exception {
230.114 + SourceUtilsTestUtil.prepareTest(new String[0], new Object[] {
230.115 + new ClassPathProvider() {
230.116 + public ClassPath findClassPath(FileObject file, String type) {
230.117 + if (src != null && (file == src || FileUtil.isParentOf(src, file))) {
230.118 + if (ClassPath.BOOT.equals(type)) {
230.119 + return ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path"));
230.120 + }
230.121 + if (ClassPath.COMPILE.equals(type)) {
230.122 + return ClassPathSupport.createClassPath(new FileObject[0]);
230.123 + }
230.124 + if (ClassPath.SOURCE.equals(type)) {
230.125 + return ClassPathSupport.createClassPath(src);
230.126 + }
230.127 + }
230.128 +
230.129 + return null;
230.130 + }
230.131 + },
230.132 + new ProjectFactory() {
230.133 + public boolean isProject(FileObject projectDirectory) {
230.134 + return src == projectDirectory;
230.135 + }
230.136 + public Project loadProject(final FileObject projectDirectory, ProjectState state) throws IOException {
230.137 + if (!isProject(projectDirectory)) return null;
230.138 + return new Project() {
230.139 + public FileObject getProjectDirectory() {
230.140 + return projectDirectory;
230.141 + }
230.142 + public Lookup getLookup() {
230.143 + return Lookup.EMPTY;
230.144 + }
230.145 + };
230.146 + }
230.147 + public void saveProject(Project project) throws IOException, ClassCastException {}
230.148 + }
230.149 + });
230.150 + Main.initializeURLFactory();
230.151 + org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
230.152 + prepareTest();
230.153 + org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj = ProjectManager.getDefault().findProject(src)}, false);
230.154 + MimeTypes.setAllMimeTypes(Collections.singleton("text/x-java"));
230.155 + GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {ClassPathSupport.createClassPath(src)});
230.156 + RepositoryUpdater.getDefault().start(true);
230.157 + super.setUp();
230.158 + }
230.159 +
230.160 + @Override
230.161 + protected void tearDown() throws Exception {
230.162 + super.tearDown();
230.163 + org.netbeans.api.project.ui.OpenProjects.getDefault().open(new Project[] {prj}, false);
230.164 + prj = null;
230.165 + }
230.166 +
230.167 + private void prepareTest() throws Exception {
230.168 + FileObject workdir = SourceUtilsTestUtil.makeScratchDir(this);
230.169 +
230.170 + src = FileUtil.createFolder(workdir, "src");
230.171 +
230.172 + FileObject cache = FileUtil.createFolder(workdir, "cache");
230.173 +
230.174 + CacheFolder.setCacheFolder(cache);
230.175 + }
230.176 +
230.177 + protected void performRefactoring(AbstractRefactoring r, File... verify) throws IOException {
230.178 + Map<FileObject, String> originalContent = new HashMap<FileObject, String>();
230.179 +
230.180 + for (FileObject file : recursive(src)) {
230.181 + originalContent.put(file, readFile(file));
230.182 + }
230.183 +
230.184 + RefactoringSession rs = RefactoringSession.create("Session");
230.185 +
230.186 + r.prepare(rs);
230.187 +
230.188 + assertNull(rs.doRefactoring(true));
230.189 +
230.190 +// IndexingManager.getDefault().refreshIndex(src.getURL(), null);
230.191 +// SourceUtils.waitScanFinished();
230.192 +// assertEquals(false, TaskCache.getDefault().isInError(src, true));
230.193 +
230.194 + for (File v : verify) {
230.195 + FileObject file = src.getFileObject(v.filename);
230.196 +
230.197 + assertNotNull(v.filename, file);
230.198 +
230.199 + String content = readFile(file);
230.200 +
230.201 + assertEquals(v.content.replaceAll("[ \n\t]+", " "), content.replaceAll("[ \n\t]+", " "));
230.202 + }
230.203 +
230.204 + rs.undoRefactoring(true);
230.205 +
230.206 + for (FileObject file : recursive(src)) {
230.207 + String content = originalContent.remove(file);
230.208 +
230.209 + assertNotNull(FileUtil.getFileDisplayName(file), content);
230.210 + assertEquals(content, readFile(file));
230.211 + }
230.212 +
230.213 + assertTrue(originalContent.toString(), originalContent.isEmpty());
230.214 + }
230.215 +
230.216 + private String readFile(FileObject file) throws IOException {
230.217 + return TestUtilities.copyFileToString(FileUtil.toFile(file));
230.218 + }
230.219 +
230.220 + private static Iterable<? extends FileObject> recursive(FileObject r) {
230.221 + Set<FileObject> result = new HashSet<FileObject>();
230.222 + List<FileObject> queue = new LinkedList<FileObject>();
230.223 +
230.224 + queue.add(r);
230.225 +
230.226 + while (!queue.isEmpty()) {
230.227 + FileObject c = queue.remove(0);
230.228 +
230.229 + if (c.isData()) {
230.230 + result.add(c);
230.231 + } else {
230.232 + queue.addAll(Arrays.asList(c.getChildren()));
230.233 + }
230.234 + }
230.235 +
230.236 + return result;
230.237 + }
230.238 +
230.239 + @ServiceProvider(service=MimeDataProvider.class)
230.240 + public static final class MimeDataProviderImpl implements MimeDataProvider {
230.241 +
230.242 + private static final Lookup L = Lookups.singleton(new JavaCustomIndexer.Factory());
230.243 +
230.244 + public Lookup getLookup(MimePath mimePath) {
230.245 + if ("text/x-java".equals(mimePath.getPath())) {
230.246 + return L;
230.247 + }
230.248 +
230.249 + return null;
230.250 + }
230.251 +
230.252 + }
230.253 +
230.254 +}
231.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
231.2 +++ b/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/RenameRefactoringPluginImplTest.java Tue Feb 21 22:37:57 2012 +0100
231.3 @@ -0,0 +1,111 @@
231.4 +/*
231.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
231.6 + *
231.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
231.8 + *
231.9 + * The contents of this file are subject to the terms of either the GNU
231.10 + * General Public License Version 2 only ("GPL") or the Common
231.11 + * Development and Distribution License("CDDL") (collectively, the
231.12 + * "License"). You may not use this file except in compliance with the
231.13 + * License. You can obtain a copy of the License at
231.14 + * http://www.netbeans.org/cddl-gplv2.html
231.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
231.16 + * specific language governing permissions and limitations under the
231.17 + * License. When distributing the software, include this License Header
231.18 + * Notice in each file and include the License file at
231.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
231.20 + * particular file as subject to the "Classpath" exception as provided
231.21 + * by Sun in the GPL Version 2 section of the License file that
231.22 + * accompanied this code. If applicable, add the following below the
231.23 + * License Header, with the fields enclosed by brackets [] replaced by
231.24 + * your own identifying information:
231.25 + * "Portions Copyrighted [year] [name of copyright owner]"
231.26 + *
231.27 + * If you wish your version of this file to be governed by only the CDDL
231.28 + * or only the GPL Version 2, indicate your decision by adding
231.29 + * "[Contributor] elects to include this software in this distribution
231.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
231.31 + * single choice of license, a recipient has the option to distribute
231.32 + * your version of this file under either the CDDL, the GPL Version 2 or
231.33 + * to extend the choice of license to its licensees as provided above.
231.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
231.35 + * Version 2 license, then the option applies only if the new code is
231.36 + * made subject to such option by the copyright holder.
231.37 + *
231.38 + * Contributor(s):
231.39 + *
231.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
231.41 + */
231.42 +package org.netbeans.modules.jackpot30.refactoring;
231.43 +
231.44 +import com.sun.source.tree.ClassTree;
231.45 +import com.sun.source.tree.CompilationUnitTree;
231.46 +import com.sun.source.tree.MethodTree;
231.47 +import com.sun.source.util.TreePath;
231.48 +import org.netbeans.api.java.source.CompilationController;
231.49 +import org.netbeans.api.java.source.JavaSource;
231.50 +import org.netbeans.api.java.source.Task;
231.51 +import org.netbeans.api.java.source.TreePathHandle;
231.52 +import org.netbeans.modules.refactoring.api.RenameRefactoring;
231.53 +import org.openide.util.lookup.Lookups;
231.54 +
231.55 +public class RenameRefactoringPluginImplTest extends RefactoringTestBase {
231.56 +
231.57 + public RenameRefactoringPluginImplTest(String name) {
231.58 + super(name);
231.59 + }
231.60 +
231.61 + public void testSimple1() throws Exception {
231.62 + writeFilesAndWaitForScan(src,
231.63 + new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"));
231.64 + final RenameRefactoring[] r = new RenameRefactoring[1];
231.65 +
231.66 + JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
231.67 +
231.68 + public void run(CompilationController parameter) throws Exception {
231.69 + parameter.toPhase(JavaSource.Phase.RESOLVED);
231.70 + CompilationUnitTree cut = parameter.getCompilationUnit();
231.71 +
231.72 + MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
231.73 +
231.74 + TreePath tp = TreePath.getPath(cut, var);
231.75 + r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
231.76 + }
231.77 + }, true);
231.78 +
231.79 + r[0].setNewName("foo");
231.80 + r[0].getContext().add(new ExtraData(true, true, true));
231.81 +
231.82 + performRefactoring(r[0],
231.83 + new File("t/A.java", "package t; public class A { @Deprecated private void test() { foo(); } public void foo() { } }"),
231.84 + new File("META-INF/upgrade/t.A.hint", " $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
231.85 + }
231.86 +
231.87 + public void testSimple2() throws Exception {
231.88 + writeFilesAndWaitForScan(src,
231.89 + new File("t/A.java", "package t; public class A {\n public void test() {\n}\n }"),
231.90 + new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; "));
231.91 + final RenameRefactoring[] r = new RenameRefactoring[1];
231.92 +
231.93 + JavaSource.forFileObject(src.getFileObject("t/A.java")).runUserActionTask(new Task<CompilationController>() {
231.94 +
231.95 + public void run(CompilationController parameter) throws Exception {
231.96 + parameter.toPhase(JavaSource.Phase.RESOLVED);
231.97 + CompilationUnitTree cut = parameter.getCompilationUnit();
231.98 +
231.99 + MethodTree var = (MethodTree) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(1);
231.100 +
231.101 + TreePath tp = TreePath.getPath(cut, var);
231.102 + r[0] = new RenameRefactoring(Lookups.singleton(TreePathHandle.create(tp, parameter)));
231.103 + }
231.104 + }, true);
231.105 +
231.106 + r[0].setNewName("foo");
231.107 + r[0].getContext().add(new ExtraData(true, /*XXX: false will fail badly here!!*/true, false));
231.108 +
231.109 + performRefactoring(r[0],
231.110 + new File("t/A.java", "package t; public class A { private void test() { foo(); } public void foo() { } }"),
231.111 + new File("META-INF/upgrade/t.A.hint", "$0.isDirectory();; $0.test() :: $0 instanceof t.A => $0.foo() ;; "));
231.112 + }
231.113 +
231.114 +}
232.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
232.2 +++ b/sandbox/old-modules/bridges/refactoring/test/unit/src/org/netbeans/modules/jackpot30/refactoring/ScriptGeneratorTest.java Tue Feb 21 22:37:57 2012 +0100
232.3 @@ -0,0 +1,135 @@
232.4 +/*
232.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
232.6 + *
232.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
232.8 + *
232.9 + * The contents of this file are subject to the terms of either the GNU
232.10 + * General Public License Version 2 only ("GPL") or the Common
232.11 + * Development and Distribution License("CDDL") (collectively, the
232.12 + * "License"). You may not use this file except in compliance with the
232.13 + * License. You can obtain a copy of the License at
232.14 + * http://www.netbeans.org/cddl-gplv2.html
232.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
232.16 + * specific language governing permissions and limitations under the
232.17 + * License. When distributing the software, include this License Header
232.18 + * Notice in each file and include the License file at
232.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
232.20 + * particular file as subject to the "Classpath" exception as provided
232.21 + * by Sun in the GPL Version 2 section of the License file that
232.22 + * accompanied this code. If applicable, add the following below the
232.23 + * License Header, with the fields enclosed by brackets [] replaced by
232.24 + * your own identifying information:
232.25 + * "Portions Copyrighted [year] [name of copyright owner]"
232.26 + *
232.27 + * If you wish your version of this file to be governed by only the CDDL
232.28 + * or only the GPL Version 2, indicate your decision by adding
232.29 + * "[Contributor] elects to include this software in this distribution
232.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
232.31 + * single choice of license, a recipient has the option to distribute
232.32 + * your version of this file under either the CDDL, the GPL Version 2 or
232.33 + * to extend the choice of license to its licensees as provided above.
232.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
232.35 + * Version 2 license, then the option applies only if the new code is
232.36 + * made subject to such option by the copyright holder.
232.37 + *
232.38 + * Contributor(s):
232.39 + *
232.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
232.41 + */
232.42 +
232.43 +package org.netbeans.modules.jackpot30.refactoring;
232.44 +
232.45 +import com.sun.source.util.TreePath;
232.46 +import java.util.regex.Pattern;
232.47 +import javax.lang.model.element.Element;
232.48 +import org.netbeans.api.java.source.SourceUtilsTestUtil;
232.49 +import org.netbeans.modules.jackpot30.impl.TestBase;
232.50 +
232.51 +/**
232.52 + *
232.53 + * @author lahvac
232.54 + */
232.55 +public class ScriptGeneratorTest extends TestBase {
232.56 +
232.57 + public ScriptGeneratorTest(String testName) {
232.58 + super(testName);
232.59 + }
232.60 +
232.61 + @Override
232.62 + protected void setUp() throws Exception {
232.63 + SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
232.64 + super.setUp();
232.65 + }
232.66 +
232.67 + public void testInstanceMethod() throws Exception {
232.68 + performTest("package test;\n" +
232.69 + "public class Test {\n" +
232.70 + " public void te|st() {}" +
232.71 + "}\n",
232.72 + "foo",
232.73 + " $0.test() :: $0 instanceof test.Test\n" +
232.74 + "=> $0.foo()\n" +
232.75 + ";;");
232.76 + }
232.77 +
232.78 + public void testInstanceMethodParam() throws Exception {
232.79 + performTest("package test;\n" +
232.80 + "public class Test {\n" +
232.81 + " public void te|st(int i) {}" +
232.82 + "}\n",
232.83 + "foo",
232.84 + " $0.test($i) :: $0 instanceof test.Test && $i instanceof int\n" +
232.85 + "=> $0.foo($i)\n" +
232.86 + ";;");
232.87 + }
232.88 +
232.89 + public void testStaticMethod() throws Exception {
232.90 + performTest("package test;\n" +
232.91 + "public class Test {\n" +
232.92 + " public static void te|st() {}" +
232.93 + "}\n",
232.94 + "foo",
232.95 + " test.Test.test()\n" +
232.96 + "=> test.Test.foo()\n" +
232.97 + ";;");
232.98 + }
232.99 +
232.100 + public void testStaticMethodParam() throws Exception {
232.101 + performTest("package test;\n" +
232.102 + "public class Test {\n" +
232.103 + " public static void te|st(int i) {}" +
232.104 + "}\n",
232.105 + "foo",
232.106 + " test.Test.test($i) :: $i instanceof int\n" +
232.107 + "=> test.Test.foo($i)\n" +
232.108 + ";;");
232.109 + }
232.110 +
232.111 + public void testMultipleParameters183659() throws Exception {
232.112 + performTest("package test;\n" +
232.113 + "public class Test {\n" +
232.114 + " public void te|st(int i, int j) {}" +
232.115 + "}\n",
232.116 + "foo",
232.117 + " $0.test($i, $j) :: $0 instanceof test.Test && $i instanceof int && $j instanceof int\n" +
232.118 + "=> $0.foo($i, $j)\n" +
232.119 + ";;");
232.120 + }
232.121 +
232.122 + private void performTest(String code, String newName, String script) throws Exception {
232.123 + assertEquals(2, code.split(Pattern.quote("|")).length);
232.124 +
232.125 + int pos = code.indexOf('|');
232.126 +
232.127 + code = code.substring(0, pos) + code.substring(pos + 1);
232.128 +
232.129 + prepareTest("test/Test.java", code);
232.130 +
232.131 + TreePath path = info.getTreeUtilities().pathFor(pos);
232.132 + Element el = info.getTrees().getElement(path);
232.133 +
232.134 + assertNotNull(el);
232.135 +
232.136 + assertEquals(script, ScriptGenerator.constructRenameRule(null, newName, el));
232.137 + }
232.138 +}
233.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
233.2 +++ b/sandbox/old-modules/help/build.xml Tue Feb 21 22:37:57 2012 +0100
233.3 @@ -0,0 +1,48 @@
233.4 +<?xml version="1.0" encoding="UTF-8"?>
233.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
233.6 +<!-- for some information on what you could do (e.g. targets to override). -->
233.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
233.8 +<project name="org.netbeans.modules.jackpot30.help" default="netbeans" basedir=".">
233.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.help.</description>
233.10 + <import file="nbproject/build-impl.xml"/>
233.11 + <import file="${suite.dir}/findbugs-import.xml"/>
233.12 +
233.13 + <target name="help-init">
233.14 + <property environment="ENV." />
233.15 + <condition property="hasLaTeX2HTML">
233.16 + <available file="latex2html" filepath="${ENV.PATH}" />
233.17 + </condition>
233.18 + </target>
233.19 +
233.20 + <target name="compile-help" depends="help-init" if="hasLaTeX2HTML">
233.21 + <mkdir dir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
233.22 +
233.23 + <copy file="jackpot30-helpset.xml" todir="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
233.24 +
233.25 + <exec executable="latex2html">
233.26 + <arg value="-antialias" />
233.27 + <arg value="-antialias_text" />
233.28 + <arg value="-dir" />
233.29 + <arg value="build/help/org/netbeans/modules/jackpot30/help/docs" />
233.30 + <arg value="jackpot30-help.tex" />
233.31 + </exec>
233.32 +
233.33 + <java classname="org.netbeans.modules.jackpot30.help.CreateMap"
233.34 + classpath="build/classes">
233.35 + <arg value="${basedir}/build/help/org/netbeans/modules/jackpot30/help/docs" />
233.36 + </java>
233.37 +
233.38 + <mkdir dir="${suite.dir}/build/cluster/modules/docs" />
233.39 +
233.40 + <jar destfile="${suite.dir}/build/cluster/modules/docs/org-netbeans-modules-jackpot30-help.jar" basedir="${basedir}/build/help">
233.41 +
233.42 + </jar>
233.43 + </target>
233.44 +
233.45 + <target name="compile" depends="projectized-common.compile,compile-help" />
233.46 +
233.47 + <target name="test" />
233.48 + <target name="test-coverage" />
233.49 + <target name="coverage-report" />
233.50 +
233.51 +</project>
234.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
234.2 +++ b/sandbox/old-modules/help/jackpot30-help.tex Tue Feb 21 22:37:57 2012 +0100
234.3 @@ -0,0 +1,119 @@
234.4 +\documentclass{article}
234.5 +\usepackage{verbdef}
234.6 +\usepackage{hyperref}
234.7 +
234.8 +\verbdef\simplevariable=$[0-9A-Za-z_]+=
234.9 +\verbdef\statementvariable=$[0-9A-Za-z_]+;=
234.10 +\verbdef\multipletreevariable=$[0-9A-Za-z_]+$=
234.11 +\verbdef\multiplestatementvariable=$[0-9A-Za-z_]+$;=
234.12 +\verbdef\wholepattern=$_=
234.13 +\verbdef\reserved=$$[0-9A-Za-z_]+=
234.14 +
234.15 +\begin{document}
234.16 +
234.17 +\section{Rules Language}
234.18 +
234.19 +\subsection{Basic Structure}
234.20 +
234.21 +The rules file consists of any number of transformation rules.
234.22 +The rule is defined as follows:
234.23 +\begin{verbatim}
234.24 + <pattern>
234.25 +=> <fix-pattern>
234.26 +=> <fix-pattern>
234.27 +;;
234.28 +\end{verbatim}
234.29 +
234.30 +Each occurrence of \verb=<pattern>= in the source code can be rewritten to one
234.31 +of the \verb=<fix-pattern>=s. For example, the following transformation rule:
234.32 +\begin{verbatim}
234.33 + $1 == null
234.34 +=> null == $1
234.35 +;;
234.36 +\end{verbatim}
234.37 +
234.38 +will rewrite the following code:
234.39 +\begin{verbatim}
234.40 +if (a == null) {
234.41 + System.err.println("a is null");
234.42 +}
234.43 +\end{verbatim}
234.44 +to:
234.45 +\begin{verbatim}
234.46 +if (null == a) {
234.47 + System.err.println("a is null");
234.48 +}
234.49 +\end{verbatim}
234.50 +
234.51 +Note: \verb=$1$= is a variable, explained \hyperref{below}{in Section~}{variables}{}.
234.52 +
234.53 +Note: batch refactoring will typically use only the first applicable fix patterns
234.54 +of each applicable rule.
234.55 +
234.56 +\subsection{Patterns}
234.57 +
234.58 +The pattern is a Java expression, statement or several statements.
234.59 +All references to classes in the pattern need to be resolvable, i.e. either fully
234.60 +qualified names need to be used, or the custom import section must be used
234.61 +(see \hyperref{Custom Imports}{Section~}{custom-import}{}).
234.62 +
234.63 +TODO: equivalence - static elements are checked only against themselves, blocks with
234.64 +one statement considered equivalent to single statement.
234.65 +
234.66 +Note: variable declaration is a Java statement.
234.67 +
234.68 +\subsection{Variables}
234.69 +
234.70 +Variables start with the dollar sign (\verb=$=). In the pattern, first occurrences
234.71 +of a variable is bound to the actual sub-tree that appears in the code. Second and
234.72 +following occurrences of the variable the actual sub-tree is verified against the subtree
234.73 +bound to the variable. The pattern occurs in the text only if the actual sub-tree
234.74 +matches the sub-tree bound to the variable. In the fix pattern, all occurrences of
234.75 +the variables are replaced with the tree(s) bound to the respective variables.
234.76 +
234.77 +The forms of the variables are:
234.78 +\begin{description}
234.79 +\item[\simplevariable]{any expression}
234.80 +\item[\statementvariable]{any statement}
234.81 +\item[\multipletreevariable]{any number of sub-trees (except statements - see next definition)}
234.82 +\item[\multiplestatementvariable]{any number of statements}
234.83 +\item[\wholepattern]{for patterns undefined, for fixes and conditions automatically bound to the current matched region}
234.84 +\item[\reserved]{reserved -- do not use}
234.85 +\end{description}
234.86 +
234.87 +\subsection{Conditions}
234.88 +
234.89 +Both the search and fix patterns may specify additional conditions. These conditions
234.90 +are specified after \verb=::=. Currently, the conditions have the following
234.91 +limitations:
234.92 +
234.93 +\begin{verbatim}
234.94 + $1.isDirectory() :: $1 instanceof java.io.File
234.95 +=> !$1.isFile()
234.96 +;;
234.97 +\end{verbatim}
234.98 +
234.99 +will rewrite the following code:
234.100 +\begin{verbatim}
234.101 +java.io.File testFile = new java.io.File("/tmp");
234.102 +if (testFile.isDirectory()) {
234.103 + System.err.println("/tmp is a directory");
234.104 +}
234.105 +\end{verbatim}
234.106 +to:
234.107 +\begin{verbatim}
234.108 +java.io.File testFile = new java.io.File("/tmp");
234.109 +if (!testFile.isFile()) {
234.110 + System.err.println("/tmp is a directory");
234.111 +}
234.112 +\end{verbatim}
234.113 +
234.114 +\subsection{Display Names and Localization}
234.115 +
234.116 +\subsection{Custom Conditions}
234.117 +
234.118 +\subsection{Custom Import}
234.119 +
234.120 +\subsection{Options}
234.121 +
234.122 +\end{document}
235.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
235.2 +++ b/sandbox/old-modules/help/jackpot30-helpset.xml Tue Feb 21 22:37:57 2012 +0100
235.3 @@ -0,0 +1,31 @@
235.4 +<?xml version="1.0" encoding="UTF-8"?>
235.5 +<!--
235.6 +To change this template, choose Tools | Templates
235.7 +and open the template in the editor.
235.8 +-->
235.9 +<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
235.10 +<helpset version="2.0">
235.11 + <title>Jackpot 3.0 Help</title>
235.12 + <maps>
235.13 + <homeID>jackpot30.about</homeID>
235.14 + <mapref location="jackpot30-map.xml"/>
235.15 + </maps>
235.16 + <view mergetype="javax.help.AppendMerge">
235.17 + <name>TOC</name>
235.18 + <label>Table of Contents</label>
235.19 + <type>javax.help.TOCView</type>
235.20 + <data>jackpot30-toc.xml</data>
235.21 + </view>
235.22 +<!-- <view mergetype="javax.help.AppendMerge">
235.23 + <name>Index</name>
235.24 + <label>Index</label>
235.25 + <type>javax.help.IndexView</type>
235.26 + <data>dsaf-idx.xml</data>
235.27 + </view>-->
235.28 +<!-- <view>
235.29 + <name>Search</name>
235.30 + <label>Search</label>
235.31 + <type>javax.help.SearchView</type>
235.32 + <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
235.33 + </view>-->
235.34 +</helpset>
236.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
236.2 +++ b/sandbox/old-modules/help/manifest.mf Tue Feb 21 22:37:57 2012 +0100
236.3 @@ -0,0 +1,7 @@
236.4 +Manifest-Version: 1.0
236.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.help
236.6 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/help/layer.xml
236.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/help/Bundle.properties
236.8 +OpenIDE-Module-Specification-Version: 1.16
236.9 +OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
236.10 +Class-Path: docs/org-netbeans-modules-jackpot30-help.jar
237.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
237.2 +++ b/sandbox/old-modules/help/nbproject-help.tex/build-settings.properties Tue Feb 21 22:37:57 2012 +0100
237.3 @@ -0,0 +1,3 @@
237.4 +build-configuration-name=latexdvips
237.5 +
237.6 +mainfile=../jackpot30-help.tex
238.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
238.2 +++ b/sandbox/old-modules/help/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
238.3 @@ -0,0 +1,45 @@
238.4 +<?xml version="1.0" encoding="UTF-8"?>
238.5 +<!--
238.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
238.7 +*** EDIT ../build.xml INSTEAD ***
238.8 +-->
238.9 +<project name="org.netbeans.modules.jackpot30.help-impl" basedir="..">
238.10 + <fail message="Please build using Ant 1.7.1 or higher.">
238.11 + <condition>
238.12 + <not>
238.13 + <antversion atleast="1.7.1"/>
238.14 + </not>
238.15 + </condition>
238.16 + </fail>
238.17 + <property file="nbproject/private/suite-private.properties"/>
238.18 + <property file="nbproject/suite.properties"/>
238.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
238.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
238.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
238.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
238.23 + <attribute name="name"/>
238.24 + <attribute name="value"/>
238.25 + <sequential>
238.26 + <property name="@{name}" value="${@{value}}"/>
238.27 + </sequential>
238.28 + </macrodef>
238.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
238.30 + <attribute name="property"/>
238.31 + <attribute name="value"/>
238.32 + <sequential>
238.33 + <property name="@{property}" value="@{value}"/>
238.34 + </sequential>
238.35 + </macrodef>
238.36 + <property file="${user.properties.file}"/>
238.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
238.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
238.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
238.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
238.41 + <condition>
238.42 + <not>
238.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
238.44 + </not>
238.45 + </condition>
238.46 + </fail>
238.47 + <import file="${harness.dir}/build.xml"/>
238.48 +</project>
239.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
239.2 +++ b/sandbox/old-modules/help/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
239.3 @@ -0,0 +1,8 @@
239.4 +build.xml.data.CRC32=ffaf56d3
239.5 +build.xml.script.CRC32=12cad5e6
239.6 +build.xml.stylesheet.CRC32=79c3b980@1.29.0.7
239.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
239.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
239.9 +nbproject/build-impl.xml.data.CRC32=ffaf56d3
239.10 +nbproject/build-impl.xml.script.CRC32=68ad079b
239.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.43
240.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
240.2 +++ b/sandbox/old-modules/help/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
240.3 @@ -0,0 +1,2 @@
240.4 +javac.source=1.5
240.5 +javac.compilerargs=-Xlint -Xlint:-serial
241.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
241.2 +++ b/sandbox/old-modules/help/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
241.3 @@ -0,0 +1,12 @@
241.4 +<?xml version="1.0" encoding="UTF-8"?>
241.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
241.6 + <type>org.netbeans.modules.apisupport.project</type>
241.7 + <configuration>
241.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
241.9 + <code-name-base>org.netbeans.modules.jackpot30.help</code-name-base>
241.10 + <suite-component/>
241.11 + <module-dependencies/>
241.12 + <public-packages/>
241.13 + </data>
241.14 + </configuration>
241.15 +</project>
242.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
242.2 +++ b/sandbox/old-modules/help/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
242.3 @@ -0,0 +1,1 @@
242.4 +suite.dir=${basedir}/..
243.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
243.2 +++ b/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
243.3 @@ -0,0 +1,38 @@
243.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
243.5 +#
243.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
243.7 +#
243.8 +# The contents of this file are subject to the terms of either the GNU
243.9 +# General Public License Version 2 only ("GPL") or the Common
243.10 +# Development and Distribution License("CDDL") (collectively, the
243.11 +# "License"). You may not use this file except in compliance with the
243.12 +# License. You can obtain a copy of the License at
243.13 +# http://www.netbeans.org/cddl-gplv2.html
243.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
243.15 +# specific language governing permissions and limitations under the
243.16 +# License. When distributing the software, include this License Header
243.17 +# Notice in each file and include the License file at
243.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
243.19 +# particular file as subject to the "Classpath" exception as provided
243.20 +# by Sun in the GPL Version 2 section of the License file that
243.21 +# accompanied this code. If applicable, add the following below the
243.22 +# License Header, with the fields enclosed by brackets [] replaced by
243.23 +# your own identifying information:
243.24 +# "Portions Copyrighted [year] [name of copyright owner]"
243.25 +#
243.26 +# If you wish your version of this file to be governed by only the CDDL
243.27 +# or only the GPL Version 2, indicate your decision by adding
243.28 +# "[Contributor] elects to include this software in this distribution
243.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
243.30 +# single choice of license, a recipient has the option to distribute
243.31 +# your version of this file under either the CDDL, the GPL Version 2 or
243.32 +# to extend the choice of license to its licensees as provided above.
243.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
243.34 +# Version 2 license, then the option applies only if the new code is
243.35 +# made subject to such option by the copyright holder.
243.36 +#
243.37 +# Contributor(s):
243.38 +#
243.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
243.40 +
243.41 +OpenIDE-Module-Name=Jackpot 3.0 Help
244.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
244.2 +++ b/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/CreateMap.java Tue Feb 21 22:37:57 2012 +0100
244.3 @@ -0,0 +1,196 @@
244.4 +/*
244.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
244.6 + *
244.7 + * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
244.8 + *
244.9 + * The contents of this file are subject to the terms of either the GNU
244.10 + * General Public License Version 2 only ("GPL") or the Common
244.11 + * Development and Distribution License("CDDL") (collectively, the
244.12 + * "License"). You may not use this file except in compliance with the
244.13 + * License. You can obtain a copy of the License at
244.14 + * http://www.netbeans.org/cddl-gplv2.html
244.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
244.16 + * specific language governing permissions and limitations under the
244.17 + * License. When distributing the software, include this License Header
244.18 + * Notice in each file and include the License file at
244.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
244.20 + * particular file as subject to the "Classpath" exception as provided
244.21 + * by Sun in the GPL Version 2 section of the License file that
244.22 + * accompanied this code. If applicable, add the following below the
244.23 + * License Header, with the fields enclosed by brackets [] replaced by
244.24 + * your own identifying information:
244.25 + * "Portions Copyrighted [year] [name of copyright owner]"
244.26 + *
244.27 + * Contributor(s):
244.28 + *
244.29 + * The Original Software is the LaTeX module.
244.30 + * The Initial Developer of the Original Software is Jan Lahoda.
244.31 + * Portions created by Jan Lahoda_ are Copyright (C) 2002-2009.
244.32 + * All Rights Reserved.
244.33 + *
244.34 + * If you wish your version of this file to be governed by only the CDDL
244.35 + * or only the GPL Version 2, indicate your decision by adding
244.36 + * "[Contributor] elects to include this software in this distribution
244.37 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
244.38 + * single choice of license, a recipient has the option to distribute
244.39 + * your version of this file under either the CDDL, the GPL Version 2 or
244.40 + * to extend the choice of license to its licensees as provided above.
244.41 + * However, if you add GPL Version 2 code and therefore, elected the GPL
244.42 + * Version 2 license, then the option applies only if the new code is
244.43 + * made subject to such option by the copyright holder.
244.44 + *
244.45 + * Contributor(s): Jan Lahoda.
244.46 + */
244.47 +package org.netbeans.modules.jackpot30.help;
244.48 +
244.49 +import java.io.BufferedReader;
244.50 +import java.io.File;
244.51 +import java.io.FileReader;
244.52 +import java.io.FileWriter;
244.53 +import java.io.IOException;
244.54 +import java.io.PrintWriter;
244.55 +import java.util.HashMap;
244.56 +import java.util.Map;
244.57 +
244.58 +/**
244.59 + *
244.60 + * @author Jan Lahoda
244.61 + */
244.62 +public class CreateMap {
244.63 +
244.64 + public CreateMap() {}
244.65 +
244.66 + /**
244.67 + * @param args the command line arguments
244.68 + */
244.69 + public static void main(String[] args) throws IOException {
244.70 + if (args.length != 1) {
244.71 + System.err.println("Incorrect number of arguments, one argument containing the location of the base dir is required.");
244.72 + return ;
244.73 + }
244.74 +
244.75 + File baseDir = new File(args[0]);
244.76 +
244.77 + if (!baseDir.exists()) {
244.78 + System.err.println(baseDir.getAbsolutePath() + " does not exist.");
244.79 + return ;
244.80 + }
244.81 +
244.82 + if (!baseDir.isDirectory()) {
244.83 + System.err.println(baseDir.getAbsolutePath() + " is not a directory.");
244.84 + return ;
244.85 + }
244.86 +
244.87 + File in = new File(baseDir, "labels.pl");
244.88 + File out = new File(baseDir, "jackpot30-map.xml");
244.89 +
244.90 + Map<String, String> map = createMapFile(in, out);
244.91 +
244.92 + File outTOC = new File(baseDir, "jackpot30-toc.xml");
244.93 + File inTOC = new File(baseDir, "jackpot30-help.html");
244.94 +
244.95 + createTOC(inTOC, outTOC, map);
244.96 + }
244.97 +
244.98 + private static Map<String, String> createMapFile(File in, File out) throws IOException {
244.99 + BufferedReader input = new BufferedReader(new FileReader(in));
244.100 + PrintWriter output = new PrintWriter(new FileWriter(out));
244.101 + Map<String, String> map = new HashMap<String, String>();
244.102 +
244.103 + output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
244.104 + output.println();
244.105 + output.println("<!DOCTYPE map");
244.106 + output.println(" PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN\"");
244.107 + output.println(" \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/map_1_0.dtd\">");
244.108 + output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/map_1_0.dtd\"-->");
244.109 + output.println();
244.110 + output.println("<map version=\"1.0\">");
244.111 +
244.112 + output.println("<mapID target=\"jackpot30.default\" url=\"jackpot30-help.html\" />");
244.113 +
244.114 + String line = null;
244.115 + String actualKey = null;
244.116 +
244.117 + while ((line = input.readLine()) != null) {
244.118 + if (line.startsWith("$key")) {
244.119 + actualKey = line.split("/")[1];
244.120 + actualKey = "jackpot30." + actualKey.replace(':', '.');
244.121 + }
244.122 +
244.123 + if (line.startsWith("$external_labels")) {
244.124 + String url = line.split("\\|")[1];
244.125 +
244.126 + output.print("<mapID target=\"");
244.127 + output.print(actualKey);
244.128 + output.print("\" url=\"");
244.129 + output.print(url);
244.130 + output.println("\"/>");
244.131 +
244.132 + map.put(url, actualKey);
244.133 +
244.134 + actualKey = null;
244.135 + }
244.136 + }
244.137 +
244.138 + output.println("</map>");
244.139 + output.close();
244.140 + input.close();
244.141 +
244.142 + return map;
244.143 + }
244.144 +
244.145 + private static void createTOC(File in, File out, Map<String, String> map) throws IOException {
244.146 + BufferedReader input = new BufferedReader(new FileReader(in));
244.147 + PrintWriter output = new PrintWriter(new FileWriter(out));
244.148 +
244.149 + String line = null;
244.150 + boolean noStop = false;
244.151 +
244.152 + output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
244.153 + output.println();
244.154 + output.println("<!DOCTYPE toc");
244.155 + output.println(" PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN\"");
244.156 + output.println(" \"file:///home/lahvac/netbeans/netbeans/bin/nbuser/sampledir/javahelp/toc_1_0.dtd\">");
244.157 + output.println("<!--This is the original DTD: \"http://java.sun.com/products/javahelp/toc_1_0.dtd\"-->");
244.158 + output.println();
244.159 + output.println("<toc version=\"1.0\">");
244.160 +
244.161 + while ((line = input.readLine()) != null && line.indexOf("<!--Table of Child-Links-->") == (-1))
244.162 + ;
244.163 +
244.164 + output.println("<tocitem text=\"Jackpot 3.0 Support Help\" target=\"jackpot30.default\">");
244.165 + while ((line = input.readLine()) != null && line.indexOf("<!--End of Table of Child-Links-->") == (-1)) {
244.166 + if (line.startsWith("<UL ")) {
244.167 + noStop = true;
244.168 + continue;
244.169 + }
244.170 +
244.171 + if (line.indexOf("HREF=\"") != (-1)) {
244.172 + if (noStop) {
244.173 + noStop = false;
244.174 + } else {
244.175 + output.println("</tocitem>");
244.176 + }
244.177 +
244.178 + String file = line.split("\"")[1];
244.179 + String name = line.split(">")[1].split("<")[0];
244.180 +
244.181 + output.println("<tocitem text=\"" + name + "\" target=\"" + (map.get(file) != null ? map.get(file) : "test") + "\">");
244.182 +
244.183 + continue;
244.184 + }
244.185 +
244.186 + if (line.startsWith("</UL>") && !noStop) {
244.187 + output.println("</tocitem>");
244.188 + continue;
244.189 + }
244.190 + }
244.191 +
244.192 + output.println("</tocitem>");
244.193 +
244.194 + output.println("</toc>");
244.195 +
244.196 + output.close();
244.197 + input.close();
244.198 + }
244.199 +}
245.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
245.2 +++ b/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/jackpot30-helpset.xml Tue Feb 21 22:37:57 2012 +0100
245.3 @@ -0,0 +1,3 @@
245.4 +<?xml version="1.0" encoding="UTF-8"?>
245.5 +<!DOCTYPE helpsetref PUBLIC "-//NetBeans//DTD JavaHelp Help Set Reference 1.0//EN" "http://www.netbeans.org/dtds/helpsetref-1_0.dtd">
245.6 +<helpsetref url="nbdocs:/org/netbeans/modules/jackpot30/help/docs/jackpot30-helpset.xml" />
246.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
246.2 +++ b/sandbox/old-modules/help/src/org/netbeans/modules/jackpot30/help/layer.xml Tue Feb 21 22:37:57 2012 +0100
246.3 @@ -0,0 +1,11 @@
246.4 +<?xml version="1.0" encoding="UTF-8"?>
246.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
246.6 +<filesystem>
246.7 + <folder name="Services">
246.8 + <folder name="JavaHelp">
246.9 + <file name="jackpot30-helpset.xml" url="jackpot30-helpset.xml">
246.10 + <attr name="position" intvalue="3456"/>
246.11 + </file>
246.12 + </folder>
246.13 + </folder>
246.14 +</filesystem>
247.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
247.2 +++ b/sandbox/old-modules/hintsimpl/build.xml Tue Feb 21 22:37:57 2012 +0100
247.3 @@ -0,0 +1,11 @@
247.4 +<?xml version="1.0" encoding="UTF-8"?>
247.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
247.6 +<!-- for some information on what you could do (e.g. targets to override). -->
247.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
247.8 +<project name="org.netbeans.modules.jackpot30.hintsimpl" default="netbeans" basedir=".">
247.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.hintsimpl.</description>
247.10 + <import file="nbproject/build-impl.xml"/>
247.11 + <import file="${suite.dir}/findbugs-import.xml"/>
247.12 + <target name="test-coverage" />
247.13 + <target name="coverage-report" />
247.14 +</project>
248.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
248.2 +++ b/sandbox/old-modules/hintsimpl/manifest.mf Tue Feb 21 22:37:57 2012 +0100
248.3 @@ -0,0 +1,7 @@
248.4 +Manifest-Version: 1.0
248.5 +AutoUpdate-Show-In-Client: false
248.6 +OpenIDE-Module: org.netbeans.modules.jackpot30.hintsimpl
248.7 +OpenIDE-Module-Implementation-Version: 1
248.8 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/hintsimpl/layer.xml
248.9 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties
248.10 +
249.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
249.2 +++ b/sandbox/old-modules/hintsimpl/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
249.3 @@ -0,0 +1,45 @@
249.4 +<?xml version="1.0" encoding="UTF-8"?>
249.5 +<!--
249.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
249.7 +*** EDIT ../build.xml INSTEAD ***
249.8 +-->
249.9 +<project name="org.netbeans.modules.jackpot30.hintsimpl-impl" basedir="..">
249.10 + <fail message="Please build using Ant 1.7.1 or higher.">
249.11 + <condition>
249.12 + <not>
249.13 + <antversion atleast="1.7.1"/>
249.14 + </not>
249.15 + </condition>
249.16 + </fail>
249.17 + <property file="nbproject/private/suite-private.properties"/>
249.18 + <property file="nbproject/suite.properties"/>
249.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
249.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
249.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
249.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
249.23 + <attribute name="name"/>
249.24 + <attribute name="value"/>
249.25 + <sequential>
249.26 + <property name="@{name}" value="${@{value}}"/>
249.27 + </sequential>
249.28 + </macrodef>
249.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
249.30 + <attribute name="property"/>
249.31 + <attribute name="value"/>
249.32 + <sequential>
249.33 + <property name="@{property}" value="@{value}"/>
249.34 + </sequential>
249.35 + </macrodef>
249.36 + <property file="${user.properties.file}"/>
249.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
249.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
249.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
249.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
249.41 + <condition>
249.42 + <not>
249.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
249.44 + </not>
249.45 + </condition>
249.46 + </fail>
249.47 + <import file="${harness.dir}/build.xml"/>
249.48 +</project>
250.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
250.2 +++ b/sandbox/old-modules/hintsimpl/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
250.3 @@ -0,0 +1,8 @@
250.4 +build.xml.data.CRC32=772824b9
250.5 +build.xml.script.CRC32=ef577a91
250.6 +build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
250.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
250.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
250.9 +nbproject/build-impl.xml.data.CRC32=2dfd5d11
250.10 +nbproject/build-impl.xml.script.CRC32=9204f652
250.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
251.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
251.2 +++ b/sandbox/old-modules/hintsimpl/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
251.3 @@ -0,0 +1,4 @@
251.4 +javac.source=1.5
251.5 +javac.compilerargs=-Xlint -Xlint:-serial
251.6 +project.license=cddl-netbeans-sun
251.7 +spec.version.base=1.16.0
252.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
252.2 +++ b/sandbox/old-modules/hintsimpl/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
252.3 @@ -0,0 +1,276 @@
252.4 +<?xml version="1.0" encoding="UTF-8"?>
252.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
252.6 + <type>org.netbeans.modules.apisupport.project</type>
252.7 + <configuration>
252.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
252.9 + <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
252.10 + <suite-component/>
252.11 + <module-dependencies>
252.12 + <dependency>
252.13 + <code-name-base>org.jdesktop.layout</code-name-base>
252.14 + <build-prerequisite/>
252.15 + <compile-dependency/>
252.16 + <run-dependency>
252.17 + <release-version>1</release-version>
252.18 + <specification-version>1.7.0.103</specification-version>
252.19 + </run-dependency>
252.20 + </dependency>
252.21 + <dependency>
252.22 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
252.23 + <build-prerequisite/>
252.24 + <compile-dependency/>
252.25 + <run-dependency>
252.26 + <release-version>1</release-version>
252.27 + <specification-version>1.19</specification-version>
252.28 + </run-dependency>
252.29 + </dependency>
252.30 + <dependency>
252.31 + <code-name-base>org.netbeans.api.progress</code-name-base>
252.32 + <build-prerequisite/>
252.33 + <compile-dependency/>
252.34 + <run-dependency>
252.35 + <release-version>1</release-version>
252.36 + <specification-version>1.13.0.1</specification-version>
252.37 + </run-dependency>
252.38 + </dependency>
252.39 + <dependency>
252.40 + <code-name-base>org.netbeans.libs.javacapi</code-name-base>
252.41 + <build-prerequisite/>
252.42 + <compile-dependency/>
252.43 + <run-dependency>
252.44 + <specification-version>0.8.0.1</specification-version>
252.45 + </run-dependency>
252.46 + </dependency>
252.47 + <dependency>
252.48 + <code-name-base>org.netbeans.modules.editor</code-name-base>
252.49 + <build-prerequisite/>
252.50 + <compile-dependency/>
252.51 + <run-dependency>
252.52 + <release-version>3</release-version>
252.53 + <specification-version>1.42.0.3.9.2</specification-version>
252.54 + </run-dependency>
252.55 + </dependency>
252.56 + <dependency>
252.57 + <code-name-base>org.netbeans.modules.editor.guards</code-name-base>
252.58 + <build-prerequisite/>
252.59 + <compile-dependency/>
252.60 + <run-dependency>
252.61 + <release-version>1</release-version>
252.62 + <specification-version>1.3</specification-version>
252.63 + </run-dependency>
252.64 + </dependency>
252.65 + <dependency>
252.66 + <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
252.67 + <build-prerequisite/>
252.68 + <compile-dependency/>
252.69 + <run-dependency>
252.70 + <release-version>1-3</release-version>
252.71 + <specification-version>1.38.0.9.2</specification-version>
252.72 + </run-dependency>
252.73 + </dependency>
252.74 + <dependency>
252.75 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
252.76 + <build-prerequisite/>
252.77 + <compile-dependency/>
252.78 + <run-dependency>
252.79 + <specification-version>1.0</specification-version>
252.80 + </run-dependency>
252.81 + </dependency>
252.82 + <dependency>
252.83 + <code-name-base>org.netbeans.modules.java.editor</code-name-base>
252.84 + <run-dependency>
252.85 + <release-version>1</release-version>
252.86 + <specification-version>2.22</specification-version>
252.87 + </run-dependency>
252.88 + </dependency>
252.89 + <dependency>
252.90 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
252.91 + <build-prerequisite/>
252.92 + <compile-dependency/>
252.93 + <run-dependency>
252.94 + <release-version>1</release-version>
252.95 + <implementation-version/>
252.96 + </run-dependency>
252.97 + </dependency>
252.98 + <dependency>
252.99 + <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
252.100 + <build-prerequisite/>
252.101 + <compile-dependency/>
252.102 + <run-dependency>
252.103 + <release-version>1</release-version>
252.104 + <specification-version>1.5</specification-version>
252.105 + </run-dependency>
252.106 + </dependency>
252.107 + <dependency>
252.108 + <code-name-base>org.netbeans.modules.java.source</code-name-base>
252.109 + <build-prerequisite/>
252.110 + <compile-dependency/>
252.111 + <run-dependency>
252.112 + <specification-version>0.53</specification-version>
252.113 + </run-dependency>
252.114 + </dependency>
252.115 + <dependency>
252.116 + <code-name-base>org.netbeans.modules.lexer</code-name-base>
252.117 + <build-prerequisite/>
252.118 + <compile-dependency/>
252.119 + <run-dependency>
252.120 + <release-version>2</release-version>
252.121 + <specification-version>1.30.0.1</specification-version>
252.122 + </run-dependency>
252.123 + </dependency>
252.124 + <dependency>
252.125 + <code-name-base>org.netbeans.modules.options.api</code-name-base>
252.126 + <build-prerequisite/>
252.127 + <compile-dependency/>
252.128 + <run-dependency>
252.129 + <release-version>1</release-version>
252.130 + <specification-version>1.12</specification-version>
252.131 + </run-dependency>
252.132 + </dependency>
252.133 + <dependency>
252.134 + <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
252.135 + <build-prerequisite/>
252.136 + <compile-dependency/>
252.137 + <run-dependency>
252.138 + <release-version>1</release-version>
252.139 + <specification-version>1.12.1</specification-version>
252.140 + </run-dependency>
252.141 + </dependency>
252.142 + <dependency>
252.143 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
252.144 + <build-prerequisite/>
252.145 + <compile-dependency/>
252.146 + <run-dependency>
252.147 + <release-version>1</release-version>
252.148 + <specification-version>1.24</specification-version>
252.149 + </run-dependency>
252.150 + </dependency>
252.151 + <dependency>
252.152 + <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
252.153 + <build-prerequisite/>
252.154 + <compile-dependency/>
252.155 + <run-dependency>
252.156 + <release-version>1</release-version>
252.157 + <specification-version>1.34.0.6</specification-version>
252.158 + </run-dependency>
252.159 + </dependency>
252.160 + <dependency>
252.161 + <code-name-base>org.netbeans.modules.sendopts</code-name-base>
252.162 + <build-prerequisite/>
252.163 + <compile-dependency/>
252.164 + <run-dependency>
252.165 + <release-version>2</release-version>
252.166 + <specification-version>2.4</specification-version>
252.167 + </run-dependency>
252.168 + </dependency>
252.169 + <dependency>
252.170 + <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
252.171 + <build-prerequisite/>
252.172 + <compile-dependency/>
252.173 + <run-dependency>
252.174 + <release-version>0-1</release-version>
252.175 + <specification-version>1.7.0.7.2</specification-version>
252.176 + </run-dependency>
252.177 + </dependency>
252.178 + <dependency>
252.179 + <code-name-base>org.netbeans.spi.tasklist</code-name-base>
252.180 + <build-prerequisite/>
252.181 + <compile-dependency/>
252.182 + <run-dependency>
252.183 + <release-version>1</release-version>
252.184 + <specification-version>1.4.0.1</specification-version>
252.185 + </run-dependency>
252.186 + </dependency>
252.187 + <dependency>
252.188 + <code-name-base>org.openide.awt</code-name-base>
252.189 + <build-prerequisite/>
252.190 + <compile-dependency/>
252.191 + <run-dependency>
252.192 + <specification-version>7.7.0.1</specification-version>
252.193 + </run-dependency>
252.194 + </dependency>
252.195 + <dependency>
252.196 + <code-name-base>org.openide.dialogs</code-name-base>
252.197 + <build-prerequisite/>
252.198 + <compile-dependency/>
252.199 + <run-dependency>
252.200 + <specification-version>7.10</specification-version>
252.201 + </run-dependency>
252.202 + </dependency>
252.203 + <dependency>
252.204 + <code-name-base>org.openide.filesystems</code-name-base>
252.205 + <build-prerequisite/>
252.206 + <compile-dependency/>
252.207 + <run-dependency>
252.208 + <specification-version>7.21.0.1.1</specification-version>
252.209 + </run-dependency>
252.210 + </dependency>
252.211 + <dependency>
252.212 + <code-name-base>org.openide.loaders</code-name-base>
252.213 + <build-prerequisite/>
252.214 + <compile-dependency/>
252.215 + <run-dependency>
252.216 + <specification-version>7.5</specification-version>
252.217 + </run-dependency>
252.218 + </dependency>
252.219 + <dependency>
252.220 + <code-name-base>org.openide.nodes</code-name-base>
252.221 + <build-prerequisite/>
252.222 + <compile-dependency/>
252.223 + <run-dependency>
252.224 + <specification-version>7.9.0.1</specification-version>
252.225 + </run-dependency>
252.226 + </dependency>
252.227 + <dependency>
252.228 + <code-name-base>org.openide.text</code-name-base>
252.229 + <build-prerequisite/>
252.230 + <compile-dependency/>
252.231 + <run-dependency>
252.232 + <specification-version>6.22</specification-version>
252.233 + </run-dependency>
252.234 + </dependency>
252.235 + <dependency>
252.236 + <code-name-base>org.openide.util</code-name-base>
252.237 + <build-prerequisite/>
252.238 + <compile-dependency/>
252.239 + <run-dependency>
252.240 + <specification-version>7.22.0.1</specification-version>
252.241 + </run-dependency>
252.242 + </dependency>
252.243 + <dependency>
252.244 + <code-name-base>org.openide.windows</code-name-base>
252.245 + <build-prerequisite/>
252.246 + <compile-dependency/>
252.247 + <run-dependency>
252.248 + <specification-version>6.26</specification-version>
252.249 + </run-dependency>
252.250 + </dependency>
252.251 + </module-dependencies>
252.252 + <test-dependencies>
252.253 + <test-type>
252.254 + <name>unit</name>
252.255 + <test-dependency>
252.256 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
252.257 + <compile-dependency/>
252.258 + </test-dependency>
252.259 + <test-dependency>
252.260 + <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
252.261 + <recursive/>
252.262 + <compile-dependency/>
252.263 + </test-dependency>
252.264 + <test-dependency>
252.265 + <code-name-base>org.netbeans.modules.java.hints.declarative.test</code-name-base>
252.266 + <recursive/>
252.267 + <compile-dependency/>
252.268 + </test-dependency>
252.269 + <test-dependency>
252.270 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
252.271 + <recursive/>
252.272 + <compile-dependency/>
252.273 + </test-dependency>
252.274 + </test-type>
252.275 + </test-dependencies>
252.276 + <public-packages/>
252.277 + </data>
252.278 + </configuration>
252.279 +</project>
253.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
253.2 +++ b/sandbox/old-modules/hintsimpl/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
253.3 @@ -0,0 +1,1 @@
253.4 +suite.dir=${basedir}/..
254.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
254.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
254.3 @@ -0,0 +1,38 @@
254.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
254.5 +#
254.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
254.7 +#
254.8 +# The contents of this file are subject to the terms of either the GNU
254.9 +# General Public License Version 2 only ("GPL") or the Common
254.10 +# Development and Distribution License("CDDL") (collectively, the
254.11 +# "License"). You may not use this file except in compliance with the
254.12 +# License. You can obtain a copy of the License at
254.13 +# http://www.netbeans.org/cddl-gplv2.html
254.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
254.15 +# specific language governing permissions and limitations under the
254.16 +# License. When distributing the software, include this License Header
254.17 +# Notice in each file and include the License file at
254.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
254.19 +# particular file as subject to the "Classpath" exception as provided
254.20 +# by Sun in the GPL Version 2 section of the License file that
254.21 +# accompanied this code. If applicable, add the following below the
254.22 +# License Header, with the fields enclosed by brackets [] replaced by
254.23 +# your own identifying information:
254.24 +# "Portions Copyrighted [year] [name of copyright owner]"
254.25 +#
254.26 +# If you wish your version of this file to be governed by only the CDDL
254.27 +# or only the GPL Version 2, indicate your decision by adding
254.28 +# "[Contributor] elects to include this software in this distribution
254.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
254.30 +# single choice of license, a recipient has the option to distribute
254.31 +# your version of this file under either the CDDL, the GPL Version 2 or
254.32 +# to extend the choice of license to its licensees as provided above.
254.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
254.34 +# Version 2 license, then the option applies only if the new code is
254.35 +# made subject to such option by the copyright holder.
254.36 +#
254.37 +# Contributor(s):
254.38 +#
254.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
254.40 +
254.41 +OpenIDE-Module-Name=Hints Impl
255.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
255.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.hint Tue Feb 21 22:37:57 2012 +0100
255.3 @@ -0,0 +1,37 @@
255.4 +{ $1$;
255.5 +$0.readLock();
255.6 +$stmts$;
255.7 +$0.readUnlock();
255.8 +$2$;
255.9 +}
255.10 +:: $0 instanceof javax.swing.text.AbstractDocument
255.11 +=>
255.12 +{ $1$;
255.13 +$0.readLock();
255.14 +try {
255.15 + $stmts$;
255.16 +} finally {
255.17 + $0.readUnlock();
255.18 +}
255.19 +$2$;
255.20 +}
255.21 +;;
255.22 +
255.23 +{ $1$;
255.24 +$0.writeLock();
255.25 +$stmts$;
255.26 +$0.writeUnlock();
255.27 +$2$;
255.28 +}
255.29 +:: $0 instanceof javax.swing.text.AbstractDocument
255.30 +=>
255.31 +{ $1$;
255.32 +$0.writeLock();
255.33 +try {
255.34 + $stmts$;
255.35 +} finally {
255.36 + $0.writeUnlock();
255.37 +}
255.38 +$2$;
255.39 +}
255.40 +;;
256.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
256.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/assert2if.hint Tue Feb 21 22:37:57 2012 +0100
256.3 @@ -0,0 +1,4 @@
256.4 +'Use of assert':
256.5 +assert $1 : $2; :: $1 instanceof boolean && $2 instanceof java.lang.Object
256.6 + => if (!$1) throw new IllegalStateException($2);
256.7 + ;;
257.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
257.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.hint Tue Feb 21 22:37:57 2012 +0100
257.3 @@ -0,0 +1,14 @@
257.4 +'Double checked locking':
257.5 +if ($var == null) {
257.6 + synchronized ($lock) {
257.7 + if ($var == null) {
257.8 + $s2$;
257.9 + }
257.10 + }
257.11 +} :: !hasModifier($var, Modifier.VOLATILE)
257.12 +=>
257.13 +synchronized ($lock) {
257.14 + if ($var == null) {
257.15 + $s2$;
257.16 + }
257.17 +};;
258.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
258.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.hint Tue Feb 21 22:37:57 2012 +0100
258.3 @@ -0,0 +1,7 @@
258.4 +if ($a) return $b; else return $c; => return $a ? $b : $c; ;;
258.5 +if ($a) $ret = $b; else $ret = $c; => $ret = $a ? $b : $c; ;;
258.6 +if ($a) $b=$c; else if ($a2) $b = $d; => $b = $a ? $c : $a2 ? $d : $b; ;;
258.7 +$a ? ($T)$b : ($T)$c => ($T)($a ? $b : $c) ;;
258.8 +//the following hint causes BulkSearch to be extremelly slow:
258.9 +//{ $p$; $T $v; if($a) $v = $b; else $v = $c; $q$; } => { $p$; $T $v = $a ? $b : $c; $q$; } ;;
258.10 +
259.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
259.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.hint Tue Feb 21 22:37:57 2012 +0100
259.3 @@ -0,0 +1,43 @@
259.4 +'Convert to Enhanced For':
259.5 +for(int $i = 0; $i < $array.length; $i++) {
259.6 + $T $var = ($T) $array[$i];
259.7 + $stmts$;
259.8 +} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
259.9 +=>
259.10 +for($T $var : $array) {
259.11 + $stmts$;
259.12 +}
259.13 +;;
259.14 +
259.15 +'Convert to Enhanced For':
259.16 +for(int $i = 0; $i < $array.length; $i++) {
259.17 + $T $var = $array[$i];
259.18 + $stmts$;
259.19 +} :: !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
259.20 +=>
259.21 +for($T $var : $array) {
259.22 + $stmts$;
259.23 +}
259.24 +;;
259.25 +
259.26 +'Convert to Enhanced For':
259.27 +for($I $i = $iterable.iterator(); $i.hasNext();) {
259.28 + $T $var = ($T)$i.next();
259.29 + $stmts$;
259.30 +} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
259.31 +=>
259.32 +for($T $var : $iterable) {
259.33 + $stmts$;
259.34 +}
259.35 +;;
259.36 +
259.37 +'Convert to Enhanced For':
259.38 +for($I $i = $iterable.iterator(); $i.hasNext();) {
259.39 + $T $var = $i.next();
259.40 + $stmts$;
259.41 +} :: $iterable instanceof java.lang.Iterable && !referencedIn($i, $stmts$) && sourceVersionGE(SourceVersion.RELEASE_5)
259.42 +=>
259.43 +for($T $var : $iterable) {
259.44 + $stmts$;
259.45 +}
259.46 +;;
260.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
260.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
260.3 @@ -0,0 +1,7 @@
260.4 +DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
260.5 +DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint=Convert to diamond bulk hint
260.6 +DN_jdk7_upgrade=To JDK7
260.7 +DN_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
260.8 +DESC_java.util.Objects=Convert to use java.util.Objects.{equals,hashCode}
260.9 +DN_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings ignoring the eq operator
260.10 +DESC_org.netbeans.modules.jackpot30.hintsimpl.jdk7.SafeConvertToSwitchString=Convert to switch over Strings, ignoring the == operator
261.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
261.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/SafeConvertToSwitchString.java Tue Feb 21 22:37:57 2012 +0100
261.3 @@ -0,0 +1,80 @@
261.4 +/*
261.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
261.6 + *
261.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
261.8 + *
261.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
261.10 + * Other names may be trademarks of their respective owners.
261.11 + *
261.12 + * The contents of this file are subject to the terms of either the GNU
261.13 + * General Public License Version 2 only ("GPL") or the Common
261.14 + * Development and Distribution License("CDDL") (collectively, the
261.15 + * "License"). You may not use this file except in compliance with the
261.16 + * License. You can obtain a copy of the License at
261.17 + * http://www.netbeans.org/cddl-gplv2.html
261.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
261.19 + * specific language governing permissions and limitations under the
261.20 + * License. When distributing the software, include this License Header
261.21 + * Notice in each file and include the License file at
261.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
261.23 + * particular file as subject to the "Classpath" exception as provided
261.24 + * by Oracle in the GPL Version 2 section of the License file that
261.25 + * accompanied this code. If applicable, add the following below the
261.26 + * License Header, with the fields enclosed by brackets [] replaced by
261.27 + * your own identifying information:
261.28 + * "Portions Copyrighted [year] [name of copyright owner]"
261.29 + *
261.30 + * If you wish your version of this file to be governed by only the CDDL
261.31 + * or only the GPL Version 2, indicate your decision by adding
261.32 + * "[Contributor] elects to include this software in this distribution
261.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
261.34 + * single choice of license, a recipient has the option to distribute
261.35 + * your version of this file under either the CDDL, the GPL Version 2 or
261.36 + * to extend the choice of license to its licensees as provided above.
261.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
261.38 + * Version 2 license, then the option applies only if the new code is
261.39 + * made subject to such option by the copyright holder.
261.40 + *
261.41 + * Contributor(s):
261.42 + *
261.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
261.44 + */
261.45 +
261.46 +package org.netbeans.modules.jackpot30.hintsimpl.jdk7;
261.47 +
261.48 +import java.util.List;
261.49 +import java.util.prefs.Preferences;
261.50 +import org.netbeans.modules.java.hints.jackpot.code.spi.Hint;
261.51 +import org.netbeans.modules.java.hints.jackpot.code.spi.TriggerPattern;
261.52 +import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
261.53 +import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
261.54 +import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata.Options;
261.55 +import org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch;
261.56 +import org.netbeans.modules.java.hints.options.HintsSettings;
261.57 +import org.netbeans.spi.editor.hints.ErrorDescription;
261.58 +
261.59 +/**
261.60 + *
261.61 + * @author lahvac
261.62 + */
261.63 +@Hint(category="rules15",enabled=false, options=Options.NON_GUI)
261.64 +public class SafeConvertToSwitchString {
261.65 +
261.66 + static final String KEY_ALSO_EQ = "also-equals";
261.67 + static final boolean DEF_ALSO_EQ = true;
261.68 +
261.69 + @TriggerPattern(value="if ($cond) $body; else $else;")
261.70 + public static List<ErrorDescription> hint(HintContext ctx) {
261.71 + Preferences prefs = RulesManager.getPreferences("org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch", HintsSettings.getCurrentProfileId());
261.72 + boolean old = prefs.getBoolean(KEY_ALSO_EQ, DEF_ALSO_EQ);
261.73 +
261.74 + prefs.putBoolean(KEY_ALSO_EQ, false);
261.75 +
261.76 + try {
261.77 + return ConvertToStringSwitch.hint(ctx);
261.78 + } finally {
261.79 + prefs.putBoolean(KEY_ALSO_EQ, old);
261.80 + }
261.81 + }
261.82 +
261.83 +}
262.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
262.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.hint Tue Feb 21 22:37:57 2012 +0100
262.3 @@ -0,0 +1,99 @@
262.4 +<!hint="java.util.Objects">
262.5 +//java.util.Objects.equals:
262.6 +($1 == null) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.7 +=>java.util.Objects.equals($1, $2)
262.8 +;;
262.9 +
262.10 +(null == $1) ? ($2 != null) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.11 +=>java.util.Objects.equals($1, $2)
262.12 +;;
262.13 +
262.14 +($1 == null) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.15 +=>java.util.Objects.equals($1, $2)
262.16 +;;
262.17 +
262.18 +(null == $1) ? (null != $2) : !$1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.19 +=>java.util.Objects.equals($1, $2)
262.20 +;;
262.21 +
262.22 +$1 != $2 && ($1 == null || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.23 +=>java.util.Objects.equals($1, $2)
262.24 +;;
262.25 +
262.26 +$1 != $2 && (null == $1 || !$1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.27 +=>java.util.Objects.equals($1, $2)
262.28 +;;
262.29 +
262.30 +($1 == null) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.31 +=>java.util.Objects.equals($1, $2)
262.32 +;;
262.33 +
262.34 +(null == $1) ? ($2 == null) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.35 +=>java.util.Objects.equals($1, $2)
262.36 +;;
262.37 +
262.38 +($1 == null) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.39 +=>java.util.Objects.equals($1, $2)
262.40 +;;
262.41 +
262.42 +(null == $1) ? (null == $2) : $1.equals($2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.43 +=>java.util.Objects.equals($1, $2)
262.44 +;;
262.45 +
262.46 +($1 != null) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.47 +=>java.util.Objects.equals($1, $2)
262.48 +;;
262.49 +
262.50 +(null != $1) ? $1.equals($2) : ($2 == null) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.51 +=>java.util.Objects.equals($1, $2)
262.52 +;;
262.53 +
262.54 +($1 != null) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.55 +=>java.util.Objects.equals($1, $2)
262.56 +;;
262.57 +
262.58 +(null != $1) ? $1.equals($2) : (null == $2) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.59 +=>java.util.Objects.equals($1, $2)
262.60 +;;
262.61 +
262.62 +$1 == $2 && ($1 == null || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.63 +=>java.util.Objects.equals($1, $2)
262.64 +;;
262.65 +
262.66 +$1 == $2 && (null == $1 || $1.equals($2)) :: $1 instanceof java.lang.Object && $2 instanceof java.lang.Object
262.67 +=>java.util.Objects.equals($1, $2)
262.68 +;;
262.69 +
262.70 +//java.util.Objects.hashCode:
262.71 +$1 != null ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
262.72 +=>java.util.Objects.hashCode($1)
262.73 +;;
262.74 +
262.75 +null != $1 ? $1.hashCode() : 0 :: $1 instanceof java.lang.Object
262.76 +=>java.util.Objects.hashCode($1)
262.77 +;;
262.78 +
262.79 +$1 == null ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
262.80 +=>java.util.Objects.hashCode($1)
262.81 +;;
262.82 +
262.83 +null == $1 ? 0 : $1.hashCode() :: $1 instanceof java.lang.Object
262.84 +=>java.util.Objects.hashCode($1)
262.85 +;;
262.86 +
262.87 +//java.util.Objects.toString:
262.88 +$1 != null ? $1.toString() : $def :: $1 instanceof java.lang.Object
262.89 +=>java.util.Objects.toString($1, $def)
262.90 +;;
262.91 +
262.92 +null != $1 ? $1.toString() : $def :: $1 instanceof java.lang.Object
262.93 +=>java.util.Objects.toString($1, $def)
262.94 +;;
262.95 +
262.96 +$1 == null ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
262.97 +=>java.util.Objects.hashCode($1, $def)
262.98 +;;
262.99 +
262.100 +null == $1 ? $def : $1.hashCode() :: $1 instanceof java.lang.Object
262.101 +=>java.util.Objects.hashCode($1, $def)
262.102 +;;
263.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
263.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/jdk7.upgrade Tue Feb 21 22:37:57 2012 +0100
263.3 @@ -0,0 +1,12 @@
263.4 +{
263.5 + "upgradeName" : "jdk7_upgrade",
263.6 + "bundle" : "org/netbeans/modules/jackpot30/hintsimpl/jdk7/Bundle",
263.7 + "hints" : [
263.8 + "org.netbeans.modules.jackpot30.hintsimpl.jdk7.ConvertToDiamondBulkHint",
263.9 + "org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch",
263.10 + "org.netbeans.modules.java.hints.jdk.ConvertToARM",
263.11 + "org.netbeans.modules.java.hints.jdk.JoinCatches",
263.12 + "org.netbeans.modules.java.hints.jdk.UseSpecificCatch",
263.13 + "java.util.Objects"
263.14 + ]
263.15 +}
264.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
264.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/layer.xml Tue Feb 21 22:37:57 2012 +0100
264.3 @@ -0,0 +1,63 @@
264.4 +<?xml version="1.0" encoding="UTF-8"?>
264.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
264.6 +<!--
264.7 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
264.8 +
264.9 +Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
264.10 +
264.11 +
264.12 +The contents of this file are subject to the terms of either the GNU
264.13 +General Public License Version 2 only ("GPL") or the Common
264.14 +Development and Distribution License("CDDL") (collectively, the
264.15 +"License"). You may not use this file except in compliance with the
264.16 +License. You can obtain a copy of the License at
264.17 +http://www.netbeans.org/cddl-gplv2.html
264.18 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
264.19 +specific language governing permissions and limitations under the
264.20 +License. When distributing the software, include this License Header
264.21 +Notice in each file and include the License file at
264.22 +nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
264.23 +particular file as subject to the "Classpath" exception as provided
264.24 +by Sun in the GPL Version 2 section of the License file that
264.25 +accompanied this code. If applicable, add the following below the
264.26 +License Header, with the fields enclosed by brackets [] replaced by
264.27 +your own identifying information:
264.28 +"Portions Copyrighted [year] [name of copyright owner]"
264.29 +
264.30 +Contributor(s):
264.31 +
264.32 +The Original Software is NetBeans. The Initial Developer of the Original
264.33 +Software is Sun Microsystems, Inc. Portions Copyright 2009-2010 Sun
264.34 +Microsystems, Inc. All Rights Reserved.
264.35 +
264.36 +If you wish your version of this file to be governed by only the CDDL
264.37 +or only the GPL Version 2, indicate your decision by adding
264.38 +"[Contributor] elects to include this software in this distribution
264.39 +under the [CDDL or GPL Version 2] license." If you do not indicate a
264.40 +single choice of license, a recipient has the option to distribute
264.41 +your version of this file under either the CDDL, the GPL Version 2 or
264.42 +to extend the choice of license to its licensees as provided above.
264.43 +However, if you add GPL Version 2 code and therefore, elected the GPL
264.44 +Version 2 license, then the option applies only if the new code is
264.45 +made subject to such option by the copyright holder.
264.46 +-->
264.47 +<filesystem>
264.48 +
264.49 + <folder name="org-netbeans-modules-java-hints">
264.50 + <folder name="declarative">
264.51 + <file name="Bundle.properties" url="jdk7/Bundle.properties" /> <!--XXX-->
264.52 + <file name="assert2if.hint" url="assert2if.hint" />
264.53 + <file name="variable-decl-assignment.hint" url="variable-decl-assignment.hint" />
264.54 + <file name="double-checked-locking.hint" url="double-checked-locking.hint" />
264.55 + <file name="sync-on-non-final.hint" url="sync-on-non-final.hint" />
264.56 + <file name="abstract-document.hint" url="abstract-document.hint" />
264.57 + <file name="AddConditionals.hint" url="jackpot/AddConditionals.hint" />
264.58 + <file name="EnhancedFor.hint" url="jackpot/EnhancedFor.hint" />
264.59 + <file name="java.util.Objects.hint" url="jdk7/java.util.Objects.hint" />
264.60 + </folder>
264.61 + <folder name="upgrades">
264.62 + <file name="jdk7.upgrade" url="jdk7/jdk7.upgrade" />
264.63 + </folder>
264.64 + </folder>
264.65 +
264.66 +</filesystem>
265.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
265.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/sync-on-non-final.hint Tue Feb 21 22:37:57 2012 +0100
265.3 @@ -0,0 +1,5 @@
265.4 +'Synchronizing on non-final field':
265.5 +synchronized($var) {
265.6 + $stmts$;
265.7 +} :: !hasModifier($var, Modifier.FINAL) && elementKindMatches($var, ElementKind.FIELD)
265.8 +;;
266.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
266.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/variable-decl-assignment.hint Tue Feb 21 22:37:57 2012 +0100
266.3 @@ -0,0 +1,4 @@
266.4 +'Separated variable declaration and assignment':
266.5 +{ $1 $2; $2 = $3; }
266.6 + => { $1 $2 = $3; }
266.7 + ;;
267.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
267.2 +++ b/sandbox/old-modules/hintsimpl/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.hint Tue Feb 21 22:37:57 2012 +0100
267.3 @@ -0,0 +1,31 @@
267.4 +'Wrong string comparison':
267.5 +$left == $right :: $left instanceof java.lang.String
267.6 + && $right instanceof java.lang.String
267.7 + && !isNullLiteral($left)
267.8 + && !isNullLiteral($right)
267.9 +=>$left == null ? $right == null : $left.equals($right)
267.10 +=>$left.equals($right)
267.11 +;;
267.12 +
267.13 +'Wrong string comparison':
267.14 +$left != $right :: $left instanceof java.lang.String
267.15 + && $right instanceof java.lang.String
267.16 + && !isNullLiteral($left)
267.17 + && !isNullLiteral($right)
267.18 + && !acceptGenerated($left, $right)
267.19 +=>!($left == null ? $right == null : $left.equals($right))
267.20 +=>!$left.equals($right)
267.21 +;;
267.22 +
267.23 +<?
267.24 +private boolean acceptGenerated(Variable left, Variable right) {
267.25 + Variable parent = left;
267.26 +
267.27 + while ((parent = context.parent(parent)) != null) {
267.28 + if (matcher.matches(parent, "$left != $right && ($left == null || $left.equals($right))"))
267.29 + return true;
267.30 + }
267.31 +
267.32 + return false;
267.33 +}
267.34 +?>
268.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
268.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/HintsTest.java Tue Feb 21 22:37:57 2012 +0100
268.3 @@ -0,0 +1,55 @@
268.4 +/*
268.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
268.6 + *
268.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
268.8 + *
268.9 + * The contents of this file are subject to the terms of either the GNU
268.10 + * General Public License Version 2 only ("GPL") or the Common
268.11 + * Development and Distribution License("CDDL") (collectively, the
268.12 + * "License"). You may not use this file except in compliance with the
268.13 + * License. You can obtain a copy of the License at
268.14 + * http://www.netbeans.org/cddl-gplv2.html
268.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
268.16 + * specific language governing permissions and limitations under the
268.17 + * License. When distributing the software, include this License Header
268.18 + * Notice in each file and include the License file at
268.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
268.20 + * particular file as subject to the "Classpath" exception as provided
268.21 + * by Sun in the GPL Version 2 section of the License file that
268.22 + * accompanied this code. If applicable, add the following below the
268.23 + * License Header, with the fields enclosed by brackets [] replaced by
268.24 + * your own identifying information:
268.25 + * "Portions Copyrighted [year] [name of copyright owner]"
268.26 + *
268.27 + * If you wish your version of this file to be governed by only the CDDL
268.28 + * or only the GPL Version 2, indicate your decision by adding
268.29 + * "[Contributor] elects to include this software in this distribution
268.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
268.31 + * single choice of license, a recipient has the option to distribute
268.32 + * your version of this file under either the CDDL, the GPL Version 2 or
268.33 + * to extend the choice of license to its licensees as provided above.
268.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
268.35 + * Version 2 license, then the option applies only if the new code is
268.36 + * made subject to such option by the copyright holder.
268.37 + *
268.38 + * Contributor(s):
268.39 + *
268.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
268.41 + */
268.42 +
268.43 +package org.netbeans.modules.jackpot30.hintsimpl;
268.44 +
268.45 +import junit.framework.TestSuite;
268.46 +import org.netbeans.modules.java.hints.declarative.test.api.DeclarativeHintsTestBase;
268.47 +
268.48 +/**
268.49 + *
268.50 + * @author lahvac
268.51 + */
268.52 +public class HintsTest extends DeclarativeHintsTestBase {
268.53 +
268.54 + public static TestSuite suite() {
268.55 + return suite(HintsTest.class);
268.56 + }
268.57 +
268.58 +}
269.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
269.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/abstract-document.test Tue Feb 21 22:37:57 2012 +0100
269.3 @@ -0,0 +1,46 @@
269.4 +%%TestCase simple-readlock
269.5 +package test;
269.6 +import javax.swing.text.AbstractDocument;
269.7 +public class Test {
269.8 + private void test(AbstractDocument d) {
269.9 + d.readLock();
269.10 + System.err.println(d.getText(0, d.getLength()));
269.11 + d.readUnlock();
269.12 + }
269.13 +}
269.14 +%%=>
269.15 +package test;
269.16 +import javax.swing.text.AbstractDocument;
269.17 +public class Test {
269.18 + private void test(AbstractDocument d) {
269.19 + d.readLock();
269.20 + try {
269.21 + System.err.println(d.getText(0, d.getLength()));
269.22 + } finally {
269.23 + d.readUnlock();
269.24 + }
269.25 + }
269.26 +}
269.27 +%%TestCase simple-writelock
269.28 +package test;
269.29 +import javax.swing.text.AbstractDocument;
269.30 +public class Test {
269.31 + private void test(AbstractDocument d) {
269.32 + d.writeLock();
269.33 + System.err.println(d.getText(0, d.getLength()));
269.34 + d.writeUnlock();
269.35 + }
269.36 +}
269.37 +%%=>
269.38 +package test;
269.39 +import javax.swing.text.AbstractDocument;
269.40 +public class Test {
269.41 + private void test(AbstractDocument d) {
269.42 + d.writeLock();
269.43 + try {
269.44 + System.err.println(d.getText(0, d.getLength()));
269.45 + } finally {
269.46 + d.writeUnlock();
269.47 + }
269.48 + }
269.49 +}
270.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
270.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/double-checked-locking.test Tue Feb 21 22:37:57 2012 +0100
270.3 @@ -0,0 +1,46 @@
270.4 +%%TestCase simple
270.5 +package test;
270.6 +public class Test {
270.7 + private static Object TEST;
270.8 + public static Object get() {
270.9 + if (TEST == null) {
270.10 + synchronized (Test.class) {
270.11 + if (TEST == null) {
270.12 + TEST = new Object();
270.13 + }
270.14 + }
270.15 + }
270.16 +
270.17 + return TEST;
270.18 + }
270.19 +}
270.20 +%%=>
270.21 +package test;
270.22 +public class Test {
270.23 + private static Object TEST;
270.24 + public static Object get() {
270.25 + synchronized (Test.class) {
270.26 + if (TEST == null) {
270.27 + TEST = new Object();
270.28 + }
270.29 + }
270.30 +
270.31 + return TEST;
270.32 + }
270.33 +}
270.34 +%%TestCase volatile
270.35 +package test;
270.36 +public class Test {
270.37 + private static volatile Object TEST;
270.38 + public static Object get() {
270.39 + if (TEST == null) {
270.40 + synchronized (Test.class) {
270.41 + if (TEST == null) {
270.42 + TEST = new Object();
270.43 + }
270.44 + }
270.45 + }
270.46 +
270.47 + return TEST;
270.48 + }
270.49 +}
271.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
271.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/AddConditionals.test Tue Feb 21 22:37:57 2012 +0100
271.3 @@ -0,0 +1,87 @@
271.4 +%%TestCase simple-return
271.5 +package test;
271.6 +public class Test {
271.7 + public int test(boolean b) {
271.8 + if (b)
271.9 + return 1;
271.10 + else
271.11 + return 2;
271.12 + }
271.13 +}
271.14 +%%=>
271.15 +package test;
271.16 +public class Test {
271.17 + public int test(boolean b) {
271.18 + return b ? 1 : 2;
271.19 + }
271.20 +}
271.21 +%%TestCase blocks-return
271.22 +package test;
271.23 +public class Test {
271.24 + public int test(boolean b) {
271.25 + if (b) {
271.26 + return 1;
271.27 + } else {
271.28 + return 2;
271.29 + }
271.30 + }
271.31 +}
271.32 +%%=>
271.33 +package test;
271.34 +public class Test {
271.35 + public int test(boolean b) {
271.36 + return b ? 1 : 2;
271.37 + }
271.38 +}
271.39 +%%TestCase simple-assignment
271.40 +package test;
271.41 +public class Test {
271.42 + public void test(boolean b) {
271.43 + int q = 3;
271.44 + if (b)
271.45 + q = 1;
271.46 + else
271.47 + q = 2;
271.48 + }
271.49 +}
271.50 +%%=>
271.51 +package test;
271.52 +public class Test {
271.53 + public void test(boolean b) {
271.54 + int q = 3;
271.55 + q = b ? 1 : 2;
271.56 + }
271.57 +}
271.58 +%%TestCase simplify-conditional-with-casts
271.59 +package test;
271.60 +public class Test {
271.61 + public void test(boolean b, Object o1, Object o2) {
271.62 + String s = b ? (String) o1 : (String) o2;
271.63 + }
271.64 +}
271.65 +%%=>
271.66 +package test;
271.67 +public class Test {
271.68 + public void test(boolean b, Object o1, Object o2) {
271.69 + String s = (String) (b ? o1 : o2);
271.70 + }
271.71 +}
271.72 +%%TestCase simplify-with-declaration
271.73 +package test;
271.74 +public class Test {
271.75 + public void test(boolean b) {
271.76 + int q;
271.77 + if (b)
271.78 + q = 1;
271.79 + else
271.80 + q = 2;
271.81 + }
271.82 +}
271.83 +%%=>
271.84 +package test;
271.85 +public class Test {
271.86 + public void test(boolean b) {
271.87 + int q;
271.88 + q = b ? 1 : 2;
271.89 + }
271.90 +}
272.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
272.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jackpot/EnhancedFor.test Tue Feb 21 22:37:57 2012 +0100
272.3 @@ -0,0 +1,64 @@
272.4 +%%TestCase simple-array
272.5 +package test;
272.6 +public class Test {
272.7 + private void test() {
272.8 + String[] a = new String[2];
272.9 +
272.10 + for (int c = 0; c < a.length; c++) {
272.11 + String s = a[c];
272.12 + System.err.println(s);
272.13 + }
272.14 + }
272.15 +}
272.16 +%%=>
272.17 +package test;
272.18 +public class Test {
272.19 + private void test() {
272.20 + String[] a = new String[2];
272.21 + for (String s : a) {
272.22 + System.err.println(s);
272.23 + }
272.24 + }
272.25 +}
272.26 +%%TestCase simple-iterable
272.27 +package test;
272.28 +import java.util.Iterator;
272.29 +public class Test {
272.30 + private void test(Iterable iterable) {
272.31 + for (Iterator it = iterable.iterator(); it.hasNext();) {
272.32 + String s = (String) it.next();
272.33 + System.err.println(s);
272.34 + }
272.35 + }
272.36 +}
272.37 +%%=>
272.38 +package test;
272.39 +import java.util.Iterator;
272.40 +public class Test {
272.41 + private void test(Iterable iterable) {
272.42 + for (String s : iterable) {
272.43 + System.err.println(s);
272.44 + }
272.45 + }
272.46 +}
272.47 +%%TestCase generified-iterable
272.48 +package test;
272.49 +import java.util.Iterator;
272.50 +public class Test {
272.51 + private void test(Iterable<? extends String> iterable) {
272.52 + for (Iterator<? extends String> it = iterable.iterator(); it.hasNext();) {
272.53 + String s = it.next();
272.54 + System.err.println(s);
272.55 + }
272.56 + }
272.57 +}
272.58 +%%=>
272.59 +package test;
272.60 +import java.util.Iterator;
272.61 +public class Test {
272.62 + private void test(Iterable<? extends String> iterable) {
272.63 + for (String s : iterable) {
272.64 + System.err.println(s);
272.65 + }
272.66 + }
272.67 +}
273.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
273.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/jdk7/java.util.Objects.test Tue Feb 21 22:37:57 2012 +0100
273.3 @@ -0,0 +1,68 @@
273.4 +%%TestCase positive-equals-1 DISABLED
273.5 +package test;
273.6 +public class Test {
273.7 + private boolean test(Object o1, Object o2) {
273.8 + return (o1 == null) ? (o2 != null) : !o1.equals(o2);
273.9 + }
273.10 +}
273.11 +%%=>
273.12 +package test;
273.13 +
273.14 +import java.util.Objects;
273.15 +
273.16 +public class Test {
273.17 + private boolean test(Object o1, Object o2) {
273.18 + return Objects.equals(o1, o2);
273.19 + }
273.20 +}
273.21 +%%TestCase positive-equals-2 DISABLED
273.22 +package test;
273.23 +public class Test {
273.24 + private boolean test(Object o1, Object o2) {
273.25 + return o1 != o2 && (o1 == null || !o1.equals(o2));
273.26 + }
273.27 +}
273.28 +%%=>
273.29 +package test;
273.30 +
273.31 +import java.util.Objects;
273.32 +
273.33 +public class Test {
273.34 + private boolean test(Object o1, Object o2) {
273.35 + return Objects.equals(o1, o2);
273.36 + }
273.37 +}
273.38 +%%TestCase positive-hashcode-1 DISABLED
273.39 +package test;
273.40 +public class Test {
273.41 + private boolean test(Object o1) {
273.42 + return (o1 != null ? o1.hashCode() : 0);
273.43 + }
273.44 +}
273.45 +%%=>
273.46 +package test;
273.47 +
273.48 +import java.util.Objects;
273.49 +
273.50 +public class Test {
273.51 + private boolean test(Object o1) {
273.52 + return Objects.hashCode(o1);
273.53 + }
273.54 +}
273.55 +%%TestCase positive-hashcode-2 DISABLED
273.56 +package test;
273.57 +public class Test {
273.58 + private boolean test(Object o1) {
273.59 + return o1 != null ? o1.hashCode() : 0;
273.60 + }
273.61 +}
273.62 +%%=>
273.63 +package test;
273.64 +
273.65 +import java.util.Objects;
273.66 +
273.67 +public class Test {
273.68 + private boolean test(Object o1) {
273.69 + return Objects.hashCode(o1);
273.70 + }
273.71 +}
274.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
274.2 +++ b/sandbox/old-modules/hintsimpl/test/unit/src/org/netbeans/modules/jackpot30/hintsimpl/wrong-string-comparison.test Tue Feb 21 22:37:57 2012 +0100
274.3 @@ -0,0 +1,56 @@
274.4 +%%TestCase simple
274.5 +package test;
274.6 +public class Test {
274.7 + public static boolean get(String s1, String s2) {
274.8 + return s1 == s2;
274.9 + }
274.10 +}
274.11 +%%=>
274.12 +package test;
274.13 +public class Test {
274.14 + public static boolean get(String s1, String s2) {
274.15 + return s1 == null ? s2 == null : s1.equals(s2);
274.16 + }
274.17 +}
274.18 +%%=>
274.19 +package test;
274.20 +public class Test {
274.21 + public static boolean get(String s1, String s2) {
274.22 + return s1.equals(s2);
274.23 + }
274.24 +}
274.25 +%%TestCase neg
274.26 +package test;
274.27 +public class Test {
274.28 + public static boolean get(String s1, String s2) {
274.29 + return s1 != s2;
274.30 + }
274.31 +}
274.32 +%%=>
274.33 +package test;
274.34 +public class Test {
274.35 + public static boolean get(String s1, String s2) {
274.36 + return !(s1 == null ? s2 == null : s1.equals(s2));
274.37 + }
274.38 +}
274.39 +%%=>
274.40 +package test;
274.41 +public class Test {
274.42 + public static boolean get(String s1, String s2) {
274.43 + return !s1.equals(s2);
274.44 + }
274.45 +}
274.46 +%%TestCase neg-accept
274.47 +package test;
274.48 +public class Test {
274.49 + public static boolean get(String s1, String s2) {
274.50 + return s1 != s2 && (s1 == null || s1.equals(s2));
274.51 + }
274.52 +}
274.53 +%%TestCase null
274.54 +package test;
274.55 +public class Test {
274.56 + public static boolean get(String s1, String s2) {
274.57 + return s1 == null;
274.58 + }
274.59 +}
275.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
275.2 +++ b/sandbox/old-modules/kit/build.xml Tue Feb 21 22:37:57 2012 +0100
275.3 @@ -0,0 +1,13 @@
275.4 +<?xml version="1.0" encoding="UTF-8"?>
275.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
275.6 +<!-- for some information on what you could do (e.g. targets to override). -->
275.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
275.8 +<project name="org.netbeans.modules.jackpot30.kit" default="netbeans" basedir=".">
275.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.kit.</description>
275.10 + <import file="nbproject/build-impl.xml"/>
275.11 +
275.12 + <target name="test" />
275.13 + <target name="test-coverage" />
275.14 + <target name="coverage-report" />
275.15 + <target name="findbugs" />
275.16 +</project>
276.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
276.2 +++ b/sandbox/old-modules/kit/manifest.mf Tue Feb 21 22:37:57 2012 +0100
276.3 @@ -0,0 +1,5 @@
276.4 +Manifest-Version: 1.0
276.5 +OpenIDE-Module: org.netbeans.modules.jackpot30.kit
276.6 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/kit/Bundle.properties
276.7 +OpenIDE-Module-Specification-Version: 1.16
276.8 +
277.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
277.2 +++ b/sandbox/old-modules/kit/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
277.3 @@ -0,0 +1,45 @@
277.4 +<?xml version="1.0" encoding="UTF-8"?>
277.5 +<!--
277.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
277.7 +*** EDIT ../build.xml INSTEAD ***
277.8 +-->
277.9 +<project name="org.netbeans.modules.jackpot30.kit-impl" basedir="..">
277.10 + <fail message="Please build using Ant 1.7.1 or higher.">
277.11 + <condition>
277.12 + <not>
277.13 + <antversion atleast="1.7.1"/>
277.14 + </not>
277.15 + </condition>
277.16 + </fail>
277.17 + <property file="nbproject/private/suite-private.properties"/>
277.18 + <property file="nbproject/suite.properties"/>
277.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
277.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
277.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
277.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
277.23 + <attribute name="name"/>
277.24 + <attribute name="value"/>
277.25 + <sequential>
277.26 + <property name="@{name}" value="${@{value}}"/>
277.27 + </sequential>
277.28 + </macrodef>
277.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
277.30 + <attribute name="property"/>
277.31 + <attribute name="value"/>
277.32 + <sequential>
277.33 + <property name="@{property}" value="@{value}"/>
277.34 + </sequential>
277.35 + </macrodef>
277.36 + <property file="${user.properties.file}"/>
277.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
277.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
277.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
277.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
277.41 + <condition>
277.42 + <not>
277.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
277.44 + </not>
277.45 + </condition>
277.46 + </fail>
277.47 + <import file="${harness.dir}/build.xml"/>
277.48 +</project>
278.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
278.2 +++ b/sandbox/old-modules/kit/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
278.3 @@ -0,0 +1,8 @@
278.4 +build.xml.data.CRC32=719584a7
278.5 +build.xml.script.CRC32=6c4da9a3
278.6 +build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
278.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
278.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
278.9 +nbproject/build-impl.xml.data.CRC32=ff5fa2e9
278.10 +nbproject/build-impl.xml.script.CRC32=c129207c
278.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47
279.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
279.2 +++ b/sandbox/old-modules/kit/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
279.3 @@ -0,0 +1,2 @@
279.4 +javac.source=1.5
279.5 +javac.compilerargs=-Xlint -Xlint:-serial
280.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
280.2 +++ b/sandbox/old-modules/kit/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
280.3 @@ -0,0 +1,33 @@
280.4 +<?xml version="1.0" encoding="UTF-8"?>
280.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
280.6 + <type>org.netbeans.modules.apisupport.project</type>
280.7 + <configuration>
280.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
280.9 + <code-name-base>org.netbeans.modules.jackpot30.kit</code-name-base>
280.10 + <suite-component/>
280.11 + <module-dependencies>
280.12 + <dependency>
280.13 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
280.14 + <build-prerequisite/>
280.15 + <compile-dependency/>
280.16 + <run-dependency>
280.17 + <specification-version>1.16</specification-version>
280.18 + </run-dependency>
280.19 + </dependency>
280.20 + <dependency>
280.21 + <code-name-base>org.netbeans.modules.jackpot30.hintsimpl</code-name-base>
280.22 + <run-dependency>
280.23 + <specification-version>1.16</specification-version>
280.24 + </run-dependency>
280.25 + </dependency>
280.26 + <dependency>
280.27 + <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
280.28 + <run-dependency>
280.29 + <specification-version>1.16</specification-version>
280.30 + </run-dependency>
280.31 + </dependency>
280.32 + </module-dependencies>
280.33 + <public-packages/>
280.34 + </data>
280.35 + </configuration>
280.36 +</project>
281.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
281.2 +++ b/sandbox/old-modules/kit/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
281.3 @@ -0,0 +1,1 @@
281.4 +suite.dir=${basedir}/..
282.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
282.2 +++ b/sandbox/old-modules/kit/src/org/netbeans/modules/jackpot30/kit/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
282.3 @@ -0,0 +1,38 @@
282.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
282.5 +#
282.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
282.7 +#
282.8 +# The contents of this file are subject to the terms of either the GNU
282.9 +# General Public License Version 2 only ("GPL") or the Common
282.10 +# Development and Distribution License("CDDL") (collectively, the
282.11 +# "License"). You may not use this file except in compliance with the
282.12 +# License. You can obtain a copy of the License at
282.13 +# http://www.netbeans.org/cddl-gplv2.html
282.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
282.15 +# specific language governing permissions and limitations under the
282.16 +# License. When distributing the software, include this License Header
282.17 +# Notice in each file and include the License file at
282.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
282.19 +# particular file as subject to the "Classpath" exception as provided
282.20 +# by Sun in the GPL Version 2 section of the License file that
282.21 +# accompanied this code. If applicable, add the following below the
282.22 +# License Header, with the fields enclosed by brackets [] replaced by
282.23 +# your own identifying information:
282.24 +# "Portions Copyrighted [year] [name of copyright owner]"
282.25 +#
282.26 +# If you wish your version of this file to be governed by only the CDDL
282.27 +# or only the GPL Version 2, indicate your decision by adding
282.28 +# "[Contributor] elects to include this software in this distribution
282.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
282.30 +# single choice of license, a recipient has the option to distribute
282.31 +# your version of this file under either the CDDL, the GPL Version 2 or
282.32 +# to extend the choice of license to its licensees as provided above.
282.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
282.34 +# Version 2 license, then the option applies only if the new code is
282.35 +# made subject to such option by the copyright holder.
282.36 +#
282.37 +# Contributor(s):
282.38 +#
282.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
282.40 +
282.41 +OpenIDE-Module-Name=Jackpot 3.0
283.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
283.2 +++ b/sandbox/old-modules/overlays/netbeans Tue Feb 21 22:37:57 2012 +0100
283.3 @@ -0,0 +1,307 @@
283.4 +diff --git a/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
283.5 +new file mode 100644
283.6 +--- /dev/null
283.7 ++++ b/openide.filesystems/src/META-INF/upgrade/org.openide.filesystems.FileObject.hint
283.8 +@@ -0,0 +1,23 @@
283.9 ++'FileObject.getPackageNameExt(char, char) is deprecated':
283.10 ++ $0.getPackageNameExt('/', '.') :: $0 instanceof org.openide.FileObject
283.11 ++=> $0.getPath()
283.12 ++;;
283.13 ++'FileObject.getPackageNameExt(char, char) is deprecated':
283.14 ++ $0.getPackageNameExt($1, '.') :: $0 instanceof org.openide.FileObject && $1 instanceof char
283.15 ++=> $0.getPath().replace('/', $1)
283.16 ++;;
283.17 ++
283.18 ++'FileObject.isReadOnly() is deprecated':
283.19 ++ $0.isReadOnly() :: $0 instanceof org.openide.FileObject
283.20 ++=> !$0.canWrite()
283.21 ++;;
283.22 ++
283.23 ++'Repository.getDefaultFileSystem()':
283.24 ++ org.openide.filesystems.Repository.getDefault.getDefaultFileSystem()
283.25 ++=> org.openide.filesystems.FileUtil.getConfigRoot()
283.26 ++;;
283.27 ++
283.28 ++'Repository.getDefaultFileSystem()':
283.29 ++ org.openide.filesystems.Repository.getDefault.getDefaultFileSystem().findResource($path) :: $path instanceof java.lang.String
283.30 ++=> org.openide.filesystems.FileUtil.getConfigFile($path)
283.31 ++;;
283.32 +diff --git a/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
283.33 +new file mode 100644
283.34 +--- /dev/null
283.35 ++++ b/openide.loaders/src/META-INF/upgrade/org.openide.loaders.DataObject.hint
283.36 +@@ -0,0 +1,3 @@
283.37 ++'DataObject.getCookie is obsolette':
283.38 ++$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
283.39 ++ => $this.getLookup().lookup($1) ;;
283.40 +diff --git a/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
283.41 +new file mode 100644
283.42 +--- /dev/null
283.43 ++++ b/openide.nodes/src/META-INF/upgrade/org.openide.nodes.Node.hint
283.44 +@@ -0,0 +1,3 @@
283.45 ++'Node.getCookie is obsolette':
283.46 ++$this.getCookie($1) :: $this instanceof org.openide.loaders.DataObject && $1 instanceof java.lang.Class
283.47 ++ => $this.getLookup().lookup($1) ;;
283.48 +diff --git a/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
283.49 +new file mode 100644
283.50 +--- /dev/null
283.51 ++++ b/openide.text/src/META-INF/upgrade/org.openide.text.Line.hint
283.52 +@@ -0,0 +1,12 @@
283.53 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
283.54 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE, $1) ;;
283.55 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
283.56 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT, $1) ;;
283.57 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
283.58 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW, $1) :: $1 instanceof int && $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS, $1) ;;
283.59 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TRY_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.NONE, org.openide.text.Line.ShowVisibilityType.NONE) ;;
283.60 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_SHOW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.NONE) ;;
283.61 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_GOTO) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
283.62 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_TOFRONT) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.OPEN, org.openide.text.Line.ShowVisibilityType.FRONT) ;;
283.63 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
283.64 ++'Line.show is deprecated': $this.show(org.openide.text.Line.SHOW_REUSE_NEW) :: $this instanceof org.openide.text.Line => $this.show(org.openide.text.Line.ShowOpenType.REUSE_NEW, org.openide.text.Line.ShowVisibilityType.FOCUS) ;;
283.65 +diff --git a/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
283.66 +new file mode 100644
283.67 +--- /dev/null
283.68 ++++ b/openide.util/src/META-INF/upgrade/org.openide.ErrorManager.hint
283.69 +@@ -0,0 +1,104 @@
283.70 ++'ErrorManager.notify is deprecated':
283.71 ++$this.notify(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.72 ++ =>org.openide.util.Exceptions.printStackTrace($1)
283.73 ++ ;;
283.74 ++
283.75 ++'ErrorManager.notify is deprecated':
283.76 ++org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.77 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
283.78 ++ ;;
283.79 ++
283.80 ++'ErrorManager.notify is deprecated':
283.81 ++org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.82 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
283.83 ++ ;;
283.84 ++
283.85 ++'ErrorManager.notify is deprecated':
283.86 ++org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.87 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, null, $1)
283.88 ++ ;;
283.89 ++
283.90 ++'ErrorManager.notify is deprecated':
283.91 ++org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.92 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
283.93 ++ ;;
283.94 ++
283.95 ++'ErrorManager.notify is deprecated':
283.96 ++org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.97 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, null, $1)
283.98 ++ ;;
283.99 ++
283.100 ++'ErrorManager.notify is deprecated':
283.101 ++$this.notify($1) :: $1 instanceof java.lang.Throwable && $this instanceof org.openide.ErrorManager
283.102 ++ =>org.openide.util.Exceptions.printStackTrace($1)
283.103 ++ ;;
283.104 ++
283.105 ++'ErrorManager.log is deprecated':
283.106 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.UNKNOWN, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.107 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.INFO, $1)
283.108 ++ ;;
283.109 ++
283.110 ++'ErrorManager.log is deprecated':
283.111 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.ERROR, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.112 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
283.113 ++ ;;
283.114 ++
283.115 ++'ErrorManager.log is deprecated':
283.116 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.EXCEPTION, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.117 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, $1)
283.118 ++ ;;
283.119 ++
283.120 ++'ErrorManager.log is deprecated':
283.121 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.INFORMATIONAL, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.122 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
283.123 ++ ;;
283.124 ++
283.125 ++'ErrorManager.log is deprecated':
283.126 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.USER, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.127 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
283.128 ++ ;;
283.129 ++
283.130 ++'ErrorManager.log is deprecated':
283.131 ++org.openide.ErrorManager.getDefault().log(org.openide.ErrorManager.WARNING, $1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.132 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.WARNING, $1)
283.133 ++ ;;
283.134 ++
283.135 ++'ErrorManager.log is deprecated':
283.136 ++org.openide.ErrorManager.getDefault().log($1) :: $1 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.137 ++ =>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.FINE, $1)
283.138 ++ ;;
283.139 ++
283.140 ++'ErrorManager.isLoggable is deprecated':
283.141 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.UNKNOWN) :: $this instanceof org.openide.ErrorManager
283.142 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.INFO)
283.143 ++ ;;
283.144 ++
283.145 ++'ErrorManager.isLoggable is deprecated':
283.146 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.ERROR) :: $this instanceof org.openide.ErrorManager
283.147 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
283.148 ++ ;;
283.149 ++
283.150 ++'ErrorManager.isLoggable is deprecated':
283.151 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.EXCEPTION) :: $this instanceof org.openide.ErrorManager
283.152 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.SEVERE)
283.153 ++ ;;
283.154 ++
283.155 ++'ErrorManager.isLoggable is deprecated':
283.156 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.INFORMATIONAL) :: $this instanceof org.openide.ErrorManager
283.157 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.FINE)
283.158 ++ ;;
283.159 ++
283.160 ++'ErrorManager.isLoggable is deprecated':
283.161 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.USER) :: $this instanceof org.openide.ErrorManager
283.162 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
283.163 ++ ;;
283.164 ++
283.165 ++'ErrorManager.isLoggable is deprecated':
283.166 ++org.openide.ErrorManager.getDefault().isLoggable(org.openide.ErrorManager.WARNING) :: $this instanceof org.openide.ErrorManager
283.167 ++ =>java.util.logging.Logger.getLogger("global").isLoggable(java.util.logging.Level.WARNING)
283.168 ++ ;;
283.169 ++
283.170 ++'ErrorManager.annotate is deprecated':
283.171 ++$this.annotate($1, $2) :: $1 instanceof java.lang.Throwable && $2 instanceof java.lang.String && $this instanceof org.openide.ErrorManager
283.172 ++ =>org.openide.util.Exceptions.attachLocalizedMessage($1, $2)
283.173 ++ ;;
283.174 +diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
283.175 +new file mode 100644
283.176 +--- /dev/null
283.177 ++++ b/openide.util/src/META-INF/upgrade/org.openide.util.Lookup.hint
283.178 +@@ -0,0 +1,17 @@
283.179 ++'Lookup.lookupAll can be used instead':
283.180 ++$0.lookup(new org.openide.util.Lookup.Template($1)).allInstances() :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class
283.181 ++=>
283.182 ++$0.lookupAll($1)
283.183 ++;;
283.184 ++
283.185 ++'Lookup.lookupResult can be used instead':
283.186 ++$0.lookup(new org.openide.util.Lookup.Template($1)) :: $0 instanceof org.openide.util.Lookup && $1 instanceof java.lang.Class && !parentMatches("$_.allInstances()")
283.187 ++=>
283.188 ++$0.lookupResult($1)
283.189 ++;;
283.190 ++
283.191 ++'Lookup.Template() is deprecated':
283.192 ++new org.openide.util.Lookup.Template()
283.193 ++=>
283.194 ++new org.openide.util.Lookup.Template(java.lang.Object.class)
283.195 ++;;
283.196 +diff --git a/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
283.197 +new file mode 100644
283.198 +--- /dev/null
283.199 ++++ b/openide.util/src/META-INF/upgrade/org.openide.util.Utilities.hint
283.200 +@@ -0,0 +1,19 @@
283.201 ++'Utilities.mergeImages is deprecated':
283.202 ++ org.openide.util.Utilities.mergeImages($1, $2, $3, $4) :: $1 instanceof java.awt.Image && $2 instanceof java.awt.Image && $3 instanceof int && $4 instanceof int
283.203 ++=> org.openide.util.ImageUtilities.mergeImages($1, $2, $3, $4)
283.204 ++;;
283.205 ++
283.206 ++'Utilities.loadImage is deprecated':
283.207 ++ org.openide.util.Utilities.loadImage($1) :: $1 instanceof String
283.208 ++=> org.openide.util.ImageUtilities.loadImage($1)
283.209 ++;;
283.210 ++
283.211 ++'Utilities.icon2Image is deprecated':
283.212 ++ org.openide.util.Utilities.icon2Image($1) :: $1 instanceof javax.swing.Icon
283.213 ++=> org.openide.util.ImageUtilities.icon2Image($1)
283.214 ++;;
283.215 ++
283.216 ++'Utilities.image2Icon can be used instead of new ImageIcon':
283.217 ++ new javax.swing.ImageIcon($1) :: $1 instanceof java.awt.Image
283.218 ++=> org.openide.util.ImageUtilities.image2Icon($1)
283.219 ++;;
283.220 +diff --git a/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
283.221 +new file mode 100644
283.222 +--- /dev/null
283.223 ++++ b/openide.util/test/unit/src/META-INF/upgrade/org.openide.util.Utilities.test
283.224 +@@ -0,0 +1,86 @@
283.225 ++%%TestCase mergeImages1
283.226 ++package test;
283.227 ++import java.awt.Image;
283.228 ++import org.openide.util.Utilities;
283.229 ++public class Test {
283.230 ++ private void test() {
283.231 ++ Image i1 = null, i2 = null;
283.232 ++ Utilities.mergeImages(i1, i2, -9, 34);
283.233 ++ }
283.234 ++}
283.235 ++%%=>
283.236 ++package test;
283.237 ++import java.awt.Image;
283.238 ++import org.openide.util.ImageUtilities;
283.239 ++import org.openide.util.Utilities;
283.240 ++public class Test {
283.241 ++ private void test() {
283.242 ++ Image i1 = null, i2 = null;
283.243 ++ ImageUtilities.mergeImages(i1, i2, -9, 34);
283.244 ++ }
283.245 ++}
283.246 ++%%TestCase loadImage1
283.247 ++package test;
283.248 ++import java.awt.Image;
283.249 ++import org.openide.util.Utilities;
283.250 ++public class Test {
283.251 ++ private void test() {
283.252 ++ Utilities.loadImage("foobar");
283.253 ++ }
283.254 ++}
283.255 ++%%=>
283.256 ++package test;
283.257 ++import java.awt.Image;
283.258 ++import org.openide.util.ImageUtilities;
283.259 ++import org.openide.util.Utilities;
283.260 ++public class Test {
283.261 ++ private void test() {
283.262 ++ ImageUtilities.loadImage("foobar");
283.263 ++ }
283.264 ++}
283.265 ++%%TestCase icon2Image1
283.266 ++package test;
283.267 ++import javax.swing.Icon;
283.268 ++import org.openide.util.Utilities;
283.269 ++public class Test {
283.270 ++ private void test() {
283.271 ++ Icon i = null;
283.272 ++ Utilities.icon2Image(i);
283.273 ++ }
283.274 ++}
283.275 ++%%=>
283.276 ++package test;
283.277 ++import javax.swing.Icon;
283.278 ++import org.openide.util.ImageUtilities;
283.279 ++import org.openide.util.Utilities;
283.280 ++public class Test {
283.281 ++ private void test() {
283.282 ++ Icon i = null;
283.283 ++ ImageUtilities.icon2Image(i);
283.284 ++ }
283.285 ++}
283.286 ++%%TestCase image2Icon1
283.287 ++package test;
283.288 ++import java.awt.Image;
283.289 ++import javax.swing.Icon;
283.290 ++import javax.swing.ImageIcon;
283.291 ++import org.openide.util.Utilities;
283.292 ++public class Test {
283.293 ++ private void test() {
283.294 ++ Image img = null;
283.295 ++ Icon i = new ImageIcon(img);
283.296 ++ }
283.297 ++}
283.298 ++%%=>
283.299 ++package test;
283.300 ++import java.awt.Image;
283.301 ++import javax.swing.Icon;
283.302 ++import javax.swing.ImageIcon;
283.303 ++import org.openide.util.ImageUtilities;
283.304 ++import org.openide.util.Utilities;
283.305 ++public class Test {
283.306 ++ private void test() {
283.307 ++ Image img = null;
283.308 ++ Icon i = ImageUtilities.image2Icon(img);
283.309 ++ }
283.310 ++}
284.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
284.2 +++ b/sandbox/old-modules/server/do-indexing Tue Feb 21 22:37:57 2012 +0100
284.3 @@ -0,0 +1,27 @@
284.4 +#!/bin/bash -x
284.5 +
284.6 +performIndexing() {
284.7 + name=`basename $1`;
284.8 + if [ -d $name ] ; then
284.9 + HG_OUT=$(tempfile) || exit
284.10 + trap "rm -f -- '$HG_OUT'" EXIT
284.11 + MODIFIED=$(tempfile) || exit
284.12 + trap "rm -f -- '$HG_OUT' '$MODIFIED'" EXIT
284.13 + REMOVED=$(tempfile) || exit
284.14 + trap "rm -f -- '$HG_OUT' '$MODIFIED' '$REMOVED'" EXIT
284.15 +
284.16 + (cd $name; hg pull; hg --verbose up >$HG_OUT; grep <$HG_OUT "^getting " | cut -d ' ' -f 2- >$MODIFIED; grep <$HG_OUT "^removing " | cut -d ' ' -f 2- >$REMOVED;)
284.17 + java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2 "$MODIFIED" "$REMOVED"
284.18 + else
284.19 + hg clone $1
284.20 + java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2
284.21 + fi;
284.22 +}
284.23 +
284.24 +mkdir -p cache
284.25 +
284.26 +for f in `echo $1 | tr ',' '\n'`; do
284.27 + performIndexing $f cache
284.28 +done
284.29 +
284.30 +exit
285.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
285.2 +++ b/sandbox/old-modules/server/indexer/build.xml Tue Feb 21 22:37:57 2012 +0100
285.3 @@ -0,0 +1,86 @@
285.4 +<?xml version="1.0" encoding="UTF-8"?>
285.5 +<!-- You may freely edit this file. See commented blocks below for -->
285.6 +<!-- some examples of how to customize the build. -->
285.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
285.8 +<!-- By default, only the Clean and Build commands use this build script. -->
285.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
285.10 +<!-- the Compile on Save feature is turned off for the project. -->
285.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
285.12 +<!-- in the project's Project Properties dialog box.-->
285.13 +<project name="indexer" default="default" basedir=".">
285.14 + <description>Builds, tests, and runs the project indexer.</description>
285.15 + <import file="../download.xml"/>
285.16 + <import file="nbproject/build-impl.xml"/>
285.17 + <!--
285.18 +
285.19 + There exist several targets which are by default empty and which can be
285.20 + used for execution of your tasks. These targets are usually executed
285.21 + before and after some main targets. They are:
285.22 +
285.23 + -pre-init: called before initialization of project properties
285.24 + -post-init: called after initialization of project properties
285.25 + -pre-compile: called before javac compilation
285.26 + -post-compile: called after javac compilation
285.27 + -pre-compile-single: called before javac compilation of single file
285.28 + -post-compile-single: called after javac compilation of single file
285.29 + -pre-compile-test: called before javac compilation of JUnit tests
285.30 + -post-compile-test: called after javac compilation of JUnit tests
285.31 + -pre-compile-test-single: called before javac compilation of single JUnit test
285.32 + -post-compile-test-single: called after javac compilation of single JUunit test
285.33 + -pre-jar: called before JAR building
285.34 + -post-jar: called after JAR building
285.35 + -post-clean: called after cleaning build products
285.36 +
285.37 + (Targets beginning with '-' are not intended to be called on their own.)
285.38 +
285.39 + Example of inserting an obfuscator after compilation could look like this:
285.40 +
285.41 + <target name="-post-compile">
285.42 + <obfuscate>
285.43 + <fileset dir="${build.classes.dir}"/>
285.44 + </obfuscate>
285.45 + </target>
285.46 +
285.47 + For list of available properties check the imported
285.48 + nbproject/build-impl.xml file.
285.49 +
285.50 +
285.51 + Another way to customize the build is by overriding existing main targets.
285.52 + The targets of interest are:
285.53 +
285.54 + -init-macrodef-javac: defines macro for javac compilation
285.55 + -init-macrodef-junit: defines macro for junit execution
285.56 + -init-macrodef-debug: defines macro for class debugging
285.57 + -init-macrodef-java: defines macro for class execution
285.58 + -do-jar-with-manifest: JAR building (if you are using a manifest)
285.59 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
285.60 + run: execution of project
285.61 + -javadoc-build: Javadoc generation
285.62 + test-report: JUnit report generation
285.63 +
285.64 + An example of overriding the target for project execution could look like this:
285.65 +
285.66 + <target name="run" depends="indexer-impl.jar">
285.67 + <exec dir="bin" executable="launcher.exe">
285.68 + <arg file="${dist.jar}"/>
285.69 + </exec>
285.70 + </target>
285.71 +
285.72 + Notice that the overridden target depends on the jar target and not only on
285.73 + the compile target as the regular run target does. Again, for a list of available
285.74 + properties which you can use, check the target you are overriding in the
285.75 + nbproject/build-impl.xml file.
285.76 +
285.77 + -->
285.78 +
285.79 + <target name="copy-to-hudson" depends="jar">
285.80 + <mkdir dir="${hudson.compiler.dir}" /> <!--only to be sure, should exist-->
285.81 + <copy todir="${hudson.compiler.dir}/indexer">
285.82 + <fileset dir="${dist.dir}"/>
285.83 + </copy>
285.84 + </target>
285.85 +
285.86 + <target name="-post-clean">
285.87 + <delete dir="${hudson.compiler.dir}/indexer"/>
285.88 + </target>
285.89 +</project>
286.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
286.2 +++ b/sandbox/old-modules/server/indexer/manifest.mf Tue Feb 21 22:37:57 2012 +0100
286.3 @@ -0,0 +1,3 @@
286.4 +Manifest-Version: 1.0
286.5 +X-COMMENT: Main-Class will be added automatically by build
286.6 +
287.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
287.2 +++ b/sandbox/old-modules/server/indexer/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
287.3 @@ -0,0 +1,914 @@
287.4 +<?xml version="1.0" encoding="UTF-8"?>
287.5 +<!--
287.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
287.7 +*** EDIT ../build.xml INSTEAD ***
287.8 +
287.9 +For the purpose of easier reading the script
287.10 +is divided into following sections:
287.11 +
287.12 + - initialization
287.13 + - compilation
287.14 + - jar
287.15 + - execution
287.16 + - debugging
287.17 + - javadoc
287.18 + - junit compilation
287.19 + - junit execution
287.20 + - junit debugging
287.21 + - applet
287.22 + - cleanup
287.23 +
287.24 + -->
287.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="indexer-impl">
287.26 + <fail message="Please build using Ant 1.7.1 or higher.">
287.27 + <condition>
287.28 + <not>
287.29 + <antversion atleast="1.7.1"/>
287.30 + </not>
287.31 + </condition>
287.32 + </fail>
287.33 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
287.34 + <!--
287.35 + ======================
287.36 + INITIALIZATION SECTION
287.37 + ======================
287.38 + -->
287.39 + <target name="-pre-init">
287.40 + <!-- Empty placeholder for easier customization. -->
287.41 + <!-- You can override this target in the ../build.xml file. -->
287.42 + </target>
287.43 + <target depends="-pre-init" name="-init-private">
287.44 + <property file="nbproject/private/config.properties"/>
287.45 + <property file="nbproject/private/configs/${config}.properties"/>
287.46 + <property file="nbproject/private/private.properties"/>
287.47 + </target>
287.48 + <target name="-pre-init-libraries">
287.49 + <property location="../lib/nblibraries.properties" name="libraries.path"/>
287.50 + <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
287.51 + <pathconvert dirsep="/" property="libraries.dir">
287.52 + <path path="${libraries.dir.nativedirsep}"/>
287.53 + </pathconvert>
287.54 + <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
287.55 + <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
287.56 + </target>
287.57 + <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
287.58 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
287.59 + <filterchain>
287.60 + <replacestring from="$${base}" to="${libraries.dir}"/>
287.61 + <escapeunicode/>
287.62 + </filterchain>
287.63 + </loadproperties>
287.64 + </target>
287.65 + <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
287.66 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
287.67 + <filterchain>
287.68 + <replacestring from="$${base}" to="${libraries.dir}"/>
287.69 + <escapeunicode/>
287.70 + </filterchain>
287.71 + </loadproperties>
287.72 + </target>
287.73 + <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
287.74 + <property file="${user.properties.file}"/>
287.75 + <!-- The two properties below are usually overridden -->
287.76 + <!-- by the active platform. Just a fallback. -->
287.77 + <property name="default.javac.source" value="1.4"/>
287.78 + <property name="default.javac.target" value="1.4"/>
287.79 + </target>
287.80 + <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
287.81 + <property file="nbproject/configs/${config}.properties"/>
287.82 + <property file="nbproject/project.properties"/>
287.83 + </target>
287.84 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
287.85 + <available file="${manifest.file}" property="manifest.available"/>
287.86 + <condition property="main.class.available">
287.87 + <and>
287.88 + <isset property="main.class"/>
287.89 + <not>
287.90 + <equals arg1="${main.class}" arg2="" trim="true"/>
287.91 + </not>
287.92 + </and>
287.93 + </condition>
287.94 + <condition property="manifest.available+main.class">
287.95 + <and>
287.96 + <isset property="manifest.available"/>
287.97 + <isset property="main.class.available"/>
287.98 + </and>
287.99 + </condition>
287.100 + <condition property="do.mkdist">
287.101 + <and>
287.102 + <isset property="libs.CopyLibs.classpath"/>
287.103 + <not>
287.104 + <istrue value="${mkdist.disabled}"/>
287.105 + </not>
287.106 + </and>
287.107 + </condition>
287.108 + <condition property="manifest.available+main.class+mkdist.available">
287.109 + <and>
287.110 + <istrue value="${manifest.available+main.class}"/>
287.111 + <isset property="do.mkdist"/>
287.112 + </and>
287.113 + </condition>
287.114 + <condition property="manifest.available+mkdist.available">
287.115 + <and>
287.116 + <istrue value="${manifest.available}"/>
287.117 + <isset property="do.mkdist"/>
287.118 + </and>
287.119 + </condition>
287.120 + <condition property="manifest.available-mkdist.available">
287.121 + <or>
287.122 + <istrue value="${manifest.available}"/>
287.123 + <isset property="do.mkdist"/>
287.124 + </or>
287.125 + </condition>
287.126 + <condition property="manifest.available+main.class-mkdist.available">
287.127 + <or>
287.128 + <istrue value="${manifest.available+main.class}"/>
287.129 + <isset property="do.mkdist"/>
287.130 + </or>
287.131 + </condition>
287.132 + <condition property="have.tests">
287.133 + <or>
287.134 + <available file="${test.src.dir}"/>
287.135 + </or>
287.136 + </condition>
287.137 + <condition property="have.sources">
287.138 + <or>
287.139 + <available file="${src.dir}"/>
287.140 + </or>
287.141 + </condition>
287.142 + <condition property="netbeans.home+have.tests">
287.143 + <and>
287.144 + <isset property="netbeans.home"/>
287.145 + <isset property="have.tests"/>
287.146 + </and>
287.147 + </condition>
287.148 + <condition property="no.javadoc.preview">
287.149 + <and>
287.150 + <isset property="javadoc.preview"/>
287.151 + <isfalse value="${javadoc.preview}"/>
287.152 + </and>
287.153 + </condition>
287.154 + <property name="run.jvmargs" value=""/>
287.155 + <property name="javac.compilerargs" value=""/>
287.156 + <property name="work.dir" value="${basedir}"/>
287.157 + <condition property="no.deps">
287.158 + <and>
287.159 + <istrue value="${no.dependencies}"/>
287.160 + </and>
287.161 + </condition>
287.162 + <property name="javac.debug" value="true"/>
287.163 + <property name="javadoc.preview" value="true"/>
287.164 + <property name="application.args" value=""/>
287.165 + <property name="source.encoding" value="${file.encoding}"/>
287.166 + <property name="runtime.encoding" value="${source.encoding}"/>
287.167 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
287.168 + <and>
287.169 + <isset property="javadoc.encoding"/>
287.170 + <not>
287.171 + <equals arg1="${javadoc.encoding}" arg2=""/>
287.172 + </not>
287.173 + </and>
287.174 + </condition>
287.175 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
287.176 + <property name="includes" value="**"/>
287.177 + <property name="excludes" value=""/>
287.178 + <property name="do.depend" value="false"/>
287.179 + <condition property="do.depend.true">
287.180 + <istrue value="${do.depend}"/>
287.181 + </condition>
287.182 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
287.183 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
287.184 + <length length="0" string="${endorsed.classpath}" when="greater"/>
287.185 + </condition>
287.186 + <property name="javac.fork" value="false"/>
287.187 + </target>
287.188 + <target name="-post-init">
287.189 + <!-- Empty placeholder for easier customization. -->
287.190 + <!-- You can override this target in the ../build.xml file. -->
287.191 + </target>
287.192 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
287.193 + <fail unless="src.dir">Must set src.dir</fail>
287.194 + <fail unless="test.src.dir">Must set test.src.dir</fail>
287.195 + <fail unless="build.dir">Must set build.dir</fail>
287.196 + <fail unless="dist.dir">Must set dist.dir</fail>
287.197 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
287.198 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
287.199 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
287.200 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
287.201 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
287.202 + <fail unless="dist.jar">Must set dist.jar</fail>
287.203 + </target>
287.204 + <target name="-init-macrodef-property">
287.205 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
287.206 + <attribute name="name"/>
287.207 + <attribute name="value"/>
287.208 + <sequential>
287.209 + <property name="@{name}" value="${@{value}}"/>
287.210 + </sequential>
287.211 + </macrodef>
287.212 + </target>
287.213 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
287.214 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
287.215 + <attribute default="${src.dir}" name="srcdir"/>
287.216 + <attribute default="${build.classes.dir}" name="destdir"/>
287.217 + <attribute default="${javac.classpath}" name="classpath"/>
287.218 + <attribute default="${javac.processorpath}" name="processorpath"/>
287.219 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
287.220 + <attribute default="${includes}" name="includes"/>
287.221 + <attribute default="${excludes}" name="excludes"/>
287.222 + <attribute default="${javac.debug}" name="debug"/>
287.223 + <attribute default="${empty.dir}" name="sourcepath"/>
287.224 + <attribute default="${empty.dir}" name="gensrcdir"/>
287.225 + <element name="customize" optional="true"/>
287.226 + <sequential>
287.227 + <property location="${build.dir}/empty" name="empty.dir"/>
287.228 + <mkdir dir="${empty.dir}"/>
287.229 + <mkdir dir="@{apgeneratedsrcdir}"/>
287.230 + <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}">
287.231 + <src>
287.232 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
287.233 + <include name="*"/>
287.234 + </dirset>
287.235 + </src>
287.236 + <classpath>
287.237 + <path path="@{classpath}"/>
287.238 + </classpath>
287.239 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
287.240 + <compilerarg line="${javac.compilerargs}"/>
287.241 + <compilerarg value="-processorpath"/>
287.242 + <compilerarg path="@{processorpath}"/>
287.243 + <compilerarg line="${ap.processors.internal}"/>
287.244 + <compilerarg value="-s"/>
287.245 + <compilerarg path="@{apgeneratedsrcdir}"/>
287.246 + <compilerarg line="${ap.proc.none.internal}"/>
287.247 + <customize/>
287.248 + </javac>
287.249 + </sequential>
287.250 + </macrodef>
287.251 + </target>
287.252 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
287.253 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
287.254 + <attribute default="${src.dir}" name="srcdir"/>
287.255 + <attribute default="${build.classes.dir}" name="destdir"/>
287.256 + <attribute default="${javac.classpath}" name="classpath"/>
287.257 + <attribute default="${javac.processorpath}" name="processorpath"/>
287.258 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
287.259 + <attribute default="${includes}" name="includes"/>
287.260 + <attribute default="${excludes}" name="excludes"/>
287.261 + <attribute default="${javac.debug}" name="debug"/>
287.262 + <attribute default="${empty.dir}" name="sourcepath"/>
287.263 + <attribute default="${empty.dir}" name="gensrcdir"/>
287.264 + <element name="customize" optional="true"/>
287.265 + <sequential>
287.266 + <property location="${build.dir}/empty" name="empty.dir"/>
287.267 + <mkdir dir="${empty.dir}"/>
287.268 + <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}">
287.269 + <src>
287.270 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
287.271 + <include name="*"/>
287.272 + </dirset>
287.273 + </src>
287.274 + <classpath>
287.275 + <path path="@{classpath}"/>
287.276 + </classpath>
287.277 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
287.278 + <compilerarg line="${javac.compilerargs}"/>
287.279 + <customize/>
287.280 + </javac>
287.281 + </sequential>
287.282 + </macrodef>
287.283 + </target>
287.284 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
287.285 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
287.286 + <attribute default="${src.dir}" name="srcdir"/>
287.287 + <attribute default="${build.classes.dir}" name="destdir"/>
287.288 + <attribute default="${javac.classpath}" name="classpath"/>
287.289 + <sequential>
287.290 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
287.291 + <classpath>
287.292 + <path path="@{classpath}"/>
287.293 + </classpath>
287.294 + </depend>
287.295 + </sequential>
287.296 + </macrodef>
287.297 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
287.298 + <attribute default="${build.classes.dir}" name="destdir"/>
287.299 + <sequential>
287.300 + <fail unless="javac.includes">Must set javac.includes</fail>
287.301 + <pathconvert pathsep="," property="javac.includes.binary">
287.302 + <path>
287.303 + <filelist dir="@{destdir}" files="${javac.includes}"/>
287.304 + </path>
287.305 + <globmapper from="*.java" to="*.class"/>
287.306 + </pathconvert>
287.307 + <delete>
287.308 + <files includes="${javac.includes.binary}"/>
287.309 + </delete>
287.310 + </sequential>
287.311 + </macrodef>
287.312 + </target>
287.313 + <target name="-init-macrodef-junit">
287.314 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
287.315 + <attribute default="${includes}" name="includes"/>
287.316 + <attribute default="${excludes}" name="excludes"/>
287.317 + <attribute default="**" name="testincludes"/>
287.318 + <sequential>
287.319 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
287.320 + <batchtest todir="${build.test.results.dir}">
287.321 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
287.322 + <filename name="@{testincludes}"/>
287.323 + </fileset>
287.324 + </batchtest>
287.325 + <classpath>
287.326 + <path path="${run.test.classpath}"/>
287.327 + </classpath>
287.328 + <syspropertyset>
287.329 + <propertyref prefix="test-sys-prop."/>
287.330 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
287.331 + </syspropertyset>
287.332 + <formatter type="brief" usefile="false"/>
287.333 + <formatter type="xml"/>
287.334 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
287.335 + <jvmarg line="${run.jvmargs}"/>
287.336 + </junit>
287.337 + </sequential>
287.338 + </macrodef>
287.339 + </target>
287.340 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
287.341 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
287.342 + <attribute default="${main.class}" name="name"/>
287.343 + <attribute default="${debug.classpath}" name="classpath"/>
287.344 + <attribute default="" name="stopclassname"/>
287.345 + <sequential>
287.346 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
287.347 + <classpath>
287.348 + <path path="@{classpath}"/>
287.349 + </classpath>
287.350 + </nbjpdastart>
287.351 + </sequential>
287.352 + </macrodef>
287.353 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
287.354 + <attribute default="${build.classes.dir}" name="dir"/>
287.355 + <sequential>
287.356 + <nbjpdareload>
287.357 + <fileset dir="@{dir}" includes="${fix.classes}">
287.358 + <include name="${fix.includes}*.class"/>
287.359 + </fileset>
287.360 + </nbjpdareload>
287.361 + </sequential>
287.362 + </macrodef>
287.363 + </target>
287.364 + <target name="-init-debug-args">
287.365 + <property name="version-output" value="java version "${ant.java.version}"/>
287.366 + <condition property="have-jdk-older-than-1.4">
287.367 + <or>
287.368 + <contains string="${version-output}" substring="java version "1.0"/>
287.369 + <contains string="${version-output}" substring="java version "1.1"/>
287.370 + <contains string="${version-output}" substring="java version "1.2"/>
287.371 + <contains string="${version-output}" substring="java version "1.3"/>
287.372 + </or>
287.373 + </condition>
287.374 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
287.375 + <istrue value="${have-jdk-older-than-1.4}"/>
287.376 + </condition>
287.377 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
287.378 + <os family="windows"/>
287.379 + </condition>
287.380 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
287.381 + <isset property="debug.transport"/>
287.382 + </condition>
287.383 + </target>
287.384 + <target depends="-init-debug-args" name="-init-macrodef-debug">
287.385 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
287.386 + <attribute default="${main.class}" name="classname"/>
287.387 + <attribute default="${debug.classpath}" name="classpath"/>
287.388 + <element name="customize" optional="true"/>
287.389 + <sequential>
287.390 + <java classname="@{classname}" dir="${work.dir}" fork="true">
287.391 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
287.392 + <jvmarg line="${debug-args-line}"/>
287.393 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
287.394 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
287.395 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
287.396 + <jvmarg line="${run.jvmargs}"/>
287.397 + <classpath>
287.398 + <path path="@{classpath}"/>
287.399 + </classpath>
287.400 + <syspropertyset>
287.401 + <propertyref prefix="run-sys-prop."/>
287.402 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
287.403 + </syspropertyset>
287.404 + <customize/>
287.405 + </java>
287.406 + </sequential>
287.407 + </macrodef>
287.408 + </target>
287.409 + <target name="-init-macrodef-java">
287.410 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
287.411 + <attribute default="${main.class}" name="classname"/>
287.412 + <attribute default="${run.classpath}" name="classpath"/>
287.413 + <element name="customize" optional="true"/>
287.414 + <sequential>
287.415 + <java classname="@{classname}" dir="${work.dir}" fork="true">
287.416 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
287.417 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
287.418 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
287.419 + <jvmarg line="${run.jvmargs}"/>
287.420 + <classpath>
287.421 + <path path="@{classpath}"/>
287.422 + </classpath>
287.423 + <syspropertyset>
287.424 + <propertyref prefix="run-sys-prop."/>
287.425 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
287.426 + </syspropertyset>
287.427 + <customize/>
287.428 + </java>
287.429 + </sequential>
287.430 + </macrodef>
287.431 + </target>
287.432 + <target name="-init-presetdef-jar">
287.433 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
287.434 + <jar compress="${jar.compress}" jarfile="${dist.jar}">
287.435 + <j2seproject1:fileset dir="${build.classes.dir}"/>
287.436 + </jar>
287.437 + </presetdef>
287.438 + </target>
287.439 + <target name="-init-ap-cmdline-properties">
287.440 + <property name="annotation.processing.enabled" value="true"/>
287.441 + <property name="annotation.processing.processors.list" value=""/>
287.442 + <property name="annotation.processing.run.all.processors" value="true"/>
287.443 + <property name="javac.processorpath" value="${javac.classpath}"/>
287.444 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
287.445 + <condition property="ap.supported.internal" value="true">
287.446 + <not>
287.447 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
287.448 + </not>
287.449 + </condition>
287.450 + </target>
287.451 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
287.452 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
287.453 + <isfalse value="${annotation.processing.run.all.processors}"/>
287.454 + </condition>
287.455 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
287.456 + <isfalse value="${annotation.processing.enabled}"/>
287.457 + </condition>
287.458 + </target>
287.459 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
287.460 + <property name="ap.cmd.line.internal" value=""/>
287.461 + </target>
287.462 + <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-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
287.463 + <!--
287.464 + ===================
287.465 + COMPILATION SECTION
287.466 + ===================
287.467 + -->
287.468 + <target name="-deps-jar-init" unless="built-jar.properties">
287.469 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
287.470 + <delete file="${built-jar.properties}" quiet="true"/>
287.471 + </target>
287.472 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
287.473 + <echo level="warn" message="Cycle detected: indexer was already built"/>
287.474 + </target>
287.475 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
287.476 + <mkdir dir="${build.dir}"/>
287.477 + <touch file="${built-jar.properties}" verbose="false"/>
287.478 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
287.479 + <antcall target="-warn-already-built-jar"/>
287.480 + <propertyfile file="${built-jar.properties}">
287.481 + <entry key="${basedir}" value=""/>
287.482 + </propertyfile>
287.483 + <antcall target="-maybe-call-dep">
287.484 + <param name="call.built.properties" value="${built-jar.properties}"/>
287.485 + <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
287.486 + <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
287.487 + <param name="call.target" value="netbeans"/>
287.488 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
287.489 + </antcall>
287.490 + </target>
287.491 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
287.492 + <target depends="init" name="-check-automatic-build">
287.493 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
287.494 + </target>
287.495 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
287.496 + <antcall target="clean"/>
287.497 + </target>
287.498 + <target depends="init,deps-jar" name="-pre-pre-compile">
287.499 + <mkdir dir="${build.classes.dir}"/>
287.500 + </target>
287.501 + <target name="-pre-compile">
287.502 + <!-- Empty placeholder for easier customization. -->
287.503 + <!-- You can override this target in the ../build.xml file. -->
287.504 + </target>
287.505 + <target if="do.depend.true" name="-compile-depend">
287.506 + <pathconvert property="build.generated.subdirs">
287.507 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
287.508 + <include name="*"/>
287.509 + </dirset>
287.510 + </pathconvert>
287.511 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
287.512 + </target>
287.513 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
287.514 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
287.515 + <copy todir="${build.classes.dir}">
287.516 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
287.517 + </copy>
287.518 + </target>
287.519 + <target name="-post-compile">
287.520 + <!-- Empty placeholder for easier customization. -->
287.521 + <!-- You can override this target in the ../build.xml file. -->
287.522 + </target>
287.523 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
287.524 + <target name="-pre-compile-single">
287.525 + <!-- Empty placeholder for easier customization. -->
287.526 + <!-- You can override this target in the ../build.xml file. -->
287.527 + </target>
287.528 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
287.529 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
287.530 + <j2seproject3:force-recompile/>
287.531 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
287.532 + </target>
287.533 + <target name="-post-compile-single">
287.534 + <!-- Empty placeholder for easier customization. -->
287.535 + <!-- You can override this target in the ../build.xml file. -->
287.536 + </target>
287.537 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
287.538 + <!--
287.539 + ====================
287.540 + JAR BUILDING SECTION
287.541 + ====================
287.542 + -->
287.543 + <target depends="init" name="-pre-pre-jar">
287.544 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
287.545 + <mkdir dir="${dist.jar.dir}"/>
287.546 + </target>
287.547 + <target name="-pre-jar">
287.548 + <!-- Empty placeholder for easier customization. -->
287.549 + <!-- You can override this target in the ../build.xml file. -->
287.550 + </target>
287.551 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
287.552 + <j2seproject1:jar/>
287.553 + </target>
287.554 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
287.555 + <j2seproject1:jar manifest="${manifest.file}"/>
287.556 + </target>
287.557 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
287.558 + <j2seproject1:jar manifest="${manifest.file}">
287.559 + <j2seproject1:manifest>
287.560 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
287.561 + </j2seproject1:manifest>
287.562 + </j2seproject1:jar>
287.563 + <echo>To run this application from the command line without Ant, try:</echo>
287.564 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
287.565 + <property location="${dist.jar}" name="dist.jar.resolved"/>
287.566 + <pathconvert property="run.classpath.with.dist.jar">
287.567 + <path path="${run.classpath}"/>
287.568 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
287.569 + </pathconvert>
287.570 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
287.571 + </target>
287.572 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
287.573 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
287.574 + <pathconvert property="run.classpath.without.build.classes.dir">
287.575 + <path path="${run.classpath}"/>
287.576 + <map from="${build.classes.dir.resolved}" to=""/>
287.577 + </pathconvert>
287.578 + <pathconvert pathsep=" " property="jar.classpath">
287.579 + <path path="${run.classpath.without.build.classes.dir}"/>
287.580 + <chainedmapper>
287.581 + <flattenmapper/>
287.582 + <globmapper from="*" to="lib/*"/>
287.583 + </chainedmapper>
287.584 + </pathconvert>
287.585 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
287.586 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
287.587 + <fileset dir="${build.classes.dir}"/>
287.588 + <manifest>
287.589 + <attribute name="Main-Class" value="${main.class}"/>
287.590 + <attribute name="Class-Path" value="${jar.classpath}"/>
287.591 + </manifest>
287.592 + </copylibs>
287.593 + <echo>To run this application from the command line without Ant, try:</echo>
287.594 + <property location="${dist.jar}" name="dist.jar.resolved"/>
287.595 + <echo>java -jar "${dist.jar.resolved}"</echo>
287.596 + </target>
287.597 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
287.598 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
287.599 + <pathconvert property="run.classpath.without.build.classes.dir">
287.600 + <path path="${run.classpath}"/>
287.601 + <map from="${build.classes.dir.resolved}" to=""/>
287.602 + </pathconvert>
287.603 + <pathconvert pathsep=" " property="jar.classpath">
287.604 + <path path="${run.classpath.without.build.classes.dir}"/>
287.605 + <chainedmapper>
287.606 + <flattenmapper/>
287.607 + <globmapper from="*" to="lib/*"/>
287.608 + </chainedmapper>
287.609 + </pathconvert>
287.610 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
287.611 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
287.612 + <fileset dir="${build.classes.dir}"/>
287.613 + <manifest>
287.614 + <attribute name="Class-Path" value="${jar.classpath}"/>
287.615 + </manifest>
287.616 + </copylibs>
287.617 + </target>
287.618 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
287.619 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
287.620 + <pathconvert property="run.classpath.without.build.classes.dir">
287.621 + <path path="${run.classpath}"/>
287.622 + <map from="${build.classes.dir.resolved}" to=""/>
287.623 + </pathconvert>
287.624 + <pathconvert pathsep=" " property="jar.classpath">
287.625 + <path path="${run.classpath.without.build.classes.dir}"/>
287.626 + <chainedmapper>
287.627 + <flattenmapper/>
287.628 + <globmapper from="*" to="lib/*"/>
287.629 + </chainedmapper>
287.630 + </pathconvert>
287.631 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
287.632 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
287.633 + <fileset dir="${build.classes.dir}"/>
287.634 + <manifest>
287.635 + <attribute name="Class-Path" value="${jar.classpath}"/>
287.636 + </manifest>
287.637 + </copylibs>
287.638 + </target>
287.639 + <target name="-post-jar">
287.640 + <!-- Empty placeholder for easier customization. -->
287.641 + <!-- You can override this target in the ../build.xml file. -->
287.642 + </target>
287.643 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
287.644 + <!--
287.645 + =================
287.646 + EXECUTION SECTION
287.647 + =================
287.648 + -->
287.649 + <target depends="init,compile" description="Run a main class." name="run">
287.650 + <j2seproject1:java>
287.651 + <customize>
287.652 + <arg line="${application.args}"/>
287.653 + </customize>
287.654 + </j2seproject1:java>
287.655 + </target>
287.656 + <target name="-do-not-recompile">
287.657 + <property name="javac.includes.binary" value=""/>
287.658 + </target>
287.659 + <target depends="init,compile-single" name="run-single">
287.660 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
287.661 + <j2seproject1:java classname="${run.class}"/>
287.662 + </target>
287.663 + <target depends="init,compile-test-single" name="run-test-with-main">
287.664 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
287.665 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
287.666 + </target>
287.667 + <!--
287.668 + =================
287.669 + DEBUGGING SECTION
287.670 + =================
287.671 + -->
287.672 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
287.673 + <j2seproject1:nbjpdastart name="${debug.class}"/>
287.674 + </target>
287.675 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
287.676 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
287.677 + </target>
287.678 + <target depends="init,compile" name="-debug-start-debuggee">
287.679 + <j2seproject3:debug>
287.680 + <customize>
287.681 + <arg line="${application.args}"/>
287.682 + </customize>
287.683 + </j2seproject3:debug>
287.684 + </target>
287.685 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
287.686 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
287.687 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
287.688 + </target>
287.689 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
287.690 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
287.691 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
287.692 + <j2seproject3:debug classname="${debug.class}"/>
287.693 + </target>
287.694 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
287.695 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
287.696 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
287.697 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
287.698 + </target>
287.699 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
287.700 + <target depends="init" name="-pre-debug-fix">
287.701 + <fail unless="fix.includes">Must set fix.includes</fail>
287.702 + <property name="javac.includes" value="${fix.includes}.java"/>
287.703 + </target>
287.704 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
287.705 + <j2seproject1:nbjpdareload/>
287.706 + </target>
287.707 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
287.708 + <!--
287.709 + ===============
287.710 + JAVADOC SECTION
287.711 + ===============
287.712 + -->
287.713 + <target depends="init" name="-javadoc-build">
287.714 + <mkdir dir="${dist.javadoc.dir}"/>
287.715 + <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}">
287.716 + <classpath>
287.717 + <path path="${javac.classpath}"/>
287.718 + </classpath>
287.719 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
287.720 + <filename name="**/*.java"/>
287.721 + </fileset>
287.722 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
287.723 + <include name="**/*.java"/>
287.724 + </fileset>
287.725 + </javadoc>
287.726 + </target>
287.727 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
287.728 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
287.729 + </target>
287.730 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
287.731 + <!--
287.732 + =========================
287.733 + JUNIT COMPILATION SECTION
287.734 + =========================
287.735 + -->
287.736 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
287.737 + <mkdir dir="${build.test.classes.dir}"/>
287.738 + </target>
287.739 + <target name="-pre-compile-test">
287.740 + <!-- Empty placeholder for easier customization. -->
287.741 + <!-- You can override this target in the ../build.xml file. -->
287.742 + </target>
287.743 + <target if="do.depend.true" name="-compile-test-depend">
287.744 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
287.745 + </target>
287.746 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
287.747 + <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}"/>
287.748 + <copy todir="${build.test.classes.dir}">
287.749 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
287.750 + </copy>
287.751 + </target>
287.752 + <target name="-post-compile-test">
287.753 + <!-- Empty placeholder for easier customization. -->
287.754 + <!-- You can override this target in the ../build.xml file. -->
287.755 + </target>
287.756 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
287.757 + <target name="-pre-compile-test-single">
287.758 + <!-- Empty placeholder for easier customization. -->
287.759 + <!-- You can override this target in the ../build.xml file. -->
287.760 + </target>
287.761 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
287.762 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
287.763 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
287.764 + <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}"/>
287.765 + <copy todir="${build.test.classes.dir}">
287.766 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
287.767 + </copy>
287.768 + </target>
287.769 + <target name="-post-compile-test-single">
287.770 + <!-- Empty placeholder for easier customization. -->
287.771 + <!-- You can override this target in the ../build.xml file. -->
287.772 + </target>
287.773 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
287.774 + <!--
287.775 + =======================
287.776 + JUNIT EXECUTION SECTION
287.777 + =======================
287.778 + -->
287.779 + <target depends="init" if="have.tests" name="-pre-test-run">
287.780 + <mkdir dir="${build.test.results.dir}"/>
287.781 + </target>
287.782 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
287.783 + <j2seproject3:junit testincludes="**/*Test.java"/>
287.784 + </target>
287.785 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
287.786 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
287.787 + </target>
287.788 + <target depends="init" if="have.tests" name="test-report"/>
287.789 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
287.790 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
287.791 + <target depends="init" if="have.tests" name="-pre-test-run-single">
287.792 + <mkdir dir="${build.test.results.dir}"/>
287.793 + </target>
287.794 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
287.795 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
287.796 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
287.797 + </target>
287.798 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
287.799 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
287.800 + </target>
287.801 + <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"/>
287.802 + <!--
287.803 + =======================
287.804 + JUNIT DEBUGGING SECTION
287.805 + =======================
287.806 + -->
287.807 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
287.808 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
287.809 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
287.810 + <delete file="${test.report.file}"/>
287.811 + <mkdir dir="${build.test.results.dir}"/>
287.812 + <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}">
287.813 + <customize>
287.814 + <syspropertyset>
287.815 + <propertyref prefix="test-sys-prop."/>
287.816 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
287.817 + </syspropertyset>
287.818 + <arg value="${test.class}"/>
287.819 + <arg value="showoutput=true"/>
287.820 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
287.821 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
287.822 + </customize>
287.823 + </j2seproject3:debug>
287.824 + </target>
287.825 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
287.826 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
287.827 + </target>
287.828 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
287.829 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
287.830 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
287.831 + </target>
287.832 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
287.833 + <!--
287.834 + =========================
287.835 + APPLET EXECUTION SECTION
287.836 + =========================
287.837 + -->
287.838 + <target depends="init,compile-single" name="run-applet">
287.839 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
287.840 + <j2seproject1:java classname="sun.applet.AppletViewer">
287.841 + <customize>
287.842 + <arg value="${applet.url}"/>
287.843 + </customize>
287.844 + </j2seproject1:java>
287.845 + </target>
287.846 + <!--
287.847 + =========================
287.848 + APPLET DEBUGGING SECTION
287.849 + =========================
287.850 + -->
287.851 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
287.852 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
287.853 + <j2seproject3:debug classname="sun.applet.AppletViewer">
287.854 + <customize>
287.855 + <arg value="${applet.url}"/>
287.856 + </customize>
287.857 + </j2seproject3:debug>
287.858 + </target>
287.859 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
287.860 + <!--
287.861 + ===============
287.862 + CLEANUP SECTION
287.863 + ===============
287.864 + -->
287.865 + <target name="-deps-clean-init" unless="built-clean.properties">
287.866 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
287.867 + <delete file="${built-clean.properties}" quiet="true"/>
287.868 + </target>
287.869 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
287.870 + <echo level="warn" message="Cycle detected: indexer was already built"/>
287.871 + </target>
287.872 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
287.873 + <mkdir dir="${build.dir}"/>
287.874 + <touch file="${built-clean.properties}" verbose="false"/>
287.875 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
287.876 + <antcall target="-warn-already-built-clean"/>
287.877 + <propertyfile file="${built-clean.properties}">
287.878 + <entry key="${basedir}" value=""/>
287.879 + </propertyfile>
287.880 + <antcall target="-maybe-call-dep">
287.881 + <param name="call.built.properties" value="${built-clean.properties}"/>
287.882 + <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
287.883 + <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
287.884 + <param name="call.target" value="clean"/>
287.885 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
287.886 + </antcall>
287.887 + </target>
287.888 + <target depends="init" name="-do-clean">
287.889 + <delete dir="${build.dir}"/>
287.890 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
287.891 + </target>
287.892 + <target name="-post-clean">
287.893 + <!-- Empty placeholder for easier customization. -->
287.894 + <!-- You can override this target in the ../build.xml file. -->
287.895 + </target>
287.896 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
287.897 + <target name="-check-call-dep">
287.898 + <property file="${call.built.properties}" prefix="already.built."/>
287.899 + <condition property="should.call.dep">
287.900 + <not>
287.901 + <isset property="already.built.${call.subproject}"/>
287.902 + </not>
287.903 + </condition>
287.904 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
287.905 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:${toString:endorsed.classpath.path}">
287.906 + <length length="0" string="${endorsed.classpath}" when="greater"/>
287.907 + </condition>
287.908 + </target>
287.909 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
287.910 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
287.911 + <propertyset>
287.912 + <propertyref prefix="transfer."/>
287.913 + <mapper from="transfer.*" to="*" type="glob"/>
287.914 + </propertyset>
287.915 + </ant>
287.916 + </target>
287.917 +</project>
288.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
288.2 +++ b/sandbox/old-modules/server/indexer/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
288.3 @@ -0,0 +1,8 @@
288.4 +build.xml.data.CRC32=8f49f787
288.5 +build.xml.script.CRC32=48d52495
288.6 +build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
288.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
288.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
288.9 +nbproject/build-impl.xml.data.CRC32=8f49f787
288.10 +nbproject/build-impl.xml.script.CRC32=81f22719
288.11 +nbproject/build-impl.xml.stylesheet.CRC32=1cdc5be9@1.35.0.45
289.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
289.2 +++ b/sandbox/old-modules/server/indexer/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
289.3 @@ -0,0 +1,95 @@
289.4 +annotation.processing.enabled=true
289.5 +annotation.processing.enabled.in.editor=false
289.6 +annotation.processing.run.all.processors=true
289.7 +application.title=indexer
289.8 +application.vendor=lahvac
289.9 +build.classes.dir=${build.dir}/classes
289.10 +build.classes.excludes=**/*.java,**/*.form
289.11 +# This directory is removed when the project is cleaned:
289.12 +build.dir=build
289.13 +build.generated.dir=${build.dir}/generated
289.14 +build.generated.sources.dir=${build.dir}/generated-sources
289.15 +# Only compile against the classpath explicitly listed here:
289.16 +build.sysclasspath=ignore
289.17 +build.test.classes.dir=${build.dir}/test/classes
289.18 +build.test.results.dir=${build.dir}/test/results
289.19 +# Uncomment to specify the preferred debugger connection transport:
289.20 +#debug.transport=dt_socket
289.21 +debug.classpath=\
289.22 + ${run.classpath}
289.23 +debug.test.classpath=\
289.24 + ${run.test.classpath}
289.25 +# This directory is removed when the project is cleaned:
289.26 +dist.dir=dist
289.27 +dist.jar=${dist.dir}/indexer.jar
289.28 +dist.javadoc.dir=${dist.dir}/javadoc
289.29 +endorsed.classpath=\
289.30 + ${libs.javac.classpath}
289.31 +excludes=
289.32 +file.reference.org-netbeans-modules-java-hints.jar=../lib/org-netbeans-modules-java-hints.jar
289.33 +file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
289.34 +file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
289.35 +file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
289.36 +file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
289.37 +file.reference.org-openide-util.jar=../lib/org-openide-util.jar
289.38 +file.reference.util-commons.jar-1=../../remoting/ide/api/external/util-commons.jar
289.39 +file.reference.util-pojson.jar-1=../../remoting/ide/api/external/util-pojson.jar
289.40 +includes=**
289.41 +jar.compress=false
289.42 +javac.classpath=\
289.43 + ${reference.org_netbeans_modules_jackpot30_api.module}:\
289.44 + ${libs.lucene.classpath}:\
289.45 + ${libs.javac.classpath}:\
289.46 + ${file.reference.org-netbeans-modules-java-source.jar}:\
289.47 + ${file.reference.org-openide-filesystems.jar}:\
289.48 + ${file.reference.org-openide-util.jar}:\
289.49 + ${file.reference.org-openide-util-lookup.jar}:\
289.50 + ${file.reference.org-netbeans-spi-editor-hints.jar}:\
289.51 + ${file.reference.org-netbeans-modules-java-hints.jar}:\
289.52 + ${file.reference.util-commons.jar-1}:\
289.53 + ${file.reference.util-pojson.jar-1}
289.54 +# Space-separated list of extra javac options
289.55 +javac.compilerargs=
289.56 +javac.deprecation=false
289.57 +javac.processorpath=\
289.58 + ${javac.classpath}
289.59 +javac.source=1.5
289.60 +javac.target=1.5
289.61 +javac.test.classpath=\
289.62 + ${javac.classpath}:\
289.63 + ${build.classes.dir}:\
289.64 + ${libs.junit_4.classpath}
289.65 +javadoc.additionalparam=
289.66 +javadoc.author=false
289.67 +javadoc.encoding=${source.encoding}
289.68 +javadoc.noindex=false
289.69 +javadoc.nonavbar=false
289.70 +javadoc.notree=false
289.71 +javadoc.private=false
289.72 +javadoc.splitindex=true
289.73 +javadoc.use=true
289.74 +javadoc.version=false
289.75 +javadoc.windowtitle=
289.76 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
289.77 +main.class=org.netbeans.modules.jackpot30.server.indexer.Index
289.78 +manifest.file=manifest.mf
289.79 +meta.inf.dir=${src.dir}/META-INF
289.80 +mkdist.disabled=false
289.81 +platform.active=default_platform
289.82 +project.org_netbeans_modules_jackpot30_api=../../api
289.83 +reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
289.84 +run.classpath=\
289.85 + ${javac.classpath}:\
289.86 + ${build.classes.dir}
289.87 +# Space-separated list of JVM arguments used when running the project
289.88 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
289.89 +# or test-sys-prop.name=value to set system properties for unit tests):
289.90 +run.jvmargs=
289.91 +run.test.classpath=\
289.92 + ${javac.test.classpath}:\
289.93 + ${build.test.classes.dir}
289.94 +source.encoding=UTF-8
289.95 +src.dir=src
289.96 +test.src.dir=test
289.97 +
289.98 +hudson.compiler.dir=../hudson/data/compiler
290.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
290.2 +++ b/sandbox/old-modules/server/indexer/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
290.3 @@ -0,0 +1,28 @@
290.4 +<?xml version="1.0" encoding="UTF-8"?>
290.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
290.6 + <type>org.netbeans.modules.java.j2seproject</type>
290.7 + <configuration>
290.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
290.9 + <name>indexer</name>
290.10 + <source-roots>
290.11 + <root id="src.dir"/>
290.12 + </source-roots>
290.13 + <test-roots>
290.14 + <root id="test.src.dir"/>
290.15 + </test-roots>
290.16 + </data>
290.17 + <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
290.18 + <definitions>../lib/nblibraries.properties</definitions>
290.19 + </libraries>
290.20 + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
290.21 + <reference>
290.22 + <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
290.23 + <artifact-type>jar</artifact-type>
290.24 + <script>build.xml</script>
290.25 + <target>netbeans</target>
290.26 + <clean-target>clean</clean-target>
290.27 + <id>module</id>
290.28 + </reference>
290.29 + </references>
290.30 + </configuration>
290.31 +</project>
291.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
291.2 +++ b/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/Index.java Tue Feb 21 22:37:57 2012 +0100
291.3 @@ -0,0 +1,106 @@
291.4 +/*
291.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
291.6 + *
291.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
291.8 + *
291.9 + * The contents of this file are subject to the terms of either the GNU
291.10 + * General Public License Version 2 only ("GPL") or the Common
291.11 + * Development and Distribution License("CDDL") (collectively, the
291.12 + * "License"). You may not use this file except in compliance with the
291.13 + * License. You can obtain a copy of the License at
291.14 + * http://www.netbeans.org/cddl-gplv2.html
291.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
291.16 + * specific language governing permissions and limitations under the
291.17 + * License. When distributing the software, include this License Header
291.18 + * Notice in each file and include the License file at
291.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
291.20 + * particular file as subject to the "Classpath" exception as provided
291.21 + * by Sun in the GPL Version 2 section of the License file that
291.22 + * accompanied this code. If applicable, add the following below the
291.23 + * License Header, with the fields enclosed by brackets [] replaced by
291.24 + * your own identifying information:
291.25 + * "Portions Copyrighted [year] [name of copyright owner]"
291.26 + *
291.27 + * If you wish your version of this file to be governed by only the CDDL
291.28 + * or only the GPL Version 2, indicate your decision by adding
291.29 + * "[Contributor] elects to include this software in this distribution
291.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
291.31 + * single choice of license, a recipient has the option to distribute
291.32 + * your version of this file under either the CDDL, the GPL Version 2 or
291.33 + * to extend the choice of license to its licensees as provided above.
291.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
291.35 + * Version 2 license, then the option applies only if the new code is
291.36 + * made subject to such option by the copyright holder.
291.37 + *
291.38 + * Contributor(s):
291.39 + *
291.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
291.41 + */
291.42 +
291.43 +package org.netbeans.modules.jackpot30.server.indexer;
291.44 +
291.45 +import java.io.File;
291.46 +import java.io.IOException;
291.47 +import java.util.ArrayList;
291.48 +import java.util.Arrays;
291.49 +import java.util.List;
291.50 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
291.51 +import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
291.52 +
291.53 +/**
291.54 + *
291.55 + * @author lahvac
291.56 + */
291.57 +public class Index {
291.58 +
291.59 + static final String PARAM_CONSTRUCT_DUPLICATES_INDEX = "-construct-duplicates-index";
291.60 + static final String PARAM_STORE_SOURCES = "-store-sources";
291.61 +
291.62 + /**
291.63 + * @param args the command line arguments
291.64 + */
291.65 + public static void main(String[] args) throws IOException {
291.66 + new Index().index(args);
291.67 + }
291.68 +
291.69 + void index(String[] args) throws IOException {
291.70 + List<String> argsList = new ArrayList<String>(Arrays.asList(args));
291.71 + boolean constructDuplicatesIndex = !argsList.isEmpty() && PARAM_CONSTRUCT_DUPLICATES_INDEX.equals(argsList.get(0));
291.72 +
291.73 + if (constructDuplicatesIndex) argsList.remove(0);
291.74 +
291.75 + boolean storeSources = !argsList.isEmpty() && PARAM_STORE_SOURCES.equals(argsList.get(0));
291.76 +
291.77 + if (storeSources) argsList.remove(0);
291.78 +
291.79 + String modified = null;
291.80 + String removed = null;
291.81 +
291.82 + if (argsList.size() != 2 && argsList.size() != 4) {
291.83 + printHelp();
291.84 + return ;
291.85 + }
291.86 +
291.87 + if (argsList.size() == 4) {
291.88 + modified = argsList.get(2);
291.89 + removed = argsList.get(3);
291.90 + }
291.91 +
291.92 + long startTime = System.currentTimeMillis();
291.93 +
291.94 + Cache.setStandaloneCacheRoot(new File(argsList.get(1)));
291.95 + invokeIndexer(new File(argsList.get(0)), constructDuplicatesIndex, storeSources, modified, removed);
291.96 +
291.97 + long endTime = System.currentTimeMillis();
291.98 +
291.99 + System.out.println("indexing took: " + Utilities.toHumanReadableTime(endTime - startTime));
291.100 + }
291.101 +
291.102 + protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
291.103 + StandaloneIndexer.index(root, duplicatesIndex, storeSources, modified, removed);
291.104 + }
291.105 +
291.106 + protected void printHelp() {
291.107 + System.err.println("Usage: java -jar " + Index.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " [" + PARAM_CONSTRUCT_DUPLICATES_INDEX + "] [" + PARAM_STORE_SOURCES + "] <source-root> <cache> [<modified-files> <removed-files>]");
291.108 + }
291.109 +}
292.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
292.2 +++ b/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinder.java Tue Feb 21 22:37:57 2012 +0100
292.3 @@ -0,0 +1,202 @@
292.4 +/*
292.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
292.6 + *
292.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
292.8 + *
292.9 + * The contents of this file are subject to the terms of either the GNU
292.10 + * General Public License Version 2 only ("GPL") or the Common
292.11 + * Development and Distribution License("CDDL") (collectively, the
292.12 + * "License"). You may not use this file except in compliance with the
292.13 + * License. You can obtain a copy of the License at
292.14 + * http://www.netbeans.org/cddl-gplv2.html
292.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
292.16 + * specific language governing permissions and limitations under the
292.17 + * License. When distributing the software, include this License Header
292.18 + * Notice in each file and include the License file at
292.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
292.20 + * particular file as subject to the "Classpath" exception as provided
292.21 + * by Sun in the GPL Version 2 section of the License file that
292.22 + * accompanied this code. If applicable, add the following below the
292.23 + * License Header, with the fields enclosed by brackets [] replaced by
292.24 + * your own identifying information:
292.25 + * "Portions Copyrighted [year] [name of copyright owner]"
292.26 + *
292.27 + * If you wish your version of this file to be governed by only the CDDL
292.28 + * or only the GPL Version 2, indicate your decision by adding
292.29 + * "[Contributor] elects to include this software in this distribution
292.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
292.31 + * single choice of license, a recipient has the option to distribute
292.32 + * your version of this file under either the CDDL, the GPL Version 2 or
292.33 + * to extend the choice of license to its licensees as provided above.
292.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
292.35 + * Version 2 license, then the option applies only if the new code is
292.36 + * made subject to such option by the copyright holder.
292.37 + *
292.38 + * Contributor(s):
292.39 + *
292.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
292.41 + */
292.42 +
292.43 +package org.netbeans.modules.jackpot30.server.indexer;
292.44 +
292.45 +import com.sun.source.tree.CompilationUnitTree;
292.46 +import com.sun.source.tree.Tree;
292.47 +import com.sun.source.util.TreePath;
292.48 +import com.sun.source.util.Trees;
292.49 +import com.sun.tools.javac.api.JavacTaskImpl;
292.50 +import java.io.File;
292.51 +import java.io.IOException;
292.52 +import java.net.URI;
292.53 +import java.util.Arrays;
292.54 +import java.util.BitSet;
292.55 +import java.util.Collection;
292.56 +import java.util.Collections;
292.57 +import java.util.HashMap;
292.58 +import java.util.LinkedList;
292.59 +import java.util.Map;
292.60 +import javax.tools.Diagnostic;
292.61 +import javax.tools.JavaCompiler;
292.62 +import javax.tools.JavaFileObject;
292.63 +import javax.tools.SimpleJavaFileObject;
292.64 +import javax.tools.ToolProvider;
292.65 +import org.apache.lucene.document.Document;
292.66 +import org.apache.lucene.index.IndexReader;
292.67 +import org.apache.lucene.index.Term;
292.68 +import org.apache.lucene.search.Collector;
292.69 +import org.apache.lucene.search.IndexSearcher;
292.70 +import org.apache.lucene.search.Query;
292.71 +import org.apache.lucene.search.Searcher;
292.72 +import org.apache.lucene.search.TermQuery;
292.73 +import org.apache.lucene.store.FSDirectory;
292.74 +import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
292.75 +import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex.BitSetCollector;
292.76 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
292.77 +import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
292.78 +import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
292.79 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
292.80 +import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
292.81 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
292.82 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
292.83 +import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
292.84 +import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
292.85 +
292.86 +/**
292.87 + *
292.88 + * @author lahvac
292.89 + */
292.90 +public class StandaloneFinder {
292.91 +
292.92 + public static Collection<? extends String> findCandidates(File sourceRoot, String pattern) throws IOException {
292.93 + BulkPattern bulkPattern = preparePattern(pattern, null);
292.94 +
292.95 + return FileBasedIndex.get(sourceRoot.toURI().toURL()).findCandidates(bulkPattern);
292.96 + }
292.97 +
292.98 + public static int[] findCandidateOccurrenceSpans(File sourceRoot, String relativePath, String pattern) throws IOException {
292.99 + BulkPattern bulkPattern = preparePattern(pattern, null);
292.100 + CharSequence source = FileBasedIndex.get(sourceRoot.toURI().toURL()).getSourceCode(relativePath).toString().replaceAll("\r\n", "\n");
292.101 + JavacTaskImpl jti = prepareJavacTaskImpl();
292.102 + CompilationUnitTree cut = jti.parse(new JFOImpl(source)).iterator().next();
292.103 + Collection<TreePath> paths = new LinkedList<TreePath>();
292.104 +
292.105 + for (Collection<TreePath> c : BulkSearch.getDefault().match(null, new TreePath(cut), bulkPattern).values()) {
292.106 + paths.addAll(c);
292.107 + }
292.108 +
292.109 + Trees t = Trees.instance(jti);
292.110 + int[] result = new int[2 * paths.size()];
292.111 + int i = 0;
292.112 +
292.113 + for (TreePath tp : paths) {
292.114 + result[i++] = (int) t.getSourcePositions().getStartPosition(cut, tp.getLeaf());
292.115 + result[i++] = (int) t.getSourcePositions().getEndPosition(cut, tp.getLeaf());
292.116 + }
292.117 +
292.118 + return result;
292.119 + }
292.120 +
292.121 + public static Collection<Diagnostic<? extends JavaFileObject>> parseAndReportErrors(String pattern) {
292.122 + Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
292.123 +
292.124 + preparePattern(pattern, errors);
292.125 +
292.126 + return errors;
292.127 + }
292.128 +
292.129 + public static Map<String, Collection<? extends String>> containsHash(File sourceRoot, Iterable<? extends String> hashes) throws IOException {
292.130 + File cacheRoot = Cache.findCache(DuplicatesIndex.NAME, DuplicatesIndex.VERSION).findCacheRoot(sourceRoot.toURI().toURL());
292.131 + File dir = new File(cacheRoot, "fulltext");
292.132 +
292.133 + if (dir.listFiles() != null && dir.listFiles().length > 0) {
292.134 + IndexReader reader = IndexReader.open(FSDirectory.open(dir), true);
292.135 + Map<String, Collection<? extends String>> result = new HashMap<String, Collection<? extends String>>();
292.136 +
292.137 + for (String hash : hashes) {
292.138 + Collection<String> found = new LinkedList<String>();
292.139 + Query query = new TermQuery(new Term("generalized", hash));
292.140 + Searcher s = new IndexSearcher(reader);
292.141 + BitSet matchingDocuments = new BitSet(reader.maxDoc());
292.142 + Collector c = new BitSetCollector(matchingDocuments);
292.143 +
292.144 + s.search(query, c);
292.145 +
292.146 + for (int docNum = matchingDocuments.nextSetBit(0); docNum >= 0; docNum = matchingDocuments.nextSetBit(docNum + 1)) {
292.147 + final Document doc = reader.document(docNum);
292.148 +
292.149 + found.add(doc.getField("path").stringValue());
292.150 + }
292.151 +
292.152 + result.put(hash, found);
292.153 + }
292.154 +
292.155 + return result;
292.156 + }
292.157 +
292.158 + return Collections.emptyMap();
292.159 + }
292.160 +
292.161 + private static BulkPattern preparePattern(String pattern, Collection<Diagnostic<? extends JavaFileObject>> errors) {
292.162 + return preparePattern(PatternConvertor.create(pattern), errors);
292.163 + }
292.164 +
292.165 + //XXX: copied from BatchSearch, may be possible to merge once CompilationInfo is accessible in server mode
292.166 + private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
292.167 + JavacTaskImpl javac = prepareJavacTaskImpl();
292.168 + Collection<String> code = new LinkedList<String>();
292.169 + Collection<Tree> trees = new LinkedList<Tree>();
292.170 + Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
292.171 +
292.172 + for (HintDescription pattern : patterns) {
292.173 + String textPattern = ((PatternDescription) pattern.getTrigger()).getPattern();
292.174 +
292.175 + code.add(textPattern);
292.176 + trees.add(Utilities.parseAndAttribute(javac, textPattern, errors));
292.177 + additionalConstraints.add(pattern.getAdditionalConstraints());
292.178 + }
292.179 +
292.180 + return BulkSearch.getDefault().create(code, trees, additionalConstraints);
292.181 + }
292.182 +
292.183 + private static JavacTaskImpl prepareJavacTaskImpl() {
292.184 + final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
292.185 + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
292.186 +
292.187 + assert tool != null;
292.188 +
292.189 + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath, "-Xjcov"), null, Collections.<JavaFileObject>emptyList());
292.190 +
292.191 + return ct;
292.192 + }
292.193 +
292.194 + private static final class JFOImpl extends SimpleJavaFileObject {
292.195 + private final CharSequence code;
292.196 + public JFOImpl(CharSequence code) {
292.197 + super(URI.create(""), Kind.SOURCE);
292.198 + this.code = code;
292.199 + }
292.200 + @Override
292.201 + public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
292.202 + return code;
292.203 + }
292.204 + }
292.205 +}
293.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
293.2 +++ b/sandbox/old-modules/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneIndexer.java Tue Feb 21 22:37:57 2012 +0100
293.3 @@ -0,0 +1,169 @@
293.4 +/*
293.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
293.6 + *
293.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
293.8 + *
293.9 + * The contents of this file are subject to the terms of either the GNU
293.10 + * General Public License Version 2 only ("GPL") or the Common
293.11 + * Development and Distribution License("CDDL") (collectively, the
293.12 + * "License"). You may not use this file except in compliance with the
293.13 + * License. You can obtain a copy of the License at
293.14 + * http://www.netbeans.org/cddl-gplv2.html
293.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
293.16 + * specific language governing permissions and limitations under the
293.17 + * License. When distributing the software, include this License Header
293.18 + * Notice in each file and include the License file at
293.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
293.20 + * particular file as subject to the "Classpath" exception as provided
293.21 + * by Sun in the GPL Version 2 section of the License file that
293.22 + * accompanied this code. If applicable, add the following below the
293.23 + * License Header, with the fields enclosed by brackets [] replaced by
293.24 + * your own identifying information:
293.25 + * "Portions Copyrighted [year] [name of copyright owner]"
293.26 + *
293.27 + * If you wish your version of this file to be governed by only the CDDL
293.28 + * or only the GPL Version 2, indicate your decision by adding
293.29 + * "[Contributor] elects to include this software in this distribution
293.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
293.31 + * single choice of license, a recipient has the option to distribute
293.32 + * your version of this file under either the CDDL, the GPL Version 2 or
293.33 + * to extend the choice of license to its licensees as provided above.
293.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
293.35 + * Version 2 license, then the option applies only if the new code is
293.36 + * made subject to such option by the copyright holder.
293.37 + *
293.38 + * Contributor(s):
293.39 + *
293.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
293.41 + */
293.42 +
293.43 +package org.netbeans.modules.jackpot30.server.indexer;
293.44 +
293.45 +import com.sun.source.tree.CompilationUnitTree;
293.46 +import com.sun.tools.javac.api.JavacTaskImpl;
293.47 +import java.io.BufferedReader;
293.48 +import java.io.File;
293.49 +import java.io.FileReader;
293.50 +import java.io.IOException;
293.51 +import java.util.Arrays;
293.52 +import java.util.Collection;
293.53 +import java.util.Collections;
293.54 +import java.util.LinkedList;
293.55 +import java.util.logging.Level;
293.56 +import java.util.logging.Logger;
293.57 +import javax.tools.Diagnostic;
293.58 +import javax.tools.DiagnosticListener;
293.59 +import javax.tools.JavaCompiler;
293.60 +import javax.tools.JavaFileObject;
293.61 +import javax.tools.StandardJavaFileManager;
293.62 +import javax.tools.StandardLocation;
293.63 +import javax.tools.ToolProvider;
293.64 +import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
293.65 +import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
293.66 +import org.netbeans.modules.jackpot30.impl.indexing.Index;
293.67 +import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
293.68 +import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
293.69 +
293.70 +/**
293.71 + *
293.72 + * @author lahvac
293.73 + */
293.74 +public class StandaloneIndexer {
293.75 +
293.76 + public static void index(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
293.77 + Index index = FileBasedIndex.create(root.toURI().toURL(), storeSources);
293.78 + IndexInfo ii = index.getIndexInfo();
293.79 + boolean clearIndexing = ii.totalFiles < 0 || ii.majorVersion != FileBasedIndex.MAJOR_VERSION || ii.minorVersion != FileBasedIndex.MINOR_VERSION;
293.80 + IndexWriter w = index.openForWriting();
293.81 + DuplicatesIndex.IndexWriter dw = duplicatesIndex ? DuplicatesIndex.get(root.toURI().toURL()).openForWriting() : null;
293.82 +
293.83 + try {
293.84 + StandaloneIndexer i = new StandaloneIndexer();
293.85 +
293.86 + if (!clearIndexing && modified != null && removed != null) {
293.87 + i.doIndex(w, dw, root, modified, removed);
293.88 + } else {
293.89 + w.clear();
293.90 + i.doIndex(w, dw, root);
293.91 + }
293.92 + } finally {
293.93 + w.close();
293.94 + if (dw != null) {
293.95 + dw.close();
293.96 + }
293.97 + }
293.98 + }
293.99 +
293.100 + private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File fileOrDir) throws IOException {
293.101 + if (fileOrDir.isDirectory()) {
293.102 + for (File f : fileOrDir.listFiles()) {
293.103 + doIndex(w, dw, f);
293.104 + }
293.105 + } else {
293.106 + indexFile(w, dw, fileOrDir);
293.107 + }
293.108 + }
293.109 +
293.110 + private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File root, String modified, String removed) throws IOException {
293.111 + for (String r : read(removed)) {
293.112 + w.remove(r);
293.113 + if (dw != null) dw.remove(r);
293.114 + }
293.115 +
293.116 + for (String m : read(modified)) {
293.117 + indexFile(w, dw, new File(root, m));
293.118 + }
293.119 + }
293.120 +
293.121 + private void indexFile(IndexWriter w, DuplicatesIndex.IndexWriter dw, File source) throws IOException {
293.122 + if (!source.getName().endsWith(".java"))
293.123 + return ;
293.124 +
293.125 + final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
293.126 + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
293.127 + assert tool != null;
293.128 +
293.129 + DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
293.130 + public void report(Diagnostic<? extends JavaFileObject> diagnostic) {}
293.131 + };
293.132 + StandardJavaFileManager m = tool.getStandardFileManager(devNull, null, null);
293.133 +
293.134 + m.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
293.135 + m.setLocation(StandardLocation.SOURCE_PATH, Collections.<File>emptyList());
293.136 +
293.137 + Iterable<? extends JavaFileObject> fos = m.getJavaFileObjects(source);
293.138 + JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, null, devNull, Arrays.asList("-bootclasspath", bootPath), null, fos);
293.139 + CompilationUnitTree cut = ct.parse().iterator().next();
293.140 +
293.141 + w.record(source.toURI().toURL(), cut, null);
293.142 +
293.143 + if (dw != null) {
293.144 + ct.analyze(ct.enter(Collections.singletonList(cut)));
293.145 +
293.146 + dw.record(ct, source.toURI().toURL(), cut);
293.147 + }
293.148 + }
293.149 +
293.150 + private static Iterable<? extends String> read(String file) throws IOException {
293.151 + Collection<String> result = new LinkedList<String>();
293.152 + BufferedReader r = new BufferedReader(new FileReader(file));
293.153 +
293.154 + try {
293.155 + String line;
293.156 +
293.157 + while ((line = r.readLine()) != null) {
293.158 + if (!line.isEmpty()) {
293.159 + result.add(line);
293.160 + }
293.161 + }
293.162 + } finally {
293.163 + try {
293.164 + r.close();
293.165 + } catch (IOException ex) {
293.166 + Logger.getLogger(StandaloneIndexer.class.getName()).log(Level.SEVERE, null, ex);
293.167 + }
293.168 + }
293.169 +
293.170 + return result;
293.171 + }
293.172 +}
294.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
294.2 +++ b/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/IndexTest.java Tue Feb 21 22:37:57 2012 +0100
294.3 @@ -0,0 +1,96 @@
294.4 +/*
294.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
294.6 + *
294.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
294.8 + *
294.9 + * The contents of this file are subject to the terms of either the GNU
294.10 + * General Public License Version 2 only ("GPL") or the Common
294.11 + * Development and Distribution License("CDDL") (collectively, the
294.12 + * "License"). You may not use this file except in compliance with the
294.13 + * License. You can obtain a copy of the License at
294.14 + * http://www.netbeans.org/cddl-gplv2.html
294.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
294.16 + * specific language governing permissions and limitations under the
294.17 + * License. When distributing the software, include this License Header
294.18 + * Notice in each file and include the License file at
294.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
294.20 + * particular file as subject to the "Classpath" exception as provided
294.21 + * by Sun in the GPL Version 2 section of the License file that
294.22 + * accompanied this code. If applicable, add the following below the
294.23 + * License Header, with the fields enclosed by brackets [] replaced by
294.24 + * your own identifying information:
294.25 + * "Portions Copyrighted [year] [name of copyright owner]"
294.26 + *
294.27 + * If you wish your version of this file to be governed by only the CDDL
294.28 + * or only the GPL Version 2, indicate your decision by adding
294.29 + * "[Contributor] elects to include this software in this distribution
294.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
294.31 + * single choice of license, a recipient has the option to distribute
294.32 + * your version of this file under either the CDDL, the GPL Version 2 or
294.33 + * to extend the choice of license to its licensees as provided above.
294.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
294.35 + * Version 2 license, then the option applies only if the new code is
294.36 + * made subject to such option by the copyright holder.
294.37 + *
294.38 + * Contributor(s):
294.39 + *
294.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
294.41 + */
294.42 +
294.43 +package org.netbeans.modules.jackpot30.server.indexer;
294.44 +
294.45 +import java.io.File;
294.46 +import java.io.IOException;
294.47 +import junit.framework.TestCase;
294.48 +
294.49 +/**
294.50 + *
294.51 + * @author lahvac
294.52 + */
294.53 +public class IndexTest extends TestCase {
294.54 +
294.55 + public IndexTest(String name) {
294.56 + super(name);
294.57 + }
294.58 +
294.59 + public void testCmdLine() throws IOException {
294.60 + assertCmdLineOk("/foo", false, false, null, null, "/foo", "/cache");
294.61 + assertCmdLineOk("/foo", false, false, "/modified.list", "/removed.list", "/foo", "/cache", "/modified.list", "/removed.list");
294.62 + assertCmdLineOk("/foo", true, false, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache");
294.63 + assertCmdLineOk("/foo", true, false, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache", "/modified.list", "/removed.list");
294.64 + assertCmdLineOk("/foo", false, true, null, null, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
294.65 + assertCmdLineOk("/foo", false, true, "/modified.list", "/removed.list", Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
294.66 + assertCmdLineOk("/foo", true, true, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
294.67 + assertCmdLineOk("/foo", true, true, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
294.68 + assertCmdLineFailed();
294.69 + assertCmdLineFailed("/foo");
294.70 + }
294.71 +
294.72 + private static void assertCmdLineOk(final String rootGolden, final boolean duplicatesIndexGolden, final boolean storeSourcesGolden, final String modifiedGolden, final String removedGolden, String... cmdLine) throws IOException {
294.73 + new Index() {
294.74 + @Override
294.75 + protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
294.76 + assertEquals(rootGolden, root.getPath());
294.77 + assertEquals(duplicatesIndexGolden, duplicatesIndex);
294.78 + assertEquals(storeSourcesGolden, storeSources);
294.79 + assertEquals(modifiedGolden, modified);
294.80 + assertEquals(removedGolden, removed);
294.81 + }
294.82 + @Override
294.83 + protected void printHelp() {
294.84 + fail();
294.85 + }
294.86 + }.index(cmdLine);
294.87 + }
294.88 +
294.89 + private static void assertCmdLineFailed(String... cmdLine) throws IOException {
294.90 + new Index() {
294.91 + @Override
294.92 + protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
294.93 + fail();
294.94 + }
294.95 + @Override
294.96 + protected void printHelp() {}
294.97 + }.index(cmdLine);
294.98 + }
294.99 +}
294.100 \ No newline at end of file
295.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
295.2 +++ b/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/LargeScaleTester.java Tue Feb 21 22:37:57 2012 +0100
295.3 @@ -0,0 +1,147 @@
295.4 +/*
295.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
295.6 + *
295.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
295.8 + *
295.9 + * The contents of this file are subject to the terms of either the GNU
295.10 + * General Public License Version 2 only ("GPL") or the Common
295.11 + * Development and Distribution License("CDDL") (collectively, the
295.12 + * "License"). You may not use this file except in compliance with the
295.13 + * License. You can obtain a copy of the License at
295.14 + * http://www.netbeans.org/cddl-gplv2.html
295.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
295.16 + * specific language governing permissions and limitations under the
295.17 + * License. When distributing the software, include this License Header
295.18 + * Notice in each file and include the License file at
295.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
295.20 + * particular file as subject to the "Classpath" exception as provided
295.21 + * by Sun in the GPL Version 2 section of the License file that
295.22 + * accompanied this code. If applicable, add the following below the
295.23 + * License Header, with the fields enclosed by brackets [] replaced by
295.24 + * your own identifying information:
295.25 + * "Portions Copyrighted [year] [name of copyright owner]"
295.26 + *
295.27 + * If you wish your version of this file to be governed by only the CDDL
295.28 + * or only the GPL Version 2, indicate your decision by adding
295.29 + * "[Contributor] elects to include this software in this distribution
295.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
295.31 + * single choice of license, a recipient has the option to distribute
295.32 + * your version of this file under either the CDDL, the GPL Version 2 or
295.33 + * to extend the choice of license to its licensees as provided above.
295.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
295.35 + * Version 2 license, then the option applies only if the new code is
295.36 + * made subject to such option by the copyright holder.
295.37 + *
295.38 + * Contributor(s):
295.39 + *
295.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
295.41 + */
295.42 +
295.43 +package org.netbeans.modules.jackpot30.server.indexer;
295.44 +
295.45 +import java.io.File;
295.46 +import java.io.IOException;
295.47 +import java.util.logging.Handler;
295.48 +import java.util.logging.Level;
295.49 +import java.util.logging.LogRecord;
295.50 +import java.util.logging.Logger;
295.51 +import java.util.logging.SimpleFormatter;
295.52 +import junit.framework.TestCase;
295.53 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
295.54 +import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
295.55 +
295.56 +/**
295.57 + *
295.58 + * @author lahvac
295.59 + */
295.60 +public class LargeScaleTester extends TestCase {
295.61 +
295.62 + public LargeScaleTester(String name) {
295.63 + super(name);
295.64 + }
295.65 +
295.66 + private static final boolean createIndex = true;
295.67 +
295.68 + private File src;
295.69 +
295.70 + public void setUp() throws Exception {
295.71 + Logger.getLogger(FileBasedIndex.class.getName()).setLevel(Level.ALL);
295.72 + Logger.getLogger(FileBasedIndex.class.getName()).addHandler(new Handler() {
295.73 + @Override
295.74 + public void publish(LogRecord record) {
295.75 + System.err.println(new SimpleFormatter().formatMessage(record));
295.76 + }
295.77 + @Override
295.78 + public void flush() {
295.79 + System.err.flush();
295.80 + }
295.81 + @Override
295.82 + public void close() throws SecurityException {}
295.83 + });
295.84 +
295.85 + File source = new File(LargeScaleTester.class.getProtectionDomain().getCodeSource().getLocation().getPath());
295.86 + File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
295.87 +
295.88 + if (createIndex)
295.89 + deleteRecursively(workingDirectory);
295.90 +
295.91 + File cache = new File(workingDirectory, "cache");
295.92 + String toIndex = System.getProperty("index-folder");
295.93 +
295.94 + if (toIndex == null || !(src = new File(toIndex)).isDirectory()) {
295.95 + throw new IllegalStateException("Directory to index not correctly specified - add 'test-sys-prop.index-folder=<directory>' to private.properties");
295.96 + }
295.97 +
295.98 + Cache.setStandaloneCacheRoot(cache);
295.99 +
295.100 + if (createIndex) {
295.101 + long start = System.currentTimeMillis();
295.102 + StandaloneIndexer.index(src, false, false, null, null);
295.103 + long end = System.currentTimeMillis();
295.104 + System.err.println("indexing took: " + (end - start));
295.105 + System.err.println("cache size total: " + totalSize(cache) + ", lucene=" + totalSize(new File(cache, "s1/jackpot30/fulltext")));
295.106 + }
295.107 + }
295.108 +
295.109 + private static void deleteRecursively(File d) throws IOException {
295.110 + if (!d.exists()) return;
295.111 +
295.112 + if (d.isDirectory()) {
295.113 + for (File c : d.listFiles()) {
295.114 + deleteRecursively(c);
295.115 + }
295.116 + }
295.117 +
295.118 + if (!d.delete()) throw new IOException();
295.119 + }
295.120 +
295.121 + private static long totalSize(File d) throws IOException {
295.122 + if (!d.exists()) return 0;
295.123 +
295.124 + if (d.isDirectory()) {
295.125 + long total = 0;
295.126 +
295.127 + for (File c : d.listFiles()) {
295.128 + total += totalSize(c);
295.129 + }
295.130 +
295.131 + return total;
295.132 + } else {
295.133 + return d.length();
295.134 + }
295.135 + }
295.136 +
295.137 + public void testFind() throws Exception {
295.138 + performTest("new $type() { $mods$ $resultType $methodName($args$) { $statements$; } }");
295.139 + performTest("$1.isDirectory()");
295.140 + }
295.141 +
295.142 + private void performTest(String code) throws Exception {
295.143 + System.err.println("searching for " + code);
295.144 + long start = System.currentTimeMillis();
295.145 + System.err.println("Found occurrences: " + StandaloneFinder.findCandidates(src, code).size());
295.146 + long end = System.currentTimeMillis();
295.147 +
295.148 + System.err.println("total search time: " + (end - start));
295.149 + }
295.150 +}
296.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
296.2 +++ b/sandbox/old-modules/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinderTest.java Tue Feb 21 22:37:57 2012 +0100
296.3 @@ -0,0 +1,154 @@
296.4 +/*
296.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
296.6 + *
296.7 + * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
296.8 + *
296.9 + * The contents of this file are subject to the terms of either the GNU
296.10 + * General Public License Version 2 only ("GPL") or the Common
296.11 + * Development and Distribution License("CDDL") (collectively, the
296.12 + * "License"). You may not use this file except in compliance with the
296.13 + * License. You can obtain a copy of the License at
296.14 + * http://www.netbeans.org/cddl-gplv2.html
296.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
296.16 + * specific language governing permissions and limitations under the
296.17 + * License. When distributing the software, include this License Header
296.18 + * Notice in each file and include the License file at
296.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
296.20 + * particular file as subject to the "Classpath" exception as provided
296.21 + * by Sun in the GPL Version 2 section of the License file that
296.22 + * accompanied this code. If applicable, add the following below the
296.23 + * License Header, with the fields enclosed by brackets [] replaced by
296.24 + * your own identifying information:
296.25 + * "Portions Copyrighted [year] [name of copyright owner]"
296.26 + *
296.27 + * If you wish your version of this file to be governed by only the CDDL
296.28 + * or only the GPL Version 2, indicate your decision by adding
296.29 + * "[Contributor] elects to include this software in this distribution
296.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
296.31 + * single choice of license, a recipient has the option to distribute
296.32 + * your version of this file under either the CDDL, the GPL Version 2 or
296.33 + * to extend the choice of license to its licensees as provided above.
296.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
296.35 + * Version 2 license, then the option applies only if the new code is
296.36 + * made subject to such option by the copyright holder.
296.37 + *
296.38 + * Contributor(s):
296.39 + *
296.40 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
296.41 + */
296.42 +
296.43 +package org.netbeans.modules.jackpot30.server.indexer;
296.44 +
296.45 +import java.io.ByteArrayInputStream;
296.46 +import java.io.File;
296.47 +import java.io.FileOutputStream;
296.48 +import java.io.IOException;
296.49 +import java.io.InputStream;
296.50 +import java.util.ArrayList;
296.51 +import java.util.Arrays;
296.52 +import java.util.HashSet;
296.53 +import java.util.LinkedList;
296.54 +import java.util.List;
296.55 +import junit.framework.Assert;
296.56 +import junit.framework.TestCase;
296.57 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
296.58 +
296.59 +/**
296.60 + *
296.61 + * @author lahvac
296.62 + */
296.63 +public class StandaloneFinderTest extends TestCase {
296.64 +
296.65 + public StandaloneFinderTest(String name) {
296.66 + super(name);
296.67 + }
296.68 +
296.69 + private File src;
296.70 +
296.71 + public void setUp() throws Exception {
296.72 + File source = new File(StandaloneFinderTest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
296.73 + File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
296.74 +
296.75 + deleteRecursively(workingDirectory);
296.76 +
296.77 + File cache = new File(workingDirectory, "cache");
296.78 +
296.79 + src = new File(workingDirectory, "src");
296.80 +
296.81 + Cache.setStandaloneCacheRoot(cache);
296.82 +
296.83 + copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
296.84 + copyStringToFile(new File(src, "test/TestLambda.java"), "package test; public class Test1 { private void test() { Runnable r = new Runnable() { public void run() { System.err.println(); } }; } }");
296.85 +
296.86 + StandaloneIndexer.index(src, false, false, null, null);
296.87 + }
296.88 +
296.89 + public final static void copyStringToFile (File f, String content) throws Exception {
296.90 + f.getParentFile().mkdirs();
296.91 +
296.92 + FileOutputStream os = new FileOutputStream(f);
296.93 + InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
296.94 + int read;
296.95 + while ((read = is.read()) != (-1)) {
296.96 + os.write(read);
296.97 + }
296.98 + os.close ();
296.99 + is.close();
296.100 + }
296.101 +
296.102 + private static List<Integer> toIntegerList(int[] arr) {
296.103 + List<Integer> res = new ArrayList<Integer>(arr.length);
296.104 +
296.105 + for (int e : arr) {
296.106 + res.add(e);
296.107 + }
296.108 +
296.109 + return res;
296.110 + }
296.111 +
296.112 + private static void deleteRecursively(File d) throws IOException {
296.113 + if (!d.exists()) return;
296.114 +
296.115 + if (d.isDirectory()) {
296.116 + for (File c : d.listFiles()) {
296.117 + deleteRecursively(c);
296.118 + }
296.119 + }
296.120 +
296.121 + if (!d.delete()) throw new IOException();
296.122 + }
296.123 +
296.124 + public void testFindSpans() throws Exception {
296.125 + Assert.assertEquals(Arrays.asList(55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", "$1.isDirectory()")));
296.126 + }
296.127 +
296.128 + public void testMultiplePatterns() throws Exception {
296.129 + String patterns = "$1.isDirectory();; new java.io.File($1);;";
296.130 + Assert.assertEquals(Arrays.asList("test/Test1.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
296.131 + Assert.assertEquals(Arrays.asList(55, 75, 55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", patterns)));
296.132 + }
296.133 +
296.134 + public void testUpdate() throws Exception {
296.135 + File modified = new File(src.getParentFile(), "modified");
296.136 + File removed = new File(src.getParentFile(), "removed");
296.137 +
296.138 + copyStringToFile(removed, "test/Test1.java");
296.139 + copyStringToFile(modified, "test/Test2.java\ntest/Test3.java");
296.140 +
296.141 + new File(src, "test/Test1.java").delete();
296.142 +
296.143 + copyStringToFile(new File(src, "test/Test2.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
296.144 + copyStringToFile(new File(src, "test/Test3.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
296.145 +
296.146 + StandaloneIndexer.index(src, false, false, modified.getAbsolutePath(), removed.getAbsolutePath());
296.147 +
296.148 + String patterns = "$1.isDirectory();; new java.io.File($1);;";
296.149 + Assert.assertEquals(new HashSet<String>(Arrays.asList("test/Test2.java", "test/Test3.java")), new HashSet<String>(StandaloneFinder.findCandidates(src, patterns)));
296.150 + }
296.151 +
296.152 + public void testLambdaPattern() throws Exception {
296.153 + String patterns = "new $type() {\n $mods$ $resultType $methodName($args$) {\n $statements$;\n }\n }\n";
296.154 + Assert.assertEquals(Arrays.asList("test/TestLambda.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
296.155 + Assert.assertEquals(Arrays.asList(70, 132), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/TestLambda.java", patterns)));
296.156 + }
296.157 +}
297.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
297.2 +++ b/sandbox/old-modules/server/web.api/build.xml Tue Feb 21 22:37:57 2012 +0100
297.3 @@ -0,0 +1,75 @@
297.4 +<?xml version="1.0" encoding="UTF-8"?>
297.5 +<!-- You may freely edit this file. See commented blocks below for -->
297.6 +<!-- some examples of how to customize the build. -->
297.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
297.8 +<!-- By default, only the Clean and Build commands use this build script. -->
297.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
297.10 +<!-- the Compile on Save feature is turned off for the project. -->
297.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
297.12 +<!-- in the project's Project Properties dialog box.-->
297.13 +<project name="web.api" default="default" basedir=".">
297.14 + <description>Builds, tests, and runs the project web.api.</description>
297.15 + <import file="../download.xml"/>
297.16 + <import file="nbproject/build-impl.xml"/>
297.17 + <!--
297.18 +
297.19 + There exist several targets which are by default empty and which can be
297.20 + used for execution of your tasks. These targets are usually executed
297.21 + before and after some main targets. They are:
297.22 +
297.23 + -pre-init: called before initialization of project properties
297.24 + -post-init: called after initialization of project properties
297.25 + -pre-compile: called before javac compilation
297.26 + -post-compile: called after javac compilation
297.27 + -pre-compile-single: called before javac compilation of single file
297.28 + -post-compile-single: called after javac compilation of single file
297.29 + -pre-compile-test: called before javac compilation of JUnit tests
297.30 + -post-compile-test: called after javac compilation of JUnit tests
297.31 + -pre-compile-test-single: called before javac compilation of single JUnit test
297.32 + -post-compile-test-single: called after javac compilation of single JUunit test
297.33 + -pre-jar: called before JAR building
297.34 + -post-jar: called after JAR building
297.35 + -post-clean: called after cleaning build products
297.36 +
297.37 + (Targets beginning with '-' are not intended to be called on their own.)
297.38 +
297.39 + Example of inserting an obfuscator after compilation could look like this:
297.40 +
297.41 + <target name="-post-compile">
297.42 + <obfuscate>
297.43 + <fileset dir="${build.classes.dir}"/>
297.44 + </obfuscate>
297.45 + </target>
297.46 +
297.47 + For list of available properties check the imported
297.48 + nbproject/build-impl.xml file.
297.49 +
297.50 +
297.51 + Another way to customize the build is by overriding existing main targets.
297.52 + The targets of interest are:
297.53 +
297.54 + -init-macrodef-javac: defines macro for javac compilation
297.55 + -init-macrodef-junit: defines macro for junit execution
297.56 + -init-macrodef-debug: defines macro for class debugging
297.57 + -init-macrodef-java: defines macro for class execution
297.58 + -do-jar-with-manifest: JAR building (if you are using a manifest)
297.59 + -do-jar-without-manifest: JAR building (if you are not using a manifest)
297.60 + run: execution of project
297.61 + -javadoc-build: Javadoc generation
297.62 + test-report: JUnit report generation
297.63 +
297.64 + An example of overriding the target for project execution could look like this:
297.65 +
297.66 + <target name="run" depends="web.api-impl.jar">
297.67 + <exec dir="bin" executable="launcher.exe">
297.68 + <arg file="${dist.jar}"/>
297.69 + </exec>
297.70 + </target>
297.71 +
297.72 + Notice that the overridden target depends on the jar target and not only on
297.73 + the compile target as the regular run target does. Again, for a list of available
297.74 + properties which you can use, check the target you are overriding in the
297.75 + nbproject/build-impl.xml file.
297.76 +
297.77 + -->
297.78 +</project>
298.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
298.2 +++ b/sandbox/old-modules/server/web.api/manifest.mf Tue Feb 21 22:37:57 2012 +0100
298.3 @@ -0,0 +1,3 @@
298.4 +Manifest-Version: 1.0
298.5 +X-COMMENT: Main-Class will be added automatically by build
298.6 +
299.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
299.2 +++ b/sandbox/old-modules/server/web.api/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
299.3 @@ -0,0 +1,966 @@
299.4 +<?xml version="1.0" encoding="UTF-8"?>
299.5 +<!--
299.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
299.7 +*** EDIT ../build.xml INSTEAD ***
299.8 +
299.9 +For the purpose of easier reading the script
299.10 +is divided into following sections:
299.11 +
299.12 + - initialization
299.13 + - compilation
299.14 + - jar
299.15 + - execution
299.16 + - debugging
299.17 + - javadoc
299.18 + - junit compilation
299.19 + - junit execution
299.20 + - junit debugging
299.21 + - applet
299.22 + - cleanup
299.23 +
299.24 + -->
299.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="web.api-impl">
299.26 + <fail message="Please build using Ant 1.7.1 or higher.">
299.27 + <condition>
299.28 + <not>
299.29 + <antversion atleast="1.7.1"/>
299.30 + </not>
299.31 + </condition>
299.32 + </fail>
299.33 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
299.34 + <!--
299.35 + ======================
299.36 + INITIALIZATION SECTION
299.37 + ======================
299.38 + -->
299.39 + <target name="-pre-init">
299.40 + <!-- Empty placeholder for easier customization. -->
299.41 + <!-- You can override this target in the ../build.xml file. -->
299.42 + </target>
299.43 + <target depends="-pre-init" name="-init-private">
299.44 + <property file="nbproject/private/config.properties"/>
299.45 + <property file="nbproject/private/configs/${config}.properties"/>
299.46 + <property file="nbproject/private/private.properties"/>
299.47 + </target>
299.48 + <target name="-pre-init-libraries">
299.49 + <property location="../lib/nblibraries.properties" name="libraries.path"/>
299.50 + <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
299.51 + <pathconvert dirsep="/" property="libraries.dir">
299.52 + <path path="${libraries.dir.nativedirsep}"/>
299.53 + </pathconvert>
299.54 + <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
299.55 + <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
299.56 + </target>
299.57 + <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
299.58 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
299.59 + <filterchain>
299.60 + <replacestring from="$${base}" to="${libraries.dir}"/>
299.61 + <escapeunicode/>
299.62 + </filterchain>
299.63 + </loadproperties>
299.64 + </target>
299.65 + <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
299.66 + <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
299.67 + <filterchain>
299.68 + <replacestring from="$${base}" to="${libraries.dir}"/>
299.69 + <escapeunicode/>
299.70 + </filterchain>
299.71 + </loadproperties>
299.72 + </target>
299.73 + <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
299.74 + <property file="${user.properties.file}"/>
299.75 + <!-- The two properties below are usually overridden -->
299.76 + <!-- by the active platform. Just a fallback. -->
299.77 + <property name="default.javac.source" value="1.4"/>
299.78 + <property name="default.javac.target" value="1.4"/>
299.79 + </target>
299.80 + <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
299.81 + <property file="nbproject/configs/${config}.properties"/>
299.82 + <property file="nbproject/project.properties"/>
299.83 + </target>
299.84 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
299.85 + <available file="${manifest.file}" property="manifest.available"/>
299.86 + <available file="${application.splash}" property="splashscreen.available"/>
299.87 + <condition property="main.class.available">
299.88 + <and>
299.89 + <isset property="main.class"/>
299.90 + <not>
299.91 + <equals arg1="${main.class}" arg2="" trim="true"/>
299.92 + </not>
299.93 + </and>
299.94 + </condition>
299.95 + <condition property="manifest.available+main.class">
299.96 + <and>
299.97 + <isset property="manifest.available"/>
299.98 + <isset property="main.class.available"/>
299.99 + </and>
299.100 + </condition>
299.101 + <condition property="do.mkdist">
299.102 + <and>
299.103 + <isset property="libs.CopyLibs.classpath"/>
299.104 + <not>
299.105 + <istrue value="${mkdist.disabled}"/>
299.106 + </not>
299.107 + </and>
299.108 + </condition>
299.109 + <condition property="manifest.available+main.class+mkdist.available">
299.110 + <and>
299.111 + <istrue value="${manifest.available+main.class}"/>
299.112 + <isset property="do.mkdist"/>
299.113 + </and>
299.114 + </condition>
299.115 + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
299.116 + <and>
299.117 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
299.118 + <istrue value="${splashscreen.available}"/>
299.119 + </and>
299.120 + </condition>
299.121 + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
299.122 + <and>
299.123 + <istrue value="${manifest.available+main.class+mkdist.available}"/>
299.124 + <istrue value="${splashscreen.available}"/>
299.125 + </and>
299.126 + </condition>
299.127 + <condition property="manifest.available+mkdist.available">
299.128 + <and>
299.129 + <istrue value="${manifest.available}"/>
299.130 + <isset property="do.mkdist"/>
299.131 + </and>
299.132 + </condition>
299.133 + <condition property="manifest.available-mkdist.available">
299.134 + <or>
299.135 + <istrue value="${manifest.available}"/>
299.136 + <isset property="do.mkdist"/>
299.137 + </or>
299.138 + </condition>
299.139 + <condition property="manifest.available+main.class-mkdist.available">
299.140 + <or>
299.141 + <istrue value="${manifest.available+main.class}"/>
299.142 + <isset property="do.mkdist"/>
299.143 + </or>
299.144 + </condition>
299.145 + <condition property="have.tests">
299.146 + <or>
299.147 + <available file="${test.src.dir}"/>
299.148 + </or>
299.149 + </condition>
299.150 + <condition property="have.sources">
299.151 + <or>
299.152 + <available file="${src.dir}"/>
299.153 + </or>
299.154 + </condition>
299.155 + <condition property="netbeans.home+have.tests">
299.156 + <and>
299.157 + <isset property="netbeans.home"/>
299.158 + <isset property="have.tests"/>
299.159 + </and>
299.160 + </condition>
299.161 + <condition property="no.javadoc.preview">
299.162 + <and>
299.163 + <isset property="javadoc.preview"/>
299.164 + <isfalse value="${javadoc.preview}"/>
299.165 + </and>
299.166 + </condition>
299.167 + <property name="run.jvmargs" value=""/>
299.168 + <property name="javac.compilerargs" value=""/>
299.169 + <property name="work.dir" value="${basedir}"/>
299.170 + <condition property="no.deps">
299.171 + <and>
299.172 + <istrue value="${no.dependencies}"/>
299.173 + </and>
299.174 + </condition>
299.175 + <property name="javac.debug" value="true"/>
299.176 + <property name="javadoc.preview" value="true"/>
299.177 + <property name="application.args" value=""/>
299.178 + <property name="source.encoding" value="${file.encoding}"/>
299.179 + <property name="runtime.encoding" value="${source.encoding}"/>
299.180 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
299.181 + <and>
299.182 + <isset property="javadoc.encoding"/>
299.183 + <not>
299.184 + <equals arg1="${javadoc.encoding}" arg2=""/>
299.185 + </not>
299.186 + </and>
299.187 + </condition>
299.188 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
299.189 + <property name="includes" value="**"/>
299.190 + <property name="excludes" value=""/>
299.191 + <property name="do.depend" value="false"/>
299.192 + <condition property="do.depend.true">
299.193 + <istrue value="${do.depend}"/>
299.194 + </condition>
299.195 + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
299.196 + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
299.197 + <length length="0" string="${endorsed.classpath}" when="greater"/>
299.198 + </condition>
299.199 + <property name="javac.fork" value="false"/>
299.200 + </target>
299.201 + <target name="-post-init">
299.202 + <!-- Empty placeholder for easier customization. -->
299.203 + <!-- You can override this target in the ../build.xml file. -->
299.204 + </target>
299.205 + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
299.206 + <fail unless="src.dir">Must set src.dir</fail>
299.207 + <fail unless="test.src.dir">Must set test.src.dir</fail>
299.208 + <fail unless="build.dir">Must set build.dir</fail>
299.209 + <fail unless="dist.dir">Must set dist.dir</fail>
299.210 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
299.211 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
299.212 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
299.213 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
299.214 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
299.215 + <fail unless="dist.jar">Must set dist.jar</fail>
299.216 + </target>
299.217 + <target name="-init-macrodef-property">
299.218 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
299.219 + <attribute name="name"/>
299.220 + <attribute name="value"/>
299.221 + <sequential>
299.222 + <property name="@{name}" value="${@{value}}"/>
299.223 + </sequential>
299.224 + </macrodef>
299.225 + </target>
299.226 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
299.227 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
299.228 + <attribute default="${src.dir}" name="srcdir"/>
299.229 + <attribute default="${build.classes.dir}" name="destdir"/>
299.230 + <attribute default="${javac.classpath}" name="classpath"/>
299.231 + <attribute default="${javac.processorpath}" name="processorpath"/>
299.232 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
299.233 + <attribute default="${includes}" name="includes"/>
299.234 + <attribute default="${excludes}" name="excludes"/>
299.235 + <attribute default="${javac.debug}" name="debug"/>
299.236 + <attribute default="${empty.dir}" name="sourcepath"/>
299.237 + <attribute default="${empty.dir}" name="gensrcdir"/>
299.238 + <element name="customize" optional="true"/>
299.239 + <sequential>
299.240 + <property location="${build.dir}/empty" name="empty.dir"/>
299.241 + <mkdir dir="${empty.dir}"/>
299.242 + <mkdir dir="@{apgeneratedsrcdir}"/>
299.243 + <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}">
299.244 + <src>
299.245 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
299.246 + <include name="*"/>
299.247 + </dirset>
299.248 + </src>
299.249 + <classpath>
299.250 + <path path="@{classpath}"/>
299.251 + </classpath>
299.252 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
299.253 + <compilerarg line="${javac.compilerargs}"/>
299.254 + <compilerarg value="-processorpath"/>
299.255 + <compilerarg path="@{processorpath}"/>
299.256 + <compilerarg line="${ap.processors.internal}"/>
299.257 + <compilerarg value="-s"/>
299.258 + <compilerarg path="@{apgeneratedsrcdir}"/>
299.259 + <compilerarg line="${ap.proc.none.internal}"/>
299.260 + <customize/>
299.261 + </javac>
299.262 + </sequential>
299.263 + </macrodef>
299.264 + </target>
299.265 + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
299.266 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
299.267 + <attribute default="${src.dir}" name="srcdir"/>
299.268 + <attribute default="${build.classes.dir}" name="destdir"/>
299.269 + <attribute default="${javac.classpath}" name="classpath"/>
299.270 + <attribute default="${javac.processorpath}" name="processorpath"/>
299.271 + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
299.272 + <attribute default="${includes}" name="includes"/>
299.273 + <attribute default="${excludes}" name="excludes"/>
299.274 + <attribute default="${javac.debug}" name="debug"/>
299.275 + <attribute default="${empty.dir}" name="sourcepath"/>
299.276 + <attribute default="${empty.dir}" name="gensrcdir"/>
299.277 + <element name="customize" optional="true"/>
299.278 + <sequential>
299.279 + <property location="${build.dir}/empty" name="empty.dir"/>
299.280 + <mkdir dir="${empty.dir}"/>
299.281 + <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}">
299.282 + <src>
299.283 + <dirset dir="@{gensrcdir}" erroronmissingdir="false">
299.284 + <include name="*"/>
299.285 + </dirset>
299.286 + </src>
299.287 + <classpath>
299.288 + <path path="@{classpath}"/>
299.289 + </classpath>
299.290 + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
299.291 + <compilerarg line="${javac.compilerargs}"/>
299.292 + <customize/>
299.293 + </javac>
299.294 + </sequential>
299.295 + </macrodef>
299.296 + </target>
299.297 + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
299.298 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
299.299 + <attribute default="${src.dir}" name="srcdir"/>
299.300 + <attribute default="${build.classes.dir}" name="destdir"/>
299.301 + <attribute default="${javac.classpath}" name="classpath"/>
299.302 + <sequential>
299.303 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
299.304 + <classpath>
299.305 + <path path="@{classpath}"/>
299.306 + </classpath>
299.307 + </depend>
299.308 + </sequential>
299.309 + </macrodef>
299.310 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
299.311 + <attribute default="${build.classes.dir}" name="destdir"/>
299.312 + <sequential>
299.313 + <fail unless="javac.includes">Must set javac.includes</fail>
299.314 + <pathconvert pathsep="," property="javac.includes.binary">
299.315 + <path>
299.316 + <filelist dir="@{destdir}" files="${javac.includes}"/>
299.317 + </path>
299.318 + <globmapper from="*.java" to="*.class"/>
299.319 + </pathconvert>
299.320 + <delete>
299.321 + <files includes="${javac.includes.binary}"/>
299.322 + </delete>
299.323 + </sequential>
299.324 + </macrodef>
299.325 + </target>
299.326 + <target name="-init-macrodef-junit">
299.327 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
299.328 + <attribute default="${includes}" name="includes"/>
299.329 + <attribute default="${excludes}" name="excludes"/>
299.330 + <attribute default="**" name="testincludes"/>
299.331 + <sequential>
299.332 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
299.333 + <batchtest todir="${build.test.results.dir}">
299.334 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
299.335 + <filename name="@{testincludes}"/>
299.336 + </fileset>
299.337 + </batchtest>
299.338 + <classpath>
299.339 + <path path="${run.test.classpath}"/>
299.340 + </classpath>
299.341 + <syspropertyset>
299.342 + <propertyref prefix="test-sys-prop."/>
299.343 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
299.344 + </syspropertyset>
299.345 + <formatter type="brief" usefile="false"/>
299.346 + <formatter type="xml"/>
299.347 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
299.348 + <jvmarg line="${run.jvmargs}"/>
299.349 + </junit>
299.350 + </sequential>
299.351 + </macrodef>
299.352 + </target>
299.353 + <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
299.354 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
299.355 + <attribute default="${main.class}" name="name"/>
299.356 + <attribute default="${debug.classpath}" name="classpath"/>
299.357 + <attribute default="" name="stopclassname"/>
299.358 + <sequential>
299.359 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
299.360 + <classpath>
299.361 + <path path="@{classpath}"/>
299.362 + </classpath>
299.363 + </nbjpdastart>
299.364 + </sequential>
299.365 + </macrodef>
299.366 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
299.367 + <attribute default="${build.classes.dir}" name="dir"/>
299.368 + <sequential>
299.369 + <nbjpdareload>
299.370 + <fileset dir="@{dir}" includes="${fix.classes}">
299.371 + <include name="${fix.includes}*.class"/>
299.372 + </fileset>
299.373 + </nbjpdareload>
299.374 + </sequential>
299.375 + </macrodef>
299.376 + </target>
299.377 + <target name="-init-debug-args">
299.378 + <property name="version-output" value="java version "${ant.java.version}"/>
299.379 + <condition property="have-jdk-older-than-1.4">
299.380 + <or>
299.381 + <contains string="${version-output}" substring="java version "1.0"/>
299.382 + <contains string="${version-output}" substring="java version "1.1"/>
299.383 + <contains string="${version-output}" substring="java version "1.2"/>
299.384 + <contains string="${version-output}" substring="java version "1.3"/>
299.385 + </or>
299.386 + </condition>
299.387 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
299.388 + <istrue value="${have-jdk-older-than-1.4}"/>
299.389 + </condition>
299.390 + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
299.391 + <os family="windows"/>
299.392 + </condition>
299.393 + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
299.394 + <isset property="debug.transport"/>
299.395 + </condition>
299.396 + </target>
299.397 + <target depends="-init-debug-args" name="-init-macrodef-debug">
299.398 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
299.399 + <attribute default="${main.class}" name="classname"/>
299.400 + <attribute default="${debug.classpath}" name="classpath"/>
299.401 + <element name="customize" optional="true"/>
299.402 + <sequential>
299.403 + <java classname="@{classname}" dir="${work.dir}" fork="true">
299.404 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
299.405 + <jvmarg line="${debug-args-line}"/>
299.406 + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
299.407 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
299.408 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
299.409 + <jvmarg line="${run.jvmargs}"/>
299.410 + <classpath>
299.411 + <path path="@{classpath}"/>
299.412 + </classpath>
299.413 + <syspropertyset>
299.414 + <propertyref prefix="run-sys-prop."/>
299.415 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
299.416 + </syspropertyset>
299.417 + <customize/>
299.418 + </java>
299.419 + </sequential>
299.420 + </macrodef>
299.421 + </target>
299.422 + <target name="-init-macrodef-java">
299.423 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
299.424 + <attribute default="${main.class}" name="classname"/>
299.425 + <attribute default="${run.classpath}" name="classpath"/>
299.426 + <element name="customize" optional="true"/>
299.427 + <sequential>
299.428 + <java classname="@{classname}" dir="${work.dir}" fork="true">
299.429 + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
299.430 + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
299.431 + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
299.432 + <jvmarg line="${run.jvmargs}"/>
299.433 + <classpath>
299.434 + <path path="@{classpath}"/>
299.435 + </classpath>
299.436 + <syspropertyset>
299.437 + <propertyref prefix="run-sys-prop."/>
299.438 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
299.439 + </syspropertyset>
299.440 + <customize/>
299.441 + </java>
299.442 + </sequential>
299.443 + </macrodef>
299.444 + </target>
299.445 + <target name="-init-presetdef-jar">
299.446 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
299.447 + <jar compress="${jar.compress}" jarfile="${dist.jar}">
299.448 + <j2seproject1:fileset dir="${build.classes.dir}"/>
299.449 + </jar>
299.450 + </presetdef>
299.451 + </target>
299.452 + <target name="-init-ap-cmdline-properties">
299.453 + <property name="annotation.processing.enabled" value="true"/>
299.454 + <property name="annotation.processing.processors.list" value=""/>
299.455 + <property name="annotation.processing.run.all.processors" value="true"/>
299.456 + <property name="javac.processorpath" value="${javac.classpath}"/>
299.457 + <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
299.458 + <condition property="ap.supported.internal" value="true">
299.459 + <not>
299.460 + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
299.461 + </not>
299.462 + </condition>
299.463 + </target>
299.464 + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
299.465 + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
299.466 + <isfalse value="${annotation.processing.run.all.processors}"/>
299.467 + </condition>
299.468 + <condition else="" property="ap.proc.none.internal" value="-proc:none">
299.469 + <isfalse value="${annotation.processing.enabled}"/>
299.470 + </condition>
299.471 + </target>
299.472 + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
299.473 + <property name="ap.cmd.line.internal" value=""/>
299.474 + </target>
299.475 + <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-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
299.476 + <!--
299.477 + ===================
299.478 + COMPILATION SECTION
299.479 + ===================
299.480 + -->
299.481 + <target name="-deps-jar-init" unless="built-jar.properties">
299.482 + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
299.483 + <delete file="${built-jar.properties}" quiet="true"/>
299.484 + </target>
299.485 + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
299.486 + <echo level="warn" message="Cycle detected: web.api was already built"/>
299.487 + </target>
299.488 + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
299.489 + <mkdir dir="${build.dir}"/>
299.490 + <touch file="${built-jar.properties}" verbose="false"/>
299.491 + <property file="${built-jar.properties}" prefix="already.built.jar."/>
299.492 + <antcall target="-warn-already-built-jar"/>
299.493 + <propertyfile file="${built-jar.properties}">
299.494 + <entry key="${basedir}" value=""/>
299.495 + </propertyfile>
299.496 + <antcall target="-maybe-call-dep">
299.497 + <param name="call.built.properties" value="${built-jar.properties}"/>
299.498 + <param location="${project.indexer}" name="call.subproject"/>
299.499 + <param location="${project.indexer}/build.xml" name="call.script"/>
299.500 + <param name="call.target" value="jar"/>
299.501 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
299.502 + </antcall>
299.503 + <antcall target="-maybe-call-dep">
299.504 + <param name="call.built.properties" value="${built-jar.properties}"/>
299.505 + <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
299.506 + <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
299.507 + <param name="call.target" value="netbeans"/>
299.508 + <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
299.509 + </antcall>
299.510 + </target>
299.511 + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
299.512 + <target depends="init" name="-check-automatic-build">
299.513 + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
299.514 + </target>
299.515 + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
299.516 + <antcall target="clean"/>
299.517 + </target>
299.518 + <target depends="init,deps-jar" name="-pre-pre-compile">
299.519 + <mkdir dir="${build.classes.dir}"/>
299.520 + </target>
299.521 + <target name="-pre-compile">
299.522 + <!-- Empty placeholder for easier customization. -->
299.523 + <!-- You can override this target in the ../build.xml file. -->
299.524 + </target>
299.525 + <target if="do.depend.true" name="-compile-depend">
299.526 + <pathconvert property="build.generated.subdirs">
299.527 + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
299.528 + <include name="*"/>
299.529 + </dirset>
299.530 + </pathconvert>
299.531 + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
299.532 + </target>
299.533 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
299.534 + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
299.535 + <copy todir="${build.classes.dir}">
299.536 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
299.537 + </copy>
299.538 + </target>
299.539 + <target name="-post-compile">
299.540 + <!-- Empty placeholder for easier customization. -->
299.541 + <!-- You can override this target in the ../build.xml file. -->
299.542 + </target>
299.543 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
299.544 + <target name="-pre-compile-single">
299.545 + <!-- Empty placeholder for easier customization. -->
299.546 + <!-- You can override this target in the ../build.xml file. -->
299.547 + </target>
299.548 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
299.549 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
299.550 + <j2seproject3:force-recompile/>
299.551 + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
299.552 + </target>
299.553 + <target name="-post-compile-single">
299.554 + <!-- Empty placeholder for easier customization. -->
299.555 + <!-- You can override this target in the ../build.xml file. -->
299.556 + </target>
299.557 + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
299.558 + <!--
299.559 + ====================
299.560 + JAR BUILDING SECTION
299.561 + ====================
299.562 + -->
299.563 + <target depends="init" name="-pre-pre-jar">
299.564 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
299.565 + <mkdir dir="${dist.jar.dir}"/>
299.566 + </target>
299.567 + <target name="-pre-jar">
299.568 + <!-- Empty placeholder for easier customization. -->
299.569 + <!-- You can override this target in the ../build.xml file. -->
299.570 + </target>
299.571 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
299.572 + <j2seproject1:jar/>
299.573 + </target>
299.574 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
299.575 + <j2seproject1:jar manifest="${manifest.file}"/>
299.576 + </target>
299.577 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
299.578 + <j2seproject1:jar manifest="${manifest.file}">
299.579 + <j2seproject1:manifest>
299.580 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
299.581 + </j2seproject1:manifest>
299.582 + </j2seproject1:jar>
299.583 + <echo>To run this application from the command line without Ant, try:</echo>
299.584 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
299.585 + <property location="${dist.jar}" name="dist.jar.resolved"/>
299.586 + <pathconvert property="run.classpath.with.dist.jar">
299.587 + <path path="${run.classpath}"/>
299.588 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
299.589 + </pathconvert>
299.590 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
299.591 + </target>
299.592 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
299.593 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
299.594 + <pathconvert property="run.classpath.without.build.classes.dir">
299.595 + <path path="${run.classpath}"/>
299.596 + <map from="${build.classes.dir.resolved}" to=""/>
299.597 + </pathconvert>
299.598 + <pathconvert pathsep=" " property="jar.classpath">
299.599 + <path path="${run.classpath.without.build.classes.dir}"/>
299.600 + <chainedmapper>
299.601 + <flattenmapper/>
299.602 + <globmapper from="*" to="lib/*"/>
299.603 + </chainedmapper>
299.604 + </pathconvert>
299.605 + <basename file="${application.splash}" property="splashscreen.basename"/>
299.606 + <mkdir dir="${build.classes.dir}/META-INF"/>
299.607 + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
299.608 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
299.609 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
299.610 + <fileset dir="${build.classes.dir}"/>
299.611 + <manifest>
299.612 + <attribute name="Main-Class" value="${main.class}"/>
299.613 + <attribute name="Class-Path" value="${jar.classpath}"/>
299.614 + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
299.615 + </manifest>
299.616 + </copylibs>
299.617 + <echo>To run this application from the command line without Ant, try:</echo>
299.618 + <property location="${dist.jar}" name="dist.jar.resolved"/>
299.619 + <echo>java -jar "${dist.jar.resolved}"</echo>
299.620 + </target>
299.621 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
299.622 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
299.623 + <pathconvert property="run.classpath.without.build.classes.dir">
299.624 + <path path="${run.classpath}"/>
299.625 + <map from="${build.classes.dir.resolved}" to=""/>
299.626 + </pathconvert>
299.627 + <pathconvert pathsep=" " property="jar.classpath">
299.628 + <path path="${run.classpath.without.build.classes.dir}"/>
299.629 + <chainedmapper>
299.630 + <flattenmapper/>
299.631 + <globmapper from="*" to="lib/*"/>
299.632 + </chainedmapper>
299.633 + </pathconvert>
299.634 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
299.635 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
299.636 + <fileset dir="${build.classes.dir}"/>
299.637 + <manifest>
299.638 + <attribute name="Main-Class" value="${main.class}"/>
299.639 + <attribute name="Class-Path" value="${jar.classpath}"/>
299.640 + </manifest>
299.641 + </copylibs>
299.642 + <echo>To run this application from the command line without Ant, try:</echo>
299.643 + <property location="${dist.jar}" name="dist.jar.resolved"/>
299.644 + <echo>java -jar "${dist.jar.resolved}"</echo>
299.645 + </target>
299.646 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
299.647 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
299.648 + <pathconvert property="run.classpath.without.build.classes.dir">
299.649 + <path path="${run.classpath}"/>
299.650 + <map from="${build.classes.dir.resolved}" to=""/>
299.651 + </pathconvert>
299.652 + <pathconvert pathsep=" " property="jar.classpath">
299.653 + <path path="${run.classpath.without.build.classes.dir}"/>
299.654 + <chainedmapper>
299.655 + <flattenmapper/>
299.656 + <globmapper from="*" to="lib/*"/>
299.657 + </chainedmapper>
299.658 + </pathconvert>
299.659 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
299.660 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
299.661 + <fileset dir="${build.classes.dir}"/>
299.662 + <manifest>
299.663 + <attribute name="Class-Path" value="${jar.classpath}"/>
299.664 + </manifest>
299.665 + </copylibs>
299.666 + </target>
299.667 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
299.668 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
299.669 + <pathconvert property="run.classpath.without.build.classes.dir">
299.670 + <path path="${run.classpath}"/>
299.671 + <map from="${build.classes.dir.resolved}" to=""/>
299.672 + </pathconvert>
299.673 + <pathconvert pathsep=" " property="jar.classpath">
299.674 + <path path="${run.classpath.without.build.classes.dir}"/>
299.675 + <chainedmapper>
299.676 + <flattenmapper/>
299.677 + <globmapper from="*" to="lib/*"/>
299.678 + </chainedmapper>
299.679 + </pathconvert>
299.680 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
299.681 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
299.682 + <fileset dir="${build.classes.dir}"/>
299.683 + <manifest>
299.684 + <attribute name="Class-Path" value="${jar.classpath}"/>
299.685 + </manifest>
299.686 + </copylibs>
299.687 + </target>
299.688 + <target name="-post-jar">
299.689 + <!-- Empty placeholder for easier customization. -->
299.690 + <!-- You can override this target in the ../build.xml file. -->
299.691 + </target>
299.692 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
299.693 + <!--
299.694 + =================
299.695 + EXECUTION SECTION
299.696 + =================
299.697 + -->
299.698 + <target depends="init,compile" description="Run a main class." name="run">
299.699 + <j2seproject1:java>
299.700 + <customize>
299.701 + <arg line="${application.args}"/>
299.702 + </customize>
299.703 + </j2seproject1:java>
299.704 + </target>
299.705 + <target name="-do-not-recompile">
299.706 + <property name="javac.includes.binary" value=""/>
299.707 + </target>
299.708 + <target depends="init,compile-single" name="run-single">
299.709 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
299.710 + <j2seproject1:java classname="${run.class}"/>
299.711 + </target>
299.712 + <target depends="init,compile-test-single" name="run-test-with-main">
299.713 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
299.714 + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
299.715 + </target>
299.716 + <!--
299.717 + =================
299.718 + DEBUGGING SECTION
299.719 + =================
299.720 + -->
299.721 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
299.722 + <j2seproject1:nbjpdastart name="${debug.class}"/>
299.723 + </target>
299.724 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
299.725 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
299.726 + </target>
299.727 + <target depends="init,compile" name="-debug-start-debuggee">
299.728 + <j2seproject3:debug>
299.729 + <customize>
299.730 + <arg line="${application.args}"/>
299.731 + </customize>
299.732 + </j2seproject3:debug>
299.733 + </target>
299.734 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
299.735 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
299.736 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
299.737 + </target>
299.738 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
299.739 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
299.740 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
299.741 + <j2seproject3:debug classname="${debug.class}"/>
299.742 + </target>
299.743 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
299.744 + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
299.745 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
299.746 + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
299.747 + </target>
299.748 + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
299.749 + <target depends="init" name="-pre-debug-fix">
299.750 + <fail unless="fix.includes">Must set fix.includes</fail>
299.751 + <property name="javac.includes" value="${fix.includes}.java"/>
299.752 + </target>
299.753 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
299.754 + <j2seproject1:nbjpdareload/>
299.755 + </target>
299.756 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
299.757 + <!--
299.758 + ===============
299.759 + JAVADOC SECTION
299.760 + ===============
299.761 + -->
299.762 + <target depends="init" if="have.sources" name="-javadoc-build">
299.763 + <mkdir dir="${dist.javadoc.dir}"/>
299.764 + <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}">
299.765 + <classpath>
299.766 + <path path="${javac.classpath}"/>
299.767 + </classpath>
299.768 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
299.769 + <filename name="**/*.java"/>
299.770 + </fileset>
299.771 + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
299.772 + <include name="**/*.java"/>
299.773 + </fileset>
299.774 + </javadoc>
299.775 + </target>
299.776 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
299.777 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
299.778 + </target>
299.779 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
299.780 + <!--
299.781 + =========================
299.782 + JUNIT COMPILATION SECTION
299.783 + =========================
299.784 + -->
299.785 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
299.786 + <mkdir dir="${build.test.classes.dir}"/>
299.787 + </target>
299.788 + <target name="-pre-compile-test">
299.789 + <!-- Empty placeholder for easier customization. -->
299.790 + <!-- You can override this target in the ../build.xml file. -->
299.791 + </target>
299.792 + <target if="do.depend.true" name="-compile-test-depend">
299.793 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
299.794 + </target>
299.795 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
299.796 + <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}"/>
299.797 + <copy todir="${build.test.classes.dir}">
299.798 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
299.799 + </copy>
299.800 + </target>
299.801 + <target name="-post-compile-test">
299.802 + <!-- Empty placeholder for easier customization. -->
299.803 + <!-- You can override this target in the ../build.xml file. -->
299.804 + </target>
299.805 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
299.806 + <target name="-pre-compile-test-single">
299.807 + <!-- Empty placeholder for easier customization. -->
299.808 + <!-- You can override this target in the ../build.xml file. -->
299.809 + </target>
299.810 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
299.811 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
299.812 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
299.813 + <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}"/>
299.814 + <copy todir="${build.test.classes.dir}">
299.815 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
299.816 + </copy>
299.817 + </target>
299.818 + <target name="-post-compile-test-single">
299.819 + <!-- Empty placeholder for easier customization. -->
299.820 + <!-- You can override this target in the ../build.xml file. -->
299.821 + </target>
299.822 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
299.823 + <!--
299.824 + =======================
299.825 + JUNIT EXECUTION SECTION
299.826 + =======================
299.827 + -->
299.828 + <target depends="init" if="have.tests" name="-pre-test-run">
299.829 + <mkdir dir="${build.test.results.dir}"/>
299.830 + </target>
299.831 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
299.832 + <j2seproject3:junit testincludes="**/*Test.java"/>
299.833 + </target>
299.834 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
299.835 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
299.836 + </target>
299.837 + <target depends="init" if="have.tests" name="test-report"/>
299.838 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
299.839 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
299.840 + <target depends="init" if="have.tests" name="-pre-test-run-single">
299.841 + <mkdir dir="${build.test.results.dir}"/>
299.842 + </target>
299.843 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
299.844 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
299.845 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
299.846 + </target>
299.847 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
299.848 + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
299.849 + </target>
299.850 + <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"/>
299.851 + <!--
299.852 + =======================
299.853 + JUNIT DEBUGGING SECTION
299.854 + =======================
299.855 + -->
299.856 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
299.857 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
299.858 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
299.859 + <delete file="${test.report.file}"/>
299.860 + <mkdir dir="${build.test.results.dir}"/>
299.861 + <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}">
299.862 + <customize>
299.863 + <syspropertyset>
299.864 + <propertyref prefix="test-sys-prop."/>
299.865 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
299.866 + </syspropertyset>
299.867 + <arg value="${test.class}"/>
299.868 + <arg value="showoutput=true"/>
299.869 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
299.870 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
299.871 + </customize>
299.872 + </j2seproject3:debug>
299.873 + </target>
299.874 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
299.875 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
299.876 + </target>
299.877 + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
299.878 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
299.879 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
299.880 + </target>
299.881 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
299.882 + <!--
299.883 + =========================
299.884 + APPLET EXECUTION SECTION
299.885 + =========================
299.886 + -->
299.887 + <target depends="init,compile-single" name="run-applet">
299.888 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
299.889 + <j2seproject1:java classname="sun.applet.AppletViewer">
299.890 + <customize>
299.891 + <arg value="${applet.url}"/>
299.892 + </customize>
299.893 + </j2seproject1:java>
299.894 + </target>
299.895 + <!--
299.896 + =========================
299.897 + APPLET DEBUGGING SECTION
299.898 + =========================
299.899 + -->
299.900 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
299.901 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
299.902 + <j2seproject3:debug classname="sun.applet.AppletViewer">
299.903 + <customize>
299.904 + <arg value="${applet.url}"/>
299.905 + </customize>
299.906 + </j2seproject3:debug>
299.907 + </target>
299.908 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
299.909 + <!--
299.910 + ===============
299.911 + CLEANUP SECTION
299.912 + ===============
299.913 + -->
299.914 + <target name="-deps-clean-init" unless="built-clean.properties">
299.915 + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
299.916 + <delete file="${built-clean.properties}" quiet="true"/>
299.917 + </target>
299.918 + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
299.919 + <echo level="warn" message="Cycle detected: web.api was already built"/>
299.920 + </target>
299.921 + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
299.922 + <mkdir dir="${build.dir}"/>
299.923 + <touch file="${built-clean.properties}" verbose="false"/>
299.924 + <property file="${built-clean.properties}" prefix="already.built.clean."/>
299.925 + <antcall target="-warn-already-built-clean"/>
299.926 + <propertyfile file="${built-clean.properties}">
299.927 + <entry key="${basedir}" value=""/>
299.928 + </propertyfile>
299.929 + <antcall target="-maybe-call-dep">
299.930 + <param name="call.built.properties" value="${built-clean.properties}"/>
299.931 + <param location="${project.indexer}" name="call.subproject"/>
299.932 + <param location="${project.indexer}/build.xml" name="call.script"/>
299.933 + <param name="call.target" value="clean"/>
299.934 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
299.935 + </antcall>
299.936 + <antcall target="-maybe-call-dep">
299.937 + <param name="call.built.properties" value="${built-clean.properties}"/>
299.938 + <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
299.939 + <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
299.940 + <param name="call.target" value="clean"/>
299.941 + <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
299.942 + </antcall>
299.943 + </target>
299.944 + <target depends="init" name="-do-clean">
299.945 + <delete dir="${build.dir}"/>
299.946 + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
299.947 + </target>
299.948 + <target name="-post-clean">
299.949 + <!-- Empty placeholder for easier customization. -->
299.950 + <!-- You can override this target in the ../build.xml file. -->
299.951 + </target>
299.952 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
299.953 + <target name="-check-call-dep">
299.954 + <property file="${call.built.properties}" prefix="already.built."/>
299.955 + <condition property="should.call.dep">
299.956 + <not>
299.957 + <isset property="already.built.${call.subproject}"/>
299.958 + </not>
299.959 + </condition>
299.960 + </target>
299.961 + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
299.962 + <ant antfile="${call.script}" inheritall="false" target="${call.target}">
299.963 + <propertyset>
299.964 + <propertyref prefix="transfer."/>
299.965 + <mapper from="transfer.*" to="*" type="glob"/>
299.966 + </propertyset>
299.967 + </ant>
299.968 + </target>
299.969 +</project>
300.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
300.2 +++ b/sandbox/old-modules/server/web.api/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
300.3 @@ -0,0 +1,8 @@
300.4 +build.xml.data.CRC32=2d84667c
300.5 +build.xml.script.CRC32=0d0c4a18
300.6 +build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
300.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
300.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
300.9 +nbproject/build-impl.xml.data.CRC32=2d84667c
300.10 +nbproject/build-impl.xml.script.CRC32=8250004f
300.11 +nbproject/build-impl.xml.stylesheet.CRC32=ff4aa3ed@1.35.0.45
301.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
301.2 +++ b/sandbox/old-modules/server/web.api/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
301.3 @@ -0,0 +1,99 @@
301.4 +annotation.processing.enabled=true
301.5 +annotation.processing.enabled.in.editor=false
301.6 +annotation.processing.run.all.processors=true
301.7 +application.title=web.api
301.8 +application.vendor=lahvac
301.9 +build.classes.dir=${build.dir}/classes
301.10 +build.classes.excludes=**/*.java,**/*.form
301.11 +# This directory is removed when the project is cleaned:
301.12 +build.dir=build
301.13 +build.generated.dir=${build.dir}/generated
301.14 +build.generated.sources.dir=${build.dir}/generated-sources
301.15 +# Only compile against the classpath explicitly listed here:
301.16 +build.sysclasspath=ignore
301.17 +build.test.classes.dir=${build.dir}/test/classes
301.18 +build.test.results.dir=${build.dir}/test/results
301.19 +# Uncomment to specify the preferred debugger connection transport:
301.20 +#debug.transport=dt_socket
301.21 +debug.classpath=\
301.22 + ${run.classpath}
301.23 +debug.test.classpath=\
301.24 + ${run.test.classpath}
301.25 +# This directory is removed when the project is cleaned:
301.26 +dist.dir=dist
301.27 +dist.jar=${dist.dir}/web.api.jar
301.28 +dist.javadoc.dir=${dist.dir}/javadoc
301.29 +endorsed.classpath=\
301.30 + ${libs.javac.classpath}
301.31 +excludes=
301.32 +file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
301.33 +file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
301.34 +file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
301.35 +file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
301.36 +file.reference.org-openide-util.jar=../lib/org-openide-util.jar
301.37 +file.reference.util-commons.jar=../../remoting/ide/api/external/util-commons.jar
301.38 +file.reference.util-pojson.jar=../../remoting/ide/api/external/util-pojson.jar
301.39 +includes=**
301.40 +jar.compress=false
301.41 +javac.classpath=\
301.42 + ${reference.org_netbeans_modules_jackpot30_api.module}:\
301.43 + ${libs.jersey.classpath}:\
301.44 + ${libs.lucene.classpath}:\
301.45 + ${libs.javac.classpath}:\
301.46 + ${reference.indexer.jar}:\
301.47 + ${file.reference.org-netbeans-modules-java-source.jar}:\
301.48 + ${file.reference.org-openide-filesystems.jar}:\
301.49 + ${file.reference.util-commons.jar}:\
301.50 + ${file.reference.util-pojson.jar}:\
301.51 + ${libs.freemarker.classpath}:\
301.52 + ${file.reference.org-openide-util.jar}:\
301.53 + ${file.reference.org-openide-util-lookup.jar}:\
301.54 + ${file.reference.org-netbeans-spi-editor-hints.jar}:\
301.55 + ${reference.org_netbeans_modules_jackpot30_remoting_api.module}
301.56 +# Space-separated list of extra javac options
301.57 +javac.compilerargs=
301.58 +javac.deprecation=false
301.59 +javac.processorpath=\
301.60 + ${javac.classpath}
301.61 +javac.source=1.5
301.62 +javac.target=1.5
301.63 +javac.test.classpath=\
301.64 + ${javac.classpath}:\
301.65 + ${build.classes.dir}:\
301.66 + ${libs.junit_4.classpath}
301.67 +javadoc.additionalparam=
301.68 +javadoc.author=false
301.69 +javadoc.encoding=${source.encoding}
301.70 +javadoc.noindex=false
301.71 +javadoc.nonavbar=false
301.72 +javadoc.notree=false
301.73 +javadoc.private=false
301.74 +javadoc.splitindex=true
301.75 +javadoc.use=true
301.76 +javadoc.version=false
301.77 +javadoc.windowtitle=
301.78 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
301.79 +main.class=org.netbeans.modules.jackpot30.server.webapi.Main
301.80 +manifest.file=manifest.mf
301.81 +meta.inf.dir=${src.dir}/META-INF
301.82 +mkdist.disabled=false
301.83 +platform.active=default_platform
301.84 +project.indexer=../indexer
301.85 +project.org_netbeans_modules_jackpot30_api=../../api
301.86 +project.org_netbeans_modules_jackpot30_remoting_api=../../remoting/ide/api
301.87 +reference.indexer.jar=${project.indexer}/dist/indexer.jar
301.88 +reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
301.89 +reference.org_netbeans_modules_jackpot30_remoting_api.module=${project.org_netbeans_modules_jackpot30_remoting_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-remoting-api.jar
301.90 +run.classpath=\
301.91 + ${javac.classpath}:\
301.92 + ${build.classes.dir}
301.93 +# Space-separated list of JVM arguments used when running the project
301.94 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
301.95 +# or test-sys-prop.name=value to set system properties for unit tests):
301.96 +run.jvmargs=-Xbootclasspath/p:${libs.javac.classpath}
301.97 +run.test.classpath=\
301.98 + ${javac.test.classpath}:\
301.99 + ${build.test.classes.dir}
301.100 +source.encoding=UTF-8
301.101 +src.dir=src
301.102 +test.src.dir=test
302.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
302.2 +++ b/sandbox/old-modules/server/web.api/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
302.3 @@ -0,0 +1,44 @@
302.4 +<?xml version="1.0" encoding="UTF-8"?>
302.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
302.6 + <type>org.netbeans.modules.java.j2seproject</type>
302.7 + <configuration>
302.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
302.9 + <name>web.api</name>
302.10 + <source-roots>
302.11 + <root id="src.dir"/>
302.12 + </source-roots>
302.13 + <test-roots>
302.14 + <root id="test.src.dir"/>
302.15 + </test-roots>
302.16 + </data>
302.17 + <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
302.18 + <definitions>../lib/nblibraries.properties</definitions>
302.19 + </libraries>
302.20 + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
302.21 + <reference>
302.22 + <foreign-project>indexer</foreign-project>
302.23 + <artifact-type>jar</artifact-type>
302.24 + <script>build.xml</script>
302.25 + <target>jar</target>
302.26 + <clean-target>clean</clean-target>
302.27 + <id>jar</id>
302.28 + </reference>
302.29 + <reference>
302.30 + <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
302.31 + <artifact-type>jar</artifact-type>
302.32 + <script>build.xml</script>
302.33 + <target>netbeans</target>
302.34 + <clean-target>clean</clean-target>
302.35 + <id>module</id>
302.36 + </reference>
302.37 + <reference>
302.38 + <foreign-project>org_netbeans_modules_jackpot30_remoting_api</foreign-project>
302.39 + <artifact-type>jar</artifact-type>
302.40 + <script>build.xml</script>
302.41 + <target>netbeans</target>
302.42 + <clean-target>clean</clean-target>
302.43 + <id>module</id>
302.44 + </reference>
302.45 + </references>
302.46 + </configuration>
302.47 +</project>
303.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
303.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/API.java Tue Feb 21 22:37:57 2012 +0100
303.3 @@ -0,0 +1,233 @@
303.4 +/*
303.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
303.6 + *
303.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
303.8 + *
303.9 + * The contents of this file are subject to the terms of either the GNU
303.10 + * General Public License Version 2 only ("GPL") or the Common
303.11 + * Development and Distribution License("CDDL") (collectively, the
303.12 + * "License"). You may not use this file except in compliance with the
303.13 + * License. You can obtain a copy of the License at
303.14 + * http://www.netbeans.org/cddl-gplv2.html
303.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
303.16 + * specific language governing permissions and limitations under the
303.17 + * License. When distributing the software, include this License Header
303.18 + * Notice in each file and include the License file at
303.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
303.20 + * particular file as subject to the "Classpath" exception as provided
303.21 + * by Sun in the GPL Version 2 section of the License file that
303.22 + * accompanied this code. If applicable, add the following below the
303.23 + * License Header, with the fields enclosed by brackets [] replaced by
303.24 + * your own identifying information:
303.25 + * "Portions Copyrighted [year] [name of copyright owner]"
303.26 + *
303.27 + * If you wish your version of this file to be governed by only the CDDL
303.28 + * or only the GPL Version 2, indicate your decision by adding
303.29 + * "[Contributor] elects to include this software in this distribution
303.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
303.31 + * single choice of license, a recipient has the option to distribute
303.32 + * your version of this file under either the CDDL, the GPL Version 2 or
303.33 + * to extend the choice of license to its licensees as provided above.
303.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
303.35 + * Version 2 license, then the option applies only if the new code is
303.36 + * made subject to such option by the copyright holder.
303.37 + *
303.38 + * Contributor(s):
303.39 + *
303.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
303.41 + */
303.42 +
303.43 +package org.netbeans.modules.jackpot30.server.webapi;
303.44 +
303.45 +import java.io.IOException;
303.46 +import java.net.URL;
303.47 +import java.util.Arrays;
303.48 +import java.util.Collection;
303.49 +import java.util.HashMap;
303.50 +import java.util.LinkedList;
303.51 +import java.util.List;
303.52 +import java.util.Map;
303.53 +import java.util.Map.Entry;
303.54 +import javax.tools.Diagnostic;
303.55 +import javax.tools.JavaFileObject;
303.56 +import javax.ws.rs.DefaultValue;
303.57 +import javax.ws.rs.GET;
303.58 +import javax.ws.rs.Path;
303.59 +import javax.ws.rs.Produces;
303.60 +import javax.ws.rs.QueryParam;
303.61 +import org.codeviation.pojson.Pojson;
303.62 +import org.netbeans.modules.jackpot30.impl.examples.Example;
303.63 +import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
303.64 +import org.netbeans.modules.jackpot30.impl.examples.LoadExamples;
303.65 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
303.66 +import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
303.67 +import org.netbeans.modules.jackpot30.impl.indexing.Index;
303.68 +import org.netbeans.modules.jackpot30.server.indexer.StandaloneFinder;
303.69 +
303.70 +/**
303.71 + *
303.72 + * @author lahvac
303.73 + */
303.74 +@Path("/")
303.75 +public class API {
303.76 +
303.77 + @GET
303.78 + @Path("/find")
303.79 + @Produces("text/plain")
303.80 + public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern) throws IOException {
303.81 + StringBuilder sb = new StringBuilder();
303.82 +
303.83 + for (String candidate : StandaloneFinder.findCandidates(Cache.sourceRootForKey(segment), pattern)) {
303.84 + sb.append(candidate);
303.85 + sb.append("\n");
303.86 + }
303.87 +
303.88 + return sb.toString();
303.89 + }
303.90 +
303.91 + @GET
303.92 + @Path("/findSpans")
303.93 + @Produces("text/plain")
303.94 + public String findSpans(@QueryParam("path") String segment, @QueryParam("relativePath") String relativePath, @QueryParam("pattern") String pattern) throws IOException {
303.95 + StringBuilder sb = new StringBuilder();
303.96 +
303.97 + for (int o : StandaloneFinder.findCandidateOccurrenceSpans(Cache.sourceRootForKey(segment), relativePath, pattern)) {
303.98 + sb.append(o);
303.99 + sb.append(":");
303.100 + }
303.101 +
303.102 + if (sb.length() > 0) {
303.103 + sb.delete(sb.length() - 1, sb.length());
303.104 + }
303.105 +
303.106 + return sb.toString();
303.107 + }
303.108 +
303.109 + @GET
303.110 + @Path("/list")
303.111 + @Produces("text/plain")
303.112 + public String list() throws IOException {
303.113 + StringBuilder sb = new StringBuilder();
303.114 +
303.115 + for (String root : Cache.knownSourceRoots()) {
303.116 + URL sourceRoot = Cache.sourceRootForKey(root).toURI().toURL();
303.117 + Index index = FileBasedIndex.get(sourceRoot);
303.118 + String displayName;
303.119 +
303.120 + if (index != null && index.getIndexInfo().displayName != null) {
303.121 + displayName = index.getIndexInfo().displayName;
303.122 + } else {
303.123 + String path = sourceRoot.getPath().replaceFirst("/$", "");
303.124 +
303.125 + displayName = path.substring(path.lastIndexOf('/') + 1);
303.126 + }
303.127 +
303.128 + sb.append(root);
303.129 + sb.append(":");
303.130 + sb.append(displayName);
303.131 + sb.append("\n");
303.132 + }
303.133 +
303.134 + return sb.toString();
303.135 + }
303.136 +
303.137 + @GET
303.138 + @Path("/cat")
303.139 + @Produces("text/plain")
303.140 + public String cat(@QueryParam("path") String segment, @QueryParam("relative") String relative) throws IOException {
303.141 + URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
303.142 + Index index = FileBasedIndex.get(sourceRoot);
303.143 +
303.144 + if (index == null) {
303.145 + throw new IOException("No index");
303.146 + }
303.147 +
303.148 + CharSequence source = index.getSourceCode(relative);
303.149 +
303.150 + if (source == null) {
303.151 + throw new IOException("Source code not found");
303.152 + }
303.153 +
303.154 + return source.toString().replaceAll("\r\n", "\n");
303.155 + }
303.156 +
303.157 + @GET
303.158 + @Path("/info")
303.159 + @Produces("text/plain")
303.160 + public String info(@QueryParam("path") String segment) throws IOException {
303.161 + URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
303.162 + Index index = FileBasedIndex.get(sourceRoot);
303.163 +
303.164 + if (index == null) {
303.165 + throw new IOException("No index");
303.166 + }
303.167 +
303.168 + return Pojson.save(index.getIndexInfo());
303.169 + }
303.170 +
303.171 + @GET
303.172 + @Path("/examples")
303.173 + @Produces("text/plain")
303.174 + public String examples() throws IOException {
303.175 + List<Map<String, String>> examples = new LinkedList<Map<String, String>>();
303.176 +
303.177 + for (Example ex : LoadExamples.loadExamples()) {
303.178 + if (ex.getOptions().contains(Option.VERIFY) || ex.getOptions().contains(Option.FIX)) continue;
303.179 + Map<String, String> desc = new HashMap<String, String>();
303.180 +
303.181 + desc.put("displayName", ex.getDisplayName());
303.182 + desc.put("pattern", ex.getCode());
303.183 +
303.184 + examples.add(desc);
303.185 + }
303.186 +
303.187 + return Pojson.save(examples);
303.188 + }
303.189 +
303.190 + @GET
303.191 + @Path("/errors")
303.192 + @Produces("text/plain")
303.193 + public String errors(@QueryParam("pattern") String pattern) throws IOException {
303.194 + StringBuilder sb = new StringBuilder();
303.195 +
303.196 + for (Diagnostic<? extends JavaFileObject> d : StandaloneFinder.parseAndReportErrors(pattern)) {
303.197 + sb.append(d.getMessage(null));
303.198 + sb.append("\n");
303.199 + }
303.200 +
303.201 + return sb.toString();
303.202 + }
303.203 +
303.204 + @GET
303.205 + @Path("/findDuplicates")
303.206 + @Produces("text/plain")
303.207 + public String findDuplicates(@QueryParam("path") String segment, @QueryParam("hashes") String hashes) throws IOException {
303.208 + Map<String, Map<String, Collection<? extends String>>> hash2Segment2Contains = new HashMap<String, Map<String, Collection<? extends String>>>();
303.209 + Collection<String> segments = new LinkedList<String>();
303.210 +
303.211 + if (segment != null) segments.add(segment);
303.212 + else {
303.213 + for (String key : Cache.knownSourceRoots()) {
303.214 + segments.add(key);
303.215 + }
303.216 + }
303.217 +
303.218 + Iterable<? extends String> hashesList = Arrays.asList(Pojson.load(String[].class, hashes));
303.219 +
303.220 + for (String key : segments) {
303.221 + Map<String, Collection<? extends String>> found = StandaloneFinder.containsHash(Cache.sourceRootForKey(key), hashesList);
303.222 +
303.223 + for (Entry<String, Collection<? extends String>> e : found.entrySet()) {
303.224 + Map<String, Collection<? extends String>> perRoot = hash2Segment2Contains.get(e.getKey());
303.225 +
303.226 + if (perRoot == null) {
303.227 + hash2Segment2Contains.put(e.getKey(), perRoot = new HashMap<String, Collection<? extends String>>());
303.228 + }
303.229 +
303.230 + perRoot.put(key, e.getValue());
303.231 + }
303.232 + }
303.233 +
303.234 + return Pojson.save(hash2Segment2Contains);
303.235 + }
303.236 +}
304.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
304.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/Main.java Tue Feb 21 22:37:57 2012 +0100
304.3 @@ -0,0 +1,93 @@
304.4 +/*
304.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
304.6 + *
304.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
304.8 + *
304.9 + * The contents of this file are subject to the terms of either the GNU
304.10 + * General Public License Version 2 only ("GPL") or the Common
304.11 + * Development and Distribution License("CDDL") (collectively, the
304.12 + * "License"). You may not use this file except in compliance with the
304.13 + * License. You can obtain a copy of the License at
304.14 + * http://www.netbeans.org/cddl-gplv2.html
304.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
304.16 + * specific language governing permissions and limitations under the
304.17 + * License. When distributing the software, include this License Header
304.18 + * Notice in each file and include the License file at
304.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
304.20 + * particular file as subject to the "Classpath" exception as provided
304.21 + * by Sun in the GPL Version 2 section of the License file that
304.22 + * accompanied this code. If applicable, add the following below the
304.23 + * License Header, with the fields enclosed by brackets [] replaced by
304.24 + * your own identifying information:
304.25 + * "Portions Copyrighted [year] [name of copyright owner]"
304.26 + *
304.27 + * If you wish your version of this file to be governed by only the CDDL
304.28 + * or only the GPL Version 2, indicate your decision by adding
304.29 + * "[Contributor] elects to include this software in this distribution
304.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
304.31 + * single choice of license, a recipient has the option to distribute
304.32 + * your version of this file under either the CDDL, the GPL Version 2 or
304.33 + * to extend the choice of license to its licensees as provided above.
304.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
304.35 + * Version 2 license, then the option applies only if the new code is
304.36 + * made subject to such option by the copyright holder.
304.37 + *
304.38 + * Contributor(s):
304.39 + *
304.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
304.41 + */
304.42 +
304.43 +package org.netbeans.modules.jackpot30.server.webapi;
304.44 +
304.45 +import com.sun.grizzly.http.embed.GrizzlyWebServer;
304.46 +import com.sun.grizzly.http.servlet.ServletAdapter;
304.47 +import com.sun.grizzly.tcp.http11.GrizzlyAdapter;
304.48 +import com.sun.grizzly.tcp.http11.GrizzlyRequest;
304.49 +import com.sun.grizzly.tcp.http11.GrizzlyResponse;
304.50 +import com.sun.jersey.spi.container.servlet.ServletContainer;
304.51 +import java.io.File;
304.52 +import java.io.IOException;
304.53 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
304.54 +
304.55 +/**
304.56 + *
304.57 + * @author lahvac
304.58 + */
304.59 +public class Main {
304.60 +
304.61 + /**
304.62 + * @param args the command line arguments
304.63 + */
304.64 + public static void main(String[] args) throws IOException {
304.65 + if (args.length != 1 && args.length != 2) {
304.66 + System.err.println("Usage: java -jar " + Main.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " <cache> [<static-content>]");
304.67 + return ;
304.68 + }
304.69 +
304.70 + Cache.setStandaloneCacheRoot(new File(args[0]));
304.71 +
304.72 + GrizzlyWebServer gws;
304.73 +
304.74 + if (args.length == 2) {
304.75 + gws = new GrizzlyWebServer(9998, args[1]);
304.76 + } else {
304.77 + gws = new GrizzlyWebServer(9998);
304.78 + }
304.79 +
304.80 + // Jersey web resources
304.81 + ServletAdapter jerseyAdapter = new ServletAdapter();
304.82 + jerseyAdapter.addInitParameter("com.sun.jersey.config.property.packages", "org.netbeans.modules.jackpot30.server.webapi");
304.83 + jerseyAdapter.setContextPath("/index");
304.84 + jerseyAdapter.setServletInstance(new ServletContainer());
304.85 +
304.86 + // register all above defined adapters
304.87 + gws.addGrizzlyAdapter(jerseyAdapter);
304.88 + gws.addGrizzlyAdapter(new GrizzlyAdapter(){
304.89 + public void service(GrizzlyRequest request, GrizzlyResponse response){}
304.90 + });
304.91 +
304.92 + // let Grizzly run
304.93 + gws.start();
304.94 + }
304.95 +
304.96 +}
305.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
305.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/UI.java Tue Feb 21 22:37:57 2012 +0100
305.3 @@ -0,0 +1,274 @@
305.4 +/*
305.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
305.6 + *
305.7 + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
305.8 + *
305.9 + * The contents of this file are subject to the terms of either the GNU
305.10 + * General Public License Version 2 only ("GPL") or the Common
305.11 + * Development and Distribution License("CDDL") (collectively, the
305.12 + * "License"). You may not use this file except in compliance with the
305.13 + * License. You can obtain a copy of the License at
305.14 + * http://www.netbeans.org/cddl-gplv2.html
305.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
305.16 + * specific language governing permissions and limitations under the
305.17 + * License. When distributing the software, include this License Header
305.18 + * Notice in each file and include the License file at
305.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
305.20 + * particular file as subject to the "Classpath" exception as provided
305.21 + * by Sun in the GPL Version 2 section of the License file that
305.22 + * accompanied this code. If applicable, add the following below the
305.23 + * License Header, with the fields enclosed by brackets [] replaced by
305.24 + * your own identifying information:
305.25 + * "Portions Copyrighted [year] [name of copyright owner]"
305.26 + *
305.27 + * If you wish your version of this file to be governed by only the CDDL
305.28 + * or only the GPL Version 2, indicate your decision by adding
305.29 + * "[Contributor] elects to include this software in this distribution
305.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
305.31 + * single choice of license, a recipient has the option to distribute
305.32 + * your version of this file under either the CDDL, the GPL Version 2 or
305.33 + * to extend the choice of license to its licensees as provided above.
305.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
305.35 + * Version 2 license, then the option applies only if the new code is
305.36 + * made subject to such option by the copyright holder.
305.37 + *
305.38 + * Contributor(s):
305.39 + *
305.40 + * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
305.41 + */
305.42 +
305.43 +package org.netbeans.modules.jackpot30.server.webapi;
305.44 +
305.45 +import freemarker.cache.TemplateLoader;
305.46 +import freemarker.template.Configuration;
305.47 +import freemarker.template.Template;
305.48 +import freemarker.template.TemplateException;
305.49 +import java.io.IOException;
305.50 +import java.io.InputStream;
305.51 +import java.io.InputStreamReader;
305.52 +import java.io.Reader;
305.53 +import java.io.StringWriter;
305.54 +import java.net.URI;
305.55 +import java.net.URISyntaxException;
305.56 +import java.util.ArrayList;
305.57 +import java.util.Collections;
305.58 +import java.util.HashMap;
305.59 +import java.util.LinkedList;
305.60 +import java.util.List;
305.61 +import java.util.Map;
305.62 +import javax.ws.rs.GET;
305.63 +import javax.ws.rs.Path;
305.64 +import javax.ws.rs.Produces;
305.65 +import javax.ws.rs.QueryParam;
305.66 +import org.codeviation.pojson.Pojson;
305.67 +import org.netbeans.modules.jackpot30.remoting.api.WebUtilities;
305.68 +import static org.netbeans.modules.jackpot30.remoting.api.WebUtilities.escapeForQuery;
305.69 +
305.70 +/**
305.71 + *
305.72 + * @author lahvac
305.73 + */
305.74 +@Path("/ui")
305.75 +public class UI {
305.76 +
305.77 + @GET
305.78 + @Path("/search")
305.79 + @Produces("text/html")
305.80 + public String search(@QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
305.81 + Map<String, Object> configurationData = new HashMap<String, Object>();
305.82 +
305.83 + configurationData.put("paths", list());
305.84 + configurationData.put("selectedPath", path);
305.85 + configurationData.put("pattern", pattern);
305.86 + configurationData.put("patternEscaped", escapeForQuery(pattern));
305.87 + configurationData.put("examples", loadExamples());
305.88 +
305.89 + if (pattern != null && path != null) {
305.90 + URI u = new URI("http://localhost:9998/index/find?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
305.91 + List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
305.92 + long queryTime = System.currentTimeMillis();
305.93 + List<String> candidates = new ArrayList<String>(WebUtilities.requestStringArrayResponse(u));
305.94 +
305.95 + queryTime = System.currentTimeMillis() - queryTime;
305.96 +
305.97 + Collections.sort(candidates);
305.98 +
305.99 + for (String c : candidates) {
305.100 + Map<String, Object> found = new HashMap<String, Object>(3);
305.101 +
305.102 + found.put("relativePath", c);
305.103 +
305.104 + results.add(found);
305.105 + }
305.106 +
305.107 + configurationData.put("results", results);
305.108 +
305.109 + Map<String, Object> statistics = new HashMap<String, Object>();
305.110 +
305.111 + statistics.put("files", candidates.size());
305.112 + statistics.put("queryTime", queryTime);
305.113 +
305.114 + configurationData.put("statistics", statistics);
305.115 + }
305.116 +
305.117 + return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-search.html", configurationData);
305.118 + }
305.119 +
305.120 + @GET
305.121 + @Path("/show")
305.122 + @Produces("text/html")
305.123 + public String show(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
305.124 + Map<String, Object> configurationData = new HashMap<String, Object>();
305.125 + List<Map<String, String>> occurrences = new LinkedList<Map<String, String>>();
305.126 +
305.127 + configurationData.put("occurrences", occurrences);
305.128 +
305.129 + URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
305.130 + String code = WebUtilities.requestStringResponse(codeURL);
305.131 + URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
305.132 + int currentCodePos = 0;
305.133 + for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) { //XXX: sorted!
305.134 + Map<String, String> occ = new HashMap<String, String>();
305.135 + occ.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, span[0])));
305.136 + occ.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
305.137 + occurrences.add(occ);
305.138 + currentCodePos = span[1];
305.139 + }
305.140 +
305.141 + configurationData.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, code.length())));
305.142 +
305.143 + return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html", configurationData);
305.144 + }
305.145 +
305.146 + @GET
305.147 + @Path("/snippet")
305.148 + @Produces("text/html")
305.149 + public String snippet(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
305.150 + List<Map<String, String>> snippets = new LinkedList<Map<String, String>>();
305.151 +
305.152 + URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
305.153 + String code = WebUtilities.requestStringResponse(codeURL);
305.154 + URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
305.155 +
305.156 + for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) {
305.157 + snippets.add(prepareSnippet(code, span));
305.158 + }
305.159 +
305.160 + return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html", Collections.<String, Object>singletonMap("snippets", snippets));
305.161 + }
305.162 +
305.163 + private static List<Map<String, String>> list() throws URISyntaxException {
305.164 + List<Map<String, String>> result = new LinkedList<Map<String, String>>();
305.165 +
305.166 + for (String enc : WebUtilities.requestStringArrayResponse(new URI("http://localhost:9998/index/list"))) {
305.167 + Map<String, String> rootDesc = new HashMap<String, String>();
305.168 + String[] col = enc.split(":", 2);
305.169 +
305.170 + rootDesc.put("segment", col[0]);
305.171 + rootDesc.put("displayName", col[1]);
305.172 + result.add(rootDesc);
305.173 + }
305.174 +
305.175 + return result;
305.176 + }
305.177 +
305.178 + private static Iterable<int[]> parseSpans(String from) {
305.179 + if (from.isEmpty()) {
305.180 + return Collections.emptyList();
305.181 + }
305.182 + String[] split = from.split(":");
305.183 + List<int[]> result = new LinkedList<int[]>();
305.184 +
305.185 + for (int i = 0; i < split.length; i += 2) {
305.186 + result.add(new int[] {
305.187 + Integer.parseInt(split[i + 0].trim()),
305.188 + Integer.parseInt(split[i + 1].trim())
305.189 + });
305.190 + }
305.191 +
305.192 + return result;
305.193 + }
305.194 +
305.195 + private static final int DESIRED_CONTEXT = 2;
305.196 +
305.197 + private static Map<String, String> prepareSnippet(String code, int[] span) {
305.198 + int grandStart = span[0];
305.199 + int firstLineStart = grandStart = lineStart(code, grandStart);
305.200 +
305.201 + while (grandStart > 0 && contextLength(code.substring(grandStart, firstLineStart)) < DESIRED_CONTEXT)
305.202 + grandStart = lineStart(code, grandStart - 1);
305.203 +
305.204 + int grandEnd = span[1];
305.205 + int firstLineEnd = grandEnd = lineEnd(code, grandEnd);
305.206 +
305.207 + while (grandEnd < code.length() - 1 && contextLength(code.substring(firstLineEnd, grandEnd)) < DESIRED_CONTEXT)
305.208 + grandEnd = lineEnd(code, grandEnd + 1);
305.209 +
305.210 + Map<String, String> result = new HashMap<String, String>();
305.211 +
305.212 + result.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(grandStart, span[0])));
305.213 + result.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
305.214 + result.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(span[1], grandEnd)));
305.215 +
305.216 + return result;
305.217 + }
305.218 +
305.219 + private static int lineStart(String code, int o) {
305.220 + while (o > 0 && code.charAt(o) != '\n') {
305.221 + o--;
305.222 + }
305.223 +
305.224 + return o;
305.225 + }
305.226 +
305.227 + private static int lineEnd(String code, int o) {
305.228 + while (o < code.length() - 1 && code.charAt(o) != '\n') {
305.229 + o++;
305.230 + }
305.231 +
305.232 + return o;
305.233 + }
305.234 +
305.235 + private static int contextLength(String in) {
305.236 + return in.replaceAll("\n[ \t]*\n", "\n").trim().split("\n").length;
305.237 + }
305.238 +
305.239 + @SuppressWarnings("unchecked")
305.240 + private List<Map<String, String>> loadExamples() throws IOException, URISyntaxException {
305.241 + return Pojson.load(LinkedList.class, new URI("http://localhost:9998/index/examples"));
305.242 + }
305.243 +
305.244 + private static String processTemplate(String template, Map<String, Object> configurationData) throws TemplateException, IOException {
305.245 + Configuration conf = new Configuration();
305.246 +
305.247 + conf.setTemplateLoader(new TemplateLoaderImpl());
305.248 +
305.249 + Template templ = conf.getTemplate(template);
305.250 + StringWriter out = new StringWriter();
305.251 +
305.252 + templ.process(configurationData, out);
305.253 +
305.254 + return out.toString();
305.255 + }
305.256 +
305.257 + private static final class TemplateLoaderImpl implements TemplateLoader {
305.258 +
305.259 + public Object findTemplateSource(String name) throws IOException {
305.260 + return TemplateLoaderImpl.class.getResourceAsStream("/" + name);
305.261 + }
305.262 +
305.263 + public long getLastModified(Object templateSource) {
305.264 + return 0L;
305.265 + }
305.266 +
305.267 + public Reader getReader(Object templateSource, String encoding) throws IOException {
305.268 + InputStream in = (InputStream) templateSource;
305.269 +
305.270 + return new InputStreamReader(in);
305.271 + }
305.272 +
305.273 + public void closeTemplateSource(Object templateSource) throws IOException {
305.274 + }
305.275 + }
305.276 +
305.277 +}
306.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
306.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html Tue Feb 21 22:37:57 2012 +0100
306.3 @@ -0,0 +1,10 @@
306.4 +<html>
306.5 +<head>
306.6 + <style type="text/css">
306.7 + .occurrence {BACKGROUND: #DDDD00;}
306.8 + </style>
306.9 +</head>
306.10 +<body>
306.11 +<pre><#list occurrences as occurrence>${occurrence.prefix}<span class="occurrence">${occurrence.occurrence}</span></#list>${suffix}</pre>
306.12 +</body>
306.13 +</html>
307.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
307.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-search.html Tue Feb 21 22:37:57 2012 +0100
307.3 @@ -0,0 +1,70 @@
307.4 +<html>
307.5 +<head>
307.6 + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
307.7 +<#if results??>
307.8 + <script type="text/javascript">
307.9 + $(document).ready(function() {
307.10 + $('#list').find('dd').hide().end().find('dt').click(function() {
307.11 + current_dd=$(this).next();
307.12 + //XXX: will do the AJAX call for both show and hide!
307.13 + $.get("snippet?path=${selectedPath}&relative=" + current_dd.attr("id") + "&pattern=${patternEscaped}",function(data) {
307.14 + current_dd.html(data).slideToggle();
307.15 + })
307.16 + });
307.17 + });
307.18 + </script>
307.19 +</#if>
307.20 + <style type="text/css">
307.21 + .occurrence {BACKGROUND: #DDDD00;}
307.22 + </style>
307.23 +</head>
307.24 +<body>
307.25 +<form method="get">
307.26 +
307.27 +<label for="path">Project:</label>
307.28 +<select size="1" name="path">");
307.29 + <#list paths as path>
307.30 + <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
307.31 + ${path.displayName}
307.32 + </option>
307.33 + </#list>
307.34 +</select>
307.35 +<br>
307.36 +<label for="pattern">Pattern:</label><br>
307.37 +<textarea rows="10" cols="40" name="pattern">
307.38 +<#if pattern??>
307.39 +${pattern}
307.40 +</#if>
307.41 +</textarea><br>
307.42 +<input type="submit" name="Find Candidates"/>
307.43 +</form>
307.44 +
307.45 +<div class="examples">
307.46 +<#if examples??>
307.47 + Examples:
307.48 + <dl id="examples-list">
307.49 + <#list examples as example>
307.50 + <dt>${example.displayName}</dt>
307.51 + <dd><pre>${example.pattern}</pre>
307.52 + </dd>
307.53 + </#list>
307.54 + </dl>
307.55 +</#if>
307.56 +</div>
307.57 +
307.58 +<#if results??>
307.59 + Found candidates for pattern: ${pattern}
307.60 + <dl id="list">
307.61 + <#list results as result>
307.62 + <dt>${result.relativePath}<a href="/index/ui/show?path=${selectedPath}&relative=${result.relativePath}&pattern=${patternEscaped}">show</a></dt>
307.63 + <dd id="${result.relativePath}">
307.64 + </dd>
307.65 + </#list>
307.66 + </dl>
307.67 +</#if>
307.68 +
307.69 +<#if statistics??>
307.70 + Query time: ${statistics.queryTime}ms, matching files: ${statistics.files}.
307.71 +</#if>
307.72 +</body>
307.73 +</html>
308.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
308.2 +++ b/sandbox/old-modules/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html Tue Feb 21 22:37:57 2012 +0100
308.3 @@ -0,0 +1,7 @@
308.4 +<#if snippets??>
308.5 + <#list snippets as snippet>
308.6 + <pre>${snippet.prefix}<span class="occurrence">${snippet.occurrence}</span>${snippet.suffix}</pre><br>
308.7 + </#list>
308.8 +<#else>
308.9 + No occurrences.
308.10 +</#if>
309.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
309.2 +++ b/sandbox/old-modules/server/web.api/test/org/netbeans/modules/jackpot30/server/webapi/APITest.java Tue Feb 21 22:37:57 2012 +0100
309.3 @@ -0,0 +1,107 @@
309.4 +/*
309.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
309.6 + *
309.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
309.8 + *
309.9 + * The contents of this file are subject to the terms of either the GNU
309.10 + * General Public License Version 2 only ("GPL") or the Common
309.11 + * Development and Distribution License("CDDL") (collectively, the
309.12 + * "License"). You may not use this file except in compliance with the
309.13 + * License. You can obtain a copy of the License at
309.14 + * http://www.netbeans.org/cddl-gplv2.html
309.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
309.16 + * specific language governing permissions and limitations under the
309.17 + * License. When distributing the software, include this License Header
309.18 + * Notice in each file and include the License file at
309.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
309.20 + * particular file as subject to the "Classpath" exception as provided
309.21 + * by Sun in the GPL Version 2 section of the License file that
309.22 + * accompanied this code. If applicable, add the following below the
309.23 + * License Header, with the fields enclosed by brackets [] replaced by
309.24 + * your own identifying information:
309.25 + * "Portions Copyrighted [year] [name of copyright owner]"
309.26 + *
309.27 + * If you wish your version of this file to be governed by only the CDDL
309.28 + * or only the GPL Version 2, indicate your decision by adding
309.29 + * "[Contributor] elects to include this software in this distribution
309.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
309.31 + * single choice of license, a recipient has the option to distribute
309.32 + * your version of this file under either the CDDL, the GPL Version 2 or
309.33 + * to extend the choice of license to its licensees as provided above.
309.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
309.35 + * Version 2 license, then the option applies only if the new code is
309.36 + * made subject to such option by the copyright holder.
309.37 + *
309.38 + * Contributor(s):
309.39 + *
309.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
309.41 + */
309.42 +
309.43 +package org.netbeans.modules.jackpot30.server.webapi;
309.44 +
309.45 +import java.io.ByteArrayInputStream;
309.46 +import java.io.File;
309.47 +import java.io.FileOutputStream;
309.48 +import java.io.InputStream;
309.49 +import org.junit.Assert;
309.50 +import org.junit.Before;
309.51 +import org.junit.Test;
309.52 +import org.netbeans.modules.jackpot30.impl.indexing.Cache;
309.53 +import org.netbeans.modules.jackpot30.server.indexer.StandaloneIndexer;
309.54 +
309.55 +/**
309.56 + *
309.57 + * @author lahvac
309.58 + */
309.59 +public class APITest {
309.60 +
309.61 + public APITest() {
309.62 + }
309.63 +
309.64 + private File src;
309.65 +
309.66 + @Before
309.67 + public void setUp() throws Exception {
309.68 + File source = new File(APITest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
309.69 + File workingDirectory = new File(source.getParentFile(), "wd");
309.70 + File cache = new File(workingDirectory, "cache");
309.71 +
309.72 + src = new File(workingDirectory, "src");
309.73 +
309.74 + Cache.setStandaloneCacheRoot(cache);
309.75 +
309.76 + copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
309.77 +
309.78 + StandaloneIndexer.index(src, false, false, null, null);
309.79 + }
309.80 +
309.81 + public final static void copyStringToFile (File f, String content) throws Exception {
309.82 + f.getParentFile().mkdirs();
309.83 +
309.84 + FileOutputStream os = new FileOutputStream(f);
309.85 + InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
309.86 + int read;
309.87 + while ((read = is.read()) != (-1)) {
309.88 + os.write(read);
309.89 + }
309.90 + os.close ();
309.91 + is.close();
309.92 + }
309.93 +
309.94 + @Test
309.95 + public void testFind() throws Exception {
309.96 + String cacheKey = null;
309.97 +
309.98 + for (String key : Cache.knownSourceRoots()) {
309.99 + if (src.getAbsolutePath().equals(Cache.sourceRootForKey(key).getAbsolutePath())) {
309.100 + cacheKey = key;
309.101 + break;
309.102 + }
309.103 + }
309.104 +
309.105 + Assert.assertNotNull(cacheKey);
309.106 +
309.107 + Assert.assertEquals("test/Test1.java\n", new API().find(cacheKey, "$1.isDirectory()"));
309.108 + }
309.109 +
309.110 +}
309.111 \ No newline at end of file
310.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
310.2 +++ b/sandbox/old-modules/transformer/build.xml Tue Feb 21 22:37:57 2012 +0100
310.3 @@ -0,0 +1,9 @@
310.4 +<?xml version="1.0" encoding="UTF-8"?>
310.5 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
310.6 +<!-- for some information on what you could do (e.g. targets to override). -->
310.7 +<!-- If you delete this file and reopen the project it will be recreated. -->
310.8 +<project name="org.netbeans.modules.jackpot30.transformers" default="netbeans" basedir=".">
310.9 + <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.transformers.</description>
310.10 + <import file="nbproject/build-impl.xml"/>
310.11 + <import file="${suite.dir}/findbugs-import.xml"/>
310.12 +</project>
311.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
311.2 +++ b/sandbox/old-modules/transformer/manifest.mf Tue Feb 21 22:37:57 2012 +0100
311.3 @@ -0,0 +1,7 @@
311.4 +Manifest-Version: 1.0
311.5 +AutoUpdate-Show-In-Client: false
311.6 +OpenIDE-Module: org.netbeans.modules.jackpot30.transformers
311.7 +OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/transformers/resources/layer.xml
311.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties
311.9 +OpenIDE-Module-Specification-Version: 1.16
311.10 +
312.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
312.2 +++ b/sandbox/old-modules/transformer/nbproject/build-impl.xml Tue Feb 21 22:37:57 2012 +0100
312.3 @@ -0,0 +1,45 @@
312.4 +<?xml version="1.0" encoding="UTF-8"?>
312.5 +<!--
312.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
312.7 +*** EDIT ../build.xml INSTEAD ***
312.8 +-->
312.9 +<project name="org.netbeans.modules.jackpot30.transformers-impl" basedir="..">
312.10 + <fail message="Please build using Ant 1.7.1 or higher.">
312.11 + <condition>
312.12 + <not>
312.13 + <antversion atleast="1.7.1"/>
312.14 + </not>
312.15 + </condition>
312.16 + </fail>
312.17 + <property file="nbproject/private/suite-private.properties"/>
312.18 + <property file="nbproject/suite.properties"/>
312.19 + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
312.20 + <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
312.21 + <property file="${suite.dir}/nbproject/platform.properties"/>
312.22 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
312.23 + <attribute name="name"/>
312.24 + <attribute name="value"/>
312.25 + <sequential>
312.26 + <property name="@{name}" value="${@{value}}"/>
312.27 + </sequential>
312.28 + </macrodef>
312.29 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
312.30 + <attribute name="property"/>
312.31 + <attribute name="value"/>
312.32 + <sequential>
312.33 + <property name="@{property}" value="@{value}"/>
312.34 + </sequential>
312.35 + </macrodef>
312.36 + <property file="${user.properties.file}"/>
312.37 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
312.38 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
312.39 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
312.40 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
312.41 + <condition>
312.42 + <not>
312.43 + <contains string="${cluster.path.evaluated}" substring="platform"/>
312.44 + </not>
312.45 + </condition>
312.46 + </fail>
312.47 + <import file="${harness.dir}/build.xml"/>
312.48 +</project>
313.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
313.2 +++ b/sandbox/old-modules/transformer/nbproject/genfiles.properties Tue Feb 21 22:37:57 2012 +0100
313.3 @@ -0,0 +1,8 @@
313.4 +build.xml.data.CRC32=ec1a83f8
313.5 +build.xml.script.CRC32=14b2fe09
313.6 +build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
313.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
313.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
313.9 +nbproject/build-impl.xml.data.CRC32=9e6fb388
313.10 +nbproject/build-impl.xml.script.CRC32=07a96417
313.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.47
314.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
314.2 +++ b/sandbox/old-modules/transformer/nbproject/project.properties Tue Feb 21 22:37:57 2012 +0100
314.3 @@ -0,0 +1,2 @@
314.4 +javac.source=1.5
314.5 +javac.compilerargs=-Xlint -Xlint:-serial
315.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
315.2 +++ b/sandbox/old-modules/transformer/nbproject/project.xml Tue Feb 21 22:37:57 2012 +0100
315.3 @@ -0,0 +1,157 @@
315.4 +<?xml version="1.0" encoding="UTF-8"?>
315.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
315.6 + <type>org.netbeans.modules.apisupport.project</type>
315.7 + <configuration>
315.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
315.9 + <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
315.10 + <suite-component/>
315.11 + <module-dependencies>
315.12 + <dependency>
315.13 + <code-name-base>org.netbeans.api.java.classpath</code-name-base>
315.14 + <build-prerequisite/>
315.15 + <compile-dependency/>
315.16 + <run-dependency>
315.17 + <release-version>1</release-version>
315.18 + <specification-version>1.19</specification-version>
315.19 + </run-dependency>
315.20 + </dependency>
315.21 + <dependency>
315.22 + <code-name-base>org.netbeans.libs.javacapi</code-name-base>
315.23 + <build-prerequisite/>
315.24 + <compile-dependency/>
315.25 + <run-dependency>
315.26 + <specification-version>0.8.0.1</specification-version>
315.27 + </run-dependency>
315.28 + </dependency>
315.29 + <dependency>
315.30 + <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
315.31 + <build-prerequisite/>
315.32 + <compile-dependency/>
315.33 + <run-dependency>
315.34 + <specification-version>1.0</specification-version>
315.35 + </run-dependency>
315.36 + </dependency>
315.37 + <dependency>
315.38 + <code-name-base>org.netbeans.modules.java.hints</code-name-base>
315.39 + <build-prerequisite/>
315.40 + <compile-dependency/>
315.41 + <run-dependency>
315.42 + <release-version>1</release-version>
315.43 + <implementation-version/>
315.44 + </run-dependency>
315.45 + </dependency>
315.46 + <dependency>
315.47 + <code-name-base>org.netbeans.modules.java.source</code-name-base>
315.48 + <build-prerequisite/>
315.49 + <compile-dependency/>
315.50 + <run-dependency>
315.51 + <specification-version>0.43.0.7.7.1</specification-version>
315.52 + </run-dependency>
315.53 + </dependency>
315.54 + <dependency>
315.55 + <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
315.56 + <build-prerequisite/>
315.57 + <compile-dependency/>
315.58 + <run-dependency>
315.59 + <release-version>0-1</release-version>
315.60 + <specification-version>1.7.0.7.2</specification-version>
315.61 + </run-dependency>
315.62 + </dependency>
315.63 + <dependency>
315.64 + <code-name-base>org.openide.filesystems</code-name-base>
315.65 + <build-prerequisite/>
315.66 + <compile-dependency/>
315.67 + <run-dependency>
315.68 + <specification-version>7.21.0.1.1</specification-version>
315.69 + </run-dependency>
315.70 + </dependency>
315.71 + <dependency>
315.72 + <code-name-base>org.openide.modules</code-name-base>
315.73 + <build-prerequisite/>
315.74 + <compile-dependency/>
315.75 + <run-dependency>
315.76 + <specification-version>7.10</specification-version>
315.77 + </run-dependency>
315.78 + </dependency>
315.79 + <dependency>
315.80 + <code-name-base>org.openide.util</code-name-base>
315.81 + <build-prerequisite/>
315.82 + <compile-dependency/>
315.83 + <run-dependency>
315.84 + <specification-version>7.22.0.1</specification-version>
315.85 + </run-dependency>
315.86 + </dependency>
315.87 + <dependency>
315.88 + <code-name-base>org.openide.util.lookup</code-name-base>
315.89 + <build-prerequisite/>
315.90 + <compile-dependency/>
315.91 + <run-dependency>
315.92 + <specification-version>8.0.0.1</specification-version>
315.93 + </run-dependency>
315.94 + </dependency>
315.95 + </module-dependencies>
315.96 + <test-dependencies>
315.97 + <test-type>
315.98 + <name>unit</name>
315.99 + <test-dependency>
315.100 + <code-name-base>org.netbeans.bootstrap</code-name-base>
315.101 + </test-dependency>
315.102 + <test-dependency>
315.103 + <code-name-base>org.netbeans.core.startup</code-name-base>
315.104 + </test-dependency>
315.105 + <test-dependency>
315.106 + <code-name-base>org.netbeans.libs.junit4</code-name-base>
315.107 + <compile-dependency/>
315.108 + </test-dependency>
315.109 + <test-dependency>
315.110 + <code-name-base>org.netbeans.modules.classfile</code-name-base>
315.111 + </test-dependency>
315.112 + <test-dependency>
315.113 + <code-name-base>org.netbeans.modules.defaults</code-name-base>
315.114 + </test-dependency>
315.115 + <test-dependency>
315.116 + <code-name-base>org.netbeans.modules.editor</code-name-base>
315.117 + </test-dependency>
315.118 + <test-dependency>
315.119 + <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
315.120 + </test-dependency>
315.121 + <test-dependency>
315.122 + <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
315.123 + </test-dependency>
315.124 + <test-dependency>
315.125 + <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
315.126 + </test-dependency>
315.127 + <test-dependency>
315.128 + <code-name-base>org.netbeans.modules.editor.util</code-name-base>
315.129 + </test-dependency>
315.130 + <test-dependency>
315.131 + <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
315.132 + <recursive/>
315.133 + <compile-dependency/>
315.134 + </test-dependency>
315.135 + <test-dependency>
315.136 + <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
315.137 + </test-dependency>
315.138 + <test-dependency>
315.139 + <code-name-base>org.netbeans.modules.masterfs</code-name-base>
315.140 + </test-dependency>
315.141 + <test-dependency>
315.142 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
315.143 + <recursive/>
315.144 + <compile-dependency/>
315.145 + </test-dependency>
315.146 + <test-dependency>
315.147 + <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
315.148 + </test-dependency>
315.149 + <test-dependency>
315.150 + <code-name-base>org.netbeans.modules.projectui</code-name-base>
315.151 + </test-dependency>
315.152 + <test-dependency>
315.153 + <code-name-base>org.openidex.util</code-name-base>
315.154 + </test-dependency>
315.155 + </test-type>
315.156 + </test-dependencies>
315.157 + <public-packages/>
315.158 + </data>
315.159 + </configuration>
315.160 +</project>
316.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
316.2 +++ b/sandbox/old-modules/transformer/nbproject/suite.properties Tue Feb 21 22:37:57 2012 +0100
316.3 @@ -0,0 +1,1 @@
316.4 +suite.dir=${basedir}/..
317.1 Binary file sandbox/old-modules/transformer/release/libs/annotations.jar has changed
318.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
318.2 +++ b/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Annotations.java Tue Feb 21 22:37:57 2012 +0100
318.3 @@ -0,0 +1,70 @@
318.4 +/*
318.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
318.6 + *
318.7 + * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
318.8 + *
318.9 + * The contents of this file are subject to the terms of either the GNU
318.10 + * General Public License Version 2 only ("GPL") or the Common
318.11 + * Development and Distribution License("CDDL") (collectively, the
318.12 + * "License"). You may not use this file except in compliance with the
318.13 + * License. You can obtain a copy of the License at
318.14 + * http://www.netbeans.org/cddl-gplv2.html
318.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
318.16 + * specific language governing permissions and limitations under the
318.17 + * License. When distributing the software, include this License Header
318.18 + * Notice in each file and include the License file at
318.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
318.20 + * particular file as subject to the "Classpath" exception as provided
318.21 + * by Sun in the GPL Version 2 section of the License file that
318.22 + * accompanied this code. If applicable, add the following below the
318.23 + * License Header, with the fields enclosed by brackets [] replaced by
318.24 + * your own identifying information:
318.25 + * "Portions Copyrighted [year] [name of copyright owner]"
318.26 + *
318.27 + * If you wish your version of this file to be governed by only the CDDL
318.28 + * or only the GPL Version 2, indicate your decision by adding
318.29 + * "[Contributor] elects to include this software in this distribution
318.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
318.31 + * single choice of license, a recipient has the option to distribute
318.32 + * your version of this file under either the CDDL, the GPL Version 2 or
318.33 + * to extend the choice of license to its licensees as provided above.
318.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
318.35 + * Version 2 license, then the option applies only if the new code is
318.36 + * made subject to such option by the copyright holder.
318.37 + *
318.38 + * Contributor(s):
318.39 + *
318.40 + * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
318.41 + */
318.42 +
318.43 +package org.netbeans.modules.jackpot30.transformers;
318.44 +
318.45 +/**
318.46 + *
318.47 + * @author Jan Lahoda
318.48 + */
318.49 +public enum Annotations {
318.50 +
318.51 + TRANSFORMATION_SET("TransformationSet"),
318.52 + TRANSFORMATION,
318.53 + FIX,
318.54 + PATTERN,
318.55 + CONSTRAINT;
318.56 +
318.57 + private static final String PACKAGE_NAME = "net.java.lang.annotations.";
318.58 +
318.59 + private final String specialName;
318.60 +
318.61 + private Annotations() {
318.62 + this(null);
318.63 + }
318.64 +
318.65 + private Annotations(String specialName) {
318.66 + this.specialName = specialName;
318.67 + }
318.68 +
318.69 + public String toFQN() {
318.70 + return PACKAGE_NAME + (specialName != null ? specialName : name().charAt(0) + name().substring(1).toLowerCase());
318.71 + }
318.72 +
318.73 +}
319.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
319.2 +++ b/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImpl.java Tue Feb 21 22:37:57 2012 +0100
319.3 @@ -0,0 +1,508 @@
319.4 +/*
319.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
319.6 + *
319.7 + * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
319.8 + *
319.9 + * The contents of this file are subject to the terms of either the GNU
319.10 + * General Public License Version 2 only ("GPL") or the Common
319.11 + * Development and Distribution License("CDDL") (collectively, the
319.12 + * "License"). You may not use this file except in compliance with the
319.13 + * License. You can obtain a copy of the License at
319.14 + * http://www.netbeans.org/cddl-gplv2.html
319.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
319.16 + * specific language governing permissions and limitations under the
319.17 + * License. When distributing the software, include this License Header
319.18 + * Notice in each file and include the License file at
319.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
319.20 + * particular file as subject to the "Classpath" exception as provided
319.21 + * by Sun in the GPL Version 2 section of the License file that
319.22 + * accompanied this code. If applicable, add the following below the
319.23 + * License Header, with the fields enclosed by brackets [] replaced bysanno
319.24 + * your own identifying information:
319.25 + * "Portions Copyrighted [year] [name of copyright owner]"
319.26 + *
319.27 + * If you wish your version of this file to be governed by only the CDDL
319.28 + * or only the GPL Version 2, indicate your decision by adding
319.29 + * "[Contributor] elects to include this software in this distribution
319.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
319.31 + * single choice of license, a recipient has the option to distribute
319.32 + * your version of this file under either the CDDL, the GPL Version 2 or
319.33 + * to extend the choice of license to its licensees as provided above.
319.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
319.35 + * Version 2 license, then the option applies only if the new code is
319.36 + * made subject to such option by the copyright holder.
319.37 + *
319.38 + * Contributor(s):
319.39 + *
319.40 + * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
319.41 + */
319.42 +
319.43 +package org.netbeans.modules.jackpot30.transformers;
319.44 +
319.45 +import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
319.46 +import org.netbeans.modules.java.hints.spi.AbstractHint.HintSeverity;
319.47 +import org.netbeans.modules.java.hints.jackpot.spi.support.ErrorDescriptionFactory;
319.48 +import org.netbeans.modules.java.hints.jackpot.spi.ElementBasedHintProvider;
319.49 +import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
319.50 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
319.51 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.Worker;
319.52 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescriptionFactory;
319.53 +import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
319.54 +import org.netbeans.modules.java.hints.jackpot.spi.JavaFix;
319.55 +import com.sun.source.tree.Tree;
319.56 +import com.sun.source.util.SourcePositions;
319.57 +import com.sun.source.util.TreePath;
319.58 +import java.io.File;
319.59 +import java.io.IOException;
319.60 +import java.net.URL;
319.61 +import java.util.Collection;
319.62 +import java.util.Collections;
319.63 +import java.util.EnumSet;
319.64 +import java.util.HashMap;
319.65 +import java.util.HashSet;
319.66 +import java.util.LinkedList;
319.67 +import java.util.List;
319.68 +import java.util.Map;
319.69 +import java.util.Map.Entry;
319.70 +import java.util.Set;
319.71 +import java.util.concurrent.atomic.AtomicBoolean;
319.72 +import java.util.regex.Matcher;
319.73 +import javax.lang.model.element.AnnotationMirror;
319.74 +import javax.lang.model.element.AnnotationValue;
319.75 +import javax.lang.model.element.Element;
319.76 +import javax.lang.model.element.ElementKind;
319.77 +import javax.lang.model.element.ExecutableElement;
319.78 +import javax.lang.model.element.Modifier;
319.79 +import javax.lang.model.element.PackageElement;
319.80 +import javax.lang.model.element.TypeElement;
319.81 +import javax.lang.model.type.DeclaredType;
319.82 +import javax.lang.model.type.TypeMirror;
319.83 +import javax.lang.model.util.ElementFilter;
319.84 +import org.netbeans.api.java.classpath.ClassPath;
319.85 +import org.netbeans.api.java.source.ClasspathInfo;
319.86 +import org.netbeans.api.java.source.ClasspathInfo.PathKind;
319.87 +import org.netbeans.api.java.source.CompilationController;
319.88 +import org.netbeans.api.java.source.CompilationInfo;
319.89 +import org.netbeans.api.java.source.ElementHandle;
319.90 +import org.netbeans.api.java.source.JavaSource;
319.91 +import org.netbeans.api.java.source.Task;
319.92 +import org.netbeans.api.java.source.TypeMirrorHandle;
319.93 +import org.netbeans.api.java.source.support.CancellableTreePathScanner;
319.94 +import org.netbeans.spi.editor.hints.ErrorDescription;
319.95 +import org.netbeans.spi.editor.hints.Fix;
319.96 +import org.netbeans.spi.java.classpath.support.ClassPathSupport;
319.97 +import org.openide.filesystems.FileUtil;
319.98 +import org.openide.modules.InstalledFileLocator;
319.99 +import org.openide.util.Exceptions;
319.100 +
319.101 +import org.openide.util.lookup.ServiceProvider;
319.102 +import static org.netbeans.modules.jackpot30.transformers.Annotations.*;
319.103 +
319.104 +/**
319.105 + *
319.106 + * @author Jan Lahoda
319.107 + */
319.108 +@ServiceProvider(service=ElementBasedHintProvider.class)
319.109 +public class TransformationHintProviderImpl implements ElementBasedHintProvider {
319.110 +
319.111 + private JavaSource prepareJavaSource(CompilationInfo info) {
319.112 + ClasspathInfo currentCP = info.getClasspathInfo();
319.113 + ClassPath overlayCompileCP = prepareOverlayCompileCP();
319.114 + ClassPath extendedCompileCP = ClassPathSupport.createProxyClassPath(overlayCompileCP, currentCP.getClassPath(PathKind.COMPILE));
319.115 + ClassPath overlayBootCP = prepareOverlayBootCP();
319.116 + ClassPath extendedBootCP = ClassPathSupport.createProxyClassPath(overlayBootCP, currentCP.getClassPath(PathKind.BOOT));
319.117 + ClasspathInfo extendedCPInfo = ClasspathInfo.create(extendedBootCP, extendedCompileCP, currentCP.getClassPath(PathKind.SOURCE));
319.118 +
319.119 + return JavaSource.create(extendedCPInfo);
319.120 + }
319.121 +
319.122 + public Collection<? extends HintDescription> computeHints(final CompilationInfo info) {
319.123 + final List<HintDescription> hints = new LinkedList<HintDescription>();
319.124 +
319.125 + if (ANNOTATIONS_JAR != null && (JDK_OVERLAY_JAR != null || NB_OVERLAY_JAR != null)) {
319.126 + try {
319.127 + prepareJavaSource(info).runUserActionTask(new Task<CompilationController>() {
319.128 + public void run(final CompilationController overlayInfo) throws Exception {
319.129 + List<HintDescription> w = doComputeHints(info, overlayInfo);
319.130 +
319.131 + if (w != null) {
319.132 + hints.addAll(w);
319.133 + }
319.134 + }
319.135 + }, true);
319.136 + } catch (IOException ex) {
319.137 + Exceptions.printStackTrace(ex);
319.138 + }
319.139 + } else {
319.140 + List<HintDescription> w = doComputeHints(info, null);
319.141 +
319.142 + if (w != null) {
319.143 + hints.addAll(w);
319.144 + }
319.145 + }
319.146 +
319.147 + return hints;
319.148 + }
319.149 +
319.150 + private static final Set<ElementKind> KINDS_FOR_ELEMENT_HANDLE = EnumSet.of(
319.151 + ElementKind.PACKAGE, ElementKind.CLASS, ElementKind.INTERFACE, ElementKind.ENUM,
319.152 + ElementKind.ANNOTATION_TYPE, ElementKind.METHOD, ElementKind.CONSTRUCTOR,
319.153 + ElementKind.INSTANCE_INIT, ElementKind.STATIC_INIT, ElementKind.FIELD,
319.154 + ElementKind.ENUM_CONSTANT);
319.155 +
319.156 + private List<HintDescription> doComputeHints(CompilationInfo info,
319.157 + CompilationInfo overlayInfo) {
319.158 +
319.159 + FindAnnotation ann = new FindAnnotation(info, overlayInfo, /*XXX*/new AtomicBoolean());
319.160 +
319.161 + ann.scan(info.getCompilationUnit(), null);
319.162 +
319.163 + return ann.hints;
319.164 + }
319.165 +
319.166 + private final class FindAnnotation extends CancellableTreePathScanner<Void, Void> {
319.167 +
319.168 + private final CompilationInfo info;
319.169 + private final CompilationInfo overlayInfo;
319.170 + private final List<HintDescription> hints = new LinkedList<HintDescription>();
319.171 +
319.172 + public FindAnnotation(CompilationInfo info, CompilationInfo overlayInfo, AtomicBoolean cancel) {
319.173 + super(cancel);
319.174 + this.info = info;
319.175 + this.overlayInfo = overlayInfo;
319.176 + }
319.177 +
319.178 + private final Set<Element> handledElements = new HashSet<Element>();
319.179 +
319.180 + private void handleElementImpl(Element el) {
319.181 + if (!handledElements.add(el)) return ;
319.182 +
319.183 + List<HintDescription> currentHints = processAnnotations(el, el.getEnclosingElement(), info, info);
319.184 +
319.185 + if (overlayInfo != null && currentHints.isEmpty() && KINDS_FOR_ELEMENT_HANDLE.contains(el.getKind())) {
319.186 + Element overlay = ElementHandle.create(el).resolve(overlayInfo);
319.187 +
319.188 + if (overlay != null) {
319.189 + currentHints = processAnnotations(overlay, overlay.getEnclosingElement(), info, overlayInfo);
319.190 + }
319.191 + }
319.192 +
319.193 + this.hints.addAll(currentHints);
319.194 + }
319.195 +
319.196 + private void handleElement(Element el) {
319.197 + PackageElement p = info.getElements().getPackageOf(el);
319.198 +
319.199 + while (p != el) {
319.200 + handleElementImpl(el);
319.201 + el = el.getEnclosingElement();
319.202 + }
319.203 +
319.204 + handleElementImpl(p);
319.205 + }
319.206 +
319.207 + @Override
319.208 + public Void scan(Tree tree, Void p) {
319.209 + if (tree == null) return null;
319.210 +
319.211 + TreePath tp = new TreePath(getCurrentPath(), tree);
319.212 + Element el = info.getTrees().getElement(tp);
319.213 +
319.214 + if (el != null) {
319.215 + handleElement(el);
319.216 + }
319.217 +
319.218 + return super.scan(tree, p);
319.219 + }
319.220 + }
319.221 +
319.222 + private static final class WorkerImpl implements Worker {
319.223 +
319.224 + private final String displayName;
319.225 + private final List<FixDescription> fixDescriptions;
319.226 +
319.227 + public WorkerImpl(String displayName, List<FixDescription> fixDescriptions) {
319.228 + this.displayName = displayName;
319.229 + this.fixDescriptions = fixDescriptions;
319.230 + }
319.231 +
319.232 + public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
319.233 + //XXX: antipatterns not supported by the current infrastructure
319.234 +// TreePath tp = treePath;
319.235 +//
319.236 +// while (tp != null) {
319.237 +// if (!pd.getPattern().checkAntipatterns(tp)) {
319.238 +// return null;
319.239 +// }
319.240 +//
319.241 +// tp = tp.getParentPath();
319.242 +// }
319.243 +
319.244 + List<Fix> fixes = new LinkedList<Fix>();
319.245 +
319.246 + for (FixDescription d : fixDescriptions) {
319.247 + String dn = d.getDisplayName();
319.248 +
319.249 + if (dn.length() == 0) {
319.250 + dn = defaultFixDisplayName(ctx.getInfo(), ctx.getVariables(), d);
319.251 + }
319.252 +
319.253 + fixes.add(JavaFix.rewriteFix(ctx.getInfo(), dn, ctx.getPath(), d.getPattern(), ctx.getVariables(), ctx.getMultiVariables(), ctx.getVariableNames(), Collections.<String, TypeMirror>emptyMap()/*XXX: pd.pattern.getConstraints()*/));
319.254 + }
319.255 +
319.256 + return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), displayName, fixes.toArray(new Fix[0])));
319.257 + }
319.258 + }
319.259 +
319.260 + private static <T> T findValue(AnnotationMirror m, String name, Class<T> clazz) {
319.261 + for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : m.getElementValues().entrySet()) {
319.262 + if (name.equals(e.getKey().getSimpleName().toString())) {
319.263 + return clazz.cast(e.getValue().getValue());
319.264 + }
319.265 + }
319.266 +
319.267 + TypeElement te = (TypeElement) m.getAnnotationType().asElement();
319.268 +
319.269 + for (ExecutableElement ee : ElementFilter.methodsIn(te.getEnclosedElements())) {
319.270 + if (name.equals(ee.getSimpleName().toString())) {
319.271 + if (ee.getDefaultValue() == null) {
319.272 + return null;
319.273 + }
319.274 + return clazz.cast(ee.getDefaultValue().getValue());
319.275 + }
319.276 + }
319.277 +
319.278 + return null;
319.279 + }
319.280 +
319.281 + private static HintDescription create(CompilationInfo info, Element el, AnnotationMirror transformation, String id, CompilationInfo fake) {
319.282 + Collection rawPatterns = findValue(transformation, "pattern", Collection.class);
319.283 +
319.284 + if (rawPatterns == null || rawPatterns.isEmpty()) {
319.285 + return null;
319.286 + }
319.287 +
319.288 + Iterable<AnnotationMirror> patterns = Utilities.checkedIterableByFilter(rawPatterns, AnnotationMirror.class, true);
319.289 +
319.290 + String patternString = findValue(patterns.iterator().next(), "value", String.class);
319.291 +
319.292 + if (patternString == null) {
319.293 + return null;
319.294 + }
319.295 +
319.296 + Collection rawConstraints = findValue(transformation, "constraint", Collection.class);
319.297 +
319.298 + if (rawConstraints == null) {
319.299 + return null;
319.300 + }
319.301 +
319.302 + Iterable<AnnotationMirror> constraints = Utilities.checkedIterableByFilter(rawConstraints, AnnotationMirror.class, true);
319.303 + Map<String, String> variableTypes = new HashMap<String, String>();
319.304 +
319.305 + for (AnnotationMirror m : constraints) {
319.306 + String var = findValue(m, "variable", String.class);
319.307 + TypeMirror tm = findValue(m, "type", TypeMirror.class);
319.308 +
319.309 + if (var == null || tm == null) {
319.310 + return null;
319.311 + }
319.312 +
319.313 + variableTypes.put(var, tm.toString()); //XXX: toString()
319.314 + }
319.315 +
319.316 + if (!el.getModifiers().contains(Modifier.STATIC) && !variableTypes.containsKey("$this")) {
319.317 + TypeMirror parent = el.getEnclosingElement().asType();
319.318 +
319.319 + variableTypes.put("$this", TypeMirrorHandle.create(fake.getTypes().erasure(parent)).resolve(info).toString()); //XXX: toString()
319.320 + }
319.321 +
319.322 + List<String> aps = new LinkedList<String>();
319.323 +
319.324 + for (AnnotationMirror ap : Utilities.checkedIterableByFilter(findValue(transformation, "antipattern", Collection.class), AnnotationMirror.class, true)) {
319.325 + aps.add(findValue(ap, "value", String.class));
319.326 + }
319.327 +
319.328 + List<FixDescription> fixes = new LinkedList<FixDescription>();
319.329 + Collection rawFixes = findValue(transformation, "fix", Collection.class);
319.330 +
319.331 + if (rawFixes == null) {
319.332 + return null;
319.333 + }
319.334 +
319.335 + for (AnnotationMirror f : Utilities.checkedIterableByFilter(rawFixes, AnnotationMirror.class, true)) {
319.336 + String dn = findValue(f, "displayName", String.class);
319.337 + String to = findValue(f, "value", String.class);
319.338 +
319.339 + if (dn == null || to == null) {
319.340 + return null;
319.341 + }
319.342 +
319.343 + fixes.add(new FixDescription(dn, to));
319.344 + }
319.345 +
319.346 + String displayName = findValue(transformation, "displayName", String.class);
319.347 +
319.348 + if (displayName == null) {
319.349 + return null;//XXX
319.350 + }
319.351 +
319.352 + HintMetadata hm = HintMetadata.Builder.create(id).setDescription(displayName, displayName).setCategory(CATEGORY).build();
319.353 +
319.354 + return HintDescriptionFactory.create()
319.355 + .setMetadata(hm)
319.356 + .setTrigger(PatternDescription.create(patternString, variableTypes))
319.357 + .setWorker(new WorkerImpl(displayName, fixes))
319.358 + .produce();
319.359 + }
319.360 +
319.361 + private static final String CATEGORY = "Transformations";
319.362 +
319.363 + private static final class FixDescription {
319.364 + private final String displayName;
319.365 + private final String pattern;
319.366 +
319.367 + public FixDescription(String displayName, String pattern) {
319.368 + this.displayName = displayName;
319.369 + this.pattern = pattern;
319.370 + }
319.371 +
319.372 + public String getDisplayName() {
319.373 + return displayName;
319.374 + }
319.375 +
319.376 + public String getPattern() {
319.377 + return pattern;
319.378 + }
319.379 +
319.380 + }
319.381 +
319.382 + private static final File ANNOTATIONS_JAR;
319.383 + private static final File NB_OVERLAY_JAR;
319.384 + private static final File JDK_OVERLAY_JAR;
319.385 +
319.386 + static {
319.387 + ANNOTATIONS_JAR = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
319.388 + NB_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/org-netbeans-nboverlay.jar", null, false);
319.389 + JDK_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/jdk.jar", null, false);
319.390 + }
319.391 +
319.392 + private ClassPath prepareOverlayCompileCP() throws IllegalArgumentException {
319.393 + if (NB_OVERLAY_JAR ==null) {
319.394 + return ClassPathSupport.createClassPath(new URL[0]);
319.395 + }
319.396 +
319.397 + return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(NB_OVERLAY_JAR));
319.398 + }
319.399 +
319.400 + private ClassPath prepareOverlayBootCP() throws IllegalArgumentException {
319.401 + if (ANNOTATIONS_JAR == null) {
319.402 + return ClassPathSupport.createClassPath(new URL[0]);
319.403 + }
319.404 +
319.405 + if (JDK_OVERLAY_JAR == null) {
319.406 + return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR));
319.407 + }
319.408 +
319.409 + return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR), FileUtil.urlForArchiveOrDir(JDK_OVERLAY_JAR));
319.410 + }
319.411 +
319.412 + private List<HintDescription> processAnnotations(Element e, Element enclosing, CompilationInfo info, CompilationInfo fake) {
319.413 + boolean foundTransformations = false;
319.414 + List<HintDescription> result = new LinkedList<HintDescription>();
319.415 + String id;
319.416 + switch (e.getKind()) {
319.417 + case ANNOTATION_TYPE:
319.418 + case CLASS:
319.419 + case ENUM:
319.420 + case INTERFACE:
319.421 + id = fake.getElements().getBinaryName((TypeElement) e).toString();
319.422 + break;
319.423 + case FIELD:
319.424 + case ENUM_CONSTANT:
319.425 + id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
319.426 + break;
319.427 + case CONSTRUCTOR:
319.428 + case METHOD:
319.429 + //XXX: parameters!
319.430 + id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
319.431 + break;
319.432 + default:
319.433 + id = "no-id";
319.434 + break;
319.435 + }
319.436 +
319.437 + int index = 0;
319.438 +
319.439 + for (AnnotationMirror am : e.getAnnotationMirrors()) {
319.440 + String fqn = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName().toString();
319.441 + List<AnnotationMirror> transformations = new LinkedList<AnnotationMirror>();
319.442 + if (TRANSFORMATION.toFQN().equals(fqn)) {
319.443 + transformations.add(am);
319.444 + foundTransformations = true;
319.445 + }
319.446 + if (TRANSFORMATION_SET.toFQN().equals(fqn)) {
319.447 + for (AnnotationMirror m : Utilities.checkedIterableByFilter(findValue(am, "value", Collection.class), AnnotationMirror.class, true)) {
319.448 + transformations.add(m);
319.449 + }
319.450 + foundTransformations = true;
319.451 + }
319.452 +
319.453 + for (AnnotationMirror t : transformations) {
319.454 + HintDescription pd = create(info, e, t, id + "-" + (index++), fake);
319.455 +
319.456 + if (pd != null) {
319.457 + result.add(pd);
319.458 + }
319.459 + }
319.460 + }
319.461 +
319.462 + if (!foundTransformations && e.getKind() == ElementKind.METHOD) {
319.463 + TypeElement owner = (TypeElement) e.getEnclosingElement();
319.464 +
319.465 + for (TypeMirror tm : fake.getTypes().directSupertypes(owner.asType())) {
319.466 + DeclaredType dt = (DeclaredType) tm;
319.467 + TypeElement parent = (TypeElement) dt.asElement();
319.468 +
319.469 + for (ExecutableElement ee : ElementFilter.methodsIn(parent.getEnclosedElements())) {
319.470 + if (!fake.getElements().overrides((ExecutableElement) e, ee, (TypeElement) enclosing)) {
319.471 + continue;
319.472 + }
319.473 + List<HintDescription> r = processAnnotations(ee, enclosing, info, fake);
319.474 +
319.475 + result.addAll(r);
319.476 + }
319.477 +
319.478 + }
319.479 + }
319.480 +
319.481 + return result;
319.482 + }
319.483 +
319.484 + private static String defaultFixDisplayName(CompilationInfo info, Map<String, TreePath> variables, FixDescription d) {
319.485 + Map<String, String> stringsForVariables = new HashMap<String, String>();
319.486 +
319.487 + for (Entry<String, TreePath> e : variables.entrySet()) {
319.488 + Tree t = e.getValue().getLeaf();
319.489 + SourcePositions sp = info.getTrees().getSourcePositions();
319.490 + int startPos = (int) sp.getStartPosition(info.getCompilationUnit(), t);
319.491 + int endPos = (int) sp.getEndPosition(info.getCompilationUnit(), t);
319.492 +
319.493 + stringsForVariables.put(e.getKey(), info.getText().substring(startPos, endPos));
319.494 + }
319.495 +
319.496 + if (!stringsForVariables.containsKey("$this")) {
319.497 + stringsForVariables.put("$this", "this");
319.498 + }
319.499 +
319.500 + String replaceTarget = d.getPattern();
319.501 +
319.502 + for (Entry<String, String> e : stringsForVariables.entrySet()) {
319.503 + String quotedVariable = java.util.regex.Pattern.quote(e.getKey());
319.504 + String quotedTarget = Matcher.quoteReplacement(e.getValue());
319.505 + replaceTarget = replaceTarget.replaceAll(quotedVariable, quotedTarget);
319.506 + }
319.507 +
319.508 + return "Rewrite to " + replaceTarget;
319.509 + }
319.510 +
319.511 +}
320.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
320.2 +++ b/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/Utilities.java Tue Feb 21 22:37:57 2012 +0100
320.3 @@ -0,0 +1,138 @@
320.4 +/*
320.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
320.6 + *
320.7 + * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
320.8 + *
320.9 + * The contents of this file are subject to the terms of either the GNU
320.10 + * General Public License Version 2 only ("GPL") or the Common
320.11 + * Development and Distribution License("CDDL") (collectively, the
320.12 + * "License"). You may not use this file except in compliance with the
320.13 + * License. You can obtain a copy of the License at
320.14 + * http://www.netbeans.org/cddl-gplv2.html
320.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
320.16 + * specific language governing permissions and limitations under the
320.17 + * License. When distributing the software, include this License Header
320.18 + * Notice in each file and include the License file at
320.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
320.20 + * particular file as subject to the "Classpath" exception as provided
320.21 + * by Sun in the GPL Version 2 section of the License file that
320.22 + * accompanied this code. If applicable, add the following below the
320.23 + * License Header, with the fields enclosed by brackets [] replaced by
320.24 + * your own identifying information:
320.25 + * "Portions Copyrighted [year] [name of copyright owner]"
320.26 + *
320.27 + * If you wish your version of this file to be governed by only the CDDL
320.28 + * or only the GPL Version 2, indicate your decision by adding
320.29 + * "[Contributor] elects to include this software in this distribution
320.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
320.31 + * single choice of license, a recipient has the option to distribute
320.32 + * your version of this file under either the CDDL, the GPL Version 2 or
320.33 + * to extend the choice of license to its licensees as provided above.
320.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
320.35 + * Version 2 license, then the option applies only if the new code is
320.36 + * made subject to such option by the copyright holder.
320.37 + *
320.38 + * Contributor(s):
320.39 + *
320.40 + * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
320.41 + */
320.42 +
320.43 +package org.netbeans.modules.jackpot30.transformers;
320.44 +
320.45 +import com.sun.source.tree.AnnotationTree;
320.46 +import com.sun.source.tree.AssignmentTree;
320.47 +import com.sun.source.tree.ExpressionTree;
320.48 +import com.sun.source.tree.IdentifierTree;
320.49 +import com.sun.source.tree.LiteralTree;
320.50 +import com.sun.source.tree.MemberSelectTree;
320.51 +import com.sun.source.tree.NewArrayTree;
320.52 +import com.sun.source.tree.Tree;
320.53 +import com.sun.source.tree.Tree.Kind;
320.54 +import java.util.Arrays;
320.55 +import java.util.Iterator;
320.56 +import java.util.LinkedList;
320.57 +import java.util.List;
320.58 +import javax.lang.model.element.TypeElement;
320.59 +import javax.lang.model.type.TypeMirror;
320.60 +import org.netbeans.api.java.source.TreeMaker;
320.61 +import org.netbeans.api.java.source.WorkingCopy;
320.62 +import org.openide.util.NbCollections;
320.63 +
320.64 +/**
320.65 + *
320.66 + * @author Jan Lahoda
320.67 + */
320.68 +public class Utilities {
320.69 +
320.70 + private Utilities() {}
320.71 +
320.72 + public static <E> Iterable<E> checkedIterableByFilter(final Iterable raw, final Class<E> type, final boolean strict) {
320.73 + return new Iterable<E>() {
320.74 + public Iterator<E> iterator() {
320.75 + return NbCollections.checkedIteratorByFilter(raw.iterator(), type, strict);
320.76 + }
320.77 + };
320.78 + }
320.79 +
320.80 +// public static AnnotationTree constructConstraint(WorkingCopy wc, String name, TypeMirror tm) {
320.81 +// TreeMaker make = wc.getTreeMaker();
320.82 +// ExpressionTree variable = prepareAssignment(make, "variable", make.Literal(name));
320.83 +// ExpressionTree type = prepareAssignment(make, "type", make.MemberSelect((ExpressionTree) make.Type(wc.getTypes().erasure(tm)), "class"));
320.84 +// TypeElement constraint = wc.getElements().getTypeElement(Annotations.CONSTRAINT.toFQN());
320.85 +//
320.86 +// return make.Annotation(make.QualIdent(constraint), Arrays.asList(variable, type));
320.87 +// }
320.88 +
320.89 + public static ExpressionTree prepareAssignment(TreeMaker make, String name, ExpressionTree value) {
320.90 + return make.Assignment(make.Identifier(name), value);
320.91 + }
320.92 +
320.93 + public static ExpressionTree findValue(AnnotationTree m, String name) {
320.94 + for (ExpressionTree et : m.getArguments()) {
320.95 + if (et.getKind() == Kind.ASSIGNMENT) {
320.96 + AssignmentTree at = (AssignmentTree) et;
320.97 + String varName = ((IdentifierTree) at.getVariable()).getName().toString();
320.98 +
320.99 + if (varName.equals(name)) {
320.100 + return at.getExpression();
320.101 + }
320.102 + }
320.103 +
320.104 + if (et instanceof LiteralTree/*XXX*/ && "value".equals(name)) {
320.105 + return et;
320.106 + }
320.107 + }
320.108 +
320.109 + return null;
320.110 + }
320.111 +
320.112 + public static List<AnnotationTree> findArrayValue(AnnotationTree at, String name) {
320.113 + ExpressionTree fixesArray = findValue(at, name);
320.114 + List<AnnotationTree> fixes = new LinkedList<AnnotationTree>();
320.115 +
320.116 + if (fixesArray != null && fixesArray.getKind() == Kind.NEW_ARRAY) {
320.117 + NewArrayTree trees = (NewArrayTree) fixesArray;
320.118 +
320.119 + for (ExpressionTree fix : trees.getInitializers()) {
320.120 + if (fix.getKind() == Kind.ANNOTATION) {
320.121 + fixes.add((AnnotationTree) fix);
320.122 + }
320.123 + }
320.124 + }
320.125 +
320.126 + if (fixesArray != null && fixesArray.getKind() == Kind.ANNOTATION) {
320.127 + fixes.add((AnnotationTree) fixesArray);
320.128 + }
320.129 +
320.130 + return fixes;
320.131 + }
320.132 +
320.133 + public static boolean isPureMemberSelect(Tree mst, boolean allowVariables) {
320.134 + switch (mst.getKind()) {
320.135 + case IDENTIFIER: return allowVariables || ((IdentifierTree) mst).getName().charAt(0) != '$';
320.136 + case MEMBER_SELECT: return isPureMemberSelect(((MemberSelectTree) mst).getExpression(), allowVariables);
320.137 + default: return false;
320.138 + }
320.139 + }
320.140 +
320.141 +}
321.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
321.2 +++ b/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties Tue Feb 21 22:37:57 2012 +0100
321.3 @@ -0,0 +1,38 @@
321.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
321.5 +#
321.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
321.7 +#
321.8 +# The contents of this file are subject to the terms of either the GNU
321.9 +# General Public License Version 2 only ("GPL") or the Common
321.10 +# Development and Distribution License("CDDL") (collectively, the
321.11 +# "License"). You may not use this file except in compliance with the
321.12 +# License. You can obtain a copy of the License at
321.13 +# http://www.netbeans.org/cddl-gplv2.html
321.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
321.15 +# specific language governing permissions and limitations under the
321.16 +# License. When distributing the software, include this License Header
321.17 +# Notice in each file and include the License file at
321.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
321.19 +# particular file as subject to the "Classpath" exception as provided
321.20 +# by Sun in the GPL Version 2 section of the License file that
321.21 +# accompanied this code. If applicable, add the following below the
321.22 +# License Header, with the fields enclosed by brackets [] replaced by
321.23 +# your own identifying information:
321.24 +# "Portions Copyrighted [year] [name of copyright owner]"
321.25 +#
321.26 +# If you wish your version of this file to be governed by only the CDDL
321.27 +# or only the GPL Version 2, indicate your decision by adding
321.28 +# "[Contributor] elects to include this software in this distribution
321.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
321.30 +# single choice of license, a recipient has the option to distribute
321.31 +# your version of this file under either the CDDL, the GPL Version 2 or
321.32 +# to extend the choice of license to its licensees as provided above.
321.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
321.34 +# Version 2 license, then the option applies only if the new code is
321.35 +# made subject to such option by the copyright holder.
321.36 +#
321.37 +# Contributor(s):
321.38 +#
321.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
321.40 +
321.41 +OpenIDE-Module-Name=Jackpot 3.0 Transformations
322.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
322.2 +++ b/sandbox/old-modules/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/layer.xml Tue Feb 21 22:37:57 2012 +0100
322.3 @@ -0,0 +1,4 @@
322.4 +<?xml version="1.0" encoding="UTF-8"?>
322.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
322.6 +<filesystem>
322.7 +</filesystem>
323.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
323.2 +++ b/sandbox/old-modules/transformer/test/unit/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImplTest.java Tue Feb 21 22:37:57 2012 +0100
323.3 @@ -0,0 +1,555 @@
323.4 +/*
323.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
323.6 + *
323.7 + * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
323.8 + *
323.9 + * The contents of this file are subject to the terms of either the GNU
323.10 + * General Public License Version 2 only ("GPL") or the Common
323.11 + * Development and Distribution License("CDDL") (collectively, the
323.12 + * "License"). You may not use this file except in compliance with the
323.13 + * License. You can obtain a copy of the License at
323.14 + * http://www.netbeans.org/cddl-gplv2.html
323.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
323.16 + * specific language governing permissions and limitations under the
323.17 + * License. When distributing the software, include this License Header
323.18 + * Notice in each file and include the License file at
323.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
323.20 + * particular file as subject to the "Classpath" exception as provided
323.21 + * by Sun in the GPL Version 2 section of the License file that
323.22 + * accompanied this code. If applicable, add the following below the
323.23 + * License Header, with the fields enclosed by brackets [] replaced by
323.24 + * your own identifying information:
323.25 + * "Portions Copyrighted [year] [name of copyright owner]"
323.26 + *
323.27 + * If you wish your version of this file to be governed by only the CDDL
323.28 + * or only the GPL Version 2, indicate your decision by adding
323.29 + * "[Contributor] elects to include this software in this distribution
323.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
323.31 + * single choice of license, a recipient has the option to distribute
323.32 + * your version of this file under either the CDDL, the GPL Version 2 or
323.33 + * to extend the choice of license to its licensees as provided above.
323.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
323.35 + * Version 2 license, then the option applies only if the new code is
323.36 + * made subject to such option by the copyright holder.
323.37 + *
323.38 + * Contributor(s):
323.39 + *
323.40 + * Portions Copyrighted 2008 Sun Microsystems, Inc.
323.41 + */
323.42 +
323.43 +package org.netbeans.modules.jackpot30.transformers;
323.44 +
323.45 +import com.sun.source.tree.Tree.Kind;
323.46 +import java.io.File;
323.47 +import java.io.IOException;
323.48 +import java.util.ArrayList;
323.49 +import java.util.Arrays;
323.50 +import java.util.Collections;
323.51 +import java.util.HashMap;
323.52 +import java.util.LinkedList;
323.53 +import java.util.List;
323.54 +import java.util.Map;
323.55 +import java.util.concurrent.atomic.AtomicBoolean;
323.56 +import javax.swing.text.Document;
323.57 +import org.netbeans.api.java.lexer.JavaTokenId;
323.58 +import org.netbeans.api.java.source.CompilationInfo;
323.59 +import org.netbeans.api.java.source.JavaSource;
323.60 +import org.netbeans.api.java.source.JavaSource.Phase;
323.61 +import org.netbeans.api.java.source.SourceUtilsTestUtil;
323.62 +import org.netbeans.api.java.source.TestUtilities;
323.63 +import org.netbeans.api.lexer.Language;
323.64 +import org.netbeans.junit.NbTestCase;
323.65 +import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
323.66 +import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
323.67 +import org.netbeans.modules.java.hints.jackpot.spi.ClassPathBasedHintProvider;
323.68 +import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
323.69 +import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
323.70 +import org.netbeans.modules.java.source.TreeLoader;
323.71 +import org.netbeans.spi.editor.hints.ErrorDescription;
323.72 +import org.netbeans.spi.editor.hints.Fix;
323.73 +import org.openide.LifecycleManager;
323.74 +import org.openide.cookies.EditorCookie;
323.75 +import org.openide.filesystems.FileObject;
323.76 +import org.openide.filesystems.FileUtil;
323.77 +import org.openide.loaders.DataObject;
323.78 +import org.openide.modules.InstalledFileLocator;
323.79 +
323.80 +/**
323.81 + *
323.82 + * @author Jan Lahoda
323.83 + */
323.84 +public class TransformationHintProviderImplTest extends NbTestCase {
323.85 +
323.86 + public TransformationHintProviderImplTest(String name) {
323.87 + super(name);
323.88 + }
323.89 +
323.90 + public void testSimpleAnalysis() throws Exception {
323.91 + performAnalysisTest("package test;\n" +
323.92 + "import net.java.lang.annotations.Constraint;\n" +
323.93 + "import net.java.lang.annotations.Fix;\n" +
323.94 + "import net.java.lang.annotations.Pattern;\n" +
323.95 + "import net.java.lang.annotations.Transformation;\n" +
323.96 + "public class Test {\n" +
323.97 + " @Transformation(\n" +
323.98 + " displayName=\"O\",\n" +
323.99 + " pattern=@Pattern(\"$0.getCookie($1)\"),\n" +
323.100 + " constraint={\n" +
323.101 + " @Constraint(variable=\"$0\", type=Test.class),\n" +
323.102 + " @Constraint(variable=\"$1\", type=Class.class)\n" +
323.103 + " },\n" +
323.104 + " fix=@Fix(\"$0.lookup($1)\")\n" +
323.105 + " )\n" +
323.106 + " public void getCookie(Class c) {}\n" +
323.107 + " private void test() {\n" +
323.108 + " getCookie(null);\n" +
323.109 + " }\n" +
323.110 + "}\n",
323.111 + "17:9-17:18:verifier:O");
323.112 + }
323.113 +
323.114 + public void testCanGoUp() throws Exception {
323.115 + performAnalysisTest("package test;\n" +
323.116 + "import net.java.lang.annotations.Constraint;\n" +
323.117 + "import net.java.lang.annotations.Fix;\n" +
323.118 + "import net.java.lang.annotations.Pattern;\n" +
323.119 + "import net.java.lang.annotations.Transformation;\n" +
323.120 + "public abstract class Test {\n" +
323.121 + " @Transformation(\n" +
323.122 + " displayName=\"O\",\n" +
323.123 + " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
323.124 + " constraint={\n" +
323.125 + " @Constraint(variable=\"$0\", type=Test.class)\n" +
323.126 + " },\n" +
323.127 + " fix=@Fix(\"$0.lookup($1)\")\n" +
323.128 + " )\n" +
323.129 + " public abstract String getCookie();\n" +
323.130 + " private void test() {\n" +
323.131 + " getCookie().toString();\n" +
323.132 + " }\n" +
323.133 + "}\n",
323.134 + "16:21-16:29:verifier:O");
323.135 + }
323.136 +
323.137 + public void testForConstructor() throws Exception {
323.138 + performAnalysisTest("package test;\n" +
323.139 + "import net.java.lang.annotations.Constraint;\n" +
323.140 + "import net.java.lang.annotations.Fix;\n" +
323.141 + "import net.java.lang.annotations.Pattern;\n" +
323.142 + "import net.java.lang.annotations.Transformation;\n" +
323.143 + "public class Test {\n" +
323.144 + " @Transformation(\n" +
323.145 + " displayName=\"O\",\n" +
323.146 + " pattern=@Pattern(\"new test.Test()\"),\n" +
323.147 + " fix={}\n" +
323.148 + " )\n" +
323.149 + " public Test() {}\n" +
323.150 + " private void test() {\n" +
323.151 + " new Test();\n" +
323.152 + " }\n" +
323.153 + "}\n",
323.154 + "13:9-13:19:verifier:O");
323.155 + }
323.156 +
323.157 + public void testMoreWarnings() throws Exception {
323.158 + performAnalysisTest("package test;\n" +
323.159 + "import net.java.lang.annotations.Constraint;\n" +
323.160 + "import net.java.lang.annotations.Fix;\n" +
323.161 + "import net.java.lang.annotations.Pattern;\n" +
323.162 + "import net.java.lang.annotations.Transformation;\n" +
323.163 + "public class Test {\n" +
323.164 + " @Transformation(\n" +
323.165 + " displayName=\"O\",\n" +
323.166 + " pattern=@Pattern(\"new test.Test()\"),\n" +
323.167 + " fix={}\n" +
323.168 + " )\n" +
323.169 + " public Test() {}\n" +
323.170 + " private void test() {\n" +
323.171 + " new Test();\n" +
323.172 + " new Test();\n" +
323.173 + " }\n" +
323.174 + "}\n",
323.175 + "13:9-13:19:verifier:O",
323.176 + "14:9-14:19:verifier:O");
323.177 + }
323.178 +
323.179 + public void testCorrectImports() throws Exception {
323.180 + performFixTest("test/Test.java",
323.181 + "package test;\n" +
323.182 + "import net.java.lang.annotations.Constraint;\n" +
323.183 + "import net.java.lang.annotations.Fix;\n" +
323.184 + "import net.java.lang.annotations.Pattern;\n" +
323.185 + "import net.java.lang.annotations.Transformation;\n" +
323.186 + "public abstract class Test {\n" +
323.187 + " @Transformation(\n" +
323.188 + " displayName=\"O\",\n" +
323.189 + " pattern=@Pattern(\"$this.test()\"),\n" +
323.190 + " fix=@Fix(\"test.Test.test1().toString()\")\n" +
323.191 + " )\n" +
323.192 + " private void test() {\n" +
323.193 + " test();\n" +
323.194 + " }" +
323.195 + " static String test1() {return null;}\n" +
323.196 + "}\n",
323.197 + "12:9-12:13:verifier:O",
323.198 + "FixImpl",
323.199 + "package test;\n" +
323.200 + "import net.java.lang.annotations.Constraint;\n" +
323.201 + "import net.java.lang.annotations.Fix;\n" +
323.202 + "import net.java.lang.annotations.Pattern;\n" +
323.203 + "import net.java.lang.annotations.Transformation;\n" +
323.204 + "public abstract class Test {\n" +
323.205 + " @Transformation(\n" +
323.206 + " displayName=\"O\",\n" +
323.207 + " pattern=@Pattern(\"$this.test()\"),\n" +
323.208 + " fix=@Fix(\"test.Test.test1().toString()\")\n" +
323.209 + " )\n" +
323.210 + " private void test() {\n" +
323.211 + " Test.test1().toString();\n" +
323.212 + " }" +
323.213 + " static String test1() {return null;}\n" +
323.214 + "}\n");
323.215 + }
323.216 +
323.217 + public void testNoExceptions1() throws Exception {
323.218 + performNoExceptionsTest("package test;\n" +
323.219 + "import net.java.lang.annotations.Constraint;\n" +
323.220 + "import net.java.lang.annotations.Fix;\n" +
323.221 + "import net.java.lang.annotations.Pattern;\n" +
323.222 + "import net.java.lang.annotations.Transformation;\n" +
323.223 + "public abstract class Test {\n" +
323.224 + " |public abstract String getCookie();\n" +
323.225 + " private void test() {\n" +
323.226 + " getCookie().toString();\n" +
323.227 + " }\n" +
323.228 + "}\n",
323.229 + " @Transformation(\n" +
323.230 + " displayName=\"O\",\n" +
323.231 + " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
323.232 + " constraint={\n" +
323.233 + " @Constraint(variable=\"$0\", type=Test.class)\n" +
323.234 + " },\n" +
323.235 + " fix={@Fix(\"$0.lookup($1)\")}\n" +
323.236 + " )\n".replaceAll("[ \n]+", " "));
323.237 + }
323.238 +
323.239 + public void testNoExceptions2() throws Exception {
323.240 + performNoExceptionsTest("package test;\n" +
323.241 + "import net.java.lang.annotations.Constraint;\n" +
323.242 + "import net.java.lang.annotations.Fix;\n" +
323.243 + "import net.java.lang.annotations.Pattern;\n" +
323.244 + "import net.java.lang.annotations.Transformation;\n" +
323.245 + "public abstract class Test {\n" +
323.246 + " |public abstract String getCookie();\n" +
323.247 + " private void test() {\n" +
323.248 + " getCookie().toString();\n" +
323.249 + " }\n" +
323.250 + "}\n",
323.251 + " @Transformation(\n" +
323.252 + " displayName=\"O\",\n" +
323.253 + " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
323.254 + " constraint=\n" +
323.255 + " @Constraint(variable=\"$0\", type=Test.class)\n" +
323.256 + " ,\n" +
323.257 + " fix=@Fix(\"$0.lookup($1)\")\n" +
323.258 + " )\n".replaceAll("[ \n]+", " "));
323.259 + }
323.260 +
323.261 + public void testType1() throws Exception {
323.262 + performFixTest("test/Test.java",
323.263 + "package test;\n" +
323.264 + "import net.java.lang.annotations.Constraint;\n" +
323.265 + "import net.java.lang.annotations.Fix;\n" +
323.266 + "import net.java.lang.annotations.Pattern;\n" +
323.267 + "import net.java.lang.annotations.Transformation;\n" +
323.268 + "public abstract class Test {\n" +
323.269 + " @Transformation(\n" +
323.270 + " displayName=\"O\",\n" +
323.271 + " pattern=@Pattern(\"test.Test.Bad\"),\n" +
323.272 + " fix=@Fix(\"test.Test.Good\")\n" +
323.273 + " )\n" +
323.274 + " public static class Bad {}\n" +
323.275 + " public static class Good {}\n" +
323.276 + " static void test1() { Bad b; }\n" +
323.277 + "}\n",
323.278 + "13:26-13:29:verifier:O",
323.279 + "FixImpl",
323.280 + "package test;\n" +
323.281 + "import net.java.lang.annotations.Constraint;\n" +
323.282 + "import net.java.lang.annotations.Fix;\n" +
323.283 + "import net.java.lang.annotations.Pattern;\n" +
323.284 + "import net.java.lang.annotations.Transformation;\n" +
323.285 + "public abstract class Test {\n" +
323.286 + " @Transformation(\n" +
323.287 + " displayName=\"O\",\n" +
323.288 + " pattern=@Pattern(\"test.Test.Bad\"),\n" +
323.289 + " fix=@Fix(\"test.Test.Good\")\n" +
323.290 + " )\n" +
323.291 + " public static class Bad {}\n" +
323.292 + " public static class Good {}\n" +
323.293 + " static void test1() { Good b; }\n" +
323.294 + "}\n".replaceAll("[ \n]+", " "));
323.295 + }
323.296 +
323.297 + public void testCorrectReplace() throws Exception {
323.298 + performFixTest("test/Test.java",
323.299 + "package test;\n" +
323.300 + "import net.java.lang.annotations.Constraint;\n" +
323.301 + "import net.java.lang.annotations.Fix;\n" +
323.302 + "import net.java.lang.annotations.Pattern;\n" +
323.303 + "import net.java.lang.annotations.Transformation;\n" +
323.304 + "public class Test {\n" +
323.305 + " @Transformation(\n" +
323.306 + " displayName=\"O\",\n" +
323.307 + " pattern=@Pattern(\"$this.test()\"),\n" +
323.308 + " fix=@Fix(\"$this.test()\")\n" +
323.309 + " )\n" +
323.310 + " private void test() {\n" +
323.311 + " new Test().test();\n" +
323.312 + " }\n" +
323.313 + "}\n",
323.314 + "12:20-12:24:verifier:O",
323.315 + "FixImpl",
323.316 + "package test;\n" +
323.317 + "import net.java.lang.annotations.Constraint;\n" +
323.318 + "import net.java.lang.annotations.Fix;\n" +
323.319 + "import net.java.lang.annotations.Pattern;\n" +
323.320 + "import net.java.lang.annotations.Transformation;\n" +
323.321 + "public class Test {\n" +
323.322 + " @Transformation(\n" +
323.323 + " displayName=\"O\",\n" +
323.324 + " pattern=@Pattern(\"$this.test()\"),\n" +
323.325 + " fix=@Fix(\"$this.test()\")\n" +
323.326 + " )\n" +
323.327 + " private void test() {\n" +
323.328 + " new Test().test();\n" +
323.329 + " }\n" +
323.330 + "}\n");
323.331 + }
323.332 +
323.333 + @Override
323.334 + protected void setUp() throws Exception {
323.335 + super.setUp();
323.336 +
323.337 + File jar = FileUtil.archiveOrDirForURL(TransformationHintProviderImpl.class.getProtectionDomain().getCodeSource().getLocation());
323.338 +
323.339 + assertNotNull(jar);
323.340 +
323.341 + String nbHome = jar.getParentFile().getParentFile().getAbsolutePath();
323.342 +
323.343 + System.setProperty("netbeans.home",nbHome);
323.344 +
323.345 + SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[0]);
323.346 + TreeLoader.DISABLE_CONFINEMENT_TEST = true;
323.347 + }
323.348 +
323.349 + private List<ErrorDescription> computeWarnings() {
323.350 + List<HintDescription> hints = new ArrayList<HintDescription>();
323.351 +
323.352 + RulesManager.computeElementBasedHintsXXX(info, new AtomicBoolean(), Collections.singletonList(new TransformationHintProviderImpl()), Collections.<ClassPathBasedHintProvider>emptyList(), hints);
323.353 +
323.354 + List<ErrorDescription> warnings = new HintsInvoker(info, new AtomicBoolean()).computeHints(info, hints);
323.355 +
323.356 + return warnings;
323.357 + }
323.358 +
323.359 + private void prepareTest(String fileName, String code) throws Exception {
323.360 + prepareTest(fileName, code, false);
323.361 + }
323.362 +
323.363 + private void prepareTest(String fileName, String code, boolean ignoreErrors) throws Exception {
323.364 + clearWorkDir();
323.365 +
323.366 + FileUtil.refreshFor(File.listRoots());
323.367 +
323.368 + FileObject workFO = FileUtil.toFileObject(getWorkDir());
323.369 +
323.370 + assertNotNull(workFO);
323.371 +
323.372 + workFO.refresh();
323.373 +
323.374 + sourceRoot = workFO.createFolder("src");
323.375 + FileObject buildRoot = workFO.createFolder("build");
323.376 + FileObject cache = workFO.createFolder("cache");
323.377 +
323.378 + FileObject data = FileUtil.createData(sourceRoot, fileName);
323.379 + File dataFile = FileUtil.toFile(data);
323.380 +
323.381 + assertNotNull(dataFile);
323.382 +
323.383 + TestUtilities.copyStringToFile(dataFile, code);
323.384 +
323.385 + File ann = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
323.386 +
323.387 + if (ann == null) {
323.388 + ann = InstalledFileLocator.getDefault().locate("release/libs/annotations.jar", null, false);
323.389 + }
323.390 +
323.391 + assertNotNull(System.getProperty("netbeans.home"), ann);
323.392 +
323.393 + FileObject annFO = FileUtil.toFileObject(ann);
323.394 +
323.395 + assertNotNull(annFO);
323.396 +
323.397 + SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache, new FileObject[] {FileUtil.getArchiveRoot(annFO)});
323.398 +
323.399 + DataObject od = DataObject.find(data);
323.400 + EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
323.401 +
323.402 + assertNotNull(ec);
323.403 +
323.404 + doc = ec.openDocument();
323.405 + doc.putProperty(Language.class, JavaTokenId.language());
323.406 +
323.407 + JavaSource js = JavaSource.forFileObject(data);
323.408 +
323.409 + assertNotNull(js);
323.410 +
323.411 + info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
323.412 +
323.413 + assertNotNull(info);
323.414 +
323.415 + if (!ignoreErrors) {
323.416 + assertEquals(info.getDiagnostics().toString(), 0, info.getDiagnostics().size());
323.417 + }
323.418 + }
323.419 +
323.420 + private FileObject sourceRoot;
323.421 + private CompilationInfo info;
323.422 + private Document doc;
323.423 + private String wordDirPath;
323.424 +
323.425 + protected void performNoExceptionsTest(String code, String type) throws Exception {
323.426 + String wDP = getWorkDirPath();
323.427 +
323.428 + int offset = code.indexOf('|');
323.429 +
323.430 + code = code.replace("|", "");
323.431 +
323.432 + File prev = null;
323.433 +
323.434 + for (int i = 0; i < type.length(); i++) {
323.435 + StringBuilder nueCode = new StringBuilder();
323.436 +
323.437 + nueCode.append(code);
323.438 + nueCode.insert(offset, type.substring(0, i + 1));
323.439 +
323.440 + this.wordDirPath = wDP + File.separatorChar + i;
323.441 +
323.442 + performAnalysisTest(nueCode.toString(), null, true);
323.443 +
323.444 + if (prev != null) {
323.445 + deleteFile(prev);
323.446 + FileUtil.refreshFor(File.listRoots());
323.447 + }
323.448 +
323.449 + prev = getWorkDir();
323.450 + }
323.451 + }
323.452 +
323.453 + protected void performAnalysisTest(String code, String... golden) throws Exception {
323.454 + performAnalysisTest(code, golden, false);
323.455 + }
323.456 +
323.457 + protected void performAnalysisTest(String code, String[] golden, boolean ignoreErrors) throws Exception {
323.458 + prepareTest("test/Test.java", code, ignoreErrors);
323.459 +
323.460 + List<ErrorDescription> warnings = computeWarnings();
323.461 + List<String> dns = new LinkedList<String>();
323.462 +
323.463 + for (ErrorDescription ed : warnings) {
323.464 + dns.add(ed.toString());
323.465 + }
323.466 +
323.467 + if (golden != null) {
323.468 + assertEquals(Arrays.asList(golden), dns);
323.469 + }
323.470 + }
323.471 +
323.472 + protected String performFixTest(String fileName, String code, String errorDescriptionToString, String fixDebugString, String golden) throws Exception {
323.473 + prepareTest(fileName, code);
323.474 +
323.475 + List<ErrorDescription> errors = computeWarnings();
323.476 +
323.477 + ErrorDescription toFix = null;
323.478 +
323.479 + for (ErrorDescription d : errors) {
323.480 + if (errorDescriptionToString.equals(d.toString())) {
323.481 + toFix = d;
323.482 + break;
323.483 + }
323.484 + }
323.485 +
323.486 + assertNotNull("Error: \"" + errorDescriptionToString + "\" not found. All ErrorDescriptions: " + errors.toString(), toFix);
323.487 +
323.488 + assertTrue("Must be computed", toFix.getFixes().isComputed());
323.489 +
323.490 + List<Fix> fixes = toFix.getFixes().getFixes();
323.491 + List<String> fixNames = new LinkedList<String>();
323.492 + Fix toApply = null;
323.493 +
323.494 + for (Fix f : fixes) {
323.495 + if (fixDebugString.equals(toDebugString(info, f))) {
323.496 + toApply = f;
323.497 + }
323.498 +
323.499 + fixNames.add(toDebugString(info, f));
323.500 + }
323.501 +
323.502 + assertNotNull("Cannot find fix to invoke: " + fixNames.toString(), toApply);
323.503 +
323.504 + toApply.implement();
323.505 +
323.506 + FileObject toCheck = sourceRoot.getFileObject(fileName);
323.507 +
323.508 + assertNotNull(toCheck);
323.509 +
323.510 + DataObject toCheckDO = DataObject.find(toCheck);
323.511 + EditorCookie ec = toCheckDO.getCookie(EditorCookie.class);
323.512 + Document toCheckDocument = ec.openDocument();
323.513 +
323.514 + String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
323.515 +
323.516 + //ignore whitespaces:
323.517 + realCode = realCode.replaceAll("[ \t\n]+", " ");
323.518 +
323.519 + if (golden != null) {
323.520 + golden = golden.replaceAll("[ \t\n]+", " ");
323.521 + assertEquals("The output code does not match the expected code.", golden, realCode);
323.522 + }
323.523 +
323.524 + LifecycleManager.getDefault().saveAll();
323.525 +
323.526 + return realCode;
323.527 + }
323.528 +
323.529 + private String toDebugString(CompilationInfo info, Fix f) {
323.530 + return "FixImpl";
323.531 + }
323.532 +
323.533 + @Override
323.534 + public String getWorkDirPath() {
323.535 + if (this.wordDirPath != null) {
323.536 + return this.wordDirPath;
323.537 + }
323.538 +
323.539 + return super.getWorkDirPath();
323.540 + }
323.541 +
323.542 + private static void deleteFile(File file) throws IOException {
323.543 + if (file.isDirectory()) {
323.544 + // file is a directory - delete sub files first
323.545 + File files[] = file.listFiles();
323.546 + for (int i = 0; i < files.length; i++) {
323.547 + deleteFile(files[i]);
323.548 + }
323.549 +
323.550 + }
323.551 + // file is a File :-)
323.552 + boolean result = file.delete();
323.553 + if (result == false ) {
323.554 + // a problem has appeared
323.555 + throw new IOException("Cannot delete file, file = "+file.getPath());
323.556 + }
323.557 + }
323.558 +}
324.1 --- a/server/do-indexing Sat Feb 18 22:14:42 2012 +0100
324.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
324.3 @@ -1,27 +0,0 @@
324.4 -#!/bin/bash -x
324.5 -
324.6 -performIndexing() {
324.7 - name=`basename $1`;
324.8 - if [ -d $name ] ; then
324.9 - HG_OUT=$(tempfile) || exit
324.10 - trap "rm -f -- '$HG_OUT'" EXIT
324.11 - MODIFIED=$(tempfile) || exit
324.12 - trap "rm -f -- '$HG_OUT' '$MODIFIED'" EXIT
324.13 - REMOVED=$(tempfile) || exit
324.14 - trap "rm -f -- '$HG_OUT' '$MODIFIED' '$REMOVED'" EXIT
324.15 -
324.16 - (cd $name; hg pull; hg --verbose up >$HG_OUT; grep <$HG_OUT "^getting " | cut -d ' ' -f 2- >$MODIFIED; grep <$HG_OUT "^removing " | cut -d ' ' -f 2- >$REMOVED;)
324.17 - java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2 "$MODIFIED" "$REMOVED"
324.18 - else
324.19 - hg clone $1
324.20 - java -Xbootclasspath/p:lib/javac-api-nb-7.0-b07.jar -jar indexer.jar $ADDITIONAL_INDEXING_PARAMS $name $2
324.21 - fi;
324.22 -}
324.23 -
324.24 -mkdir -p cache
324.25 -
324.26 -for f in `echo $1 | tr ',' '\n'`; do
324.27 - performIndexing $f cache
324.28 -done
324.29 -
324.30 -exit
325.1 --- a/server/download.xml Sat Feb 18 22:14:42 2012 +0100
325.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
325.3 @@ -1,69 +0,0 @@
325.4 -<project name="download" default="download">
325.5 - <target name="download">
325.6 - <property name="imported.basedir" value="${basedir}"/>
325.7 -
325.8 - <macrodef name="download">
325.9 - <attribute name="url"/>
325.10 - <attribute name="target"/>
325.11 - <sequential>
325.12 - <antcall target="-download" inheritAll="false">
325.13 - <param name="url" value="@{url}" />
325.14 - <param name="target" value="@{target}" />
325.15 - <param name="imported.basedir" value="${imported.basedir}" />
325.16 - </antcall>
325.17 - </sequential>
325.18 - </macrodef>
325.19 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1.jar" target="jersey-1.1/jersey-client-1.0.1.jar"/>
325.20 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1-javadoc.jar" target="jersey-1.1/jersey-client-1.0.1-javadoc.jar"/>
325.21 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-client/1.0.1/jersey-client-1.0.1-sources.jar" target="jersey-1.1/jersey-client-1.0.1-sources.jar"/>
325.22 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1.jar" target="jersey-1.1/jersey-core-1.0.1.jar"/>
325.23 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1-javadoc.jar" target="jersey-1.1/jersey-core-1.0.1-javadoc.jar"/>
325.24 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1-sources.jar" target="jersey-1.1/jersey-core-1.0.1-sources.jar"/>
325.25 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1.jar" target="jersey-1.1/jersey-server-1.0.1.jar"/>
325.26 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1-javadoc.jar" target="jersey-1.1/jersey-server-1.0.1-javadoc.jar"/>
325.27 - <download url="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1-sources.jar" target="jersey-1.1/jersey-server-1.0.1-sources.jar"/>
325.28 - <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.8.6.3/grizzly-servlet-webserver-1.8.6.3.jar" target="jersey-1.1/grizzly-servlet-webserver-1.8.6.3.jar"/>
325.29 -<!-- <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.14/grizzly-servlet-webserver-1.9.14-javadoc.jar" target="jersey-1.1/grizzly-servlet-webserver-1.9.14-javadoc.jar"/>-->
325.30 -<!-- <download url="http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-webserver/1.9.14/grizzly-servlet-webserver-1.9.14-sources.jar" target="jersey-1.1/grizzly-servlet-webserver-1.9.14-sources.jar"/>-->
325.31 - <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar" target="jersey-1.1/jsr311-api-1.0.jar"/>
325.32 - <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0-javadoc.jar" target="jersey-1.1/jsr311-api-1.0-javadoc.jar"/>
325.33 - <download url="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0-sources.jar" target="jersey-1.1/jsr311-api-1.0-sources.jar"/>
325.34 - <download url="http://repo2.maven.org/maven2/asm/asm-all/3.1/asm-all-3.1.jar" target="jersey-1.1/asm-all-3.1.jar"/>
325.35 - <download url="http://repo2.maven.org/maven2/asm/asm-all/3.1/asm-all-3.1-sources.jar" target="jersey-1.1/asm-all-3.1-sources.jar"/>
325.36 -
325.37 - <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0.jar" target="lucene-3.5.0/lucene-core-3.5.0.jar" />
325.38 - <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0-javadoc.jar" target="lucene-3.5.0/lucene-core-3.5.0-javadoc.jar" />
325.39 - <download url="http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/3.5.0/lucene-core-3.5.0-sources.jar" target="lucene-3.5.0/lucene-core-3.5.0-sources.jar" />
325.40 -
325.41 - <download url="http://repo1.maven.org/maven2/junit/junit/4.5/junit-4.5.jar" target="junit_4/junit-4.5.jar" />
325.42 - <download url="http://switch.dl.sourceforge.net/project/junit/junit/4.5/junit4.5.zip" target="junit_4/junit-4.5-api.zip" />
325.43 - <download url="http://repo1.maven.org/maven2/junit/junit/4.5/junit-4.5-sources.jar" target="junit_4/junit-4.5-src.jar" />
325.44 -
325.45 - <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar" target="junit/junit-3.8.2.jar" />
325.46 - <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2-javadoc.jar" target="junit/junit-3.8.2-javadoc.jar" />
325.47 - <download url="http://repo1.maven.org/maven2/junit/junit/3.8.2/junit-3.8.2-sources.jar" target="junit/junit-3.8.2-sources.jar" />
325.48 -
325.49 - <download url="http://cdn.bitbucket.org/jlahoda/jackpot30/downloads/org-netbeans-modules-java-j2seproject-copylibstask.jar" target="CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar" />
325.50 -
325.51 - <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/org/freemarker/freemarker/2.3.16/freemarker-2.3.16.jar" target="freemarker/freemarker-2.3.16.jar" />
325.52 -
325.53 - <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2.jar" target="jopt-simple/jopt-simple-3.2.jar" />
325.54 - <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2-sources.jar" target="jopt-simple/jopt-simple-3.2-sources.jar" />
325.55 - <download url="http://mirrors.ibiblio.org/pub/mirrors/maven2/net/sf/jopt-simple/jopt-simple/3.2/jopt-simple-3.2-javadoc.jar" target="jopt-simple/jopt-simple-3.2-javadoc.jar" />
325.56 - </target>
325.57 -
325.58 - <target name="-download-check-exists">
325.59 - <available property="file.exists" file="${imported.basedir}/lib/${target}"/>
325.60 - </target>
325.61 -
325.62 - <target name="-download" depends="-download-check-exists" unless="file.exists">
325.63 - <dirname property="dir" file="${imported.basedir}/lib/${target}" />
325.64 - <mkdir dir="${dir}" />
325.65 - <get src="${url}" dest="${imported.basedir}/lib/${target}" usetimestamp="true"/>
325.66 - </target>
325.67 -
325.68 - <target name="-prepare-imported-basedir-property">
325.69 - <dirname property="imported.basedir" file="${ant.file.download}"/>
325.70 - </target>
325.71 - <target name="-post-init" depends="-prepare-imported-basedir-property,download"/>
325.72 -</project>
326.1 --- a/server/indexer/build.xml Sat Feb 18 22:14:42 2012 +0100
326.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
326.3 @@ -1,86 +0,0 @@
326.4 -<?xml version="1.0" encoding="UTF-8"?>
326.5 -<!-- You may freely edit this file. See commented blocks below for -->
326.6 -<!-- some examples of how to customize the build. -->
326.7 -<!-- (If you delete it and reopen the project it will be recreated.) -->
326.8 -<!-- By default, only the Clean and Build commands use this build script. -->
326.9 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
326.10 -<!-- the Compile on Save feature is turned off for the project. -->
326.11 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
326.12 -<!-- in the project's Project Properties dialog box.-->
326.13 -<project name="indexer" default="default" basedir=".">
326.14 - <description>Builds, tests, and runs the project indexer.</description>
326.15 - <import file="../download.xml"/>
326.16 - <import file="nbproject/build-impl.xml"/>
326.17 - <!--
326.18 -
326.19 - There exist several targets which are by default empty and which can be
326.20 - used for execution of your tasks. These targets are usually executed
326.21 - before and after some main targets. They are:
326.22 -
326.23 - -pre-init: called before initialization of project properties
326.24 - -post-init: called after initialization of project properties
326.25 - -pre-compile: called before javac compilation
326.26 - -post-compile: called after javac compilation
326.27 - -pre-compile-single: called before javac compilation of single file
326.28 - -post-compile-single: called after javac compilation of single file
326.29 - -pre-compile-test: called before javac compilation of JUnit tests
326.30 - -post-compile-test: called after javac compilation of JUnit tests
326.31 - -pre-compile-test-single: called before javac compilation of single JUnit test
326.32 - -post-compile-test-single: called after javac compilation of single JUunit test
326.33 - -pre-jar: called before JAR building
326.34 - -post-jar: called after JAR building
326.35 - -post-clean: called after cleaning build products
326.36 -
326.37 - (Targets beginning with '-' are not intended to be called on their own.)
326.38 -
326.39 - Example of inserting an obfuscator after compilation could look like this:
326.40 -
326.41 - <target name="-post-compile">
326.42 - <obfuscate>
326.43 - <fileset dir="${build.classes.dir}"/>
326.44 - </obfuscate>
326.45 - </target>
326.46 -
326.47 - For list of available properties check the imported
326.48 - nbproject/build-impl.xml file.
326.49 -
326.50 -
326.51 - Another way to customize the build is by overriding existing main targets.
326.52 - The targets of interest are:
326.53 -
326.54 - -init-macrodef-javac: defines macro for javac compilation
326.55 - -init-macrodef-junit: defines macro for junit execution
326.56 - -init-macrodef-debug: defines macro for class debugging
326.57 - -init-macrodef-java: defines macro for class execution
326.58 - -do-jar-with-manifest: JAR building (if you are using a manifest)
326.59 - -do-jar-without-manifest: JAR building (if you are not using a manifest)
326.60 - run: execution of project
326.61 - -javadoc-build: Javadoc generation
326.62 - test-report: JUnit report generation
326.63 -
326.64 - An example of overriding the target for project execution could look like this:
326.65 -
326.66 - <target name="run" depends="indexer-impl.jar">
326.67 - <exec dir="bin" executable="launcher.exe">
326.68 - <arg file="${dist.jar}"/>
326.69 - </exec>
326.70 - </target>
326.71 -
326.72 - Notice that the overridden target depends on the jar target and not only on
326.73 - the compile target as the regular run target does. Again, for a list of available
326.74 - properties which you can use, check the target you are overriding in the
326.75 - nbproject/build-impl.xml file.
326.76 -
326.77 - -->
326.78 -
326.79 - <target name="copy-to-hudson" depends="jar">
326.80 - <mkdir dir="${hudson.compiler.dir}" /> <!--only to be sure, should exist-->
326.81 - <copy todir="${hudson.compiler.dir}/indexer">
326.82 - <fileset dir="${dist.dir}"/>
326.83 - </copy>
326.84 - </target>
326.85 -
326.86 - <target name="-post-clean">
326.87 - <delete dir="${hudson.compiler.dir}/indexer"/>
326.88 - </target>
326.89 -</project>
327.1 --- a/server/indexer/manifest.mf Sat Feb 18 22:14:42 2012 +0100
327.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
327.3 @@ -1,3 +0,0 @@
327.4 -Manifest-Version: 1.0
327.5 -X-COMMENT: Main-Class will be added automatically by build
327.6 -
328.1 --- a/server/indexer/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
328.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
328.3 @@ -1,914 +0,0 @@
328.4 -<?xml version="1.0" encoding="UTF-8"?>
328.5 -<!--
328.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
328.7 -*** EDIT ../build.xml INSTEAD ***
328.8 -
328.9 -For the purpose of easier reading the script
328.10 -is divided into following sections:
328.11 -
328.12 - - initialization
328.13 - - compilation
328.14 - - jar
328.15 - - execution
328.16 - - debugging
328.17 - - javadoc
328.18 - - junit compilation
328.19 - - junit execution
328.20 - - junit debugging
328.21 - - applet
328.22 - - cleanup
328.23 -
328.24 - -->
328.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="indexer-impl">
328.26 - <fail message="Please build using Ant 1.7.1 or higher.">
328.27 - <condition>
328.28 - <not>
328.29 - <antversion atleast="1.7.1"/>
328.30 - </not>
328.31 - </condition>
328.32 - </fail>
328.33 - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
328.34 - <!--
328.35 - ======================
328.36 - INITIALIZATION SECTION
328.37 - ======================
328.38 - -->
328.39 - <target name="-pre-init">
328.40 - <!-- Empty placeholder for easier customization. -->
328.41 - <!-- You can override this target in the ../build.xml file. -->
328.42 - </target>
328.43 - <target depends="-pre-init" name="-init-private">
328.44 - <property file="nbproject/private/config.properties"/>
328.45 - <property file="nbproject/private/configs/${config}.properties"/>
328.46 - <property file="nbproject/private/private.properties"/>
328.47 - </target>
328.48 - <target name="-pre-init-libraries">
328.49 - <property location="../lib/nblibraries.properties" name="libraries.path"/>
328.50 - <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
328.51 - <pathconvert dirsep="/" property="libraries.dir">
328.52 - <path path="${libraries.dir.nativedirsep}"/>
328.53 - </pathconvert>
328.54 - <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
328.55 - <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
328.56 - </target>
328.57 - <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
328.58 - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
328.59 - <filterchain>
328.60 - <replacestring from="$${base}" to="${libraries.dir}"/>
328.61 - <escapeunicode/>
328.62 - </filterchain>
328.63 - </loadproperties>
328.64 - </target>
328.65 - <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
328.66 - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
328.67 - <filterchain>
328.68 - <replacestring from="$${base}" to="${libraries.dir}"/>
328.69 - <escapeunicode/>
328.70 - </filterchain>
328.71 - </loadproperties>
328.72 - </target>
328.73 - <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
328.74 - <property file="${user.properties.file}"/>
328.75 - <!-- The two properties below are usually overridden -->
328.76 - <!-- by the active platform. Just a fallback. -->
328.77 - <property name="default.javac.source" value="1.4"/>
328.78 - <property name="default.javac.target" value="1.4"/>
328.79 - </target>
328.80 - <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
328.81 - <property file="nbproject/configs/${config}.properties"/>
328.82 - <property file="nbproject/project.properties"/>
328.83 - </target>
328.84 - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
328.85 - <available file="${manifest.file}" property="manifest.available"/>
328.86 - <condition property="main.class.available">
328.87 - <and>
328.88 - <isset property="main.class"/>
328.89 - <not>
328.90 - <equals arg1="${main.class}" arg2="" trim="true"/>
328.91 - </not>
328.92 - </and>
328.93 - </condition>
328.94 - <condition property="manifest.available+main.class">
328.95 - <and>
328.96 - <isset property="manifest.available"/>
328.97 - <isset property="main.class.available"/>
328.98 - </and>
328.99 - </condition>
328.100 - <condition property="do.mkdist">
328.101 - <and>
328.102 - <isset property="libs.CopyLibs.classpath"/>
328.103 - <not>
328.104 - <istrue value="${mkdist.disabled}"/>
328.105 - </not>
328.106 - </and>
328.107 - </condition>
328.108 - <condition property="manifest.available+main.class+mkdist.available">
328.109 - <and>
328.110 - <istrue value="${manifest.available+main.class}"/>
328.111 - <isset property="do.mkdist"/>
328.112 - </and>
328.113 - </condition>
328.114 - <condition property="manifest.available+mkdist.available">
328.115 - <and>
328.116 - <istrue value="${manifest.available}"/>
328.117 - <isset property="do.mkdist"/>
328.118 - </and>
328.119 - </condition>
328.120 - <condition property="manifest.available-mkdist.available">
328.121 - <or>
328.122 - <istrue value="${manifest.available}"/>
328.123 - <isset property="do.mkdist"/>
328.124 - </or>
328.125 - </condition>
328.126 - <condition property="manifest.available+main.class-mkdist.available">
328.127 - <or>
328.128 - <istrue value="${manifest.available+main.class}"/>
328.129 - <isset property="do.mkdist"/>
328.130 - </or>
328.131 - </condition>
328.132 - <condition property="have.tests">
328.133 - <or>
328.134 - <available file="${test.src.dir}"/>
328.135 - </or>
328.136 - </condition>
328.137 - <condition property="have.sources">
328.138 - <or>
328.139 - <available file="${src.dir}"/>
328.140 - </or>
328.141 - </condition>
328.142 - <condition property="netbeans.home+have.tests">
328.143 - <and>
328.144 - <isset property="netbeans.home"/>
328.145 - <isset property="have.tests"/>
328.146 - </and>
328.147 - </condition>
328.148 - <condition property="no.javadoc.preview">
328.149 - <and>
328.150 - <isset property="javadoc.preview"/>
328.151 - <isfalse value="${javadoc.preview}"/>
328.152 - </and>
328.153 - </condition>
328.154 - <property name="run.jvmargs" value=""/>
328.155 - <property name="javac.compilerargs" value=""/>
328.156 - <property name="work.dir" value="${basedir}"/>
328.157 - <condition property="no.deps">
328.158 - <and>
328.159 - <istrue value="${no.dependencies}"/>
328.160 - </and>
328.161 - </condition>
328.162 - <property name="javac.debug" value="true"/>
328.163 - <property name="javadoc.preview" value="true"/>
328.164 - <property name="application.args" value=""/>
328.165 - <property name="source.encoding" value="${file.encoding}"/>
328.166 - <property name="runtime.encoding" value="${source.encoding}"/>
328.167 - <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
328.168 - <and>
328.169 - <isset property="javadoc.encoding"/>
328.170 - <not>
328.171 - <equals arg1="${javadoc.encoding}" arg2=""/>
328.172 - </not>
328.173 - </and>
328.174 - </condition>
328.175 - <property name="javadoc.encoding.used" value="${source.encoding}"/>
328.176 - <property name="includes" value="**"/>
328.177 - <property name="excludes" value=""/>
328.178 - <property name="do.depend" value="false"/>
328.179 - <condition property="do.depend.true">
328.180 - <istrue value="${do.depend}"/>
328.181 - </condition>
328.182 - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
328.183 - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
328.184 - <length length="0" string="${endorsed.classpath}" when="greater"/>
328.185 - </condition>
328.186 - <property name="javac.fork" value="false"/>
328.187 - </target>
328.188 - <target name="-post-init">
328.189 - <!-- Empty placeholder for easier customization. -->
328.190 - <!-- You can override this target in the ../build.xml file. -->
328.191 - </target>
328.192 - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
328.193 - <fail unless="src.dir">Must set src.dir</fail>
328.194 - <fail unless="test.src.dir">Must set test.src.dir</fail>
328.195 - <fail unless="build.dir">Must set build.dir</fail>
328.196 - <fail unless="dist.dir">Must set dist.dir</fail>
328.197 - <fail unless="build.classes.dir">Must set build.classes.dir</fail>
328.198 - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
328.199 - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
328.200 - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
328.201 - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
328.202 - <fail unless="dist.jar">Must set dist.jar</fail>
328.203 - </target>
328.204 - <target name="-init-macrodef-property">
328.205 - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
328.206 - <attribute name="name"/>
328.207 - <attribute name="value"/>
328.208 - <sequential>
328.209 - <property name="@{name}" value="${@{value}}"/>
328.210 - </sequential>
328.211 - </macrodef>
328.212 - </target>
328.213 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
328.214 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
328.215 - <attribute default="${src.dir}" name="srcdir"/>
328.216 - <attribute default="${build.classes.dir}" name="destdir"/>
328.217 - <attribute default="${javac.classpath}" name="classpath"/>
328.218 - <attribute default="${javac.processorpath}" name="processorpath"/>
328.219 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
328.220 - <attribute default="${includes}" name="includes"/>
328.221 - <attribute default="${excludes}" name="excludes"/>
328.222 - <attribute default="${javac.debug}" name="debug"/>
328.223 - <attribute default="${empty.dir}" name="sourcepath"/>
328.224 - <attribute default="${empty.dir}" name="gensrcdir"/>
328.225 - <element name="customize" optional="true"/>
328.226 - <sequential>
328.227 - <property location="${build.dir}/empty" name="empty.dir"/>
328.228 - <mkdir dir="${empty.dir}"/>
328.229 - <mkdir dir="@{apgeneratedsrcdir}"/>
328.230 - <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}">
328.231 - <src>
328.232 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
328.233 - <include name="*"/>
328.234 - </dirset>
328.235 - </src>
328.236 - <classpath>
328.237 - <path path="@{classpath}"/>
328.238 - </classpath>
328.239 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
328.240 - <compilerarg line="${javac.compilerargs}"/>
328.241 - <compilerarg value="-processorpath"/>
328.242 - <compilerarg path="@{processorpath}"/>
328.243 - <compilerarg line="${ap.processors.internal}"/>
328.244 - <compilerarg value="-s"/>
328.245 - <compilerarg path="@{apgeneratedsrcdir}"/>
328.246 - <compilerarg line="${ap.proc.none.internal}"/>
328.247 - <customize/>
328.248 - </javac>
328.249 - </sequential>
328.250 - </macrodef>
328.251 - </target>
328.252 - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
328.253 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
328.254 - <attribute default="${src.dir}" name="srcdir"/>
328.255 - <attribute default="${build.classes.dir}" name="destdir"/>
328.256 - <attribute default="${javac.classpath}" name="classpath"/>
328.257 - <attribute default="${javac.processorpath}" name="processorpath"/>
328.258 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
328.259 - <attribute default="${includes}" name="includes"/>
328.260 - <attribute default="${excludes}" name="excludes"/>
328.261 - <attribute default="${javac.debug}" name="debug"/>
328.262 - <attribute default="${empty.dir}" name="sourcepath"/>
328.263 - <attribute default="${empty.dir}" name="gensrcdir"/>
328.264 - <element name="customize" optional="true"/>
328.265 - <sequential>
328.266 - <property location="${build.dir}/empty" name="empty.dir"/>
328.267 - <mkdir dir="${empty.dir}"/>
328.268 - <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}">
328.269 - <src>
328.270 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
328.271 - <include name="*"/>
328.272 - </dirset>
328.273 - </src>
328.274 - <classpath>
328.275 - <path path="@{classpath}"/>
328.276 - </classpath>
328.277 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
328.278 - <compilerarg line="${javac.compilerargs}"/>
328.279 - <customize/>
328.280 - </javac>
328.281 - </sequential>
328.282 - </macrodef>
328.283 - </target>
328.284 - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
328.285 - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
328.286 - <attribute default="${src.dir}" name="srcdir"/>
328.287 - <attribute default="${build.classes.dir}" name="destdir"/>
328.288 - <attribute default="${javac.classpath}" name="classpath"/>
328.289 - <sequential>
328.290 - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
328.291 - <classpath>
328.292 - <path path="@{classpath}"/>
328.293 - </classpath>
328.294 - </depend>
328.295 - </sequential>
328.296 - </macrodef>
328.297 - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
328.298 - <attribute default="${build.classes.dir}" name="destdir"/>
328.299 - <sequential>
328.300 - <fail unless="javac.includes">Must set javac.includes</fail>
328.301 - <pathconvert pathsep="," property="javac.includes.binary">
328.302 - <path>
328.303 - <filelist dir="@{destdir}" files="${javac.includes}"/>
328.304 - </path>
328.305 - <globmapper from="*.java" to="*.class"/>
328.306 - </pathconvert>
328.307 - <delete>
328.308 - <files includes="${javac.includes.binary}"/>
328.309 - </delete>
328.310 - </sequential>
328.311 - </macrodef>
328.312 - </target>
328.313 - <target name="-init-macrodef-junit">
328.314 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
328.315 - <attribute default="${includes}" name="includes"/>
328.316 - <attribute default="${excludes}" name="excludes"/>
328.317 - <attribute default="**" name="testincludes"/>
328.318 - <sequential>
328.319 - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
328.320 - <batchtest todir="${build.test.results.dir}">
328.321 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
328.322 - <filename name="@{testincludes}"/>
328.323 - </fileset>
328.324 - </batchtest>
328.325 - <classpath>
328.326 - <path path="${run.test.classpath}"/>
328.327 - </classpath>
328.328 - <syspropertyset>
328.329 - <propertyref prefix="test-sys-prop."/>
328.330 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
328.331 - </syspropertyset>
328.332 - <formatter type="brief" usefile="false"/>
328.333 - <formatter type="xml"/>
328.334 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
328.335 - <jvmarg line="${run.jvmargs}"/>
328.336 - </junit>
328.337 - </sequential>
328.338 - </macrodef>
328.339 - </target>
328.340 - <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
328.341 - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
328.342 - <attribute default="${main.class}" name="name"/>
328.343 - <attribute default="${debug.classpath}" name="classpath"/>
328.344 - <attribute default="" name="stopclassname"/>
328.345 - <sequential>
328.346 - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
328.347 - <classpath>
328.348 - <path path="@{classpath}"/>
328.349 - </classpath>
328.350 - </nbjpdastart>
328.351 - </sequential>
328.352 - </macrodef>
328.353 - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
328.354 - <attribute default="${build.classes.dir}" name="dir"/>
328.355 - <sequential>
328.356 - <nbjpdareload>
328.357 - <fileset dir="@{dir}" includes="${fix.classes}">
328.358 - <include name="${fix.includes}*.class"/>
328.359 - </fileset>
328.360 - </nbjpdareload>
328.361 - </sequential>
328.362 - </macrodef>
328.363 - </target>
328.364 - <target name="-init-debug-args">
328.365 - <property name="version-output" value="java version "${ant.java.version}"/>
328.366 - <condition property="have-jdk-older-than-1.4">
328.367 - <or>
328.368 - <contains string="${version-output}" substring="java version "1.0"/>
328.369 - <contains string="${version-output}" substring="java version "1.1"/>
328.370 - <contains string="${version-output}" substring="java version "1.2"/>
328.371 - <contains string="${version-output}" substring="java version "1.3"/>
328.372 - </or>
328.373 - </condition>
328.374 - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
328.375 - <istrue value="${have-jdk-older-than-1.4}"/>
328.376 - </condition>
328.377 - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
328.378 - <os family="windows"/>
328.379 - </condition>
328.380 - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
328.381 - <isset property="debug.transport"/>
328.382 - </condition>
328.383 - </target>
328.384 - <target depends="-init-debug-args" name="-init-macrodef-debug">
328.385 - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
328.386 - <attribute default="${main.class}" name="classname"/>
328.387 - <attribute default="${debug.classpath}" name="classpath"/>
328.388 - <element name="customize" optional="true"/>
328.389 - <sequential>
328.390 - <java classname="@{classname}" dir="${work.dir}" fork="true">
328.391 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
328.392 - <jvmarg line="${debug-args-line}"/>
328.393 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
328.394 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
328.395 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
328.396 - <jvmarg line="${run.jvmargs}"/>
328.397 - <classpath>
328.398 - <path path="@{classpath}"/>
328.399 - </classpath>
328.400 - <syspropertyset>
328.401 - <propertyref prefix="run-sys-prop."/>
328.402 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
328.403 - </syspropertyset>
328.404 - <customize/>
328.405 - </java>
328.406 - </sequential>
328.407 - </macrodef>
328.408 - </target>
328.409 - <target name="-init-macrodef-java">
328.410 - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
328.411 - <attribute default="${main.class}" name="classname"/>
328.412 - <attribute default="${run.classpath}" name="classpath"/>
328.413 - <element name="customize" optional="true"/>
328.414 - <sequential>
328.415 - <java classname="@{classname}" dir="${work.dir}" fork="true">
328.416 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
328.417 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
328.418 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
328.419 - <jvmarg line="${run.jvmargs}"/>
328.420 - <classpath>
328.421 - <path path="@{classpath}"/>
328.422 - </classpath>
328.423 - <syspropertyset>
328.424 - <propertyref prefix="run-sys-prop."/>
328.425 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
328.426 - </syspropertyset>
328.427 - <customize/>
328.428 - </java>
328.429 - </sequential>
328.430 - </macrodef>
328.431 - </target>
328.432 - <target name="-init-presetdef-jar">
328.433 - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
328.434 - <jar compress="${jar.compress}" jarfile="${dist.jar}">
328.435 - <j2seproject1:fileset dir="${build.classes.dir}"/>
328.436 - </jar>
328.437 - </presetdef>
328.438 - </target>
328.439 - <target name="-init-ap-cmdline-properties">
328.440 - <property name="annotation.processing.enabled" value="true"/>
328.441 - <property name="annotation.processing.processors.list" value=""/>
328.442 - <property name="annotation.processing.run.all.processors" value="true"/>
328.443 - <property name="javac.processorpath" value="${javac.classpath}"/>
328.444 - <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
328.445 - <condition property="ap.supported.internal" value="true">
328.446 - <not>
328.447 - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
328.448 - </not>
328.449 - </condition>
328.450 - </target>
328.451 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
328.452 - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
328.453 - <isfalse value="${annotation.processing.run.all.processors}"/>
328.454 - </condition>
328.455 - <condition else="" property="ap.proc.none.internal" value="-proc:none">
328.456 - <isfalse value="${annotation.processing.enabled}"/>
328.457 - </condition>
328.458 - </target>
328.459 - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
328.460 - <property name="ap.cmd.line.internal" value=""/>
328.461 - </target>
328.462 - <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-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
328.463 - <!--
328.464 - ===================
328.465 - COMPILATION SECTION
328.466 - ===================
328.467 - -->
328.468 - <target name="-deps-jar-init" unless="built-jar.properties">
328.469 - <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
328.470 - <delete file="${built-jar.properties}" quiet="true"/>
328.471 - </target>
328.472 - <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
328.473 - <echo level="warn" message="Cycle detected: indexer was already built"/>
328.474 - </target>
328.475 - <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
328.476 - <mkdir dir="${build.dir}"/>
328.477 - <touch file="${built-jar.properties}" verbose="false"/>
328.478 - <property file="${built-jar.properties}" prefix="already.built.jar."/>
328.479 - <antcall target="-warn-already-built-jar"/>
328.480 - <propertyfile file="${built-jar.properties}">
328.481 - <entry key="${basedir}" value=""/>
328.482 - </propertyfile>
328.483 - <antcall target="-maybe-call-dep">
328.484 - <param name="call.built.properties" value="${built-jar.properties}"/>
328.485 - <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
328.486 - <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
328.487 - <param name="call.target" value="netbeans"/>
328.488 - <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
328.489 - </antcall>
328.490 - </target>
328.491 - <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
328.492 - <target depends="init" name="-check-automatic-build">
328.493 - <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
328.494 - </target>
328.495 - <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
328.496 - <antcall target="clean"/>
328.497 - </target>
328.498 - <target depends="init,deps-jar" name="-pre-pre-compile">
328.499 - <mkdir dir="${build.classes.dir}"/>
328.500 - </target>
328.501 - <target name="-pre-compile">
328.502 - <!-- Empty placeholder for easier customization. -->
328.503 - <!-- You can override this target in the ../build.xml file. -->
328.504 - </target>
328.505 - <target if="do.depend.true" name="-compile-depend">
328.506 - <pathconvert property="build.generated.subdirs">
328.507 - <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
328.508 - <include name="*"/>
328.509 - </dirset>
328.510 - </pathconvert>
328.511 - <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
328.512 - </target>
328.513 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
328.514 - <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
328.515 - <copy todir="${build.classes.dir}">
328.516 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
328.517 - </copy>
328.518 - </target>
328.519 - <target name="-post-compile">
328.520 - <!-- Empty placeholder for easier customization. -->
328.521 - <!-- You can override this target in the ../build.xml file. -->
328.522 - </target>
328.523 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
328.524 - <target name="-pre-compile-single">
328.525 - <!-- Empty placeholder for easier customization. -->
328.526 - <!-- You can override this target in the ../build.xml file. -->
328.527 - </target>
328.528 - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
328.529 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
328.530 - <j2seproject3:force-recompile/>
328.531 - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
328.532 - </target>
328.533 - <target name="-post-compile-single">
328.534 - <!-- Empty placeholder for easier customization. -->
328.535 - <!-- You can override this target in the ../build.xml file. -->
328.536 - </target>
328.537 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
328.538 - <!--
328.539 - ====================
328.540 - JAR BUILDING SECTION
328.541 - ====================
328.542 - -->
328.543 - <target depends="init" name="-pre-pre-jar">
328.544 - <dirname file="${dist.jar}" property="dist.jar.dir"/>
328.545 - <mkdir dir="${dist.jar.dir}"/>
328.546 - </target>
328.547 - <target name="-pre-jar">
328.548 - <!-- Empty placeholder for easier customization. -->
328.549 - <!-- You can override this target in the ../build.xml file. -->
328.550 - </target>
328.551 - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
328.552 - <j2seproject1:jar/>
328.553 - </target>
328.554 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
328.555 - <j2seproject1:jar manifest="${manifest.file}"/>
328.556 - </target>
328.557 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
328.558 - <j2seproject1:jar manifest="${manifest.file}">
328.559 - <j2seproject1:manifest>
328.560 - <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
328.561 - </j2seproject1:manifest>
328.562 - </j2seproject1:jar>
328.563 - <echo>To run this application from the command line without Ant, try:</echo>
328.564 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
328.565 - <property location="${dist.jar}" name="dist.jar.resolved"/>
328.566 - <pathconvert property="run.classpath.with.dist.jar">
328.567 - <path path="${run.classpath}"/>
328.568 - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
328.569 - </pathconvert>
328.570 - <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
328.571 - </target>
328.572 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
328.573 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
328.574 - <pathconvert property="run.classpath.without.build.classes.dir">
328.575 - <path path="${run.classpath}"/>
328.576 - <map from="${build.classes.dir.resolved}" to=""/>
328.577 - </pathconvert>
328.578 - <pathconvert pathsep=" " property="jar.classpath">
328.579 - <path path="${run.classpath.without.build.classes.dir}"/>
328.580 - <chainedmapper>
328.581 - <flattenmapper/>
328.582 - <globmapper from="*" to="lib/*"/>
328.583 - </chainedmapper>
328.584 - </pathconvert>
328.585 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
328.586 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
328.587 - <fileset dir="${build.classes.dir}"/>
328.588 - <manifest>
328.589 - <attribute name="Main-Class" value="${main.class}"/>
328.590 - <attribute name="Class-Path" value="${jar.classpath}"/>
328.591 - </manifest>
328.592 - </copylibs>
328.593 - <echo>To run this application from the command line without Ant, try:</echo>
328.594 - <property location="${dist.jar}" name="dist.jar.resolved"/>
328.595 - <echo>java -jar "${dist.jar.resolved}"</echo>
328.596 - </target>
328.597 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
328.598 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
328.599 - <pathconvert property="run.classpath.without.build.classes.dir">
328.600 - <path path="${run.classpath}"/>
328.601 - <map from="${build.classes.dir.resolved}" to=""/>
328.602 - </pathconvert>
328.603 - <pathconvert pathsep=" " property="jar.classpath">
328.604 - <path path="${run.classpath.without.build.classes.dir}"/>
328.605 - <chainedmapper>
328.606 - <flattenmapper/>
328.607 - <globmapper from="*" to="lib/*"/>
328.608 - </chainedmapper>
328.609 - </pathconvert>
328.610 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
328.611 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
328.612 - <fileset dir="${build.classes.dir}"/>
328.613 - <manifest>
328.614 - <attribute name="Class-Path" value="${jar.classpath}"/>
328.615 - </manifest>
328.616 - </copylibs>
328.617 - </target>
328.618 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
328.619 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
328.620 - <pathconvert property="run.classpath.without.build.classes.dir">
328.621 - <path path="${run.classpath}"/>
328.622 - <map from="${build.classes.dir.resolved}" to=""/>
328.623 - </pathconvert>
328.624 - <pathconvert pathsep=" " property="jar.classpath">
328.625 - <path path="${run.classpath.without.build.classes.dir}"/>
328.626 - <chainedmapper>
328.627 - <flattenmapper/>
328.628 - <globmapper from="*" to="lib/*"/>
328.629 - </chainedmapper>
328.630 - </pathconvert>
328.631 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
328.632 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
328.633 - <fileset dir="${build.classes.dir}"/>
328.634 - <manifest>
328.635 - <attribute name="Class-Path" value="${jar.classpath}"/>
328.636 - </manifest>
328.637 - </copylibs>
328.638 - </target>
328.639 - <target name="-post-jar">
328.640 - <!-- Empty placeholder for easier customization. -->
328.641 - <!-- You can override this target in the ../build.xml file. -->
328.642 - </target>
328.643 - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
328.644 - <!--
328.645 - =================
328.646 - EXECUTION SECTION
328.647 - =================
328.648 - -->
328.649 - <target depends="init,compile" description="Run a main class." name="run">
328.650 - <j2seproject1:java>
328.651 - <customize>
328.652 - <arg line="${application.args}"/>
328.653 - </customize>
328.654 - </j2seproject1:java>
328.655 - </target>
328.656 - <target name="-do-not-recompile">
328.657 - <property name="javac.includes.binary" value=""/>
328.658 - </target>
328.659 - <target depends="init,compile-single" name="run-single">
328.660 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
328.661 - <j2seproject1:java classname="${run.class}"/>
328.662 - </target>
328.663 - <target depends="init,compile-test-single" name="run-test-with-main">
328.664 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
328.665 - <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
328.666 - </target>
328.667 - <!--
328.668 - =================
328.669 - DEBUGGING SECTION
328.670 - =================
328.671 - -->
328.672 - <target depends="init" if="netbeans.home" name="-debug-start-debugger">
328.673 - <j2seproject1:nbjpdastart name="${debug.class}"/>
328.674 - </target>
328.675 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
328.676 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
328.677 - </target>
328.678 - <target depends="init,compile" name="-debug-start-debuggee">
328.679 - <j2seproject3:debug>
328.680 - <customize>
328.681 - <arg line="${application.args}"/>
328.682 - </customize>
328.683 - </j2seproject3:debug>
328.684 - </target>
328.685 - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
328.686 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
328.687 - <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
328.688 - </target>
328.689 - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
328.690 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
328.691 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
328.692 - <j2seproject3:debug classname="${debug.class}"/>
328.693 - </target>
328.694 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
328.695 - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
328.696 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
328.697 - <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
328.698 - </target>
328.699 - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
328.700 - <target depends="init" name="-pre-debug-fix">
328.701 - <fail unless="fix.includes">Must set fix.includes</fail>
328.702 - <property name="javac.includes" value="${fix.includes}.java"/>
328.703 - </target>
328.704 - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
328.705 - <j2seproject1:nbjpdareload/>
328.706 - </target>
328.707 - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
328.708 - <!--
328.709 - ===============
328.710 - JAVADOC SECTION
328.711 - ===============
328.712 - -->
328.713 - <target depends="init" name="-javadoc-build">
328.714 - <mkdir dir="${dist.javadoc.dir}"/>
328.715 - <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}">
328.716 - <classpath>
328.717 - <path path="${javac.classpath}"/>
328.718 - </classpath>
328.719 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
328.720 - <filename name="**/*.java"/>
328.721 - </fileset>
328.722 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
328.723 - <include name="**/*.java"/>
328.724 - </fileset>
328.725 - </javadoc>
328.726 - </target>
328.727 - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
328.728 - <nbbrowse file="${dist.javadoc.dir}/index.html"/>
328.729 - </target>
328.730 - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
328.731 - <!--
328.732 - =========================
328.733 - JUNIT COMPILATION SECTION
328.734 - =========================
328.735 - -->
328.736 - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
328.737 - <mkdir dir="${build.test.classes.dir}"/>
328.738 - </target>
328.739 - <target name="-pre-compile-test">
328.740 - <!-- Empty placeholder for easier customization. -->
328.741 - <!-- You can override this target in the ../build.xml file. -->
328.742 - </target>
328.743 - <target if="do.depend.true" name="-compile-test-depend">
328.744 - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
328.745 - </target>
328.746 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
328.747 - <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}"/>
328.748 - <copy todir="${build.test.classes.dir}">
328.749 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
328.750 - </copy>
328.751 - </target>
328.752 - <target name="-post-compile-test">
328.753 - <!-- Empty placeholder for easier customization. -->
328.754 - <!-- You can override this target in the ../build.xml file. -->
328.755 - </target>
328.756 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
328.757 - <target name="-pre-compile-test-single">
328.758 - <!-- Empty placeholder for easier customization. -->
328.759 - <!-- You can override this target in the ../build.xml file. -->
328.760 - </target>
328.761 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
328.762 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
328.763 - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
328.764 - <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}"/>
328.765 - <copy todir="${build.test.classes.dir}">
328.766 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
328.767 - </copy>
328.768 - </target>
328.769 - <target name="-post-compile-test-single">
328.770 - <!-- Empty placeholder for easier customization. -->
328.771 - <!-- You can override this target in the ../build.xml file. -->
328.772 - </target>
328.773 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
328.774 - <!--
328.775 - =======================
328.776 - JUNIT EXECUTION SECTION
328.777 - =======================
328.778 - -->
328.779 - <target depends="init" if="have.tests" name="-pre-test-run">
328.780 - <mkdir dir="${build.test.results.dir}"/>
328.781 - </target>
328.782 - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
328.783 - <j2seproject3:junit testincludes="**/*Test.java"/>
328.784 - </target>
328.785 - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
328.786 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
328.787 - </target>
328.788 - <target depends="init" if="have.tests" name="test-report"/>
328.789 - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
328.790 - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
328.791 - <target depends="init" if="have.tests" name="-pre-test-run-single">
328.792 - <mkdir dir="${build.test.results.dir}"/>
328.793 - </target>
328.794 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
328.795 - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
328.796 - <j2seproject3:junit excludes="" includes="${test.includes}"/>
328.797 - </target>
328.798 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
328.799 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
328.800 - </target>
328.801 - <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"/>
328.802 - <!--
328.803 - =======================
328.804 - JUNIT DEBUGGING SECTION
328.805 - =======================
328.806 - -->
328.807 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
328.808 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
328.809 - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
328.810 - <delete file="${test.report.file}"/>
328.811 - <mkdir dir="${build.test.results.dir}"/>
328.812 - <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}">
328.813 - <customize>
328.814 - <syspropertyset>
328.815 - <propertyref prefix="test-sys-prop."/>
328.816 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
328.817 - </syspropertyset>
328.818 - <arg value="${test.class}"/>
328.819 - <arg value="showoutput=true"/>
328.820 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
328.821 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
328.822 - </customize>
328.823 - </j2seproject3:debug>
328.824 - </target>
328.825 - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
328.826 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
328.827 - </target>
328.828 - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
328.829 - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
328.830 - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
328.831 - </target>
328.832 - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
328.833 - <!--
328.834 - =========================
328.835 - APPLET EXECUTION SECTION
328.836 - =========================
328.837 - -->
328.838 - <target depends="init,compile-single" name="run-applet">
328.839 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
328.840 - <j2seproject1:java classname="sun.applet.AppletViewer">
328.841 - <customize>
328.842 - <arg value="${applet.url}"/>
328.843 - </customize>
328.844 - </j2seproject1:java>
328.845 - </target>
328.846 - <!--
328.847 - =========================
328.848 - APPLET DEBUGGING SECTION
328.849 - =========================
328.850 - -->
328.851 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
328.852 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
328.853 - <j2seproject3:debug classname="sun.applet.AppletViewer">
328.854 - <customize>
328.855 - <arg value="${applet.url}"/>
328.856 - </customize>
328.857 - </j2seproject3:debug>
328.858 - </target>
328.859 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
328.860 - <!--
328.861 - ===============
328.862 - CLEANUP SECTION
328.863 - ===============
328.864 - -->
328.865 - <target name="-deps-clean-init" unless="built-clean.properties">
328.866 - <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
328.867 - <delete file="${built-clean.properties}" quiet="true"/>
328.868 - </target>
328.869 - <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
328.870 - <echo level="warn" message="Cycle detected: indexer was already built"/>
328.871 - </target>
328.872 - <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
328.873 - <mkdir dir="${build.dir}"/>
328.874 - <touch file="${built-clean.properties}" verbose="false"/>
328.875 - <property file="${built-clean.properties}" prefix="already.built.clean."/>
328.876 - <antcall target="-warn-already-built-clean"/>
328.877 - <propertyfile file="${built-clean.properties}">
328.878 - <entry key="${basedir}" value=""/>
328.879 - </propertyfile>
328.880 - <antcall target="-maybe-call-dep">
328.881 - <param name="call.built.properties" value="${built-clean.properties}"/>
328.882 - <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
328.883 - <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
328.884 - <param name="call.target" value="clean"/>
328.885 - <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
328.886 - </antcall>
328.887 - </target>
328.888 - <target depends="init" name="-do-clean">
328.889 - <delete dir="${build.dir}"/>
328.890 - <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
328.891 - </target>
328.892 - <target name="-post-clean">
328.893 - <!-- Empty placeholder for easier customization. -->
328.894 - <!-- You can override this target in the ../build.xml file. -->
328.895 - </target>
328.896 - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
328.897 - <target name="-check-call-dep">
328.898 - <property file="${call.built.properties}" prefix="already.built."/>
328.899 - <condition property="should.call.dep">
328.900 - <not>
328.901 - <isset property="already.built.${call.subproject}"/>
328.902 - </not>
328.903 - </condition>
328.904 - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
328.905 - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:${toString:endorsed.classpath.path}">
328.906 - <length length="0" string="${endorsed.classpath}" when="greater"/>
328.907 - </condition>
328.908 - </target>
328.909 - <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
328.910 - <ant antfile="${call.script}" inheritall="false" target="${call.target}">
328.911 - <propertyset>
328.912 - <propertyref prefix="transfer."/>
328.913 - <mapper from="transfer.*" to="*" type="glob"/>
328.914 - </propertyset>
328.915 - </ant>
328.916 - </target>
328.917 -</project>
329.1 --- a/server/indexer/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
329.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
329.3 @@ -1,8 +0,0 @@
329.4 -build.xml.data.CRC32=8f49f787
329.5 -build.xml.script.CRC32=48d52495
329.6 -build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
329.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
329.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
329.9 -nbproject/build-impl.xml.data.CRC32=8f49f787
329.10 -nbproject/build-impl.xml.script.CRC32=81f22719
329.11 -nbproject/build-impl.xml.stylesheet.CRC32=1cdc5be9@1.35.0.45
330.1 --- a/server/indexer/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
330.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
330.3 @@ -1,95 +0,0 @@
330.4 -annotation.processing.enabled=true
330.5 -annotation.processing.enabled.in.editor=false
330.6 -annotation.processing.run.all.processors=true
330.7 -application.title=indexer
330.8 -application.vendor=lahvac
330.9 -build.classes.dir=${build.dir}/classes
330.10 -build.classes.excludes=**/*.java,**/*.form
330.11 -# This directory is removed when the project is cleaned:
330.12 -build.dir=build
330.13 -build.generated.dir=${build.dir}/generated
330.14 -build.generated.sources.dir=${build.dir}/generated-sources
330.15 -# Only compile against the classpath explicitly listed here:
330.16 -build.sysclasspath=ignore
330.17 -build.test.classes.dir=${build.dir}/test/classes
330.18 -build.test.results.dir=${build.dir}/test/results
330.19 -# Uncomment to specify the preferred debugger connection transport:
330.20 -#debug.transport=dt_socket
330.21 -debug.classpath=\
330.22 - ${run.classpath}
330.23 -debug.test.classpath=\
330.24 - ${run.test.classpath}
330.25 -# This directory is removed when the project is cleaned:
330.26 -dist.dir=dist
330.27 -dist.jar=${dist.dir}/indexer.jar
330.28 -dist.javadoc.dir=${dist.dir}/javadoc
330.29 -endorsed.classpath=\
330.30 - ${libs.javac.classpath}
330.31 -excludes=
330.32 -file.reference.org-netbeans-modules-java-hints.jar=../lib/org-netbeans-modules-java-hints.jar
330.33 -file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
330.34 -file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
330.35 -file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
330.36 -file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
330.37 -file.reference.org-openide-util.jar=../lib/org-openide-util.jar
330.38 -file.reference.util-commons.jar-1=../../remoting/ide/api/external/util-commons.jar
330.39 -file.reference.util-pojson.jar-1=../../remoting/ide/api/external/util-pojson.jar
330.40 -includes=**
330.41 -jar.compress=false
330.42 -javac.classpath=\
330.43 - ${reference.org_netbeans_modules_jackpot30_api.module}:\
330.44 - ${libs.lucene.classpath}:\
330.45 - ${libs.javac.classpath}:\
330.46 - ${file.reference.org-netbeans-modules-java-source.jar}:\
330.47 - ${file.reference.org-openide-filesystems.jar}:\
330.48 - ${file.reference.org-openide-util.jar}:\
330.49 - ${file.reference.org-openide-util-lookup.jar}:\
330.50 - ${file.reference.org-netbeans-spi-editor-hints.jar}:\
330.51 - ${file.reference.org-netbeans-modules-java-hints.jar}:\
330.52 - ${file.reference.util-commons.jar-1}:\
330.53 - ${file.reference.util-pojson.jar-1}
330.54 -# Space-separated list of extra javac options
330.55 -javac.compilerargs=
330.56 -javac.deprecation=false
330.57 -javac.processorpath=\
330.58 - ${javac.classpath}
330.59 -javac.source=1.5
330.60 -javac.target=1.5
330.61 -javac.test.classpath=\
330.62 - ${javac.classpath}:\
330.63 - ${build.classes.dir}:\
330.64 - ${libs.junit_4.classpath}
330.65 -javadoc.additionalparam=
330.66 -javadoc.author=false
330.67 -javadoc.encoding=${source.encoding}
330.68 -javadoc.noindex=false
330.69 -javadoc.nonavbar=false
330.70 -javadoc.notree=false
330.71 -javadoc.private=false
330.72 -javadoc.splitindex=true
330.73 -javadoc.use=true
330.74 -javadoc.version=false
330.75 -javadoc.windowtitle=
330.76 -jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
330.77 -main.class=org.netbeans.modules.jackpot30.server.indexer.Index
330.78 -manifest.file=manifest.mf
330.79 -meta.inf.dir=${src.dir}/META-INF
330.80 -mkdist.disabled=false
330.81 -platform.active=default_platform
330.82 -project.org_netbeans_modules_jackpot30_api=../../api
330.83 -reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
330.84 -run.classpath=\
330.85 - ${javac.classpath}:\
330.86 - ${build.classes.dir}
330.87 -# Space-separated list of JVM arguments used when running the project
330.88 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
330.89 -# or test-sys-prop.name=value to set system properties for unit tests):
330.90 -run.jvmargs=
330.91 -run.test.classpath=\
330.92 - ${javac.test.classpath}:\
330.93 - ${build.test.classes.dir}
330.94 -source.encoding=UTF-8
330.95 -src.dir=src
330.96 -test.src.dir=test
330.97 -
330.98 -hudson.compiler.dir=../hudson/data/compiler
331.1 --- a/server/indexer/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
331.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
331.3 @@ -1,28 +0,0 @@
331.4 -<?xml version="1.0" encoding="UTF-8"?>
331.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
331.6 - <type>org.netbeans.modules.java.j2seproject</type>
331.7 - <configuration>
331.8 - <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
331.9 - <name>indexer</name>
331.10 - <source-roots>
331.11 - <root id="src.dir"/>
331.12 - </source-roots>
331.13 - <test-roots>
331.14 - <root id="test.src.dir"/>
331.15 - </test-roots>
331.16 - </data>
331.17 - <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
331.18 - <definitions>../lib/nblibraries.properties</definitions>
331.19 - </libraries>
331.20 - <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
331.21 - <reference>
331.22 - <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
331.23 - <artifact-type>jar</artifact-type>
331.24 - <script>build.xml</script>
331.25 - <target>netbeans</target>
331.26 - <clean-target>clean</clean-target>
331.27 - <id>module</id>
331.28 - </reference>
331.29 - </references>
331.30 - </configuration>
331.31 -</project>
332.1 --- a/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/Index.java Sat Feb 18 22:14:42 2012 +0100
332.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
332.3 @@ -1,106 +0,0 @@
332.4 -/*
332.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
332.6 - *
332.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
332.8 - *
332.9 - * The contents of this file are subject to the terms of either the GNU
332.10 - * General Public License Version 2 only ("GPL") or the Common
332.11 - * Development and Distribution License("CDDL") (collectively, the
332.12 - * "License"). You may not use this file except in compliance with the
332.13 - * License. You can obtain a copy of the License at
332.14 - * http://www.netbeans.org/cddl-gplv2.html
332.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
332.16 - * specific language governing permissions and limitations under the
332.17 - * License. When distributing the software, include this License Header
332.18 - * Notice in each file and include the License file at
332.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
332.20 - * particular file as subject to the "Classpath" exception as provided
332.21 - * by Sun in the GPL Version 2 section of the License file that
332.22 - * accompanied this code. If applicable, add the following below the
332.23 - * License Header, with the fields enclosed by brackets [] replaced by
332.24 - * your own identifying information:
332.25 - * "Portions Copyrighted [year] [name of copyright owner]"
332.26 - *
332.27 - * If you wish your version of this file to be governed by only the CDDL
332.28 - * or only the GPL Version 2, indicate your decision by adding
332.29 - * "[Contributor] elects to include this software in this distribution
332.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
332.31 - * single choice of license, a recipient has the option to distribute
332.32 - * your version of this file under either the CDDL, the GPL Version 2 or
332.33 - * to extend the choice of license to its licensees as provided above.
332.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
332.35 - * Version 2 license, then the option applies only if the new code is
332.36 - * made subject to such option by the copyright holder.
332.37 - *
332.38 - * Contributor(s):
332.39 - *
332.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
332.41 - */
332.42 -
332.43 -package org.netbeans.modules.jackpot30.server.indexer;
332.44 -
332.45 -import java.io.File;
332.46 -import java.io.IOException;
332.47 -import java.util.ArrayList;
332.48 -import java.util.Arrays;
332.49 -import java.util.List;
332.50 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
332.51 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
332.52 -
332.53 -/**
332.54 - *
332.55 - * @author lahvac
332.56 - */
332.57 -public class Index {
332.58 -
332.59 - static final String PARAM_CONSTRUCT_DUPLICATES_INDEX = "-construct-duplicates-index";
332.60 - static final String PARAM_STORE_SOURCES = "-store-sources";
332.61 -
332.62 - /**
332.63 - * @param args the command line arguments
332.64 - */
332.65 - public static void main(String[] args) throws IOException {
332.66 - new Index().index(args);
332.67 - }
332.68 -
332.69 - void index(String[] args) throws IOException {
332.70 - List<String> argsList = new ArrayList<String>(Arrays.asList(args));
332.71 - boolean constructDuplicatesIndex = !argsList.isEmpty() && PARAM_CONSTRUCT_DUPLICATES_INDEX.equals(argsList.get(0));
332.72 -
332.73 - if (constructDuplicatesIndex) argsList.remove(0);
332.74 -
332.75 - boolean storeSources = !argsList.isEmpty() && PARAM_STORE_SOURCES.equals(argsList.get(0));
332.76 -
332.77 - if (storeSources) argsList.remove(0);
332.78 -
332.79 - String modified = null;
332.80 - String removed = null;
332.81 -
332.82 - if (argsList.size() != 2 && argsList.size() != 4) {
332.83 - printHelp();
332.84 - return ;
332.85 - }
332.86 -
332.87 - if (argsList.size() == 4) {
332.88 - modified = argsList.get(2);
332.89 - removed = argsList.get(3);
332.90 - }
332.91 -
332.92 - long startTime = System.currentTimeMillis();
332.93 -
332.94 - Cache.setStandaloneCacheRoot(new File(argsList.get(1)));
332.95 - invokeIndexer(new File(argsList.get(0)), constructDuplicatesIndex, storeSources, modified, removed);
332.96 -
332.97 - long endTime = System.currentTimeMillis();
332.98 -
332.99 - System.out.println("indexing took: " + Utilities.toHumanReadableTime(endTime - startTime));
332.100 - }
332.101 -
332.102 - protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
332.103 - StandaloneIndexer.index(root, duplicatesIndex, storeSources, modified, removed);
332.104 - }
332.105 -
332.106 - protected void printHelp() {
332.107 - System.err.println("Usage: java -jar " + Index.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " [" + PARAM_CONSTRUCT_DUPLICATES_INDEX + "] [" + PARAM_STORE_SOURCES + "] <source-root> <cache> [<modified-files> <removed-files>]");
332.108 - }
332.109 -}
333.1 --- a/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinder.java Sat Feb 18 22:14:42 2012 +0100
333.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
333.3 @@ -1,202 +0,0 @@
333.4 -/*
333.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
333.6 - *
333.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
333.8 - *
333.9 - * The contents of this file are subject to the terms of either the GNU
333.10 - * General Public License Version 2 only ("GPL") or the Common
333.11 - * Development and Distribution License("CDDL") (collectively, the
333.12 - * "License"). You may not use this file except in compliance with the
333.13 - * License. You can obtain a copy of the License at
333.14 - * http://www.netbeans.org/cddl-gplv2.html
333.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
333.16 - * specific language governing permissions and limitations under the
333.17 - * License. When distributing the software, include this License Header
333.18 - * Notice in each file and include the License file at
333.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
333.20 - * particular file as subject to the "Classpath" exception as provided
333.21 - * by Sun in the GPL Version 2 section of the License file that
333.22 - * accompanied this code. If applicable, add the following below the
333.23 - * License Header, with the fields enclosed by brackets [] replaced by
333.24 - * your own identifying information:
333.25 - * "Portions Copyrighted [year] [name of copyright owner]"
333.26 - *
333.27 - * If you wish your version of this file to be governed by only the CDDL
333.28 - * or only the GPL Version 2, indicate your decision by adding
333.29 - * "[Contributor] elects to include this software in this distribution
333.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
333.31 - * single choice of license, a recipient has the option to distribute
333.32 - * your version of this file under either the CDDL, the GPL Version 2 or
333.33 - * to extend the choice of license to its licensees as provided above.
333.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
333.35 - * Version 2 license, then the option applies only if the new code is
333.36 - * made subject to such option by the copyright holder.
333.37 - *
333.38 - * Contributor(s):
333.39 - *
333.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
333.41 - */
333.42 -
333.43 -package org.netbeans.modules.jackpot30.server.indexer;
333.44 -
333.45 -import com.sun.source.tree.CompilationUnitTree;
333.46 -import com.sun.source.tree.Tree;
333.47 -import com.sun.source.util.TreePath;
333.48 -import com.sun.source.util.Trees;
333.49 -import com.sun.tools.javac.api.JavacTaskImpl;
333.50 -import java.io.File;
333.51 -import java.io.IOException;
333.52 -import java.net.URI;
333.53 -import java.util.Arrays;
333.54 -import java.util.BitSet;
333.55 -import java.util.Collection;
333.56 -import java.util.Collections;
333.57 -import java.util.HashMap;
333.58 -import java.util.LinkedList;
333.59 -import java.util.Map;
333.60 -import javax.tools.Diagnostic;
333.61 -import javax.tools.JavaCompiler;
333.62 -import javax.tools.JavaFileObject;
333.63 -import javax.tools.SimpleJavaFileObject;
333.64 -import javax.tools.ToolProvider;
333.65 -import org.apache.lucene.document.Document;
333.66 -import org.apache.lucene.index.IndexReader;
333.67 -import org.apache.lucene.index.Term;
333.68 -import org.apache.lucene.search.Collector;
333.69 -import org.apache.lucene.search.IndexSearcher;
333.70 -import org.apache.lucene.search.Query;
333.71 -import org.apache.lucene.search.Searcher;
333.72 -import org.apache.lucene.search.TermQuery;
333.73 -import org.apache.lucene.store.FSDirectory;
333.74 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
333.75 -import org.netbeans.modules.jackpot30.impl.indexing.AbstractLuceneIndex.BitSetCollector;
333.76 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
333.77 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
333.78 -import org.netbeans.modules.java.hints.jackpot.impl.Utilities;
333.79 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch;
333.80 -import org.netbeans.modules.java.hints.jackpot.impl.pm.BulkSearch.BulkPattern;
333.81 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
333.82 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.AdditionalQueryConstraints;
333.83 -import org.netbeans.modules.java.hints.jackpot.spi.PatternConvertor;
333.84 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
333.85 -
333.86 -/**
333.87 - *
333.88 - * @author lahvac
333.89 - */
333.90 -public class StandaloneFinder {
333.91 -
333.92 - public static Collection<? extends String> findCandidates(File sourceRoot, String pattern) throws IOException {
333.93 - BulkPattern bulkPattern = preparePattern(pattern, null);
333.94 -
333.95 - return FileBasedIndex.get(sourceRoot.toURI().toURL()).findCandidates(bulkPattern);
333.96 - }
333.97 -
333.98 - public static int[] findCandidateOccurrenceSpans(File sourceRoot, String relativePath, String pattern) throws IOException {
333.99 - BulkPattern bulkPattern = preparePattern(pattern, null);
333.100 - CharSequence source = FileBasedIndex.get(sourceRoot.toURI().toURL()).getSourceCode(relativePath).toString().replaceAll("\r\n", "\n");
333.101 - JavacTaskImpl jti = prepareJavacTaskImpl();
333.102 - CompilationUnitTree cut = jti.parse(new JFOImpl(source)).iterator().next();
333.103 - Collection<TreePath> paths = new LinkedList<TreePath>();
333.104 -
333.105 - for (Collection<TreePath> c : BulkSearch.getDefault().match(null, new TreePath(cut), bulkPattern).values()) {
333.106 - paths.addAll(c);
333.107 - }
333.108 -
333.109 - Trees t = Trees.instance(jti);
333.110 - int[] result = new int[2 * paths.size()];
333.111 - int i = 0;
333.112 -
333.113 - for (TreePath tp : paths) {
333.114 - result[i++] = (int) t.getSourcePositions().getStartPosition(cut, tp.getLeaf());
333.115 - result[i++] = (int) t.getSourcePositions().getEndPosition(cut, tp.getLeaf());
333.116 - }
333.117 -
333.118 - return result;
333.119 - }
333.120 -
333.121 - public static Collection<Diagnostic<? extends JavaFileObject>> parseAndReportErrors(String pattern) {
333.122 - Collection<Diagnostic<? extends JavaFileObject>> errors = new LinkedList<Diagnostic<? extends JavaFileObject>>();
333.123 -
333.124 - preparePattern(pattern, errors);
333.125 -
333.126 - return errors;
333.127 - }
333.128 -
333.129 - public static Map<String, Collection<? extends String>> containsHash(File sourceRoot, Iterable<? extends String> hashes) throws IOException {
333.130 - File cacheRoot = Cache.findCache(DuplicatesIndex.NAME, DuplicatesIndex.VERSION).findCacheRoot(sourceRoot.toURI().toURL());
333.131 - File dir = new File(cacheRoot, "fulltext");
333.132 -
333.133 - if (dir.listFiles() != null && dir.listFiles().length > 0) {
333.134 - IndexReader reader = IndexReader.open(FSDirectory.open(dir), true);
333.135 - Map<String, Collection<? extends String>> result = new HashMap<String, Collection<? extends String>>();
333.136 -
333.137 - for (String hash : hashes) {
333.138 - Collection<String> found = new LinkedList<String>();
333.139 - Query query = new TermQuery(new Term("generalized", hash));
333.140 - Searcher s = new IndexSearcher(reader);
333.141 - BitSet matchingDocuments = new BitSet(reader.maxDoc());
333.142 - Collector c = new BitSetCollector(matchingDocuments);
333.143 -
333.144 - s.search(query, c);
333.145 -
333.146 - for (int docNum = matchingDocuments.nextSetBit(0); docNum >= 0; docNum = matchingDocuments.nextSetBit(docNum + 1)) {
333.147 - final Document doc = reader.document(docNum);
333.148 -
333.149 - found.add(doc.getField("path").stringValue());
333.150 - }
333.151 -
333.152 - result.put(hash, found);
333.153 - }
333.154 -
333.155 - return result;
333.156 - }
333.157 -
333.158 - return Collections.emptyMap();
333.159 - }
333.160 -
333.161 - private static BulkPattern preparePattern(String pattern, Collection<Diagnostic<? extends JavaFileObject>> errors) {
333.162 - return preparePattern(PatternConvertor.create(pattern), errors);
333.163 - }
333.164 -
333.165 - //XXX: copied from BatchSearch, may be possible to merge once CompilationInfo is accessible in server mode
333.166 - private static BulkPattern preparePattern(final Iterable<? extends HintDescription> patterns, Collection<Diagnostic<? extends JavaFileObject>> errors) {
333.167 - JavacTaskImpl javac = prepareJavacTaskImpl();
333.168 - Collection<String> code = new LinkedList<String>();
333.169 - Collection<Tree> trees = new LinkedList<Tree>();
333.170 - Collection<AdditionalQueryConstraints> additionalConstraints = new LinkedList<AdditionalQueryConstraints>();
333.171 -
333.172 - for (HintDescription pattern : patterns) {
333.173 - String textPattern = ((PatternDescription) pattern.getTrigger()).getPattern();
333.174 -
333.175 - code.add(textPattern);
333.176 - trees.add(Utilities.parseAndAttribute(javac, textPattern, errors));
333.177 - additionalConstraints.add(pattern.getAdditionalConstraints());
333.178 - }
333.179 -
333.180 - return BulkSearch.getDefault().create(code, trees, additionalConstraints);
333.181 - }
333.182 -
333.183 - private static JavacTaskImpl prepareJavacTaskImpl() {
333.184 - final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
333.185 - final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
333.186 -
333.187 - assert tool != null;
333.188 -
333.189 - JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath, "-Xjcov"), null, Collections.<JavaFileObject>emptyList());
333.190 -
333.191 - return ct;
333.192 - }
333.193 -
333.194 - private static final class JFOImpl extends SimpleJavaFileObject {
333.195 - private final CharSequence code;
333.196 - public JFOImpl(CharSequence code) {
333.197 - super(URI.create(""), Kind.SOURCE);
333.198 - this.code = code;
333.199 - }
333.200 - @Override
333.201 - public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
333.202 - return code;
333.203 - }
333.204 - }
333.205 -}
334.1 --- a/server/indexer/src/org/netbeans/modules/jackpot30/server/indexer/StandaloneIndexer.java Sat Feb 18 22:14:42 2012 +0100
334.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
334.3 @@ -1,169 +0,0 @@
334.4 -/*
334.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
334.6 - *
334.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
334.8 - *
334.9 - * The contents of this file are subject to the terms of either the GNU
334.10 - * General Public License Version 2 only ("GPL") or the Common
334.11 - * Development and Distribution License("CDDL") (collectively, the
334.12 - * "License"). You may not use this file except in compliance with the
334.13 - * License. You can obtain a copy of the License at
334.14 - * http://www.netbeans.org/cddl-gplv2.html
334.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
334.16 - * specific language governing permissions and limitations under the
334.17 - * License. When distributing the software, include this License Header
334.18 - * Notice in each file and include the License file at
334.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
334.20 - * particular file as subject to the "Classpath" exception as provided
334.21 - * by Sun in the GPL Version 2 section of the License file that
334.22 - * accompanied this code. If applicable, add the following below the
334.23 - * License Header, with the fields enclosed by brackets [] replaced by
334.24 - * your own identifying information:
334.25 - * "Portions Copyrighted [year] [name of copyright owner]"
334.26 - *
334.27 - * If you wish your version of this file to be governed by only the CDDL
334.28 - * or only the GPL Version 2, indicate your decision by adding
334.29 - * "[Contributor] elects to include this software in this distribution
334.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
334.31 - * single choice of license, a recipient has the option to distribute
334.32 - * your version of this file under either the CDDL, the GPL Version 2 or
334.33 - * to extend the choice of license to its licensees as provided above.
334.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
334.35 - * Version 2 license, then the option applies only if the new code is
334.36 - * made subject to such option by the copyright holder.
334.37 - *
334.38 - * Contributor(s):
334.39 - *
334.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
334.41 - */
334.42 -
334.43 -package org.netbeans.modules.jackpot30.server.indexer;
334.44 -
334.45 -import com.sun.source.tree.CompilationUnitTree;
334.46 -import com.sun.tools.javac.api.JavacTaskImpl;
334.47 -import java.io.BufferedReader;
334.48 -import java.io.File;
334.49 -import java.io.FileReader;
334.50 -import java.io.IOException;
334.51 -import java.util.Arrays;
334.52 -import java.util.Collection;
334.53 -import java.util.Collections;
334.54 -import java.util.LinkedList;
334.55 -import java.util.logging.Level;
334.56 -import java.util.logging.Logger;
334.57 -import javax.tools.Diagnostic;
334.58 -import javax.tools.DiagnosticListener;
334.59 -import javax.tools.JavaCompiler;
334.60 -import javax.tools.JavaFileObject;
334.61 -import javax.tools.StandardJavaFileManager;
334.62 -import javax.tools.StandardLocation;
334.63 -import javax.tools.ToolProvider;
334.64 -import org.netbeans.modules.jackpot30.impl.duplicates.indexing.DuplicatesIndex;
334.65 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
334.66 -import org.netbeans.modules.jackpot30.impl.indexing.Index;
334.67 -import org.netbeans.modules.jackpot30.impl.indexing.Index.IndexWriter;
334.68 -import org.netbeans.modules.jackpot30.impl.indexing.IndexInfo;
334.69 -
334.70 -/**
334.71 - *
334.72 - * @author lahvac
334.73 - */
334.74 -public class StandaloneIndexer {
334.75 -
334.76 - public static void index(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
334.77 - Index index = FileBasedIndex.create(root.toURI().toURL(), storeSources);
334.78 - IndexInfo ii = index.getIndexInfo();
334.79 - boolean clearIndexing = ii.totalFiles < 0 || ii.majorVersion != FileBasedIndex.MAJOR_VERSION || ii.minorVersion != FileBasedIndex.MINOR_VERSION;
334.80 - IndexWriter w = index.openForWriting();
334.81 - DuplicatesIndex.IndexWriter dw = duplicatesIndex ? DuplicatesIndex.get(root.toURI().toURL()).openForWriting() : null;
334.82 -
334.83 - try {
334.84 - StandaloneIndexer i = new StandaloneIndexer();
334.85 -
334.86 - if (!clearIndexing && modified != null && removed != null) {
334.87 - i.doIndex(w, dw, root, modified, removed);
334.88 - } else {
334.89 - w.clear();
334.90 - i.doIndex(w, dw, root);
334.91 - }
334.92 - } finally {
334.93 - w.close();
334.94 - if (dw != null) {
334.95 - dw.close();
334.96 - }
334.97 - }
334.98 - }
334.99 -
334.100 - private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File fileOrDir) throws IOException {
334.101 - if (fileOrDir.isDirectory()) {
334.102 - for (File f : fileOrDir.listFiles()) {
334.103 - doIndex(w, dw, f);
334.104 - }
334.105 - } else {
334.106 - indexFile(w, dw, fileOrDir);
334.107 - }
334.108 - }
334.109 -
334.110 - private void doIndex(IndexWriter w, DuplicatesIndex.IndexWriter dw, File root, String modified, String removed) throws IOException {
334.111 - for (String r : read(removed)) {
334.112 - w.remove(r);
334.113 - if (dw != null) dw.remove(r);
334.114 - }
334.115 -
334.116 - for (String m : read(modified)) {
334.117 - indexFile(w, dw, new File(root, m));
334.118 - }
334.119 - }
334.120 -
334.121 - private void indexFile(IndexWriter w, DuplicatesIndex.IndexWriter dw, File source) throws IOException {
334.122 - if (!source.getName().endsWith(".java"))
334.123 - return ;
334.124 -
334.125 - final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
334.126 - final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
334.127 - assert tool != null;
334.128 -
334.129 - DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
334.130 - public void report(Diagnostic<? extends JavaFileObject> diagnostic) {}
334.131 - };
334.132 - StandardJavaFileManager m = tool.getStandardFileManager(devNull, null, null);
334.133 -
334.134 - m.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
334.135 - m.setLocation(StandardLocation.SOURCE_PATH, Collections.<File>emptyList());
334.136 -
334.137 - Iterable<? extends JavaFileObject> fos = m.getJavaFileObjects(source);
334.138 - JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, null, devNull, Arrays.asList("-bootclasspath", bootPath), null, fos);
334.139 - CompilationUnitTree cut = ct.parse().iterator().next();
334.140 -
334.141 - w.record(source.toURI().toURL(), cut, null);
334.142 -
334.143 - if (dw != null) {
334.144 - ct.analyze(ct.enter(Collections.singletonList(cut)));
334.145 -
334.146 - dw.record(ct, source.toURI().toURL(), cut);
334.147 - }
334.148 - }
334.149 -
334.150 - private static Iterable<? extends String> read(String file) throws IOException {
334.151 - Collection<String> result = new LinkedList<String>();
334.152 - BufferedReader r = new BufferedReader(new FileReader(file));
334.153 -
334.154 - try {
334.155 - String line;
334.156 -
334.157 - while ((line = r.readLine()) != null) {
334.158 - if (!line.isEmpty()) {
334.159 - result.add(line);
334.160 - }
334.161 - }
334.162 - } finally {
334.163 - try {
334.164 - r.close();
334.165 - } catch (IOException ex) {
334.166 - Logger.getLogger(StandaloneIndexer.class.getName()).log(Level.SEVERE, null, ex);
334.167 - }
334.168 - }
334.169 -
334.170 - return result;
334.171 - }
334.172 -}
335.1 --- a/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/IndexTest.java Sat Feb 18 22:14:42 2012 +0100
335.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
335.3 @@ -1,96 +0,0 @@
335.4 -/*
335.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
335.6 - *
335.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
335.8 - *
335.9 - * The contents of this file are subject to the terms of either the GNU
335.10 - * General Public License Version 2 only ("GPL") or the Common
335.11 - * Development and Distribution License("CDDL") (collectively, the
335.12 - * "License"). You may not use this file except in compliance with the
335.13 - * License. You can obtain a copy of the License at
335.14 - * http://www.netbeans.org/cddl-gplv2.html
335.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
335.16 - * specific language governing permissions and limitations under the
335.17 - * License. When distributing the software, include this License Header
335.18 - * Notice in each file and include the License file at
335.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
335.20 - * particular file as subject to the "Classpath" exception as provided
335.21 - * by Sun in the GPL Version 2 section of the License file that
335.22 - * accompanied this code. If applicable, add the following below the
335.23 - * License Header, with the fields enclosed by brackets [] replaced by
335.24 - * your own identifying information:
335.25 - * "Portions Copyrighted [year] [name of copyright owner]"
335.26 - *
335.27 - * If you wish your version of this file to be governed by only the CDDL
335.28 - * or only the GPL Version 2, indicate your decision by adding
335.29 - * "[Contributor] elects to include this software in this distribution
335.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
335.31 - * single choice of license, a recipient has the option to distribute
335.32 - * your version of this file under either the CDDL, the GPL Version 2 or
335.33 - * to extend the choice of license to its licensees as provided above.
335.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
335.35 - * Version 2 license, then the option applies only if the new code is
335.36 - * made subject to such option by the copyright holder.
335.37 - *
335.38 - * Contributor(s):
335.39 - *
335.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
335.41 - */
335.42 -
335.43 -package org.netbeans.modules.jackpot30.server.indexer;
335.44 -
335.45 -import java.io.File;
335.46 -import java.io.IOException;
335.47 -import junit.framework.TestCase;
335.48 -
335.49 -/**
335.50 - *
335.51 - * @author lahvac
335.52 - */
335.53 -public class IndexTest extends TestCase {
335.54 -
335.55 - public IndexTest(String name) {
335.56 - super(name);
335.57 - }
335.58 -
335.59 - public void testCmdLine() throws IOException {
335.60 - assertCmdLineOk("/foo", false, false, null, null, "/foo", "/cache");
335.61 - assertCmdLineOk("/foo", false, false, "/modified.list", "/removed.list", "/foo", "/cache", "/modified.list", "/removed.list");
335.62 - assertCmdLineOk("/foo", true, false, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache");
335.63 - assertCmdLineOk("/foo", true, false, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, "/foo", "/cache", "/modified.list", "/removed.list");
335.64 - assertCmdLineOk("/foo", false, true, null, null, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
335.65 - assertCmdLineOk("/foo", false, true, "/modified.list", "/removed.list", Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
335.66 - assertCmdLineOk("/foo", true, true, null, null, Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache");
335.67 - assertCmdLineOk("/foo", true, true, "/modified.list", "/removed.list", Index.PARAM_CONSTRUCT_DUPLICATES_INDEX, Index.PARAM_STORE_SOURCES, "/foo", "/cache", "/modified.list", "/removed.list");
335.68 - assertCmdLineFailed();
335.69 - assertCmdLineFailed("/foo");
335.70 - }
335.71 -
335.72 - private static void assertCmdLineOk(final String rootGolden, final boolean duplicatesIndexGolden, final boolean storeSourcesGolden, final String modifiedGolden, final String removedGolden, String... cmdLine) throws IOException {
335.73 - new Index() {
335.74 - @Override
335.75 - protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
335.76 - assertEquals(rootGolden, root.getPath());
335.77 - assertEquals(duplicatesIndexGolden, duplicatesIndex);
335.78 - assertEquals(storeSourcesGolden, storeSources);
335.79 - assertEquals(modifiedGolden, modified);
335.80 - assertEquals(removedGolden, removed);
335.81 - }
335.82 - @Override
335.83 - protected void printHelp() {
335.84 - fail();
335.85 - }
335.86 - }.index(cmdLine);
335.87 - }
335.88 -
335.89 - private static void assertCmdLineFailed(String... cmdLine) throws IOException {
335.90 - new Index() {
335.91 - @Override
335.92 - protected void invokeIndexer(File root, boolean duplicatesIndex, boolean storeSources, String modified, String removed) throws IOException {
335.93 - fail();
335.94 - }
335.95 - @Override
335.96 - protected void printHelp() {}
335.97 - }.index(cmdLine);
335.98 - }
335.99 -}
335.100 \ No newline at end of file
336.1 --- a/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/LargeScaleTester.java Sat Feb 18 22:14:42 2012 +0100
336.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
336.3 @@ -1,147 +0,0 @@
336.4 -/*
336.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
336.6 - *
336.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
336.8 - *
336.9 - * The contents of this file are subject to the terms of either the GNU
336.10 - * General Public License Version 2 only ("GPL") or the Common
336.11 - * Development and Distribution License("CDDL") (collectively, the
336.12 - * "License"). You may not use this file except in compliance with the
336.13 - * License. You can obtain a copy of the License at
336.14 - * http://www.netbeans.org/cddl-gplv2.html
336.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
336.16 - * specific language governing permissions and limitations under the
336.17 - * License. When distributing the software, include this License Header
336.18 - * Notice in each file and include the License file at
336.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
336.20 - * particular file as subject to the "Classpath" exception as provided
336.21 - * by Sun in the GPL Version 2 section of the License file that
336.22 - * accompanied this code. If applicable, add the following below the
336.23 - * License Header, with the fields enclosed by brackets [] replaced by
336.24 - * your own identifying information:
336.25 - * "Portions Copyrighted [year] [name of copyright owner]"
336.26 - *
336.27 - * If you wish your version of this file to be governed by only the CDDL
336.28 - * or only the GPL Version 2, indicate your decision by adding
336.29 - * "[Contributor] elects to include this software in this distribution
336.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
336.31 - * single choice of license, a recipient has the option to distribute
336.32 - * your version of this file under either the CDDL, the GPL Version 2 or
336.33 - * to extend the choice of license to its licensees as provided above.
336.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
336.35 - * Version 2 license, then the option applies only if the new code is
336.36 - * made subject to such option by the copyright holder.
336.37 - *
336.38 - * Contributor(s):
336.39 - *
336.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
336.41 - */
336.42 -
336.43 -package org.netbeans.modules.jackpot30.server.indexer;
336.44 -
336.45 -import java.io.File;
336.46 -import java.io.IOException;
336.47 -import java.util.logging.Handler;
336.48 -import java.util.logging.Level;
336.49 -import java.util.logging.LogRecord;
336.50 -import java.util.logging.Logger;
336.51 -import java.util.logging.SimpleFormatter;
336.52 -import junit.framework.TestCase;
336.53 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
336.54 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
336.55 -
336.56 -/**
336.57 - *
336.58 - * @author lahvac
336.59 - */
336.60 -public class LargeScaleTester extends TestCase {
336.61 -
336.62 - public LargeScaleTester(String name) {
336.63 - super(name);
336.64 - }
336.65 -
336.66 - private static final boolean createIndex = true;
336.67 -
336.68 - private File src;
336.69 -
336.70 - public void setUp() throws Exception {
336.71 - Logger.getLogger(FileBasedIndex.class.getName()).setLevel(Level.ALL);
336.72 - Logger.getLogger(FileBasedIndex.class.getName()).addHandler(new Handler() {
336.73 - @Override
336.74 - public void publish(LogRecord record) {
336.75 - System.err.println(new SimpleFormatter().formatMessage(record));
336.76 - }
336.77 - @Override
336.78 - public void flush() {
336.79 - System.err.flush();
336.80 - }
336.81 - @Override
336.82 - public void close() throws SecurityException {}
336.83 - });
336.84 -
336.85 - File source = new File(LargeScaleTester.class.getProtectionDomain().getCodeSource().getLocation().getPath());
336.86 - File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
336.87 -
336.88 - if (createIndex)
336.89 - deleteRecursively(workingDirectory);
336.90 -
336.91 - File cache = new File(workingDirectory, "cache");
336.92 - String toIndex = System.getProperty("index-folder");
336.93 -
336.94 - if (toIndex == null || !(src = new File(toIndex)).isDirectory()) {
336.95 - throw new IllegalStateException("Directory to index not correctly specified - add 'test-sys-prop.index-folder=<directory>' to private.properties");
336.96 - }
336.97 -
336.98 - Cache.setStandaloneCacheRoot(cache);
336.99 -
336.100 - if (createIndex) {
336.101 - long start = System.currentTimeMillis();
336.102 - StandaloneIndexer.index(src, false, false, null, null);
336.103 - long end = System.currentTimeMillis();
336.104 - System.err.println("indexing took: " + (end - start));
336.105 - System.err.println("cache size total: " + totalSize(cache) + ", lucene=" + totalSize(new File(cache, "s1/jackpot30/fulltext")));
336.106 - }
336.107 - }
336.108 -
336.109 - private static void deleteRecursively(File d) throws IOException {
336.110 - if (!d.exists()) return;
336.111 -
336.112 - if (d.isDirectory()) {
336.113 - for (File c : d.listFiles()) {
336.114 - deleteRecursively(c);
336.115 - }
336.116 - }
336.117 -
336.118 - if (!d.delete()) throw new IOException();
336.119 - }
336.120 -
336.121 - private static long totalSize(File d) throws IOException {
336.122 - if (!d.exists()) return 0;
336.123 -
336.124 - if (d.isDirectory()) {
336.125 - long total = 0;
336.126 -
336.127 - for (File c : d.listFiles()) {
336.128 - total += totalSize(c);
336.129 - }
336.130 -
336.131 - return total;
336.132 - } else {
336.133 - return d.length();
336.134 - }
336.135 - }
336.136 -
336.137 - public void testFind() throws Exception {
336.138 - performTest("new $type() { $mods$ $resultType $methodName($args$) { $statements$; } }");
336.139 - performTest("$1.isDirectory()");
336.140 - }
336.141 -
336.142 - private void performTest(String code) throws Exception {
336.143 - System.err.println("searching for " + code);
336.144 - long start = System.currentTimeMillis();
336.145 - System.err.println("Found occurrences: " + StandaloneFinder.findCandidates(src, code).size());
336.146 - long end = System.currentTimeMillis();
336.147 -
336.148 - System.err.println("total search time: " + (end - start));
336.149 - }
336.150 -}
337.1 --- a/server/indexer/test/org/netbeans/modules/jackpot30/server/indexer/StandaloneFinderTest.java Sat Feb 18 22:14:42 2012 +0100
337.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
337.3 @@ -1,154 +0,0 @@
337.4 -/*
337.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
337.6 - *
337.7 - * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
337.8 - *
337.9 - * The contents of this file are subject to the terms of either the GNU
337.10 - * General Public License Version 2 only ("GPL") or the Common
337.11 - * Development and Distribution License("CDDL") (collectively, the
337.12 - * "License"). You may not use this file except in compliance with the
337.13 - * License. You can obtain a copy of the License at
337.14 - * http://www.netbeans.org/cddl-gplv2.html
337.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
337.16 - * specific language governing permissions and limitations under the
337.17 - * License. When distributing the software, include this License Header
337.18 - * Notice in each file and include the License file at
337.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
337.20 - * particular file as subject to the "Classpath" exception as provided
337.21 - * by Sun in the GPL Version 2 section of the License file that
337.22 - * accompanied this code. If applicable, add the following below the
337.23 - * License Header, with the fields enclosed by brackets [] replaced by
337.24 - * your own identifying information:
337.25 - * "Portions Copyrighted [year] [name of copyright owner]"
337.26 - *
337.27 - * If you wish your version of this file to be governed by only the CDDL
337.28 - * or only the GPL Version 2, indicate your decision by adding
337.29 - * "[Contributor] elects to include this software in this distribution
337.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
337.31 - * single choice of license, a recipient has the option to distribute
337.32 - * your version of this file under either the CDDL, the GPL Version 2 or
337.33 - * to extend the choice of license to its licensees as provided above.
337.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
337.35 - * Version 2 license, then the option applies only if the new code is
337.36 - * made subject to such option by the copyright holder.
337.37 - *
337.38 - * Contributor(s):
337.39 - *
337.40 - * Portions Copyrighted 2010 Sun Microsystems, Inc.
337.41 - */
337.42 -
337.43 -package org.netbeans.modules.jackpot30.server.indexer;
337.44 -
337.45 -import java.io.ByteArrayInputStream;
337.46 -import java.io.File;
337.47 -import java.io.FileOutputStream;
337.48 -import java.io.IOException;
337.49 -import java.io.InputStream;
337.50 -import java.util.ArrayList;
337.51 -import java.util.Arrays;
337.52 -import java.util.HashSet;
337.53 -import java.util.LinkedList;
337.54 -import java.util.List;
337.55 -import junit.framework.Assert;
337.56 -import junit.framework.TestCase;
337.57 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
337.58 -
337.59 -/**
337.60 - *
337.61 - * @author lahvac
337.62 - */
337.63 -public class StandaloneFinderTest extends TestCase {
337.64 -
337.65 - public StandaloneFinderTest(String name) {
337.66 - super(name);
337.67 - }
337.68 -
337.69 - private File src;
337.70 -
337.71 - public void setUp() throws Exception {
337.72 - File source = new File(StandaloneFinderTest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
337.73 - File workingDirectory = new File(new File(source.getParentFile(), "wd"), this.getName());
337.74 -
337.75 - deleteRecursively(workingDirectory);
337.76 -
337.77 - File cache = new File(workingDirectory, "cache");
337.78 -
337.79 - src = new File(workingDirectory, "src");
337.80 -
337.81 - Cache.setStandaloneCacheRoot(cache);
337.82 -
337.83 - copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
337.84 - copyStringToFile(new File(src, "test/TestLambda.java"), "package test; public class Test1 { private void test() { Runnable r = new Runnable() { public void run() { System.err.println(); } }; } }");
337.85 -
337.86 - StandaloneIndexer.index(src, false, false, null, null);
337.87 - }
337.88 -
337.89 - public final static void copyStringToFile (File f, String content) throws Exception {
337.90 - f.getParentFile().mkdirs();
337.91 -
337.92 - FileOutputStream os = new FileOutputStream(f);
337.93 - InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
337.94 - int read;
337.95 - while ((read = is.read()) != (-1)) {
337.96 - os.write(read);
337.97 - }
337.98 - os.close ();
337.99 - is.close();
337.100 - }
337.101 -
337.102 - private static List<Integer> toIntegerList(int[] arr) {
337.103 - List<Integer> res = new ArrayList<Integer>(arr.length);
337.104 -
337.105 - for (int e : arr) {
337.106 - res.add(e);
337.107 - }
337.108 -
337.109 - return res;
337.110 - }
337.111 -
337.112 - private static void deleteRecursively(File d) throws IOException {
337.113 - if (!d.exists()) return;
337.114 -
337.115 - if (d.isDirectory()) {
337.116 - for (File c : d.listFiles()) {
337.117 - deleteRecursively(c);
337.118 - }
337.119 - }
337.120 -
337.121 - if (!d.delete()) throw new IOException();
337.122 - }
337.123 -
337.124 - public void testFindSpans() throws Exception {
337.125 - Assert.assertEquals(Arrays.asList(55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", "$1.isDirectory()")));
337.126 - }
337.127 -
337.128 - public void testMultiplePatterns() throws Exception {
337.129 - String patterns = "$1.isDirectory();; new java.io.File($1);;";
337.130 - Assert.assertEquals(Arrays.asList("test/Test1.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
337.131 - Assert.assertEquals(Arrays.asList(55, 75, 55, 89), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/Test1.java", patterns)));
337.132 - }
337.133 -
337.134 - public void testUpdate() throws Exception {
337.135 - File modified = new File(src.getParentFile(), "modified");
337.136 - File removed = new File(src.getParentFile(), "removed");
337.137 -
337.138 - copyStringToFile(removed, "test/Test1.java");
337.139 - copyStringToFile(modified, "test/Test2.java\ntest/Test3.java");
337.140 -
337.141 - new File(src, "test/Test1.java").delete();
337.142 -
337.143 - copyStringToFile(new File(src, "test/Test2.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
337.144 - copyStringToFile(new File(src, "test/Test3.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
337.145 -
337.146 - StandaloneIndexer.index(src, false, false, modified.getAbsolutePath(), removed.getAbsolutePath());
337.147 -
337.148 - String patterns = "$1.isDirectory();; new java.io.File($1);;";
337.149 - Assert.assertEquals(new HashSet<String>(Arrays.asList("test/Test2.java", "test/Test3.java")), new HashSet<String>(StandaloneFinder.findCandidates(src, patterns)));
337.150 - }
337.151 -
337.152 - public void testLambdaPattern() throws Exception {
337.153 - String patterns = "new $type() {\n $mods$ $resultType $methodName($args$) {\n $statements$;\n }\n }\n";
337.154 - Assert.assertEquals(Arrays.asList("test/TestLambda.java"), new LinkedList<String>(StandaloneFinder.findCandidates(src, patterns)));
337.155 - Assert.assertEquals(Arrays.asList(70, 132), toIntegerList(StandaloneFinder.findCandidateOccurrenceSpans(src, "test/TestLambda.java", patterns)));
337.156 - }
337.157 -}
338.1 --- a/server/lib/nblibraries.properties Sat Feb 18 22:14:42 2012 +0100
338.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
338.3 @@ -1,50 +0,0 @@
338.4 -libs.jopt-simple.classpath=\
338.5 - ${base}/jopt-simple/jopt-simple-3.2.jar
338.6 -libs.jopt-simple.javadoc=\
338.7 - ${base}/jopt-simple/jopt-simple-3.2-javadoc.jar!//
338.8 -libs.jopt-simple.src=\
338.9 - ${base}/jopt-simple/jopt-simple-3.2-sources.jar
338.10 -libs.junit.classpath=\
338.11 - ${base}/junit/junit-3.8.2.jar
338.12 -libs.junit.javadoc=\
338.13 - ${base}/junit/junit-3.8.2-api.zip
338.14 -libs.junit_4.classpath=\
338.15 - ${base}/junit_4/junit-4.5.jar
338.16 -libs.junit_4.javadoc=\
338.17 - ${base}/junit_4/junit-4.5-api.zip
338.18 -libs.junit_4.src=\
338.19 - ${base}/junit_4/junit-4.5-src.jar
338.20 -libs.CopyLibs.classpath=\
338.21 - ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
338.22 -libs.jersey.classpath=\
338.23 - ${base}/jersey-1.1/grizzly-servlet-webserver-1.8.6.3.jar:\
338.24 - ${base}/jersey-1.1/jersey-client-1.0.1.jar:\
338.25 - ${base}/jersey-1.1/jersey-core-1.0.1.jar:\
338.26 - ${base}/jersey-1.1/jersey-server-1.0.1.jar:\
338.27 - ${base}/jersey-1.1/asm-all-3.1.jar:\
338.28 - ${base}/jersey-1.1/jsr311-api-1.0.jar
338.29 -libs.jersey.src=\
338.30 - ${base}/jersey-1.1/jersey-client-1.0.1-sources.jar:\
338.31 - ${base}/jersey-1.1/jersey-core-1.0.1-sources.jar:\
338.32 - ${base}/jersey-1.1/jersey-server-1.0.1-sources.jar:\
338.33 - ${base}/jersey-1.1/asm-all-3.1-sources.jar:\
338.34 - ${base}/jersey-1.1/jsr311-api-1.0-sources.jar
338.35 -libs.lucene.classpath=\
338.36 - ${base}/lucene-3.5.0/lucene-core-3.5.0.jar
338.37 -libs.jersey.javadoc=\
338.38 - ${base}/jersey-1.1/jersey-client-1.0.1-javadoc.jar!//:\
338.39 - ${base}/jersey-1.1/jersey-core-1.0.1-javadoc.jar!//:\
338.40 - ${base}/jersey-1.1/jersey-server-1.0.1-javadoc.jar!//:\
338.41 - ${base}/jersey-1.1/jsr311-api-1.0-javadoc.jar!//
338.42 -libs.lucene.javadoc=\
338.43 - ${base}/lucene-3.5.0/lucene-core-3.5.0-javadoc.jar!//
338.44 -libs.lucene.src=\
338.45 - ${base}/lucene-3.5.0/lucene-core-3.5.0-sources.jar
338.46 -libs.javac.classpath=\
338.47 - ${base}/javac/javac-api-nb-7.0-b07.jar:\
338.48 - ${base}/javac/javac-impl-nb-7.0-b07.jar
338.49 -libs.freemarker.classpath=\
338.50 - ${base}/freemarker/freemarker-2.3.16.jar
338.51 -libs.freemarker.src=\
338.52 - ${base}/freemarker/freemarker-src.zip
338.53 -
339.1 --- a/server/web.api/build.xml Sat Feb 18 22:14:42 2012 +0100
339.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
339.3 @@ -1,75 +0,0 @@
339.4 -<?xml version="1.0" encoding="UTF-8"?>
339.5 -<!-- You may freely edit this file. See commented blocks below for -->
339.6 -<!-- some examples of how to customize the build. -->
339.7 -<!-- (If you delete it and reopen the project it will be recreated.) -->
339.8 -<!-- By default, only the Clean and Build commands use this build script. -->
339.9 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
339.10 -<!-- the Compile on Save feature is turned off for the project. -->
339.11 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
339.12 -<!-- in the project's Project Properties dialog box.-->
339.13 -<project name="web.api" default="default" basedir=".">
339.14 - <description>Builds, tests, and runs the project web.api.</description>
339.15 - <import file="../download.xml"/>
339.16 - <import file="nbproject/build-impl.xml"/>
339.17 - <!--
339.18 -
339.19 - There exist several targets which are by default empty and which can be
339.20 - used for execution of your tasks. These targets are usually executed
339.21 - before and after some main targets. They are:
339.22 -
339.23 - -pre-init: called before initialization of project properties
339.24 - -post-init: called after initialization of project properties
339.25 - -pre-compile: called before javac compilation
339.26 - -post-compile: called after javac compilation
339.27 - -pre-compile-single: called before javac compilation of single file
339.28 - -post-compile-single: called after javac compilation of single file
339.29 - -pre-compile-test: called before javac compilation of JUnit tests
339.30 - -post-compile-test: called after javac compilation of JUnit tests
339.31 - -pre-compile-test-single: called before javac compilation of single JUnit test
339.32 - -post-compile-test-single: called after javac compilation of single JUunit test
339.33 - -pre-jar: called before JAR building
339.34 - -post-jar: called after JAR building
339.35 - -post-clean: called after cleaning build products
339.36 -
339.37 - (Targets beginning with '-' are not intended to be called on their own.)
339.38 -
339.39 - Example of inserting an obfuscator after compilation could look like this:
339.40 -
339.41 - <target name="-post-compile">
339.42 - <obfuscate>
339.43 - <fileset dir="${build.classes.dir}"/>
339.44 - </obfuscate>
339.45 - </target>
339.46 -
339.47 - For list of available properties check the imported
339.48 - nbproject/build-impl.xml file.
339.49 -
339.50 -
339.51 - Another way to customize the build is by overriding existing main targets.
339.52 - The targets of interest are:
339.53 -
339.54 - -init-macrodef-javac: defines macro for javac compilation
339.55 - -init-macrodef-junit: defines macro for junit execution
339.56 - -init-macrodef-debug: defines macro for class debugging
339.57 - -init-macrodef-java: defines macro for class execution
339.58 - -do-jar-with-manifest: JAR building (if you are using a manifest)
339.59 - -do-jar-without-manifest: JAR building (if you are not using a manifest)
339.60 - run: execution of project
339.61 - -javadoc-build: Javadoc generation
339.62 - test-report: JUnit report generation
339.63 -
339.64 - An example of overriding the target for project execution could look like this:
339.65 -
339.66 - <target name="run" depends="web.api-impl.jar">
339.67 - <exec dir="bin" executable="launcher.exe">
339.68 - <arg file="${dist.jar}"/>
339.69 - </exec>
339.70 - </target>
339.71 -
339.72 - Notice that the overridden target depends on the jar target and not only on
339.73 - the compile target as the regular run target does. Again, for a list of available
339.74 - properties which you can use, check the target you are overriding in the
339.75 - nbproject/build-impl.xml file.
339.76 -
339.77 - -->
339.78 -</project>
340.1 --- a/server/web.api/manifest.mf Sat Feb 18 22:14:42 2012 +0100
340.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
340.3 @@ -1,3 +0,0 @@
340.4 -Manifest-Version: 1.0
340.5 -X-COMMENT: Main-Class will be added automatically by build
340.6 -
341.1 --- a/server/web.api/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
341.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
341.3 @@ -1,966 +0,0 @@
341.4 -<?xml version="1.0" encoding="UTF-8"?>
341.5 -<!--
341.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
341.7 -*** EDIT ../build.xml INSTEAD ***
341.8 -
341.9 -For the purpose of easier reading the script
341.10 -is divided into following sections:
341.11 -
341.12 - - initialization
341.13 - - compilation
341.14 - - jar
341.15 - - execution
341.16 - - debugging
341.17 - - javadoc
341.18 - - junit compilation
341.19 - - junit execution
341.20 - - junit debugging
341.21 - - applet
341.22 - - cleanup
341.23 -
341.24 - -->
341.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="web.api-impl">
341.26 - <fail message="Please build using Ant 1.7.1 or higher.">
341.27 - <condition>
341.28 - <not>
341.29 - <antversion atleast="1.7.1"/>
341.30 - </not>
341.31 - </condition>
341.32 - </fail>
341.33 - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
341.34 - <!--
341.35 - ======================
341.36 - INITIALIZATION SECTION
341.37 - ======================
341.38 - -->
341.39 - <target name="-pre-init">
341.40 - <!-- Empty placeholder for easier customization. -->
341.41 - <!-- You can override this target in the ../build.xml file. -->
341.42 - </target>
341.43 - <target depends="-pre-init" name="-init-private">
341.44 - <property file="nbproject/private/config.properties"/>
341.45 - <property file="nbproject/private/configs/${config}.properties"/>
341.46 - <property file="nbproject/private/private.properties"/>
341.47 - </target>
341.48 - <target name="-pre-init-libraries">
341.49 - <property location="../lib/nblibraries.properties" name="libraries.path"/>
341.50 - <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/>
341.51 - <pathconvert dirsep="/" property="libraries.dir">
341.52 - <path path="${libraries.dir.nativedirsep}"/>
341.53 - </pathconvert>
341.54 - <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/>
341.55 - <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/>
341.56 - </target>
341.57 - <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries">
341.58 - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties">
341.59 - <filterchain>
341.60 - <replacestring from="$${base}" to="${libraries.dir}"/>
341.61 - <escapeunicode/>
341.62 - </filterchain>
341.63 - </loadproperties>
341.64 - </target>
341.65 - <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries">
341.66 - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}">
341.67 - <filterchain>
341.68 - <replacestring from="$${base}" to="${libraries.dir}"/>
341.69 - <escapeunicode/>
341.70 - </filterchain>
341.71 - </loadproperties>
341.72 - </target>
341.73 - <target depends="-pre-init,-init-private,-init-libraries" name="-init-user">
341.74 - <property file="${user.properties.file}"/>
341.75 - <!-- The two properties below are usually overridden -->
341.76 - <!-- by the active platform. Just a fallback. -->
341.77 - <property name="default.javac.source" value="1.4"/>
341.78 - <property name="default.javac.target" value="1.4"/>
341.79 - </target>
341.80 - <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project">
341.81 - <property file="nbproject/configs/${config}.properties"/>
341.82 - <property file="nbproject/project.properties"/>
341.83 - </target>
341.84 - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
341.85 - <available file="${manifest.file}" property="manifest.available"/>
341.86 - <available file="${application.splash}" property="splashscreen.available"/>
341.87 - <condition property="main.class.available">
341.88 - <and>
341.89 - <isset property="main.class"/>
341.90 - <not>
341.91 - <equals arg1="${main.class}" arg2="" trim="true"/>
341.92 - </not>
341.93 - </and>
341.94 - </condition>
341.95 - <condition property="manifest.available+main.class">
341.96 - <and>
341.97 - <isset property="manifest.available"/>
341.98 - <isset property="main.class.available"/>
341.99 - </and>
341.100 - </condition>
341.101 - <condition property="do.mkdist">
341.102 - <and>
341.103 - <isset property="libs.CopyLibs.classpath"/>
341.104 - <not>
341.105 - <istrue value="${mkdist.disabled}"/>
341.106 - </not>
341.107 - </and>
341.108 - </condition>
341.109 - <condition property="manifest.available+main.class+mkdist.available">
341.110 - <and>
341.111 - <istrue value="${manifest.available+main.class}"/>
341.112 - <isset property="do.mkdist"/>
341.113 - </and>
341.114 - </condition>
341.115 - <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
341.116 - <and>
341.117 - <istrue value="${manifest.available+main.class+mkdist.available}"/>
341.118 - <istrue value="${splashscreen.available}"/>
341.119 - </and>
341.120 - </condition>
341.121 - <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
341.122 - <and>
341.123 - <istrue value="${manifest.available+main.class+mkdist.available}"/>
341.124 - <istrue value="${splashscreen.available}"/>
341.125 - </and>
341.126 - </condition>
341.127 - <condition property="manifest.available+mkdist.available">
341.128 - <and>
341.129 - <istrue value="${manifest.available}"/>
341.130 - <isset property="do.mkdist"/>
341.131 - </and>
341.132 - </condition>
341.133 - <condition property="manifest.available-mkdist.available">
341.134 - <or>
341.135 - <istrue value="${manifest.available}"/>
341.136 - <isset property="do.mkdist"/>
341.137 - </or>
341.138 - </condition>
341.139 - <condition property="manifest.available+main.class-mkdist.available">
341.140 - <or>
341.141 - <istrue value="${manifest.available+main.class}"/>
341.142 - <isset property="do.mkdist"/>
341.143 - </or>
341.144 - </condition>
341.145 - <condition property="have.tests">
341.146 - <or>
341.147 - <available file="${test.src.dir}"/>
341.148 - </or>
341.149 - </condition>
341.150 - <condition property="have.sources">
341.151 - <or>
341.152 - <available file="${src.dir}"/>
341.153 - </or>
341.154 - </condition>
341.155 - <condition property="netbeans.home+have.tests">
341.156 - <and>
341.157 - <isset property="netbeans.home"/>
341.158 - <isset property="have.tests"/>
341.159 - </and>
341.160 - </condition>
341.161 - <condition property="no.javadoc.preview">
341.162 - <and>
341.163 - <isset property="javadoc.preview"/>
341.164 - <isfalse value="${javadoc.preview}"/>
341.165 - </and>
341.166 - </condition>
341.167 - <property name="run.jvmargs" value=""/>
341.168 - <property name="javac.compilerargs" value=""/>
341.169 - <property name="work.dir" value="${basedir}"/>
341.170 - <condition property="no.deps">
341.171 - <and>
341.172 - <istrue value="${no.dependencies}"/>
341.173 - </and>
341.174 - </condition>
341.175 - <property name="javac.debug" value="true"/>
341.176 - <property name="javadoc.preview" value="true"/>
341.177 - <property name="application.args" value=""/>
341.178 - <property name="source.encoding" value="${file.encoding}"/>
341.179 - <property name="runtime.encoding" value="${source.encoding}"/>
341.180 - <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
341.181 - <and>
341.182 - <isset property="javadoc.encoding"/>
341.183 - <not>
341.184 - <equals arg1="${javadoc.encoding}" arg2=""/>
341.185 - </not>
341.186 - </and>
341.187 - </condition>
341.188 - <property name="javadoc.encoding.used" value="${source.encoding}"/>
341.189 - <property name="includes" value="**"/>
341.190 - <property name="excludes" value=""/>
341.191 - <property name="do.depend" value="false"/>
341.192 - <condition property="do.depend.true">
341.193 - <istrue value="${do.depend}"/>
341.194 - </condition>
341.195 - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
341.196 - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
341.197 - <length length="0" string="${endorsed.classpath}" when="greater"/>
341.198 - </condition>
341.199 - <property name="javac.fork" value="false"/>
341.200 - </target>
341.201 - <target name="-post-init">
341.202 - <!-- Empty placeholder for easier customization. -->
341.203 - <!-- You can override this target in the ../build.xml file. -->
341.204 - </target>
341.205 - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check">
341.206 - <fail unless="src.dir">Must set src.dir</fail>
341.207 - <fail unless="test.src.dir">Must set test.src.dir</fail>
341.208 - <fail unless="build.dir">Must set build.dir</fail>
341.209 - <fail unless="dist.dir">Must set dist.dir</fail>
341.210 - <fail unless="build.classes.dir">Must set build.classes.dir</fail>
341.211 - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
341.212 - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
341.213 - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
341.214 - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
341.215 - <fail unless="dist.jar">Must set dist.jar</fail>
341.216 - </target>
341.217 - <target name="-init-macrodef-property">
341.218 - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
341.219 - <attribute name="name"/>
341.220 - <attribute name="value"/>
341.221 - <sequential>
341.222 - <property name="@{name}" value="${@{value}}"/>
341.223 - </sequential>
341.224 - </macrodef>
341.225 - </target>
341.226 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
341.227 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
341.228 - <attribute default="${src.dir}" name="srcdir"/>
341.229 - <attribute default="${build.classes.dir}" name="destdir"/>
341.230 - <attribute default="${javac.classpath}" name="classpath"/>
341.231 - <attribute default="${javac.processorpath}" name="processorpath"/>
341.232 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
341.233 - <attribute default="${includes}" name="includes"/>
341.234 - <attribute default="${excludes}" name="excludes"/>
341.235 - <attribute default="${javac.debug}" name="debug"/>
341.236 - <attribute default="${empty.dir}" name="sourcepath"/>
341.237 - <attribute default="${empty.dir}" name="gensrcdir"/>
341.238 - <element name="customize" optional="true"/>
341.239 - <sequential>
341.240 - <property location="${build.dir}/empty" name="empty.dir"/>
341.241 - <mkdir dir="${empty.dir}"/>
341.242 - <mkdir dir="@{apgeneratedsrcdir}"/>
341.243 - <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}">
341.244 - <src>
341.245 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
341.246 - <include name="*"/>
341.247 - </dirset>
341.248 - </src>
341.249 - <classpath>
341.250 - <path path="@{classpath}"/>
341.251 - </classpath>
341.252 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
341.253 - <compilerarg line="${javac.compilerargs}"/>
341.254 - <compilerarg value="-processorpath"/>
341.255 - <compilerarg path="@{processorpath}"/>
341.256 - <compilerarg line="${ap.processors.internal}"/>
341.257 - <compilerarg value="-s"/>
341.258 - <compilerarg path="@{apgeneratedsrcdir}"/>
341.259 - <compilerarg line="${ap.proc.none.internal}"/>
341.260 - <customize/>
341.261 - </javac>
341.262 - </sequential>
341.263 - </macrodef>
341.264 - </target>
341.265 - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
341.266 - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
341.267 - <attribute default="${src.dir}" name="srcdir"/>
341.268 - <attribute default="${build.classes.dir}" name="destdir"/>
341.269 - <attribute default="${javac.classpath}" name="classpath"/>
341.270 - <attribute default="${javac.processorpath}" name="processorpath"/>
341.271 - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
341.272 - <attribute default="${includes}" name="includes"/>
341.273 - <attribute default="${excludes}" name="excludes"/>
341.274 - <attribute default="${javac.debug}" name="debug"/>
341.275 - <attribute default="${empty.dir}" name="sourcepath"/>
341.276 - <attribute default="${empty.dir}" name="gensrcdir"/>
341.277 - <element name="customize" optional="true"/>
341.278 - <sequential>
341.279 - <property location="${build.dir}/empty" name="empty.dir"/>
341.280 - <mkdir dir="${empty.dir}"/>
341.281 - <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}">
341.282 - <src>
341.283 - <dirset dir="@{gensrcdir}" erroronmissingdir="false">
341.284 - <include name="*"/>
341.285 - </dirset>
341.286 - </src>
341.287 - <classpath>
341.288 - <path path="@{classpath}"/>
341.289 - </classpath>
341.290 - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
341.291 - <compilerarg line="${javac.compilerargs}"/>
341.292 - <customize/>
341.293 - </javac>
341.294 - </sequential>
341.295 - </macrodef>
341.296 - </target>
341.297 - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
341.298 - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
341.299 - <attribute default="${src.dir}" name="srcdir"/>
341.300 - <attribute default="${build.classes.dir}" name="destdir"/>
341.301 - <attribute default="${javac.classpath}" name="classpath"/>
341.302 - <sequential>
341.303 - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
341.304 - <classpath>
341.305 - <path path="@{classpath}"/>
341.306 - </classpath>
341.307 - </depend>
341.308 - </sequential>
341.309 - </macrodef>
341.310 - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
341.311 - <attribute default="${build.classes.dir}" name="destdir"/>
341.312 - <sequential>
341.313 - <fail unless="javac.includes">Must set javac.includes</fail>
341.314 - <pathconvert pathsep="," property="javac.includes.binary">
341.315 - <path>
341.316 - <filelist dir="@{destdir}" files="${javac.includes}"/>
341.317 - </path>
341.318 - <globmapper from="*.java" to="*.class"/>
341.319 - </pathconvert>
341.320 - <delete>
341.321 - <files includes="${javac.includes.binary}"/>
341.322 - </delete>
341.323 - </sequential>
341.324 - </macrodef>
341.325 - </target>
341.326 - <target name="-init-macrodef-junit">
341.327 - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
341.328 - <attribute default="${includes}" name="includes"/>
341.329 - <attribute default="${excludes}" name="excludes"/>
341.330 - <attribute default="**" name="testincludes"/>
341.331 - <sequential>
341.332 - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
341.333 - <batchtest todir="${build.test.results.dir}">
341.334 - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
341.335 - <filename name="@{testincludes}"/>
341.336 - </fileset>
341.337 - </batchtest>
341.338 - <classpath>
341.339 - <path path="${run.test.classpath}"/>
341.340 - </classpath>
341.341 - <syspropertyset>
341.342 - <propertyref prefix="test-sys-prop."/>
341.343 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
341.344 - </syspropertyset>
341.345 - <formatter type="brief" usefile="false"/>
341.346 - <formatter type="xml"/>
341.347 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
341.348 - <jvmarg line="${run.jvmargs}"/>
341.349 - </junit>
341.350 - </sequential>
341.351 - </macrodef>
341.352 - </target>
341.353 - <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
341.354 - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
341.355 - <attribute default="${main.class}" name="name"/>
341.356 - <attribute default="${debug.classpath}" name="classpath"/>
341.357 - <attribute default="" name="stopclassname"/>
341.358 - <sequential>
341.359 - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
341.360 - <classpath>
341.361 - <path path="@{classpath}"/>
341.362 - </classpath>
341.363 - </nbjpdastart>
341.364 - </sequential>
341.365 - </macrodef>
341.366 - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
341.367 - <attribute default="${build.classes.dir}" name="dir"/>
341.368 - <sequential>
341.369 - <nbjpdareload>
341.370 - <fileset dir="@{dir}" includes="${fix.classes}">
341.371 - <include name="${fix.includes}*.class"/>
341.372 - </fileset>
341.373 - </nbjpdareload>
341.374 - </sequential>
341.375 - </macrodef>
341.376 - </target>
341.377 - <target name="-init-debug-args">
341.378 - <property name="version-output" value="java version "${ant.java.version}"/>
341.379 - <condition property="have-jdk-older-than-1.4">
341.380 - <or>
341.381 - <contains string="${version-output}" substring="java version "1.0"/>
341.382 - <contains string="${version-output}" substring="java version "1.1"/>
341.383 - <contains string="${version-output}" substring="java version "1.2"/>
341.384 - <contains string="${version-output}" substring="java version "1.3"/>
341.385 - </or>
341.386 - </condition>
341.387 - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
341.388 - <istrue value="${have-jdk-older-than-1.4}"/>
341.389 - </condition>
341.390 - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
341.391 - <os family="windows"/>
341.392 - </condition>
341.393 - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
341.394 - <isset property="debug.transport"/>
341.395 - </condition>
341.396 - </target>
341.397 - <target depends="-init-debug-args" name="-init-macrodef-debug">
341.398 - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
341.399 - <attribute default="${main.class}" name="classname"/>
341.400 - <attribute default="${debug.classpath}" name="classpath"/>
341.401 - <element name="customize" optional="true"/>
341.402 - <sequential>
341.403 - <java classname="@{classname}" dir="${work.dir}" fork="true">
341.404 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
341.405 - <jvmarg line="${debug-args-line}"/>
341.406 - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
341.407 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
341.408 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
341.409 - <jvmarg line="${run.jvmargs}"/>
341.410 - <classpath>
341.411 - <path path="@{classpath}"/>
341.412 - </classpath>
341.413 - <syspropertyset>
341.414 - <propertyref prefix="run-sys-prop."/>
341.415 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
341.416 - </syspropertyset>
341.417 - <customize/>
341.418 - </java>
341.419 - </sequential>
341.420 - </macrodef>
341.421 - </target>
341.422 - <target name="-init-macrodef-java">
341.423 - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
341.424 - <attribute default="${main.class}" name="classname"/>
341.425 - <attribute default="${run.classpath}" name="classpath"/>
341.426 - <element name="customize" optional="true"/>
341.427 - <sequential>
341.428 - <java classname="@{classname}" dir="${work.dir}" fork="true">
341.429 - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
341.430 - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
341.431 - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
341.432 - <jvmarg line="${run.jvmargs}"/>
341.433 - <classpath>
341.434 - <path path="@{classpath}"/>
341.435 - </classpath>
341.436 - <syspropertyset>
341.437 - <propertyref prefix="run-sys-prop."/>
341.438 - <mapper from="run-sys-prop.*" to="*" type="glob"/>
341.439 - </syspropertyset>
341.440 - <customize/>
341.441 - </java>
341.442 - </sequential>
341.443 - </macrodef>
341.444 - </target>
341.445 - <target name="-init-presetdef-jar">
341.446 - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
341.447 - <jar compress="${jar.compress}" jarfile="${dist.jar}">
341.448 - <j2seproject1:fileset dir="${build.classes.dir}"/>
341.449 - </jar>
341.450 - </presetdef>
341.451 - </target>
341.452 - <target name="-init-ap-cmdline-properties">
341.453 - <property name="annotation.processing.enabled" value="true"/>
341.454 - <property name="annotation.processing.processors.list" value=""/>
341.455 - <property name="annotation.processing.run.all.processors" value="true"/>
341.456 - <property name="javac.processorpath" value="${javac.classpath}"/>
341.457 - <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
341.458 - <condition property="ap.supported.internal" value="true">
341.459 - <not>
341.460 - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
341.461 - </not>
341.462 - </condition>
341.463 - </target>
341.464 - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
341.465 - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
341.466 - <isfalse value="${annotation.processing.run.all.processors}"/>
341.467 - </condition>
341.468 - <condition else="" property="ap.proc.none.internal" value="-proc:none">
341.469 - <isfalse value="${annotation.processing.enabled}"/>
341.470 - </condition>
341.471 - </target>
341.472 - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
341.473 - <property name="ap.cmd.line.internal" value=""/>
341.474 - </target>
341.475 - <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-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
341.476 - <!--
341.477 - ===================
341.478 - COMPILATION SECTION
341.479 - ===================
341.480 - -->
341.481 - <target name="-deps-jar-init" unless="built-jar.properties">
341.482 - <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
341.483 - <delete file="${built-jar.properties}" quiet="true"/>
341.484 - </target>
341.485 - <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
341.486 - <echo level="warn" message="Cycle detected: web.api was already built"/>
341.487 - </target>
341.488 - <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
341.489 - <mkdir dir="${build.dir}"/>
341.490 - <touch file="${built-jar.properties}" verbose="false"/>
341.491 - <property file="${built-jar.properties}" prefix="already.built.jar."/>
341.492 - <antcall target="-warn-already-built-jar"/>
341.493 - <propertyfile file="${built-jar.properties}">
341.494 - <entry key="${basedir}" value=""/>
341.495 - </propertyfile>
341.496 - <antcall target="-maybe-call-dep">
341.497 - <param name="call.built.properties" value="${built-jar.properties}"/>
341.498 - <param location="${project.indexer}" name="call.subproject"/>
341.499 - <param location="${project.indexer}/build.xml" name="call.script"/>
341.500 - <param name="call.target" value="jar"/>
341.501 - <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
341.502 - </antcall>
341.503 - <antcall target="-maybe-call-dep">
341.504 - <param name="call.built.properties" value="${built-jar.properties}"/>
341.505 - <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
341.506 - <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
341.507 - <param name="call.target" value="netbeans"/>
341.508 - <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
341.509 - </antcall>
341.510 - </target>
341.511 - <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
341.512 - <target depends="init" name="-check-automatic-build">
341.513 - <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
341.514 - </target>
341.515 - <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
341.516 - <antcall target="clean"/>
341.517 - </target>
341.518 - <target depends="init,deps-jar" name="-pre-pre-compile">
341.519 - <mkdir dir="${build.classes.dir}"/>
341.520 - </target>
341.521 - <target name="-pre-compile">
341.522 - <!-- Empty placeholder for easier customization. -->
341.523 - <!-- You can override this target in the ../build.xml file. -->
341.524 - </target>
341.525 - <target if="do.depend.true" name="-compile-depend">
341.526 - <pathconvert property="build.generated.subdirs">
341.527 - <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
341.528 - <include name="*"/>
341.529 - </dirset>
341.530 - </pathconvert>
341.531 - <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
341.532 - </target>
341.533 - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
341.534 - <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
341.535 - <copy todir="${build.classes.dir}">
341.536 - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
341.537 - </copy>
341.538 - </target>
341.539 - <target name="-post-compile">
341.540 - <!-- Empty placeholder for easier customization. -->
341.541 - <!-- You can override this target in the ../build.xml file. -->
341.542 - </target>
341.543 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
341.544 - <target name="-pre-compile-single">
341.545 - <!-- Empty placeholder for easier customization. -->
341.546 - <!-- You can override this target in the ../build.xml file. -->
341.547 - </target>
341.548 - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
341.549 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
341.550 - <j2seproject3:force-recompile/>
341.551 - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
341.552 - </target>
341.553 - <target name="-post-compile-single">
341.554 - <!-- Empty placeholder for easier customization. -->
341.555 - <!-- You can override this target in the ../build.xml file. -->
341.556 - </target>
341.557 - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
341.558 - <!--
341.559 - ====================
341.560 - JAR BUILDING SECTION
341.561 - ====================
341.562 - -->
341.563 - <target depends="init" name="-pre-pre-jar">
341.564 - <dirname file="${dist.jar}" property="dist.jar.dir"/>
341.565 - <mkdir dir="${dist.jar.dir}"/>
341.566 - </target>
341.567 - <target name="-pre-jar">
341.568 - <!-- Empty placeholder for easier customization. -->
341.569 - <!-- You can override this target in the ../build.xml file. -->
341.570 - </target>
341.571 - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
341.572 - <j2seproject1:jar/>
341.573 - </target>
341.574 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
341.575 - <j2seproject1:jar manifest="${manifest.file}"/>
341.576 - </target>
341.577 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
341.578 - <j2seproject1:jar manifest="${manifest.file}">
341.579 - <j2seproject1:manifest>
341.580 - <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
341.581 - </j2seproject1:manifest>
341.582 - </j2seproject1:jar>
341.583 - <echo>To run this application from the command line without Ant, try:</echo>
341.584 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
341.585 - <property location="${dist.jar}" name="dist.jar.resolved"/>
341.586 - <pathconvert property="run.classpath.with.dist.jar">
341.587 - <path path="${run.classpath}"/>
341.588 - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
341.589 - </pathconvert>
341.590 - <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
341.591 - </target>
341.592 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
341.593 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
341.594 - <pathconvert property="run.classpath.without.build.classes.dir">
341.595 - <path path="${run.classpath}"/>
341.596 - <map from="${build.classes.dir.resolved}" to=""/>
341.597 - </pathconvert>
341.598 - <pathconvert pathsep=" " property="jar.classpath">
341.599 - <path path="${run.classpath.without.build.classes.dir}"/>
341.600 - <chainedmapper>
341.601 - <flattenmapper/>
341.602 - <globmapper from="*" to="lib/*"/>
341.603 - </chainedmapper>
341.604 - </pathconvert>
341.605 - <basename file="${application.splash}" property="splashscreen.basename"/>
341.606 - <mkdir dir="${build.classes.dir}/META-INF"/>
341.607 - <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
341.608 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
341.609 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
341.610 - <fileset dir="${build.classes.dir}"/>
341.611 - <manifest>
341.612 - <attribute name="Main-Class" value="${main.class}"/>
341.613 - <attribute name="Class-Path" value="${jar.classpath}"/>
341.614 - <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
341.615 - </manifest>
341.616 - </copylibs>
341.617 - <echo>To run this application from the command line without Ant, try:</echo>
341.618 - <property location="${dist.jar}" name="dist.jar.resolved"/>
341.619 - <echo>java -jar "${dist.jar.resolved}"</echo>
341.620 - </target>
341.621 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
341.622 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
341.623 - <pathconvert property="run.classpath.without.build.classes.dir">
341.624 - <path path="${run.classpath}"/>
341.625 - <map from="${build.classes.dir.resolved}" to=""/>
341.626 - </pathconvert>
341.627 - <pathconvert pathsep=" " property="jar.classpath">
341.628 - <path path="${run.classpath.without.build.classes.dir}"/>
341.629 - <chainedmapper>
341.630 - <flattenmapper/>
341.631 - <globmapper from="*" to="lib/*"/>
341.632 - </chainedmapper>
341.633 - </pathconvert>
341.634 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
341.635 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
341.636 - <fileset dir="${build.classes.dir}"/>
341.637 - <manifest>
341.638 - <attribute name="Main-Class" value="${main.class}"/>
341.639 - <attribute name="Class-Path" value="${jar.classpath}"/>
341.640 - </manifest>
341.641 - </copylibs>
341.642 - <echo>To run this application from the command line without Ant, try:</echo>
341.643 - <property location="${dist.jar}" name="dist.jar.resolved"/>
341.644 - <echo>java -jar "${dist.jar.resolved}"</echo>
341.645 - </target>
341.646 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">
341.647 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
341.648 - <pathconvert property="run.classpath.without.build.classes.dir">
341.649 - <path path="${run.classpath}"/>
341.650 - <map from="${build.classes.dir.resolved}" to=""/>
341.651 - </pathconvert>
341.652 - <pathconvert pathsep=" " property="jar.classpath">
341.653 - <path path="${run.classpath.without.build.classes.dir}"/>
341.654 - <chainedmapper>
341.655 - <flattenmapper/>
341.656 - <globmapper from="*" to="lib/*"/>
341.657 - </chainedmapper>
341.658 - </pathconvert>
341.659 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
341.660 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
341.661 - <fileset dir="${build.classes.dir}"/>
341.662 - <manifest>
341.663 - <attribute name="Class-Path" value="${jar.classpath}"/>
341.664 - </manifest>
341.665 - </copylibs>
341.666 - </target>
341.667 - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">
341.668 - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
341.669 - <pathconvert property="run.classpath.without.build.classes.dir">
341.670 - <path path="${run.classpath}"/>
341.671 - <map from="${build.classes.dir.resolved}" to=""/>
341.672 - </pathconvert>
341.673 - <pathconvert pathsep=" " property="jar.classpath">
341.674 - <path path="${run.classpath.without.build.classes.dir}"/>
341.675 - <chainedmapper>
341.676 - <flattenmapper/>
341.677 - <globmapper from="*" to="lib/*"/>
341.678 - </chainedmapper>
341.679 - </pathconvert>
341.680 - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
341.681 - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
341.682 - <fileset dir="${build.classes.dir}"/>
341.683 - <manifest>
341.684 - <attribute name="Class-Path" value="${jar.classpath}"/>
341.685 - </manifest>
341.686 - </copylibs>
341.687 - </target>
341.688 - <target name="-post-jar">
341.689 - <!-- Empty placeholder for easier customization. -->
341.690 - <!-- You can override this target in the ../build.xml file. -->
341.691 - </target>
341.692 - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>
341.693 - <!--
341.694 - =================
341.695 - EXECUTION SECTION
341.696 - =================
341.697 - -->
341.698 - <target depends="init,compile" description="Run a main class." name="run">
341.699 - <j2seproject1:java>
341.700 - <customize>
341.701 - <arg line="${application.args}"/>
341.702 - </customize>
341.703 - </j2seproject1:java>
341.704 - </target>
341.705 - <target name="-do-not-recompile">
341.706 - <property name="javac.includes.binary" value=""/>
341.707 - </target>
341.708 - <target depends="init,compile-single" name="run-single">
341.709 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
341.710 - <j2seproject1:java classname="${run.class}"/>
341.711 - </target>
341.712 - <target depends="init,compile-test-single" name="run-test-with-main">
341.713 - <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
341.714 - <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
341.715 - </target>
341.716 - <!--
341.717 - =================
341.718 - DEBUGGING SECTION
341.719 - =================
341.720 - -->
341.721 - <target depends="init" if="netbeans.home" name="-debug-start-debugger">
341.722 - <j2seproject1:nbjpdastart name="${debug.class}"/>
341.723 - </target>
341.724 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
341.725 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
341.726 - </target>
341.727 - <target depends="init,compile" name="-debug-start-debuggee">
341.728 - <j2seproject3:debug>
341.729 - <customize>
341.730 - <arg line="${application.args}"/>
341.731 - </customize>
341.732 - </j2seproject3:debug>
341.733 - </target>
341.734 - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
341.735 - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
341.736 - <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
341.737 - </target>
341.738 - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
341.739 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
341.740 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
341.741 - <j2seproject3:debug classname="${debug.class}"/>
341.742 - </target>
341.743 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
341.744 - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
341.745 - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
341.746 - <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
341.747 - </target>
341.748 - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
341.749 - <target depends="init" name="-pre-debug-fix">
341.750 - <fail unless="fix.includes">Must set fix.includes</fail>
341.751 - <property name="javac.includes" value="${fix.includes}.java"/>
341.752 - </target>
341.753 - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
341.754 - <j2seproject1:nbjpdareload/>
341.755 - </target>
341.756 - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
341.757 - <!--
341.758 - ===============
341.759 - JAVADOC SECTION
341.760 - ===============
341.761 - -->
341.762 - <target depends="init" if="have.sources" name="-javadoc-build">
341.763 - <mkdir dir="${dist.javadoc.dir}"/>
341.764 - <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}">
341.765 - <classpath>
341.766 - <path path="${javac.classpath}"/>
341.767 - </classpath>
341.768 - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
341.769 - <filename name="**/*.java"/>
341.770 - </fileset>
341.771 - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
341.772 - <include name="**/*.java"/>
341.773 - </fileset>
341.774 - </javadoc>
341.775 - </target>
341.776 - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
341.777 - <nbbrowse file="${dist.javadoc.dir}/index.html"/>
341.778 - </target>
341.779 - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
341.780 - <!--
341.781 - =========================
341.782 - JUNIT COMPILATION SECTION
341.783 - =========================
341.784 - -->
341.785 - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
341.786 - <mkdir dir="${build.test.classes.dir}"/>
341.787 - </target>
341.788 - <target name="-pre-compile-test">
341.789 - <!-- Empty placeholder for easier customization. -->
341.790 - <!-- You can override this target in the ../build.xml file. -->
341.791 - </target>
341.792 - <target if="do.depend.true" name="-compile-test-depend">
341.793 - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
341.794 - </target>
341.795 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
341.796 - <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}"/>
341.797 - <copy todir="${build.test.classes.dir}">
341.798 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
341.799 - </copy>
341.800 - </target>
341.801 - <target name="-post-compile-test">
341.802 - <!-- Empty placeholder for easier customization. -->
341.803 - <!-- You can override this target in the ../build.xml file. -->
341.804 - </target>
341.805 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
341.806 - <target name="-pre-compile-test-single">
341.807 - <!-- Empty placeholder for easier customization. -->
341.808 - <!-- You can override this target in the ../build.xml file. -->
341.809 - </target>
341.810 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
341.811 - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
341.812 - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
341.813 - <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}"/>
341.814 - <copy todir="${build.test.classes.dir}">
341.815 - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
341.816 - </copy>
341.817 - </target>
341.818 - <target name="-post-compile-test-single">
341.819 - <!-- Empty placeholder for easier customization. -->
341.820 - <!-- You can override this target in the ../build.xml file. -->
341.821 - </target>
341.822 - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
341.823 - <!--
341.824 - =======================
341.825 - JUNIT EXECUTION SECTION
341.826 - =======================
341.827 - -->
341.828 - <target depends="init" if="have.tests" name="-pre-test-run">
341.829 - <mkdir dir="${build.test.results.dir}"/>
341.830 - </target>
341.831 - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
341.832 - <j2seproject3:junit testincludes="**/*Test.java"/>
341.833 - </target>
341.834 - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
341.835 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
341.836 - </target>
341.837 - <target depends="init" if="have.tests" name="test-report"/>
341.838 - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
341.839 - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
341.840 - <target depends="init" if="have.tests" name="-pre-test-run-single">
341.841 - <mkdir dir="${build.test.results.dir}"/>
341.842 - </target>
341.843 - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
341.844 - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
341.845 - <j2seproject3:junit excludes="" includes="${test.includes}"/>
341.846 - </target>
341.847 - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
341.848 - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
341.849 - </target>
341.850 - <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"/>
341.851 - <!--
341.852 - =======================
341.853 - JUNIT DEBUGGING SECTION
341.854 - =======================
341.855 - -->
341.856 - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
341.857 - <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
341.858 - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
341.859 - <delete file="${test.report.file}"/>
341.860 - <mkdir dir="${build.test.results.dir}"/>
341.861 - <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}">
341.862 - <customize>
341.863 - <syspropertyset>
341.864 - <propertyref prefix="test-sys-prop."/>
341.865 - <mapper from="test-sys-prop.*" to="*" type="glob"/>
341.866 - </syspropertyset>
341.867 - <arg value="${test.class}"/>
341.868 - <arg value="showoutput=true"/>
341.869 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
341.870 - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
341.871 - </customize>
341.872 - </j2seproject3:debug>
341.873 - </target>
341.874 - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
341.875 - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
341.876 - </target>
341.877 - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
341.878 - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
341.879 - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
341.880 - </target>
341.881 - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
341.882 - <!--
341.883 - =========================
341.884 - APPLET EXECUTION SECTION
341.885 - =========================
341.886 - -->
341.887 - <target depends="init,compile-single" name="run-applet">
341.888 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
341.889 - <j2seproject1:java classname="sun.applet.AppletViewer">
341.890 - <customize>
341.891 - <arg value="${applet.url}"/>
341.892 - </customize>
341.893 - </j2seproject1:java>
341.894 - </target>
341.895 - <!--
341.896 - =========================
341.897 - APPLET DEBUGGING SECTION
341.898 - =========================
341.899 - -->
341.900 - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
341.901 - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
341.902 - <j2seproject3:debug classname="sun.applet.AppletViewer">
341.903 - <customize>
341.904 - <arg value="${applet.url}"/>
341.905 - </customize>
341.906 - </j2seproject3:debug>
341.907 - </target>
341.908 - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
341.909 - <!--
341.910 - ===============
341.911 - CLEANUP SECTION
341.912 - ===============
341.913 - -->
341.914 - <target name="-deps-clean-init" unless="built-clean.properties">
341.915 - <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
341.916 - <delete file="${built-clean.properties}" quiet="true"/>
341.917 - </target>
341.918 - <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
341.919 - <echo level="warn" message="Cycle detected: web.api was already built"/>
341.920 - </target>
341.921 - <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
341.922 - <mkdir dir="${build.dir}"/>
341.923 - <touch file="${built-clean.properties}" verbose="false"/>
341.924 - <property file="${built-clean.properties}" prefix="already.built.clean."/>
341.925 - <antcall target="-warn-already-built-clean"/>
341.926 - <propertyfile file="${built-clean.properties}">
341.927 - <entry key="${basedir}" value=""/>
341.928 - </propertyfile>
341.929 - <antcall target="-maybe-call-dep">
341.930 - <param name="call.built.properties" value="${built-clean.properties}"/>
341.931 - <param location="${project.indexer}" name="call.subproject"/>
341.932 - <param location="${project.indexer}/build.xml" name="call.script"/>
341.933 - <param name="call.target" value="clean"/>
341.934 - <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
341.935 - </antcall>
341.936 - <antcall target="-maybe-call-dep">
341.937 - <param name="call.built.properties" value="${built-clean.properties}"/>
341.938 - <param location="${project.org_netbeans_modules_jackpot30_api}" name="call.subproject"/>
341.939 - <param location="${project.org_netbeans_modules_jackpot30_api}/build.xml" name="call.script"/>
341.940 - <param name="call.target" value="clean"/>
341.941 - <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
341.942 - </antcall>
341.943 - </target>
341.944 - <target depends="init" name="-do-clean">
341.945 - <delete dir="${build.dir}"/>
341.946 - <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
341.947 - </target>
341.948 - <target name="-post-clean">
341.949 - <!-- Empty placeholder for easier customization. -->
341.950 - <!-- You can override this target in the ../build.xml file. -->
341.951 - </target>
341.952 - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
341.953 - <target name="-check-call-dep">
341.954 - <property file="${call.built.properties}" prefix="already.built."/>
341.955 - <condition property="should.call.dep">
341.956 - <not>
341.957 - <isset property="already.built.${call.subproject}"/>
341.958 - </not>
341.959 - </condition>
341.960 - </target>
341.961 - <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
341.962 - <ant antfile="${call.script}" inheritall="false" target="${call.target}">
341.963 - <propertyset>
341.964 - <propertyref prefix="transfer."/>
341.965 - <mapper from="transfer.*" to="*" type="glob"/>
341.966 - </propertyset>
341.967 - </ant>
341.968 - </target>
341.969 -</project>
342.1 --- a/server/web.api/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
342.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
342.3 @@ -1,8 +0,0 @@
342.4 -build.xml.data.CRC32=2d84667c
342.5 -build.xml.script.CRC32=0d0c4a18
342.6 -build.xml.stylesheet.CRC32=958a1d3e@1.27.0.45
342.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
342.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
342.9 -nbproject/build-impl.xml.data.CRC32=2d84667c
342.10 -nbproject/build-impl.xml.script.CRC32=8250004f
342.11 -nbproject/build-impl.xml.stylesheet.CRC32=ff4aa3ed@1.35.0.45
343.1 --- a/server/web.api/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
343.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
343.3 @@ -1,99 +0,0 @@
343.4 -annotation.processing.enabled=true
343.5 -annotation.processing.enabled.in.editor=false
343.6 -annotation.processing.run.all.processors=true
343.7 -application.title=web.api
343.8 -application.vendor=lahvac
343.9 -build.classes.dir=${build.dir}/classes
343.10 -build.classes.excludes=**/*.java,**/*.form
343.11 -# This directory is removed when the project is cleaned:
343.12 -build.dir=build
343.13 -build.generated.dir=${build.dir}/generated
343.14 -build.generated.sources.dir=${build.dir}/generated-sources
343.15 -# Only compile against the classpath explicitly listed here:
343.16 -build.sysclasspath=ignore
343.17 -build.test.classes.dir=${build.dir}/test/classes
343.18 -build.test.results.dir=${build.dir}/test/results
343.19 -# Uncomment to specify the preferred debugger connection transport:
343.20 -#debug.transport=dt_socket
343.21 -debug.classpath=\
343.22 - ${run.classpath}
343.23 -debug.test.classpath=\
343.24 - ${run.test.classpath}
343.25 -# This directory is removed when the project is cleaned:
343.26 -dist.dir=dist
343.27 -dist.jar=${dist.dir}/web.api.jar
343.28 -dist.javadoc.dir=${dist.dir}/javadoc
343.29 -endorsed.classpath=\
343.30 - ${libs.javac.classpath}
343.31 -excludes=
343.32 -file.reference.org-netbeans-modules-java-source.jar=../lib/org-netbeans-modules-java-source.jar
343.33 -file.reference.org-netbeans-spi-editor-hints.jar=../lib/org-netbeans-spi-editor-hints.jar
343.34 -file.reference.org-openide-filesystems.jar=../lib/org-openide-filesystems.jar
343.35 -file.reference.org-openide-util-lookup.jar=../lib/org-openide-util-lookup.jar
343.36 -file.reference.org-openide-util.jar=../lib/org-openide-util.jar
343.37 -file.reference.util-commons.jar=../../remoting/ide/api/external/util-commons.jar
343.38 -file.reference.util-pojson.jar=../../remoting/ide/api/external/util-pojson.jar
343.39 -includes=**
343.40 -jar.compress=false
343.41 -javac.classpath=\
343.42 - ${reference.org_netbeans_modules_jackpot30_api.module}:\
343.43 - ${libs.jersey.classpath}:\
343.44 - ${libs.lucene.classpath}:\
343.45 - ${libs.javac.classpath}:\
343.46 - ${reference.indexer.jar}:\
343.47 - ${file.reference.org-netbeans-modules-java-source.jar}:\
343.48 - ${file.reference.org-openide-filesystems.jar}:\
343.49 - ${file.reference.util-commons.jar}:\
343.50 - ${file.reference.util-pojson.jar}:\
343.51 - ${libs.freemarker.classpath}:\
343.52 - ${file.reference.org-openide-util.jar}:\
343.53 - ${file.reference.org-openide-util-lookup.jar}:\
343.54 - ${file.reference.org-netbeans-spi-editor-hints.jar}:\
343.55 - ${reference.org_netbeans_modules_jackpot30_remoting_api.module}
343.56 -# Space-separated list of extra javac options
343.57 -javac.compilerargs=
343.58 -javac.deprecation=false
343.59 -javac.processorpath=\
343.60 - ${javac.classpath}
343.61 -javac.source=1.5
343.62 -javac.target=1.5
343.63 -javac.test.classpath=\
343.64 - ${javac.classpath}:\
343.65 - ${build.classes.dir}:\
343.66 - ${libs.junit_4.classpath}
343.67 -javadoc.additionalparam=
343.68 -javadoc.author=false
343.69 -javadoc.encoding=${source.encoding}
343.70 -javadoc.noindex=false
343.71 -javadoc.nonavbar=false
343.72 -javadoc.notree=false
343.73 -javadoc.private=false
343.74 -javadoc.splitindex=true
343.75 -javadoc.use=true
343.76 -javadoc.version=false
343.77 -javadoc.windowtitle=
343.78 -jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
343.79 -main.class=org.netbeans.modules.jackpot30.server.webapi.Main
343.80 -manifest.file=manifest.mf
343.81 -meta.inf.dir=${src.dir}/META-INF
343.82 -mkdist.disabled=false
343.83 -platform.active=default_platform
343.84 -project.indexer=../indexer
343.85 -project.org_netbeans_modules_jackpot30_api=../../api
343.86 -project.org_netbeans_modules_jackpot30_remoting_api=../../remoting/ide/api
343.87 -reference.indexer.jar=${project.indexer}/dist/indexer.jar
343.88 -reference.org_netbeans_modules_jackpot30_api.module=${project.org_netbeans_modules_jackpot30_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-api.jar
343.89 -reference.org_netbeans_modules_jackpot30_remoting_api.module=${project.org_netbeans_modules_jackpot30_remoting_api}/../build/cluster/modules/org-netbeans-modules-jackpot30-remoting-api.jar
343.90 -run.classpath=\
343.91 - ${javac.classpath}:\
343.92 - ${build.classes.dir}
343.93 -# Space-separated list of JVM arguments used when running the project
343.94 -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
343.95 -# or test-sys-prop.name=value to set system properties for unit tests):
343.96 -run.jvmargs=-Xbootclasspath/p:${libs.javac.classpath}
343.97 -run.test.classpath=\
343.98 - ${javac.test.classpath}:\
343.99 - ${build.test.classes.dir}
343.100 -source.encoding=UTF-8
343.101 -src.dir=src
343.102 -test.src.dir=test
344.1 --- a/server/web.api/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
344.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
344.3 @@ -1,44 +0,0 @@
344.4 -<?xml version="1.0" encoding="UTF-8"?>
344.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
344.6 - <type>org.netbeans.modules.java.j2seproject</type>
344.7 - <configuration>
344.8 - <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
344.9 - <name>web.api</name>
344.10 - <source-roots>
344.11 - <root id="src.dir"/>
344.12 - </source-roots>
344.13 - <test-roots>
344.14 - <root id="test.src.dir"/>
344.15 - </test-roots>
344.16 - </data>
344.17 - <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
344.18 - <definitions>../lib/nblibraries.properties</definitions>
344.19 - </libraries>
344.20 - <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
344.21 - <reference>
344.22 - <foreign-project>indexer</foreign-project>
344.23 - <artifact-type>jar</artifact-type>
344.24 - <script>build.xml</script>
344.25 - <target>jar</target>
344.26 - <clean-target>clean</clean-target>
344.27 - <id>jar</id>
344.28 - </reference>
344.29 - <reference>
344.30 - <foreign-project>org_netbeans_modules_jackpot30_api</foreign-project>
344.31 - <artifact-type>jar</artifact-type>
344.32 - <script>build.xml</script>
344.33 - <target>netbeans</target>
344.34 - <clean-target>clean</clean-target>
344.35 - <id>module</id>
344.36 - </reference>
344.37 - <reference>
344.38 - <foreign-project>org_netbeans_modules_jackpot30_remoting_api</foreign-project>
344.39 - <artifact-type>jar</artifact-type>
344.40 - <script>build.xml</script>
344.41 - <target>netbeans</target>
344.42 - <clean-target>clean</clean-target>
344.43 - <id>module</id>
344.44 - </reference>
344.45 - </references>
344.46 - </configuration>
344.47 -</project>
345.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/API.java Sat Feb 18 22:14:42 2012 +0100
345.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
345.3 @@ -1,233 +0,0 @@
345.4 -/*
345.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
345.6 - *
345.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
345.8 - *
345.9 - * The contents of this file are subject to the terms of either the GNU
345.10 - * General Public License Version 2 only ("GPL") or the Common
345.11 - * Development and Distribution License("CDDL") (collectively, the
345.12 - * "License"). You may not use this file except in compliance with the
345.13 - * License. You can obtain a copy of the License at
345.14 - * http://www.netbeans.org/cddl-gplv2.html
345.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
345.16 - * specific language governing permissions and limitations under the
345.17 - * License. When distributing the software, include this License Header
345.18 - * Notice in each file and include the License file at
345.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
345.20 - * particular file as subject to the "Classpath" exception as provided
345.21 - * by Sun in the GPL Version 2 section of the License file that
345.22 - * accompanied this code. If applicable, add the following below the
345.23 - * License Header, with the fields enclosed by brackets [] replaced by
345.24 - * your own identifying information:
345.25 - * "Portions Copyrighted [year] [name of copyright owner]"
345.26 - *
345.27 - * If you wish your version of this file to be governed by only the CDDL
345.28 - * or only the GPL Version 2, indicate your decision by adding
345.29 - * "[Contributor] elects to include this software in this distribution
345.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
345.31 - * single choice of license, a recipient has the option to distribute
345.32 - * your version of this file under either the CDDL, the GPL Version 2 or
345.33 - * to extend the choice of license to its licensees as provided above.
345.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
345.35 - * Version 2 license, then the option applies only if the new code is
345.36 - * made subject to such option by the copyright holder.
345.37 - *
345.38 - * Contributor(s):
345.39 - *
345.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
345.41 - */
345.42 -
345.43 -package org.netbeans.modules.jackpot30.server.webapi;
345.44 -
345.45 -import java.io.IOException;
345.46 -import java.net.URL;
345.47 -import java.util.Arrays;
345.48 -import java.util.Collection;
345.49 -import java.util.HashMap;
345.50 -import java.util.LinkedList;
345.51 -import java.util.List;
345.52 -import java.util.Map;
345.53 -import java.util.Map.Entry;
345.54 -import javax.tools.Diagnostic;
345.55 -import javax.tools.JavaFileObject;
345.56 -import javax.ws.rs.DefaultValue;
345.57 -import javax.ws.rs.GET;
345.58 -import javax.ws.rs.Path;
345.59 -import javax.ws.rs.Produces;
345.60 -import javax.ws.rs.QueryParam;
345.61 -import org.codeviation.pojson.Pojson;
345.62 -import org.netbeans.modules.jackpot30.impl.examples.Example;
345.63 -import org.netbeans.modules.jackpot30.impl.examples.Example.Option;
345.64 -import org.netbeans.modules.jackpot30.impl.examples.LoadExamples;
345.65 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
345.66 -import org.netbeans.modules.jackpot30.impl.indexing.FileBasedIndex;
345.67 -import org.netbeans.modules.jackpot30.impl.indexing.Index;
345.68 -import org.netbeans.modules.jackpot30.server.indexer.StandaloneFinder;
345.69 -
345.70 -/**
345.71 - *
345.72 - * @author lahvac
345.73 - */
345.74 -@Path("/")
345.75 -public class API {
345.76 -
345.77 - @GET
345.78 - @Path("/find")
345.79 - @Produces("text/plain")
345.80 - public String find(@QueryParam("path") String segment, @QueryParam("pattern") String pattern) throws IOException {
345.81 - StringBuilder sb = new StringBuilder();
345.82 -
345.83 - for (String candidate : StandaloneFinder.findCandidates(Cache.sourceRootForKey(segment), pattern)) {
345.84 - sb.append(candidate);
345.85 - sb.append("\n");
345.86 - }
345.87 -
345.88 - return sb.toString();
345.89 - }
345.90 -
345.91 - @GET
345.92 - @Path("/findSpans")
345.93 - @Produces("text/plain")
345.94 - public String findSpans(@QueryParam("path") String segment, @QueryParam("relativePath") String relativePath, @QueryParam("pattern") String pattern) throws IOException {
345.95 - StringBuilder sb = new StringBuilder();
345.96 -
345.97 - for (int o : StandaloneFinder.findCandidateOccurrenceSpans(Cache.sourceRootForKey(segment), relativePath, pattern)) {
345.98 - sb.append(o);
345.99 - sb.append(":");
345.100 - }
345.101 -
345.102 - if (sb.length() > 0) {
345.103 - sb.delete(sb.length() - 1, sb.length());
345.104 - }
345.105 -
345.106 - return sb.toString();
345.107 - }
345.108 -
345.109 - @GET
345.110 - @Path("/list")
345.111 - @Produces("text/plain")
345.112 - public String list() throws IOException {
345.113 - StringBuilder sb = new StringBuilder();
345.114 -
345.115 - for (String root : Cache.knownSourceRoots()) {
345.116 - URL sourceRoot = Cache.sourceRootForKey(root).toURI().toURL();
345.117 - Index index = FileBasedIndex.get(sourceRoot);
345.118 - String displayName;
345.119 -
345.120 - if (index != null && index.getIndexInfo().displayName != null) {
345.121 - displayName = index.getIndexInfo().displayName;
345.122 - } else {
345.123 - String path = sourceRoot.getPath().replaceFirst("/$", "");
345.124 -
345.125 - displayName = path.substring(path.lastIndexOf('/') + 1);
345.126 - }
345.127 -
345.128 - sb.append(root);
345.129 - sb.append(":");
345.130 - sb.append(displayName);
345.131 - sb.append("\n");
345.132 - }
345.133 -
345.134 - return sb.toString();
345.135 - }
345.136 -
345.137 - @GET
345.138 - @Path("/cat")
345.139 - @Produces("text/plain")
345.140 - public String cat(@QueryParam("path") String segment, @QueryParam("relative") String relative) throws IOException {
345.141 - URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
345.142 - Index index = FileBasedIndex.get(sourceRoot);
345.143 -
345.144 - if (index == null) {
345.145 - throw new IOException("No index");
345.146 - }
345.147 -
345.148 - CharSequence source = index.getSourceCode(relative);
345.149 -
345.150 - if (source == null) {
345.151 - throw new IOException("Source code not found");
345.152 - }
345.153 -
345.154 - return source.toString().replaceAll("\r\n", "\n");
345.155 - }
345.156 -
345.157 - @GET
345.158 - @Path("/info")
345.159 - @Produces("text/plain")
345.160 - public String info(@QueryParam("path") String segment) throws IOException {
345.161 - URL sourceRoot = Cache.sourceRootForKey(segment).toURI().toURL();
345.162 - Index index = FileBasedIndex.get(sourceRoot);
345.163 -
345.164 - if (index == null) {
345.165 - throw new IOException("No index");
345.166 - }
345.167 -
345.168 - return Pojson.save(index.getIndexInfo());
345.169 - }
345.170 -
345.171 - @GET
345.172 - @Path("/examples")
345.173 - @Produces("text/plain")
345.174 - public String examples() throws IOException {
345.175 - List<Map<String, String>> examples = new LinkedList<Map<String, String>>();
345.176 -
345.177 - for (Example ex : LoadExamples.loadExamples()) {
345.178 - if (ex.getOptions().contains(Option.VERIFY) || ex.getOptions().contains(Option.FIX)) continue;
345.179 - Map<String, String> desc = new HashMap<String, String>();
345.180 -
345.181 - desc.put("displayName", ex.getDisplayName());
345.182 - desc.put("pattern", ex.getCode());
345.183 -
345.184 - examples.add(desc);
345.185 - }
345.186 -
345.187 - return Pojson.save(examples);
345.188 - }
345.189 -
345.190 - @GET
345.191 - @Path("/errors")
345.192 - @Produces("text/plain")
345.193 - public String errors(@QueryParam("pattern") String pattern) throws IOException {
345.194 - StringBuilder sb = new StringBuilder();
345.195 -
345.196 - for (Diagnostic<? extends JavaFileObject> d : StandaloneFinder.parseAndReportErrors(pattern)) {
345.197 - sb.append(d.getMessage(null));
345.198 - sb.append("\n");
345.199 - }
345.200 -
345.201 - return sb.toString();
345.202 - }
345.203 -
345.204 - @GET
345.205 - @Path("/findDuplicates")
345.206 - @Produces("text/plain")
345.207 - public String findDuplicates(@QueryParam("path") String segment, @QueryParam("hashes") String hashes) throws IOException {
345.208 - Map<String, Map<String, Collection<? extends String>>> hash2Segment2Contains = new HashMap<String, Map<String, Collection<? extends String>>>();
345.209 - Collection<String> segments = new LinkedList<String>();
345.210 -
345.211 - if (segment != null) segments.add(segment);
345.212 - else {
345.213 - for (String key : Cache.knownSourceRoots()) {
345.214 - segments.add(key);
345.215 - }
345.216 - }
345.217 -
345.218 - Iterable<? extends String> hashesList = Arrays.asList(Pojson.load(String[].class, hashes));
345.219 -
345.220 - for (String key : segments) {
345.221 - Map<String, Collection<? extends String>> found = StandaloneFinder.containsHash(Cache.sourceRootForKey(key), hashesList);
345.222 -
345.223 - for (Entry<String, Collection<? extends String>> e : found.entrySet()) {
345.224 - Map<String, Collection<? extends String>> perRoot = hash2Segment2Contains.get(e.getKey());
345.225 -
345.226 - if (perRoot == null) {
345.227 - hash2Segment2Contains.put(e.getKey(), perRoot = new HashMap<String, Collection<? extends String>>());
345.228 - }
345.229 -
345.230 - perRoot.put(key, e.getValue());
345.231 - }
345.232 - }
345.233 -
345.234 - return Pojson.save(hash2Segment2Contains);
345.235 - }
345.236 -}
346.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/Main.java Sat Feb 18 22:14:42 2012 +0100
346.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
346.3 @@ -1,93 +0,0 @@
346.4 -/*
346.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
346.6 - *
346.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
346.8 - *
346.9 - * The contents of this file are subject to the terms of either the GNU
346.10 - * General Public License Version 2 only ("GPL") or the Common
346.11 - * Development and Distribution License("CDDL") (collectively, the
346.12 - * "License"). You may not use this file except in compliance with the
346.13 - * License. You can obtain a copy of the License at
346.14 - * http://www.netbeans.org/cddl-gplv2.html
346.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
346.16 - * specific language governing permissions and limitations under the
346.17 - * License. When distributing the software, include this License Header
346.18 - * Notice in each file and include the License file at
346.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
346.20 - * particular file as subject to the "Classpath" exception as provided
346.21 - * by Sun in the GPL Version 2 section of the License file that
346.22 - * accompanied this code. If applicable, add the following below the
346.23 - * License Header, with the fields enclosed by brackets [] replaced by
346.24 - * your own identifying information:
346.25 - * "Portions Copyrighted [year] [name of copyright owner]"
346.26 - *
346.27 - * If you wish your version of this file to be governed by only the CDDL
346.28 - * or only the GPL Version 2, indicate your decision by adding
346.29 - * "[Contributor] elects to include this software in this distribution
346.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
346.31 - * single choice of license, a recipient has the option to distribute
346.32 - * your version of this file under either the CDDL, the GPL Version 2 or
346.33 - * to extend the choice of license to its licensees as provided above.
346.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
346.35 - * Version 2 license, then the option applies only if the new code is
346.36 - * made subject to such option by the copyright holder.
346.37 - *
346.38 - * Contributor(s):
346.39 - *
346.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
346.41 - */
346.42 -
346.43 -package org.netbeans.modules.jackpot30.server.webapi;
346.44 -
346.45 -import com.sun.grizzly.http.embed.GrizzlyWebServer;
346.46 -import com.sun.grizzly.http.servlet.ServletAdapter;
346.47 -import com.sun.grizzly.tcp.http11.GrizzlyAdapter;
346.48 -import com.sun.grizzly.tcp.http11.GrizzlyRequest;
346.49 -import com.sun.grizzly.tcp.http11.GrizzlyResponse;
346.50 -import com.sun.jersey.spi.container.servlet.ServletContainer;
346.51 -import java.io.File;
346.52 -import java.io.IOException;
346.53 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
346.54 -
346.55 -/**
346.56 - *
346.57 - * @author lahvac
346.58 - */
346.59 -public class Main {
346.60 -
346.61 - /**
346.62 - * @param args the command line arguments
346.63 - */
346.64 - public static void main(String[] args) throws IOException {
346.65 - if (args.length != 1 && args.length != 2) {
346.66 - System.err.println("Usage: java -jar " + Main.class.getProtectionDomain().getCodeSource().getLocation().getPath() + " <cache> [<static-content>]");
346.67 - return ;
346.68 - }
346.69 -
346.70 - Cache.setStandaloneCacheRoot(new File(args[0]));
346.71 -
346.72 - GrizzlyWebServer gws;
346.73 -
346.74 - if (args.length == 2) {
346.75 - gws = new GrizzlyWebServer(9998, args[1]);
346.76 - } else {
346.77 - gws = new GrizzlyWebServer(9998);
346.78 - }
346.79 -
346.80 - // Jersey web resources
346.81 - ServletAdapter jerseyAdapter = new ServletAdapter();
346.82 - jerseyAdapter.addInitParameter("com.sun.jersey.config.property.packages", "org.netbeans.modules.jackpot30.server.webapi");
346.83 - jerseyAdapter.setContextPath("/index");
346.84 - jerseyAdapter.setServletInstance(new ServletContainer());
346.85 -
346.86 - // register all above defined adapters
346.87 - gws.addGrizzlyAdapter(jerseyAdapter);
346.88 - gws.addGrizzlyAdapter(new GrizzlyAdapter(){
346.89 - public void service(GrizzlyRequest request, GrizzlyResponse response){}
346.90 - });
346.91 -
346.92 - // let Grizzly run
346.93 - gws.start();
346.94 - }
346.95 -
346.96 -}
347.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/UI.java Sat Feb 18 22:14:42 2012 +0100
347.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
347.3 @@ -1,274 +0,0 @@
347.4 -/*
347.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
347.6 - *
347.7 - * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved.
347.8 - *
347.9 - * The contents of this file are subject to the terms of either the GNU
347.10 - * General Public License Version 2 only ("GPL") or the Common
347.11 - * Development and Distribution License("CDDL") (collectively, the
347.12 - * "License"). You may not use this file except in compliance with the
347.13 - * License. You can obtain a copy of the License at
347.14 - * http://www.netbeans.org/cddl-gplv2.html
347.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
347.16 - * specific language governing permissions and limitations under the
347.17 - * License. When distributing the software, include this License Header
347.18 - * Notice in each file and include the License file at
347.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
347.20 - * particular file as subject to the "Classpath" exception as provided
347.21 - * by Sun in the GPL Version 2 section of the License file that
347.22 - * accompanied this code. If applicable, add the following below the
347.23 - * License Header, with the fields enclosed by brackets [] replaced by
347.24 - * your own identifying information:
347.25 - * "Portions Copyrighted [year] [name of copyright owner]"
347.26 - *
347.27 - * If you wish your version of this file to be governed by only the CDDL
347.28 - * or only the GPL Version 2, indicate your decision by adding
347.29 - * "[Contributor] elects to include this software in this distribution
347.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
347.31 - * single choice of license, a recipient has the option to distribute
347.32 - * your version of this file under either the CDDL, the GPL Version 2 or
347.33 - * to extend the choice of license to its licensees as provided above.
347.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
347.35 - * Version 2 license, then the option applies only if the new code is
347.36 - * made subject to such option by the copyright holder.
347.37 - *
347.38 - * Contributor(s):
347.39 - *
347.40 - * Portions Copyrighted 2009-2010 Sun Microsystems, Inc.
347.41 - */
347.42 -
347.43 -package org.netbeans.modules.jackpot30.server.webapi;
347.44 -
347.45 -import freemarker.cache.TemplateLoader;
347.46 -import freemarker.template.Configuration;
347.47 -import freemarker.template.Template;
347.48 -import freemarker.template.TemplateException;
347.49 -import java.io.IOException;
347.50 -import java.io.InputStream;
347.51 -import java.io.InputStreamReader;
347.52 -import java.io.Reader;
347.53 -import java.io.StringWriter;
347.54 -import java.net.URI;
347.55 -import java.net.URISyntaxException;
347.56 -import java.util.ArrayList;
347.57 -import java.util.Collections;
347.58 -import java.util.HashMap;
347.59 -import java.util.LinkedList;
347.60 -import java.util.List;
347.61 -import java.util.Map;
347.62 -import javax.ws.rs.GET;
347.63 -import javax.ws.rs.Path;
347.64 -import javax.ws.rs.Produces;
347.65 -import javax.ws.rs.QueryParam;
347.66 -import org.codeviation.pojson.Pojson;
347.67 -import org.netbeans.modules.jackpot30.remoting.api.WebUtilities;
347.68 -import static org.netbeans.modules.jackpot30.remoting.api.WebUtilities.escapeForQuery;
347.69 -
347.70 -/**
347.71 - *
347.72 - * @author lahvac
347.73 - */
347.74 -@Path("/ui")
347.75 -public class UI {
347.76 -
347.77 - @GET
347.78 - @Path("/search")
347.79 - @Produces("text/html")
347.80 - public String search(@QueryParam("path") String path, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
347.81 - Map<String, Object> configurationData = new HashMap<String, Object>();
347.82 -
347.83 - configurationData.put("paths", list());
347.84 - configurationData.put("selectedPath", path);
347.85 - configurationData.put("pattern", pattern);
347.86 - configurationData.put("patternEscaped", escapeForQuery(pattern));
347.87 - configurationData.put("examples", loadExamples());
347.88 -
347.89 - if (pattern != null && path != null) {
347.90 - URI u = new URI("http://localhost:9998/index/find?path=" + escapeForQuery(path) + "&pattern=" + escapeForQuery(pattern));
347.91 - List<Map<String, Object>> results = new LinkedList<Map<String, Object>>();
347.92 - long queryTime = System.currentTimeMillis();
347.93 - List<String> candidates = new ArrayList<String>(WebUtilities.requestStringArrayResponse(u));
347.94 -
347.95 - queryTime = System.currentTimeMillis() - queryTime;
347.96 -
347.97 - Collections.sort(candidates);
347.98 -
347.99 - for (String c : candidates) {
347.100 - Map<String, Object> found = new HashMap<String, Object>(3);
347.101 -
347.102 - found.put("relativePath", c);
347.103 -
347.104 - results.add(found);
347.105 - }
347.106 -
347.107 - configurationData.put("results", results);
347.108 -
347.109 - Map<String, Object> statistics = new HashMap<String, Object>();
347.110 -
347.111 - statistics.put("files", candidates.size());
347.112 - statistics.put("queryTime", queryTime);
347.113 -
347.114 - configurationData.put("statistics", statistics);
347.115 - }
347.116 -
347.117 - return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-search.html", configurationData);
347.118 - }
347.119 -
347.120 - @GET
347.121 - @Path("/show")
347.122 - @Produces("text/html")
347.123 - public String show(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
347.124 - Map<String, Object> configurationData = new HashMap<String, Object>();
347.125 - List<Map<String, String>> occurrences = new LinkedList<Map<String, String>>();
347.126 -
347.127 - configurationData.put("occurrences", occurrences);
347.128 -
347.129 - URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
347.130 - String code = WebUtilities.requestStringResponse(codeURL);
347.131 - URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
347.132 - int currentCodePos = 0;
347.133 - for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) { //XXX: sorted!
347.134 - Map<String, String> occ = new HashMap<String, String>();
347.135 - occ.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, span[0])));
347.136 - occ.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
347.137 - occurrences.add(occ);
347.138 - currentCodePos = span[1];
347.139 - }
347.140 -
347.141 - configurationData.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(currentCodePos, code.length())));
347.142 -
347.143 - return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html", configurationData);
347.144 - }
347.145 -
347.146 - @GET
347.147 - @Path("/snippet")
347.148 - @Produces("text/html")
347.149 - public String snippet(@QueryParam("path") String path, @QueryParam("relative") String relativePath, @QueryParam("pattern") String pattern) throws URISyntaxException, IOException, TemplateException {
347.150 - List<Map<String, String>> snippets = new LinkedList<Map<String, String>>();
347.151 -
347.152 - URI codeURL = new URI("http://localhost:9998/index/cat?path=" + escapeForQuery(path) + "&relative=" + escapeForQuery(relativePath));
347.153 - String code = WebUtilities.requestStringResponse(codeURL);
347.154 - URI spansURL = new URI("http://localhost:9998/index/findSpans?path=" + escapeForQuery(path) + "&relativePath=" + escapeForQuery(relativePath) + "&pattern=" + escapeForQuery(pattern));
347.155 -
347.156 - for (int[] span : parseSpans(WebUtilities.requestStringResponse(spansURL))) {
347.157 - snippets.add(prepareSnippet(code, span));
347.158 - }
347.159 -
347.160 - return processTemplate("/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html", Collections.<String, Object>singletonMap("snippets", snippets));
347.161 - }
347.162 -
347.163 - private static List<Map<String, String>> list() throws URISyntaxException {
347.164 - List<Map<String, String>> result = new LinkedList<Map<String, String>>();
347.165 -
347.166 - for (String enc : WebUtilities.requestStringArrayResponse(new URI("http://localhost:9998/index/list"))) {
347.167 - Map<String, String> rootDesc = new HashMap<String, String>();
347.168 - String[] col = enc.split(":", 2);
347.169 -
347.170 - rootDesc.put("segment", col[0]);
347.171 - rootDesc.put("displayName", col[1]);
347.172 - result.add(rootDesc);
347.173 - }
347.174 -
347.175 - return result;
347.176 - }
347.177 -
347.178 - private static Iterable<int[]> parseSpans(String from) {
347.179 - if (from.isEmpty()) {
347.180 - return Collections.emptyList();
347.181 - }
347.182 - String[] split = from.split(":");
347.183 - List<int[]> result = new LinkedList<int[]>();
347.184 -
347.185 - for (int i = 0; i < split.length; i += 2) {
347.186 - result.add(new int[] {
347.187 - Integer.parseInt(split[i + 0].trim()),
347.188 - Integer.parseInt(split[i + 1].trim())
347.189 - });
347.190 - }
347.191 -
347.192 - return result;
347.193 - }
347.194 -
347.195 - private static final int DESIRED_CONTEXT = 2;
347.196 -
347.197 - private static Map<String, String> prepareSnippet(String code, int[] span) {
347.198 - int grandStart = span[0];
347.199 - int firstLineStart = grandStart = lineStart(code, grandStart);
347.200 -
347.201 - while (grandStart > 0 && contextLength(code.substring(grandStart, firstLineStart)) < DESIRED_CONTEXT)
347.202 - grandStart = lineStart(code, grandStart - 1);
347.203 -
347.204 - int grandEnd = span[1];
347.205 - int firstLineEnd = grandEnd = lineEnd(code, grandEnd);
347.206 -
347.207 - while (grandEnd < code.length() - 1 && contextLength(code.substring(firstLineEnd, grandEnd)) < DESIRED_CONTEXT)
347.208 - grandEnd = lineEnd(code, grandEnd + 1);
347.209 -
347.210 - Map<String, String> result = new HashMap<String, String>();
347.211 -
347.212 - result.put("prefix", WebUtilities.escapeForHTMLElement(code.substring(grandStart, span[0])));
347.213 - result.put("occurrence", WebUtilities.escapeForHTMLElement(code.substring(span[0], span[1])));
347.214 - result.put("suffix", WebUtilities.escapeForHTMLElement(code.substring(span[1], grandEnd)));
347.215 -
347.216 - return result;
347.217 - }
347.218 -
347.219 - private static int lineStart(String code, int o) {
347.220 - while (o > 0 && code.charAt(o) != '\n') {
347.221 - o--;
347.222 - }
347.223 -
347.224 - return o;
347.225 - }
347.226 -
347.227 - private static int lineEnd(String code, int o) {
347.228 - while (o < code.length() - 1 && code.charAt(o) != '\n') {
347.229 - o++;
347.230 - }
347.231 -
347.232 - return o;
347.233 - }
347.234 -
347.235 - private static int contextLength(String in) {
347.236 - return in.replaceAll("\n[ \t]*\n", "\n").trim().split("\n").length;
347.237 - }
347.238 -
347.239 - @SuppressWarnings("unchecked")
347.240 - private List<Map<String, String>> loadExamples() throws IOException, URISyntaxException {
347.241 - return Pojson.load(LinkedList.class, new URI("http://localhost:9998/index/examples"));
347.242 - }
347.243 -
347.244 - private static String processTemplate(String template, Map<String, Object> configurationData) throws TemplateException, IOException {
347.245 - Configuration conf = new Configuration();
347.246 -
347.247 - conf.setTemplateLoader(new TemplateLoaderImpl());
347.248 -
347.249 - Template templ = conf.getTemplate(template);
347.250 - StringWriter out = new StringWriter();
347.251 -
347.252 - templ.process(configurationData, out);
347.253 -
347.254 - return out.toString();
347.255 - }
347.256 -
347.257 - private static final class TemplateLoaderImpl implements TemplateLoader {
347.258 -
347.259 - public Object findTemplateSource(String name) throws IOException {
347.260 - return TemplateLoaderImpl.class.getResourceAsStream("/" + name);
347.261 - }
347.262 -
347.263 - public long getLastModified(Object templateSource) {
347.264 - return 0L;
347.265 - }
347.266 -
347.267 - public Reader getReader(Object templateSource, String encoding) throws IOException {
347.268 - InputStream in = (InputStream) templateSource;
347.269 -
347.270 - return new InputStreamReader(in);
347.271 - }
347.272 -
347.273 - public void closeTemplateSource(Object templateSource) throws IOException {
347.274 - }
347.275 - }
347.276 -
347.277 -}
348.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-cat.html Sat Feb 18 22:14:42 2012 +0100
348.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
348.3 @@ -1,10 +0,0 @@
348.4 -<html>
348.5 -<head>
348.6 - <style type="text/css">
348.7 - .occurrence {BACKGROUND: #DDDD00;}
348.8 - </style>
348.9 -</head>
348.10 -<body>
348.11 -<pre><#list occurrences as occurrence>${occurrence.prefix}<span class="occurrence">${occurrence.occurrence}</span></#list>${suffix}</pre>
348.12 -</body>
348.13 -</html>
349.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-search.html Sat Feb 18 22:14:42 2012 +0100
349.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
349.3 @@ -1,70 +0,0 @@
349.4 -<html>
349.5 -<head>
349.6 - <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
349.7 -<#if results??>
349.8 - <script type="text/javascript">
349.9 - $(document).ready(function() {
349.10 - $('#list').find('dd').hide().end().find('dt').click(function() {
349.11 - current_dd=$(this).next();
349.12 - //XXX: will do the AJAX call for both show and hide!
349.13 - $.get("snippet?path=${selectedPath}&relative=" + current_dd.attr("id") + "&pattern=${patternEscaped}",function(data) {
349.14 - current_dd.html(data).slideToggle();
349.15 - })
349.16 - });
349.17 - });
349.18 - </script>
349.19 -</#if>
349.20 - <style type="text/css">
349.21 - .occurrence {BACKGROUND: #DDDD00;}
349.22 - </style>
349.23 -</head>
349.24 -<body>
349.25 -<form method="get">
349.26 -
349.27 -<label for="path">Project:</label>
349.28 -<select size="1" name="path">");
349.29 - <#list paths as path>
349.30 - <option <#if selectedPath?? && path.segment == selectedPath>selected</#if> value="${path.segment}">
349.31 - ${path.displayName}
349.32 - </option>
349.33 - </#list>
349.34 -</select>
349.35 -<br>
349.36 -<label for="pattern">Pattern:</label><br>
349.37 -<textarea rows="10" cols="40" name="pattern">
349.38 -<#if pattern??>
349.39 -${pattern}
349.40 -</#if>
349.41 -</textarea><br>
349.42 -<input type="submit" name="Find Candidates"/>
349.43 -</form>
349.44 -
349.45 -<div class="examples">
349.46 -<#if examples??>
349.47 - Examples:
349.48 - <dl id="examples-list">
349.49 - <#list examples as example>
349.50 - <dt>${example.displayName}</dt>
349.51 - <dd><pre>${example.pattern}</pre>
349.52 - </dd>
349.53 - </#list>
349.54 - </dl>
349.55 -</#if>
349.56 -</div>
349.57 -
349.58 -<#if results??>
349.59 - Found candidates for pattern: ${pattern}
349.60 - <dl id="list">
349.61 - <#list results as result>
349.62 - <dt>${result.relativePath}<a href="/index/ui/show?path=${selectedPath}&relative=${result.relativePath}&pattern=${patternEscaped}">show</a></dt>
349.63 - <dd id="${result.relativePath}">
349.64 - </dd>
349.65 - </#list>
349.66 - </dl>
349.67 -</#if>
349.68 -
349.69 -<#if statistics??>
349.70 - Query time: ${statistics.queryTime}ms, matching files: ${statistics.files}.
349.71 -</#if>
349.72 -</body>
349.73 -</html>
350.1 --- a/server/web.api/src/org/netbeans/modules/jackpot30/server/webapi/ui-snippet.html Sat Feb 18 22:14:42 2012 +0100
350.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
350.3 @@ -1,7 +0,0 @@
350.4 -<#if snippets??>
350.5 - <#list snippets as snippet>
350.6 - <pre>${snippet.prefix}<span class="occurrence">${snippet.occurrence}</span>${snippet.suffix}</pre><br>
350.7 - </#list>
350.8 -<#else>
350.9 - No occurrences.
350.10 -</#if>
351.1 --- a/server/web.api/test/org/netbeans/modules/jackpot30/server/webapi/APITest.java Sat Feb 18 22:14:42 2012 +0100
351.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
351.3 @@ -1,107 +0,0 @@
351.4 -/*
351.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
351.6 - *
351.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
351.8 - *
351.9 - * The contents of this file are subject to the terms of either the GNU
351.10 - * General Public License Version 2 only ("GPL") or the Common
351.11 - * Development and Distribution License("CDDL") (collectively, the
351.12 - * "License"). You may not use this file except in compliance with the
351.13 - * License. You can obtain a copy of the License at
351.14 - * http://www.netbeans.org/cddl-gplv2.html
351.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
351.16 - * specific language governing permissions and limitations under the
351.17 - * License. When distributing the software, include this License Header
351.18 - * Notice in each file and include the License file at
351.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
351.20 - * particular file as subject to the "Classpath" exception as provided
351.21 - * by Sun in the GPL Version 2 section of the License file that
351.22 - * accompanied this code. If applicable, add the following below the
351.23 - * License Header, with the fields enclosed by brackets [] replaced by
351.24 - * your own identifying information:
351.25 - * "Portions Copyrighted [year] [name of copyright owner]"
351.26 - *
351.27 - * If you wish your version of this file to be governed by only the CDDL
351.28 - * or only the GPL Version 2, indicate your decision by adding
351.29 - * "[Contributor] elects to include this software in this distribution
351.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
351.31 - * single choice of license, a recipient has the option to distribute
351.32 - * your version of this file under either the CDDL, the GPL Version 2 or
351.33 - * to extend the choice of license to its licensees as provided above.
351.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
351.35 - * Version 2 license, then the option applies only if the new code is
351.36 - * made subject to such option by the copyright holder.
351.37 - *
351.38 - * Contributor(s):
351.39 - *
351.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
351.41 - */
351.42 -
351.43 -package org.netbeans.modules.jackpot30.server.webapi;
351.44 -
351.45 -import java.io.ByteArrayInputStream;
351.46 -import java.io.File;
351.47 -import java.io.FileOutputStream;
351.48 -import java.io.InputStream;
351.49 -import org.junit.Assert;
351.50 -import org.junit.Before;
351.51 -import org.junit.Test;
351.52 -import org.netbeans.modules.jackpot30.impl.indexing.Cache;
351.53 -import org.netbeans.modules.jackpot30.server.indexer.StandaloneIndexer;
351.54 -
351.55 -/**
351.56 - *
351.57 - * @author lahvac
351.58 - */
351.59 -public class APITest {
351.60 -
351.61 - public APITest() {
351.62 - }
351.63 -
351.64 - private File src;
351.65 -
351.66 - @Before
351.67 - public void setUp() throws Exception {
351.68 - File source = new File(APITest.class.getProtectionDomain().getCodeSource().getLocation().getPath());
351.69 - File workingDirectory = new File(source.getParentFile(), "wd");
351.70 - File cache = new File(workingDirectory, "cache");
351.71 -
351.72 - src = new File(workingDirectory, "src");
351.73 -
351.74 - Cache.setStandaloneCacheRoot(cache);
351.75 -
351.76 - copyStringToFile(new File(src, "test/Test1.java"), "package test; public class Test {private void test() { new java.io.File(\"\").isDirectory(); } }");
351.77 -
351.78 - StandaloneIndexer.index(src, false, false, null, null);
351.79 - }
351.80 -
351.81 - public final static void copyStringToFile (File f, String content) throws Exception {
351.82 - f.getParentFile().mkdirs();
351.83 -
351.84 - FileOutputStream os = new FileOutputStream(f);
351.85 - InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
351.86 - int read;
351.87 - while ((read = is.read()) != (-1)) {
351.88 - os.write(read);
351.89 - }
351.90 - os.close ();
351.91 - is.close();
351.92 - }
351.93 -
351.94 - @Test
351.95 - public void testFind() throws Exception {
351.96 - String cacheKey = null;
351.97 -
351.98 - for (String key : Cache.knownSourceRoots()) {
351.99 - if (src.getAbsolutePath().equals(Cache.sourceRootForKey(key).getAbsolutePath())) {
351.100 - cacheKey = key;
351.101 - break;
351.102 - }
351.103 - }
351.104 -
351.105 - Assert.assertNotNull(cacheKey);
351.106 -
351.107 - Assert.assertEquals("test/Test1.java\n", new API().find(cacheKey, "$1.isDirectory()"));
351.108 - }
351.109 -
351.110 -}
351.111 \ No newline at end of file
352.1 --- a/transformer/build.xml Sat Feb 18 22:14:42 2012 +0100
352.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
352.3 @@ -1,9 +0,0 @@
352.4 -<?xml version="1.0" encoding="UTF-8"?>
352.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
352.6 -<!-- for some information on what you could do (e.g. targets to override). -->
352.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
352.8 -<project name="org.netbeans.modules.jackpot30.transformers" default="netbeans" basedir=".">
352.9 - <description>Builds, tests, and runs the project org.netbeans.modules.jackpot30.transformers.</description>
352.10 - <import file="nbproject/build-impl.xml"/>
352.11 - <import file="${suite.dir}/findbugs-import.xml"/>
352.12 -</project>
353.1 --- a/transformer/manifest.mf Sat Feb 18 22:14:42 2012 +0100
353.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
353.3 @@ -1,7 +0,0 @@
353.4 -Manifest-Version: 1.0
353.5 -AutoUpdate-Show-In-Client: false
353.6 -OpenIDE-Module: org.netbeans.modules.jackpot30.transformers
353.7 -OpenIDE-Module-Layer: org/netbeans/modules/jackpot30/transformers/resources/layer.xml
353.8 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties
353.9 -OpenIDE-Module-Specification-Version: 1.16
353.10 -
354.1 --- a/transformer/nbproject/build-impl.xml Sat Feb 18 22:14:42 2012 +0100
354.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
354.3 @@ -1,45 +0,0 @@
354.4 -<?xml version="1.0" encoding="UTF-8"?>
354.5 -<!--
354.6 -*** GENERATED FROM project.xml - DO NOT EDIT ***
354.7 -*** EDIT ../build.xml INSTEAD ***
354.8 --->
354.9 -<project name="org.netbeans.modules.jackpot30.transformers-impl" basedir="..">
354.10 - <fail message="Please build using Ant 1.7.1 or higher.">
354.11 - <condition>
354.12 - <not>
354.13 - <antversion atleast="1.7.1"/>
354.14 - </not>
354.15 - </condition>
354.16 - </fail>
354.17 - <property file="nbproject/private/suite-private.properties"/>
354.18 - <property file="nbproject/suite.properties"/>
354.19 - <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
354.20 - <property file="${suite.dir}/nbproject/private/platform-private.properties"/>
354.21 - <property file="${suite.dir}/nbproject/platform.properties"/>
354.22 - <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
354.23 - <attribute name="name"/>
354.24 - <attribute name="value"/>
354.25 - <sequential>
354.26 - <property name="@{name}" value="${@{value}}"/>
354.27 - </sequential>
354.28 - </macrodef>
354.29 - <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
354.30 - <attribute name="property"/>
354.31 - <attribute name="value"/>
354.32 - <sequential>
354.33 - <property name="@{property}" value="@{value}"/>
354.34 - </sequential>
354.35 - </macrodef>
354.36 - <property file="${user.properties.file}"/>
354.37 - <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
354.38 - <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
354.39 - <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
354.40 - <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
354.41 - <condition>
354.42 - <not>
354.43 - <contains string="${cluster.path.evaluated}" substring="platform"/>
354.44 - </not>
354.45 - </condition>
354.46 - </fail>
354.47 - <import file="${harness.dir}/build.xml"/>
354.48 -</project>
355.1 --- a/transformer/nbproject/genfiles.properties Sat Feb 18 22:14:42 2012 +0100
355.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
355.3 @@ -1,8 +0,0 @@
355.4 -build.xml.data.CRC32=ec1a83f8
355.5 -build.xml.script.CRC32=14b2fe09
355.6 -build.xml.stylesheet.CRC32=79c3b980@1.28.0.7
355.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
355.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
355.9 -nbproject/build-impl.xml.data.CRC32=9e6fb388
355.10 -nbproject/build-impl.xml.script.CRC32=07a96417
355.11 -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.47
356.1 --- a/transformer/nbproject/project.properties Sat Feb 18 22:14:42 2012 +0100
356.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
356.3 @@ -1,2 +0,0 @@
356.4 -javac.source=1.5
356.5 -javac.compilerargs=-Xlint -Xlint:-serial
357.1 --- a/transformer/nbproject/project.xml Sat Feb 18 22:14:42 2012 +0100
357.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
357.3 @@ -1,157 +0,0 @@
357.4 -<?xml version="1.0" encoding="UTF-8"?>
357.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
357.6 - <type>org.netbeans.modules.apisupport.project</type>
357.7 - <configuration>
357.8 - <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
357.9 - <code-name-base>org.netbeans.modules.jackpot30.transformers</code-name-base>
357.10 - <suite-component/>
357.11 - <module-dependencies>
357.12 - <dependency>
357.13 - <code-name-base>org.netbeans.api.java.classpath</code-name-base>
357.14 - <build-prerequisite/>
357.15 - <compile-dependency/>
357.16 - <run-dependency>
357.17 - <release-version>1</release-version>
357.18 - <specification-version>1.19</specification-version>
357.19 - </run-dependency>
357.20 - </dependency>
357.21 - <dependency>
357.22 - <code-name-base>org.netbeans.libs.javacapi</code-name-base>
357.23 - <build-prerequisite/>
357.24 - <compile-dependency/>
357.25 - <run-dependency>
357.26 - <specification-version>0.8.0.1</specification-version>
357.27 - </run-dependency>
357.28 - </dependency>
357.29 - <dependency>
357.30 - <code-name-base>org.netbeans.modules.jackpot30.api</code-name-base>
357.31 - <build-prerequisite/>
357.32 - <compile-dependency/>
357.33 - <run-dependency>
357.34 - <specification-version>1.0</specification-version>
357.35 - </run-dependency>
357.36 - </dependency>
357.37 - <dependency>
357.38 - <code-name-base>org.netbeans.modules.java.hints</code-name-base>
357.39 - <build-prerequisite/>
357.40 - <compile-dependency/>
357.41 - <run-dependency>
357.42 - <release-version>1</release-version>
357.43 - <implementation-version/>
357.44 - </run-dependency>
357.45 - </dependency>
357.46 - <dependency>
357.47 - <code-name-base>org.netbeans.modules.java.source</code-name-base>
357.48 - <build-prerequisite/>
357.49 - <compile-dependency/>
357.50 - <run-dependency>
357.51 - <specification-version>0.43.0.7.7.1</specification-version>
357.52 - </run-dependency>
357.53 - </dependency>
357.54 - <dependency>
357.55 - <code-name-base>org.netbeans.spi.editor.hints</code-name-base>
357.56 - <build-prerequisite/>
357.57 - <compile-dependency/>
357.58 - <run-dependency>
357.59 - <release-version>0-1</release-version>
357.60 - <specification-version>1.7.0.7.2</specification-version>
357.61 - </run-dependency>
357.62 - </dependency>
357.63 - <dependency>
357.64 - <code-name-base>org.openide.filesystems</code-name-base>
357.65 - <build-prerequisite/>
357.66 - <compile-dependency/>
357.67 - <run-dependency>
357.68 - <specification-version>7.21.0.1.1</specification-version>
357.69 - </run-dependency>
357.70 - </dependency>
357.71 - <dependency>
357.72 - <code-name-base>org.openide.modules</code-name-base>
357.73 - <build-prerequisite/>
357.74 - <compile-dependency/>
357.75 - <run-dependency>
357.76 - <specification-version>7.10</specification-version>
357.77 - </run-dependency>
357.78 - </dependency>
357.79 - <dependency>
357.80 - <code-name-base>org.openide.util</code-name-base>
357.81 - <build-prerequisite/>
357.82 - <compile-dependency/>
357.83 - <run-dependency>
357.84 - <specification-version>7.22.0.1</specification-version>
357.85 - </run-dependency>
357.86 - </dependency>
357.87 - <dependency>
357.88 - <code-name-base>org.openide.util.lookup</code-name-base>
357.89 - <build-prerequisite/>
357.90 - <compile-dependency/>
357.91 - <run-dependency>
357.92 - <specification-version>8.0.0.1</specification-version>
357.93 - </run-dependency>
357.94 - </dependency>
357.95 - </module-dependencies>
357.96 - <test-dependencies>
357.97 - <test-type>
357.98 - <name>unit</name>
357.99 - <test-dependency>
357.100 - <code-name-base>org.netbeans.bootstrap</code-name-base>
357.101 - </test-dependency>
357.102 - <test-dependency>
357.103 - <code-name-base>org.netbeans.core.startup</code-name-base>
357.104 - </test-dependency>
357.105 - <test-dependency>
357.106 - <code-name-base>org.netbeans.libs.junit4</code-name-base>
357.107 - <compile-dependency/>
357.108 - </test-dependency>
357.109 - <test-dependency>
357.110 - <code-name-base>org.netbeans.modules.classfile</code-name-base>
357.111 - </test-dependency>
357.112 - <test-dependency>
357.113 - <code-name-base>org.netbeans.modules.defaults</code-name-base>
357.114 - </test-dependency>
357.115 - <test-dependency>
357.116 - <code-name-base>org.netbeans.modules.editor</code-name-base>
357.117 - </test-dependency>
357.118 - <test-dependency>
357.119 - <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
357.120 - </test-dependency>
357.121 - <test-dependency>
357.122 - <code-name-base>org.netbeans.modules.editor.settings</code-name-base>
357.123 - </test-dependency>
357.124 - <test-dependency>
357.125 - <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
357.126 - </test-dependency>
357.127 - <test-dependency>
357.128 - <code-name-base>org.netbeans.modules.editor.util</code-name-base>
357.129 - </test-dependency>
357.130 - <test-dependency>
357.131 - <code-name-base>org.netbeans.modules.jackpot30.test.borrowed</code-name-base>
357.132 - <recursive/>
357.133 - <compile-dependency/>
357.134 - </test-dependency>
357.135 - <test-dependency>
357.136 - <code-name-base>org.netbeans.modules.java.lexer</code-name-base>
357.137 - </test-dependency>
357.138 - <test-dependency>
357.139 - <code-name-base>org.netbeans.modules.masterfs</code-name-base>
357.140 - </test-dependency>
357.141 - <test-dependency>
357.142 - <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
357.143 - <recursive/>
357.144 - <compile-dependency/>
357.145 - </test-dependency>
357.146 - <test-dependency>
357.147 - <code-name-base>org.netbeans.modules.progress.ui</code-name-base>
357.148 - </test-dependency>
357.149 - <test-dependency>
357.150 - <code-name-base>org.netbeans.modules.projectui</code-name-base>
357.151 - </test-dependency>
357.152 - <test-dependency>
357.153 - <code-name-base>org.openidex.util</code-name-base>
357.154 - </test-dependency>
357.155 - </test-type>
357.156 - </test-dependencies>
357.157 - <public-packages/>
357.158 - </data>
357.159 - </configuration>
357.160 -</project>
358.1 --- a/transformer/nbproject/suite.properties Sat Feb 18 22:14:42 2012 +0100
358.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
358.3 @@ -1,1 +0,0 @@
358.4 -suite.dir=${basedir}/..
359.1 Binary file transformer/release/libs/annotations.jar has changed
360.1 --- a/transformer/src/org/netbeans/modules/jackpot30/transformers/Annotations.java Sat Feb 18 22:14:42 2012 +0100
360.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
360.3 @@ -1,70 +0,0 @@
360.4 -/*
360.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
360.6 - *
360.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
360.8 - *
360.9 - * The contents of this file are subject to the terms of either the GNU
360.10 - * General Public License Version 2 only ("GPL") or the Common
360.11 - * Development and Distribution License("CDDL") (collectively, the
360.12 - * "License"). You may not use this file except in compliance with the
360.13 - * License. You can obtain a copy of the License at
360.14 - * http://www.netbeans.org/cddl-gplv2.html
360.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
360.16 - * specific language governing permissions and limitations under the
360.17 - * License. When distributing the software, include this License Header
360.18 - * Notice in each file and include the License file at
360.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
360.20 - * particular file as subject to the "Classpath" exception as provided
360.21 - * by Sun in the GPL Version 2 section of the License file that
360.22 - * accompanied this code. If applicable, add the following below the
360.23 - * License Header, with the fields enclosed by brackets [] replaced by
360.24 - * your own identifying information:
360.25 - * "Portions Copyrighted [year] [name of copyright owner]"
360.26 - *
360.27 - * If you wish your version of this file to be governed by only the CDDL
360.28 - * or only the GPL Version 2, indicate your decision by adding
360.29 - * "[Contributor] elects to include this software in this distribution
360.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
360.31 - * single choice of license, a recipient has the option to distribute
360.32 - * your version of this file under either the CDDL, the GPL Version 2 or
360.33 - * to extend the choice of license to its licensees as provided above.
360.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
360.35 - * Version 2 license, then the option applies only if the new code is
360.36 - * made subject to such option by the copyright holder.
360.37 - *
360.38 - * Contributor(s):
360.39 - *
360.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
360.41 - */
360.42 -
360.43 -package org.netbeans.modules.jackpot30.transformers;
360.44 -
360.45 -/**
360.46 - *
360.47 - * @author Jan Lahoda
360.48 - */
360.49 -public enum Annotations {
360.50 -
360.51 - TRANSFORMATION_SET("TransformationSet"),
360.52 - TRANSFORMATION,
360.53 - FIX,
360.54 - PATTERN,
360.55 - CONSTRAINT;
360.56 -
360.57 - private static final String PACKAGE_NAME = "net.java.lang.annotations.";
360.58 -
360.59 - private final String specialName;
360.60 -
360.61 - private Annotations() {
360.62 - this(null);
360.63 - }
360.64 -
360.65 - private Annotations(String specialName) {
360.66 - this.specialName = specialName;
360.67 - }
360.68 -
360.69 - public String toFQN() {
360.70 - return PACKAGE_NAME + (specialName != null ? specialName : name().charAt(0) + name().substring(1).toLowerCase());
360.71 - }
360.72 -
360.73 -}
361.1 --- a/transformer/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImpl.java Sat Feb 18 22:14:42 2012 +0100
361.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
361.3 @@ -1,508 +0,0 @@
361.4 -/*
361.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
361.6 - *
361.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
361.8 - *
361.9 - * The contents of this file are subject to the terms of either the GNU
361.10 - * General Public License Version 2 only ("GPL") or the Common
361.11 - * Development and Distribution License("CDDL") (collectively, the
361.12 - * "License"). You may not use this file except in compliance with the
361.13 - * License. You can obtain a copy of the License at
361.14 - * http://www.netbeans.org/cddl-gplv2.html
361.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
361.16 - * specific language governing permissions and limitations under the
361.17 - * License. When distributing the software, include this License Header
361.18 - * Notice in each file and include the License file at
361.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
361.20 - * particular file as subject to the "Classpath" exception as provided
361.21 - * by Sun in the GPL Version 2 section of the License file that
361.22 - * accompanied this code. If applicable, add the following below the
361.23 - * License Header, with the fields enclosed by brackets [] replaced bysanno
361.24 - * your own identifying information:
361.25 - * "Portions Copyrighted [year] [name of copyright owner]"
361.26 - *
361.27 - * If you wish your version of this file to be governed by only the CDDL
361.28 - * or only the GPL Version 2, indicate your decision by adding
361.29 - * "[Contributor] elects to include this software in this distribution
361.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
361.31 - * single choice of license, a recipient has the option to distribute
361.32 - * your version of this file under either the CDDL, the GPL Version 2 or
361.33 - * to extend the choice of license to its licensees as provided above.
361.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
361.35 - * Version 2 license, then the option applies only if the new code is
361.36 - * made subject to such option by the copyright holder.
361.37 - *
361.38 - * Contributor(s):
361.39 - *
361.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
361.41 - */
361.42 -
361.43 -package org.netbeans.modules.jackpot30.transformers;
361.44 -
361.45 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
361.46 -import org.netbeans.modules.java.hints.spi.AbstractHint.HintSeverity;
361.47 -import org.netbeans.modules.java.hints.jackpot.spi.support.ErrorDescriptionFactory;
361.48 -import org.netbeans.modules.java.hints.jackpot.spi.ElementBasedHintProvider;
361.49 -import org.netbeans.modules.java.hints.jackpot.spi.HintContext;
361.50 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
361.51 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription.Worker;
361.52 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescriptionFactory;
361.53 -import org.netbeans.modules.java.hints.jackpot.spi.HintMetadata;
361.54 -import org.netbeans.modules.java.hints.jackpot.spi.JavaFix;
361.55 -import com.sun.source.tree.Tree;
361.56 -import com.sun.source.util.SourcePositions;
361.57 -import com.sun.source.util.TreePath;
361.58 -import java.io.File;
361.59 -import java.io.IOException;
361.60 -import java.net.URL;
361.61 -import java.util.Collection;
361.62 -import java.util.Collections;
361.63 -import java.util.EnumSet;
361.64 -import java.util.HashMap;
361.65 -import java.util.HashSet;
361.66 -import java.util.LinkedList;
361.67 -import java.util.List;
361.68 -import java.util.Map;
361.69 -import java.util.Map.Entry;
361.70 -import java.util.Set;
361.71 -import java.util.concurrent.atomic.AtomicBoolean;
361.72 -import java.util.regex.Matcher;
361.73 -import javax.lang.model.element.AnnotationMirror;
361.74 -import javax.lang.model.element.AnnotationValue;
361.75 -import javax.lang.model.element.Element;
361.76 -import javax.lang.model.element.ElementKind;
361.77 -import javax.lang.model.element.ExecutableElement;
361.78 -import javax.lang.model.element.Modifier;
361.79 -import javax.lang.model.element.PackageElement;
361.80 -import javax.lang.model.element.TypeElement;
361.81 -import javax.lang.model.type.DeclaredType;
361.82 -import javax.lang.model.type.TypeMirror;
361.83 -import javax.lang.model.util.ElementFilter;
361.84 -import org.netbeans.api.java.classpath.ClassPath;
361.85 -import org.netbeans.api.java.source.ClasspathInfo;
361.86 -import org.netbeans.api.java.source.ClasspathInfo.PathKind;
361.87 -import org.netbeans.api.java.source.CompilationController;
361.88 -import org.netbeans.api.java.source.CompilationInfo;
361.89 -import org.netbeans.api.java.source.ElementHandle;
361.90 -import org.netbeans.api.java.source.JavaSource;
361.91 -import org.netbeans.api.java.source.Task;
361.92 -import org.netbeans.api.java.source.TypeMirrorHandle;
361.93 -import org.netbeans.api.java.source.support.CancellableTreePathScanner;
361.94 -import org.netbeans.spi.editor.hints.ErrorDescription;
361.95 -import org.netbeans.spi.editor.hints.Fix;
361.96 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
361.97 -import org.openide.filesystems.FileUtil;
361.98 -import org.openide.modules.InstalledFileLocator;
361.99 -import org.openide.util.Exceptions;
361.100 -
361.101 -import org.openide.util.lookup.ServiceProvider;
361.102 -import static org.netbeans.modules.jackpot30.transformers.Annotations.*;
361.103 -
361.104 -/**
361.105 - *
361.106 - * @author Jan Lahoda
361.107 - */
361.108 -@ServiceProvider(service=ElementBasedHintProvider.class)
361.109 -public class TransformationHintProviderImpl implements ElementBasedHintProvider {
361.110 -
361.111 - private JavaSource prepareJavaSource(CompilationInfo info) {
361.112 - ClasspathInfo currentCP = info.getClasspathInfo();
361.113 - ClassPath overlayCompileCP = prepareOverlayCompileCP();
361.114 - ClassPath extendedCompileCP = ClassPathSupport.createProxyClassPath(overlayCompileCP, currentCP.getClassPath(PathKind.COMPILE));
361.115 - ClassPath overlayBootCP = prepareOverlayBootCP();
361.116 - ClassPath extendedBootCP = ClassPathSupport.createProxyClassPath(overlayBootCP, currentCP.getClassPath(PathKind.BOOT));
361.117 - ClasspathInfo extendedCPInfo = ClasspathInfo.create(extendedBootCP, extendedCompileCP, currentCP.getClassPath(PathKind.SOURCE));
361.118 -
361.119 - return JavaSource.create(extendedCPInfo);
361.120 - }
361.121 -
361.122 - public Collection<? extends HintDescription> computeHints(final CompilationInfo info) {
361.123 - final List<HintDescription> hints = new LinkedList<HintDescription>();
361.124 -
361.125 - if (ANNOTATIONS_JAR != null && (JDK_OVERLAY_JAR != null || NB_OVERLAY_JAR != null)) {
361.126 - try {
361.127 - prepareJavaSource(info).runUserActionTask(new Task<CompilationController>() {
361.128 - public void run(final CompilationController overlayInfo) throws Exception {
361.129 - List<HintDescription> w = doComputeHints(info, overlayInfo);
361.130 -
361.131 - if (w != null) {
361.132 - hints.addAll(w);
361.133 - }
361.134 - }
361.135 - }, true);
361.136 - } catch (IOException ex) {
361.137 - Exceptions.printStackTrace(ex);
361.138 - }
361.139 - } else {
361.140 - List<HintDescription> w = doComputeHints(info, null);
361.141 -
361.142 - if (w != null) {
361.143 - hints.addAll(w);
361.144 - }
361.145 - }
361.146 -
361.147 - return hints;
361.148 - }
361.149 -
361.150 - private static final Set<ElementKind> KINDS_FOR_ELEMENT_HANDLE = EnumSet.of(
361.151 - ElementKind.PACKAGE, ElementKind.CLASS, ElementKind.INTERFACE, ElementKind.ENUM,
361.152 - ElementKind.ANNOTATION_TYPE, ElementKind.METHOD, ElementKind.CONSTRUCTOR,
361.153 - ElementKind.INSTANCE_INIT, ElementKind.STATIC_INIT, ElementKind.FIELD,
361.154 - ElementKind.ENUM_CONSTANT);
361.155 -
361.156 - private List<HintDescription> doComputeHints(CompilationInfo info,
361.157 - CompilationInfo overlayInfo) {
361.158 -
361.159 - FindAnnotation ann = new FindAnnotation(info, overlayInfo, /*XXX*/new AtomicBoolean());
361.160 -
361.161 - ann.scan(info.getCompilationUnit(), null);
361.162 -
361.163 - return ann.hints;
361.164 - }
361.165 -
361.166 - private final class FindAnnotation extends CancellableTreePathScanner<Void, Void> {
361.167 -
361.168 - private final CompilationInfo info;
361.169 - private final CompilationInfo overlayInfo;
361.170 - private final List<HintDescription> hints = new LinkedList<HintDescription>();
361.171 -
361.172 - public FindAnnotation(CompilationInfo info, CompilationInfo overlayInfo, AtomicBoolean cancel) {
361.173 - super(cancel);
361.174 - this.info = info;
361.175 - this.overlayInfo = overlayInfo;
361.176 - }
361.177 -
361.178 - private final Set<Element> handledElements = new HashSet<Element>();
361.179 -
361.180 - private void handleElementImpl(Element el) {
361.181 - if (!handledElements.add(el)) return ;
361.182 -
361.183 - List<HintDescription> currentHints = processAnnotations(el, el.getEnclosingElement(), info, info);
361.184 -
361.185 - if (overlayInfo != null && currentHints.isEmpty() && KINDS_FOR_ELEMENT_HANDLE.contains(el.getKind())) {
361.186 - Element overlay = ElementHandle.create(el).resolve(overlayInfo);
361.187 -
361.188 - if (overlay != null) {
361.189 - currentHints = processAnnotations(overlay, overlay.getEnclosingElement(), info, overlayInfo);
361.190 - }
361.191 - }
361.192 -
361.193 - this.hints.addAll(currentHints);
361.194 - }
361.195 -
361.196 - private void handleElement(Element el) {
361.197 - PackageElement p = info.getElements().getPackageOf(el);
361.198 -
361.199 - while (p != el) {
361.200 - handleElementImpl(el);
361.201 - el = el.getEnclosingElement();
361.202 - }
361.203 -
361.204 - handleElementImpl(p);
361.205 - }
361.206 -
361.207 - @Override
361.208 - public Void scan(Tree tree, Void p) {
361.209 - if (tree == null) return null;
361.210 -
361.211 - TreePath tp = new TreePath(getCurrentPath(), tree);
361.212 - Element el = info.getTrees().getElement(tp);
361.213 -
361.214 - if (el != null) {
361.215 - handleElement(el);
361.216 - }
361.217 -
361.218 - return super.scan(tree, p);
361.219 - }
361.220 - }
361.221 -
361.222 - private static final class WorkerImpl implements Worker {
361.223 -
361.224 - private final String displayName;
361.225 - private final List<FixDescription> fixDescriptions;
361.226 -
361.227 - public WorkerImpl(String displayName, List<FixDescription> fixDescriptions) {
361.228 - this.displayName = displayName;
361.229 - this.fixDescriptions = fixDescriptions;
361.230 - }
361.231 -
361.232 - public Collection<? extends ErrorDescription> createErrors(HintContext ctx) {
361.233 - //XXX: antipatterns not supported by the current infrastructure
361.234 -// TreePath tp = treePath;
361.235 -//
361.236 -// while (tp != null) {
361.237 -// if (!pd.getPattern().checkAntipatterns(tp)) {
361.238 -// return null;
361.239 -// }
361.240 -//
361.241 -// tp = tp.getParentPath();
361.242 -// }
361.243 -
361.244 - List<Fix> fixes = new LinkedList<Fix>();
361.245 -
361.246 - for (FixDescription d : fixDescriptions) {
361.247 - String dn = d.getDisplayName();
361.248 -
361.249 - if (dn.length() == 0) {
361.250 - dn = defaultFixDisplayName(ctx.getInfo(), ctx.getVariables(), d);
361.251 - }
361.252 -
361.253 - fixes.add(JavaFix.rewriteFix(ctx.getInfo(), dn, ctx.getPath(), d.getPattern(), ctx.getVariables(), ctx.getMultiVariables(), ctx.getVariableNames(), Collections.<String, TypeMirror>emptyMap()/*XXX: pd.pattern.getConstraints()*/));
361.254 - }
361.255 -
361.256 - return Collections.singletonList(ErrorDescriptionFactory.forName(ctx, ctx.getPath(), displayName, fixes.toArray(new Fix[0])));
361.257 - }
361.258 - }
361.259 -
361.260 - private static <T> T findValue(AnnotationMirror m, String name, Class<T> clazz) {
361.261 - for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : m.getElementValues().entrySet()) {
361.262 - if (name.equals(e.getKey().getSimpleName().toString())) {
361.263 - return clazz.cast(e.getValue().getValue());
361.264 - }
361.265 - }
361.266 -
361.267 - TypeElement te = (TypeElement) m.getAnnotationType().asElement();
361.268 -
361.269 - for (ExecutableElement ee : ElementFilter.methodsIn(te.getEnclosedElements())) {
361.270 - if (name.equals(ee.getSimpleName().toString())) {
361.271 - if (ee.getDefaultValue() == null) {
361.272 - return null;
361.273 - }
361.274 - return clazz.cast(ee.getDefaultValue().getValue());
361.275 - }
361.276 - }
361.277 -
361.278 - return null;
361.279 - }
361.280 -
361.281 - private static HintDescription create(CompilationInfo info, Element el, AnnotationMirror transformation, String id, CompilationInfo fake) {
361.282 - Collection rawPatterns = findValue(transformation, "pattern", Collection.class);
361.283 -
361.284 - if (rawPatterns == null || rawPatterns.isEmpty()) {
361.285 - return null;
361.286 - }
361.287 -
361.288 - Iterable<AnnotationMirror> patterns = Utilities.checkedIterableByFilter(rawPatterns, AnnotationMirror.class, true);
361.289 -
361.290 - String patternString = findValue(patterns.iterator().next(), "value", String.class);
361.291 -
361.292 - if (patternString == null) {
361.293 - return null;
361.294 - }
361.295 -
361.296 - Collection rawConstraints = findValue(transformation, "constraint", Collection.class);
361.297 -
361.298 - if (rawConstraints == null) {
361.299 - return null;
361.300 - }
361.301 -
361.302 - Iterable<AnnotationMirror> constraints = Utilities.checkedIterableByFilter(rawConstraints, AnnotationMirror.class, true);
361.303 - Map<String, String> variableTypes = new HashMap<String, String>();
361.304 -
361.305 - for (AnnotationMirror m : constraints) {
361.306 - String var = findValue(m, "variable", String.class);
361.307 - TypeMirror tm = findValue(m, "type", TypeMirror.class);
361.308 -
361.309 - if (var == null || tm == null) {
361.310 - return null;
361.311 - }
361.312 -
361.313 - variableTypes.put(var, tm.toString()); //XXX: toString()
361.314 - }
361.315 -
361.316 - if (!el.getModifiers().contains(Modifier.STATIC) && !variableTypes.containsKey("$this")) {
361.317 - TypeMirror parent = el.getEnclosingElement().asType();
361.318 -
361.319 - variableTypes.put("$this", TypeMirrorHandle.create(fake.getTypes().erasure(parent)).resolve(info).toString()); //XXX: toString()
361.320 - }
361.321 -
361.322 - List<String> aps = new LinkedList<String>();
361.323 -
361.324 - for (AnnotationMirror ap : Utilities.checkedIterableByFilter(findValue(transformation, "antipattern", Collection.class), AnnotationMirror.class, true)) {
361.325 - aps.add(findValue(ap, "value", String.class));
361.326 - }
361.327 -
361.328 - List<FixDescription> fixes = new LinkedList<FixDescription>();
361.329 - Collection rawFixes = findValue(transformation, "fix", Collection.class);
361.330 -
361.331 - if (rawFixes == null) {
361.332 - return null;
361.333 - }
361.334 -
361.335 - for (AnnotationMirror f : Utilities.checkedIterableByFilter(rawFixes, AnnotationMirror.class, true)) {
361.336 - String dn = findValue(f, "displayName", String.class);
361.337 - String to = findValue(f, "value", String.class);
361.338 -
361.339 - if (dn == null || to == null) {
361.340 - return null;
361.341 - }
361.342 -
361.343 - fixes.add(new FixDescription(dn, to));
361.344 - }
361.345 -
361.346 - String displayName = findValue(transformation, "displayName", String.class);
361.347 -
361.348 - if (displayName == null) {
361.349 - return null;//XXX
361.350 - }
361.351 -
361.352 - HintMetadata hm = HintMetadata.Builder.create(id).setDescription(displayName, displayName).setCategory(CATEGORY).build();
361.353 -
361.354 - return HintDescriptionFactory.create()
361.355 - .setMetadata(hm)
361.356 - .setTrigger(PatternDescription.create(patternString, variableTypes))
361.357 - .setWorker(new WorkerImpl(displayName, fixes))
361.358 - .produce();
361.359 - }
361.360 -
361.361 - private static final String CATEGORY = "Transformations";
361.362 -
361.363 - private static final class FixDescription {
361.364 - private final String displayName;
361.365 - private final String pattern;
361.366 -
361.367 - public FixDescription(String displayName, String pattern) {
361.368 - this.displayName = displayName;
361.369 - this.pattern = pattern;
361.370 - }
361.371 -
361.372 - public String getDisplayName() {
361.373 - return displayName;
361.374 - }
361.375 -
361.376 - public String getPattern() {
361.377 - return pattern;
361.378 - }
361.379 -
361.380 - }
361.381 -
361.382 - private static final File ANNOTATIONS_JAR;
361.383 - private static final File NB_OVERLAY_JAR;
361.384 - private static final File JDK_OVERLAY_JAR;
361.385 -
361.386 - static {
361.387 - ANNOTATIONS_JAR = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
361.388 - NB_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/org-netbeans-nboverlay.jar", null, false);
361.389 - JDK_OVERLAY_JAR = InstalledFileLocator.getDefault().locate("overlay/jdk.jar", null, false);
361.390 - }
361.391 -
361.392 - private ClassPath prepareOverlayCompileCP() throws IllegalArgumentException {
361.393 - if (NB_OVERLAY_JAR ==null) {
361.394 - return ClassPathSupport.createClassPath(new URL[0]);
361.395 - }
361.396 -
361.397 - return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(NB_OVERLAY_JAR));
361.398 - }
361.399 -
361.400 - private ClassPath prepareOverlayBootCP() throws IllegalArgumentException {
361.401 - if (ANNOTATIONS_JAR == null) {
361.402 - return ClassPathSupport.createClassPath(new URL[0]);
361.403 - }
361.404 -
361.405 - if (JDK_OVERLAY_JAR == null) {
361.406 - return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR));
361.407 - }
361.408 -
361.409 - return ClassPathSupport.createClassPath(FileUtil.urlForArchiveOrDir(ANNOTATIONS_JAR), FileUtil.urlForArchiveOrDir(JDK_OVERLAY_JAR));
361.410 - }
361.411 -
361.412 - private List<HintDescription> processAnnotations(Element e, Element enclosing, CompilationInfo info, CompilationInfo fake) {
361.413 - boolean foundTransformations = false;
361.414 - List<HintDescription> result = new LinkedList<HintDescription>();
361.415 - String id;
361.416 - switch (e.getKind()) {
361.417 - case ANNOTATION_TYPE:
361.418 - case CLASS:
361.419 - case ENUM:
361.420 - case INTERFACE:
361.421 - id = fake.getElements().getBinaryName((TypeElement) e).toString();
361.422 - break;
361.423 - case FIELD:
361.424 - case ENUM_CONSTANT:
361.425 - id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
361.426 - break;
361.427 - case CONSTRUCTOR:
361.428 - case METHOD:
361.429 - //XXX: parameters!
361.430 - id = fake.getElements().getBinaryName((TypeElement) enclosing).toString() + e.getSimpleName().toString();
361.431 - break;
361.432 - default:
361.433 - id = "no-id";
361.434 - break;
361.435 - }
361.436 -
361.437 - int index = 0;
361.438 -
361.439 - for (AnnotationMirror am : e.getAnnotationMirrors()) {
361.440 - String fqn = ((TypeElement) am.getAnnotationType().asElement()).getQualifiedName().toString();
361.441 - List<AnnotationMirror> transformations = new LinkedList<AnnotationMirror>();
361.442 - if (TRANSFORMATION.toFQN().equals(fqn)) {
361.443 - transformations.add(am);
361.444 - foundTransformations = true;
361.445 - }
361.446 - if (TRANSFORMATION_SET.toFQN().equals(fqn)) {
361.447 - for (AnnotationMirror m : Utilities.checkedIterableByFilter(findValue(am, "value", Collection.class), AnnotationMirror.class, true)) {
361.448 - transformations.add(m);
361.449 - }
361.450 - foundTransformations = true;
361.451 - }
361.452 -
361.453 - for (AnnotationMirror t : transformations) {
361.454 - HintDescription pd = create(info, e, t, id + "-" + (index++), fake);
361.455 -
361.456 - if (pd != null) {
361.457 - result.add(pd);
361.458 - }
361.459 - }
361.460 - }
361.461 -
361.462 - if (!foundTransformations && e.getKind() == ElementKind.METHOD) {
361.463 - TypeElement owner = (TypeElement) e.getEnclosingElement();
361.464 -
361.465 - for (TypeMirror tm : fake.getTypes().directSupertypes(owner.asType())) {
361.466 - DeclaredType dt = (DeclaredType) tm;
361.467 - TypeElement parent = (TypeElement) dt.asElement();
361.468 -
361.469 - for (ExecutableElement ee : ElementFilter.methodsIn(parent.getEnclosedElements())) {
361.470 - if (!fake.getElements().overrides((ExecutableElement) e, ee, (TypeElement) enclosing)) {
361.471 - continue;
361.472 - }
361.473 - List<HintDescription> r = processAnnotations(ee, enclosing, info, fake);
361.474 -
361.475 - result.addAll(r);
361.476 - }
361.477 -
361.478 - }
361.479 - }
361.480 -
361.481 - return result;
361.482 - }
361.483 -
361.484 - private static String defaultFixDisplayName(CompilationInfo info, Map<String, TreePath> variables, FixDescription d) {
361.485 - Map<String, String> stringsForVariables = new HashMap<String, String>();
361.486 -
361.487 - for (Entry<String, TreePath> e : variables.entrySet()) {
361.488 - Tree t = e.getValue().getLeaf();
361.489 - SourcePositions sp = info.getTrees().getSourcePositions();
361.490 - int startPos = (int) sp.getStartPosition(info.getCompilationUnit(), t);
361.491 - int endPos = (int) sp.getEndPosition(info.getCompilationUnit(), t);
361.492 -
361.493 - stringsForVariables.put(e.getKey(), info.getText().substring(startPos, endPos));
361.494 - }
361.495 -
361.496 - if (!stringsForVariables.containsKey("$this")) {
361.497 - stringsForVariables.put("$this", "this");
361.498 - }
361.499 -
361.500 - String replaceTarget = d.getPattern();
361.501 -
361.502 - for (Entry<String, String> e : stringsForVariables.entrySet()) {
361.503 - String quotedVariable = java.util.regex.Pattern.quote(e.getKey());
361.504 - String quotedTarget = Matcher.quoteReplacement(e.getValue());
361.505 - replaceTarget = replaceTarget.replaceAll(quotedVariable, quotedTarget);
361.506 - }
361.507 -
361.508 - return "Rewrite to " + replaceTarget;
361.509 - }
361.510 -
361.511 -}
362.1 --- a/transformer/src/org/netbeans/modules/jackpot30/transformers/Utilities.java Sat Feb 18 22:14:42 2012 +0100
362.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
362.3 @@ -1,138 +0,0 @@
362.4 -/*
362.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
362.6 - *
362.7 - * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
362.8 - *
362.9 - * The contents of this file are subject to the terms of either the GNU
362.10 - * General Public License Version 2 only ("GPL") or the Common
362.11 - * Development and Distribution License("CDDL") (collectively, the
362.12 - * "License"). You may not use this file except in compliance with the
362.13 - * License. You can obtain a copy of the License at
362.14 - * http://www.netbeans.org/cddl-gplv2.html
362.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
362.16 - * specific language governing permissions and limitations under the
362.17 - * License. When distributing the software, include this License Header
362.18 - * Notice in each file and include the License file at
362.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
362.20 - * particular file as subject to the "Classpath" exception as provided
362.21 - * by Sun in the GPL Version 2 section of the License file that
362.22 - * accompanied this code. If applicable, add the following below the
362.23 - * License Header, with the fields enclosed by brackets [] replaced by
362.24 - * your own identifying information:
362.25 - * "Portions Copyrighted [year] [name of copyright owner]"
362.26 - *
362.27 - * If you wish your version of this file to be governed by only the CDDL
362.28 - * or only the GPL Version 2, indicate your decision by adding
362.29 - * "[Contributor] elects to include this software in this distribution
362.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
362.31 - * single choice of license, a recipient has the option to distribute
362.32 - * your version of this file under either the CDDL, the GPL Version 2 or
362.33 - * to extend the choice of license to its licensees as provided above.
362.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
362.35 - * Version 2 license, then the option applies only if the new code is
362.36 - * made subject to such option by the copyright holder.
362.37 - *
362.38 - * Contributor(s):
362.39 - *
362.40 - * Portions Copyrighted 2008-2009 Sun Microsystems, Inc.
362.41 - */
362.42 -
362.43 -package org.netbeans.modules.jackpot30.transformers;
362.44 -
362.45 -import com.sun.source.tree.AnnotationTree;
362.46 -import com.sun.source.tree.AssignmentTree;
362.47 -import com.sun.source.tree.ExpressionTree;
362.48 -import com.sun.source.tree.IdentifierTree;
362.49 -import com.sun.source.tree.LiteralTree;
362.50 -import com.sun.source.tree.MemberSelectTree;
362.51 -import com.sun.source.tree.NewArrayTree;
362.52 -import com.sun.source.tree.Tree;
362.53 -import com.sun.source.tree.Tree.Kind;
362.54 -import java.util.Arrays;
362.55 -import java.util.Iterator;
362.56 -import java.util.LinkedList;
362.57 -import java.util.List;
362.58 -import javax.lang.model.element.TypeElement;
362.59 -import javax.lang.model.type.TypeMirror;
362.60 -import org.netbeans.api.java.source.TreeMaker;
362.61 -import org.netbeans.api.java.source.WorkingCopy;
362.62 -import org.openide.util.NbCollections;
362.63 -
362.64 -/**
362.65 - *
362.66 - * @author Jan Lahoda
362.67 - */
362.68 -public class Utilities {
362.69 -
362.70 - private Utilities() {}
362.71 -
362.72 - public static <E> Iterable<E> checkedIterableByFilter(final Iterable raw, final Class<E> type, final boolean strict) {
362.73 - return new Iterable<E>() {
362.74 - public Iterator<E> iterator() {
362.75 - return NbCollections.checkedIteratorByFilter(raw.iterator(), type, strict);
362.76 - }
362.77 - };
362.78 - }
362.79 -
362.80 -// public static AnnotationTree constructConstraint(WorkingCopy wc, String name, TypeMirror tm) {
362.81 -// TreeMaker make = wc.getTreeMaker();
362.82 -// ExpressionTree variable = prepareAssignment(make, "variable", make.Literal(name));
362.83 -// ExpressionTree type = prepareAssignment(make, "type", make.MemberSelect((ExpressionTree) make.Type(wc.getTypes().erasure(tm)), "class"));
362.84 -// TypeElement constraint = wc.getElements().getTypeElement(Annotations.CONSTRAINT.toFQN());
362.85 -//
362.86 -// return make.Annotation(make.QualIdent(constraint), Arrays.asList(variable, type));
362.87 -// }
362.88 -
362.89 - public static ExpressionTree prepareAssignment(TreeMaker make, String name, ExpressionTree value) {
362.90 - return make.Assignment(make.Identifier(name), value);
362.91 - }
362.92 -
362.93 - public static ExpressionTree findValue(AnnotationTree m, String name) {
362.94 - for (ExpressionTree et : m.getArguments()) {
362.95 - if (et.getKind() == Kind.ASSIGNMENT) {
362.96 - AssignmentTree at = (AssignmentTree) et;
362.97 - String varName = ((IdentifierTree) at.getVariable()).getName().toString();
362.98 -
362.99 - if (varName.equals(name)) {
362.100 - return at.getExpression();
362.101 - }
362.102 - }
362.103 -
362.104 - if (et instanceof LiteralTree/*XXX*/ && "value".equals(name)) {
362.105 - return et;
362.106 - }
362.107 - }
362.108 -
362.109 - return null;
362.110 - }
362.111 -
362.112 - public static List<AnnotationTree> findArrayValue(AnnotationTree at, String name) {
362.113 - ExpressionTree fixesArray = findValue(at, name);
362.114 - List<AnnotationTree> fixes = new LinkedList<AnnotationTree>();
362.115 -
362.116 - if (fixesArray != null && fixesArray.getKind() == Kind.NEW_ARRAY) {
362.117 - NewArrayTree trees = (NewArrayTree) fixesArray;
362.118 -
362.119 - for (ExpressionTree fix : trees.getInitializers()) {
362.120 - if (fix.getKind() == Kind.ANNOTATION) {
362.121 - fixes.add((AnnotationTree) fix);
362.122 - }
362.123 - }
362.124 - }
362.125 -
362.126 - if (fixesArray != null && fixesArray.getKind() == Kind.ANNOTATION) {
362.127 - fixes.add((AnnotationTree) fixesArray);
362.128 - }
362.129 -
362.130 - return fixes;
362.131 - }
362.132 -
362.133 - public static boolean isPureMemberSelect(Tree mst, boolean allowVariables) {
362.134 - switch (mst.getKind()) {
362.135 - case IDENTIFIER: return allowVariables || ((IdentifierTree) mst).getName().charAt(0) != '$';
362.136 - case MEMBER_SELECT: return isPureMemberSelect(((MemberSelectTree) mst).getExpression(), allowVariables);
362.137 - default: return false;
362.138 - }
362.139 - }
362.140 -
362.141 -}
363.1 --- a/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/Bundle.properties Sat Feb 18 22:14:42 2012 +0100
363.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
363.3 @@ -1,38 +0,0 @@
363.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
363.5 -#
363.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
363.7 -#
363.8 -# The contents of this file are subject to the terms of either the GNU
363.9 -# General Public License Version 2 only ("GPL") or the Common
363.10 -# Development and Distribution License("CDDL") (collectively, the
363.11 -# "License"). You may not use this file except in compliance with the
363.12 -# License. You can obtain a copy of the License at
363.13 -# http://www.netbeans.org/cddl-gplv2.html
363.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
363.15 -# specific language governing permissions and limitations under the
363.16 -# License. When distributing the software, include this License Header
363.17 -# Notice in each file and include the License file at
363.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
363.19 -# particular file as subject to the "Classpath" exception as provided
363.20 -# by Sun in the GPL Version 2 section of the License file that
363.21 -# accompanied this code. If applicable, add the following below the
363.22 -# License Header, with the fields enclosed by brackets [] replaced by
363.23 -# your own identifying information:
363.24 -# "Portions Copyrighted [year] [name of copyright owner]"
363.25 -#
363.26 -# If you wish your version of this file to be governed by only the CDDL
363.27 -# or only the GPL Version 2, indicate your decision by adding
363.28 -# "[Contributor] elects to include this software in this distribution
363.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
363.30 -# single choice of license, a recipient has the option to distribute
363.31 -# your version of this file under either the CDDL, the GPL Version 2 or
363.32 -# to extend the choice of license to its licensees as provided above.
363.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
363.34 -# Version 2 license, then the option applies only if the new code is
363.35 -# made subject to such option by the copyright holder.
363.36 -#
363.37 -# Contributor(s):
363.38 -#
363.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
363.40 -
363.41 -OpenIDE-Module-Name=Jackpot 3.0 Transformations
364.1 --- a/transformer/src/org/netbeans/modules/jackpot30/transformers/resources/layer.xml Sat Feb 18 22:14:42 2012 +0100
364.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
364.3 @@ -1,4 +0,0 @@
364.4 -<?xml version="1.0" encoding="UTF-8"?>
364.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
364.6 -<filesystem>
364.7 -</filesystem>
365.1 --- a/transformer/test/unit/src/org/netbeans/modules/jackpot30/transformers/TransformationHintProviderImplTest.java Sat Feb 18 22:14:42 2012 +0100
365.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
365.3 @@ -1,555 +0,0 @@
365.4 -/*
365.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
365.6 - *
365.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
365.8 - *
365.9 - * The contents of this file are subject to the terms of either the GNU
365.10 - * General Public License Version 2 only ("GPL") or the Common
365.11 - * Development and Distribution License("CDDL") (collectively, the
365.12 - * "License"). You may not use this file except in compliance with the
365.13 - * License. You can obtain a copy of the License at
365.14 - * http://www.netbeans.org/cddl-gplv2.html
365.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
365.16 - * specific language governing permissions and limitations under the
365.17 - * License. When distributing the software, include this License Header
365.18 - * Notice in each file and include the License file at
365.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
365.20 - * particular file as subject to the "Classpath" exception as provided
365.21 - * by Sun in the GPL Version 2 section of the License file that
365.22 - * accompanied this code. If applicable, add the following below the
365.23 - * License Header, with the fields enclosed by brackets [] replaced by
365.24 - * your own identifying information:
365.25 - * "Portions Copyrighted [year] [name of copyright owner]"
365.26 - *
365.27 - * If you wish your version of this file to be governed by only the CDDL
365.28 - * or only the GPL Version 2, indicate your decision by adding
365.29 - * "[Contributor] elects to include this software in this distribution
365.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
365.31 - * single choice of license, a recipient has the option to distribute
365.32 - * your version of this file under either the CDDL, the GPL Version 2 or
365.33 - * to extend the choice of license to its licensees as provided above.
365.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
365.35 - * Version 2 license, then the option applies only if the new code is
365.36 - * made subject to such option by the copyright holder.
365.37 - *
365.38 - * Contributor(s):
365.39 - *
365.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
365.41 - */
365.42 -
365.43 -package org.netbeans.modules.jackpot30.transformers;
365.44 -
365.45 -import com.sun.source.tree.Tree.Kind;
365.46 -import java.io.File;
365.47 -import java.io.IOException;
365.48 -import java.util.ArrayList;
365.49 -import java.util.Arrays;
365.50 -import java.util.Collections;
365.51 -import java.util.HashMap;
365.52 -import java.util.LinkedList;
365.53 -import java.util.List;
365.54 -import java.util.Map;
365.55 -import java.util.concurrent.atomic.AtomicBoolean;
365.56 -import javax.swing.text.Document;
365.57 -import org.netbeans.api.java.lexer.JavaTokenId;
365.58 -import org.netbeans.api.java.source.CompilationInfo;
365.59 -import org.netbeans.api.java.source.JavaSource;
365.60 -import org.netbeans.api.java.source.JavaSource.Phase;
365.61 -import org.netbeans.api.java.source.SourceUtilsTestUtil;
365.62 -import org.netbeans.api.java.source.TestUtilities;
365.63 -import org.netbeans.api.lexer.Language;
365.64 -import org.netbeans.junit.NbTestCase;
365.65 -import org.netbeans.modules.java.hints.jackpot.impl.RulesManager;
365.66 -import org.netbeans.modules.java.hints.jackpot.impl.hints.HintsInvoker;
365.67 -import org.netbeans.modules.java.hints.jackpot.spi.ClassPathBasedHintProvider;
365.68 -import org.netbeans.modules.java.hints.jackpot.spi.HintDescription;
365.69 -import org.netbeans.modules.java.hints.jackpot.spi.Trigger.PatternDescription;
365.70 -import org.netbeans.modules.java.source.TreeLoader;
365.71 -import org.netbeans.spi.editor.hints.ErrorDescription;
365.72 -import org.netbeans.spi.editor.hints.Fix;
365.73 -import org.openide.LifecycleManager;
365.74 -import org.openide.cookies.EditorCookie;
365.75 -import org.openide.filesystems.FileObject;
365.76 -import org.openide.filesystems.FileUtil;
365.77 -import org.openide.loaders.DataObject;
365.78 -import org.openide.modules.InstalledFileLocator;
365.79 -
365.80 -/**
365.81 - *
365.82 - * @author Jan Lahoda
365.83 - */
365.84 -public class TransformationHintProviderImplTest extends NbTestCase {
365.85 -
365.86 - public TransformationHintProviderImplTest(String name) {
365.87 - super(name);
365.88 - }
365.89 -
365.90 - public void testSimpleAnalysis() throws Exception {
365.91 - performAnalysisTest("package test;\n" +
365.92 - "import net.java.lang.annotations.Constraint;\n" +
365.93 - "import net.java.lang.annotations.Fix;\n" +
365.94 - "import net.java.lang.annotations.Pattern;\n" +
365.95 - "import net.java.lang.annotations.Transformation;\n" +
365.96 - "public class Test {\n" +
365.97 - " @Transformation(\n" +
365.98 - " displayName=\"O\",\n" +
365.99 - " pattern=@Pattern(\"$0.getCookie($1)\"),\n" +
365.100 - " constraint={\n" +
365.101 - " @Constraint(variable=\"$0\", type=Test.class),\n" +
365.102 - " @Constraint(variable=\"$1\", type=Class.class)\n" +
365.103 - " },\n" +
365.104 - " fix=@Fix(\"$0.lookup($1)\")\n" +
365.105 - " )\n" +
365.106 - " public void getCookie(Class c) {}\n" +
365.107 - " private void test() {\n" +
365.108 - " getCookie(null);\n" +
365.109 - " }\n" +
365.110 - "}\n",
365.111 - "17:9-17:18:verifier:O");
365.112 - }
365.113 -
365.114 - public void testCanGoUp() throws Exception {
365.115 - performAnalysisTest("package test;\n" +
365.116 - "import net.java.lang.annotations.Constraint;\n" +
365.117 - "import net.java.lang.annotations.Fix;\n" +
365.118 - "import net.java.lang.annotations.Pattern;\n" +
365.119 - "import net.java.lang.annotations.Transformation;\n" +
365.120 - "public abstract class Test {\n" +
365.121 - " @Transformation(\n" +
365.122 - " displayName=\"O\",\n" +
365.123 - " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
365.124 - " constraint={\n" +
365.125 - " @Constraint(variable=\"$0\", type=Test.class)\n" +
365.126 - " },\n" +
365.127 - " fix=@Fix(\"$0.lookup($1)\")\n" +
365.128 - " )\n" +
365.129 - " public abstract String getCookie();\n" +
365.130 - " private void test() {\n" +
365.131 - " getCookie().toString();\n" +
365.132 - " }\n" +
365.133 - "}\n",
365.134 - "16:21-16:29:verifier:O");
365.135 - }
365.136 -
365.137 - public void testForConstructor() throws Exception {
365.138 - performAnalysisTest("package test;\n" +
365.139 - "import net.java.lang.annotations.Constraint;\n" +
365.140 - "import net.java.lang.annotations.Fix;\n" +
365.141 - "import net.java.lang.annotations.Pattern;\n" +
365.142 - "import net.java.lang.annotations.Transformation;\n" +
365.143 - "public class Test {\n" +
365.144 - " @Transformation(\n" +
365.145 - " displayName=\"O\",\n" +
365.146 - " pattern=@Pattern(\"new test.Test()\"),\n" +
365.147 - " fix={}\n" +
365.148 - " )\n" +
365.149 - " public Test() {}\n" +
365.150 - " private void test() {\n" +
365.151 - " new Test();\n" +
365.152 - " }\n" +
365.153 - "}\n",
365.154 - "13:9-13:19:verifier:O");
365.155 - }
365.156 -
365.157 - public void testMoreWarnings() throws Exception {
365.158 - performAnalysisTest("package test;\n" +
365.159 - "import net.java.lang.annotations.Constraint;\n" +
365.160 - "import net.java.lang.annotations.Fix;\n" +
365.161 - "import net.java.lang.annotations.Pattern;\n" +
365.162 - "import net.java.lang.annotations.Transformation;\n" +
365.163 - "public class Test {\n" +
365.164 - " @Transformation(\n" +
365.165 - " displayName=\"O\",\n" +
365.166 - " pattern=@Pattern(\"new test.Test()\"),\n" +
365.167 - " fix={}\n" +
365.168 - " )\n" +
365.169 - " public Test() {}\n" +
365.170 - " private void test() {\n" +
365.171 - " new Test();\n" +
365.172 - " new Test();\n" +
365.173 - " }\n" +
365.174 - "}\n",
365.175 - "13:9-13:19:verifier:O",
365.176 - "14:9-14:19:verifier:O");
365.177 - }
365.178 -
365.179 - public void testCorrectImports() throws Exception {
365.180 - performFixTest("test/Test.java",
365.181 - "package test;\n" +
365.182 - "import net.java.lang.annotations.Constraint;\n" +
365.183 - "import net.java.lang.annotations.Fix;\n" +
365.184 - "import net.java.lang.annotations.Pattern;\n" +
365.185 - "import net.java.lang.annotations.Transformation;\n" +
365.186 - "public abstract class Test {\n" +
365.187 - " @Transformation(\n" +
365.188 - " displayName=\"O\",\n" +
365.189 - " pattern=@Pattern(\"$this.test()\"),\n" +
365.190 - " fix=@Fix(\"test.Test.test1().toString()\")\n" +
365.191 - " )\n" +
365.192 - " private void test() {\n" +
365.193 - " test();\n" +
365.194 - " }" +
365.195 - " static String test1() {return null;}\n" +
365.196 - "}\n",
365.197 - "12:9-12:13:verifier:O",
365.198 - "FixImpl",
365.199 - "package test;\n" +
365.200 - "import net.java.lang.annotations.Constraint;\n" +
365.201 - "import net.java.lang.annotations.Fix;\n" +
365.202 - "import net.java.lang.annotations.Pattern;\n" +
365.203 - "import net.java.lang.annotations.Transformation;\n" +
365.204 - "public abstract class Test {\n" +
365.205 - " @Transformation(\n" +
365.206 - " displayName=\"O\",\n" +
365.207 - " pattern=@Pattern(\"$this.test()\"),\n" +
365.208 - " fix=@Fix(\"test.Test.test1().toString()\")\n" +
365.209 - " )\n" +
365.210 - " private void test() {\n" +
365.211 - " Test.test1().toString();\n" +
365.212 - " }" +
365.213 - " static String test1() {return null;}\n" +
365.214 - "}\n");
365.215 - }
365.216 -
365.217 - public void testNoExceptions1() throws Exception {
365.218 - performNoExceptionsTest("package test;\n" +
365.219 - "import net.java.lang.annotations.Constraint;\n" +
365.220 - "import net.java.lang.annotations.Fix;\n" +
365.221 - "import net.java.lang.annotations.Pattern;\n" +
365.222 - "import net.java.lang.annotations.Transformation;\n" +
365.223 - "public abstract class Test {\n" +
365.224 - " |public abstract String getCookie();\n" +
365.225 - " private void test() {\n" +
365.226 - " getCookie().toString();\n" +
365.227 - " }\n" +
365.228 - "}\n",
365.229 - " @Transformation(\n" +
365.230 - " displayName=\"O\",\n" +
365.231 - " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
365.232 - " constraint={\n" +
365.233 - " @Constraint(variable=\"$0\", type=Test.class)\n" +
365.234 - " },\n" +
365.235 - " fix={@Fix(\"$0.lookup($1)\")}\n" +
365.236 - " )\n".replaceAll("[ \n]+", " "));
365.237 - }
365.238 -
365.239 - public void testNoExceptions2() throws Exception {
365.240 - performNoExceptionsTest("package test;\n" +
365.241 - "import net.java.lang.annotations.Constraint;\n" +
365.242 - "import net.java.lang.annotations.Fix;\n" +
365.243 - "import net.java.lang.annotations.Pattern;\n" +
365.244 - "import net.java.lang.annotations.Transformation;\n" +
365.245 - "public abstract class Test {\n" +
365.246 - " |public abstract String getCookie();\n" +
365.247 - " private void test() {\n" +
365.248 - " getCookie().toString();\n" +
365.249 - " }\n" +
365.250 - "}\n",
365.251 - " @Transformation(\n" +
365.252 - " displayName=\"O\",\n" +
365.253 - " pattern=@Pattern(\"$0.getCookie().toString()\"),\n" +
365.254 - " constraint=\n" +
365.255 - " @Constraint(variable=\"$0\", type=Test.class)\n" +
365.256 - " ,\n" +
365.257 - " fix=@Fix(\"$0.lookup($1)\")\n" +
365.258 - " )\n".replaceAll("[ \n]+", " "));
365.259 - }
365.260 -
365.261 - public void testType1() throws Exception {
365.262 - performFixTest("test/Test.java",
365.263 - "package test;\n" +
365.264 - "import net.java.lang.annotations.Constraint;\n" +
365.265 - "import net.java.lang.annotations.Fix;\n" +
365.266 - "import net.java.lang.annotations.Pattern;\n" +
365.267 - "import net.java.lang.annotations.Transformation;\n" +
365.268 - "public abstract class Test {\n" +
365.269 - " @Transformation(\n" +
365.270 - " displayName=\"O\",\n" +
365.271 - " pattern=@Pattern(\"test.Test.Bad\"),\n" +
365.272 - " fix=@Fix(\"test.Test.Good\")\n" +
365.273 - " )\n" +
365.274 - " public static class Bad {}\n" +
365.275 - " public static class Good {}\n" +
365.276 - " static void test1() { Bad b; }\n" +
365.277 - "}\n",
365.278 - "13:26-13:29:verifier:O",
365.279 - "FixImpl",
365.280 - "package test;\n" +
365.281 - "import net.java.lang.annotations.Constraint;\n" +
365.282 - "import net.java.lang.annotations.Fix;\n" +
365.283 - "import net.java.lang.annotations.Pattern;\n" +
365.284 - "import net.java.lang.annotations.Transformation;\n" +
365.285 - "public abstract class Test {\n" +
365.286 - " @Transformation(\n" +
365.287 - " displayName=\"O\",\n" +
365.288 - " pattern=@Pattern(\"test.Test.Bad\"),\n" +
365.289 - " fix=@Fix(\"test.Test.Good\")\n" +
365.290 - " )\n" +
365.291 - " public static class Bad {}\n" +
365.292 - " public static class Good {}\n" +
365.293 - " static void test1() { Good b; }\n" +
365.294 - "}\n".replaceAll("[ \n]+", " "));
365.295 - }
365.296 -
365.297 - public void testCorrectReplace() throws Exception {
365.298 - performFixTest("test/Test.java",
365.299 - "package test;\n" +
365.300 - "import net.java.lang.annotations.Constraint;\n" +
365.301 - "import net.java.lang.annotations.Fix;\n" +
365.302 - "import net.java.lang.annotations.Pattern;\n" +
365.303 - "import net.java.lang.annotations.Transformation;\n" +
365.304 - "public class Test {\n" +
365.305 - " @Transformation(\n" +
365.306 - " displayName=\"O\",\n" +
365.307 - " pattern=@Pattern(\"$this.test()\"),\n" +
365.308 - " fix=@Fix(\"$this.test()\")\n" +
365.309 - " )\n" +
365.310 - " private void test() {\n" +
365.311 - " new Test().test();\n" +
365.312 - " }\n" +
365.313 - "}\n",
365.314 - "12:20-12:24:verifier:O",
365.315 - "FixImpl",
365.316 - "package test;\n" +
365.317 - "import net.java.lang.annotations.Constraint;\n" +
365.318 - "import net.java.lang.annotations.Fix;\n" +
365.319 - "import net.java.lang.annotations.Pattern;\n" +
365.320 - "import net.java.lang.annotations.Transformation;\n" +
365.321 - "public class Test {\n" +
365.322 - " @Transformation(\n" +
365.323 - " displayName=\"O\",\n" +
365.324 - " pattern=@Pattern(\"$this.test()\"),\n" +
365.325 - " fix=@Fix(\"$this.test()\")\n" +
365.326 - " )\n" +
365.327 - " private void test() {\n" +
365.328 - " new Test().test();\n" +
365.329 - " }\n" +
365.330 - "}\n");
365.331 - }
365.332 -
365.333 - @Override
365.334 - protected void setUp() throws Exception {
365.335 - super.setUp();
365.336 -
365.337 - File jar = FileUtil.archiveOrDirForURL(TransformationHintProviderImpl.class.getProtectionDomain().getCodeSource().getLocation());
365.338 -
365.339 - assertNotNull(jar);
365.340 -
365.341 - String nbHome = jar.getParentFile().getParentFile().getAbsolutePath();
365.342 -
365.343 - System.setProperty("netbeans.home",nbHome);
365.344 -
365.345 - SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/editor/resources/layer.xml"}, new Object[0]);
365.346 - TreeLoader.DISABLE_CONFINEMENT_TEST = true;
365.347 - }
365.348 -
365.349 - private List<ErrorDescription> computeWarnings() {
365.350 - List<HintDescription> hints = new ArrayList<HintDescription>();
365.351 -
365.352 - RulesManager.computeElementBasedHintsXXX(info, new AtomicBoolean(), Collections.singletonList(new TransformationHintProviderImpl()), Collections.<ClassPathBasedHintProvider>emptyList(), hints);
365.353 -
365.354 - List<ErrorDescription> warnings = new HintsInvoker(info, new AtomicBoolean()).computeHints(info, hints);
365.355 -
365.356 - return warnings;
365.357 - }
365.358 -
365.359 - private void prepareTest(String fileName, String code) throws Exception {
365.360 - prepareTest(fileName, code, false);
365.361 - }
365.362 -
365.363 - private void prepareTest(String fileName, String code, boolean ignoreErrors) throws Exception {
365.364 - clearWorkDir();
365.365 -
365.366 - FileUtil.refreshFor(File.listRoots());
365.367 -
365.368 - FileObject workFO = FileUtil.toFileObject(getWorkDir());
365.369 -
365.370 - assertNotNull(workFO);
365.371 -
365.372 - workFO.refresh();
365.373 -
365.374 - sourceRoot = workFO.createFolder("src");
365.375 - FileObject buildRoot = workFO.createFolder("build");
365.376 - FileObject cache = workFO.createFolder("cache");
365.377 -
365.378 - FileObject data = FileUtil.createData(sourceRoot, fileName);
365.379 - File dataFile = FileUtil.toFile(data);
365.380 -
365.381 - assertNotNull(dataFile);
365.382 -
365.383 - TestUtilities.copyStringToFile(dataFile, code);
365.384 -
365.385 - File ann = InstalledFileLocator.getDefault().locate("libs/annotations.jar", null, false);
365.386 -
365.387 - if (ann == null) {
365.388 - ann = InstalledFileLocator.getDefault().locate("release/libs/annotations.jar", null, false);
365.389 - }
365.390 -
365.391 - assertNotNull(System.getProperty("netbeans.home"), ann);
365.392 -
365.393 - FileObject annFO = FileUtil.toFileObject(ann);
365.394 -
365.395 - assertNotNull(annFO);
365.396 -
365.397 - SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache, new FileObject[] {FileUtil.getArchiveRoot(annFO)});
365.398 -
365.399 - DataObject od = DataObject.find(data);
365.400 - EditorCookie ec = od.getLookup().lookup(EditorCookie.class);
365.401 -
365.402 - assertNotNull(ec);
365.403 -
365.404 - doc = ec.openDocument();
365.405 - doc.putProperty(Language.class, JavaTokenId.language());
365.406 -
365.407 - JavaSource js = JavaSource.forFileObject(data);
365.408 -
365.409 - assertNotNull(js);
365.410 -
365.411 - info = SourceUtilsTestUtil.getCompilationInfo(js, Phase.RESOLVED);
365.412 -
365.413 - assertNotNull(info);
365.414 -
365.415 - if (!ignoreErrors) {
365.416 - assertEquals(info.getDiagnostics().toString(), 0, info.getDiagnostics().size());
365.417 - }
365.418 - }
365.419 -
365.420 - private FileObject sourceRoot;
365.421 - private CompilationInfo info;
365.422 - private Document doc;
365.423 - private String wordDirPath;
365.424 -
365.425 - protected void performNoExceptionsTest(String code, String type) throws Exception {
365.426 - String wDP = getWorkDirPath();
365.427 -
365.428 - int offset = code.indexOf('|');
365.429 -
365.430 - code = code.replace("|", "");
365.431 -
365.432 - File prev = null;
365.433 -
365.434 - for (int i = 0; i < type.length(); i++) {
365.435 - StringBuilder nueCode = new StringBuilder();
365.436 -
365.437 - nueCode.append(code);
365.438 - nueCode.insert(offset, type.substring(0, i + 1));
365.439 -
365.440 - this.wordDirPath = wDP + File.separatorChar + i;
365.441 -
365.442 - performAnalysisTest(nueCode.toString(), null, true);
365.443 -
365.444 - if (prev != null) {
365.445 - deleteFile(prev);
365.446 - FileUtil.refreshFor(File.listRoots());
365.447 - }
365.448 -
365.449 - prev = getWorkDir();
365.450 - }
365.451 - }
365.452 -
365.453 - protected void performAnalysisTest(String code, String... golden) throws Exception {
365.454 - performAnalysisTest(code, golden, false);
365.455 - }
365.456 -
365.457 - protected void performAnalysisTest(String code, String[] golden, boolean ignoreErrors) throws Exception {
365.458 - prepareTest("test/Test.java", code, ignoreErrors);
365.459 -
365.460 - List<ErrorDescription> warnings = computeWarnings();
365.461 - List<String> dns = new LinkedList<String>();
365.462 -
365.463 - for (ErrorDescription ed : warnings) {
365.464 - dns.add(ed.toString());
365.465 - }
365.466 -
365.467 - if (golden != null) {
365.468 - assertEquals(Arrays.asList(golden), dns);
365.469 - }
365.470 - }
365.471 -
365.472 - protected String performFixTest(String fileName, String code, String errorDescriptionToString, String fixDebugString, String golden) throws Exception {
365.473 - prepareTest(fileName, code);
365.474 -
365.475 - List<ErrorDescription> errors = computeWarnings();
365.476 -
365.477 - ErrorDescription toFix = null;
365.478 -
365.479 - for (ErrorDescription d : errors) {
365.480 - if (errorDescriptionToString.equals(d.toString())) {
365.481 - toFix = d;
365.482 - break;
365.483 - }
365.484 - }
365.485 -
365.486 - assertNotNull("Error: \"" + errorDescriptionToString + "\" not found. All ErrorDescriptions: " + errors.toString(), toFix);
365.487 -
365.488 - assertTrue("Must be computed", toFix.getFixes().isComputed());
365.489 -
365.490 - List<Fix> fixes = toFix.getFixes().getFixes();
365.491 - List<String> fixNames = new LinkedList<String>();
365.492 - Fix toApply = null;
365.493 -
365.494 - for (Fix f : fixes) {
365.495 - if (fixDebugString.equals(toDebugString(info, f))) {
365.496 - toApply = f;
365.497 - }
365.498 -
365.499 - fixNames.add(toDebugString(info, f));
365.500 - }
365.501 -
365.502 - assertNotNull("Cannot find fix to invoke: " + fixNames.toString(), toApply);
365.503 -
365.504 - toApply.implement();
365.505 -
365.506 - FileObject toCheck = sourceRoot.getFileObject(fileName);
365.507 -
365.508 - assertNotNull(toCheck);
365.509 -
365.510 - DataObject toCheckDO = DataObject.find(toCheck);
365.511 - EditorCookie ec = toCheckDO.getCookie(EditorCookie.class);
365.512 - Document toCheckDocument = ec.openDocument();
365.513 -
365.514 - String realCode = toCheckDocument.getText(0, toCheckDocument.getLength());
365.515 -
365.516 - //ignore whitespaces:
365.517 - realCode = realCode.replaceAll("[ \t\n]+", " ");
365.518 -
365.519 - if (golden != null) {
365.520 - golden = golden.replaceAll("[ \t\n]+", " ");
365.521 - assertEquals("The output code does not match the expected code.", golden, realCode);
365.522 - }
365.523 -
365.524 - LifecycleManager.getDefault().saveAll();
365.525 -
365.526 - return realCode;
365.527 - }
365.528 -
365.529 - private String toDebugString(CompilationInfo info, Fix f) {
365.530 - return "FixImpl";
365.531 - }
365.532 -
365.533 - @Override
365.534 - public String getWorkDirPath() {
365.535 - if (this.wordDirPath != null) {
365.536 - return this.wordDirPath;
365.537 - }
365.538 -
365.539 - return super.getWorkDirPath();
365.540 - }
365.541 -
365.542 - private static void deleteFile(File file) throws IOException {
365.543 - if (file.isDirectory()) {
365.544 - // file is a directory - delete sub files first
365.545 - File files[] = file.listFiles();
365.546 - for (int i = 0; i < files.length; i++) {
365.547 - deleteFile(files[i]);
365.548 - }
365.549 -
365.550 - }
365.551 - // file is a File :-)
365.552 - boolean result = file.delete();
365.553 - if (result == false ) {
365.554 - // a problem has appeared
365.555 - throw new IOException("Cannot delete file, file = "+file.getPath());
365.556 - }
365.557 - }
365.558 -}