Automated merge with http://hg.netbeans.org/main/contrib/
authorNils Hoffmann <nhoffmann@netbeans.org>
Sun, 10 Feb 2013 16:18:19 +0100
changeset 17974343d45cc5bb8
parent 17952 dfead56198e1
parent 17973 fa82becb74f2
child 17975 1eddb2ad63dd
Automated merge with http://hg.netbeans.org/main/contrib/
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.form
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesWizardPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChangerWizardAction.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.form
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserWizardPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LineEndingsPanel.form
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LineEndingsPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.form
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewWizardPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersPanel.form
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersWizardPanel.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Bundle.properties
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/CheckableNodeCapability.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/CheckboxListView.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileChildren.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileLoader.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FolderChildren.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LicenseChangerRunnable.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LineEndingPreference.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/NodeCheckObserver.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Offsets.java
licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/WizardProperties.java
licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/fake_license.txt
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/licensechanger/arch.xml	Sun Feb 10 16:18:19 2013 +0100
     1.3 @@ -0,0 +1,1081 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
     1.6 +  <!ENTITY api-questions SYSTEM "../../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
     1.7 +]>
     1.8 +
     1.9 +<api-answers
    1.10 +  question-version="1.29"
    1.11 +  author="yourname@netbeans.org"
    1.12 +>
    1.13 +
    1.14 +  &api-questions;
    1.15 +
    1.16 +
    1.17 +<!--
    1.18 +        <question id="arch-overall" when="init">
    1.19 +            Describe the overall architecture. 
    1.20 +            <hint>
    1.21 +            What will be API for 
    1.22 +            <a href="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API">
    1.23 +                clients and what support API</a>? 
    1.24 +            What parts will be pluggable?
    1.25 +            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
    1.26 +            to describe your general APIs and specify their
    1.27 +            <a href="http://wiki.netbeans.org/API_Stability#Private">
    1.28 +            stability categories</a>.
    1.29 +            If possible please provide simple diagrams.
    1.30 +            </hint>
    1.31 +        </question>
    1.32 +-->
    1.33 + <answer id="arch-overall">
    1.34 +  <p>
    1.35 +   XXX no answer for arch-overall
    1.36 +  <api type="export" name=""
    1.37 +  </p>
    1.38 + </answer>
    1.39 +
    1.40 +
    1.41 +
    1.42 +<!--
    1.43 +        <question id="arch-quality" when="init">
    1.44 +            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
    1.45 +            of your code be tested and 
    1.46 +            how are future regressions going to be prevented?
    1.47 +            <hint>
    1.48 +            What kind of testing do
    1.49 +            you want to use? How much functionality, in which areas,
    1.50 +            should be covered by the tests? How you find out that your
    1.51 +            project was successful?
    1.52 +            </hint>
    1.53 +        </question>
    1.54 +-->
    1.55 + <answer id="arch-quality">
    1.56 +  <p>
    1.57 +   XXX no answer for arch-quality
    1.58 +  </p>
    1.59 + </answer>
    1.60 +
    1.61 +
    1.62 +
    1.63 +<!--
    1.64 +        <question id="arch-time" when="init">
    1.65 +            What are the time estimates of the work?
    1.66 +            <hint>
    1.67 +            Please express your estimates of how long the design, implementation,
    1.68 +            stabilization are likely to last. How many people will be needed to
    1.69 +            implement this and what is the expected milestone by which the work should be 
    1.70 +            ready?
    1.71 +            </hint>
    1.72 +        </question>
    1.73 +-->
    1.74 + <answer id="arch-time">
    1.75 +  <p>
    1.76 +   XXX no answer for arch-time
    1.77 +  </p>
    1.78 + </answer>
    1.79 +
    1.80 +
    1.81 +
    1.82 +<!--
    1.83 +        <question id="arch-usecases" when="init">
    1.84 +            <hint>
    1.85 +                Content of this answer will be displayed as part of page at
    1.86 +                http://www.netbeans.org/download/dev/javadoc/usecases.html 
    1.87 +                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
    1.88 +                and if you want to use an URL you can prefix if with @TOP@ to begin
    1.89 +                at the root of your javadoc
    1.90 +            </hint>
    1.91 +        
    1.92 +            Describe the main <a href="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented">
    1.93 +            use cases</a> of the new API. Who will use it under
    1.94 +            what circumstances? What kind of code would typically need to be written
    1.95 +            to use the module?
    1.96 +        </question>
    1.97 +-->
    1.98 + <answer id="arch-usecases">
    1.99 +  <p>
   1.100 +   XXX no answer for arch-usecases
   1.101 +  </p>
   1.102 + </answer>
   1.103 +
   1.104 +
   1.105 +
   1.106 +<!--
   1.107 +        <question id="arch-what" when="init">
   1.108 +            What is this project good for?
   1.109 +            <hint>
   1.110 +            Please provide here a few lines describing the project, 
   1.111 +            what problem it should solve, provide links to documentation, 
   1.112 +            specifications, etc.
   1.113 +            </hint>
   1.114 +        </question>
   1.115 +-->
   1.116 + <answer id="arch-what">
   1.117 +  <p>
   1.118 +  The Licensechanger plugin allows users to alter the license header used in their project's source files. It 
   1.119 +  integrates with the NetBeans template mechanism and accesses license header templates available within the IDE.
   1.120 +  The plugin provides a convenient wizard that may be invoked from the Tools-&gt;Change License Header menu on 
   1.121 +  source code or file system folders. It allows for further customizations, such as setting a distinct copyright holder and 
   1.122 +  to update the project's default license header used when new source files are created.
   1.123 +  </p>
   1.124 + </answer>
   1.125 +
   1.126 +
   1.127 +
   1.128 +<!--
   1.129 +        <question id="arch-where" when="impl">
   1.130 +            Where one can find sources for your module?
   1.131 +            <hint>
   1.132 +                Please provide link to the Hg web client at
   1.133 +                http://hg.netbeans.org/
   1.134 +                or just use tag defaultanswer generate='here'
   1.135 +            </hint>
   1.136 +        </question>
   1.137 +-->
   1.138 + <answer id="arch-where">
   1.139 +  <defaultanswer generate='here' />
   1.140 + </answer>
   1.141 +
   1.142 +
   1.143 +
   1.144 +<!--
   1.145 +        <question id="compat-deprecation" when="init">
   1.146 +            How the introduction of your project influences functionality
   1.147 +            provided by previous version of the product?
   1.148 +            <hint>
   1.149 +            If you are planning to deprecate/remove/change any existing APIs,
   1.150 +            list them here accompanied with the reason explaining why you
   1.151 +            are doing so.
   1.152 +            </hint>
   1.153 +        </question>
   1.154 +-->
   1.155 + <answer id="compat-deprecation">
   1.156 +  <p>
   1.157 +   XXX no answer for compat-deprecation
   1.158 +  </p>
   1.159 + </answer>
   1.160 +
   1.161 +
   1.162 +
   1.163 +<!--
   1.164 +        <question id="compat-i18n" when="impl">
   1.165 +            Is your module correctly internationalized?
   1.166 +            <hint>
   1.167 +            Correct internationalization means that it obeys instructions 
   1.168 +            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
   1.169 +            NetBeans I18N pages</a>.
   1.170 +            </hint>
   1.171 +        </question>
   1.172 +-->
   1.173 + <answer id="compat-i18n">
   1.174 +  <p>
   1.175 +   XXX no answer for compat-i18n
   1.176 +  </p>
   1.177 + </answer>
   1.178 +
   1.179 +
   1.180 +
   1.181 +<!--
   1.182 +        <question id="compat-standards" when="init">
   1.183 +            Does the module implement or define any standards? Is the 
   1.184 +            implementation exact or does it deviate somehow?
   1.185 +        </question>
   1.186 +-->
   1.187 + <answer id="compat-standards">
   1.188 +  <p>
   1.189 +   XXX no answer for compat-standards
   1.190 +  </p>
   1.191 + </answer>
   1.192 +
   1.193 +
   1.194 +
   1.195 +<!--
   1.196 +        <question id="compat-version" when="impl">
   1.197 +            Can your module coexist with earlier and future
   1.198 +            versions of itself? Can you correctly read all old settings? Will future
   1.199 +            versions be able to read your current settings? Can you read
   1.200 +            or politely ignore settings stored by a future version?
   1.201 +            
   1.202 +            <hint>
   1.203 +            Very helpful for reading settings is to store version number
   1.204 +            there, so future versions can decide whether how to read/convert
   1.205 +            the settings and older versions can ignore the new ones.
   1.206 +            </hint>
   1.207 +        </question>
   1.208 +-->
   1.209 + <answer id="compat-version">
   1.210 +  <p>
   1.211 +   XXX no answer for compat-version
   1.212 +  </p>
   1.213 + </answer>
   1.214 +
   1.215 +
   1.216 +
   1.217 +<!--
   1.218 +        <question id="dep-jre" when="final">
   1.219 +            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
   1.220 +            <hint>
   1.221 +            It is expected that if your module runs on 1.x that it will run 
   1.222 +            on 1.x+1 if no, state that please. Also describe here cases where
   1.223 +            you run different code on different versions of JRE and why.
   1.224 +            </hint>
   1.225 +        </question>
   1.226 +-->
   1.227 + <answer id="dep-jre">
   1.228 +  <p>
   1.229 +   XXX no answer for dep-jre
   1.230 +  </p>
   1.231 + </answer>
   1.232 +
   1.233 +
   1.234 +
   1.235 +<!--
   1.236 +        <question id="dep-jrejdk" when="final">
   1.237 +            Do you require the JDK or is the JRE enough?
   1.238 +        </question>
   1.239 +-->
   1.240 + <answer id="dep-jrejdk">
   1.241 +  <p>
   1.242 +   XXX no answer for dep-jrejdk
   1.243 +  </p>
   1.244 + </answer>
   1.245 +
   1.246 +
   1.247 +
   1.248 +<!--
   1.249 +        <question id="dep-nb" when="init">
   1.250 +            What other NetBeans projects and modules does this one depend on?
   1.251 +            <hint>
   1.252 +            Depending on other NetBeans projects influnces the ability of
   1.253 +            users of your work to customize their own branded version of
   1.254 +            NetBeans by enabling and disabling some modules. Too
   1.255 +            much dependencies restrict this kind of customization. If that
   1.256 +            is your case, then you may want to split your functionality into
   1.257 +            pieces of autoload, eager and regular modules which can be
   1.258 +            enabled independently. Usually the answer to this question
   1.259 +            is generated from your <code>project.xml</code> file, but
   1.260 +            if it is not guessed correctly, you can suppress it by
   1.261 +            specifying &lt;defaultanswer generate="none"/&gt; and
   1.262 +            write here your own. Please describe such projects as imported APIs using
   1.263 +            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
   1.264 +            By doing this information gets listed in the summary page of your
   1.265 +            javadoc.
   1.266 +            </hint>
   1.267 +        </question>
   1.268 +-->
   1.269 + <answer id="dep-nb">
   1.270 +  <defaultanswer generate='here' />
   1.271 + </answer>
   1.272 +
   1.273 +
   1.274 +
   1.275 +<!--
   1.276 +        <question id="dep-non-nb" when="init">
   1.277 +            What other projects outside NetBeans does this one depend on?
   1.278 +            
   1.279 +            <hint>
   1.280 +            Depending on 3rd party libraries is always problematic,
   1.281 +            especially if they are not open source, as that complicates
   1.282 +            the licensing scheme of NetBeans. Please enumerate your
   1.283 +            external dependencies here, so it is correctly understood since
   1.284 +            the begining what are the legal implications of your project.
   1.285 +            Also please note that
   1.286 +            some non-NetBeans projects are packaged as NetBeans modules
   1.287 +            (see <a href="http://libs.netbeans.org/">libraries</a>) and
   1.288 +            it is preferred to use this approach when more modules may
   1.289 +            depend and share such third-party libraries.
   1.290 +            </hint>
   1.291 +        </question>
   1.292 +-->
   1.293 + <answer id="dep-non-nb">
   1.294 +  <p>
   1.295 +   XXX no answer for dep-non-nb
   1.296 +  </p>
   1.297 + </answer>
   1.298 +
   1.299 +
   1.300 +
   1.301 +<!--
   1.302 +        <question id="dep-platform" when="init">
   1.303 +            On which platforms does your module run? Does it run in the same
   1.304 +            way on each?
   1.305 +            <hint>
   1.306 +            If you plan any dependency on OS or any usage of native code,
   1.307 +            please describe why you are doing so and describe how you envision
   1.308 +            to enforce the portability of your code.
   1.309 +            Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally
   1.310 +            enabled modules</a> which together with autoload/eager modules
   1.311 +            can allow you to enable to provide the best OS aware support
   1.312 +            on certain OSes while providing compatibility bridge on the not
   1.313 +            supported ones.
   1.314 +            Also please list the supported
   1.315 +            OSes/HW platforms and mentioned the lovest version of JDK required
   1.316 +            for your project to run on. Also state whether JRE is enough or
   1.317 +            you really need JDK.
   1.318 +            </hint>
   1.319 +        </question>
   1.320 +-->
   1.321 + <answer id="dep-platform">
   1.322 +  <p>
   1.323 +   XXX no answer for dep-platform
   1.324 +  </p>
   1.325 + </answer>
   1.326 +
   1.327 +
   1.328 +
   1.329 +<!--
   1.330 +        <question id="deploy-dependencies" when="final">
   1.331 +            What do other modules need to do to declare a dependency on this one,
   1.332 +            in addition to or instead of the normal module dependency declaration
   1.333 +            (e.g. tokens to require)?
   1.334 +            <hint>
   1.335 +                Provide a sample of the actual lines you would add to a module manifest
   1.336 +                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
   1.337 +                If other modules should not depend on this module, or should just use a
   1.338 +                simple regular module dependency, you can just answer "nothing". If you
   1.339 +                intentionally expose a semistable API to clients using implementation
   1.340 +                dependencies, you should mention that here (but there is no need to give
   1.341 +                an example of usage).
   1.342 +            </hint>
   1.343 +        </question>
   1.344 +-->
   1.345 + <answer id="deploy-dependencies">
   1.346 +  <p>
   1.347 +   XXX no answer for deploy-dependencies
   1.348 +  </p>
   1.349 + </answer>
   1.350 +
   1.351 +
   1.352 +
   1.353 +<!--
   1.354 +        <question id="deploy-jar" when="impl">
   1.355 +            Do you deploy just module JAR file(s) or other files as well?
   1.356 +            <hint>
   1.357 +            Usually a module consist of one JAR file (perhaps with Class-Path
   1.358 +            extensions) and also a configuration file that enables it. If you
   1.359 +            have any other files, use
   1.360 +            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
   1.361 +            to define the location, name and stability of your files (of course
   1.362 +            changing "yourname" and "friend" to suit your needs).
   1.363 +            
   1.364 +            If it uses more than one JAR, describe where they are located, how
   1.365 +            they refer to each other. 
   1.366 +            If it consist of module JAR(s) and other files, please describe
   1.367 +            what is their purpose, why other files are necessary. Please 
   1.368 +            make sure that installation/uninstallation leaves the system 
   1.369 +            in state as it was before installation.
   1.370 +            </hint>
   1.371 +        </question>
   1.372 +-->
   1.373 + <answer id="deploy-jar">
   1.374 +  <p>
   1.375 +   XXX no answer for deploy-jar
   1.376 +  </p>
   1.377 + </answer>
   1.378 +
   1.379 +
   1.380 +
   1.381 +<!--
   1.382 +        <question id="deploy-nbm" when="impl">
   1.383 +            Can you deploy an NBM via the Update Center?
   1.384 +            <hint>
   1.385 +            If not why?
   1.386 +            </hint>
   1.387 +        </question>
   1.388 +-->
   1.389 + <answer id="deploy-nbm">
   1.390 +  <p>
   1.391 +   XXX no answer for deploy-nbm
   1.392 +  </p>
   1.393 + </answer>
   1.394 +
   1.395 +
   1.396 +
   1.397 +<!--
   1.398 +        <question id="deploy-packages" when="init">
   1.399 +            Are packages of your module made inaccessible by not declaring them
   1.400 +            public?
   1.401 +            
   1.402 +            <hint>
   1.403 +            By default NetBeans build harness treats all packages are private.
   1.404 +            If you export some of them - either as public or friend packages,
   1.405 +            you should have a reason. If the reason is described elsewhere
   1.406 +            in this document, you can ignore this question.
   1.407 +            </hint>
   1.408 +        </question>
   1.409 +-->
   1.410 + <answer id="deploy-packages">
   1.411 +  <p>
   1.412 +   XXX no answer for deploy-packages
   1.413 +  </p>
   1.414 + </answer>
   1.415 +
   1.416 +
   1.417 +
   1.418 +<!--
   1.419 +        <question id="deploy-shared" when="final">
   1.420 +            Do you need to be installed in the shared location only, or in the user directory only,
   1.421 +            or can your module be installed anywhere?
   1.422 +            <hint>
   1.423 +            Installation location shall not matter, if it does explain why.
   1.424 +            Consider also whether <code>InstalledFileLocator</code> can help.
   1.425 +            </hint>
   1.426 +        </question>
   1.427 +-->
   1.428 + <answer id="deploy-shared">
   1.429 +  <p>
   1.430 +   XXX no answer for deploy-shared
   1.431 +  </p>
   1.432 + </answer>
   1.433 +
   1.434 +
   1.435 +
   1.436 +<!--
   1.437 +        <question id="exec-ant-tasks" when="impl">
   1.438 +            Do you define or register any ant tasks that other can use?
   1.439 +            
   1.440 +            <hint>
   1.441 +            If you provide an ant task that users can use, you need to be very
   1.442 +            careful about its syntax and behaviour, as it most likely forms an
   1.443 +	          API for end users and as there is a lot of end users, their reaction
   1.444 +            when such API gets broken can be pretty strong.
   1.445 +            </hint>
   1.446 +        </question>
   1.447 +-->
   1.448 + <answer id="exec-ant-tasks">
   1.449 +  <p>
   1.450 +   XXX no answer for exec-ant-tasks
   1.451 +  </p>
   1.452 + </answer>
   1.453 +
   1.454 +
   1.455 +
   1.456 +<!--
   1.457 +        <question id="exec-classloader" when="impl">
   1.458 +            Does your code create its own class loader(s)?
   1.459 +            <hint>
   1.460 +            A bit unusual. Please explain why and what for.
   1.461 +            </hint>
   1.462 +        </question>
   1.463 +-->
   1.464 + <answer id="exec-classloader">
   1.465 +  <p>
   1.466 +   XXX no answer for exec-classloader
   1.467 +  </p>
   1.468 + </answer>
   1.469 +
   1.470 +
   1.471 +
   1.472 +<!--
   1.473 +        <question id="exec-component" when="impl">
   1.474 +            Is execution of your code influenced by any (string) property
   1.475 +            of any of your components?
   1.476 +            
   1.477 +            <hint>
   1.478 +            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
   1.479 +            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
   1.480 +            a behavior of some code. This of course forms an interface that should
   1.481 +            be documented. Also if one depends on some interface that an object
   1.482 +            implements (<code>component instanceof Runnable</code>) that forms an
   1.483 +            API as well.
   1.484 +            </hint>
   1.485 +        </question>
   1.486 +-->
   1.487 + <answer id="exec-component">
   1.488 +  <p>
   1.489 +   XXX no answer for exec-component
   1.490 +  </p>
   1.491 + </answer>
   1.492 +
   1.493 +
   1.494 +
   1.495 +<!--
   1.496 +        <question id="exec-introspection" when="impl">
   1.497 +            Does your module use any kind of runtime type information (<code>instanceof</code>,
   1.498 +            work with <code>java.lang.Class</code>, etc.)?
   1.499 +            <hint>
   1.500 +            Check for cases when you have an object of type A and you also
   1.501 +            expect it to (possibly) be of type B and do some special action. That
   1.502 +            should be documented. The same applies on operations in meta-level
   1.503 +            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
   1.504 +            </hint>
   1.505 +        </question>
   1.506 +-->
   1.507 + <answer id="exec-introspection">
   1.508 +  <p>
   1.509 +   XXX no answer for exec-introspection
   1.510 +  </p>
   1.511 + </answer>
   1.512 +
   1.513 +
   1.514 +
   1.515 +<!--
   1.516 +        <question id="exec-privateaccess" when="final">
   1.517 +            Are you aware of any other parts of the system calling some of 
   1.518 +            your methods by reflection?
   1.519 +            <hint>
   1.520 +            If so, describe the "contract" as an API. Likely private or friend one, but
   1.521 +            still API and consider rewrite of it.
   1.522 +            </hint>
   1.523 +        </question>
   1.524 +-->
   1.525 + <answer id="exec-privateaccess">
   1.526 +  <p>
   1.527 +   XXX no answer for exec-privateaccess
   1.528 +  </p>
   1.529 + </answer>
   1.530 +
   1.531 +
   1.532 +
   1.533 +<!--
   1.534 +        <question id="exec-process" when="impl">
   1.535 +            Do you execute an external process from your module? How do you ensure
   1.536 +            that the result is the same on different platforms? Do you parse output?
   1.537 +            Do you depend on result code?
   1.538 +            <hint>
   1.539 +            If you feed an input, parse the output please declare that as an API.
   1.540 +            </hint>
   1.541 +        </question>
   1.542 +-->
   1.543 + <answer id="exec-process">
   1.544 +  <p>
   1.545 +   XXX no answer for exec-process
   1.546 +  </p>
   1.547 + </answer>
   1.548 +
   1.549 +
   1.550 +
   1.551 +<!--
   1.552 +        <question id="exec-property" when="impl">
   1.553 +            Is execution of your code influenced by any environment or
   1.554 +            Java system (<code>System.getProperty</code>) property?
   1.555 +            On a similar note, is there something interesting that you
   1.556 +            pass to <code>java.util.logging.Logger</code>? Or do you observe
   1.557 +            what others log?
   1.558 +            <hint>
   1.559 +            If there is a property that can change the behavior of your 
   1.560 +            code, somebody will likely use it. You should describe what it does 
   1.561 +            and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
   1.562 +            of this API. You may use
   1.563 +            <pre>
   1.564 +                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
   1.565 +                    description of the property, where it is used, what it influence, etc.
   1.566 +                &lt;/api&gt;            
   1.567 +            </pre>
   1.568 +            </hint>
   1.569 +        </question>
   1.570 +-->
   1.571 + <answer id="exec-property">
   1.572 +  <p>
   1.573 +   XXX no answer for exec-property
   1.574 +  </p>
   1.575 + </answer>
   1.576 +
   1.577 +
   1.578 +
   1.579 +<!--
   1.580 +        <question id="exec-reflection" when="impl">
   1.581 +            Does your code use Java Reflection to execute other code?
   1.582 +            <hint>
   1.583 +            This usually indicates a missing or insufficient API in the other
   1.584 +            part of the system. If the other side is not aware of your dependency
   1.585 +            this contract can be easily broken.
   1.586 +            </hint>
   1.587 +        </question>
   1.588 +-->
   1.589 + <answer id="exec-reflection">
   1.590 +  <p>
   1.591 +   XXX no answer for exec-reflection
   1.592 +  </p>
   1.593 + </answer>
   1.594 +
   1.595 +
   1.596 +
   1.597 +<!--
   1.598 +        <question id="exec-threading" when="init">
   1.599 +            What threading models, if any, does your module adhere to? How the
   1.600 +            project behaves with respect to threading?
   1.601 +            <hint>
   1.602 +                Is your API threadsafe? Can it be accessed from any threads or
   1.603 +                just from some dedicated ones? Any special relation to AWT and
   1.604 +                its Event Dispatch thread? Also
   1.605 +                if your module calls foreign APIs which have a specific threading model,
   1.606 +                indicate how you comply with the requirements for multithreaded access
   1.607 +                (synchronization, mutexes, etc.) applicable to those APIs.
   1.608 +                If your module defines any APIs, or has complex internal structures
   1.609 +                that might be used from multiple threads, declare how you protect
   1.610 +                data against concurrent access, race conditions, deadlocks, etc.,
   1.611 +                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
   1.612 +                Examples: a class might be non-thread-safe (like Java Collections); might
   1.613 +                be fully thread-safe (internal locking); might require access through a mutex
   1.614 +                (and may or may not automatically acquire that mutex on behalf of a client method);
   1.615 +                might be able to run only in the event queue; etc.
   1.616 +                Also describe when any events are fired: synchronously, asynchronously, etc.
   1.617 +                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
   1.618 +            </hint>
   1.619 +        </question>
   1.620 +-->
   1.621 + <answer id="exec-threading">
   1.622 +  <p>
   1.623 +   XXX no answer for exec-threading
   1.624 +  </p>
   1.625 + </answer>
   1.626 +
   1.627 +
   1.628 +
   1.629 +<!--
   1.630 +        <question id="format-clipboard" when="impl">
   1.631 +            Which data flavors (if any) does your code read from or insert to
   1.632 +            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
   1.633 +            
   1.634 +            <hint>
   1.635 +            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
   1.636 +            Check your code for overriding these methods.
   1.637 +            </hint>
   1.638 +        </question>
   1.639 +-->
   1.640 + <answer id="format-clipboard">
   1.641 +  <p>
   1.642 +   XXX no answer for format-clipboard
   1.643 +  </p>
   1.644 + </answer>
   1.645 +
   1.646 +
   1.647 +
   1.648 +<!--
   1.649 +        <question id="format-dnd" when="impl">
   1.650 +            Which protocols (if any) does your code understand during Drag &amp; Drop?
   1.651 +            <hint>
   1.652 +            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>. 
   1.653 +            Check your code for overriding these methods. Btw. if they are not overridden, they
   1.654 +            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
   1.655 +            </hint>
   1.656 +        </question>
   1.657 +-->
   1.658 + <answer id="format-dnd">
   1.659 +  <p>
   1.660 +   XXX no answer for format-dnd
   1.661 +  </p>
   1.662 + </answer>
   1.663 +
   1.664 +
   1.665 +
   1.666 +<!--
   1.667 +        <question id="format-types" when="impl">
   1.668 +            Which protocols and file formats (if any) does your module read or write on disk,
   1.669 +            or transmit or receive over the network? Do you generate an ant build script?
   1.670 +            Can it be edited and modified? 
   1.671 +            
   1.672 +            <hint>
   1.673 +            <p>
   1.674 +            Files can be read and written by other programs, modules and users. If they influence
   1.675 +            your behaviour, make sure you either document the format or claim that it is a private
   1.676 +            api (using the &lt;api&gt; tag). 
   1.677 +            </p>
   1.678 +            
   1.679 +            <p>
   1.680 +            If you generate an ant build file, this is very likely going to be seen by end users and
   1.681 +            they will be attempted to edit it. You should be ready for that and provide here a link
   1.682 +            to documentation that you have for such purposes and also describe how you are going to
   1.683 +            understand such files during next release, when you (very likely) slightly change the 
   1.684 +            format.
   1.685 +            </p>
   1.686 +            </hint>
   1.687 +        </question>
   1.688 +-->
   1.689 + <answer id="format-types">
   1.690 +  <p>
   1.691 +   XXX no answer for format-types
   1.692 +  </p>
   1.693 + </answer>
   1.694 +
   1.695 +
   1.696 +
   1.697 +<!--
   1.698 +        <question id="lookup-lookup" when="init">
   1.699 +            Does your module use <code>org.openide.util.Lookup</code>
   1.700 +            or any similar technology to find any components to communicate with? Which ones?
   1.701 +            
   1.702 +            <hint>
   1.703 +            NetBeans is build around a generic registry of services called
   1.704 +            lookup. It is preferable to use it for registration and discovery
   1.705 +            if possible. See
   1.706 +            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
   1.707 +            The Solution to Comunication Between Components
   1.708 +            </a>. If you do not plan to use lookup and insist usage
   1.709 +            of other solution, then please describe why it is not working for
   1.710 +            you.
   1.711 +            <br/>
   1.712 +            When filling the final version of your arch document, please
   1.713 +            describe the interfaces you are searching for, where 
   1.714 +            are defined, whether you are searching for just one or more of them,
   1.715 +            if the order is important, etc. Also classify the stability of such
   1.716 +            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
   1.717 +            your information gets listed in the summary page of your javadoc.
   1.718 +            </hint>
   1.719 +        </question>
   1.720 +-->
   1.721 + <answer id="lookup-lookup">
   1.722 +  <p>
   1.723 +   XXX no answer for lookup-lookup
   1.724 +  </p>
   1.725 + </answer>
   1.726 +
   1.727 +
   1.728 +
   1.729 +<!--
   1.730 +        <question id="lookup-register" when="final">
   1.731 +            Do you register anything into lookup for other code to find?
   1.732 +            <hint>
   1.733 +            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
   1.734 +            Who is supposed to find your component?
   1.735 +            </hint>
   1.736 +        </question>
   1.737 +-->
   1.738 + <answer id="lookup-register">
   1.739 +  <p>
   1.740 +   XXX no answer for lookup-register
   1.741 +  </p>
   1.742 + </answer>
   1.743 +
   1.744 +
   1.745 +
   1.746 +<!--
   1.747 +        <question id="lookup-remove" when="final">
   1.748 +            Do you remove entries of other modules from lookup?
   1.749 +            <hint>
   1.750 +            Why? Of course, that is possible, but it can be dangerous. Is the module
   1.751 +            your are masking resource from aware of what you are doing?
   1.752 +            </hint>
   1.753 +        </question>
   1.754 +-->
   1.755 + <answer id="lookup-remove">
   1.756 +  <p>
   1.757 +   XXX no answer for lookup-remove
   1.758 +  </p>
   1.759 + </answer>
   1.760 +
   1.761 +
   1.762 +
   1.763 +<!--
   1.764 +        <question id="perf-exit" when="final">
   1.765 +            Does your module run any code on exit?
   1.766 +        </question>
   1.767 +-->
   1.768 + <answer id="perf-exit">
   1.769 +  <p>
   1.770 +   XXX no answer for perf-exit
   1.771 +  </p>
   1.772 + </answer>
   1.773 +
   1.774 +
   1.775 +
   1.776 +<!--
   1.777 +        <question id="perf-huge_dialogs" when="final">
   1.778 +            Does your module contain any dialogs or wizards with a large number of
   1.779 +            GUI controls such as combo boxes, lists, trees, or text areas?
   1.780 +        </question>
   1.781 +-->
   1.782 + <answer id="perf-huge_dialogs">
   1.783 +  <p>
   1.784 +   XXX no answer for perf-huge_dialogs
   1.785 +  </p>
   1.786 + </answer>
   1.787 +
   1.788 +
   1.789 +
   1.790 +<!--
   1.791 +        <question id="perf-limit" when="init">
   1.792 +            Are there any hard-coded or practical limits in the number or size of
   1.793 +            elements your code can handle?
   1.794 +            <hint>
   1.795 +                Most of algorithms have increasing memory and speed complexity
   1.796 +                with respect to size of data they operate on. What is the critical
   1.797 +                part of your project that can be seen as a bottleneck with
   1.798 +                respect to speed or required memory? What are the practical
   1.799 +                sizes of data you tested your project with? What is your estimate
   1.800 +                of potential size of data that would cause visible performance
   1.801 +                problems? Is there some kind of check to detect such situation
   1.802 +                and prevent "hard" crashes - for example the CloneableEditorSupport
   1.803 +                checks for size of a file to be opened in editor
   1.804 +                and if it is larger than 1Mb it shows a dialog giving the
   1.805 +                user the right to decide - e.g. to cancel or commit suicide.
   1.806 +            </hint>
   1.807 +        </question>
   1.808 +-->
   1.809 + <answer id="perf-limit">
   1.810 +  <p>
   1.811 +   XXX no answer for perf-limit
   1.812 +  </p>
   1.813 + </answer>
   1.814 +
   1.815 +
   1.816 +
   1.817 +<!--
   1.818 +        <question id="perf-mem" when="final">
   1.819 +            How much memory does your component consume? Estimate
   1.820 +            with a relation to the number of windows, etc.
   1.821 +        </question>
   1.822 +-->
   1.823 + <answer id="perf-mem">
   1.824 +  <p>
   1.825 +   XXX no answer for perf-mem
   1.826 +  </p>
   1.827 + </answer>
   1.828 +
   1.829 +
   1.830 +
   1.831 +<!--
   1.832 +        <question id="perf-menus" when="final">
   1.833 +            Does your module use dynamically updated context menus, or
   1.834 +            context-sensitive actions with complicated and slow enablement logic?
   1.835 +            <hint>
   1.836 +                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
   1.837 +                slow down display of the menu, even when the user is not using your action. Pay attention to
   1.838 +                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
   1.839 +                the action is conditionally enabled, or changes its display dynamically, you need to check the
   1.840 +                impact on performance. In some cases it may be more appropriate to make a simple action that is
   1.841 +                always enabled but does more detailed checks in a dialog if it is actually run.
   1.842 +            </hint>
   1.843 +        </question>
   1.844 +-->
   1.845 + <answer id="perf-menus">
   1.846 +  <p>
   1.847 +   XXX no answer for perf-menus
   1.848 +  </p>
   1.849 + </answer>
   1.850 +
   1.851 +
   1.852 +
   1.853 +<!--
   1.854 +        <question id="perf-progress" when="final">
   1.855 +            Does your module execute any long-running tasks?
   1.856 +            
   1.857 +            <hint>Long running tasks should never block 
   1.858 +            AWT thread as it badly hurts the UI
   1.859 +            <a href="http://performance.netbeans.org/responsiveness/issues.html">
   1.860 +            responsiveness</a>.
   1.861 +            Tasks like connecting over
   1.862 +            network, computing huge amount of data, compilation
   1.863 +            be done asynchronously (for example
   1.864 +            using <code>RequestProcessor</code>), definitively it should 
   1.865 +            not block AWT thread.
   1.866 +            </hint>
   1.867 +        </question>
   1.868 +-->
   1.869 + <answer id="perf-progress">
   1.870 +  <p>
   1.871 +   XXX no answer for perf-progress
   1.872 +  </p>
   1.873 + </answer>
   1.874 +
   1.875 +
   1.876 +
   1.877 +<!--
   1.878 +        <question id="perf-scale" when="init">
   1.879 +            Which external criteria influence the performance of your
   1.880 +            program (size of file in editor, number of files in menu, 
   1.881 +            in source directory, etc.) and how well your code scales?
   1.882 +            <hint>
   1.883 +            Please include some estimates, there are other more detailed 
   1.884 +            questions to answer in later phases of implementation. 
   1.885 +            </hint>
   1.886 +        </question>
   1.887 +-->
   1.888 + <answer id="perf-scale">
   1.889 +  <p>
   1.890 +   XXX no answer for perf-scale
   1.891 +  </p>
   1.892 + </answer>
   1.893 +
   1.894 +
   1.895 +
   1.896 +<!--
   1.897 +        <question id="perf-spi" when="init">
   1.898 +            How the performance of the plugged in code will be enforced?
   1.899 +            <hint>
   1.900 +            If you allow foreign code to be plugged into your own module, how
   1.901 +            do you enforce that it will behave correctly and quickly and will not
   1.902 +            negatively influence the performance of your own module?
   1.903 +            </hint>
   1.904 +        </question>
   1.905 +-->
   1.906 + <answer id="perf-spi">
   1.907 +  <p>
   1.908 +   XXX no answer for perf-spi
   1.909 +  </p>
   1.910 + </answer>
   1.911 +
   1.912 +
   1.913 +
   1.914 +<!--
   1.915 +        <question id="perf-startup" when="final">
   1.916 +            Does your module run any code on startup?
   1.917 +        </question>
   1.918 +-->
   1.919 + <answer id="perf-startup">
   1.920 +  <p>
   1.921 +   XXX no answer for perf-startup
   1.922 +  </p>
   1.923 + </answer>
   1.924 +
   1.925 +
   1.926 +
   1.927 +<!--
   1.928 +        <question id="perf-wakeup" when="final">
   1.929 +            Does any piece of your code wake up periodically and do something
   1.930 +            even when the system is otherwise idle (no user interaction)?
   1.931 +        </question>
   1.932 +-->
   1.933 + <answer id="perf-wakeup">
   1.934 +  <p>
   1.935 +   XXX no answer for perf-wakeup
   1.936 +  </p>
   1.937 + </answer>
   1.938 +
   1.939 +
   1.940 +
   1.941 +<!--
   1.942 +        <question id="resources-file" when="final">
   1.943 +            Does your module use <code>java.io.File</code> directly?
   1.944 +            
   1.945 +            <hint>
   1.946 +            NetBeans provide a logical wrapper over plain files called 
   1.947 +            <code>org.openide.filesystems.FileObject</code> that
   1.948 +            provides uniform access to such resources and is the preferred
   1.949 +            way that should be used. But of course there can be situations when
   1.950 +            this is not suitable.
   1.951 +            </hint>
   1.952 +        </question>
   1.953 +-->
   1.954 + <answer id="resources-file">
   1.955 +  <p>
   1.956 +   XXX no answer for resources-file
   1.957 +  </p>
   1.958 + </answer>
   1.959 +
   1.960 +
   1.961 +
   1.962 +<!--
   1.963 +        <question id="resources-layer" when="final">
   1.964 +            Does your module provide own layer? Does it create any files or
   1.965 +            folders in it? What it is trying to communicate by that and with which 
   1.966 +            components?
   1.967 +            
   1.968 +            <hint>
   1.969 +            NetBeans allows automatic and declarative installation of resources 
   1.970 +            by module layers. Module register files into appropriate places
   1.971 +            and other components use that information to perform their task
   1.972 +            (build menu, toolbar, window layout, list of templates, set of
   1.973 +            options, etc.). 
   1.974 +            </hint>
   1.975 +        </question>
   1.976 +-->
   1.977 + <answer id="resources-layer">
   1.978 +  <p>
   1.979 +   XXX no answer for resources-layer
   1.980 +  </p>
   1.981 + </answer>
   1.982 +
   1.983 +
   1.984 +
   1.985 +<!--
   1.986 +        <question id="resources-mask" when="final">
   1.987 +            Does your module mask/hide/override any resources provided by other modules in
   1.988 +            their layers?
   1.989 +            
   1.990 +            <hint>
   1.991 +            If you mask a file provided by another module, you probably depend
   1.992 +            on that and do not want the other module to (for example) change
   1.993 +            the file's name. That module shall thus make that file available as an API
   1.994 +            of some stability category.
   1.995 +            </hint>
   1.996 +        </question>
   1.997 +-->
   1.998 + <answer id="resources-mask">
   1.999 +  <p>
  1.1000 +   XXX no answer for resources-mask
  1.1001 +  </p>
  1.1002 + </answer>
  1.1003 +
  1.1004 +
  1.1005 +
  1.1006 +<!--
  1.1007 +        <question id="resources-preferences" when="final">
  1.1008 +            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
  1.1009 +            or regular JDK Preferences ? Does it read, write or both ? 
  1.1010 +            Does it share preferences with other modules ? If so, then why ?
  1.1011 +            <hint>
  1.1012 +                You may use
  1.1013 +                    &lt;api type="export" group="preferences"
  1.1014 +                    name="preference node name" category="private"&gt;
  1.1015 +                    description of individual keys, where it is used, what it
  1.1016 +                    influences, whether the module reads/write it, etc.
  1.1017 +                    &lt;/api&gt;
  1.1018 +                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
  1.1019 +                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
  1.1020 +            </hint>
  1.1021 +        </question>
  1.1022 +-->
  1.1023 + <answer id="resources-preferences">
  1.1024 +  <p>
  1.1025 +   XXX no answer for resources-preferences
  1.1026 +  </p>
  1.1027 + </answer>
  1.1028 +
  1.1029 +
  1.1030 +
  1.1031 +<!--
  1.1032 +        <question id="resources-read" when="final">
  1.1033 +            Does your module read any resources from layers? For what purpose?
  1.1034 +            
  1.1035 +            <hint>
  1.1036 +            As this is some kind of intermodule dependency, it is a kind of API.
  1.1037 +            Please describe it and classify according to 
  1.1038 +            <a href="http://wiki.netbeans.org/API_Design#What_is_an_API.3F">
  1.1039 +            common stability categories</a>.
  1.1040 +            </hint>
  1.1041 +        </question>
  1.1042 +-->
  1.1043 + <answer id="resources-read">
  1.1044 +  <p>
  1.1045 +   XXX no answer for resources-read
  1.1046 +  </p>
  1.1047 + </answer>
  1.1048 +
  1.1049 +
  1.1050 +
  1.1051 +<!--
  1.1052 +        <question id="security-grant" when="final">
  1.1053 +            Does your code grant additional rights to some other code?
  1.1054 +            <hint>Avoid using a class loader that adds extra
  1.1055 +            permissions to loaded code unless really necessary.
  1.1056 +            Also note that your API implementation
  1.1057 +            can also expose unneeded permissions to enemy code by
  1.1058 +            calling AccessController.doPrivileged().</hint>
  1.1059 +        </question>
  1.1060 +-->
  1.1061 + <answer id="security-grant">
  1.1062 +  <p>
  1.1063 +   XXX no answer for security-grant
  1.1064 +  </p>
  1.1065 + </answer>
  1.1066 +
  1.1067 +
  1.1068 +
  1.1069 +<!--
  1.1070 +        <question id="security-policy" when="final">
  1.1071 +            Does your functionality require modifications to the standard policy file?
  1.1072 +            <hint>Your code might pass control to third-party code not
  1.1073 +            coming from trusted domains. This could be code downloaded over the
  1.1074 +            network or code coming from libraries that are not bundled
  1.1075 +            with NetBeans. Which permissions need to be granted to which domains?</hint>
  1.1076 +        </question>
  1.1077 +-->
  1.1078 + <answer id="security-policy">
  1.1079 +  <p>
  1.1080 +   XXX no answer for security-policy
  1.1081 +  </p>
  1.1082 + </answer>
  1.1083 +
  1.1084 +</api-answers>
     2.1 --- a/licensechanger/build.xml	Fri Feb 08 11:02:28 2013 +0100
     2.2 +++ b/licensechanger/build.xml	Sun Feb 10 16:18:19 2013 +0100
     2.3 @@ -2,5 +2,4 @@
     2.4  <project basedir="." default="netbeans" name="contrib/licensechanger">
     2.5  
     2.6      <import file="../../nbbuild/templates/projectized.xml"/>
     2.7 -
     2.8  </project>
     3.1 --- a/licensechanger/nbproject/project.properties	Fri Feb 08 11:02:28 2013 +0100
     3.2 +++ b/licensechanger/nbproject/project.properties	Sun Feb 10 16:18:19 2013 +0100
     3.3 @@ -1,3 +1,4 @@
     3.4  javac.source=1.6
     3.5  javac.compilerargs=-Xlint -Xlint:-serial
     3.6 +javadoc.arch=${basedir}/arch.xml
     3.7  nbm.module.author=Tim Boudreau
     4.1 --- a/licensechanger/nbproject/project.xml	Fri Feb 08 11:02:28 2013 +0100
     4.2 +++ b/licensechanger/nbproject/project.xml	Sun Feb 10 16:18:19 2013 +0100
     4.3 @@ -6,15 +6,6 @@
     4.4              <code-name-base>org.netbeans.modules.licensechanger</code-name-base>
     4.5              <module-dependencies>
     4.6                  <dependency>
     4.7 -                    <code-name-base>org.jdesktop.layout</code-name-base>
     4.8 -                    <build-prerequisite/>
     4.9 -                    <compile-dependency/>
    4.10 -                    <run-dependency>
    4.11 -                        <release-version>1</release-version>
    4.12 -                        <specification-version>1.7</specification-version>
    4.13 -                    </run-dependency>
    4.14 -                </dependency>
    4.15 -                <dependency>
    4.16                      <code-name-base>org.netbeans.api.progress</code-name-base>
    4.17                      <build-prerequisite/>
    4.18                      <compile-dependency/>
    4.19 @@ -33,6 +24,15 @@
    4.20                      </run-dependency>
    4.21                  </dependency>
    4.22                  <dependency>
    4.23 +                    <code-name-base>org.netbeans.modules.maven.model</code-name-base>
    4.24 +                    <build-prerequisite/>
    4.25 +                    <compile-dependency/>
    4.26 +                    <run-dependency>
    4.27 +                        <release-version>1</release-version>
    4.28 +                        <specification-version>1.26</specification-version>
    4.29 +                    </run-dependency>
    4.30 +                </dependency>
    4.31 +                <dependency>
    4.32                      <code-name-base>org.netbeans.modules.projectapi</code-name-base>
    4.33                      <build-prerequisite/>
    4.34                      <compile-dependency/>
    4.35 @@ -51,6 +51,23 @@
    4.36                      </run-dependency>
    4.37                  </dependency>
    4.38                  <dependency>
    4.39 +                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
    4.40 +                    <build-prerequisite/>
    4.41 +                    <compile-dependency/>
    4.42 +                    <run-dependency>
    4.43 +                        <release-version>1</release-version>
    4.44 +                        <specification-version>1.22</specification-version>
    4.45 +                    </run-dependency>
    4.46 +                </dependency>
    4.47 +                <dependency>
    4.48 +                    <code-name-base>org.netbeans.swing.outline</code-name-base>
    4.49 +                    <build-prerequisite/>
    4.50 +                    <compile-dependency/>
    4.51 +                    <run-dependency>
    4.52 +                        <specification-version>1.23</specification-version>
    4.53 +                    </run-dependency>
    4.54 +                </dependency>
    4.55 +                <dependency>
    4.56                      <code-name-base>org.openide.awt</code-name-base>
    4.57                      <build-prerequisite/>
    4.58                      <compile-dependency/>
    4.59 @@ -119,9 +136,21 @@
    4.60                  <test-type>
    4.61                      <name>unit</name>
    4.62                      <test-dependency>
    4.63 +                        <code-name-base>org.netbeans.insane</code-name-base>
    4.64 +                        <compile-dependency/>
    4.65 +                    </test-dependency>
    4.66 +                    <test-dependency>
    4.67                          <code-name-base>org.netbeans.libs.junit4</code-name-base>
    4.68                          <compile-dependency/>
    4.69                      </test-dependency>
    4.70 +                    <test-dependency>
    4.71 +                        <code-name-base>org.netbeans.modules.masterfs</code-name-base>
    4.72 +                        <compile-dependency/>
    4.73 +                    </test-dependency>
    4.74 +                    <test-dependency>
    4.75 +                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
    4.76 +                        <compile-dependency/>
    4.77 +                    </test-dependency>
    4.78                  </test-type>
    4.79              </test-dependencies>
    4.80              <public-packages>
     5.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/Bundle.properties	Fri Feb 08 11:02:28 2013 +0100
     5.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/Bundle.properties	Sun Feb 10 16:18:19 2013 +0100
     5.3 @@ -2,4 +2,4 @@
     5.4  OpenIDE-Module-Long-Description=\
     5.5      Provides an action on folders to change the license headers on all files underneath
     5.6  OpenIDE-Module-Name=License Changer
     5.7 -OpenIDE-Module-Short-Description=Provides an action on folders to change the license headers on all files underneath
     5.8 \ No newline at end of file
     5.9 +OpenIDE-Module-Short-Description=Provides an action on folders to change the license headers on all files underneath
     6.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/Customizable.java	Fri Feb 08 11:02:28 2013 +0100
     6.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/Customizable.java	Sun Feb 10 16:18:19 2013 +0100
     6.3 @@ -36,7 +36,6 @@
     6.4   *
     6.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
     6.6   */
     6.7 -
     6.8  package org.netbeans.modules.licensechanger.api;
     6.9  
    6.10  import java.awt.Component;
    6.11 @@ -47,5 +46,6 @@
    6.12   * @author Tim Boudreau
    6.13   */
    6.14  public interface Customizable {
    6.15 +
    6.16      public Component getCustomizer();
    6.17  }
     7.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/FileHandler.java	Fri Feb 08 11:02:28 2013 +0100
     7.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/FileHandler.java	Sun Feb 10 16:18:19 2013 +0100
     7.3 @@ -39,6 +39,7 @@
     7.4  package org.netbeans.modules.licensechanger.api;
     7.5  
     7.6  import java.io.IOException;
     7.7 +import java.io.InputStream;
     7.8  import java.io.StringWriter;
     7.9  import java.util.ArrayList;
    7.10  import java.util.Date;
    7.11 @@ -51,8 +52,8 @@
    7.12  import javax.script.ScriptEngine;
    7.13  import javax.script.ScriptEngineManager;
    7.14  import javax.script.ScriptException;
    7.15 -import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
    7.16 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
    7.17 +import org.netbeans.modules.licensechanger.freemarker.Project;
    7.18 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
    7.19  import org.openide.filesystems.FileObject;
    7.20  import org.openide.filesystems.FileUtil;
    7.21  import org.openide.util.Exceptions;
    7.22 @@ -60,7 +61,8 @@
    7.23  /**
    7.24   *
    7.25   * @author Tim Boudreau
    7.26 - * @author Nils Hoffmann (Refactoring, Freemarker Variables, resolveLicenseTemplate)
    7.27 + * @author Nils Hoffmann (Refactoring, Freemarker Variables,
    7.28 + * resolveLicenseTemplate)
    7.29   */
    7.30  public abstract class FileHandler {
    7.31  
    7.32 @@ -81,56 +83,80 @@
    7.33      protected abstract String licenseLast();
    7.34  
    7.35      /**
    7.36 -     * Uses the freemarker template engine to resolve the licenseText. If no
    7.37 -     * freemarker script engine is found, a {@link RuntimeException} is thrown.
    7.38 -     * This method will access user information under {@code Templates/Properties/User.properties}
    7.39 -     * in order to resolve various tokens, e.g. 'user'. If that file does not
    7.40 -     * exist, a {@link RuntimeException} will be thrown, wrapping the original {@link IOException}.
    7.41 -     * Should the freemarker engine encounter a {@link ScriptException}, this
    7.42 -     * will also be wrapped in a {@link RuntimeException}.
    7.43 +     * <p>Uses the freemarker template engine to resolve the licenseText.</p>
    7.44       *
    7.45 -     * @param licenseText
    7.46 +     * <p>If no freemarker script engine is found, a {@link RuntimeException} is
    7.47 +     * thrown.</p>
    7.48 +     *
    7.49 +     * <p>This method will access user information under
    7.50 +     * {@code Templates/Properties/User.properties} in order to resolve various
    7.51 +     * tokens, e.g. 'user'. If that file does not exist, a
    7.52 +     * {@link RuntimeException} will be thrown, wrapping the original
    7.53 +     * {@link IOException}. Should the freemarker engine encounter a
    7.54 +     * {@link ScriptException}, this will also be wrapped in a
    7.55 +     * {@link RuntimeException}.</p>
    7.56 +     *
    7.57 +     * <p>The additionalBindings parameter may be used to supplement or override
    7.58 +     * the information retrieved from
    7.59 +     * <code>User.properties</code>.</p>
    7.60 +     *
    7.61 +     * <p>The implementation will look for tokens
    7.62 +     * <code>${licenseFirst}</code>,
    7.63 +     * <code>${licensePrefix}</code>, and
    7.64 +     * <code>${licenseLast}</code> to determine whether the licenseText has
    7.65 +     * already been interpolated or if it needs escaping.
    7.66 +     *
    7.67 +     * @param licenseText the license text with freemarker template tokens
    7.68 +     * @param additionalBindings additional binding values for freemarker
    7.69 +     * interpolation
    7.70       * @return the resolved licenseText
    7.71       * @throws RuntimeException
    7.72       */
    7.73      public String resolveLicenseTemplate(String licenseText, Map<String, Object> additionalBindings) throws RuntimeException {
    7.74 -        if (licenseText.contains("${licenseFirst}") && licenseText.contains("${licensePrefix}") && licenseText.contains("${licenseLast}")) {
    7.75 -            System.out.println("License is a freemarker template!");
    7.76 +        if (licenseText.contains("${") || (licenseText.contains("${licenseFirst}") && licenseText.contains("${licensePrefix}") && licenseText.contains("${licenseLast}"))) {
    7.77 +//            System.out.println("License is a freemarker template!");
    7.78              //freemarker template
    7.79              ScriptEngineManager sem = new ScriptEngineManager();
    7.80              ScriptEngine se = sem.getEngineByName("freemarker");
    7.81              if (se != null) {
    7.82                  Bindings bindings = se.createBindings();
    7.83 -                FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Properties/User.properties");
    7.84 +                FileObject userProperties = FileUtil.getConfigFile("Templates/Properties/User.properties");
    7.85                  Properties props = new Properties();
    7.86 +                InputStream in = null;
    7.87                  try {
    7.88 -                    props.load(licenseTemplates.getInputStream());
    7.89 +                    in = userProperties.getInputStream();
    7.90 +                    props.load(in);
    7.91                  } catch (IOException ex) {
    7.92                      Exceptions.printStackTrace(ex);
    7.93                      throw new RuntimeException(ex);
    7.94 +                } finally {
    7.95 +                    try {
    7.96 +                        if (in != null) {
    7.97 +                            in.close();
    7.98 +                        }
    7.99 +                    } catch (IOException ex) {
   7.100 +                        Exceptions.printStackTrace(ex);
   7.101 +                        throw new RuntimeException(ex);
   7.102 +                    }
   7.103                  }
   7.104                  for (String key : props.stringPropertyNames()) {
   7.105                      bindings.put(key, props.getProperty(key));
   7.106                  }
   7.107 -                String copyrightHolder = props.getProperty(WizardProperties.KEY_COPYRIGHT_HOLDER);
   7.108 -                if (copyrightHolder != null && !copyrightHolder.trim().isEmpty()) {
   7.109 -                    bindings.put("user", copyrightHolder);
   7.110 -                }
   7.111                  bindings.put("licenseFirst", licenseFirst());
   7.112                  bindings.put("licensePrefix", licensePrefix());
   7.113                  bindings.put("licenseLast", licenseLast());
   7.114                  bindings.put("date", new Date());
   7.115 -                for (Map.Entry<String,Object> e : additionalBindings.entrySet()) {
   7.116 -                    bindings.put (e.getKey(), e.getValue());
   7.117 +                for (Map.Entry<String, Object> e : additionalBindings.entrySet()) {
   7.118 +                    bindings.put(e.getKey(), e.getValue());
   7.119                  }
   7.120 +                String user = additionalBindings.containsKey(WizardProperties.KEY_COPYRIGHT_HOLDER) ? (String) additionalBindings.get(WizardProperties.KEY_COPYRIGHT_HOLDER) : props.getProperty("user", System.getProperty("user.name"));
   7.121 +//                System.out.println("Using user: " + user);
   7.122                  if (props.containsKey("project.organization")) {
   7.123                      Project project = new Project(props.getProperty("project.organization"));
   7.124 -                    System.out.println("Using project.organization: " + props.getProperty("project.organization"));
   7.125 +//                    System.out.println("Using project.organization: " + props.getProperty("project.organization"));
   7.126                      bindings.put("project", project);
   7.127 -                    bindings.put("user", null);
   7.128 +                    bindings.put("user", user);
   7.129                  } else {
   7.130 -                    Object user = additionalBindings.containsKey(WizardProperties.KEY_COPYRIGHT_HOLDER) ? additionalBindings.get(WizardProperties.KEY_COPYRIGHT_HOLDER) : props.getProperty("user", System.getProperty("user.name"));
   7.131 -                    System.out.println("Using user: " + user);
   7.132                      bindings.put("project", new Project(null));
   7.133                      if (!bindings.containsKey("user")) {
   7.134                          bindings.put("user", user);
   7.135 @@ -149,11 +175,11 @@
   7.136                  throw new RuntimeException("Could not find script engine 'freemarker'!");
   7.137              }
   7.138          } else if (licenseText.contains(licenseFirst()) && licenseText.contains(licensePrefix()) && licenseText.contains(licenseLast())) {
   7.139 -            System.out.println("License is already escaped!");
   7.140 +//            System.out.println("License is already escaped!");
   7.141              //probably already escaped
   7.142              return licenseText;
   7.143          } else {
   7.144 -            System.out.println("License is plain!");
   7.145 +//            System.out.println("License is plain!");
   7.146              //unescaped
   7.147              return escape(licenseText);
   7.148          }
   7.149 @@ -169,18 +195,6 @@
   7.150          return after.toString();
   7.151      }
   7.152  
   7.153 -    /**
   7.154 -     * Freemarker expects project.organization to be the field 'organization' in
   7.155 -     * an object. This provided a thin wrapper for that.
   7.156 -     */
   7.157 -    private class Project {
   7.158 -
   7.159 -        public String organization;
   7.160 -
   7.161 -        public Project(String organization) {
   7.162 -            this.organization = organization;
   7.163 -        }
   7.164 -    }
   7.165      static Pattern p = Pattern.compile("(.*?)\\n|\\z", Pattern.UNIX_LINES);
   7.166  
   7.167      public static String[] splitIntoLines(CharSequence content) {
     8.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/LicenseHeader.java	Fri Feb 08 11:02:28 2013 +0100
     8.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/LicenseHeader.java	Sun Feb 10 16:18:19 2013 +0100
     8.3 @@ -36,7 +36,6 @@
     8.4   *
     8.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
     8.6   */
     8.7 -
     8.8  package org.netbeans.modules.licensechanger.api;
     8.9  
    8.10  import java.io.*;
    8.11 @@ -46,22 +45,59 @@
    8.12  import java.util.List;
    8.13  import org.openide.filesystems.FileObject;
    8.14  import org.openide.filesystems.FileUtil;
    8.15 +import org.openide.loaders.DataObject;
    8.16 +import org.openide.loaders.DataObjectNotFoundException;
    8.17  import org.openide.util.Exceptions;
    8.18  
    8.19  /**
    8.20 - * License header resource/file abstraction class with static 
    8.21 - * methods to load a license header from file or registered license template.
    8.22 + * License header resource/file abstraction class with static methods to load a
    8.23 + * license header from file or registered license template.
    8.24 + *
    8.25   * @author Nils Hoffmann
    8.26   */
    8.27  public final class LicenseHeader {
    8.28 - 
    8.29 -    public static LicenseHeader fromFileObject(FileObject file, String licenseName, boolean isNetBeansTemplate) {
    8.30 -        String name = licenseName==null?file.getName():licenseName;
    8.31 +
    8.32 +    /**
    8.33 +     * <p>Creates a
    8.34 +     * <code>LicenseHeader</code> from a given
    8.35 +     * <code>FileObject</code>.</p>
    8.36 +     *
    8.37 +     * <p>If the passed in
    8.38 +     * <code>licenseName</code> is <em>null</em>, the name is inferred from the
    8.39 +     * <code>FileObject</code>'s name. According to NetBeans conventions,
    8.40 +     * license file names start with a prefixed <em>license-</em> before the
    8.41 +     * actual license abbreviation, e.g. <em>epl10</em> for the Eclipse public
    8.42 +     * license version 1.0 will have a final name of
    8.43 +     * <em>license-epl10.txt</em>.</p>
    8.44 +     *
    8.45 +     * <p>If the passed in licenseName starts with <em>license-</em>, that
    8.46 +     * prefix is removed.</p>
    8.47 +     *
    8.48 +     * @param file the FileObject containing the license header text
    8.49 +     * @param licenseName the name of the license
    8.50 +     * @param netBeansTemplate whether the license is a netbeans template or not
    8.51 +     * @return a new LicenseHeader
    8.52 +     * @throws NullPointerException if file is null
    8.53 +     */
    8.54 +    public static LicenseHeader fromFileObject(FileObject file, String licenseName, boolean isNetBeansTemplate) throws NullPointerException {
    8.55 +        if(file == null) {
    8.56 +            throw new NullPointerException("Parameter 'file' must not be null!");
    8.57 +        }
    8.58 +        String name;
    8.59 +        if (licenseName == null) {
    8.60 +            name = file.getName();
    8.61 +        } else {
    8.62 +            name = licenseName;
    8.63 +        }
    8.64 +        if (name.startsWith("license-")) {
    8.65 +            name = name.substring("license-".length());
    8.66 +        }
    8.67          String content;
    8.68          InputStream in = null;
    8.69 +        ByteArrayOutputStream out = null;
    8.70          try {
    8.71              in = new BufferedInputStream(file.getInputStream());
    8.72 -            ByteArrayOutputStream out = new ByteArrayOutputStream();
    8.73 +            out = new ByteArrayOutputStream();
    8.74              FileUtil.copy(in, out);
    8.75              content = new String(out.toByteArray());
    8.76              LicenseHeader header = new LicenseHeader(name, content, file, isNetBeansTemplate);
    8.77 @@ -71,97 +107,241 @@
    8.78              return null;
    8.79          } finally {
    8.80              try {
    8.81 -                if(in!=null) {
    8.82 +                if (in != null) {
    8.83                      in.close();
    8.84                  }
    8.85              } catch (IOException ex) {
    8.86                  Exceptions.printStackTrace(ex);
    8.87              }
    8.88 +            try {
    8.89 +                if (out != null) {
    8.90 +                    out.close();
    8.91 +                }
    8.92 +            } catch (IOException ex) {
    8.93 +                Exceptions.printStackTrace(ex);
    8.94 +            }
    8.95          }
    8.96      }
    8.97 -    
    8.98 -    public static LicenseHeader fromFileObject(FileObject file, String licenseName) {
    8.99 +
   8.100 +    /**
   8.101 +     * <p>Creates a
   8.102 +     * <code>LicenseHeader</code> from a given
   8.103 +     * <code>FileObject</code> and
   8.104 +     * <code>licenseName</code>.</p>
   8.105 +     *
   8.106 +     * @param file the FileObject containing the license header text
   8.107 +     * @param licenseName the name of the license
   8.108 +     * @return a new LicenseHeader
   8.109 +     * @see #fromFileObject(org.openide.filesystems.FileObject,
   8.110 +     * java.lang.String, boolean)
   8.111 +     */
   8.112 +    public static LicenseHeader fromFileObject(FileObject file, String licenseName) throws NullPointerException {
   8.113          return fromFileObject(file, licenseName, false);
   8.114      }
   8.115 -    
   8.116 -    public static LicenseHeader fromFile(File file) {
   8.117 -        return fromFileObject(FileUtil.toFileObject(file),null);
   8.118 +
   8.119 +    /**
   8.120 +     * <p>Creates a
   8.121 +     * <code>LicenseHeader</code> from a given
   8.122 +     * <code>File</code>.</p>
   8.123 +     *
   8.124 +     * @param file the File containing the license header text
   8.125 +     * @return a new LicenseHeader
   8.126 +     *
   8.127 +     * @see #fromFileObject(org.openide.filesystems.FileObject,
   8.128 +     * java.lang.String)
   8.129 +     */
   8.130 +    public static LicenseHeader fromFile(File file) throws NullPointerException {
   8.131 +        if(file==null) {
   8.132 +            throw new NullPointerException("Parameter 'file' must not be null!");
   8.133 +        }
   8.134 +        return fromFileObject(FileUtil.toFileObject(file), null);
   8.135      }
   8.136 -    
   8.137 +
   8.138 +    /**
   8.139 +     * <p>Retrieves and returns the available license templates converted to
   8.140 +     * {@link LicenseHeader} objects. Empty licenses are not returned.</p>
   8.141 +     *
   8.142 +     * @return the available license headers
   8.143 +     */
   8.144      public static Collection<? extends LicenseHeader> fromTemplates() {
   8.145          FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Licenses");
   8.146          List<LicenseHeader> templateLicenses = new LinkedList<LicenseHeader>();
   8.147 -        for(FileObject license:licenseTemplates.getChildren()) {
   8.148 +        for (FileObject license : licenseTemplates.getChildren()) {
   8.149              String name = license.getName();
   8.150              name = name.substring("license-".length());
   8.151 -            LicenseHeader licenseHeader = LicenseHeader.fromFileObject(license,name,true);
   8.152 -            if(licenseHeader.getLicenseHeader() == null || licenseHeader.getLicenseHeader().isEmpty()) {
   8.153 -                System.err.println("License file "+name+" seems to be empty! Skipping...");
   8.154 -            }else{
   8.155 -                licenseHeader.setIsNetBeansTemplate(true);
   8.156 +            LicenseHeader licenseHeader = LicenseHeader.fromFileObject(license, name, true);
   8.157 +            if (licenseHeader.getLicenseHeader() == null || licenseHeader.getLicenseHeader().isEmpty()) {
   8.158 +                System.err.println("License file " + name + " seems to be empty! Skipping...");
   8.159 +            } else {
   8.160 +//                licenseHeader.setNetBeansTemplate(true);
   8.161                  templateLicenses.add(licenseHeader);
   8.162              }
   8.163          }
   8.164          return templateLicenses;
   8.165      }
   8.166 -    
   8.167 -    public static void addAsNetBeansTemplate(LicenseHeader header) {
   8.168 -        String filename = "license-"+header.getName()+".txt";
   8.169 +
   8.170 +    /**
   8.171 +     * <p>Add the given header as a netbeans template under
   8.172 +     * <code>Templates/Licenses</code>.</p>
   8.173 +     *
   8.174 +     * <p>The new license template will have a name according to license
   8.175 +     * template conventions. E.g. a license header with name
   8.176 +     * <code>example</code> will result in a template file stored at
   8.177 +     * <code>Templates/Licenses/license-example.txt</code> in the virtual file
   8.178 +     * system. The file can be retrieved via
   8.179 +     * <code>FileUtil.getConfigFile("Templates/Licenses/license-example.txt")</code>.</p>
   8.180 +     *
   8.181 +     * @param header the license header to add as a template
   8.182 +     * @return the license header representing the netbeans template or
   8.183 +     * <em>null</em> if any exceptions occurred.
   8.184 +     */
   8.185 +    public static LicenseHeader addAsNetBeansTemplate(LicenseHeader header) {
   8.186 +        String filename = "license-" + header.getName() + ".txt";
   8.187          FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Licenses");
   8.188          BufferedWriter bos = null;
   8.189          try {
   8.190              FileObject templateFile = licenseTemplates.createData(filename);
   8.191 -            bos = new BufferedWriter(new OutputStreamWriter(templateFile.getOutputStream(),Charset.forName("UTF-8")));
   8.192 -            bos.write(header.getLicenseHeader());
   8.193 -            header.setIsNetBeansTemplate(true);
   8.194 +            try {
   8.195 +                DataObject dobj = DataObject.find(templateFile);
   8.196 +                dobj.setTemplate(true);
   8.197 +                dobj.getNodeDelegate().setDisplayName(filename);
   8.198 +            } catch (DataObjectNotFoundException donfe) {
   8.199 +                Exceptions.printStackTrace(donfe);
   8.200 +            }
   8.201 +            //even if the dataobject was not found, 
   8.202 +            //we can still write our template to the file object
   8.203 +            try {
   8.204 +                bos = new BufferedWriter(new OutputStreamWriter(templateFile.getOutputStream(), Charset.forName("UTF-8")));
   8.205 +                bos.write(header.getLicenseHeader());
   8.206 +                bos.close();
   8.207 +            } catch (IOException ioex) {
   8.208 +                Exceptions.printStackTrace(ioex);
   8.209 +            } finally {
   8.210 +                try {
   8.211 +                    if (bos != null) {
   8.212 +                        bos.close();
   8.213 +                    }
   8.214 +                } catch (IOException ex) {
   8.215 +                    Exceptions.printStackTrace(ex);
   8.216 +                }
   8.217 +            }
   8.218 +            return LicenseHeader.fromFileObject(templateFile, null, true);
   8.219          } catch (IOException ex) {
   8.220              Exceptions.printStackTrace(ex);
   8.221 -        } finally {
   8.222 -            try {
   8.223 -                if(bos!=null) {
   8.224 -                    bos.close();
   8.225 -                }
   8.226 -            } catch (IOException ex) {
   8.227 -                Exceptions.printStackTrace(ex);
   8.228 -            }
   8.229 +//        } finally {
   8.230          }
   8.231 +        return null;
   8.232      }
   8.233 -    
   8.234      private final String name;
   8.235      private final String licenseHeader;
   8.236      private final FileObject fo;
   8.237 -    private boolean isNetBeansTemplate = false;
   8.238 +    private final boolean netBeansTemplate;
   8.239  
   8.240 -    private LicenseHeader(String name, String licenseHeader, FileObject fo, boolean isNetBeansTemplate) {
   8.241 +    private LicenseHeader(String name, String licenseHeader, FileObject fo, boolean netBeansTemplate) {
   8.242 +        if (name == null) {
   8.243 +            throw new NullPointerException("Parameter 'name' must not be null!");
   8.244 +        }
   8.245 +        if (licenseHeader == null) {
   8.246 +            throw new NullPointerException("Parameter 'licenseHeader' must not be null!");
   8.247 +        }
   8.248          this.name = name;
   8.249          this.licenseHeader = licenseHeader;
   8.250          this.fo = fo;
   8.251 -        this.isNetBeansTemplate = isNetBeansTemplate;
   8.252 +        this.netBeansTemplate = netBeansTemplate;
   8.253      }
   8.254 -    
   8.255 +
   8.256 +    /**
   8.257 +     * <p>Returns the name of this LicenseHeader.</p>
   8.258 +     *
   8.259 +     * @return the license header name
   8.260 +     */
   8.261      public String getName() {
   8.262          return name;
   8.263      }
   8.264 -    
   8.265 +
   8.266 +    /**
   8.267 +     * <p>Returns the raw license header text that may require further
   8.268 +     * interpolation by e.g. freemarker.</p>
   8.269 +     *
   8.270 +     * @return the raw license header text
   8.271 +     */
   8.272      public String getLicenseHeader() {
   8.273          return licenseHeader;
   8.274      }
   8.275  
   8.276 +    /**
   8.277 +     * <p>The FileObject associated to this LicenseHeader.</p>
   8.278 +     *
   8.279 +     * @return the physical file object
   8.280 +     */
   8.281      public FileObject getFileObject() {
   8.282          return this.fo;
   8.283      }
   8.284  
   8.285 -    public boolean isIsNetBeansTemplate() {
   8.286 -        return isNetBeansTemplate;
   8.287 +    /**
   8.288 +     * <p>For informational purposes only. The method returns true, if 
   8.289 +     * {@link LicenseHeader#addAsNetBeansTemplate(org.netbeans.modules.licensechanger.api.LicenseHeader) }
   8.290 +     * has been used to add a custom license, or if the LicenseHeader has been
   8.291 +     * loaded via {@link LicenseHeader#fromTemplates() }.</p>
   8.292 +     *
   8.293 +     * @return whether this is a NetBeans template
   8.294 +     */
   8.295 +    public boolean isNetBeansTemplate() {
   8.296 +        return netBeansTemplate;
   8.297      }
   8.298  
   8.299 -    public void setIsNetBeansTemplate(boolean isNetBeansTemplate) {
   8.300 -        this.isNetBeansTemplate = isNetBeansTemplate;
   8.301 +    /**
   8.302 +     * Returns the display name of the associated
   8.303 +     * <code>FileObject</code>'s
   8.304 +     * <code>DataObject</code>. If no
   8.305 +     * <code>DataObject</code> can be found, the name of this LicenseHeader is
   8.306 +     * returned.
   8.307 +     *
   8.308 +     * @return the display name
   8.309 +     */
   8.310 +    @Override
   8.311 +    public String toString() {
   8.312 +        if (fo != null) {
   8.313 +            try {
   8.314 +                return DataObject.find(getFileObject()).getNodeDelegate().getDisplayName();
   8.315 +            } catch (DataObjectNotFoundException ex) {
   8.316 +                Exceptions.printStackTrace(ex);
   8.317 +            }
   8.318 +        }
   8.319 +        return name;
   8.320      }
   8.321  
   8.322      @Override
   8.323 -    public String toString() {
   8.324 -        return name;
   8.325 +    public int hashCode() {
   8.326 +        int hash = 7;
   8.327 +        hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
   8.328 +        hash = 59 * hash + (this.licenseHeader != null ? this.licenseHeader.hashCode() : 0);
   8.329 +        hash = 59 * hash + (this.fo != null ? this.fo.hashCode() : 0);
   8.330 +        hash = 59 * hash + (this.netBeansTemplate ? 1 : 0);
   8.331 +        return hash;
   8.332      }
   8.333 -    
   8.334 +
   8.335 +    @Override
   8.336 +    public boolean equals(Object obj) {
   8.337 +        if (obj == null) {
   8.338 +            return false;
   8.339 +        }
   8.340 +        if (getClass() != obj.getClass()) {
   8.341 +            return false;
   8.342 +        }
   8.343 +        final LicenseHeader other = (LicenseHeader) obj;
   8.344 +        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
   8.345 +            return false;
   8.346 +        }
   8.347 +        if ((this.licenseHeader == null) ? (other.licenseHeader != null) : !this.licenseHeader.equals(other.licenseHeader)) {
   8.348 +            return false;
   8.349 +        }
   8.350 +        if (this.fo != other.fo && (this.fo == null || !this.fo.equals(other.fo))) {
   8.351 +            return false;
   8.352 +        }
   8.353 +        if (this.netBeansTemplate != other.netBeansTemplate) {
   8.354 +            return false;
   8.355 +        }
   8.356 +        return true;
   8.357 +    }
   8.358  }
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/Offsets.java	Sun Feb 10 16:18:19 2013 +0100
     9.3 @@ -0,0 +1,62 @@
     9.4 +/*
     9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 + *
     9.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
     9.8 + *
     9.9 + * The contents of this file are subject to the terms of either the GNU
    9.10 + * General Public License Version 2 only ("GPL") or the Common
    9.11 + * Development and Distribution License("CDDL") (collectively, the
    9.12 + * "License"). You may not use this file except in compliance with the
    9.13 + * License. You can obtain a copy of the License at
    9.14 + * http://www.netbeans.org/cddl-gplv2.html
    9.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.16 + * specific language governing permissions and limitations under the
    9.17 + * License.  When distributing the software, include this License Header
    9.18 + * Notice in each file and include the License file at
    9.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    9.20 + * particular file as subject to the "Classpath" exception as provided
    9.21 + * by Sun in the GPL Version 2 section of the License file that
    9.22 + * accompanied this code. If applicable, add the following below the
    9.23 + * License Header, with the fields enclosed by brackets [] replaced by
    9.24 + * your own identifying information:
    9.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    9.26 + *
    9.27 + * If you wish your version of this file to be governed by only the CDDL
    9.28 + * or only the GPL Version 2, indicate your decision by adding
    9.29 + * "[Contributor] elects to include this software in this distribution
    9.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.31 + * single choice of license, a recipient has the option to distribute
    9.32 + * your version of this file under either the CDDL, the GPL Version 2 or
    9.33 + * to extend the choice of license to its licensees as provided above.
    9.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.35 + * Version 2 license, then the option applies only if the new code is
    9.36 + * made subject to such option by the copyright holder.
    9.37 + *
    9.38 + * Contributor(s):
    9.39 + *
    9.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
    9.41 + */
    9.42 +package org.netbeans.modules.licensechanger.api;
    9.43 +
    9.44 +/**
    9.45 + *
    9.46 + * @author Tim Boudreau
    9.47 + */
    9.48 +public final class Offsets {
    9.49 +
    9.50 +    private final int start;
    9.51 +    private final int end;
    9.52 +
    9.53 +    public Offsets(int start, int end) {
    9.54 +        this.start = start;
    9.55 +        this.end = end;
    9.56 +    }
    9.57 +
    9.58 +    public int getEnd() {
    9.59 +        return end;
    9.60 +    }
    9.61 +
    9.62 +    public int getStart() {
    9.63 +        return start;
    9.64 +    }
    9.65 +}
    10.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/RegexpFileHandler.java	Fri Feb 08 11:02:28 2013 +0100
    10.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/RegexpFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    10.3 @@ -36,20 +36,20 @@
    10.4   *
    10.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    10.6   */
    10.7 -
    10.8  package org.netbeans.modules.licensechanger.api;
    10.9  
   10.10  import java.util.regex.Matcher;
   10.11  import java.util.regex.Pattern;
   10.12 -import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
   10.13  
   10.14  /**
   10.15   *
   10.16   * @author Tim Boudreau
   10.17   */
   10.18  public abstract class RegexpFileHandler extends FileHandler {
   10.19 +
   10.20      private final Pattern pattern;
   10.21 -    public RegexpFileHandler (Pattern pattern) {
   10.22 +
   10.23 +    public RegexpFileHandler(Pattern pattern) {
   10.24          this.pattern = pattern;
   10.25      }
   10.26  
   10.27 @@ -61,13 +61,12 @@
   10.28                  int end = m.end(1);
   10.29                  return new Offsets(start, end);
   10.30              } else {
   10.31 -                throw new IllegalStateException ("Regexp " + pattern.pattern()
   10.32 +                throw new IllegalStateException("Regexp " + pattern.pattern()
   10.33                          + " gets groupCount " + m.groupCount());
   10.34              }
   10.35          } else {
   10.36 -            throw new IllegalStateException ("Regexp " + pattern.pattern() +
   10.37 -                    " could find match in " + seq);
   10.38 +            throw new IllegalStateException("Regexp " + pattern.pattern()
   10.39 +                    + " could find match in " + seq);
   10.40          }
   10.41      }
   10.42 -
   10.43  }
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/freemarker/Project.java	Sun Feb 10 16:18:19 2013 +0100
    11.3 @@ -0,0 +1,62 @@
    11.4 +/*
    11.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 + *
    11.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    11.8 + *
    11.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   11.10 + * Other names may be trademarks of their respective owners.
   11.11 + *
   11.12 + * The contents of this file are subject to the terms of either the GNU
   11.13 + * General Public License Version 2 only ("GPL") or the Common
   11.14 + * Development and Distribution License("CDDL") (collectively, the
   11.15 + * "License"). You may not use this file except in compliance with the
   11.16 + * License. You can obtain a copy of the License at
   11.17 + * http://www.netbeans.org/cddl-gplv2.html
   11.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.19 + * specific language governing permissions and limitations under the
   11.20 + * License.  When distributing the software, include this License Header
   11.21 + * Notice in each file and include the License file at
   11.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   11.23 + * particular file as subject to the "Classpath" exception as provided
   11.24 + * by Oracle in the GPL Version 2 section of the License file that
   11.25 + * accompanied this code. If applicable, add the following below the
   11.26 + * License Header, with the fields enclosed by brackets [] replaced by
   11.27 + * your own identifying information:
   11.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   11.29 + *
   11.30 + * If you wish your version of this file to be governed by only the CDDL
   11.31 + * or only the GPL Version 2, indicate your decision by adding
   11.32 + * "[Contributor] elects to include this software in this distribution
   11.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.34 + * single choice of license, a recipient has the option to distribute
   11.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   11.36 + * to extend the choice of license to its licensees as provided above.
   11.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   11.38 + * Version 2 license, then the option applies only if the new code is
   11.39 + * made subject to such option by the copyright holder.
   11.40 + *
   11.41 + * Contributor(s):
   11.42 + *
   11.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
   11.44 + */
   11.45 +package org.netbeans.modules.licensechanger.freemarker;
   11.46 +
   11.47 +/**
   11.48 + * Freemarker expects project.organization to be the field 'organization' in an
   11.49 + * object. This provides a thin wrapper for that. Class must be public to be
   11.50 + * accessible by freemarker.
   11.51 + * 
   11.52 + * @author Nils Hoffmann
   11.53 + */
   11.54 +public class Project {
   11.55 +
   11.56 +    private final String organization;
   11.57 +
   11.58 +    public Project(String organization) {
   11.59 +        this.organization = organization;
   11.60 +    }
   11.61 +
   11.62 +    public String getOrganization() {
   11.63 +        return this.organization;
   11.64 +    }
   11.65 +}
    12.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/Bundle.properties	Fri Feb 08 11:02:28 2013 +0100
    12.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/Bundle.properties	Sun Feb 10 16:18:19 2013 +0100
    12.3 @@ -36,6 +36,7 @@
    12.4  # Portions Copyrighted 2009 Sun Microsystems, Inc.
    12.5  NAME_JAVA_FILES=Java Files
    12.6  NAME_JAVAFX_FILES=JavaFX Files
    12.7 +NAME_GROOVY_FILES=Groovy Files
    12.8  NAME_PROPERTIES_FILES=Properties Files
    12.9  NAME_XML_FILES=XML Files
   12.10  XmlHandlerCustomizer.beforeButton.text=Insert License Before XML Declaration
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/GroovyFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    13.3 @@ -0,0 +1,64 @@
    13.4 +/*
    13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 + *
    13.7 + * Copyright 2012 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 2012 Sun Microsystems, Inc.
   13.44 + */
   13.45 +package org.netbeans.modules.licensechanger.spi.handlers;
   13.46 +
   13.47 +import org.openide.filesystems.FileObject;
   13.48 +import org.openide.util.NbBundle;
   13.49 +
   13.50 +/**
   13.51 + * Service Provider implementation for files with mime-type text/x-groovy.
   13.52 + *
   13.53 + * @author Nils Hoffmann
   13.54 + */
   13.55 +@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.licensechanger.api.FileHandler.class)
   13.56 +public class GroovyFileHandler extends JavaFileHandler {
   13.57 +
   13.58 +    @Override
   13.59 +    public String getDisplayName() {
   13.60 +        return NbBundle.getMessage(GroovyFileHandler.class, "NAME_GROOVY_FILES"); //NOI18N
   13.61 +    }
   13.62 +
   13.63 +    @Override
   13.64 +    public boolean match(FileObject file) {
   13.65 +        return "text/x-groovy".equals(file.getMIMEType()); //NOI18N
   13.66 +    }
   13.67 +}
    14.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandler.java	Fri Feb 08 11:02:28 2013 +0100
    14.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    14.3 @@ -39,7 +39,7 @@
    14.4  package org.netbeans.modules.licensechanger.spi.handlers;
    14.5  
    14.6  import org.netbeans.modules.licensechanger.api.FileHandler;
    14.7 -import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
    14.8 +import org.netbeans.modules.licensechanger.api.Offsets;
    14.9  import org.openide.filesystems.FileObject;
   14.10  import org.openide.util.NbBundle;
   14.11  
   14.12 @@ -47,7 +47,7 @@
   14.13   *
   14.14   * @author Tim Boudreau
   14.15   */
   14.16 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
   14.17 +@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.licensechanger.api.FileHandler.class)
   14.18  public class JavaFileHandler extends FileHandler {
   14.19  
   14.20      @Override
   14.21 @@ -69,13 +69,13 @@
   14.22      protected Offsets getReplaceOffsets(CharSequence seq) {
   14.23          String[] lines = splitIntoLines(seq);
   14.24          LineVisitor v = new LineVisitor();
   14.25 -        for (int i=0; i < lines.length; i++) {
   14.26 +        for (int i = 0; i < lines.length; i++) {
   14.27              String line = lines[i];
   14.28              if (!v.visitLine(line)) {
   14.29                  break;
   14.30              }
   14.31          }
   14.32 -        return new Offsets (0, v.delCount);
   14.33 +        return new Offsets(0, v.delCount);
   14.34      }
   14.35  
   14.36      @Override
   14.37 @@ -94,18 +94,20 @@
   14.38      }
   14.39  
   14.40      private static final class LineVisitor {
   14.41 +
   14.42          private boolean inComment;
   14.43          int delCount;
   14.44 -        public boolean visitLine (String line) {
   14.45 +
   14.46 +        public boolean visitLine(String line) {
   14.47              String trimmed = line.trim();
   14.48              if (trimmed.startsWith("//") || trimmed.startsWith("/*") && trimmed.endsWith("*/")) {
   14.49                  return visitCommentLine(line);
   14.50              } else if (trimmed.length() == 0) {
   14.51 -                return visitEmptyLine (line);
   14.52 +                return visitEmptyLine(line);
   14.53              } else if (inComment) {
   14.54 -                return visitLineInComment (line);
   14.55 +                return visitLineInComment(line);
   14.56              } else {
   14.57 -                return visitLineAndTestForComment (line);
   14.58 +                return visitLineAndTestForComment(line);
   14.59              }
   14.60          }
   14.61  
   14.62 @@ -145,7 +147,6 @@
   14.63          }
   14.64      }
   14.65  
   14.66 -
   14.67  //    @Override
   14.68  //    protected Offsets getReplaceOffsets(CharSequence seq) {
   14.69  //        int end2 = 0;
   14.70 @@ -191,20 +192,19 @@
   14.71  //        }
   14.72  //        return new Offsets(0, end2);
   14.73  //    }
   14.74 -
   14.75      @Override
   14.76      protected String escape(String licenseText) {
   14.77          StringBuilder sb = new StringBuilder(licenseText.length() + 30);
   14.78 -        String[] lines = splitIntoLines (licenseText);
   14.79 -        sb.append ("/*\n");
   14.80 +        String[] lines = splitIntoLines(licenseText);
   14.81 +        sb.append("/*\n");
   14.82          for (int i = 0; i < lines.length; i++) {
   14.83              String line = lines[i];
   14.84              boolean empty = line.trim().length() == 0;
   14.85              if (empty) {
   14.86 -                sb.append (" *");
   14.87 +                sb.append(" *");
   14.88              } else {
   14.89 -                sb.append (" * ");
   14.90 -                sb.append (line);
   14.91 +                sb.append(" * ");
   14.92 +                sb.append(line);
   14.93              }
   14.94              sb.append("\n");
   14.95          }
    15.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFxFileHandler.java	Fri Feb 08 11:02:28 2013 +0100
    15.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFxFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    15.3 @@ -36,14 +36,14 @@
    15.4   *
    15.5   * Portions Copyrighted 2010 Sun Microsystems, Inc.
    15.6   */
    15.7 -
    15.8  package org.netbeans.modules.licensechanger.spi.handlers;
    15.9  
   15.10  import org.openide.filesystems.FileObject;
   15.11  import org.openide.util.NbBundle;
   15.12  
   15.13 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
   15.14 +@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.licensechanger.api.FileHandler.class)
   15.15  public class JavaFxFileHandler extends JavaFileHandler {
   15.16 +
   15.17      @Override
   15.18      public String getDisplayName() {
   15.19          return NbBundle.getMessage(JavaFxFileHandler.class, "NAME_JAVAFX_FILES"); //NOI18N
   15.20 @@ -54,4 +54,3 @@
   15.21          return "text/x-fx".equals(file.getMIMEType()); //NOI18N
   15.22      }
   15.23  }
   15.24 -
    16.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandler.java	Fri Feb 08 11:02:28 2013 +0100
    16.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    16.3 @@ -36,11 +36,10 @@
    16.4   *
    16.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    16.6   */
    16.7 -
    16.8  package org.netbeans.modules.licensechanger.spi.handlers;
    16.9  
   16.10  import org.netbeans.modules.licensechanger.api.FileHandler;
   16.11 -import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
   16.12 +import org.netbeans.modules.licensechanger.api.Offsets;
   16.13  import org.openide.filesystems.FileObject;
   16.14  import org.openide.util.NbBundle;
   16.15  
   16.16 @@ -49,17 +48,17 @@
   16.17   *
   16.18   * @author Tim Boudreau
   16.19   */
   16.20 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
   16.21 +@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.licensechanger.api.FileHandler.class)
   16.22  public class PropertiesFileHandler extends FileHandler {
   16.23  
   16.24      @Override
   16.25      public String getDisplayName() {
   16.26 -        return NbBundle.getMessage (JavaFileHandler.class, "NAME_PROPERTIES_FILES"); //NOI18N
   16.27 +        return NbBundle.getMessage(JavaFileHandler.class, "NAME_PROPERTIES_FILES"); //NOI18N
   16.28      }
   16.29  
   16.30      @Override
   16.31      public boolean match(FileObject file) {
   16.32 -        return "properties".equals (file.getExt());
   16.33 +        return "properties".equals(file.getExt());
   16.34      }
   16.35  
   16.36      @Override
   16.37 @@ -67,8 +66,8 @@
   16.38          String n = file.getNameExt();
   16.39          return "project.properties".equals(n) || "private.properties".equals(n) || //NOI18N
   16.40                  "platform-private.properties".equals(n) || "genfiles.properties".equals(n)
   16.41 -                || "config.properties".equals(n) || "nblibraries-private.properties".equals(n) ||
   16.42 -                "nblibraries.properties".equals(n); //NOI18N
   16.43 +                || "config.properties".equals(n) || "nblibraries-private.properties".equals(n)
   16.44 +                || "nblibraries.properties".equals(n); //NOI18N
   16.45      }
   16.46  
   16.47      @Override
   16.48 @@ -85,7 +84,7 @@
   16.49                  break;
   16.50              }
   16.51          }
   16.52 -        return new Offsets (0, end);
   16.53 +        return new Offsets(0, end);
   16.54      }
   16.55  
   16.56      @Override
   16.57 @@ -95,12 +94,12 @@
   16.58          for (int i = 0; i < lines.length; i++) {
   16.59              String line = lines[i];
   16.60              if (line.trim().length() == 0) {
   16.61 -                sb.append ("#");
   16.62 +                sb.append("#");
   16.63              } else {
   16.64 -                sb.append ("# ");
   16.65 -                sb.append (line);
   16.66 +                sb.append("# ");
   16.67 +                sb.append(line);
   16.68              }
   16.69 -            sb.append ("\n");
   16.70 +            sb.append("\n");
   16.71          }
   16.72          return sb.toString();
   16.73      }
    17.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandler.java	Fri Feb 08 11:02:28 2013 +0100
    17.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandler.java	Sun Feb 10 16:18:19 2013 +0100
    17.3 @@ -36,7 +36,6 @@
    17.4   *
    17.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    17.6   */
    17.7 -
    17.8  package org.netbeans.modules.licensechanger.spi.handlers;
    17.9  
   17.10  import java.io.CharConversionException;
   17.11 @@ -44,7 +43,7 @@
   17.12  import java.util.regex.Matcher;
   17.13  import java.util.regex.Pattern;
   17.14  import org.netbeans.modules.licensechanger.api.FileHandler;
   17.15 -import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
   17.16 +import org.netbeans.modules.licensechanger.api.Offsets;
   17.17  import org.openide.filesystems.FileObject;
   17.18  import org.openide.util.Exceptions;
   17.19  import org.openide.util.NbBundle;
   17.20 @@ -55,23 +54,23 @@
   17.21   *
   17.22   * @author Tim Boudreau
   17.23   */
   17.24 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
   17.25 -public class XmlFileHandler extends FileHandler{// implements Customizable {
   17.26 +@org.openide.util.lookup.ServiceProvider(service = org.netbeans.modules.licensechanger.api.FileHandler.class)
   17.27 +public class XmlFileHandler extends FileHandler {// implements Customizable {
   17.28  
   17.29      @Override
   17.30      public boolean match(FileObject file) {
   17.31          String ext = file.getExt();
   17.32          String mime = file.getMIMEType();
   17.33 -        return "xml".equals (file.getExt()) || "text/xml".equals(mime) ||
   17.34 -                "application/xml".equals(mime) || mime.endsWith("+xml");
   17.35 +        return "xml".equals(file.getExt()) || "text/xml".equals(mime)
   17.36 +                || "application/xml".equals(mime) || mime.endsWith("+xml");
   17.37      }
   17.38  
   17.39      @Override
   17.40      public boolean shouldSkipFile(FileObject file) {
   17.41          String n = file.getNameExt();
   17.42 -        return "project.xml".equals(n) ||
   17.43 -                "private.xml".equals(n) || "build.xml".equals(n) ||
   17.44 -                "build-impl.xml".equals(n) || "pom.xml".equals(n);
   17.45 +        return "project.xml".equals(n)
   17.46 +                || "private.xml".equals(n) || "build.xml".equals(n)
   17.47 +                || "build-impl.xml".equals(n) || "pom.xml".equals(n);
   17.48      }
   17.49  
   17.50      @Override
   17.51 @@ -83,13 +82,13 @@
   17.52      protected Offsets getReplaceOffsets(CharSequence seq) {
   17.53          String[] lines = splitIntoLines(seq);
   17.54          LineVisitor v = new LineVisitor();
   17.55 -        for (int i=0; i < lines.length; i++) {
   17.56 +        for (int i = 0; i < lines.length; i++) {
   17.57              String line = lines[i];
   17.58              if (!v.visitLine(line)) {
   17.59                  break;
   17.60              }
   17.61          }
   17.62 -        return new Offsets (v.start, v.delCount);
   17.63 +        return new Offsets(v.start, v.delCount);
   17.64      }
   17.65  
   17.66      @Override
   17.67 @@ -101,19 +100,17 @@
   17.68          }
   17.69          return "<!--\n" + licenseText + "\n-->\n";
   17.70      }
   17.71 -
   17.72 -    static Pattern xmlDeclaration = Pattern.compile ("(<\\?xml.*?\\?>)");
   17.73 +    static Pattern xmlDeclaration = Pattern.compile("(<\\?xml.*?\\?>)");
   17.74  
   17.75  //    @Override
   17.76  //    public Component getCustomizer() {
   17.77  //        return new XmlHandlerCustomizer();
   17.78  //    }
   17.79 -
   17.80      public static boolean isInsertAtTopOfFile() {
   17.81          return NbPreferences.forModule(XmlFileHandler.class).getBoolean("atTop", false);
   17.82      }
   17.83  
   17.84 -    public static void setInsertAtTopOfFile (boolean val) {
   17.85 +    public static void setInsertAtTopOfFile(boolean val) {
   17.86          NbPreferences.forModule(XmlFileHandler.class).putBoolean("atTop", val);
   17.87      }
   17.88  
   17.89 @@ -133,11 +130,13 @@
   17.90      }
   17.91  
   17.92      private static final class XmlDeclarationLocator {
   17.93 +
   17.94          int declarationStartIndex;
   17.95          int declarationEndIndex;
   17.96          boolean isMidLine;
   17.97 +
   17.98          public boolean visitLine(String line) {
   17.99 -            Matcher m = xmlDeclaration.matcher (line);
  17.100 +            Matcher m = xmlDeclaration.matcher(line);
  17.101              if (m.find()) {
  17.102                  declarationStartIndex += m.start(1);
  17.103                  declarationEndIndex = declarationStartIndex + m.end(1);
  17.104 @@ -155,28 +154,28 @@
  17.105      }
  17.106  
  17.107      @Override
  17.108 -    public String transform(String origText, String licenseText, Map<String,Object> bindings) {
  17.109 +    public String transform(String origText, String licenseText, Map<String, Object> bindings) {
  17.110          String[] lines = splitIntoLines(origText);
  17.111          XmlDeclarationLocator v = new XmlDeclarationLocator();
  17.112 -        for (int i=0; i < lines.length; i++) {
  17.113 +        for (int i = 0; i < lines.length; i++) {
  17.114              if (!v.visitLine(lines[i])) {
  17.115                  break;
  17.116              }
  17.117          }
  17.118          if (v.foundDeclaration()) {
  17.119 -            StringBuilder sb = new StringBuilder (origText);
  17.120 +            StringBuilder sb = new StringBuilder(origText);
  17.121              sb.delete(0, v.declarationStartIndex);
  17.122              origText = sb.toString();
  17.123          }
  17.124  //        String license = escape (licenseText);
  17.125          String license = resolveLicenseTemplate(licenseText, bindings);
  17.126          license = "\n" + license;
  17.127 -        StringBuilder sb = new StringBuilder (origText);
  17.128 +        StringBuilder sb = new StringBuilder(origText);
  17.129          Offsets o = getReplaceOffsets(sb);
  17.130          sb.delete(o.getStart(), o.getEnd());
  17.131          lines = splitIntoLines(origText);
  17.132          v = new XmlDeclarationLocator();
  17.133 -        for (int i=0; i < lines.length; i++) {
  17.134 +        for (int i = 0; i < lines.length; i++) {
  17.135              if (!v.visitLine(lines[i])) {
  17.136                  break;
  17.137              }
  17.138 @@ -189,13 +188,13 @@
  17.139          return sb.toString();
  17.140      }
  17.141  
  17.142 +    private static final class LineVisitor {
  17.143  
  17.144 -
  17.145 -    private static final class LineVisitor {
  17.146          private boolean inComment;
  17.147          int delCount;
  17.148          int start;
  17.149 -        public boolean visitLine (String line) {
  17.150 +
  17.151 +        public boolean visitLine(String line) {
  17.152              if (start == 0) {
  17.153                  if (line.trim().startsWith("<?xml ")) {
  17.154                      start += line.length() + 1;
  17.155 @@ -207,11 +206,11 @@
  17.156              if (trimmed.startsWith("<!--") && trimmed.endsWith("-->")) {
  17.157                  return visitCommentLine(line);
  17.158              } else if (trimmed.length() == 0) {
  17.159 -                return visitEmptyLine (line);
  17.160 +                return visitEmptyLine(line);
  17.161              } else if (inComment) {
  17.162 -                return visitLineInComment (line);
  17.163 +                return visitLineInComment(line);
  17.164              } else {
  17.165 -                return visitLineAndTestForComment (line);
  17.166 +                return visitLineAndTestForComment(line);
  17.167              }
  17.168          }
  17.169  
    18.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlHandlerCustomizer.java	Fri Feb 08 11:02:28 2013 +0100
    18.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlHandlerCustomizer.java	Sun Feb 10 16:18:19 2013 +0100
    18.3 @@ -43,19 +43,23 @@
    18.4   * @author Tim Boudreau
    18.5   */
    18.6  public class XmlHandlerCustomizer extends javax.swing.JPanel {
    18.7 +
    18.8      boolean init;
    18.9 -    /** Creates new form XmlHandlerCustomizer */
   18.10 +
   18.11 +    /**
   18.12 +     * Creates new form XmlHandlerCustomizer
   18.13 +     */
   18.14      public XmlHandlerCustomizer() {
   18.15          initComponents();
   18.16 -        afterButton.setSelected (!XmlFileHandler.isInsertAtTopOfFile());
   18.17 +        afterButton.setSelected(!XmlFileHandler.isInsertAtTopOfFile());
   18.18          beforeButton.setSelected(!afterButton.isSelected());
   18.19          init = true;
   18.20      }
   18.21  
   18.22 -    /** This method is called from within the constructor to
   18.23 -     * initialize the form.
   18.24 -     * WARNING: Do NOT modify this code. The content of this method is
   18.25 -     * always regenerated by the Form Editor.
   18.26 +    /**
   18.27 +     * This method is called from within the constructor to initialize the form.
   18.28 +     * WARNING: Do NOT modify this code. The content of this method is always
   18.29 +     * regenerated by the Form Editor.
   18.30       */
   18.31      @SuppressWarnings("unchecked")
   18.32      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   18.33 @@ -105,15 +109,14 @@
   18.34      }// </editor-fold>//GEN-END:initComponents
   18.35  
   18.36      private void licensePreferenceChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_licensePreferenceChanged
   18.37 -        if (!init) return;
   18.38 +        if (!init) {
   18.39 +            return;
   18.40 +        }
   18.41          XmlFileHandler.setInsertAtTopOfFile(beforeButton.isSelected());
   18.42      }//GEN-LAST:event_licensePreferenceChanged
   18.43 -
   18.44 -
   18.45      // Variables declaration - do not modify//GEN-BEGIN:variables
   18.46      private javax.swing.JRadioButton afterButton;
   18.47      private javax.swing.JRadioButton beforeButton;
   18.48      private javax.swing.ButtonGroup buttonGroup1;
   18.49      // End of variables declaration//GEN-END:variables
   18.50 -
   18.51  }
    19.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties	Fri Feb 08 11:02:28 2013 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,32 +0,0 @@
    19.4 -BROWSE_LICENSE_TITLE=Locate License File
    19.5 -MSG_SELECT_A_LICENSE=Select a License or Browse for file
    19.6 -ERR_COULD_NOT_LOAD=Could not load {0}
    19.7 -LicenseChooserPanel.chooseLabel.text=Choose License
    19.8 -LicenseChooserPanel.browseButton.text=Browse
    19.9 -SelectFoldersPanel.jLabel1.text=Uncheck Folders that Should Be Ignored
   19.10 -LineEndingsPanel.border.title=Line Endings
   19.11 -ChooseFileTypesPanel.jLabel1.text=Choose and Customize File Types
   19.12 -ChooseFileTypesPanel.noCustomizerLabel.text=[no customizer]
   19.13 -ChooseFileTypesPanel.customizerPanel.border.title=File Type Settings
   19.14 -
   19.15 -WIZARD_TITLE=Add/Replace License Headers
   19.16 -chooseFileTypes=Select File Types
   19.17 -chooseLicense=Select License
   19.18 -chooseFolders=Prune Folders
   19.19 -chooseFiles=Choose Files
   19.20 -preview=Preview
   19.21 -LBL_CHANGE_LICENSE=Change License Headers
   19.22 -
   19.23 -PreviewPanel.jLabel3.text=jLabel3
   19.24 -LineEndingsPanel.noChangeButton.text=Do Not Change
   19.25 -LineEndingsPanel.systemDefaultButton.text=Force System Default
   19.26 -LineEndingsPanel.newlineButton.text=Force Newline
   19.27 -LineEndingsPanel.forceCrlf.text=Force CRLF
   19.28 -LineEndingsPanel.newlineButton.text_1=Force Newline
   19.29 -LineEndingsPanel.systemDefaultButton.text_1=Force System Default
   19.30 -LineEndingsPanel.noChangeButton.text_1=Do Not Change
   19.31 -LineEndingsPanel.forceCrlf.text_1=Force CRLF
   19.32 -LicenseChooserPanel.updateDefaultProjectLicense.text=Set as default project license
   19.33 -PreviewPanel.fileList.border.title=Select File for Preview
   19.34 -ChooseFileTypesPanel.copyrightHolderLabel.text=Copyright Holder
   19.35 -ChooseFileTypesPanel.licensePropertiesPanel.border.title=License Properties
    20.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.form	Fri Feb 08 11:02:28 2013 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,201 +0,0 @@
    20.4 -<?xml version="1.0" encoding="UTF-8" ?>
    20.5 -
    20.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    20.7 -  <AuxValues>
    20.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    20.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   20.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   20.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   20.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   20.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   20.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   20.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   20.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   20.17 -  </AuxValues>
   20.18 -
   20.19 -  <Layout>
   20.20 -    <DimensionLayout dim="0">
   20.21 -      <Group type="103" groupAlignment="0" attributes="0">
   20.22 -          <Group type="102" attributes="0">
   20.23 -              <EmptySpace max="-2" attributes="0"/>
   20.24 -              <Group type="103" groupAlignment="0" attributes="0">
   20.25 -                  <Component id="jScrollPane1" alignment="0" pref="804" max="32767" attributes="0"/>
   20.26 -                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
   20.27 -                  <Group type="102" alignment="1" attributes="0">
   20.28 -                      <Component id="customizerPanel" pref="559" max="32767" attributes="0"/>
   20.29 -                      <EmptySpace max="-2" attributes="0"/>
   20.30 -                      <Group type="103" groupAlignment="0" max="-2" attributes="0">
   20.31 -                          <Component id="lineEndingsPanel1" pref="239" max="32767" attributes="0"/>
   20.32 -                          <Component id="licensePropertiesPanel" max="32767" attributes="0"/>
   20.33 -                      </Group>
   20.34 -                  </Group>
   20.35 -              </Group>
   20.36 -              <EmptySpace max="-2" attributes="0"/>
   20.37 -          </Group>
   20.38 -      </Group>
   20.39 -    </DimensionLayout>
   20.40 -    <DimensionLayout dim="1">
   20.41 -      <Group type="103" groupAlignment="0" attributes="0">
   20.42 -          <Group type="102" alignment="0" attributes="0">
   20.43 -              <EmptySpace max="-2" attributes="0"/>
   20.44 -              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   20.45 -              <EmptySpace max="-2" attributes="0"/>
   20.46 -              <Component id="jScrollPane1" min="-2" pref="112" max="-2" attributes="0"/>
   20.47 -              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   20.48 -              <Group type="103" groupAlignment="0" attributes="0">
   20.49 -                  <Component id="customizerPanel" pref="361" max="32767" attributes="0"/>
   20.50 -                  <Group type="102" attributes="0">
   20.51 -                      <Component id="lineEndingsPanel1" min="-2" max="-2" attributes="0"/>
   20.52 -                      <EmptySpace type="separate" max="-2" attributes="0"/>
   20.53 -                      <Component id="licensePropertiesPanel" max="32767" attributes="0"/>
   20.54 -                  </Group>
   20.55 -              </Group>
   20.56 -              <EmptySpace max="-2" attributes="0"/>
   20.57 -          </Group>
   20.58 -      </Group>
   20.59 -    </DimensionLayout>
   20.60 -  </Layout>
   20.61 -  <SubComponents>
   20.62 -    <Component class="javax.swing.JLabel" name="jLabel1">
   20.63 -      <Properties>
   20.64 -        <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
   20.65 -          <FontInfo relative="true">
   20.66 -            <Font bold="true" component="jLabel1" property="font" relativeSize="true" size="0"/>
   20.67 -          </FontInfo>
   20.68 -        </Property>
   20.69 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   20.70 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   20.71 -        </Property>
   20.72 -        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   20.73 -          <Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
   20.74 -            <MatteColorBorder bottom="1" left="0" right="0" top="0"/>
   20.75 -          </Border>
   20.76 -        </Property>
   20.77 -      </Properties>
   20.78 -      <AccessibilityProperties>
   20.79 -        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   20.80 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   20.81 -        </Property>
   20.82 -      </AccessibilityProperties>
   20.83 -    </Component>
   20.84 -    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
   20.85 -      <Properties>
   20.86 -        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   20.87 -          <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
   20.88 -            <LineBorder>
   20.89 -              <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
   20.90 -            </LineBorder>
   20.91 -          </Border>
   20.92 -        </Property>
   20.93 -      </Properties>
   20.94 -      <AuxValues>
   20.95 -        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
   20.96 -      </AuxValues>
   20.97 -
   20.98 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   20.99 -    </Container>
  20.100 -    <Container class="javax.swing.JPanel" name="customizerPanel">
  20.101 -      <Properties>
  20.102 -        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  20.103 -          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
  20.104 -            <TitledBorder title="File Type Settings">
  20.105 -              <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.106 -            </TitledBorder>
  20.107 -          </Border>
  20.108 -        </Property>
  20.109 -      </Properties>
  20.110 -      <AccessibilityProperties>
  20.111 -        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  20.112 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.113 -        </Property>
  20.114 -      </AccessibilityProperties>
  20.115 -
  20.116 -      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
  20.117 -      <SubComponents>
  20.118 -        <Component class="javax.swing.JLabel" name="noCustomizerLabel">
  20.119 -          <Properties>
  20.120 -            <Property name="horizontalAlignment" type="int" value="0"/>
  20.121 -            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  20.122 -              <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.123 -            </Property>
  20.124 -            <Property name="enabled" type="boolean" value="false"/>
  20.125 -          </Properties>
  20.126 -          <AccessibilityProperties>
  20.127 -            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  20.128 -              <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.129 -            </Property>
  20.130 -          </AccessibilityProperties>
  20.131 -          <Constraints>
  20.132 -            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
  20.133 -              <BorderConstraints direction="Center"/>
  20.134 -            </Constraint>
  20.135 -          </Constraints>
  20.136 -        </Component>
  20.137 -      </SubComponents>
  20.138 -    </Container>
  20.139 -    <Component class="org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel" name="lineEndingsPanel1">
  20.140 -    </Component>
  20.141 -    <Container class="javax.swing.JPanel" name="licensePropertiesPanel">
  20.142 -      <Properties>
  20.143 -        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  20.144 -          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
  20.145 -            <TitledBorder title="License Properties">
  20.146 -              <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.licensePropertiesPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.147 -            </TitledBorder>
  20.148 -          </Border>
  20.149 -        </Property>
  20.150 -      </Properties>
  20.151 -
  20.152 -      <Layout>
  20.153 -        <DimensionLayout dim="0">
  20.154 -          <Group type="103" groupAlignment="0" attributes="0">
  20.155 -              <Group type="102" attributes="0">
  20.156 -                  <EmptySpace max="-2" attributes="0"/>
  20.157 -                  <Group type="103" groupAlignment="0" attributes="0">
  20.158 -                      <Group type="102" attributes="0">
  20.159 -                          <Component id="copyrightHolderLabel" min="-2" max="-2" attributes="0"/>
  20.160 -                          <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
  20.161 -                      </Group>
  20.162 -                      <Component id="copyrightHolderField" max="32767" attributes="0"/>
  20.163 -                  </Group>
  20.164 -                  <EmptySpace max="-2" attributes="0"/>
  20.165 -              </Group>
  20.166 -          </Group>
  20.167 -        </DimensionLayout>
  20.168 -        <DimensionLayout dim="1">
  20.169 -          <Group type="103" groupAlignment="0" attributes="0">
  20.170 -              <Group type="102" alignment="0" attributes="0">
  20.171 -                  <EmptySpace max="-2" attributes="0"/>
  20.172 -                  <Component id="copyrightHolderLabel" min="-2" max="-2" attributes="0"/>
  20.173 -                  <EmptySpace max="-2" attributes="0"/>
  20.174 -                  <Component id="copyrightHolderField" min="-2" max="-2" attributes="0"/>
  20.175 -                  <EmptySpace max="32767" attributes="0"/>
  20.176 -              </Group>
  20.177 -          </Group>
  20.178 -        </DimensionLayout>
  20.179 -      </Layout>
  20.180 -      <SubComponents>
  20.181 -        <Component class="javax.swing.JLabel" name="copyrightHolderLabel">
  20.182 -          <Properties>
  20.183 -            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  20.184 -              <ComponentRef name="copyrightHolderField"/>
  20.185 -            </Property>
  20.186 -            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  20.187 -              <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.copyrightHolderLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  20.188 -            </Property>
  20.189 -          </Properties>
  20.190 -        </Component>
  20.191 -        <Component class="javax.swing.JTextField" name="copyrightHolderField">
  20.192 -          <Properties>
  20.193 -            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
  20.194 -              <Connection code="System.getProperty(&quot;user.name&quot;) == null ? &quot;&quot; : System.getProperty(&quot;user.name&quot;)" type="code"/>
  20.195 -            </Property>
  20.196 -          </Properties>
  20.197 -          <Events>
  20.198 -            <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="copyrightHolderFieldFocusGained"/>
  20.199 -          </Events>
  20.200 -        </Component>
  20.201 -      </SubComponents>
  20.202 -    </Container>
  20.203 -  </SubComponents>
  20.204 -</Form>
    21.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.java	Fri Feb 08 11:02:28 2013 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,283 +0,0 @@
    21.4 -/*
    21.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    21.6 - *
    21.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    21.8 - *
    21.9 - * The contents of this file are subject to the terms of either the GNU
   21.10 - * General Public License Version 2 only ("GPL") or the Common
   21.11 - * Development and Distribution License("CDDL") (collectively, the
   21.12 - * "License"). You may not use this file except in compliance with the
   21.13 - * License. You can obtain a copy of the License at
   21.14 - * http://www.netbeans.org/cddl-gplv2.html
   21.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   21.16 - * specific language governing permissions and limitations under the
   21.17 - * License.  When distributing the software, include this License Header
   21.18 - * Notice in each file and include the License file at
   21.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   21.20 - * particular file as subject to the "Classpath" exception as provided
   21.21 - * by Sun in the GPL Version 2 section of the License file that
   21.22 - * accompanied this code. If applicable, add the following below the
   21.23 - * License Header, with the fields enclosed by brackets [] replaced by
   21.24 - * your own identifying information:
   21.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   21.26 - *
   21.27 - * If you wish your version of this file to be governed by only the CDDL
   21.28 - * or only the GPL Version 2, indicate your decision by adding
   21.29 - * "[Contributor] elects to include this software in this distribution
   21.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   21.31 - * single choice of license, a recipient has the option to distribute
   21.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   21.33 - * to extend the choice of license to its licensees as provided above.
   21.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   21.35 - * Version 2 license, then the option applies only if the new code is
   21.36 - * made subject to such option by the copyright holder.
   21.37 - *
   21.38 - * Contributor(s):
   21.39 - *
   21.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   21.41 - */
   21.42 -
   21.43 -/*
   21.44 - * NewJPanel.java
   21.45 - *
   21.46 - * Created on Mar 20, 2009, 1:14:43 AM
   21.47 - */
   21.48 -
   21.49 -package org.netbeans.modules.licensechanger.spi.wizard;
   21.50 -
   21.51 -import java.beans.PropertyChangeEvent;
   21.52 -import java.beans.PropertyChangeListener;
   21.53 -import java.util.HashSet;
   21.54 -import java.util.List;
   21.55 -import java.util.Set;
   21.56 -import org.netbeans.modules.licensechanger.api.Customizable;
   21.57 -import org.netbeans.modules.licensechanger.api.FileHandler;
   21.58 -import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckableNodeCapability;
   21.59 -import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
   21.60 -import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
   21.61 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   21.62 -import org.openide.explorer.ExplorerManager;
   21.63 -import org.openide.explorer.view.CheckableNode;
   21.64 -import org.openide.nodes.AbstractNode;
   21.65 -import org.openide.nodes.ChildFactory;
   21.66 -import org.openide.nodes.Children;
   21.67 -import org.openide.nodes.Node;
   21.68 -import org.openide.util.Lookup;
   21.69 -import org.openide.util.NbPreferences;
   21.70 -import org.openide.util.lookup.Lookups;
   21.71 -
   21.72 -/**
   21.73 - *
   21.74 - * @author Tim Boudreau
   21.75 - * @author Nils Hoffmann (Refactoring)
   21.76 - */
   21.77 -public class ChooseFileTypesPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
   21.78 -    private final ExplorerManager mgr = new ExplorerManager();
   21.79 -
   21.80 -    public ChooseFileTypesPanel() {
   21.81 -        initComponents();
   21.82 -        String copyrightHolder = 
   21.83 -                NbPreferences.forModule(ChooseFileTypesWizardPanel.class)
   21.84 -                .get(WizardProperties.KEY_COPYRIGHT_HOLDER, null);
   21.85 -        if (copyrightHolder != null && !copyrightHolder.trim().isEmpty()) {
   21.86 -            copyrightHolderField.setText(copyrightHolder);
   21.87 -        }
   21.88 -        mgr.setRootContext(new AbstractNode (Children.create(new FileHandlerChildren(), false)));
   21.89 -        ((CheckboxListView) jScrollPane1).setNodeCheckObserver(this);
   21.90 -        ((CheckboxListView) jScrollPane1).setListEnabled(true);
   21.91 -        ((CheckboxListView) jScrollPane1).setCheckboxesEnabled(true);
   21.92 -        ((CheckboxListView) jScrollPane1).setCheckboxesVisible(true);
   21.93 -        mgr.addPropertyChangeListener(this);
   21.94 -        setName("Choose File Types");
   21.95 -        updateMap();
   21.96 -    }
   21.97 -
   21.98 -    private void updateMap() {
   21.99 -        Set<FileHandler> handlers = getFileHandlers();
  21.100 -        firePropertyChange(WizardProperties.KEY_FILE_HANDLERS, null, handlers);
  21.101 -    }
  21.102 -
  21.103 -    /** This method is called from within the constructor to
  21.104 -     * initialize the form.
  21.105 -     * WARNING: Do NOT modify this code. The content of this method is
  21.106 -     * always regenerated by the Form Editor.
  21.107 -     */
  21.108 -    @SuppressWarnings("unchecked")
  21.109 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  21.110 -    private void initComponents() {
  21.111 -
  21.112 -        jLabel1 = new javax.swing.JLabel();
  21.113 -        jScrollPane1 = new CheckboxListView();
  21.114 -        customizerPanel = new javax.swing.JPanel();
  21.115 -        noCustomizerLabel = new javax.swing.JLabel();
  21.116 -        lineEndingsPanel1 = new org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel();
  21.117 -        licensePropertiesPanel = new javax.swing.JPanel();
  21.118 -        copyrightHolderLabel = new javax.swing.JLabel();
  21.119 -        copyrightHolderField = new javax.swing.JTextField();
  21.120 -
  21.121 -        jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
  21.122 -        jLabel1.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.jLabel1.text")); // NOI18N
  21.123 -        jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
  21.124 -
  21.125 -        jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
  21.126 -
  21.127 -        customizerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title"))); // NOI18N
  21.128 -        customizerPanel.setLayout(new java.awt.BorderLayout());
  21.129 -
  21.130 -        noCustomizerLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  21.131 -        noCustomizerLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
  21.132 -        noCustomizerLabel.setEnabled(false);
  21.133 -        customizerPanel.add(noCustomizerLabel, java.awt.BorderLayout.CENTER);
  21.134 -        noCustomizerLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
  21.135 -
  21.136 -        licensePropertiesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.licensePropertiesPanel.border.title"))); // NOI18N
  21.137 -
  21.138 -        copyrightHolderLabel.setLabelFor(copyrightHolderField);
  21.139 -        copyrightHolderLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.copyrightHolderLabel.text")); // NOI18N
  21.140 -
  21.141 -        copyrightHolderField.setText(System.getProperty("user.name") == null ? "" : System.getProperty("user.name"));
  21.142 -        copyrightHolderField.addFocusListener(new java.awt.event.FocusAdapter() {
  21.143 -            public void focusGained(java.awt.event.FocusEvent evt) {
  21.144 -                copyrightHolderFieldFocusGained(evt);
  21.145 -            }
  21.146 -        });
  21.147 -
  21.148 -        javax.swing.GroupLayout licensePropertiesPanelLayout = new javax.swing.GroupLayout(licensePropertiesPanel);
  21.149 -        licensePropertiesPanel.setLayout(licensePropertiesPanelLayout);
  21.150 -        licensePropertiesPanelLayout.setHorizontalGroup(
  21.151 -            licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.152 -            .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  21.153 -                .addContainerGap()
  21.154 -                .addGroup(licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.155 -                    .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  21.156 -                        .addComponent(copyrightHolderLabel)
  21.157 -                        .addGap(0, 0, Short.MAX_VALUE))
  21.158 -                    .addComponent(copyrightHolderField))
  21.159 -                .addContainerGap())
  21.160 -        );
  21.161 -        licensePropertiesPanelLayout.setVerticalGroup(
  21.162 -            licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.163 -            .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  21.164 -                .addContainerGap()
  21.165 -                .addComponent(copyrightHolderLabel)
  21.166 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  21.167 -                .addComponent(copyrightHolderField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  21.168 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  21.169 -        );
  21.170 -
  21.171 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  21.172 -        this.setLayout(layout);
  21.173 -        layout.setHorizontalGroup(
  21.174 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.175 -            .addGroup(layout.createSequentialGroup()
  21.176 -                .addContainerGap()
  21.177 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.178 -                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 804, Short.MAX_VALUE)
  21.179 -                    .addComponent(jLabel1)
  21.180 -                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  21.181 -                        .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
  21.182 -                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  21.183 -                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  21.184 -                            .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
  21.185 -                            .addComponent(licensePropertiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  21.186 -                .addContainerGap())
  21.187 -        );
  21.188 -        layout.setVerticalGroup(
  21.189 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.190 -            .addGroup(layout.createSequentialGroup()
  21.191 -                .addContainerGap()
  21.192 -                .addComponent(jLabel1)
  21.193 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  21.194 -                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
  21.195 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  21.196 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  21.197 -                    .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
  21.198 -                    .addGroup(layout.createSequentialGroup()
  21.199 -                        .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  21.200 -                        .addGap(18, 18, 18)
  21.201 -                        .addComponent(licensePropertiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  21.202 -                .addContainerGap())
  21.203 -        );
  21.204 -
  21.205 -        jLabel1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title")); // NOI18N
  21.206 -        customizerPanel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title")); // NOI18N
  21.207 -    }// </editor-fold>//GEN-END:initComponents
  21.208 -
  21.209 -    private void copyrightHolderFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_copyrightHolderFieldFocusGained
  21.210 -        copyrightHolderField.selectAll();
  21.211 -    }//GEN-LAST:event_copyrightHolderFieldFocusGained
  21.212 -
  21.213 -
  21.214 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  21.215 -    private javax.swing.JTextField copyrightHolderField;
  21.216 -    private javax.swing.JLabel copyrightHolderLabel;
  21.217 -    private javax.swing.JPanel customizerPanel;
  21.218 -    private javax.swing.JLabel jLabel1;
  21.219 -    private javax.swing.JScrollPane jScrollPane1;
  21.220 -    private javax.swing.JPanel licensePropertiesPanel;
  21.221 -    private org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel lineEndingsPanel1;
  21.222 -    private javax.swing.JLabel noCustomizerLabel;
  21.223 -    // End of variables declaration//GEN-END:variables
  21.224 -    
  21.225 -    @Override
  21.226 -    public ExplorerManager getExplorerManager() {
  21.227 -        return mgr;
  21.228 -    }
  21.229 -
  21.230 -    public Set<FileHandler> getFileHandlers() {
  21.231 -        Set <FileHandler> result = new HashSet<FileHandler>();
  21.232 -        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  21.233 -            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  21.234 -            if (cn!= null && cn.isSelected()) {
  21.235 -                result.addAll (n.getLookup().lookupAll(FileHandler.class));
  21.236 -            }
  21.237 -        }
  21.238 -        return result;
  21.239 -    }
  21.240 -
  21.241 -    @Override
  21.242 -    public void propertyChange(PropertyChangeEvent evt) {
  21.243 -        if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
  21.244 -            Node[] n = mgr.getSelectedNodes();
  21.245 -            updateCustomizer (n.length == 1 ? n[0].getLookup().lookup(Customizable.class) : null);
  21.246 -        }
  21.247 -    }
  21.248 -
  21.249 -    @Override
  21.250 -    public void onNodeChecked(Node node) {
  21.251 -        updateMap();
  21.252 -    }
  21.253 -
  21.254 -    @Override
  21.255 -    public void onNodeUnchecked(Node node) {
  21.256 -        updateMap();
  21.257 -    }
  21.258 -    
  21.259 -    public String getCopyrightHolder() {
  21.260 -        return copyrightHolderField.getText();
  21.261 -    }
  21.262 -
  21.263 -    private static final class FileHandlerChildren extends ChildFactory<FileHandler> {
  21.264 -        @Override
  21.265 -        protected boolean createKeys(List<FileHandler> toPopulate) {
  21.266 -            toPopulate.addAll (Lookup.getDefault().lookupAll(FileHandler.class));
  21.267 -            return true;
  21.268 -        }
  21.269 -
  21.270 -        @Override
  21.271 -        protected Node createNodeForKey(FileHandler key) {
  21.272 -            AbstractNode result = new AbstractNode (Children.LEAF, Lookups.fixed(key,new CheckableNodeCapability()));
  21.273 -            result.setDisplayName(key.getDisplayName());
  21.274 -            return result;
  21.275 -        }
  21.276 -    }
  21.277 -
  21.278 -    private void updateCustomizer(Customizable c) {
  21.279 -        customizerPanel.removeAll();
  21.280 -        customizerPanel.add (c == null ? noCustomizerLabel : c.getCustomizer());
  21.281 -        invalidate();
  21.282 -        revalidate();
  21.283 -        repaint();
  21.284 -    }
  21.285 -    
  21.286 -}
    22.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesWizardPanel.java	Fri Feb 08 11:02:28 2013 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,128 +0,0 @@
    22.4 -/*
    22.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    22.6 - *
    22.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    22.8 - *
    22.9 - * The contents of this file are subject to the terms of either the GNU
   22.10 - * General Public License Version 2 only ("GPL") or the Common
   22.11 - * Development and Distribution License("CDDL") (collectively, the
   22.12 - * "License"). You may not use this file except in compliance with the
   22.13 - * License. You can obtain a copy of the License at
   22.14 - * http://www.netbeans.org/cddl-gplv2.html
   22.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   22.16 - * specific language governing permissions and limitations under the
   22.17 - * License.  When distributing the software, include this License Header
   22.18 - * Notice in each file and include the License file at
   22.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   22.20 - * particular file as subject to the "Classpath" exception as provided
   22.21 - * by Sun in the GPL Version 2 section of the License file that
   22.22 - * accompanied this code. If applicable, add the following below the
   22.23 - * License Header, with the fields enclosed by brackets [] replaced by
   22.24 - * your own identifying information:
   22.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   22.26 - *
   22.27 - * If you wish your version of this file to be governed by only the CDDL
   22.28 - * or only the GPL Version 2, indicate your decision by adding
   22.29 - * "[Contributor] elects to include this software in this distribution
   22.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   22.31 - * single choice of license, a recipient has the option to distribute
   22.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   22.33 - * to extend the choice of license to its licensees as provided above.
   22.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   22.35 - * Version 2 license, then the option applies only if the new code is
   22.36 - * made subject to such option by the copyright holder.
   22.37 - *
   22.38 - * Contributor(s):
   22.39 - *
   22.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   22.41 - */
   22.42 -
   22.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   22.44 -
   22.45 -import java.beans.PropertyChangeEvent;
   22.46 -import java.beans.PropertyChangeListener;
   22.47 -import javax.swing.event.ChangeListener;
   22.48 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   22.49 -import org.openide.WizardDescriptor;
   22.50 -import org.openide.WizardValidationException;
   22.51 -import org.openide.util.ChangeSupport;
   22.52 -import org.openide.util.HelpCtx;
   22.53 -import org.openide.util.NbPreferences;
   22.54 -
   22.55 -/**
   22.56 - * 
   22.57 - * @author Nils Hoffmann
   22.58 - */
   22.59 -public class ChooseFileTypesWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   22.60 -
   22.61 -    /**
   22.62 -     * The visual component that displays this panel. If you need to access the
   22.63 -     * component from this class, just use getComponent().
   22.64 -     */
   22.65 -    private ChooseFileTypesPanel component;
   22.66 -    private WizardDescriptor wiz;
   22.67 -    private boolean valid = true;
   22.68 -    private ChangeSupport cs = new ChangeSupport(this);
   22.69 -
   22.70 -    // Get the visual component for the panel. In this template, the component
   22.71 -    // is kept separate. This can be more efficient: if the wizard is created
   22.72 -    // but never displayed, or not all panels are displayed, it is better to
   22.73 -    // create only those which really need to be visible.
   22.74 -    @Override
   22.75 -    public ChooseFileTypesPanel getComponent() {
   22.76 -        if (component == null) {
   22.77 -            component = new ChooseFileTypesPanel();
   22.78 -            component.addPropertyChangeListener(this);
   22.79 -        }
   22.80 -        return component;
   22.81 -    }
   22.82 -
   22.83 -    @Override
   22.84 -    public HelpCtx getHelp() {
   22.85 -        // Show no Help button for this panel:
   22.86 -        return HelpCtx.DEFAULT_HELP;
   22.87 -        // If you have context help:
   22.88 -        // return new HelpCtx("help.key.here");
   22.89 -    }
   22.90 -
   22.91 -    @Override
   22.92 -    public boolean isValid() {
   22.93 -        return valid;
   22.94 -    }
   22.95 -    
   22.96 -    @Override
   22.97 -    public void addChangeListener(ChangeListener l) {
   22.98 -        cs.addChangeListener(l);
   22.99 -    }
  22.100 -    
  22.101 -    @Override
  22.102 -    public void removeChangeListener(ChangeListener l) {
  22.103 -        cs.removeChangeListener(l);
  22.104 -    }
  22.105 -    
  22.106 -    @Override
  22.107 -    public void propertyChange(PropertyChangeEvent pce) {
  22.108 -        cs.fireChange();
  22.109 -    }
  22.110 -
  22.111 -    @Override
  22.112 -    public void readSettings(WizardDescriptor wiz) {
  22.113 -        this.wiz = wiz;
  22.114 -    }
  22.115 -
  22.116 -    @Override
  22.117 -    public void storeSettings(WizardDescriptor wiz) {
  22.118 -        wiz.putProperty(WizardProperties.KEY_FILE_HANDLERS, getComponent().getFileHandlers());
  22.119 -        String copyrightHolder = getComponent().getCopyrightHolder();
  22.120 -        if (copyrightHolder != null && !copyrightHolder.isEmpty()) {
  22.121 -            wiz.putProperty(WizardProperties.KEY_COPYRIGHT_HOLDER, copyrightHolder);
  22.122 -            NbPreferences.forModule(ChooseFileTypesWizardPanel.class).put(WizardProperties.KEY_COPYRIGHT_HOLDER, copyrightHolder);
  22.123 -        }
  22.124 -    }
  22.125 -
  22.126 -    @Override
  22.127 -    public void validate() throws WizardValidationException {
  22.128 -        valid = true;
  22.129 -    }
  22.130 -
  22.131 -}
    23.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChangerWizardAction.java	Fri Feb 08 11:02:28 2013 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,132 +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.licensechanger.spi.wizard;
   23.44 -
   23.45 -import java.awt.Component;
   23.46 -import java.awt.event.ActionEvent;
   23.47 -import java.awt.event.ActionListener;
   23.48 -import java.text.MessageFormat;
   23.49 -import java.util.ArrayList;
   23.50 -import java.util.HashSet;
   23.51 -import java.util.List;
   23.52 -import java.util.Set;
   23.53 -import javax.swing.JComponent;
   23.54 -import org.netbeans.api.project.*;
   23.55 -import org.netbeans.modules.licensechanger.spi.wizard.utils.LicenseChangerRunnable;
   23.56 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   23.57 -import org.openide.DialogDisplayer;
   23.58 -import org.openide.WizardDescriptor;
   23.59 -import org.openide.awt.ActionID;
   23.60 -import org.openide.awt.ActionReference;
   23.61 -import org.openide.awt.ActionRegistration;
   23.62 -import org.openide.filesystems.FileObject;
   23.63 -import org.openide.loaders.DataObject;
   23.64 -import org.openide.util.*;
   23.65 -
   23.66 -/**
   23.67 - * Context-sensitive action to launch the license header change wizard.
   23.68 - * @author Nils Hoffmann
   23.69 - */
   23.70 -@ActionID(
   23.71 -    category = "Tools",
   23.72 -id = "org.netbeans.modules.licensechanger.wizard.LicenseChangerWizardAction")
   23.73 -@ActionRegistration(
   23.74 -    displayName = "#CTL_LicenseChangerWizardAction")
   23.75 -@ActionReference(path = "Loaders/folder/any/Actions", position = 1550)
   23.76 -@NbBundle.Messages("CTL_LicenseChangerWizardAction=Change License Header")
   23.77 -public final class LicenseChangerWizardAction implements ActionListener {
   23.78 -
   23.79 -    private List<DataObject> context;
   23.80 -    
   23.81 -    public LicenseChangerWizardAction(List<DataObject> context) {
   23.82 -        this.context = context;
   23.83 -    }
   23.84 -    
   23.85 -    @Override
   23.86 -    public void actionPerformed(ActionEvent e) {
   23.87 -        Set<FileObject> files = new HashSet<FileObject>();
   23.88 -        Project owningProject = null;
   23.89 -        for (DataObject ob : context) {
   23.90 -            FileObject fo = ob.getPrimaryFile();
   23.91 -            Project proj = FileOwnerQuery.getOwner(fo);
   23.92 -            if(owningProject == null) {
   23.93 -                owningProject = proj;
   23.94 -                //TODO implement better exclusion of build directories 
   23.95 -                files.add (fo);
   23.96 -            } else {
   23.97 -                if(owningProject.equals(proj)) {
   23.98 -                    files.add(fo);
   23.99 -                } else {
  23.100 -                    Exceptions.printStackTrace(new IllegalStateException("Can only handle folders below one project!"));
  23.101 -                    return;
  23.102 -                }
  23.103 -            }
  23.104 -        }
  23.105 -        
  23.106 -        List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
  23.107 -        panels.add(new ChooseFileTypesWizardPanel());
  23.108 -        panels.add(new LicenseChooserWizardPanel());
  23.109 -        panels.add(new SelectFoldersWizardPanel());
  23.110 -        panels.add(new PreviewWizardPanel());
  23.111 -        String[] steps = new String[panels.size()];
  23.112 -        for (int i = 0; i < panels.size(); i++) {
  23.113 -            Component c = panels.get(i).getComponent();
  23.114 -            // Default step name to component name of panel.
  23.115 -            steps[i] = c.getName();
  23.116 -            if (c instanceof JComponent) { // assume Swing components
  23.117 -                JComponent jc = (JComponent) c;
  23.118 -                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
  23.119 -                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
  23.120 -                jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
  23.121 -                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
  23.122 -                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
  23.123 -            }
  23.124 -        }
  23.125 -        WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
  23.126 -        // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
  23.127 -        wiz.setTitleFormat(new MessageFormat("{0}"));
  23.128 -        wiz.setTitle("Change licenses");
  23.129 -        wiz.putProperty(WizardProperties.KEY_ROOT_FILES, files);
  23.130 -        wiz.putProperty(WizardProperties.KEY_PROJECT, owningProject);
  23.131 -        if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
  23.132 -            RequestProcessor.getDefault().post(new LicenseChangerRunnable(wiz));
  23.133 -        }
  23.134 -    }
  23.135 -}
    24.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.form	Fri Feb 08 11:02:28 2013 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,116 +0,0 @@
    24.4 -<?xml version="1.0" encoding="UTF-8" ?>
    24.5 -
    24.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    24.7 -  <AuxValues>
    24.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    24.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   24.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   24.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   24.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   24.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   24.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   24.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   24.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   24.17 -  </AuxValues>
   24.18 -
   24.19 -  <Layout>
   24.20 -    <DimensionLayout dim="0">
   24.21 -      <Group type="103" groupAlignment="0" attributes="0">
   24.22 -          <Group type="102" alignment="0" attributes="0">
   24.23 -              <EmptySpace max="-2" attributes="0"/>
   24.24 -              <Group type="103" groupAlignment="0" attributes="0">
   24.25 -                  <Component id="jScrollPane2" max="32767" attributes="0"/>
   24.26 -                  <Group type="102" alignment="0" attributes="0">
   24.27 -                      <Component id="chooseLabel" min="-2" max="-2" attributes="0"/>
   24.28 -                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
   24.29 -                      <Component id="selectLicense" max="32767" attributes="0"/>
   24.30 -                  </Group>
   24.31 -                  <Group type="102" alignment="1" attributes="0">
   24.32 -                      <Component id="updateDefaultProjectLicense" min="-2" max="-2" attributes="0"/>
   24.33 -                      <EmptySpace max="32767" attributes="0"/>
   24.34 -                      <Component id="browseButton" min="-2" max="-2" attributes="0"/>
   24.35 -                  </Group>
   24.36 -              </Group>
   24.37 -              <EmptySpace max="-2" attributes="0"/>
   24.38 -          </Group>
   24.39 -      </Group>
   24.40 -    </DimensionLayout>
   24.41 -    <DimensionLayout dim="1">
   24.42 -      <Group type="103" groupAlignment="0" attributes="0">
   24.43 -          <Group type="102" alignment="0" attributes="0">
   24.44 -              <EmptySpace min="-2" max="-2" attributes="0"/>
   24.45 -              <Group type="103" groupAlignment="3" attributes="0">
   24.46 -                  <Component id="chooseLabel" alignment="3" min="-2" max="-2" attributes="0"/>
   24.47 -                  <Component id="selectLicense" alignment="3" min="-2" max="-2" attributes="0"/>
   24.48 -              </Group>
   24.49 -              <EmptySpace max="-2" attributes="0"/>
   24.50 -              <Component id="jScrollPane2" pref="223" max="32767" attributes="0"/>
   24.51 -              <EmptySpace max="-2" attributes="0"/>
   24.52 -              <Group type="103" groupAlignment="0" attributes="0">
   24.53 -                  <Component id="browseButton" min="-2" max="-2" attributes="0"/>
   24.54 -                  <Component id="updateDefaultProjectLicense" min="-2" max="-2" attributes="0"/>
   24.55 -              </Group>
   24.56 -              <EmptySpace max="-2" attributes="0"/>
   24.57 -          </Group>
   24.58 -      </Group>
   24.59 -    </DimensionLayout>
   24.60 -  </Layout>
   24.61 -  <SubComponents>
   24.62 -    <Component class="javax.swing.JLabel" name="chooseLabel">
   24.63 -      <Properties>
   24.64 -        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   24.65 -          <ComponentRef name="selectLicense"/>
   24.66 -        </Property>
   24.67 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   24.68 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LicenseChooserPanel.chooseLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   24.69 -        </Property>
   24.70 -      </Properties>
   24.71 -    </Component>
   24.72 -    <Component class="javax.swing.JComboBox" name="selectLicense">
   24.73 -      <Properties>
   24.74 -        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
   24.75 -          <StringArray count="1">
   24.76 -            <StringItem index="0" value="[loading licenses]"/>
   24.77 -          </StringArray>
   24.78 -        </Property>
   24.79 -      </Properties>
   24.80 -      <Events>
   24.81 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="licenseSelected"/>
   24.82 -      </Events>
   24.83 -    </Component>
   24.84 -    <Component class="javax.swing.JButton" name="browseButton">
   24.85 -      <Properties>
   24.86 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   24.87 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LicenseChooserPanel.browseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   24.88 -        </Property>
   24.89 -      </Properties>
   24.90 -      <Events>
   24.91 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseForLicense"/>
   24.92 -      </Events>
   24.93 -    </Component>
   24.94 -    <Component class="javax.swing.JCheckBox" name="updateDefaultProjectLicense">
   24.95 -      <Properties>
   24.96 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   24.97 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LicenseChooserPanel.updateDefaultProjectLicense.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   24.98 -        </Property>
   24.99 -      </Properties>
  24.100 -    </Component>
  24.101 -    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
  24.102 -      <AuxValues>
  24.103 -        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
  24.104 -      </AuxValues>
  24.105 -
  24.106 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
  24.107 -      <SubComponents>
  24.108 -        <Component class="javax.swing.JEditorPane" name="licenseText">
  24.109 -          <Properties>
  24.110 -            <Property name="editable" type="boolean" value="false"/>
  24.111 -          </Properties>
  24.112 -          <AuxValues>
  24.113 -            <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="licenseText.setContentType(&quot;text/plain&quot;);"/>
  24.114 -          </AuxValues>
  24.115 -        </Component>
  24.116 -      </SubComponents>
  24.117 -    </Container>
  24.118 -  </SubComponents>
  24.119 -</Form>
    25.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.java	Fri Feb 08 11:02:28 2013 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,302 +0,0 @@
    25.4 -/*
    25.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    25.6 - *
    25.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    25.8 - *
    25.9 - * The contents of this file are subject to the terms of either the GNU
   25.10 - * General Public License Version 2 only ("GPL") or the Common
   25.11 - * Development and Distribution License("CDDL") (collectively, the
   25.12 - * "License"). You may not use this file except in compliance with the
   25.13 - * License. You can obtain a copy of the License at
   25.14 - * http://www.netbeans.org/cddl-gplv2.html
   25.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   25.16 - * specific language governing permissions and limitations under the
   25.17 - * License.  When distributing the software, include this License Header
   25.18 - * Notice in each file and include the License file at
   25.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   25.20 - * particular file as subject to the "Classpath" exception as provided
   25.21 - * by Sun in the GPL Version 2 section of the License file that
   25.22 - * accompanied this code. If applicable, add the following below the
   25.23 - * License Header, with the fields enclosed by brackets [] replaced by
   25.24 - * your own identifying information:
   25.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   25.26 - *
   25.27 - * If you wish your version of this file to be governed by only the CDDL
   25.28 - * or only the GPL Version 2, indicate your decision by adding
   25.29 - * "[Contributor] elects to include this software in this distribution
   25.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   25.31 - * single choice of license, a recipient has the option to distribute
   25.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   25.33 - * to extend the choice of license to its licensees as provided above.
   25.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   25.35 - * Version 2 license, then the option applies only if the new code is
   25.36 - * made subject to such option by the copyright holder.
   25.37 - *
   25.38 - * Contributor(s):
   25.39 - *
   25.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   25.41 - */
   25.42 -
   25.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   25.44 -
   25.45 -import java.awt.Component;
   25.46 -import java.awt.EventQueue;
   25.47 -import java.io.File;
   25.48 -import java.io.IOException;
   25.49 -import javax.swing.DefaultComboBoxModel;
   25.50 -import javax.swing.SwingUtilities;
   25.51 -import javax.swing.event.DocumentEvent;
   25.52 -import javax.swing.event.DocumentListener;
   25.53 -import org.netbeans.modules.licensechanger.api.LicenseHeader;
   25.54 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   25.55 -import org.openide.filesystems.FileChooserBuilder;
   25.56 -import org.openide.util.Exceptions;
   25.57 -import org.openide.util.NbBundle;
   25.58 -import org.openide.util.RequestProcessor;
   25.59 -
   25.60 -/**
   25.61 - *
   25.62 - * @author Tim Boudreau
   25.63 - * @author Nils Hoffmann (Refactoring)
   25.64 - */
   25.65 -public class LicenseChooserPanel extends javax.swing.JPanel implements Runnable, DocumentListener {
   25.66 -
   25.67 -    private volatile boolean licensesLoaded;
   25.68 -    private volatile boolean loadingLicenses;
   25.69 -
   25.70 -    /**
   25.71 -     * Creates new form LicenseChooser
   25.72 -     */
   25.73 -    public LicenseChooserPanel() {
   25.74 -        initComponents();
   25.75 -        enabled(false);
   25.76 -        licenseText.getDocument().addDocumentListener(this);
   25.77 -        licenseText.setText(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT);
   25.78 -        setName("Choose License Header");
   25.79 -    }
   25.80 -
   25.81 -    /**
   25.82 -     * This method is called from within the constructor to initialize the form.
   25.83 -     * WARNING: Do NOT modify this code. The content of this method is always
   25.84 -     * regenerated by the Form Editor.
   25.85 -     */
   25.86 -    @SuppressWarnings("unchecked")
   25.87 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   25.88 -    private void initComponents() {
   25.89 -
   25.90 -        chooseLabel = new javax.swing.JLabel();
   25.91 -        selectLicense = new javax.swing.JComboBox();
   25.92 -        browseButton = new javax.swing.JButton();
   25.93 -        updateDefaultProjectLicense = new javax.swing.JCheckBox();
   25.94 -        jScrollPane2 = new javax.swing.JScrollPane();
   25.95 -        licenseText = new javax.swing.JEditorPane();
   25.96 -
   25.97 -        chooseLabel.setLabelFor(selectLicense);
   25.98 -        chooseLabel.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.chooseLabel.text")); // NOI18N
   25.99 -
  25.100 -        selectLicense.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "[loading licenses]" }));
  25.101 -        selectLicense.addActionListener(new java.awt.event.ActionListener() {
  25.102 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  25.103 -                licenseSelected(evt);
  25.104 -            }
  25.105 -        });
  25.106 -
  25.107 -        browseButton.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.browseButton.text")); // NOI18N
  25.108 -        browseButton.addActionListener(new java.awt.event.ActionListener() {
  25.109 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  25.110 -                browseForLicense(evt);
  25.111 -            }
  25.112 -        });
  25.113 -
  25.114 -        updateDefaultProjectLicense.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.updateDefaultProjectLicense.text")); // NOI18N
  25.115 -
  25.116 -        licenseText.setEditable(false);
  25.117 -        jScrollPane2.setViewportView(licenseText);
  25.118 -        licenseText.setContentType("text/plain");
  25.119 -
  25.120 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  25.121 -        this.setLayout(layout);
  25.122 -        layout.setHorizontalGroup(
  25.123 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  25.124 -            .addGroup(layout.createSequentialGroup()
  25.125 -                .addContainerGap()
  25.126 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  25.127 -                    .addComponent(jScrollPane2)
  25.128 -                    .addGroup(layout.createSequentialGroup()
  25.129 -                        .addComponent(chooseLabel)
  25.130 -                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  25.131 -                        .addComponent(selectLicense, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  25.132 -                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  25.133 -                        .addComponent(updateDefaultProjectLicense)
  25.134 -                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  25.135 -                        .addComponent(browseButton)))
  25.136 -                .addContainerGap())
  25.137 -        );
  25.138 -        layout.setVerticalGroup(
  25.139 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  25.140 -            .addGroup(layout.createSequentialGroup()
  25.141 -                .addContainerGap()
  25.142 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  25.143 -                    .addComponent(chooseLabel)
  25.144 -                    .addComponent(selectLicense, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  25.145 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  25.146 -                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
  25.147 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  25.148 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  25.149 -                    .addComponent(browseButton)
  25.150 -                    .addComponent(updateDefaultProjectLicense))
  25.151 -                .addContainerGap())
  25.152 -        );
  25.153 -    }// </editor-fold>//GEN-END:initComponents
  25.154 -
  25.155 -    private void licenseSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_licenseSelected
  25.156 -        if (loadingLicenses || !selectLicense.isEnabled()) {
  25.157 -            return;
  25.158 -        }
  25.159 -        loadLicenseFromResource((LicenseHeader) selectLicense.getSelectedItem());
  25.160 -    }//GEN-LAST:event_licenseSelected
  25.161 -
  25.162 -    private void browseForLicense(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseForLicense
  25.163 -        File f;
  25.164 -        if ((f = new FileChooserBuilder(LicenseChooserPanel.class).setTitle(
  25.165 -                NbBundle.getMessage(LicenseChooserPanel.class, "BROWSE_LICENSE_TITLE")) //NOI18N
  25.166 -                .setFilesOnly(true).showOpenDialog()) != null) {
  25.167 -            updateDefaultProjectLicense.setSelected(false);
  25.168 -            DefaultComboBoxModel dcbm = (DefaultComboBoxModel) selectLicense.getModel();
  25.169 -            LicenseHeader lh = LicenseHeader.fromFile(f);
  25.170 -            LicenseHeader.addAsNetBeansTemplate(lh);
  25.171 -            for(LicenseHeader header:LicenseHeader.fromTemplates()) {
  25.172 -                if(header.getName().equals(lh.getName())) {
  25.173 -                    System.out.println("Found newly added template!");
  25.174 -                    dcbm.addElement(header);
  25.175 -                    dcbm.setSelectedItem(header);
  25.176 -                    loadLicenseFromResource(header);
  25.177 -                }
  25.178 -            }
  25.179 -        }
  25.180 -    }//GEN-LAST:event_browseForLicense
  25.181 -
  25.182 -    @Override
  25.183 -    public void addNotify() {
  25.184 -        super.addNotify();
  25.185 -        if (!licensesLoaded && !loadingLicenses) {
  25.186 -            loadingLicenses = true;
  25.187 -            enabled(false);
  25.188 -            RequestProcessor.getDefault().post(this);
  25.189 -        }
  25.190 -    }
  25.191 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  25.192 -    private javax.swing.JButton browseButton;
  25.193 -    private javax.swing.JLabel chooseLabel;
  25.194 -    private javax.swing.JScrollPane jScrollPane2;
  25.195 -    private javax.swing.JEditorPane licenseText;
  25.196 -    private javax.swing.JComboBox selectLicense;
  25.197 -    private javax.swing.JCheckBox updateDefaultProjectLicense;
  25.198 -    // End of variables declaration//GEN-END:variables
  25.199 -
  25.200 -    private void enabled(boolean val) {
  25.201 -        for (Component c : getComponents()) {
  25.202 -            c.setEnabled(val);
  25.203 -        }
  25.204 -    }
  25.205 -
  25.206 -    private void initLicenses() throws IOException {
  25.207 -        assert !EventQueue.isDispatchThread();
  25.208 -        final DefaultComboBoxModel mdl = new DefaultComboBoxModel();
  25.209 -        for(LicenseHeader header:LicenseHeader.fromTemplates()) {
  25.210 -            mdl.addElement(header);
  25.211 -        }
  25.212 -        EventQueue.invokeLater(new Runnable() {
  25.213 -            @Override
  25.214 -            public void run() {
  25.215 -                mdl.setSelectedItem(NbBundle.getMessage(LicenseChooserPanel.class,
  25.216 -                        "MSG_SELECT_A_LICENSE")); //NOI18N
  25.217 -                selectLicense.setModel(mdl);
  25.218 -                enabled(true);
  25.219 -                licensesLoaded = true;
  25.220 -                loadingLicenses = false;
  25.221 -            }
  25.222 -        });
  25.223 -    }
  25.224 -
  25.225 -    @Override
  25.226 -    public void run() {
  25.227 -        try {
  25.228 -            initLicenses();
  25.229 -        } catch (IOException ex) {
  25.230 -            Exceptions.printStackTrace(ex);
  25.231 -        }
  25.232 -    }
  25.233 -
  25.234 -    private void loadLicenseFromResource(LicenseHeader header) {
  25.235 -        enabled(false);
  25.236 -        SwingUtilities.invokeLater(new ResourceLoader(header));
  25.237 -    }
  25.238 -
  25.239 -    public String getLicenseText() {
  25.240 -        return licenseText.getText();
  25.241 -    }
  25.242 -    
  25.243 -    public String getLicenseName() {
  25.244 -        Object obj = selectLicense.getSelectedItem();
  25.245 -        if(obj!= null && obj instanceof LicenseHeader) {
  25.246 -            LicenseHeader header = (LicenseHeader)obj;
  25.247 -            return header.getName();
  25.248 -        }
  25.249 -        return null;
  25.250 -    }
  25.251 -    
  25.252 -    public boolean isUpdateDefaultProjectLicense() {
  25.253 -        return updateDefaultProjectLicense.isSelected();
  25.254 -    }
  25.255 -    
  25.256 -    public void setUpdateDefaultProjectLicense(boolean b) {
  25.257 -        updateDefaultProjectLicense.setSelected(b);
  25.258 -    }
  25.259 -
  25.260 -    private void updateLicense() {
  25.261 -        System.out.println("Update license called");
  25.262 -        licenseText.setEditable(false);
  25.263 -        String txt = licenseText.getText();
  25.264 -        if (!txt.endsWith("\n")) {
  25.265 -            txt += "\n";
  25.266 -        }
  25.267 -        firePropertyChange(WizardProperties.KEY_LICENSE_TEXT, null, txt);
  25.268 -    }
  25.269 -
  25.270 -    @Override
  25.271 -    public void insertUpdate(DocumentEvent e) {
  25.272 -        updateLicense();
  25.273 -    }
  25.274 -
  25.275 -    @Override
  25.276 -    public void removeUpdate(DocumentEvent e) {
  25.277 -        updateLicense();
  25.278 -    }
  25.279 -
  25.280 -    @Override
  25.281 -    public void changedUpdate(DocumentEvent e) {
  25.282 -        updateLicense();
  25.283 -    }
  25.284 -
  25.285 -    private class ResourceLoader implements Runnable {
  25.286 -
  25.287 -        private LicenseHeader header;
  25.288 -
  25.289 -        ResourceLoader(LicenseHeader header) {
  25.290 -            this.header = header;
  25.291 -        }
  25.292 -        
  25.293 -        @Override
  25.294 -        public void run() {
  25.295 -            licenseText.setText(header.getLicenseHeader());
  25.296 -            String mimeType = header.getFileObject().getMIMEType();
  25.297 -            licenseText.setContentType(mimeType);
  25.298 -            enabled(true);
  25.299 -        }
  25.300 -    }
  25.301 -
  25.302 -    public void setLicenseText(String text) {
  25.303 -        licenseText.setText(text);
  25.304 -    }
  25.305 -}
    26.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserWizardPanel.java	Fri Feb 08 11:02:28 2013 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,149 +0,0 @@
    26.4 -/*
    26.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    26.6 - *
    26.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    26.8 - *
    26.9 - * The contents of this file are subject to the terms of either the GNU
   26.10 - * General Public License Version 2 only ("GPL") or the Common
   26.11 - * Development and Distribution License("CDDL") (collectively, the
   26.12 - * "License"). You may not use this file except in compliance with the
   26.13 - * License. You can obtain a copy of the License at
   26.14 - * http://www.netbeans.org/cddl-gplv2.html
   26.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   26.16 - * specific language governing permissions and limitations under the
   26.17 - * License.  When distributing the software, include this License Header
   26.18 - * Notice in each file and include the License file at
   26.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   26.20 - * particular file as subject to the "Classpath" exception as provided
   26.21 - * by Sun in the GPL Version 2 section of the License file that
   26.22 - * accompanied this code. If applicable, add the following below the
   26.23 - * License Header, with the fields enclosed by brackets [] replaced by
   26.24 - * your own identifying information:
   26.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   26.26 - *
   26.27 - * If you wish your version of this file to be governed by only the CDDL
   26.28 - * or only the GPL Version 2, indicate your decision by adding
   26.29 - * "[Contributor] elects to include this software in this distribution
   26.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   26.31 - * single choice of license, a recipient has the option to distribute
   26.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   26.33 - * to extend the choice of license to its licensees as provided above.
   26.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   26.35 - * Version 2 license, then the option applies only if the new code is
   26.36 - * made subject to such option by the copyright holder.
   26.37 - *
   26.38 - * Contributor(s):
   26.39 - *
   26.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   26.41 - */
   26.42 -
   26.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   26.44 -
   26.45 -import java.beans.PropertyChangeEvent;
   26.46 -import java.beans.PropertyChangeListener;
   26.47 -import javax.swing.event.ChangeListener;
   26.48 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   26.49 -import org.openide.WizardDescriptor;
   26.50 -import org.openide.WizardValidationException;
   26.51 -import org.openide.util.ChangeSupport;
   26.52 -import org.openide.util.HelpCtx;
   26.53 -
   26.54 -/**
   26.55 - * 
   26.56 - * @author Nils Hoffmann
   26.57 - */
   26.58 -public class LicenseChooserWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   26.59 -
   26.60 -    /**
   26.61 -     * The visual component that displays this panel. If you need to access the
   26.62 -     * component from this class, just use getComponent().
   26.63 -     */
   26.64 -    private LicenseChooserPanel component;
   26.65 -    private WizardDescriptor wiz;
   26.66 -    private boolean valid = false;
   26.67 -    private ChangeSupport cs = new ChangeSupport(this);
   26.68 -
   26.69 -    // Get the visual component for the panel. In this template, the component
   26.70 -    // is kept separate. This can be more efficient: if the wizard is created
   26.71 -    // but never displayed, or not all panels are displayed, it is better to
   26.72 -    // create only those which really need to be visible.
   26.73 -    @Override
   26.74 -    public LicenseChooserPanel getComponent() {
   26.75 -        if (component == null) {
   26.76 -            component = new LicenseChooserPanel();
   26.77 -            component.addPropertyChangeListener(this);
   26.78 -        }
   26.79 -        return component;
   26.80 -    }
   26.81 -    
   26.82 -    @Override
   26.83 -    public HelpCtx getHelp() {
   26.84 -        // Show no Help button for this panel:
   26.85 -        return HelpCtx.DEFAULT_HELP;
   26.86 -        // If you have context help:
   26.87 -        // return new HelpCtx("help.key.here");
   26.88 -    }
   26.89 -    
   26.90 -    @Override
   26.91 -    public boolean isValid() {
   26.92 -        return valid;
   26.93 -    }
   26.94 -    
   26.95 -    @Override
   26.96 -    public void addChangeListener(ChangeListener l) {
   26.97 -        cs.addChangeListener(l);
   26.98 -    }
   26.99 -    
  26.100 -    @Override
  26.101 -    public void removeChangeListener(ChangeListener l) {
  26.102 -        cs.removeChangeListener(l);
  26.103 -    }
  26.104 -    
  26.105 -    @Override
  26.106 -    public void propertyChange(PropertyChangeEvent pce) {
  26.107 -        cs.fireChange();
  26.108 -        try{
  26.109 -            validate();
  26.110 -        }catch(WizardValidationException ex) {
  26.111 -            if(wiz!=null) {
  26.112 -                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Please select a license!");
  26.113 -            }
  26.114 -        }
  26.115 -    }
  26.116 -    
  26.117 -    @Override
  26.118 -    public void readSettings(WizardDescriptor wiz) {
  26.119 -        this.wiz = wiz;
  26.120 -        Object obj = wiz.getProperty(WizardProperties.KEY_LICENSE_TEXT);
  26.121 -        if (obj != null && obj instanceof String) {
  26.122 -            getComponent().setLicenseText((String) obj);
  26.123 -        }
  26.124 -        Boolean b = (Boolean)wiz.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
  26.125 -        if(b != null) {
  26.126 -            getComponent().setUpdateDefaultProjectLicense(b);
  26.127 -        }
  26.128 -    }
  26.129 -    
  26.130 -    @Override
  26.131 -    public void storeSettings(WizardDescriptor wiz) {
  26.132 -        wiz.putProperty(WizardProperties.KEY_LICENSE_TEXT, getComponent().getLicenseText());
  26.133 -        wiz.putProperty(WizardProperties.KEY_LICENSE_NAME, getComponent().getLicenseName());
  26.134 -        wiz.putProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE, Boolean.valueOf(getComponent().isUpdateDefaultProjectLicense()));
  26.135 -    }
  26.136 -
  26.137 -    @Override
  26.138 -    public void validate() throws WizardValidationException {
  26.139 -        valid = true;
  26.140 -        if (getComponent().getLicenseText() == null ||
  26.141 -            getComponent().getLicenseText().equals(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT)) {
  26.142 -            valid = false;
  26.143 -            throw new WizardValidationException(component, "Please select a license!", null);
  26.144 -        }
  26.145 -        if(wiz!=null) {
  26.146 -            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  26.147 -            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  26.148 -            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  26.149 -        }
  26.150 -    }
  26.151 -
  26.152 -}
    27.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LineEndingsPanel.form	Fri Feb 08 11:02:28 2013 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,119 +0,0 @@
    27.4 -<?xml version="1.0" encoding="UTF-8" ?>
    27.5 -
    27.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    27.7 -  <NonVisualComponents>
    27.8 -    <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
    27.9 -    </Component>
   27.10 -  </NonVisualComponents>
   27.11 -  <Properties>
   27.12 -    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   27.13 -      <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
   27.14 -        <TitledBorder title="Line Endings">
   27.15 -          <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   27.16 -        </TitledBorder>
   27.17 -      </Border>
   27.18 -    </Property>
   27.19 -  </Properties>
   27.20 -  <AccessibilityProperties>
   27.21 -    <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   27.22 -      <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   27.23 -    </Property>
   27.24 -  </AccessibilityProperties>
   27.25 -  <AuxValues>
   27.26 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
   27.27 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   27.28 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   27.29 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   27.30 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   27.31 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   27.32 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   27.33 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   27.34 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   27.35 -  </AuxValues>
   27.36 -
   27.37 -  <Layout>
   27.38 -    <DimensionLayout dim="0">
   27.39 -      <Group type="103" groupAlignment="0" attributes="0">
   27.40 -          <Group type="102" attributes="0">
   27.41 -              <EmptySpace max="-2" attributes="0"/>
   27.42 -              <Group type="103" groupAlignment="0" attributes="0">
   27.43 -                  <Component id="noChangeButton" alignment="0" min="-2" max="-2" attributes="0"/>
   27.44 -                  <Component id="systemDefaultButton" alignment="0" min="-2" max="-2" attributes="0"/>
   27.45 -                  <Component id="newlineButton" alignment="0" min="-2" max="-2" attributes="0"/>
   27.46 -                  <Component id="forceCrlf" alignment="0" min="-2" max="-2" attributes="0"/>
   27.47 -              </Group>
   27.48 -              <EmptySpace max="32767" attributes="0"/>
   27.49 -          </Group>
   27.50 -      </Group>
   27.51 -    </DimensionLayout>
   27.52 -    <DimensionLayout dim="1">
   27.53 -      <Group type="103" groupAlignment="0" attributes="0">
   27.54 -          <Group type="102" alignment="0" attributes="0">
   27.55 -              <Component id="noChangeButton" min="-2" max="-2" attributes="0"/>
   27.56 -              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   27.57 -              <Component id="systemDefaultButton" min="-2" max="-2" attributes="0"/>
   27.58 -              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   27.59 -              <Component id="newlineButton" min="-2" max="-2" attributes="0"/>
   27.60 -              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   27.61 -              <Component id="forceCrlf" min="-2" max="-2" attributes="0"/>
   27.62 -              <EmptySpace max="32767" attributes="0"/>
   27.63 -          </Group>
   27.64 -      </Group>
   27.65 -    </DimensionLayout>
   27.66 -  </Layout>
   27.67 -  <SubComponents>
   27.68 -    <Component class="javax.swing.JRadioButton" name="noChangeButton">
   27.69 -      <Properties>
   27.70 -        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   27.71 -          <ComponentRef name="buttonGroup1"/>
   27.72 -        </Property>
   27.73 -        <Property name="selected" type="boolean" value="true"/>
   27.74 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   27.75 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.noChangeButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   27.76 -        </Property>
   27.77 -      </Properties>
   27.78 -      <Events>
   27.79 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
   27.80 -      </Events>
   27.81 -    </Component>
   27.82 -    <Component class="javax.swing.JRadioButton" name="systemDefaultButton">
   27.83 -      <Properties>
   27.84 -        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   27.85 -          <ComponentRef name="buttonGroup1"/>
   27.86 -        </Property>
   27.87 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   27.88 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.systemDefaultButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   27.89 -        </Property>
   27.90 -      </Properties>
   27.91 -      <Events>
   27.92 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
   27.93 -      </Events>
   27.94 -    </Component>
   27.95 -    <Component class="javax.swing.JRadioButton" name="newlineButton">
   27.96 -      <Properties>
   27.97 -        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   27.98 -          <ComponentRef name="buttonGroup1"/>
   27.99 -        </Property>
  27.100 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  27.101 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.newlineButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  27.102 -        </Property>
  27.103 -      </Properties>
  27.104 -      <Events>
  27.105 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
  27.106 -      </Events>
  27.107 -    </Component>
  27.108 -    <Component class="javax.swing.JRadioButton" name="forceCrlf">
  27.109 -      <Properties>
  27.110 -        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
  27.111 -          <ComponentRef name="buttonGroup1"/>
  27.112 -        </Property>
  27.113 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  27.114 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="LineEndingsPanel.forceCrlf.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  27.115 -        </Property>
  27.116 -      </Properties>
  27.117 -      <Events>
  27.118 -        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
  27.119 -      </Events>
  27.120 -    </Component>
  27.121 -  </SubComponents>
  27.122 -</Form>
    28.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LineEndingsPanel.java	Fri Feb 08 11:02:28 2013 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,173 +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 -/*
   28.44 - * LineEndingsPanel.java
   28.45 - *
   28.46 - * Created on Mar 20, 2009, 12:33:04 AM
   28.47 - */
   28.48 -
   28.49 -package org.netbeans.modules.licensechanger.spi.wizard;
   28.50 -
   28.51 -import javax.swing.JRadioButton;
   28.52 -import org.netbeans.modules.licensechanger.spi.wizard.utils.LineEndingPreference;
   28.53 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   28.54 -import org.openide.util.NbPreferences;
   28.55 -
   28.56 -/**
   28.57 - *
   28.58 - * @author Administrator
   28.59 - */
   28.60 -public class LineEndingsPanel extends javax.swing.JPanel {
   28.61 -    
   28.62 -    /** Creates new form LineEndingsPanel */
   28.63 -    public LineEndingsPanel() {
   28.64 -        initComponents();
   28.65 -        forceCrlf.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_CRLF);
   28.66 -        noChangeButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE);
   28.67 -        newlineButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_NEWLINE);
   28.68 -        systemDefaultButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.SYSTEM_DEFAULT);
   28.69 -    }
   28.70 -
   28.71 -    /** This method is called from within the constructor to
   28.72 -     * initialize the form.
   28.73 -     * WARNING: Do NOT modify this code. The content of this method is
   28.74 -     * always regenerated by the Form Editor.
   28.75 -     */
   28.76 -    @SuppressWarnings("unchecked")
   28.77 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   28.78 -    private void initComponents() {
   28.79 -
   28.80 -        buttonGroup1 = new javax.swing.ButtonGroup();
   28.81 -        noChangeButton = new javax.swing.JRadioButton();
   28.82 -        systemDefaultButton = new javax.swing.JRadioButton();
   28.83 -        newlineButton = new javax.swing.JRadioButton();
   28.84 -        forceCrlf = new javax.swing.JRadioButton();
   28.85 -
   28.86 -        setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title"))); // NOI18N
   28.87 -
   28.88 -        buttonGroup1.add(noChangeButton);
   28.89 -        noChangeButton.setSelected(true);
   28.90 -        noChangeButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.noChangeButton.text_1")); // NOI18N
   28.91 -        noChangeButton.addActionListener(new java.awt.event.ActionListener() {
   28.92 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
   28.93 -                lineEndingPreferenceChanged(evt);
   28.94 -            }
   28.95 -        });
   28.96 -
   28.97 -        buttonGroup1.add(systemDefaultButton);
   28.98 -        systemDefaultButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.systemDefaultButton.text_1")); // NOI18N
   28.99 -        systemDefaultButton.addActionListener(new java.awt.event.ActionListener() {
  28.100 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  28.101 -                lineEndingPreferenceChanged(evt);
  28.102 -            }
  28.103 -        });
  28.104 -
  28.105 -        buttonGroup1.add(newlineButton);
  28.106 -        newlineButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.newlineButton.text_1")); // NOI18N
  28.107 -        newlineButton.addActionListener(new java.awt.event.ActionListener() {
  28.108 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  28.109 -                lineEndingPreferenceChanged(evt);
  28.110 -            }
  28.111 -        });
  28.112 -
  28.113 -        buttonGroup1.add(forceCrlf);
  28.114 -        forceCrlf.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.forceCrlf.text_1")); // NOI18N
  28.115 -        forceCrlf.addActionListener(new java.awt.event.ActionListener() {
  28.116 -            public void actionPerformed(java.awt.event.ActionEvent evt) {
  28.117 -                lineEndingPreferenceChanged(evt);
  28.118 -            }
  28.119 -        });
  28.120 -
  28.121 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  28.122 -        this.setLayout(layout);
  28.123 -        layout.setHorizontalGroup(
  28.124 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  28.125 -            .addGroup(layout.createSequentialGroup()
  28.126 -                .addContainerGap()
  28.127 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  28.128 -                    .addComponent(noChangeButton)
  28.129 -                    .addComponent(systemDefaultButton)
  28.130 -                    .addComponent(newlineButton)
  28.131 -                    .addComponent(forceCrlf))
  28.132 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  28.133 -        );
  28.134 -        layout.setVerticalGroup(
  28.135 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  28.136 -            .addGroup(layout.createSequentialGroup()
  28.137 -                .addComponent(noChangeButton)
  28.138 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  28.139 -                .addComponent(systemDefaultButton)
  28.140 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  28.141 -                .addComponent(newlineButton)
  28.142 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  28.143 -                .addComponent(forceCrlf)
  28.144 -                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  28.145 -        );
  28.146 -
  28.147 -        getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title")); // NOI18N
  28.148 -    }// </editor-fold>//GEN-END:initComponents
  28.149 -
  28.150 -    private void lineEndingPreferenceChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lineEndingPreferenceChanged
  28.151 -        for (JRadioButton b : new JRadioButton[] { forceCrlf, newlineButton, noChangeButton, systemDefaultButton }) {
  28.152 -            if (b.isSelected()) {
  28.153 -                LineEndingPreference x = (LineEndingPreference) b.getClientProperty(WizardProperties.PROP_ENDING);
  28.154 -                if (x != null) {
  28.155 -                    NbPreferences.forModule(LineEndingsPanel.class).put(WizardProperties.PROP_ENDING, x.name());
  28.156 -                }
  28.157 -                break;
  28.158 -            }
  28.159 -        }
  28.160 -    }//GEN-LAST:event_lineEndingPreferenceChanged
  28.161 -
  28.162 -    public static LineEndingPreference getLineEndingPrefs() {
  28.163 -        String ending = NbPreferences.forModule(LineEndingsPanel.class).get(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE.name());
  28.164 -        return LineEndingPreference.valueOf(ending);
  28.165 -    }
  28.166 -
  28.167 -
  28.168 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  28.169 -    private javax.swing.ButtonGroup buttonGroup1;
  28.170 -    private javax.swing.JRadioButton forceCrlf;
  28.171 -    private javax.swing.JRadioButton newlineButton;
  28.172 -    private javax.swing.JRadioButton noChangeButton;
  28.173 -    private javax.swing.JRadioButton systemDefaultButton;
  28.174 -    // End of variables declaration//GEN-END:variables
  28.175 -
  28.176 -}
    29.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.form	Fri Feb 08 11:02:28 2013 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,101 +0,0 @@
    29.4 -<?xml version="1.0" encoding="UTF-8" ?>
    29.5 -
    29.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    29.7 -  <AuxValues>
    29.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    29.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   29.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   29.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   29.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   29.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   29.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   29.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   29.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   29.17 -  </AuxValues>
   29.18 -
   29.19 -  <Layout>
   29.20 -    <DimensionLayout dim="0">
   29.21 -      <Group type="103" groupAlignment="0" attributes="0">
   29.22 -          <Group type="102" alignment="1" attributes="0">
   29.23 -              <EmptySpace max="-2" attributes="0"/>
   29.24 -              <Group type="103" groupAlignment="1" attributes="0">
   29.25 -                  <Component id="jSplitPane1" alignment="0" max="32767" attributes="0"/>
   29.26 -                  <Component id="jLabel3" alignment="0" max="32767" attributes="0"/>
   29.27 -              </Group>
   29.28 -              <EmptySpace max="-2" attributes="0"/>
   29.29 -          </Group>
   29.30 -      </Group>
   29.31 -    </DimensionLayout>
   29.32 -    <DimensionLayout dim="1">
   29.33 -      <Group type="103" groupAlignment="0" attributes="0">
   29.34 -          <Group type="102" alignment="1" attributes="0">
   29.35 -              <EmptySpace max="-2" attributes="0"/>
   29.36 -              <Component id="jSplitPane1" pref="408" max="32767" attributes="0"/>
   29.37 -              <EmptySpace max="-2" attributes="0"/>
   29.38 -              <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
   29.39 -          </Group>
   29.40 -      </Group>
   29.41 -    </DimensionLayout>
   29.42 -  </Layout>
   29.43 -  <SubComponents>
   29.44 -    <Container class="javax.swing.JSplitPane" name="jSplitPane1">
   29.45 -      <Properties>
   29.46 -        <Property name="dividerLocation" type="int" value="200"/>
   29.47 -        <Property name="orientation" type="int" value="0"/>
   29.48 -        <Property name="resizeWeight" type="double" value="0.5"/>
   29.49 -      </Properties>
   29.50 -
   29.51 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
   29.52 -      <SubComponents>
   29.53 -        <Container class="javax.swing.JScrollPane" name="fileList">
   29.54 -          <Properties>
   29.55 -            <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   29.56 -              <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
   29.57 -                <TitledBorder title="Select File for Preview">
   29.58 -                  <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="PreviewPanel.fileList.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   29.59 -                </TitledBorder>
   29.60 -              </Border>
   29.61 -            </Property>
   29.62 -          </Properties>
   29.63 -          <AuxValues>
   29.64 -            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
   29.65 -          </AuxValues>
   29.66 -          <Constraints>
   29.67 -            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
   29.68 -              <JSplitPaneConstraints position="top"/>
   29.69 -            </Constraint>
   29.70 -          </Constraints>
   29.71 -
   29.72 -          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   29.73 -        </Container>
   29.74 -        <Container class="javax.swing.JPanel" name="diffPanel">
   29.75 -          <Constraints>
   29.76 -            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
   29.77 -              <JSplitPaneConstraints position="right"/>
   29.78 -            </Constraint>
   29.79 -          </Constraints>
   29.80 -
   29.81 -          <Layout>
   29.82 -            <DimensionLayout dim="0">
   29.83 -              <Group type="103" groupAlignment="0" attributes="0">
   29.84 -                  <EmptySpace min="0" pref="417" max="32767" attributes="0"/>
   29.85 -              </Group>
   29.86 -            </DimensionLayout>
   29.87 -            <DimensionLayout dim="1">
   29.88 -              <Group type="103" groupAlignment="0" attributes="0">
   29.89 -                  <EmptySpace min="0" pref="202" max="32767" attributes="0"/>
   29.90 -              </Group>
   29.91 -            </DimensionLayout>
   29.92 -          </Layout>
   29.93 -        </Container>
   29.94 -      </SubComponents>
   29.95 -    </Container>
   29.96 -    <Component class="javax.swing.JLabel" name="jLabel3">
   29.97 -      <Properties>
   29.98 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   29.99 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="PreviewPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  29.100 -        </Property>
  29.101 -      </Properties>
  29.102 -    </Component>
  29.103 -  </SubComponents>
  29.104 -</Form>
    30.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.java	Fri Feb 08 11:02:28 2013 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,361 +0,0 @@
    30.4 -/*
    30.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    30.6 - *
    30.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    30.8 - *
    30.9 - * The contents of this file are subject to the terms of either the GNU
   30.10 - * General Public License Version 2 only ("GPL") or the Common
   30.11 - * Development and Distribution License("CDDL") (collectively, the
   30.12 - * "License"). You may not use this file except in compliance with the
   30.13 - * License. You can obtain a copy of the License at
   30.14 - * http://www.netbeans.org/cddl-gplv2.html
   30.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   30.16 - * specific language governing permissions and limitations under the
   30.17 - * License.  When distributing the software, include this License Header
   30.18 - * Notice in each file and include the License file at
   30.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   30.20 - * particular file as subject to the "Classpath" exception as provided
   30.21 - * by Sun in the GPL Version 2 section of the License file that
   30.22 - * accompanied this code. If applicable, add the following below the
   30.23 - * License Header, with the fields enclosed by brackets [] replaced by
   30.24 - * your own identifying information:
   30.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   30.26 - *
   30.27 - * If you wish your version of this file to be governed by only the CDDL
   30.28 - * or only the GPL Version 2, indicate your decision by adding
   30.29 - * "[Contributor] elects to include this software in this distribution
   30.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   30.31 - * single choice of license, a recipient has the option to distribute
   30.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   30.33 - * to extend the choice of license to its licensees as provided above.
   30.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   30.35 - * Version 2 license, then the option applies only if the new code is
   30.36 - * made subject to such option by the copyright holder.
   30.37 - *
   30.38 - * Contributor(s):
   30.39 - *
   30.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   30.41 - */
   30.42 -
   30.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   30.44 -
   30.45 -import java.awt.EventQueue;
   30.46 -import java.beans.PropertyChangeEvent;
   30.47 -import java.beans.PropertyChangeListener;
   30.48 -import java.io.ByteArrayOutputStream;
   30.49 -import java.io.IOException;
   30.50 -import java.io.PrintWriter;
   30.51 -import java.io.StringReader;
   30.52 -import java.util.Collections;
   30.53 -import java.util.HashSet;
   30.54 -import java.util.Map;
   30.55 -import java.util.Set;
   30.56 -import org.netbeans.api.diff.Diff;
   30.57 -import org.netbeans.api.diff.DiffView;
   30.58 -import org.netbeans.api.diff.StreamSource;
   30.59 -import org.netbeans.modules.licensechanger.api.FileHandler;
   30.60 -import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
   30.61 -import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren;
   30.62 -import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren.FileItem;
   30.63 -import org.netbeans.modules.licensechanger.spi.wizard.utils.FileLoader;
   30.64 -import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
   30.65 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   30.66 -import org.openide.explorer.ExplorerManager;
   30.67 -import org.openide.explorer.view.CheckableNode;
   30.68 -import org.openide.filesystems.FileObject;
   30.69 -import org.openide.nodes.AbstractNode;
   30.70 -import org.openide.nodes.Children;
   30.71 -import org.openide.nodes.Node;
   30.72 -import org.openide.util.Exceptions;
   30.73 -import org.openide.util.RequestProcessor;
   30.74 -import org.openide.util.RequestProcessor.Task;
   30.75 -
   30.76 -/**
   30.77 - *
   30.78 - * @author Tim Boudreau
   30.79 - * @author Nils Hoffmann (Refactoring, Diff API inclusion)
   30.80 - */
   30.81 -public class PreviewPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
   30.82 -
   30.83 -    private final ExplorerManager mgr = new ExplorerManager();
   30.84 -    private ItemLoader loader;
   30.85 -    private String licenseText;
   30.86 -    private Diff diff;
   30.87 -    private Map<String, Object> properties;
   30.88 -
   30.89 -    public PreviewPanel() {
   30.90 -        diff = Diff.getDefault();
   30.91 -        initComponents();
   30.92 -        mgr.addPropertyChangeListener(this);
   30.93 -        jLabel3.setText ("  ");
   30.94 -        view().setNodeCheckObserver(this);
   30.95 -        setName("Preview Changes");
   30.96 -    }
   30.97 -    
   30.98 -    public void setFolders(Set<FileObject> folders, Set<FileHandler> fileHandler) {
   30.99 -        Children kids = Children.create(new FileChildren(folders,fileHandler), true);
  30.100 -        mgr.setRootContext(new AbstractNode(kids));
  30.101 -        view().setCheckboxesVisible(true);
  30.102 -        view().setCheckboxesEnabled(true);
  30.103 -        view().setListEnabled(true);
  30.104 -        updateItems();
  30.105 -    }
  30.106 -
  30.107 -    public Set<FileItem> getSelectedItems() {
  30.108 -        Set<FileItem> s = new HashSet<FileItem>();
  30.109 -        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  30.110 -            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  30.111 -            if (cn!= null && cn.isSelected()) {
  30.112 -                s.addAll(n.getLookup().lookupAll(FileItem.class));
  30.113 -            }
  30.114 -        }
  30.115 -        return s;
  30.116 -    }
  30.117 -    
  30.118 -    private void updateItems() {
  30.119 -        Set<FileItem> s = getSelectedItems();
  30.120 -        firePropertyChange(WizardProperties.KEY_ITEMS, null, s);
  30.121 -    }
  30.122 -
  30.123 -    private CheckboxListView view() {
  30.124 -        return (CheckboxListView) fileList;
  30.125 -    }
  30.126 -
  30.127 -    public void setLicenseText(String licenseText) {
  30.128 -        this.licenseText = licenseText;
  30.129 -        firePropertyChange(WizardProperties.KEY_LICENSE_TEXT, null, this.licenseText);
  30.130 -    }
  30.131 -    
  30.132 -    void setProperties(Map<String, Object> properties) {
  30.133 -        this.properties = properties;
  30.134 -    }
  30.135 -
  30.136 -    /** This method is called from within the constructor to
  30.137 -     * initialize the form.
  30.138 -     * WARNING: Do NOT modify this code. The content of this method is
  30.139 -     * always regenerated by the Form Editor.
  30.140 -     */
  30.141 -    @SuppressWarnings("unchecked")
  30.142 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  30.143 -    private void initComponents() {
  30.144 -
  30.145 -        jSplitPane1 = new javax.swing.JSplitPane();
  30.146 -        fileList = new CheckboxListView();
  30.147 -        diffPanel = new javax.swing.JPanel();
  30.148 -        jLabel3 = new javax.swing.JLabel();
  30.149 -
  30.150 -        jSplitPane1.setDividerLocation(200);
  30.151 -        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
  30.152 -        jSplitPane1.setResizeWeight(0.5);
  30.153 -
  30.154 -        fileList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.fileList.border.title"))); // NOI18N
  30.155 -        jSplitPane1.setTopComponent(fileList);
  30.156 -
  30.157 -        javax.swing.GroupLayout diffPanelLayout = new javax.swing.GroupLayout(diffPanel);
  30.158 -        diffPanel.setLayout(diffPanelLayout);
  30.159 -        diffPanelLayout.setHorizontalGroup(
  30.160 -            diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  30.161 -            .addGap(0, 417, Short.MAX_VALUE)
  30.162 -        );
  30.163 -        diffPanelLayout.setVerticalGroup(
  30.164 -            diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  30.165 -            .addGap(0, 202, Short.MAX_VALUE)
  30.166 -        );
  30.167 -
  30.168 -        jSplitPane1.setRightComponent(diffPanel);
  30.169 -
  30.170 -        jLabel3.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel3.text")); // NOI18N
  30.171 -
  30.172 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  30.173 -        this.setLayout(layout);
  30.174 -        layout.setHorizontalGroup(
  30.175 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  30.176 -            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  30.177 -                .addContainerGap()
  30.178 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  30.179 -                    .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.LEADING)
  30.180 -                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  30.181 -                .addContainerGap())
  30.182 -        );
  30.183 -        layout.setVerticalGroup(
  30.184 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  30.185 -            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  30.186 -                .addContainerGap()
  30.187 -                .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)
  30.188 -                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  30.189 -                .addComponent(jLabel3))
  30.190 -        );
  30.191 -    }// </editor-fold>//GEN-END:initComponents
  30.192 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  30.193 -    private javax.swing.JPanel diffPanel;
  30.194 -    private javax.swing.JScrollPane fileList;
  30.195 -    private javax.swing.JLabel jLabel3;
  30.196 -    private javax.swing.JSplitPane jSplitPane1;
  30.197 -    // End of variables declaration//GEN-END:variables
  30.198 -
  30.199 -    @Override
  30.200 -    public ExplorerManager getExplorerManager() {
  30.201 -        return mgr;
  30.202 -    }
  30.203 -
  30.204 -    @Override
  30.205 -    public void propertyChange(PropertyChangeEvent evt) {
  30.206 -        if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
  30.207 -            Node[] n = mgr.getSelectedNodes();
  30.208 -            if (n.length > 0) {
  30.209 -                FileItem item = n[0].getLookup().lookup(FileItem.class);
  30.210 -                if (item != null) {
  30.211 -                    setFileItem(item);
  30.212 -                    // XXX use FileUtil.getFileDisplayName rather than FileObject.getPath
  30.213 -                    
  30.214 -                    jLabel3.setText (item.getFile().getPath());
  30.215 -                } else {
  30.216 -//                    before.setText("");
  30.217 -                    jLabel3.setText ("  ");
  30.218 -                }
  30.219 -            } else {
  30.220 -//                before.setText("");
  30.221 -//                after.setText("");
  30.222 -                jLabel3.setText("  ");
  30.223 -            }
  30.224 -        }
  30.225 -    }
  30.226 -
  30.227 -    private void setFileItem(FileItem item) {
  30.228 -        if (item.getFile().isValid()) {
  30.229 -            // XXX should use Diff API instead (like refactoring preview)
  30.230 -//            before.setContentType("text/plain");
  30.231 -//            after.setContentType("text/plain");
  30.232 -//            before.setText("Loading " + item.getFile().getPath());
  30.233 -//            after.setText("Loading " + item.getFile().getPath());
  30.234 -            ItemLoader ldr = new ItemLoader(item);
  30.235 -            setLoader(ldr);
  30.236 -        }
  30.237 -    }
  30.238 -
  30.239 -    private synchronized void setLoader(ItemLoader ldr) {
  30.240 -        if (loader != null) {
  30.241 -            loader.cancel();
  30.242 -        }
  30.243 -        this.loader = ldr;
  30.244 -        loader.start();
  30.245 -    }
  30.246 -
  30.247 -    @Override
  30.248 -    public void onNodeChecked(Node node) {
  30.249 -        updateItems();
  30.250 -    }
  30.251 -
  30.252 -    @Override
  30.253 -    public void onNodeUnchecked(Node node) {
  30.254 -        updateItems();
  30.255 -    }
  30.256 -
  30.257 -    private class ItemLoader implements Runnable {
  30.258 -
  30.259 -        private final Task task;
  30.260 -        private volatile boolean cancelled;
  30.261 -        private final FileItem item;
  30.262 -        private volatile String beforeText = "Cancelled";
  30.263 -        private volatile String afterText = "Cancelled";
  30.264 -
  30.265 -        public ItemLoader(FileItem item) {
  30.266 -            this.item = item;
  30.267 -            task = RequestProcessor.getDefault().create(this);
  30.268 -        }
  30.269 -
  30.270 -        void start() {
  30.271 -            task.schedule(200);
  30.272 -        }
  30.273 -
  30.274 -        public void cancel() {
  30.275 -            cancelled = true;
  30.276 -            task.cancel();
  30.277 -        }
  30.278 -
  30.279 -        private void loadFile() throws IOException {
  30.280 -            beforeText = FileLoader.loadFile(item.getFile());
  30.281 -        }
  30.282 -
  30.283 -        @Override
  30.284 -        public void run() {
  30.285 -            if (cancelled) {
  30.286 -                return;
  30.287 -            }
  30.288 -            if (!EventQueue.isDispatchThread()) {
  30.289 -                try {
  30.290 -                    if (cancelled) {
  30.291 -                        return;
  30.292 -                    }
  30.293 -                    if (!item.getFile().isValid()) {
  30.294 -                        beforeText = "Invalid file";
  30.295 -                        afterText = "Invalid file";
  30.296 -                        return;
  30.297 -                    }
  30.298 -                    if (!item.getFile().canRead()) {
  30.299 -                        beforeText = "Cannot read " + item.getFile().getPath();
  30.300 -                        afterText = "Cannot read " + item.getFile().getPath();
  30.301 -                        return;
  30.302 -                    }
  30.303 -                    if (item.getFile().getSize() >= Integer.MAX_VALUE) {
  30.304 -                        beforeText = "File too long: " + item.getFile().getPath();
  30.305 -                        afterText = "File too long: " + item.getFile().getPath();
  30.306 -                        return;
  30.307 -                    }
  30.308 -                    if (item.getFile().getSize() == 0) {
  30.309 -                        beforeText = "Empty file";
  30.310 -                        afterText = "Empty file";
  30.311 -                        return;
  30.312 -                    }
  30.313 -                    if (cancelled) {
  30.314 -                        return;
  30.315 -                    }
  30.316 -                    try {
  30.317 -                        loadFile();
  30.318 -                    } catch (IOException ex) {
  30.319 -                        ByteArrayOutputStream out = new ByteArrayOutputStream();
  30.320 -                        PrintWriter w = new PrintWriter(out);
  30.321 -                        ex.printStackTrace(w);
  30.322 -                        beforeText = new String(out.toByteArray());
  30.323 -                        afterText = "Error";
  30.324 -                        return;
  30.325 -                    }
  30.326 -                    if (cancelled) {
  30.327 -                        return;
  30.328 -                    }
  30.329 -                    if (beforeText.length() == 0) {
  30.330 -                        afterText = "";
  30.331 -                        return;
  30.332 -                    }
  30.333 -                    afterText = transform(beforeText, item.getHandler());
  30.334 -                } finally {
  30.335 -                    if (!cancelled) {
  30.336 -                        EventQueue.invokeLater(this);
  30.337 -                    }
  30.338 -                }
  30.339 -            } else {
  30.340 -                String contentType = item.getFile().getMIMEType();
  30.341 -                DiffView view;
  30.342 -                try {
  30.343 -                    view = diff.createDiff(StreamSource.createSource("Before", "Before", contentType, new StringReader(beforeText)),
  30.344 -                           StreamSource.createSource("After", "After", contentType, new StringReader(afterText)));
  30.345 -                    int dloc = jSplitPane1.getDividerLocation();
  30.346 -                    jSplitPane1.setBottomComponent(view.getComponent());
  30.347 -                    jSplitPane1.setDividerLocation(dloc);
  30.348 -                } catch (IOException ex) {
  30.349 -                    Exceptions.printStackTrace(ex);
  30.350 -                    int dloc = jSplitPane1.getDividerLocation();
  30.351 -                    jSplitPane1.setBottomComponent(diffPanel);
  30.352 -                    jSplitPane1.setDividerLocation(dloc);
  30.353 -                }
  30.354 -                
  30.355 -            }
  30.356 -        }
  30.357 -
  30.358 -        private String transform(String beforeText, FileHandler handler) {
  30.359 -            return handler.transform(beforeText, licenseText, 
  30.360 -                    properties == null ? Collections.<String,Object>emptyMap() : 
  30.361 -                    properties);
  30.362 -        }
  30.363 -    }
  30.364 -}
    31.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewWizardPanel.java	Fri Feb 08 11:02:28 2013 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,154 +0,0 @@
    31.4 -/*
    31.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    31.6 - *
    31.7 - * Copyright 2009 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 2009 Sun Microsystems, Inc.
   31.41 - */
   31.42 -
   31.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   31.44 -
   31.45 -import java.beans.PropertyChangeEvent;
   31.46 -import java.beans.PropertyChangeListener;
   31.47 -import java.util.Set;
   31.48 -import javax.swing.event.ChangeListener;
   31.49 -import org.netbeans.modules.licensechanger.api.FileHandler;
   31.50 -import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren.FileItem;
   31.51 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   31.52 -import org.openide.WizardDescriptor;
   31.53 -import org.openide.WizardValidationException;
   31.54 -import org.openide.filesystems.FileObject;
   31.55 -import org.openide.util.ChangeSupport;
   31.56 -import org.openide.util.HelpCtx;
   31.57 -
   31.58 -/**
   31.59 - * 
   31.60 - * @author Nils Hoffmann
   31.61 - */
   31.62 -public class PreviewWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener{
   31.63 -
   31.64 -    /**
   31.65 -     * The visual component that displays this panel. If you need to access the
   31.66 -     * component from this class, just use getComponent().
   31.67 -     */
   31.68 -    private PreviewPanel component;
   31.69 -    private WizardDescriptor wiz;
   31.70 -    private boolean valid = true;
   31.71 -    private ChangeSupport cs = new ChangeSupport(this);
   31.72 -
   31.73 -    // Get the visual component for the panel. In this template, the component
   31.74 -    // is kept separate. This can be more efficient: if the wizard is created
   31.75 -    // but never displayed, or not all panels are displayed, it is better to
   31.76 -    // create only those which really need to be visible.
   31.77 -    @Override
   31.78 -    public PreviewPanel getComponent() {
   31.79 -        if (component == null) {
   31.80 -            component = new PreviewPanel();
   31.81 -            component.addPropertyChangeListener(this);
   31.82 -        }
   31.83 -        return component;
   31.84 -    }
   31.85 -
   31.86 -    @Override
   31.87 -    public HelpCtx getHelp() {
   31.88 -        // Show no Help button for this panel:
   31.89 -        return HelpCtx.DEFAULT_HELP;
   31.90 -        // If you have context help:
   31.91 -        // return new HelpCtx("help.key.here");
   31.92 -    }
   31.93 -
   31.94 -    @Override
   31.95 -    public boolean isValid() {
   31.96 -        return valid;
   31.97 -    }
   31.98 -    
   31.99 -    @Override
  31.100 -    public void addChangeListener(ChangeListener l) {
  31.101 -        cs.addChangeListener(l);
  31.102 -    }
  31.103 -    
  31.104 -    @Override
  31.105 -    public void removeChangeListener(ChangeListener l) {
  31.106 -        cs.removeChangeListener(l);
  31.107 -    }
  31.108 -    
  31.109 -    @Override
  31.110 -    public void propertyChange(PropertyChangeEvent pce) {
  31.111 -        cs.fireChange();
  31.112 -        try {
  31.113 -            validate();
  31.114 -        } catch (WizardValidationException ex) {
  31.115 -            if(wiz!=null) {
  31.116 -                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
  31.117 -            }
  31.118 -        }
  31.119 -    }
  31.120 -
  31.121 -    @Override
  31.122 -    public void readSettings(WizardDescriptor wiz) {
  31.123 -        this.wiz = wiz;
  31.124 -        String license = (String)wiz.getProperty(WizardProperties.KEY_LICENSE_TEXT);
  31.125 -        if(license!=null) {
  31.126 -            getComponent().setLicenseText(license);
  31.127 -        }
  31.128 -        getComponent().setProperties(wiz.getProperties());
  31.129 -        Set<FileHandler> fileHandler = (Set<FileHandler>)wiz.getProperty(WizardProperties.KEY_FILE_HANDLERS);
  31.130 -        Set<FileObject> folders = (Set<FileObject>)wiz.getProperty(WizardProperties.KEY_FOLDERS);
  31.131 -        if(fileHandler!=null && folders != null) {
  31.132 -            getComponent().setFolders(folders, fileHandler);
  31.133 -        }
  31.134 -        wiz.putProperty(WizardProperties.KEY_ITEMS, null);
  31.135 -    }
  31.136 -
  31.137 -    @Override
  31.138 -    public void storeSettings(WizardDescriptor wiz) {
  31.139 -        wiz.putProperty(WizardProperties.KEY_ITEMS, getComponent().getSelectedItems());
  31.140 -    }
  31.141 -
  31.142 -    @Override
  31.143 -    public void validate() throws WizardValidationException {
  31.144 -        valid = true;
  31.145 -        Set<FileItem> keyItems = (Set<FileItem>)getComponent().getSelectedItems();
  31.146 -        
  31.147 -        if(keyItems==null || keyItems.isEmpty()) {
  31.148 -            valid = false;
  31.149 -            throw new WizardValidationException(component, "Please select at least one file!", null);
  31.150 -        }
  31.151 -        if(wiz!=null) {
  31.152 -            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  31.153 -            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  31.154 -            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  31.155 -        }
  31.156 -    }
  31.157 -}
    32.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersPanel.form	Fri Feb 08 11:02:28 2013 +0100
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,66 +0,0 @@
    32.4 -<?xml version="1.0" encoding="UTF-8" ?>
    32.5 -
    32.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    32.7 -  <AuxValues>
    32.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    32.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   32.10 -    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   32.11 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   32.12 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   32.13 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   32.14 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   32.15 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   32.16 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   32.17 -  </AuxValues>
   32.18 -
   32.19 -  <Layout>
   32.20 -    <DimensionLayout dim="0">
   32.21 -      <Group type="103" groupAlignment="0" attributes="0">
   32.22 -          <Group type="102" alignment="0" attributes="0">
   32.23 -              <EmptySpace max="-2" attributes="0"/>
   32.24 -              <Group type="103" groupAlignment="0" attributes="0">
   32.25 -                  <Component id="jScrollPane1" alignment="0" pref="541" max="32767" attributes="0"/>
   32.26 -                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
   32.27 -              </Group>
   32.28 -              <EmptySpace max="-2" attributes="0"/>
   32.29 -          </Group>
   32.30 -      </Group>
   32.31 -    </DimensionLayout>
   32.32 -    <DimensionLayout dim="1">
   32.33 -      <Group type="103" groupAlignment="0" attributes="0">
   32.34 -          <Group type="102" alignment="0" attributes="0">
   32.35 -              <EmptySpace max="-2" attributes="0"/>
   32.36 -              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   32.37 -              <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
   32.38 -              <Component id="jScrollPane1" pref="364" max="32767" attributes="0"/>
   32.39 -              <EmptySpace max="-2" attributes="0"/>
   32.40 -          </Group>
   32.41 -      </Group>
   32.42 -    </DimensionLayout>
   32.43 -  </Layout>
   32.44 -  <SubComponents>
   32.45 -    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
   32.46 -      <Properties>
   32.47 -        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   32.48 -          <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
   32.49 -            <LineBorder>
   32.50 -              <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
   32.51 -            </LineBorder>
   32.52 -          </Border>
   32.53 -        </Property>
   32.54 -      </Properties>
   32.55 -      <AuxValues>
   32.56 -        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
   32.57 -      </AuxValues>
   32.58 -
   32.59 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   32.60 -    </Container>
   32.61 -    <Component class="javax.swing.JLabel" name="jLabel1">
   32.62 -      <Properties>
   32.63 -        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   32.64 -          <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="SelectFoldersPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   32.65 -        </Property>
   32.66 -      </Properties>
   32.67 -    </Component>
   32.68 -  </SubComponents>
   32.69 -</Form>
    33.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersPanel.java	Fri Feb 08 11:02:28 2013 +0100
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,169 +0,0 @@
    33.4 -/*
    33.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    33.6 - *
    33.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    33.8 - *
    33.9 - * The contents of this file are subject to the terms of either the GNU
   33.10 - * General Public License Version 2 only ("GPL") or the Common
   33.11 - * Development and Distribution License("CDDL") (collectively, the
   33.12 - * "License"). You may not use this file except in compliance with the
   33.13 - * License. You can obtain a copy of the License at
   33.14 - * http://www.netbeans.org/cddl-gplv2.html
   33.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   33.16 - * specific language governing permissions and limitations under the
   33.17 - * License.  When distributing the software, include this License Header
   33.18 - * Notice in each file and include the License file at
   33.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   33.20 - * particular file as subject to the "Classpath" exception as provided
   33.21 - * by Sun in the GPL Version 2 section of the License file that
   33.22 - * accompanied this code. If applicable, add the following below the
   33.23 - * License Header, with the fields enclosed by brackets [] replaced by
   33.24 - * your own identifying information:
   33.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   33.26 - *
   33.27 - * If you wish your version of this file to be governed by only the CDDL
   33.28 - * or only the GPL Version 2, indicate your decision by adding
   33.29 - * "[Contributor] elects to include this software in this distribution
   33.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   33.31 - * single choice of license, a recipient has the option to distribute
   33.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   33.33 - * to extend the choice of license to its licensees as provided above.
   33.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   33.35 - * Version 2 license, then the option applies only if the new code is
   33.36 - * made subject to such option by the copyright holder.
   33.37 - *
   33.38 - * Contributor(s):
   33.39 - *
   33.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   33.41 - */
   33.42 -
   33.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   33.44 -
   33.45 -import java.util.HashSet;
   33.46 -import java.util.Set;
   33.47 -import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
   33.48 -import org.netbeans.modules.licensechanger.spi.wizard.utils.FolderChildren;
   33.49 -import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
   33.50 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   33.51 -import org.openide.explorer.ExplorerManager;
   33.52 -import org.openide.explorer.view.CheckableNode;
   33.53 -import org.openide.filesystems.FileObject;
   33.54 -import org.openide.nodes.AbstractNode;
   33.55 -import org.openide.nodes.Children;
   33.56 -import org.openide.nodes.Node;
   33.57 -
   33.58 -/**
   33.59 - *
   33.60 - * @author Tim Boudreau
   33.61 - * @author Nils Hoffmann (Refactoring)
   33.62 - */
   33.63 -public class SelectFoldersPanel extends javax.swing.JPanel implements ExplorerManager.Provider, NodeCheckObserver {
   33.64 -
   33.65 -    private final ExplorerManager mgr = new ExplorerManager();
   33.66 -
   33.67 -    public SelectFoldersPanel() {
   33.68 -        initComponents();
   33.69 -        view().setNodeCheckObserver(this);
   33.70 -        setName("Select Folders");
   33.71 -    }
   33.72 -
   33.73 -    private void updateFolders() {
   33.74 -        Set<FileObject> folders = getSelectedFolders();
   33.75 -        System.out.println("Selected folders: "+folders);
   33.76 -        firePropertyChange(WizardProperties.KEY_FOLDERS, null, folders);
   33.77 -    }
   33.78 -
   33.79 -    private void enableUI() {
   33.80 -        view().setCheckboxesVisible(true);
   33.81 -        view().setCheckboxesEnabled(true);
   33.82 -        jLabel1.setEnabled(true);
   33.83 -        view().setListEnabled(true);
   33.84 -    }
   33.85 -
   33.86 -    private CheckboxListView view() {
   33.87 -        return (CheckboxListView) jScrollPane1;
   33.88 -    }
   33.89 -
   33.90 -    /**
   33.91 -     * This method is called from within the constructor to initialize the form.
   33.92 -     * WARNING: Do NOT modify this code. The content of this method is always
   33.93 -     * regenerated by the Form Editor.
   33.94 -     */
   33.95 -    @SuppressWarnings("unchecked")
   33.96 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   33.97 -    private void initComponents() {
   33.98 -
   33.99 -        jScrollPane1 = new CheckboxListView();
  33.100 -        jLabel1 = new javax.swing.JLabel();
  33.101 -
  33.102 -        jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
  33.103 -
  33.104 -        jLabel1.setText(org.openide.util.NbBundle.getMessage(SelectFoldersPanel.class, "SelectFoldersPanel.jLabel1.text")); // NOI18N
  33.105 -
  33.106 -        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  33.107 -        this.setLayout(layout);
  33.108 -        layout.setHorizontalGroup(
  33.109 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  33.110 -            .addGroup(layout.createSequentialGroup()
  33.111 -                .addContainerGap()
  33.112 -                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  33.113 -                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
  33.114 -                    .addComponent(jLabel1))
  33.115 -                .addContainerGap())
  33.116 -        );
  33.117 -        layout.setVerticalGroup(
  33.118 -            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  33.119 -            .addGroup(layout.createSequentialGroup()
  33.120 -                .addContainerGap()
  33.121 -                .addComponent(jLabel1)
  33.122 -                .addGap(9, 9, 9)
  33.123 -                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)
  33.124 -                .addContainerGap())
  33.125 -        );
  33.126 -    }// </editor-fold>//GEN-END:initComponents
  33.127 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  33.128 -    private javax.swing.JLabel jLabel1;
  33.129 -    private javax.swing.JScrollPane jScrollPane1;
  33.130 -    // End of variables declaration//GEN-END:variables
  33.131 -
  33.132 -    @Override
  33.133 -    public ExplorerManager getExplorerManager() {
  33.134 -        return mgr;
  33.135 -    }
  33.136 -
  33.137 -    @Override
  33.138 -    public void onNodeChecked(Node node) {
  33.139 -        updateFolders();
  33.140 -    }
  33.141 -
  33.142 -    @Override
  33.143 -    public void onNodeUnchecked(Node node) {
  33.144 -        updateFolders();
  33.145 -    }
  33.146 -
  33.147 -    public void setRootFiles(Set<FileObject> roots) {
  33.148 -        AbstractNode root = new AbstractNode(Children.create(new FolderChildren(roots.toArray(new FileObject[roots.size()])) {
  33.149 -            @Override
  33.150 -            public void onAllNodesCreated() {
  33.151 -                enableUI();
  33.152 -                updateFolders();
  33.153 -            }
  33.154 -        }, true));
  33.155 -        mgr.setRootContext(root);
  33.156 -        firePropertyChange("rootFiles", null, roots);
  33.157 -    }
  33.158 -    
  33.159 -    public Set<FileObject> getSelectedFolders() {
  33.160 -        Set<FileObject> folders = new HashSet<FileObject>();
  33.161 -        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  33.162 -            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  33.163 -            if (cn != null && cn.isSelected()) {
  33.164 -                FileObject f = n.getLookup().lookup(FileObject.class);
  33.165 -                if (f != null) {
  33.166 -                    folders.add(f);
  33.167 -                }
  33.168 -            }
  33.169 -        }
  33.170 -        return folders;
  33.171 -    }
  33.172 -}
    34.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersWizardPanel.java	Fri Feb 08 11:02:28 2013 +0100
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,150 +0,0 @@
    34.4 -/*
    34.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    34.6 - *
    34.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    34.8 - *
    34.9 - * The contents of this file are subject to the terms of either the GNU
   34.10 - * General Public License Version 2 only ("GPL") or the Common
   34.11 - * Development and Distribution License("CDDL") (collectively, the
   34.12 - * "License"). You may not use this file except in compliance with the
   34.13 - * License. You can obtain a copy of the License at
   34.14 - * http://www.netbeans.org/cddl-gplv2.html
   34.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   34.16 - * specific language governing permissions and limitations under the
   34.17 - * License.  When distributing the software, include this License Header
   34.18 - * Notice in each file and include the License file at
   34.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   34.20 - * particular file as subject to the "Classpath" exception as provided
   34.21 - * by Sun in the GPL Version 2 section of the License file that
   34.22 - * accompanied this code. If applicable, add the following below the
   34.23 - * License Header, with the fields enclosed by brackets [] replaced by
   34.24 - * your own identifying information:
   34.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   34.26 - *
   34.27 - * If you wish your version of this file to be governed by only the CDDL
   34.28 - * or only the GPL Version 2, indicate your decision by adding
   34.29 - * "[Contributor] elects to include this software in this distribution
   34.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   34.31 - * single choice of license, a recipient has the option to distribute
   34.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   34.33 - * to extend the choice of license to its licensees as provided above.
   34.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   34.35 - * Version 2 license, then the option applies only if the new code is
   34.36 - * made subject to such option by the copyright holder.
   34.37 - *
   34.38 - * Contributor(s):
   34.39 - *
   34.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   34.41 - */
   34.42 -
   34.43 -package org.netbeans.modules.licensechanger.spi.wizard;
   34.44 -
   34.45 -import java.beans.PropertyChangeEvent;
   34.46 -import java.beans.PropertyChangeListener;
   34.47 -import java.util.Set;
   34.48 -import javax.swing.event.ChangeListener;
   34.49 -import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
   34.50 -import org.openide.WizardDescriptor;
   34.51 -import org.openide.WizardValidationException;
   34.52 -import org.openide.filesystems.FileObject;
   34.53 -import org.openide.util.ChangeSupport;
   34.54 -import org.openide.util.HelpCtx;
   34.55 -
   34.56 -/**
   34.57 - * 
   34.58 - * @author Nils Hoffmann
   34.59 - */
   34.60 -public class SelectFoldersWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   34.61 -
   34.62 -    /**
   34.63 -     * The visual component that displays this panel. If you need to access the
   34.64 -     * component from this class, just use getComponent().
   34.65 -     */
   34.66 -    private SelectFoldersPanel component;
   34.67 -    private WizardDescriptor wiz;
   34.68 -    private boolean valid = false;
   34.69 -    private ChangeSupport cs = new ChangeSupport(this);
   34.70 -
   34.71 -    // Get the visual component for the panel. In this template, the component
   34.72 -    // is kept separate. This can be more efficient: if the wizard is created
   34.73 -    // but never displayed, or not all panels are displayed, it is better to
   34.74 -    // create only those which really need to be visible.
   34.75 -    @Override
   34.76 -    public SelectFoldersPanel getComponent() {
   34.77 -        if (component == null) {
   34.78 -            component = new SelectFoldersPanel();
   34.79 -            component.addPropertyChangeListener(this);
   34.80 -        }
   34.81 -        return component;
   34.82 -    }
   34.83 -
   34.84 -    @Override
   34.85 -    public HelpCtx getHelp() {
   34.86 -        // Show no Help button for this panel:
   34.87 -        return HelpCtx.DEFAULT_HELP;
   34.88 -        // If you have context help:
   34.89 -        // return new HelpCtx("help.key.here");
   34.90 -    }
   34.91 -
   34.92 -    @Override
   34.93 -    public boolean isValid() {
   34.94 -        return valid;
   34.95 -    }
   34.96 -    
   34.97 -    @Override
   34.98 -    public void addChangeListener(ChangeListener l) {
   34.99 -        cs.addChangeListener(l);
  34.100 -    }
  34.101 -    
  34.102 -    @Override
  34.103 -    public void removeChangeListener(ChangeListener l) {
  34.104 -        cs.removeChangeListener(l);
  34.105 -    }
  34.106 -    
  34.107 -    @Override
  34.108 -    public void propertyChange(PropertyChangeEvent pce) {
  34.109 -        cs.fireChange();
  34.110 -        try{
  34.111 -            validate();
  34.112 -        }catch(WizardValidationException ex) {
  34.113 -            if(wiz!=null) {
  34.114 -                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
  34.115 -            }
  34.116 -        }
  34.117 -    }
  34.118 -
  34.119 -    @Override
  34.120 -    public void readSettings(WizardDescriptor wiz) {
  34.121 -        this.wiz = wiz;
  34.122 -        Set<FileObject> folders = (Set<FileObject>)wiz.getProperty(WizardProperties.KEY_FOLDERS);
  34.123 -        if(folders==null || folders.isEmpty()) {
  34.124 -            Object obj = wiz.getProperty(WizardProperties.KEY_ROOT_FILES);
  34.125 -            if(obj!=null) {
  34.126 -                getComponent().setRootFiles((Set<FileObject>)obj);
  34.127 -            }
  34.128 -        }else{
  34.129 -            getComponent().setRootFiles(folders);
  34.130 -        }
  34.131 -    }
  34.132 -
  34.133 -    @Override
  34.134 -    public void storeSettings(WizardDescriptor wiz) {
  34.135 -        Set<FileObject> folders = getComponent().getSelectedFolders();
  34.136 -        wiz.putProperty(WizardProperties.KEY_FOLDERS, folders);
  34.137 -    }
  34.138 -
  34.139 -    @Override
  34.140 -    public void validate() throws WizardValidationException {
  34.141 -        valid = true;
  34.142 -        Set<FileObject> folders = getComponent().getSelectedFolders();
  34.143 -        if(folders==null || folders.isEmpty()) {
  34.144 -            valid = false;
  34.145 -            throw new WizardValidationException(component, "Please select at least one folder!", null);
  34.146 -        }
  34.147 -        if(wiz!=null) {
  34.148 -            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  34.149 -            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  34.150 -            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  34.151 -        }
  34.152 -    }
  34.153 -}
    35.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Bundle.properties	Fri Feb 08 11:02:28 2013 +0100
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,1 +0,0 @@
    35.4 -MSG_WAIT_FOLDERS=Scanning for folders, please wait...
    36.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/CheckableNodeCapability.java	Fri Feb 08 11:02:28 2013 +0100
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,76 +0,0 @@
    36.4 -/*
    36.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    36.6 - *
    36.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    36.8 - *
    36.9 - * The contents of this file are subject to the terms of either the GNU
   36.10 - * General Public License Version 2 only ("GPL") or the Common
   36.11 - * Development and Distribution License("CDDL") (collectively, the
   36.12 - * "License"). You may not use this file except in compliance with the
   36.13 - * License. You can obtain a copy of the License at
   36.14 - * http://www.netbeans.org/cddl-gplv2.html
   36.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   36.16 - * specific language governing permissions and limitations under the
   36.17 - * License.  When distributing the software, include this License Header
   36.18 - * Notice in each file and include the License file at
   36.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   36.20 - * particular file as subject to the "Classpath" exception as provided
   36.21 - * by Sun in the GPL Version 2 section of the License file that
   36.22 - * accompanied this code. If applicable, add the following below the
   36.23 - * License Header, with the fields enclosed by brackets [] replaced by
   36.24 - * your own identifying information:
   36.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   36.26 - *
   36.27 - * If you wish your version of this file to be governed by only the CDDL
   36.28 - * or only the GPL Version 2, indicate your decision by adding
   36.29 - * "[Contributor] elects to include this software in this distribution
   36.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   36.31 - * single choice of license, a recipient has the option to distribute
   36.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   36.33 - * to extend the choice of license to its licensees as provided above.
   36.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   36.35 - * Version 2 license, then the option applies only if the new code is
   36.36 - * made subject to such option by the copyright holder.
   36.37 - *
   36.38 - * Contributor(s):
   36.39 - *
   36.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   36.41 - */
   36.42 -
   36.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   36.44 -
   36.45 -import org.openide.explorer.view.CheckableNode;
   36.46 -
   36.47 -/**
   36.48 - * Implements {@see CheckableNode} to allow display and 
   36.49 - * use of checkable nodes in views.
   36.50 - * 
   36.51 - * @author Nils Hoffmann
   36.52 - */
   36.53 -public class CheckableNodeCapability implements CheckableNode {
   36.54 -
   36.55 -    private boolean checkable = true;
   36.56 -    private boolean checkEnabled = true;
   36.57 -    private boolean selected = true;
   36.58 -    
   36.59 -    @Override
   36.60 -    public boolean isCheckable() {
   36.61 -        return checkable;
   36.62 -    }
   36.63 -
   36.64 -    @Override
   36.65 -    public boolean isCheckEnabled() {
   36.66 -        return checkEnabled;
   36.67 -    }
   36.68 -
   36.69 -    @Override
   36.70 -    public Boolean isSelected() {
   36.71 -        return selected;
   36.72 -    }
   36.73 -
   36.74 -    @Override
   36.75 -    public void setSelected(Boolean selected) {
   36.76 -        this.selected = selected.booleanValue();
   36.77 -    }
   36.78 -    
   36.79 -}
    37.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/CheckboxListView.java	Fri Feb 08 11:02:28 2013 +0100
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,421 +0,0 @@
    37.4 -/*
    37.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    37.6 - *
    37.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    37.8 - *
    37.9 - * The contents of this file are subject to the terms of either the GNU
   37.10 - * General Public License Version 2 only ("GPL") or the Common
   37.11 - * Development and Distribution License("CDDL") (collectively, the
   37.12 - * "License"). You may not use this file except in compliance with the
   37.13 - * License. You can obtain a copy of the License at
   37.14 - * http://www.netbeans.org/cddl-gplv2.html
   37.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   37.16 - * specific language governing permissions and limitations under the
   37.17 - * License.  When distributing the software, include this License Header
   37.18 - * Notice in each file and include the License file at
   37.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   37.20 - * particular file as subject to the "Classpath" exception as provided
   37.21 - * by Sun in the GPL Version 2 section of the License file that
   37.22 - * accompanied this code. If applicable, add the following below the
   37.23 - * License Header, with the fields enclosed by brackets [] replaced by
   37.24 - * your own identifying information:
   37.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   37.26 - *
   37.27 - * If you wish your version of this file to be governed by only the CDDL
   37.28 - * or only the GPL Version 2, indicate your decision by adding
   37.29 - * "[Contributor] elects to include this software in this distribution
   37.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   37.31 - * single choice of license, a recipient has the option to distribute
   37.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   37.33 - * to extend the choice of license to its licensees as provided above.
   37.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   37.35 - * Version 2 license, then the option applies only if the new code is
   37.36 - * made subject to such option by the copyright holder.
   37.37 - *
   37.38 - * Contributor(s):
   37.39 - *
   37.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   37.41 - */
   37.42 -
   37.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   37.44 -
   37.45 -import java.awt.Component;
   37.46 -import java.awt.Dimension;
   37.47 -import java.awt.Graphics;
   37.48 -import java.awt.Insets;
   37.49 -import java.awt.event.KeyAdapter;
   37.50 -import java.awt.event.KeyEvent;
   37.51 -import java.awt.event.MouseEvent;
   37.52 -import java.awt.event.MouseListener;
   37.53 -import javax.swing.BorderFactory;
   37.54 -import javax.swing.JCheckBox;
   37.55 -import javax.swing.JComponent;
   37.56 -import javax.swing.JList;
   37.57 -import javax.swing.ListSelectionModel;
   37.58 -import javax.swing.SwingUtilities;
   37.59 -import javax.swing.UIManager;
   37.60 -import org.openide.awt.HtmlRenderer.Renderer;
   37.61 -import org.openide.explorer.ExplorerManager;
   37.62 -import org.openide.explorer.ExplorerManager.Provider;
   37.63 -import org.openide.explorer.view.CheckableNode;
   37.64 -import org.openide.explorer.view.ListView;
   37.65 -import org.openide.explorer.view.NodeRenderer;
   37.66 -import org.openide.nodes.Node;
   37.67 -
   37.68 -/**
   37.69 - * A JList-based list of Nodes which show checkboxes.
   37.70 - *
   37.71 - * @author Tim Boudreau (original author)
   37.72 - * @author Nils Hoffmann (changed to use CheckableNodeCapability)
   37.73 - */
   37.74 -public class CheckboxListView extends ListView {
   37.75 -
   37.76 -//    public static final String SELECTED = "selected"; //NOI18N
   37.77 -    private final EventHandler ml = new EventHandler();
   37.78 -    private boolean checkboxesEnabled = true;
   37.79 -    private NodeCheckObserver observer;
   37.80 -
   37.81 -    public CheckboxListView() {
   37.82 -        setPopupAllowed(false);
   37.83 -        setViewportBorder(BorderFactory.createMatteBorder(5, 5, 5, 5,
   37.84 -                UIManager.getColor("text"))); //NOI18N
   37.85 -    }
   37.86 -
   37.87 -    @Override
   37.88 -    public void addNotify() {
   37.89 -        super.addNotify();
   37.90 -        //Need to do this here since overriding createList does not work -
   37.91 -        //the list is being created somewhere else; this is the best place
   37.92 -        //to intercept it
   37.93 -        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   37.94 -        if (checkboxesEnabled) {
   37.95 -            enableCheckboxes();
   37.96 -        }
   37.97 -    }
   37.98 -    private boolean enabled = true;
   37.99 -
  37.100 -    public void setCheckboxesEnabled(boolean enabled) {
  37.101 -        this.enabled = enabled;
  37.102 -    }
  37.103 -
  37.104 -    public void setListEnabled(boolean enabled) {
  37.105 -        list.setEnabled(enabled);
  37.106 -    }
  37.107 -
  37.108 -    /**
  37.109 -     * Set an observer, which will be notified when nodes are checked or
  37.110 -     * unchecked.
  37.111 -     *
  37.112 -     * @param observer
  37.113 -     */
  37.114 -    public final void setNodeCheckObserver(NodeCheckObserver observer) {
  37.115 -        this.observer = observer;
  37.116 -    }
  37.117 -
  37.118 -    @Override
  37.119 -    public void removeNotify() {
  37.120 -        super.removeNotify();
  37.121 -        if (checkboxesEnabled) {
  37.122 -            disableCheckboxes();
  37.123 -        }
  37.124 -    }
  37.125 -
  37.126 -    public synchronized final void setCheckboxesVisible(boolean val) {
  37.127 -        if (val != checkboxesEnabled) {
  37.128 -            checkboxesEnabled = val;
  37.129 -            if (isDisplayable()) {
  37.130 -                if (val) {
  37.131 -                    enableCheckboxes();
  37.132 -                } else {
  37.133 -                    disableCheckboxes();
  37.134 -                }
  37.135 -            }
  37.136 -        }
  37.137 -    }
  37.138 -
  37.139 -    private void enableCheckboxes() {
  37.140 -        list.addMouseListener(ml);
  37.141 -        list.addKeyListener(ml);
  37.142 -        list.setCellRenderer(new CheckboxCellRenderer());
  37.143 -        repaint();
  37.144 -    }
  37.145 -
  37.146 -    private void disableCheckboxes() {
  37.147 -        list.removeMouseListener(ml);
  37.148 -        list.removeKeyListener(ml);
  37.149 -        list.setCellRenderer(new NodeRenderer());
  37.150 -        repaint();
  37.151 -    }
  37.152 -
  37.153 -    public void setCheckedNodes(Iterable<Node> nodes) {
  37.154 -        clearCheckedNodes();
  37.155 -        for (Node n : nodes) {
  37.156 -            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  37.157 -            if (cn != null) {
  37.158 -                cn.setSelected(Boolean.TRUE);
  37.159 -            }
  37.160 -//            n.setValue(SELECTED, Boolean.TRUE);
  37.161 -        }
  37.162 -        repaint();
  37.163 -    }
  37.164 -
  37.165 -    public void clearCheckedNodes() {
  37.166 -        for (Node n : allNodes()) {
  37.167 -            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  37.168 -            if (cn != null) {
  37.169 -                cn.setSelected(Boolean.FALSE);
  37.170 -                if (observer != null) {
  37.171 -                    observer.onNodeUnchecked(n);
  37.172 -                }
  37.173 -            }
  37.174 -//            boolean val = Boolean.TRUE.equals(n.getValue(SELECTED));
  37.175 -//
  37.176 -//            n.setValue(SELECTED, Boolean.FALSE);
  37.177 -        }
  37.178 -        repaint();
  37.179 -    }
  37.180 -
  37.181 -    private void selectNode(int index) {
  37.182 -        if (!enabled) {
  37.183 -            return;
  37.184 -        }
  37.185 -        if (index < 0) {
  37.186 -            return;
  37.187 -        }
  37.188 -        ExplorerManager.Provider prov = (Provider) SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
  37.189 -        if (prov != null) {
  37.190 -            Node[] n = prov.getExplorerManager().getRootContext().getChildren().getNodes();
  37.191 -            if (index < n.length) {
  37.192 -                CheckableNode cn = n[index].getLookup().lookup(CheckableNode.class);
  37.193 -                if (cn != null) {
  37.194 -                    boolean wasSet = cn.isSelected();
  37.195 -                    if (wasSet) {
  37.196 -                        cn.setSelected(Boolean.FALSE);
  37.197 -                    } else {
  37.198 -                        cn.setSelected(Boolean.TRUE);
  37.199 -                    }
  37.200 -                    if (observer != null) {
  37.201 -                        if (!wasSet) {
  37.202 -                            observer.onNodeChecked(n[index]);
  37.203 -                        } else {
  37.204 -                            observer.onNodeUnchecked(n[index]);
  37.205 -                        }
  37.206 -                    }
  37.207 -                    repaint();
  37.208 -                }
  37.209 -//                Boolean val = (Boolean) n[index].getValue(SELECTED);
  37.210 -//                boolean wasSet = val != null && val.booleanValue();
  37.211 -//                n[index].setValue(SELECTED, !wasSet);
  37.212 -            }
  37.213 -        }
  37.214 -    }
  37.215 -
  37.216 -    private Node[] allNodes() {
  37.217 -        ExplorerManager.Provider prov = (Provider) SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
  37.218 -        return prov == null ? new Node[0]
  37.219 -                : prov.getExplorerManager().getRootContext().getChildren().getNodes();
  37.220 -    }
  37.221 -
  37.222 -    private boolean isChecked(int index) {
  37.223 -        if (index < 0) {
  37.224 -            return false;
  37.225 -        }
  37.226 -        Node[] n = allNodes();
  37.227 -        if(index>n.length-1) {
  37.228 -            return false;
  37.229 -        }
  37.230 -        CheckableNode cn = n[index].getLookup().lookup(CheckableNode.class);
  37.231 -        if (cn != null) {
  37.232 -            return cn.isSelected();
  37.233 -        }else{
  37.234 -            return false;
  37.235 -        }
  37.236 -//        return index > n.length - 1 ? false
  37.237 -//                : Boolean.TRUE.equals(n[index].getValue(SELECTED));
  37.238 -    }
  37.239 -
  37.240 -    private class EventHandler extends KeyAdapter implements MouseListener {
  37.241 -
  37.242 -        @Override
  37.243 -        public void mouseClicked(MouseEvent e) {
  37.244 -            if (e.getClickCount() == 2) {
  37.245 -                selectNode(findIndex(e));
  37.246 -                e.consume();
  37.247 -            }
  37.248 -        }
  37.249 -
  37.250 -        private int findIndex(MouseEvent e) {
  37.251 -            JList jl = (JList) e.getSource();
  37.252 -            int result = jl.locationToIndex(e.getPoint());
  37.253 -            return result;
  37.254 -        }
  37.255 -        int pressIndex = -1;
  37.256 -
  37.257 -        @Override
  37.258 -        public void mousePressed(MouseEvent e) {
  37.259 -            pressIndex = findIndex(e);
  37.260 -        }
  37.261 -
  37.262 -        @Override
  37.263 -        public void mouseReleased(MouseEvent e) {
  37.264 -            int ix = findIndex(e);
  37.265 -            if (pressIndex == ix) {
  37.266 -                if (e.getX() <= 24) {
  37.267 -                    selectNode(ix);
  37.268 -                    e.consume();
  37.269 -                }
  37.270 -            }
  37.271 -            pressIndex = -1;
  37.272 -        }
  37.273 -
  37.274 -        @Override
  37.275 -        public void mouseEntered(MouseEvent e) {
  37.276 -            //do nothing
  37.277 -        }
  37.278 -
  37.279 -        @Override
  37.280 -        public void mouseExited(MouseEvent e) {
  37.281 -            //do nothing
  37.282 -        }
  37.283 -
  37.284 -        @Override
  37.285 -        public void keyTyped(KeyEvent e) {
  37.286 -            JList jl = (JList) e.getSource();
  37.287 -            if (e.getKeyChar() == '\n' && e.getModifiers() == 0) {
  37.288 -                selectNode(jl.getSelectedIndex());
  37.289 -                e.consume();
  37.290 -            }
  37.291 -        }
  37.292 -    }
  37.293 -
  37.294 -    private final class CheckboxCellRenderer extends NodeRenderer {
  37.295 -
  37.296 -        final WrapperComponent rr = new WrapperComponent();
  37.297 -
  37.298 -        @Override
  37.299 -        public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean cellHasFocus) {
  37.300 -            cellHasFocus = false;
  37.301 -            Component c = super.getListCellRendererComponent(list, value, index, sel, cellHasFocus);
  37.302 -            Renderer r = (Renderer) c;
  37.303 -            r.setIndent(20);
  37.304 -            rr.setSelected(isChecked(index));
  37.305 -            rr.setToPaint(c);
  37.306 -            rr.setEnabled(enabled);
  37.307 -            c.setEnabled(enabled);
  37.308 -            return rr;
  37.309 -        }
  37.310 -    }
  37.311 -
  37.312 -    private static class WrapperComponent extends JComponent {
  37.313 -
  37.314 -        Component toPaint;
  37.315 -        private final JCheckBox box = new JCheckBox();
  37.316 -
  37.317 -        WrapperComponent() {
  37.318 -            add(box);
  37.319 -            box.setBorder(BorderFactory.createEmptyBorder());
  37.320 -        }
  37.321 -
  37.322 -        void setToPaint(Component toPaint) {
  37.323 -            if (this.toPaint != toPaint) {
  37.324 -                if (this.toPaint != null) {
  37.325 -                    remove(this.toPaint);
  37.326 -                }
  37.327 -                this.toPaint = toPaint;
  37.328 -                box.setBackground(toPaint.getBackground());
  37.329 -                add(toPaint);
  37.330 -            }
  37.331 -            doLayout();
  37.332 -        }
  37.333 -
  37.334 -        @Override
  37.335 -        public Dimension getPreferredSize() {
  37.336 -            Dimension a = box.getPreferredSize();
  37.337 -            Dimension b = toPaint == null ? new Dimension(0, 0) : toPaint.getPreferredSize();
  37.338 -            return new Dimension(a.width + b.width, Math.max(22, Math.max(a.height, b.height) + 1));
  37.339 -        }
  37.340 -
  37.341 -        @Override
  37.342 -        public void doLayout() {
  37.343 -            Dimension a = box.getPreferredSize();
  37.344 -            Dimension size = getPreferredSize();
  37.345 -            Insets ins = getInsets();
  37.346 -            size.height -= ins.top + ins.bottom;
  37.347 -            int x = ins.left;
  37.348 -            int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
  37.349 -            box.setBounds(x, y, a.width, a.height);
  37.350 -            x += a.width;
  37.351 -            if (toPaint != null) {
  37.352 -                Dimension c = toPaint.getPreferredSize();
  37.353 -                toPaint.setBounds(x, 0, getWidth() - x, c.height);
  37.354 -            }
  37.355 -        }
  37.356 -
  37.357 -        @Override
  37.358 -        public void paint(Graphics g) {
  37.359 -            doLayout();
  37.360 -            box.paint(g);
  37.361 -            if (toPaint != null) {
  37.362 -                toPaint.paint(g);
  37.363 -            }
  37.364 -        }
  37.365 -
  37.366 -        /*
  37.367 -         @Override
  37.368 -         public void doLayout() {
  37.369 -         Dimension a = box.getPreferredSize();
  37.370 -         System.err.println("Box preferred size " + a);
  37.371 -         Dimension size = getPreferredSize();
  37.372 -         System.err.println("My Preferred Size " + size);
  37.373 -         Insets ins = getInsets();
  37.374 -         size.height -= ins.top + ins.bottom;
  37.375 -         int x = ins.left;
  37.376 -         int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
  37.377 -         box.setBounds(x, y, a.width, a.height);
  37.378 -         x += a.width;
  37.379 -         if (toPaint != null) {
  37.380 -         a = toPaint.getPreferredSize();
  37.381 -         System.err.println("toPaint preferred size " + a);
  37.382 -         a.height = Math.max(22, a.height);
  37.383 -         y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
  37.384 -         toPaint.setBounds(x, y, a.width, a.height);
  37.385 -         //                toPaint.setBounds (x, 0, getWidth() - x, getHeight());
  37.386 -         }
  37.387 -
  37.388 -         System.err.println("---------------------------------------");
  37.389 -         System.err.println("toPaint bounds " + toPaint.getBounds());
  37.390 -         System.err.println("toPaint text " + ((JLabel) toPaint).getText());
  37.391 -         System.err.println("toPaint fg " + toPaint.getForeground());
  37.392 -         }
  37.393 -         */
  37.394 -        void setSelected(boolean val) {
  37.395 -            box.setSelected(val);
  37.396 -        }
  37.397 -        /*
  37.398 -         @Override
  37.399 -         protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
  37.400 -         //do nothing
  37.401 -         }
  37.402 -
  37.403 -         @Override
  37.404 -         public void repaint(int x, int y, int w, int h) {
  37.405 -         }
  37.406 -
  37.407 -         @Override
  37.408 -         public void invalidate() {
  37.409 -         }
  37.410 -
  37.411 -         @Override
  37.412 -         public void revalidate() {
  37.413 -         }
  37.414 -
  37.415 -         @Override
  37.416 -         public void repaint() {
  37.417 -         }
  37.418 -
  37.419 -         @Override
  37.420 -         public void validate() {
  37.421 -         }
  37.422 -         */
  37.423 -    }
  37.424 -}
    38.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileChildren.java	Fri Feb 08 11:02:28 2013 +0100
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,155 +0,0 @@
    38.4 -/*
    38.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    38.6 - *
    38.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    38.8 - *
    38.9 - * The contents of this file are subject to the terms of either the GNU
   38.10 - * General Public License Version 2 only ("GPL") or the Common
   38.11 - * Development and Distribution License("CDDL") (collectively, the
   38.12 - * "License"). You may not use this file except in compliance with the
   38.13 - * License. You can obtain a copy of the License at
   38.14 - * http://www.netbeans.org/cddl-gplv2.html
   38.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   38.16 - * specific language governing permissions and limitations under the
   38.17 - * License.  When distributing the software, include this License Header
   38.18 - * Notice in each file and include the License file at
   38.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   38.20 - * particular file as subject to the "Classpath" exception as provided
   38.21 - * by Sun in the GPL Version 2 section of the License file that
   38.22 - * accompanied this code. If applicable, add the following below the
   38.23 - * License Header, with the fields enclosed by brackets [] replaced by
   38.24 - * your own identifying information:
   38.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   38.26 - *
   38.27 - * If you wish your version of this file to be governed by only the CDDL
   38.28 - * or only the GPL Version 2, indicate your decision by adding
   38.29 - * "[Contributor] elects to include this software in this distribution
   38.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   38.31 - * single choice of license, a recipient has the option to distribute
   38.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   38.33 - * to extend the choice of license to its licensees as provided above.
   38.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   38.35 - * Version 2 license, then the option applies only if the new code is
   38.36 - * made subject to such option by the copyright holder.
   38.37 - *
   38.38 - * Contributor(s):
   38.39 - *
   38.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   38.41 - */
   38.42 -
   38.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   38.44 -
   38.45 -import java.util.Collection;
   38.46 -import java.util.Collections;
   38.47 -import java.util.HashSet;
   38.48 -import java.util.LinkedList;
   38.49 -import java.util.List;
   38.50 -import java.util.Set;
   38.51 -import javax.swing.Action;
   38.52 -import org.netbeans.modules.licensechanger.api.FileHandler;
   38.53 -import org.openide.filesystems.FileObject;
   38.54 -import org.openide.loaders.DataObject;
   38.55 -import org.openide.loaders.DataObjectNotFoundException;
   38.56 -import org.openide.nodes.ChildFactory;
   38.57 -import org.openide.nodes.FilterNode;
   38.58 -import org.openide.nodes.Node;
   38.59 -import org.openide.util.Exceptions;
   38.60 -import org.openide.util.Lookup;
   38.61 -import org.openide.util.lookup.Lookups;
   38.62 -import org.openide.util.lookup.ProxyLookup;
   38.63 -
   38.64 -/**
   38.65 - *
   38.66 - * @author Tim Boudreau (original author)
   38.67 - * @author Nils Hoffmann (changed to use CheckableNodeCapability)
   38.68 - */
   38.69 -public class FileChildren extends ChildFactory.Detachable<FileObject> {
   38.70 -
   38.71 -    private final Set<FileObject> folders;
   38.72 -    private final Collection<? extends FileHandler> allHandlers;
   38.73 -    private final Set<FileItem> items = Collections.synchronizedSet(new HashSet<FileItem>());
   38.74 -
   38.75 -    public FileChildren(Set<FileObject> folders, Set<FileHandler> fileHandler) {
   38.76 -        assert folders != null;
   38.77 -        this.folders = new HashSet<FileObject>(folders);
   38.78 -        allHandlers = fileHandler;//Lookup.getDefault().lookupAll(FileHandler.class);
   38.79 -        //settings.put(WizardProperties.KEY_ITEMS, items);
   38.80 -    }
   38.81 -
   38.82 -    @Override
   38.83 -    protected boolean createKeys(List<FileObject> toPopulate) {
   38.84 -        toPopulate.addAll(folders);
   38.85 -        return true;
   38.86 -    }
   38.87 -
   38.88 -    @Override
   38.89 -    protected Node[] createNodesForKey(FileObject key) {
   38.90 -        List<Node> result = new LinkedList<Node>();
   38.91 -        for (FileObject fo : key.getChildren()) {
   38.92 -            if (fo.isData()) {
   38.93 -                for (FileHandler h : allHandlers) {
   38.94 -                    if (h.match(fo)) {
   38.95 -                        try {
   38.96 -                            DataObject dob = DataObject.find(fo);
   38.97 -                            FileItem item = new FileItem(h, fo);
   38.98 -                            items.add(item);
   38.99 -                            FN fn = new FN (dob.getNodeDelegate(), item);
  38.100 -                            boolean shouldChange =  !h.shouldSkipFile(fo);
  38.101 -                            result.add(fn);
  38.102 -//                            fn.setValue (CheckboxListView.SELECTED, shouldChange);
  38.103 -                            break;
  38.104 -                        } catch (DataObjectNotFoundException ex) {
  38.105 -                            Exceptions.printStackTrace(ex);
  38.106 -                        }
  38.107 -                    }
  38.108 -                }
  38.109 -            }
  38.110 -        }
  38.111 -        return result.toArray(new Node[result.size()]);
  38.112 -    }
  38.113 -
  38.114 -    public static final class FileItem {
  38.115 -
  38.116 -        FileHandler handler;
  38.117 -        FileObject file;
  38.118 -
  38.119 -        public FileItem(FileHandler handler, FileObject file) {
  38.120 -            this.handler = handler;
  38.121 -            this.file = file;
  38.122 -        }
  38.123 -
  38.124 -        public FileObject getFile() {
  38.125 -            return file;
  38.126 -        }
  38.127 -
  38.128 -        public FileHandler getHandler() {
  38.129 -            return handler;
  38.130 -        }
  38.131 -    }
  38.132 -
  38.133 -    private static final class FN extends FilterNode {
  38.134 -
  38.135 -        FN(Node orig, FileItem item) {
  38.136 -            super(orig, Children.LEAF, new ProxyLookup(
  38.137 -                    Lookups.fixed(item,new CheckableNodeCapability()),
  38.138 -                    orig.getLookup()));
  38.139 -            disableDelegation(DELEGATE_GET_ACTIONS);
  38.140 -            disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
  38.141 -            disableDelegation(DELEGATE_SET_DISPLAY_NAME);
  38.142 -            disableDelegation(DELEGATE_GET_DISPLAY_NAME);
  38.143 -            disableDelegation(DELEGATE_GET_VALUE);
  38.144 -            disableDelegation(DELEGATE_SET_VALUE);
  38.145 -            disableDelegation(DELEGATE_SET_NAME);
  38.146 -            disableDelegation(DELEGATE_GET_NAME);
  38.147 -//            setValue(CheckboxListView.SELECTED, Boolean.TRUE);
  38.148 -            setName(item.file.getPath());
  38.149 -            setDisplayName(item.file.getPath());
  38.150 -            setShortDescription(item.file.getPath());
  38.151 -        }
  38.152 -
  38.153 -        @Override
  38.154 -        public Action[] getActions(boolean ignored) {
  38.155 -            return new Action[0];
  38.156 -        }
  38.157 -    }
  38.158 -}
    39.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileLoader.java	Fri Feb 08 11:02:28 2013 +0100
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,81 +0,0 @@
    39.4 -/*
    39.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    39.6 - *
    39.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    39.8 - *
    39.9 - * The contents of this file are subject to the terms of either the GNU
   39.10 - * General Public License Version 2 only ("GPL") or the Common
   39.11 - * Development and Distribution License("CDDL") (collectively, the
   39.12 - * "License"). You may not use this file except in compliance with the
   39.13 - * License. You can obtain a copy of the License at
   39.14 - * http://www.netbeans.org/cddl-gplv2.html
   39.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   39.16 - * specific language governing permissions and limitations under the
   39.17 - * License.  When distributing the software, include this License Header
   39.18 - * Notice in each file and include the License file at
   39.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   39.20 - * particular file as subject to the "Classpath" exception as provided
   39.21 - * by Sun in the GPL Version 2 section of the License file that
   39.22 - * accompanied this code. If applicable, add the following below the
   39.23 - * License Header, with the fields enclosed by brackets [] replaced by
   39.24 - * your own identifying information:
   39.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   39.26 - *
   39.27 - * If you wish your version of this file to be governed by only the CDDL
   39.28 - * or only the GPL Version 2, indicate your decision by adding
   39.29 - * "[Contributor] elects to include this software in this distribution
   39.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   39.31 - * single choice of license, a recipient has the option to distribute
   39.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   39.33 - * to extend the choice of license to its licensees as provided above.
   39.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   39.35 - * Version 2 license, then the option applies only if the new code is
   39.36 - * made subject to such option by the copyright holder.
   39.37 - *
   39.38 - * Contributor(s):
   39.39 - *
   39.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   39.41 - */
   39.42 -
   39.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   39.44 -
   39.45 -import java.io.BufferedInputStream;
   39.46 -import java.io.ByteArrayOutputStream;
   39.47 -import java.io.IOException;
   39.48 -import java.io.InputStream;
   39.49 -import java.io.UnsupportedEncodingException;
   39.50 -import java.nio.charset.Charset;
   39.51 -import org.netbeans.api.queries.FileEncodingQuery;
   39.52 -import org.openide.filesystems.FileObject;
   39.53 -import org.openide.filesystems.FileUtil;
   39.54 -import org.openide.util.Utilities;
   39.55 -
   39.56 -/**
   39.57 - * @author Tim Boudreau
   39.58 - * @author Nils Hoffmann (Refactoring)
   39.59 - */
   39.60 -public class FileLoader {
   39.61 -    public static String loadFile(FileObject file) throws IOException {
   39.62 -        Charset encoding = FileEncodingQuery.getEncoding(file);
   39.63 -        InputStream in = new BufferedInputStream(file.getInputStream());
   39.64 -        ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.getSize());
   39.65 -        try {
   39.66 -            FileUtil.copy(in, out);
   39.67 -            try {
   39.68 -                String result = new String(out.toByteArray(), encoding.name());
   39.69 -                String sep = System.getProperty ("line.separator");
   39.70 -                //Convert everything internally to use \n
   39.71 -                if (!"\n".equals(sep) && sep != null) {
   39.72 -                    return Utilities.replaceString(result, sep, "\n");
   39.73 -                } else {
   39.74 -                    return result;
   39.75 -                }
   39.76 -            } catch (UnsupportedEncodingException q) {
   39.77 -                return new String(out.toByteArray(), FileEncodingQuery.getDefaultEncoding().name());
   39.78 -            }
   39.79 -        } finally {
   39.80 -            in.close();
   39.81 -            out.close();
   39.82 -        }
   39.83 -    }
   39.84 -}
    40.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FolderChildren.java	Fri Feb 08 11:02:28 2013 +0100
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,186 +0,0 @@
    40.4 -/*
    40.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    40.6 - *
    40.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    40.8 - *
    40.9 - * The contents of this file are subject to the terms of either the GNU
   40.10 - * General Public License Version 2 only ("GPL") or the Common
   40.11 - * Development and Distribution License("CDDL") (collectively, the
   40.12 - * "License"). You may not use this file except in compliance with the
   40.13 - * License. You can obtain a copy of the License at
   40.14 - * http://www.netbeans.org/cddl-gplv2.html
   40.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   40.16 - * specific language governing permissions and limitations under the
   40.17 - * License.  When distributing the software, include this License Header
   40.18 - * Notice in each file and include the License file at
   40.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   40.20 - * particular file as subject to the "Classpath" exception as provided
   40.21 - * by Sun in the GPL Version 2 section of the License file that
   40.22 - * accompanied this code. If applicable, add the following below the
   40.23 - * License Header, with the fields enclosed by brackets [] replaced by
   40.24 - * 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
   40.28 - * or only the GPL Version 2, indicate your decision by adding
   40.29 - * "[Contributor] elects to include this software in this distribution
   40.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   40.31 - * single choice of license, a recipient has the option to distribute
   40.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   40.33 - * to extend the choice of license to its licensees as provided above.
   40.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   40.35 - * Version 2 license, then the option applies only if the new code is
   40.36 - * made subject to such option by the copyright holder.
   40.37 - *
   40.38 - * Contributor(s):
   40.39 - *
   40.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   40.41 - */
   40.42 -
   40.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   40.44 -
   40.45 -import java.awt.EventQueue;
   40.46 -import java.util.List;
   40.47 -import javax.swing.Action;
   40.48 -import org.netbeans.api.queries.VisibilityQuery;
   40.49 -import org.openide.explorer.view.CheckableNode;
   40.50 -import org.openide.filesystems.FileObject;
   40.51 -import org.openide.filesystems.FileUtil;
   40.52 -import org.openide.loaders.DataObject;
   40.53 -import org.openide.loaders.DataObjectNotFoundException;
   40.54 -import org.openide.nodes.AbstractNode;
   40.55 -import org.openide.nodes.ChildFactory;
   40.56 -import org.openide.nodes.Children;
   40.57 -import org.openide.nodes.FilterNode;
   40.58 -import org.openide.nodes.Node;
   40.59 -import org.openide.util.Exceptions;
   40.60 -import org.openide.util.NbBundle;
   40.61 -import org.openide.util.NbCollections;
   40.62 -import org.openide.util.lookup.Lookups;
   40.63 -import org.openide.util.lookup.ProxyLookup;
   40.64 -
   40.65 -/**
   40.66 - *
   40.67 - * @author Tim Boudreau (original author)
   40.68 - * @author Nils Hoffmann (changed to use CheckableNodeCapability)
   40.69 - */
   40.70 -public abstract class FolderChildren extends ChildFactory.Detachable<FileObject> implements Runnable {
   40.71 -    private FileObject[] roots;
   40.72 -    volatile int keyCount = 0;
   40.73 -    private int nodeCount = 0;
   40.74 -    private volatile boolean cancelled = false;
   40.75 -
   40.76 -    public FolderChildren (FileObject[] roots) {
   40.77 -        this.roots = roots;
   40.78 -    }
   40.79 -
   40.80 -    @Override
   40.81 -    protected Node createWaitNode() {
   40.82 -        AbstractNode result = new AbstractNode(Children.LEAF);
   40.83 -        result.setDisplayName(NbBundle.getMessage(FolderChildren.class, "MSG_WAIT_FOLDERS"));
   40.84 -        return result;
   40.85 -    }
   40.86 -
   40.87 -    @Override
   40.88 -    public void addNotify() {
   40.89 -        cancelled = false;
   40.90 -        super.addNotify();
   40.91 -        keyCount = 0;
   40.92 -        nodeCount = 0;
   40.93 -    }
   40.94 -
   40.95 -    @Override
   40.96 -    protected void removeNotify() {
   40.97 -        super.removeNotify();
   40.98 -        cancelled = true;
   40.99 -    }
  40.100 -
  40.101 -    private boolean shouldSkipFolder (FileObject folder) {
  40.102 -        // XXX use VisibilityQuery instead
  40.103 -        String path = folder.getPath();
  40.104 -        return path.contains(".svn") || path.contains(".cvs") || path.contains(".hg") ||
  40.105 -                path.endsWith(".svn") || path.endsWith(".cvs") || path.endsWith(".hg") ||
  40.106 -                path.contains("target") || path.endsWith("target") || path.contains("build") || path.endsWith("build");
  40.107 -    }
  40.108 -
  40.109 -    @Override
  40.110 -    protected boolean createKeys(List<FileObject> toPopulate) {
  40.111 -        for (FileObject f : roots) {
  40.112 -            toPopulate.add(f);
  40.113 -            keyCount++;
  40.114 -            for (FileObject fo : NbCollections.iterable(f.getChildren(true))) {
  40.115 -                if (fo.isFolder()) {
  40.116 -                    if (shouldSkipFolder(fo)) {
  40.117 -                        continue;
  40.118 -                    }
  40.119 -                    toPopulate.add(fo);
  40.120 -                    keyCount++;
  40.121 -                }
  40.122 -                if (cancelled) {
  40.123 -                    return true;
  40.124 -                }
  40.125 -            }
  40.126 -            if (cancelled) {
  40.127 -                return true;
  40.128 -            }
  40.129 -        }
  40.130 -        return true;
  40.131 -    }
  40.132 -
  40.133 -    @Override
  40.134 -    protected Node createNodeForKey(FileObject f) {
  40.135 -        try {
  40.136 -            Node n = DataObject.find(f).getNodeDelegate();
  40.137 -            nodeCount++;
  40.138 -            if (nodeCount == keyCount) {
  40.139 -                EventQueue.invokeLater(this);
  40.140 -            }
  40.141 -            return new FN(n, f);
  40.142 -        } catch (DataObjectNotFoundException ex) {
  40.143 -            Exceptions.printStackTrace(ex);
  40.144 -            return null;
  40.145 -        }
  40.146 -    }
  40.147 -
  40.148 -    public abstract void onAllNodesCreated();
  40.149 -
  40.150 -    @Override
  40.151 -    public void run() {
  40.152 -        onAllNodesCreated();
  40.153 -    }
  40.154 -
  40.155 -    private static final class FN extends FilterNode {
  40.156 -        FN(Node orig, FileObject f) {
  40.157 -            super (orig, Children.LEAF, new ProxyLookup(
  40.158 -                    Lookups.fixed(f,new CheckableNodeCapability()),
  40.159 -                    orig.getLookup()));
  40.160 -            disableDelegation(DELEGATE_GET_ACTIONS);
  40.161 -            disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
  40.162 -            disableDelegation(DELEGATE_SET_DISPLAY_NAME);
  40.163 -            disableDelegation(DELEGATE_GET_DISPLAY_NAME);
  40.164 -            disableDelegation(DELEGATE_GET_VALUE);
  40.165 -            disableDelegation(DELEGATE_SET_VALUE);
  40.166 -            disableDelegation(DELEGATE_SET_NAME);
  40.167 -            disableDelegation(DELEGATE_GET_NAME);
  40.168 -            String p = f.getPath();
  40.169 -            // XXX this is a pretty arbitrary list... maybe check SharabilityQuery?
  40.170 -            if (!p.endsWith("nbproject") &&
  40.171 -                !p.endsWith("nbproject/private")) { //NOI18N
  40.172 -//                setValue (CheckboxListView.SELECTED, Boolean.TRUE);
  40.173 -                    
  40.174 -            }else{
  40.175 -                CheckableNode cn = getLookup().lookup(CheckableNode.class);
  40.176 -                if(cn!=null) {
  40.177 -                    cn.setSelected(false);
  40.178 -                }
  40.179 -            }
  40.180 -            setName(p);
  40.181 -            setDisplayName(FileUtil.getFileDisplayName(f));
  40.182 -        }
  40.183 -
  40.184 -        @Override
  40.185 -        public Action[] getActions(boolean ignored) {
  40.186 -            return new Action[0];
  40.187 -        }
  40.188 -    }
  40.189 -}
    41.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LicenseChangerRunnable.java	Fri Feb 08 11:02:28 2013 +0100
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,166 +0,0 @@
    41.4 -/*
    41.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    41.6 - *
    41.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    41.8 - *
    41.9 - * The contents of this file are subject to the terms of either the GNU
   41.10 - * General Public License Version 2 only ("GPL") or the Common
   41.11 - * Development and Distribution License("CDDL") (collectively, the
   41.12 - * "License"). You may not use this file except in compliance with the
   41.13 - * License. You can obtain a copy of the License at
   41.14 - * http://www.netbeans.org/cddl-gplv2.html
   41.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   41.16 - * specific language governing permissions and limitations under the
   41.17 - * License.  When distributing the software, include this License Header
   41.18 - * Notice in each file and include the License file at
   41.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   41.20 - * particular file as subject to the "Classpath" exception as provided
   41.21 - * by Sun in the GPL Version 2 section of the License file that
   41.22 - * accompanied this code. If applicable, add the following below the
   41.23 - * License Header, with the fields enclosed by brackets [] replaced by
   41.24 - * your own identifying information:
   41.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   41.26 - *
   41.27 - * If you wish your version of this file to be governed by only the CDDL
   41.28 - * or only the GPL Version 2, indicate your decision by adding
   41.29 - * "[Contributor] elects to include this software in this distribution
   41.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   41.31 - * single choice of license, a recipient has the option to distribute
   41.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   41.33 - * to extend the choice of license to its licensees as provided above.
   41.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   41.35 - * Version 2 license, then the option applies only if the new code is
   41.36 - * made subject to such option by the copyright holder.
   41.37 - *
   41.38 - * Contributor(s):
   41.39 - *
   41.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   41.41 - */
   41.42 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   41.43 -
   41.44 -import java.io.*;
   41.45 -import java.nio.charset.Charset;
   41.46 -import java.util.Set;
   41.47 -import org.netbeans.api.progress.ProgressHandle;
   41.48 -import org.netbeans.api.progress.ProgressHandleFactory;
   41.49 -import org.netbeans.api.project.*;
   41.50 -import org.netbeans.api.queries.FileEncodingQuery;
   41.51 -import org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel;
   41.52 -import org.openide.WizardDescriptor;
   41.53 -import org.openide.filesystems.*;
   41.54 -import org.openide.filesystems.FileUtil;
   41.55 -import org.openide.util.EditableProperties;
   41.56 -import org.openide.util.Exceptions;
   41.57 -
   41.58 -/**
   41.59 - * @author Tim Boudreau
   41.60 - * @author Nils Hoffmann (Refactoring)
   41.61 - */
   41.62 -public class LicenseChangerRunnable implements Runnable {
   41.63 -
   41.64 -    private final WizardDescriptor wizard;
   41.65 -
   41.66 -    public LicenseChangerRunnable(WizardDescriptor wizard) {
   41.67 -        this.wizard = wizard;
   41.68 -    }
   41.69 -
   41.70 -    @Override
   41.71 -    public void run() {
   41.72 -        ProgressHandle handle = ProgressHandleFactory.createHandle("Changing license headers");
   41.73 -        try {
   41.74 -            Set<FileChildren.FileItem> items = (Set<FileChildren.FileItem>) wizard.getProperty(WizardProperties.KEY_ITEMS);
   41.75 -            final String licenseText = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_TEXT);
   41.76 -            final String licenseName = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_NAME);
   41.77 -            int ix = 0;
   41.78 -            int max = items.size();
   41.79 -            handle.start(max);
   41.80 -            Charset enc;
   41.81 -            for (FileChildren.FileItem item : items) {
   41.82 -                handle.progress(item.getFile().getNameExt(), ix);
   41.83 -                try {
   41.84 -                    String content = FileLoader.loadFile(item.file);
   41.85 -                    String nue = item.handler.transform(content, licenseText, wizard.getProperties());
   41.86 -                    LineEndingPreference pref = LineEndingsPanel.getLineEndingPrefs();
   41.87 -                    nue = LineEndingPreference.convertLineEndings(pref, content, nue);
   41.88 -
   41.89 -                    enc = FileEncodingQuery.getEncoding(item.file);
   41.90 -                    byte[] bytes;
   41.91 -                    try {
   41.92 -                        bytes = nue.getBytes(enc.name());
   41.93 -                    } catch (UnsupportedEncodingException e) {
   41.94 -                        //properties files get resource_bundle_charset
   41.95 -                        bytes = nue.getBytes(FileEncodingQuery.getDefaultEncoding().name());
   41.96 -                    }
   41.97 -                    ByteArrayInputStream in = new ByteArrayInputStream(bytes);
   41.98 -                    BufferedOutputStream out = new BufferedOutputStream(item.file.getOutputStream());
   41.99 -                    try {
  41.100 -                        FileUtil.copy(in, out);
  41.101 -                    } finally {
  41.102 -                        out.close();
  41.103 -                        in.close();
  41.104 -                    }
  41.105 -                } catch (IOException ex) {
  41.106 -                    Exceptions.printStackTrace(ex);
  41.107 -                }
  41.108 -                ix++;
  41.109 -            }
  41.110 -            Boolean updateProjectLicense = (Boolean) wizard.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
  41.111 -            if (updateProjectLicense) {
  41.112 -                System.out.println("Updating default license header!");
  41.113 -                Project project = (Project) wizard.getProperty(WizardProperties.KEY_PROJECT);
  41.114 -                Sources source = ProjectUtils.getSources(project);
  41.115 -                for (SourceGroup group : source.getSourceGroups(Sources.TYPE_GENERIC)) {
  41.116 -                    try {
  41.117 -                        FileObject nbprojectDir = group.getRootFolder().getFileObject("nbproject");
  41.118 -                        if (nbprojectDir != null) {
  41.119 -                            final FileObject projectProps = FileUtil.createData(nbprojectDir, "project.properties");
  41.120 -                            boolean hasProjectProperties = group.contains(projectProps);
  41.121 -                            if (hasProjectProperties) {
  41.122 -                                System.out.println("Found project.properties at " + projectProps.getPath());
  41.123 -                                ProjectManager.mutex().writeAccess(new Runnable() {
  41.124 -
  41.125 -                                    @Override
  41.126 -                                    public void run() {
  41.127 -                                        try {
  41.128 -                                            InputStream istream = projectProps.getInputStream();
  41.129 -                                            EditableProperties props = new EditableProperties(true);
  41.130 -                                            try {
  41.131 -                                                props.load(istream);
  41.132 -                                            } finally {
  41.133 -                                                istream.close();
  41.134 -                                            }
  41.135 -                                            props.setProperty("project.license", licenseName);
  41.136 -                                            OutputStream ostream = projectProps.getOutputStream();
  41.137 -                                            try {
  41.138 -                                                props.store(ostream);
  41.139 -                                            } finally {
  41.140 -                                                ostream.close();
  41.141 -                                            }
  41.142 -                                        } catch (IOException ex) {
  41.143 -                                            Exceptions.printStackTrace(ex);
  41.144 -                                        }
  41.145 -                                    }
  41.146 -                                });
  41.147 -
  41.148 -                            }
  41.149 -                        } else {
  41.150 -                            //TODO implement handling of maven-based projects and others
  41.151 -                            //check for pom.xml
  41.152 -                            FileObject pom = group.getRootFolder().getFileObject("pom.xml");
  41.153 -                            if (pom != null) {
  41.154 -                                System.out.println("Found maven pom.xml at " + pom.getPath());
  41.155 -                                //found pom-based maven project
  41.156 -                                String netbeansHintLicense = "<netbeans.hint.license>" + licenseName + "</netbeans.hint.license>";
  41.157 -                                System.out.println("Please add " + netbeansHintLicense + " within your pom.xml <properties> section!");
  41.158 -                            }
  41.159 -                        }
  41.160 -                    } catch (IOException ex) {
  41.161 -                        Exceptions.printStackTrace(ex);
  41.162 -                    }
  41.163 -                }
  41.164 -            }
  41.165 -        } finally {
  41.166 -            handle.finish();
  41.167 -        }
  41.168 -    }
  41.169 -}
    42.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LineEndingPreference.java	Fri Feb 08 11:02:28 2013 +0100
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,77 +0,0 @@
    42.4 -/*
    42.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    42.6 - *
    42.7 - * Copyright 2009 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 2009 Sun Microsystems, Inc.
   42.41 - */
   42.42 -
   42.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   42.44 -
   42.45 -import org.openide.util.Utilities;
   42.46 -
   42.47 -/**
   42.48 - * User preference for line ending conversion
   42.49 - *
   42.50 - * @author Tim Boudreau
   42.51 - */
   42.52 -public enum LineEndingPreference {
   42.53 -    FORCE_CRLF,
   42.54 -    NO_CHANGE,
   42.55 -    FORCE_NEWLINE,
   42.56 -    SYSTEM_DEFAULT;
   42.57 -    
   42.58 -    public static String convertLineEndings (LineEndingPreference pref, String old, String nue) {
   42.59 -        boolean oldHasCrlf = old.contains("\r\n"); //NOI18N
   42.60 -        switch (pref) {
   42.61 -            case FORCE_CRLF :
   42.62 -                return Utilities.replaceString(nue, "\n", "\r\n"); //NOI18N
   42.63 -            case FORCE_NEWLINE :
   42.64 -                //We already converted everything to newline only on load
   42.65 -                return nue;
   42.66 -            case NO_CHANGE :
   42.67 -                return oldHasCrlf ? Utilities.replaceString(nue, "\n", "\r\n") : //NOI18N
   42.68 -                    nue;
   42.69 -            case SYSTEM_DEFAULT :
   42.70 -                String sep = System.getProperty( "line.separator" ); //NOI18N
   42.71 -                if ("\n".equals(sep)) {
   42.72 -                    return nue;
   42.73 -                } else {
   42.74 -                    return Utilities.replaceString (nue, "\n", sep); //NOI18N
   42.75 -                }
   42.76 -            default :
   42.77 -                throw new AssertionError();
   42.78 -        }
   42.79 -    }
   42.80 -}
    43.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/NodeCheckObserver.java	Fri Feb 08 11:02:28 2013 +0100
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,51 +0,0 @@
    43.4 -/*
    43.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    43.6 - *
    43.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    43.8 - *
    43.9 - * The contents of this file are subject to the terms of either the GNU
   43.10 - * General Public License Version 2 only ("GPL") or the Common
   43.11 - * Development and Distribution License("CDDL") (collectively, the
   43.12 - * "License"). You may not use this file except in compliance with the
   43.13 - * License. You can obtain a copy of the License at
   43.14 - * http://www.netbeans.org/cddl-gplv2.html
   43.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   43.16 - * specific language governing permissions and limitations under the
   43.17 - * License.  When distributing the software, include this License Header
   43.18 - * Notice in each file and include the License file at
   43.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   43.20 - * particular file as subject to the "Classpath" exception as provided
   43.21 - * by Sun in the GPL Version 2 section of the License file that
   43.22 - * accompanied this code. If applicable, add the following below the
   43.23 - * License Header, with the fields enclosed by brackets [] replaced by
   43.24 - * 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
   43.28 - * or only the GPL Version 2, indicate your decision by adding
   43.29 - * "[Contributor] elects to include this software in this distribution
   43.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   43.31 - * single choice of license, a recipient has the option to distribute
   43.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   43.33 - * to extend the choice of license to its licensees as provided above.
   43.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   43.35 - * Version 2 license, then the option applies only if the new code is
   43.36 - * made subject to such option by the copyright holder.
   43.37 - *
   43.38 - * Contributor(s):
   43.39 - *
   43.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   43.41 - */
   43.42 -
   43.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   43.44 -
   43.45 -import org.openide.nodes.Node;
   43.46 -
   43.47 -/**
   43.48 - *
   43.49 - * @author Tim Boudreau
   43.50 - */
   43.51 -public interface NodeCheckObserver {
   43.52 -    public void onNodeChecked (Node node);
   43.53 -    public void onNodeUnchecked (Node node);
   43.54 -}
    44.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Offsets.java	Fri Feb 08 11:02:28 2013 +0100
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,62 +0,0 @@
    44.4 -/*
    44.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    44.6 - *
    44.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    44.8 - *
    44.9 - * The contents of this file are subject to the terms of either the GNU
   44.10 - * General Public License Version 2 only ("GPL") or the Common
   44.11 - * Development and Distribution License("CDDL") (collectively, the
   44.12 - * "License"). You may not use this file except in compliance with the
   44.13 - * License. You can obtain a copy of the License at
   44.14 - * http://www.netbeans.org/cddl-gplv2.html
   44.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   44.16 - * specific language governing permissions and limitations under the
   44.17 - * License.  When distributing the software, include this License Header
   44.18 - * Notice in each file and include the License file at
   44.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   44.20 - * particular file as subject to the "Classpath" exception as provided
   44.21 - * by Sun in the GPL Version 2 section of the License file that
   44.22 - * accompanied this code. If applicable, add the following below the
   44.23 - * License Header, with the fields enclosed by brackets [] replaced by
   44.24 - * 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
   44.28 - * or only the GPL Version 2, indicate your decision by adding
   44.29 - * "[Contributor] elects to include this software in this distribution
   44.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   44.31 - * single choice of license, a recipient has the option to distribute
   44.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   44.33 - * to extend the choice of license to its licensees as provided above.
   44.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   44.35 - * Version 2 license, then the option applies only if the new code is
   44.36 - * made subject to such option by the copyright holder.
   44.37 - *
   44.38 - * Contributor(s):
   44.39 - *
   44.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
   44.41 - */
   44.42 -
   44.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   44.44 -
   44.45 -/**
   44.46 - *
   44.47 - * @author Tim Boudreau
   44.48 - */
   44.49 -public final class Offsets {
   44.50 -    private final int start;
   44.51 -    private final int end;
   44.52 -
   44.53 -    public Offsets(int start, int end) {
   44.54 -        this.start = start;
   44.55 -        this.end = end;
   44.56 -    }
   44.57 -
   44.58 -    public int getEnd() {
   44.59 -        return end;
   44.60 -    }
   44.61 -
   44.62 -    public int getStart() {
   44.63 -        return start;
   44.64 -    }
   44.65 -}
    45.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/WizardProperties.java	Fri Feb 08 11:02:28 2013 +0100
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,62 +0,0 @@
    45.4 -/*
    45.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    45.6 - *
    45.7 - * Copyright 2009 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 2009 Sun Microsystems, Inc.
   45.41 - */
   45.42 -
   45.43 -package org.netbeans.modules.licensechanger.spi.wizard.utils;
   45.44 -
   45.45 -/**
   45.46 - * Central class for Wizard-related property keys.
   45.47 - * 
   45.48 - * @author Nils Hoffmann
   45.49 - */
   45.50 -public final class WizardProperties {
   45.51 -
   45.52 -    public static final String KEY_FILE_HANDLERS = "fileHandlers";
   45.53 -    public static final String KEY_ITEMS = "fileItems";
   45.54 -    public static final String KEY_LICENSE_TEXT = "licenseText";
   45.55 -    public static final String KEY_LICENSE_NAME = "licenseName";
   45.56 -    public static final String KEY_ROOT_FILES = "rootFiles";
   45.57 -    public static final String KEY_FOLDERS = "folders";
   45.58 -    public static final String KEY_UPDATE_DEFAULT_PROJECT_LICENSE = "updateDefaultProjectLicense";
   45.59 -    public static final String VALUE_DEFAULT_LICENSE_TEXT = "No License";
   45.60 -    public static final String PROP_ENDING = "ending";
   45.61 -    public static final String KEY_ENDING = "line_terminator";
   45.62 -    public static final String KEY_PROJECT = "project";
   45.63 -    public static final String KEY_COPYRIGHT_HOLDER = "project.organization";
   45.64 -    private WizardProperties(){}
   45.65 -}
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/Bundle.properties	Sun Feb 10 16:18:19 2013 +0100
    46.3 @@ -0,0 +1,39 @@
    46.4 +BROWSE_LICENSE_TITLE=Locate License File
    46.5 +MSG_SELECT_A_LICENSE=Select a License or Browse for file
    46.6 +ERR_COULD_NOT_LOAD=Could not load {0}
    46.7 +
    46.8 +WIZARD_TITLE=Add/Replace License Headers
    46.9 +#chooseFileTypes=Select File Types
   46.10 +#chooseLicense=Select License
   46.11 +#chooseFolders=Prune Folders
   46.12 +#chooseFiles=Choose Files
   46.13 +#preview=Preview
   46.14 +LBL_CHANGE_LICENSE=Change License Headers
   46.15 +
   46.16 +LicenseChooserPanel.chooseLabel.text=Choose License
   46.17 +LicenseChooserPanel.browseButton.text=Browse
   46.18 +LicenseChooserPanel.updateDefaultProjectLicense.text=Set as default project license
   46.19 +
   46.20 +ChooseFileTypesPanel.noCustomizerLabel.text=[no customizer]
   46.21 +ChooseFileTypesPanel.customizerPanel.border.title=File Type Settings
   46.22 +ChooseFileTypesPanel.copyrightHolderLabel.text=Copyright Holder
   46.23 +ChooseFileTypesPanel.licensePropertiesPanel.border.title=License Properties
   46.24 +ChooseFileTypesPanel.storeInUserProperties.text=Store in User.properties
   46.25 +ChooseFileTypesPanel.nodesLabel.text=File Types
   46.26 +
   46.27 +SelectFoldersPanel.jLabel1.text=Uncheck Folders that Should Be Ignored
   46.28 +SelectFoldersPanel.nodesLabel.text=Folders
   46.29 +
   46.30 +LineEndingsPanel.border.title=Line Endings
   46.31 +LineEndingsPanel.noChangeButton.text=Do Not Change
   46.32 +LineEndingsPanel.systemDefaultButton.text=Force System Default
   46.33 +LineEndingsPanel.newlineButton.text=Force Newline
   46.34 +LineEndingsPanel.forceCrlf.text=Force CRLF
   46.35 +LineEndingsPanel.newlineButton.text_1=Force Newline
   46.36 +LineEndingsPanel.systemDefaultButton.text_1=Force System Default
   46.37 +LineEndingsPanel.noChangeButton.text_1=Do Not Change
   46.38 +LineEndingsPanel.forceCrlf.text_1=Force CRLF
   46.39 +
   46.40 +PreviewPanel.jLabel1.text=Select File for Preview
   46.41 +PreviewPanel.jLabel3.text=jLabel3
   46.42 +PreviewPanel.nodesLabel.text=Files
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/ChooseFileTypesPanel.form	Sun Feb 10 16:18:19 2013 +0100
    47.3 @@ -0,0 +1,186 @@
    47.4 +<?xml version="1.0" encoding="UTF-8" ?>
    47.5 +
    47.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    47.7 +  <AuxValues>
    47.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    47.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   47.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   47.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   47.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   47.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   47.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   47.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   47.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   47.17 +  </AuxValues>
   47.18 +
   47.19 +  <Layout>
   47.20 +    <DimensionLayout dim="0">
   47.21 +      <Group type="103" groupAlignment="0" attributes="0">
   47.22 +          <Group type="102" attributes="0">
   47.23 +              <EmptySpace max="-2" attributes="0"/>
   47.24 +              <Group type="103" groupAlignment="0" attributes="0">
   47.25 +                  <Component id="jScrollPane1" alignment="0" pref="804" max="32767" attributes="0"/>
   47.26 +                  <Group type="102" alignment="1" attributes="0">
   47.27 +                      <Component id="customizerPanel" pref="559" max="32767" attributes="0"/>
   47.28 +                      <EmptySpace max="-2" attributes="0"/>
   47.29 +                      <Group type="103" groupAlignment="0" max="-2" attributes="0">
   47.30 +                          <Component id="lineEndingsPanel1" pref="239" max="32767" attributes="0"/>
   47.31 +                          <Component id="licensePropertiesPanel" max="32767" attributes="0"/>
   47.32 +                      </Group>
   47.33 +                  </Group>
   47.34 +              </Group>
   47.35 +              <EmptySpace max="-2" attributes="0"/>
   47.36 +          </Group>
   47.37 +      </Group>
   47.38 +    </DimensionLayout>
   47.39 +    <DimensionLayout dim="1">
   47.40 +      <Group type="103" groupAlignment="0" attributes="0">
   47.41 +          <Group type="102" alignment="0" attributes="0">
   47.42 +              <EmptySpace max="-2" attributes="0"/>
   47.43 +              <Component id="jScrollPane1" min="-2" pref="137" max="-2" attributes="0"/>
   47.44 +              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   47.45 +              <Group type="103" groupAlignment="0" attributes="0">
   47.46 +                  <Component id="customizerPanel" pref="361" max="32767" attributes="0"/>
   47.47 +                  <Group type="102" attributes="0">
   47.48 +                      <Component id="lineEndingsPanel1" min="-2" max="-2" attributes="0"/>
   47.49 +                      <EmptySpace type="separate" max="-2" attributes="0"/>
   47.50 +                      <Component id="licensePropertiesPanel" max="32767" attributes="0"/>
   47.51 +                  </Group>
   47.52 +              </Group>
   47.53 +              <EmptySpace max="-2" attributes="0"/>
   47.54 +          </Group>
   47.55 +      </Group>
   47.56 +    </DimensionLayout>
   47.57 +  </Layout>
   47.58 +  <SubComponents>
   47.59 +    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
   47.60 +      <Properties>
   47.61 +        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   47.62 +          <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
   47.63 +            <LineBorder>
   47.64 +              <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
   47.65 +            </LineBorder>
   47.66 +          </Border>
   47.67 +        </Property>
   47.68 +      </Properties>
   47.69 +      <AuxValues>
   47.70 +        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new OutlineView()"/>
   47.71 +      </AuxValues>
   47.72 +
   47.73 +      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   47.74 +    </Container>
   47.75 +    <Container class="javax.swing.JPanel" name="customizerPanel">
   47.76 +      <Properties>
   47.77 +        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   47.78 +          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
   47.79 +            <TitledBorder title="File Type Settings">
   47.80 +              <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   47.81 +            </TitledBorder>
   47.82 +          </Border>
   47.83 +        </Property>
   47.84 +      </Properties>
   47.85 +      <AccessibilityProperties>
   47.86 +        <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   47.87 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   47.88 +        </Property>
   47.89 +      </AccessibilityProperties>
   47.90 +
   47.91 +      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
   47.92 +      <SubComponents>
   47.93 +        <Component class="javax.swing.JLabel" name="noCustomizerLabel">
   47.94 +          <Properties>
   47.95 +            <Property name="horizontalAlignment" type="int" value="0"/>
   47.96 +            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   47.97 +              <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   47.98 +            </Property>
   47.99 +            <Property name="enabled" type="boolean" value="false"/>
  47.100 +          </Properties>
  47.101 +          <AccessibilityProperties>
  47.102 +            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  47.103 +              <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  47.104 +            </Property>
  47.105 +          </AccessibilityProperties>
  47.106 +          <Constraints>
  47.107 +            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
  47.108 +              <BorderConstraints direction="Center"/>
  47.109 +            </Constraint>
  47.110 +          </Constraints>
  47.111 +        </Component>
  47.112 +      </SubComponents>
  47.113 +    </Container>
  47.114 +    <Component class="org.netbeans.modules.licensechanger.wizard.LineEndingsPanel" name="lineEndingsPanel1">
  47.115 +    </Component>
  47.116 +    <Container class="javax.swing.JPanel" name="licensePropertiesPanel">
  47.117 +      <Properties>
  47.118 +        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  47.119 +          <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
  47.120 +            <TitledBorder title="License Properties">
  47.121 +              <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.licensePropertiesPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  47.122 +            </TitledBorder>
  47.123 +          </Border>
  47.124 +        </Property>
  47.125 +      </Properties>
  47.126 +
  47.127 +      <Layout>
  47.128 +        <DimensionLayout dim="0">
  47.129 +          <Group type="103" groupAlignment="0" attributes="0">
  47.130 +              <Group type="102" attributes="0">
  47.131 +                  <EmptySpace max="-2" attributes="0"/>
  47.132 +                  <Group type="103" groupAlignment="0" attributes="0">
  47.133 +                      <Component id="copyrightHolderField" max="32767" attributes="0"/>
  47.134 +                      <Group type="102" attributes="0">
  47.135 +                          <Component id="copyrightHolderLabel" min="-2" max="-2" attributes="0"/>
  47.136 +                          <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
  47.137 +                      </Group>
  47.138 +                      <Component id="storeInUserProperties" max="32767" attributes="0"/>
  47.139 +                  </Group>
  47.140 +                  <EmptySpace max="-2" attributes="0"/>
  47.141 +              </Group>
  47.142 +          </Group>
  47.143 +        </DimensionLayout>
  47.144 +        <DimensionLayout dim="1">
  47.145 +          <Group type="103" groupAlignment="0" attributes="0">
  47.146 +              <Group type="102" alignment="0" attributes="0">
  47.147 +                  <EmptySpace max="-2" attributes="0"/>
  47.148 +                  <Component id="copyrightHolderLabel" min="-2" max="-2" attributes="0"/>
  47.149 +                  <EmptySpace max="-2" attributes="0"/>
  47.150 +                  <Component id="copyrightHolderField" min="-2" max="-2" attributes="0"/>
  47.151 +                  <EmptySpace max="-2" attributes="0"/>
  47.152 +                  <Component id="storeInUserProperties" min="-2" max="-2" attributes="0"/>
  47.153 +                  <EmptySpace max="32767" attributes="0"/>
  47.154 +              </Group>
  47.155 +          </Group>
  47.156 +        </DimensionLayout>
  47.157 +      </Layout>
  47.158 +      <SubComponents>
  47.159 +        <Component class="javax.swing.JLabel" name="copyrightHolderLabel">
  47.160 +          <Properties>
  47.161 +            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
  47.162 +              <ComponentRef name="copyrightHolderField"/>
  47.163 +            </Property>
  47.164 +            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  47.165 +              <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.copyrightHolderLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  47.166 +            </Property>
  47.167 +          </Properties>
  47.168 +        </Component>
  47.169 +        <Component class="javax.swing.JTextField" name="copyrightHolderField">
  47.170 +          <Properties>
  47.171 +            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
  47.172 +              <Connection code="System.getProperty(&quot;user.name&quot;) == null ? &quot;&quot; : System.getProperty(&quot;user.name&quot;)" type="code"/>
  47.173 +            </Property>
  47.174 +          </Properties>
  47.175 +          <Events>
  47.176 +            <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="copyrightHolderFieldFocusGained"/>
  47.177 +          </Events>
  47.178 +        </Component>
  47.179 +        <Component class="javax.swing.JCheckBox" name="storeInUserProperties">
  47.180 +          <Properties>
  47.181 +            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  47.182 +              <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="ChooseFileTypesPanel.storeInUserProperties.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  47.183 +            </Property>
  47.184 +          </Properties>
  47.185 +        </Component>
  47.186 +      </SubComponents>
  47.187 +    </Container>
  47.188 +  </SubComponents>
  47.189 +</Form>
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/ChooseFileTypesPanel.java	Sun Feb 10 16:18:19 2013 +0100
    48.3 @@ -0,0 +1,295 @@
    48.4 +/*
    48.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    48.6 + *
    48.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    48.8 + *
    48.9 + * The contents of this file are subject to the terms of either the GNU
   48.10 + * General Public License Version 2 only ("GPL") or the Common
   48.11 + * Development and Distribution License("CDDL") (collectively, the
   48.12 + * "License"). You may not use this file except in compliance with the
   48.13 + * License. You can obtain a copy of the License at
   48.14 + * http://www.netbeans.org/cddl-gplv2.html
   48.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   48.16 + * specific language governing permissions and limitations under the
   48.17 + * License.  When distributing the software, include this License Header
   48.18 + * Notice in each file and include the License file at
   48.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   48.20 + * particular file as subject to the "Classpath" exception as provided
   48.21 + * by Sun in the GPL Version 2 section of the License file that
   48.22 + * accompanied this code. If applicable, add the following below the
   48.23 + * License Header, with the fields enclosed by brackets [] replaced by
   48.24 + * your own identifying information:
   48.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   48.26 + *
   48.27 + * If you wish your version of this file to be governed by only the CDDL
   48.28 + * or only the GPL Version 2, indicate your decision by adding
   48.29 + * "[Contributor] elects to include this software in this distribution
   48.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   48.31 + * single choice of license, a recipient has the option to distribute
   48.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   48.33 + * to extend the choice of license to its licensees as provided above.
   48.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   48.35 + * Version 2 license, then the option applies only if the new code is
   48.36 + * made subject to such option by the copyright holder.
   48.37 + *
   48.38 + * Contributor(s):
   48.39 + *
   48.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   48.41 + */
   48.42 +
   48.43 +/*
   48.44 + * NewJPanel.java
   48.45 + *
   48.46 + * Created on Mar 20, 2009, 1:14:43 AM
   48.47 + */
   48.48 +package org.netbeans.modules.licensechanger.wizard;
   48.49 +
   48.50 +import java.beans.PropertyChangeEvent;
   48.51 +import java.beans.PropertyChangeListener;
   48.52 +import java.util.Collections;
   48.53 +import java.util.Comparator;
   48.54 +import java.util.HashSet;
   48.55 +import java.util.List;
   48.56 +import java.util.Set;
   48.57 +import org.netbeans.modules.licensechanger.api.Customizable;
   48.58 +import org.netbeans.modules.licensechanger.api.FileHandler;
   48.59 +import org.netbeans.modules.licensechanger.wizard.utils.CheckableNodeCapability;
   48.60 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   48.61 +import org.netbeans.swing.outline.DefaultOutlineModel;
   48.62 +import org.openide.explorer.ExplorerManager;
   48.63 +import org.openide.explorer.view.CheckableNode;
   48.64 +import org.openide.explorer.view.OutlineView;
   48.65 +import org.openide.nodes.AbstractNode;
   48.66 +import org.openide.nodes.ChildFactory;
   48.67 +import org.openide.nodes.Children;
   48.68 +import org.openide.nodes.Node;
   48.69 +import org.openide.util.Lookup;
   48.70 +import org.openide.util.NbPreferences;
   48.71 +import org.openide.util.lookup.Lookups;
   48.72 +
   48.73 +/**
   48.74 + *
   48.75 + * @author Tim Boudreau
   48.76 + * @author Nils Hoffmann (Refactoring)
   48.77 + */
   48.78 +public class ChooseFileTypesPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener {
   48.79 +
   48.80 +    private final ExplorerManager mgr = new ExplorerManager();
   48.81 +
   48.82 +    public ChooseFileTypesPanel() {
   48.83 +        initComponents();
   48.84 +        String copyrightHolder =
   48.85 +                NbPreferences.forModule(ChooseFileTypesWizardPanel.class)
   48.86 +                .get(WizardProperties.KEY_COPYRIGHT_HOLDER, null);
   48.87 +        if (copyrightHolder != null && !copyrightHolder.trim().isEmpty()) {
   48.88 +            copyrightHolderField.setText(copyrightHolder);
   48.89 +        }
   48.90 +        mgr.setRootContext(new AbstractNode(Children.create(new FileHandlerChildren(), false)));
   48.91 +        mgr.addPropertyChangeListener(this);
   48.92 +        updateMap();
   48.93 +        updateView();
   48.94 +    }
   48.95 +
   48.96 +    private void updateMap() {
   48.97 +        Set<FileHandler> handlers = getFileHandlers();
   48.98 +        firePropertyChange(WizardProperties.KEY_FILE_HANDLERS, null, handlers);
   48.99 +    }
  48.100 +
  48.101 +    /**
  48.102 +     * This method is called from within the constructor to initialize the form.
  48.103 +     * WARNING: Do NOT modify this code. The content of this method is always
  48.104 +     * regenerated by the Form Editor.
  48.105 +     */
  48.106 +    @SuppressWarnings("unchecked")
  48.107 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  48.108 +    private void initComponents() {
  48.109 +
  48.110 +        jScrollPane1 = new OutlineView();
  48.111 +        customizerPanel = new javax.swing.JPanel();
  48.112 +        noCustomizerLabel = new javax.swing.JLabel();
  48.113 +        lineEndingsPanel1 = new org.netbeans.modules.licensechanger.wizard.LineEndingsPanel();
  48.114 +        licensePropertiesPanel = new javax.swing.JPanel();
  48.115 +        copyrightHolderLabel = new javax.swing.JLabel();
  48.116 +        copyrightHolderField = new javax.swing.JTextField();
  48.117 +        storeInUserProperties = new javax.swing.JCheckBox();
  48.118 +
  48.119 +        jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
  48.120 +
  48.121 +        customizerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title"))); // NOI18N
  48.122 +        customizerPanel.setLayout(new java.awt.BorderLayout());
  48.123 +
  48.124 +        noCustomizerLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  48.125 +        noCustomizerLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
  48.126 +        noCustomizerLabel.setEnabled(false);
  48.127 +        customizerPanel.add(noCustomizerLabel, java.awt.BorderLayout.CENTER);
  48.128 +        noCustomizerLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
  48.129 +
  48.130 +        licensePropertiesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.licensePropertiesPanel.border.title"))); // NOI18N
  48.131 +
  48.132 +        copyrightHolderLabel.setLabelFor(copyrightHolderField);
  48.133 +        copyrightHolderLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.copyrightHolderLabel.text")); // NOI18N
  48.134 +
  48.135 +        copyrightHolderField.setText(System.getProperty("user.name") == null ? "" : System.getProperty("user.name"));
  48.136 +        copyrightHolderField.addFocusListener(new java.awt.event.FocusAdapter() {
  48.137 +            public void focusGained(java.awt.event.FocusEvent evt) {
  48.138 +                copyrightHolderFieldFocusGained(evt);
  48.139 +            }
  48.140 +        });
  48.141 +
  48.142 +        storeInUserProperties.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.storeInUserProperties.text")); // NOI18N
  48.143 +
  48.144 +        javax.swing.GroupLayout licensePropertiesPanelLayout = new javax.swing.GroupLayout(licensePropertiesPanel);
  48.145 +        licensePropertiesPanel.setLayout(licensePropertiesPanelLayout);
  48.146 +        licensePropertiesPanelLayout.setHorizontalGroup(
  48.147 +            licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.148 +            .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  48.149 +                .addContainerGap()
  48.150 +                .addGroup(licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.151 +                    .addComponent(copyrightHolderField)
  48.152 +                    .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  48.153 +                        .addComponent(copyrightHolderLabel)
  48.154 +                        .addGap(0, 0, Short.MAX_VALUE))
  48.155 +                    .addComponent(storeInUserProperties, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  48.156 +                .addContainerGap())
  48.157 +        );
  48.158 +        licensePropertiesPanelLayout.setVerticalGroup(
  48.159 +            licensePropertiesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.160 +            .addGroup(licensePropertiesPanelLayout.createSequentialGroup()
  48.161 +                .addContainerGap()
  48.162 +                .addComponent(copyrightHolderLabel)
  48.163 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  48.164 +                .addComponent(copyrightHolderField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  48.165 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  48.166 +                .addComponent(storeInUserProperties)
  48.167 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  48.168 +        );
  48.169 +
  48.170 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  48.171 +        this.setLayout(layout);
  48.172 +        layout.setHorizontalGroup(
  48.173 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.174 +            .addGroup(layout.createSequentialGroup()
  48.175 +                .addContainerGap()
  48.176 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.177 +                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 804, Short.MAX_VALUE)
  48.178 +                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  48.179 +                        .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
  48.180 +                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  48.181 +                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  48.182 +                            .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
  48.183 +                            .addComponent(licensePropertiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  48.184 +                .addContainerGap())
  48.185 +        );
  48.186 +        layout.setVerticalGroup(
  48.187 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.188 +            .addGroup(layout.createSequentialGroup()
  48.189 +                .addContainerGap()
  48.190 +                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
  48.191 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  48.192 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  48.193 +                    .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
  48.194 +                    .addGroup(layout.createSequentialGroup()
  48.195 +                        .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  48.196 +                        .addGap(18, 18, 18)
  48.197 +                        .addComponent(licensePropertiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  48.198 +                .addContainerGap())
  48.199 +        );
  48.200 +
  48.201 +        customizerPanel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title")); // NOI18N
  48.202 +    }// </editor-fold>//GEN-END:initComponents
  48.203 +
  48.204 +    private void copyrightHolderFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_copyrightHolderFieldFocusGained
  48.205 +        copyrightHolderField.selectAll();
  48.206 +    }//GEN-LAST:event_copyrightHolderFieldFocusGained
  48.207 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  48.208 +    private javax.swing.JTextField copyrightHolderField;
  48.209 +    private javax.swing.JLabel copyrightHolderLabel;
  48.210 +    private javax.swing.JPanel customizerPanel;
  48.211 +    private javax.swing.JScrollPane jScrollPane1;
  48.212 +    private javax.swing.JPanel licensePropertiesPanel;
  48.213 +    private org.netbeans.modules.licensechanger.wizard.LineEndingsPanel lineEndingsPanel1;
  48.214 +    private javax.swing.JLabel noCustomizerLabel;
  48.215 +    private javax.swing.JCheckBox storeInUserProperties;
  48.216 +    // End of variables declaration//GEN-END:variables
  48.217 +
  48.218 +    @Override
  48.219 +    public ExplorerManager getExplorerManager() {
  48.220 +        return mgr;
  48.221 +    }
  48.222 +
  48.223 +    public Set<FileHandler> getFileHandlers() {
  48.224 +        Set<FileHandler> result = new HashSet<FileHandler>();
  48.225 +        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  48.226 +            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  48.227 +            if (cn != null && cn.isSelected()) {
  48.228 +                result.addAll(n.getLookup().lookupAll(FileHandler.class));
  48.229 +            }
  48.230 +        }
  48.231 +        return result;
  48.232 +    }
  48.233 +
  48.234 +    @Override
  48.235 +    public void propertyChange(PropertyChangeEvent evt) {
  48.236 +        if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
  48.237 +            Node[] n = mgr.getSelectedNodes();
  48.238 +            updateCustomizer(n.length == 1 ? n[0].getLookup().lookup(Customizable.class) : null);
  48.239 +        }
  48.240 +    }
  48.241 +
  48.242 +    public String getCopyrightHolder() {
  48.243 +        return copyrightHolderField.getText();
  48.244 +    }
  48.245 +
  48.246 +    public void setCopyrightHolder(String copyrightHolder) {
  48.247 +        copyrightHolderField.setText(copyrightHolder);
  48.248 +    }
  48.249 +
  48.250 +    public boolean isStoreInUserProperties() {
  48.251 +        return storeInUserProperties.isSelected();
  48.252 +    }
  48.253 +
  48.254 +    public void setStoreInUserProperties(boolean b) {
  48.255 +        storeInUserProperties.setSelected(b);
  48.256 +    }
  48.257 +
  48.258 +    private void updateView() {
  48.259 +        OutlineView ov = (OutlineView) jScrollPane1;
  48.260 +        ov.getOutline().setRootVisible(false);
  48.261 +        ov.setPopupAllowed(false);
  48.262 +        ov.setTreeSortable(false);
  48.263 +        ov.getOutline().setShowGrid(false);
  48.264 +        String headerName = org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.nodesLabel.text"); // NOI18N
  48.265 +        ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(headerName);
  48.266 +        setName("Choose File Types");
  48.267 +    }
  48.268 +
  48.269 +    private static final class FileHandlerChildren extends ChildFactory<FileHandler> {
  48.270 +
  48.271 +        @Override
  48.272 +        protected boolean createKeys(List<FileHandler> toPopulate) {
  48.273 +            toPopulate.addAll(Lookup.getDefault().lookupAll(FileHandler.class));
  48.274 +            Collections.sort(toPopulate, new Comparator<FileHandler>() {
  48.275 +                @Override
  48.276 +                public int compare(FileHandler t, FileHandler t1) {
  48.277 +                    return t.getDisplayName().compareTo(t1.getDisplayName());
  48.278 +                }
  48.279 +            });
  48.280 +            return true;
  48.281 +        }
  48.282 +
  48.283 +        @Override
  48.284 +        protected Node createNodeForKey(FileHandler key) {
  48.285 +            AbstractNode result = new AbstractNode(Children.LEAF, Lookups.fixed(key, new CheckableNodeCapability()));
  48.286 +            result.setDisplayName(key.getDisplayName());
  48.287 +            return result;
  48.288 +        }
  48.289 +    }
  48.290 +
  48.291 +    private void updateCustomizer(Customizable c) {
  48.292 +        customizerPanel.removeAll();
  48.293 +        customizerPanel.add(c == null ? noCustomizerLabel : c.getCustomizer());
  48.294 +        invalidate();
  48.295 +        revalidate();
  48.296 +        repaint();
  48.297 +    }
  48.298 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/ChooseFileTypesWizardPanel.java	Sun Feb 10 16:18:19 2013 +0100
    49.3 @@ -0,0 +1,137 @@
    49.4 +/*
    49.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    49.6 + *
    49.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    49.8 + *
    49.9 + * The contents of this file are subject to the terms of either the GNU
   49.10 + * General Public License Version 2 only ("GPL") or the Common
   49.11 + * Development and Distribution License("CDDL") (collectively, the
   49.12 + * "License"). You may not use this file except in compliance with the
   49.13 + * License. You can obtain a copy of the License at
   49.14 + * http://www.netbeans.org/cddl-gplv2.html
   49.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   49.16 + * specific language governing permissions and limitations under the
   49.17 + * License.  When distributing the software, include this License Header
   49.18 + * Notice in each file and include the License file at
   49.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   49.20 + * particular file as subject to the "Classpath" exception as provided
   49.21 + * by Sun in the GPL Version 2 section of the License file that
   49.22 + * accompanied this code. If applicable, add the following below the
   49.23 + * License Header, with the fields enclosed by brackets [] replaced by
   49.24 + * your own identifying information:
   49.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   49.26 + *
   49.27 + * If you wish your version of this file to be governed by only the CDDL
   49.28 + * or only the GPL Version 2, indicate your decision by adding
   49.29 + * "[Contributor] elects to include this software in this distribution
   49.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   49.31 + * single choice of license, a recipient has the option to distribute
   49.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   49.33 + * to extend the choice of license to its licensees as provided above.
   49.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   49.35 + * Version 2 license, then the option applies only if the new code is
   49.36 + * made subject to such option by the copyright holder.
   49.37 + *
   49.38 + * Contributor(s):
   49.39 + *
   49.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   49.41 + */
   49.42 +package org.netbeans.modules.licensechanger.wizard;
   49.43 +
   49.44 +import java.beans.PropertyChangeEvent;
   49.45 +import java.beans.PropertyChangeListener;
   49.46 +import javax.swing.event.ChangeListener;
   49.47 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   49.48 +import org.openide.WizardDescriptor;
   49.49 +import org.openide.WizardValidationException;
   49.50 +import org.openide.util.ChangeSupport;
   49.51 +import org.openide.util.HelpCtx;
   49.52 +import org.openide.util.NbPreferences;
   49.53 +
   49.54 +/**
   49.55 + *
   49.56 + * @author Nils Hoffmann
   49.57 + */
   49.58 +public class ChooseFileTypesWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   49.59 +
   49.60 +    /**
   49.61 +     * The visual component that displays this panel. If you need to access the
   49.62 +     * component from this class, just use getComponent().
   49.63 +     */
   49.64 +    private ChooseFileTypesPanel component;
   49.65 +    private WizardDescriptor wiz;
   49.66 +    private boolean valid = true;
   49.67 +    private ChangeSupport cs = new ChangeSupport(this);
   49.68 +
   49.69 +    // Get the visual component for the panel. In this template, the component
   49.70 +    // is kept separate. This can be more efficient: if the wizard is created
   49.71 +    // but never displayed, or not all panels are displayed, it is better to
   49.72 +    // create only those which really need to be visible.
   49.73 +    @Override
   49.74 +    public ChooseFileTypesPanel getComponent() {
   49.75 +        if (component == null) {
   49.76 +            component = new ChooseFileTypesPanel();
   49.77 +            component.addPropertyChangeListener(this);
   49.78 +        }
   49.79 +        return component;
   49.80 +    }
   49.81 +
   49.82 +    @Override
   49.83 +    public HelpCtx getHelp() {
   49.84 +        // Show no Help button for this panel:
   49.85 +        return HelpCtx.DEFAULT_HELP;
   49.86 +        // If you have context help:
   49.87 +        // return new HelpCtx("help.key.here");
   49.88 +    }
   49.89 +
   49.90 +    @Override
   49.91 +    public boolean isValid() {
   49.92 +        return valid;
   49.93 +    }
   49.94 +
   49.95 +    @Override
   49.96 +    public void addChangeListener(ChangeListener l) {
   49.97 +        cs.addChangeListener(l);
   49.98 +    }
   49.99 +
  49.100 +    @Override
  49.101 +    public void removeChangeListener(ChangeListener l) {
  49.102 +        cs.removeChangeListener(l);
  49.103 +    }
  49.104 +
  49.105 +    @Override
  49.106 +    public void propertyChange(PropertyChangeEvent pce) {
  49.107 +        cs.fireChange();
  49.108 +    }
  49.109 +
  49.110 +    @Override
  49.111 +    public void readSettings(WizardDescriptor wiz) {
  49.112 +        this.wiz = wiz;
  49.113 +        Boolean storeInUserProperties = (Boolean) wiz.getProperty(WizardProperties.KEY_STORE_IN_USER_PROPERTIES);
  49.114 +        ChooseFileTypesPanel panel = getComponent();
  49.115 +        if (storeInUserProperties != null) {
  49.116 +            panel.setStoreInUserProperties(storeInUserProperties);
  49.117 +        }
  49.118 +        String copyrightHolder = (String) wiz.getProperty(WizardProperties.KEY_COPYRIGHT_HOLDER);
  49.119 +        if (copyrightHolder == null) {
  49.120 +            copyrightHolder = NbPreferences.forModule(ChooseFileTypesWizardPanel.class).get(WizardProperties.KEY_COPYRIGHT_HOLDER, "");
  49.121 +        }
  49.122 +        panel.setCopyrightHolder(copyrightHolder);
  49.123 +    }
  49.124 +
  49.125 +    @Override
  49.126 +    public void storeSettings(WizardDescriptor wiz) {
  49.127 +        wiz.putProperty(WizardProperties.KEY_FILE_HANDLERS, getComponent().getFileHandlers());
  49.128 +        String copyrightHolder = getComponent().getCopyrightHolder();
  49.129 +        if (copyrightHolder != null && !copyrightHolder.isEmpty()) {
  49.130 +            wiz.putProperty(WizardProperties.KEY_COPYRIGHT_HOLDER, copyrightHolder);
  49.131 +            NbPreferences.forModule(ChooseFileTypesWizardPanel.class).put(WizardProperties.KEY_COPYRIGHT_HOLDER, copyrightHolder);
  49.132 +        }
  49.133 +        wiz.putProperty(WizardProperties.KEY_STORE_IN_USER_PROPERTIES, Boolean.valueOf(getComponent().isStoreInUserProperties()));
  49.134 +    }
  49.135 +
  49.136 +    @Override
  49.137 +    public void validate() throws WizardValidationException {
  49.138 +        valid = true;
  49.139 +    }
  49.140 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LicenseChangerWizardAction.java	Sun Feb 10 16:18:19 2013 +0100
    50.3 @@ -0,0 +1,148 @@
    50.4 +/*
    50.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    50.6 + *
    50.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    50.8 + *
    50.9 + * The contents of this file are subject to the terms of either the GNU
   50.10 + * General Public License Version 2 only ("GPL") or the Common
   50.11 + * Development and Distribution License("CDDL") (collectively, the
   50.12 + * "License"). You may not use this file except in compliance with the
   50.13 + * License. You can obtain a copy of the License at
   50.14 + * http://www.netbeans.org/cddl-gplv2.html
   50.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   50.16 + * specific language governing permissions and limitations under the
   50.17 + * License.  When distributing the software, include this License Header
   50.18 + * Notice in each file and include the License file at
   50.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   50.20 + * particular file as subject to the "Classpath" exception as provided
   50.21 + * by Sun in the GPL Version 2 section of the License file that
   50.22 + * accompanied this code. If applicable, add the following below the
   50.23 + * License Header, with the fields enclosed by brackets [] replaced by
   50.24 + * your own identifying information:
   50.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   50.26 + *
   50.27 + * If you wish your version of this file to be governed by only the CDDL
   50.28 + * or only the GPL Version 2, indicate your decision by adding
   50.29 + * "[Contributor] elects to include this software in this distribution
   50.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   50.31 + * single choice of license, a recipient has the option to distribute
   50.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   50.33 + * to extend the choice of license to its licensees as provided above.
   50.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   50.35 + * Version 2 license, then the option applies only if the new code is
   50.36 + * made subject to such option by the copyright holder.
   50.37 + *
   50.38 + * Contributor(s):
   50.39 + *
   50.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   50.41 + */
   50.42 +package org.netbeans.modules.licensechanger.wizard;
   50.43 +
   50.44 +import java.awt.Component;
   50.45 +import java.awt.event.ActionEvent;
   50.46 +import java.awt.event.ActionListener;
   50.47 +import java.text.MessageFormat;
   50.48 +import java.util.ArrayList;
   50.49 +import java.util.HashSet;
   50.50 +import java.util.List;
   50.51 +import java.util.Set;
   50.52 +import javax.swing.JComponent;
   50.53 +import org.netbeans.api.project.*;
   50.54 +import org.netbeans.modules.licensechanger.wizard.utils.LicenseChangerRunnable;
   50.55 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   50.56 +import org.openide.DialogDisplayer;
   50.57 +import org.openide.WizardDescriptor;
   50.58 +import org.openide.awt.ActionID;
   50.59 +import org.openide.awt.ActionReference;
   50.60 +import org.openide.awt.ActionReferences;
   50.61 +import org.openide.awt.ActionRegistration;
   50.62 +import org.openide.filesystems.FileObject;
   50.63 +import org.openide.loaders.DataObject;
   50.64 +import org.openide.util.*;
   50.65 +
   50.66 +/**
   50.67 + * Context-sensitive action to launch the license header change wizard.
   50.68 + *
   50.69 + * @author Nils Hoffmann
   50.70 + */
   50.71 +@ActionID(
   50.72 +    category = "Tools",
   50.73 +id = "org.netbeans.modules.licensechanger.wizard.LicenseChangerWizardAction")
   50.74 +@ActionRegistration(
   50.75 +    displayName = "#CTL_LicenseChangerWizardAction")
   50.76 +@ActionReferences(
   50.77 +//    @ActionReference(path = "Loaders/folder/any/Actions", position = 951)
   50.78 +@ActionReference(path = "UI/ToolActions/Files", position = 951))
   50.79 +@NbBundle.Messages("CTL_LicenseChangerWizardAction=Change License Header")
   50.80 +public final class LicenseChangerWizardAction implements ActionListener {
   50.81 +
   50.82 +    private List<DataObject> context;
   50.83 +
   50.84 +    public LicenseChangerWizardAction(List<DataObject> context) {
   50.85 +        this.context = context;
   50.86 +    }
   50.87 +
   50.88 +    /**
   50.89 +     * Used to return the parent folder of a file or the folder itself.
   50.90 +     *
   50.91 +     * @param fo
   50.92 +     * @return
   50.93 +     */
   50.94 +    private FileObject addFileObject(FileObject fo) {
   50.95 +        if (fo.isFolder()) {
   50.96 +            return fo;
   50.97 +        }
   50.98 +        return fo.getParent();
   50.99 +    }
  50.100 +
  50.101 +    @Override
  50.102 +    public void actionPerformed(ActionEvent e) {
  50.103 +        Set<FileObject> files = new HashSet<FileObject>();
  50.104 +        Project owningProject = null;
  50.105 +        for (DataObject ob : context) {
  50.106 +            FileObject fo = ob.getPrimaryFile();
  50.107 +            Project proj = FileOwnerQuery.getOwner(fo);
  50.108 +            if (owningProject == null) {
  50.109 +                owningProject = proj;
  50.110 +                //TODO implement better exclusion of build directories 
  50.111 +                files.add(addFileObject(fo));
  50.112 +            } else {
  50.113 +                if (owningProject.equals(proj)) {
  50.114 +                    files.add(addFileObject(fo));
  50.115 +                } else {
  50.116 +                    Exceptions.printStackTrace(new IllegalStateException("Can only handle folders below one project!"));
  50.117 +                    return;
  50.118 +                }
  50.119 +            }
  50.120 +        }
  50.121 +
  50.122 +        List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
  50.123 +        panels.add(new ChooseFileTypesWizardPanel());
  50.124 +        panels.add(new LicenseChooserWizardPanel());
  50.125 +        panels.add(new SelectFoldersWizardPanel());
  50.126 +        panels.add(new PreviewWizardPanel());
  50.127 +        String[] steps = new String[panels.size()];
  50.128 +        for (int i = 0; i < panels.size(); i++) {
  50.129 +            Component c = panels.get(i).getComponent();
  50.130 +            // Default step name to component name of panel.
  50.131 +            steps[i] = c.getName();
  50.132 +            if (c instanceof JComponent) { // assume Swing components
  50.133 +                JComponent jc = (JComponent) c;
  50.134 +                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
  50.135 +                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
  50.136 +                jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
  50.137 +                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
  50.138 +                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
  50.139 +            }
  50.140 +        }
  50.141 +        WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
  50.142 +        // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
  50.143 +        wiz.setTitleFormat(new MessageFormat("{0}"));
  50.144 +        wiz.setTitle("Change License Headers");
  50.145 +        wiz.putProperty(WizardProperties.KEY_ROOT_FILES, files);
  50.146 +        wiz.putProperty(WizardProperties.KEY_PROJECT, owningProject);
  50.147 +        if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
  50.148 +            RequestProcessor.getDefault().post(new LicenseChangerRunnable(wiz));
  50.149 +        }
  50.150 +    }
  50.151 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LicenseChooserPanel.form	Sun Feb 10 16:18:19 2013 +0100
    51.3 @@ -0,0 +1,121 @@
    51.4 +<?xml version="1.0" encoding="UTF-8" ?>
    51.5 +
    51.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    51.7 +  <AuxValues>
    51.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    51.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   51.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   51.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   51.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   51.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   51.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   51.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   51.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   51.17 +  </AuxValues>
   51.18 +
   51.19 +  <Layout>
   51.20 +    <DimensionLayout dim="0">
   51.21 +      <Group type="103" groupAlignment="0" attributes="0">
   51.22 +          <Group type="102" alignment="0" attributes="0">
   51.23 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.24 +              <Group type="103" groupAlignment="0" attributes="0">
   51.25 +                  <Component id="jScrollPane2" pref="376" max="32767" attributes="0"/>
   51.26 +                  <Group type="102" alignment="0" attributes="0">
   51.27 +                      <Component id="chooseLabel" min="-2" max="-2" attributes="0"/>
   51.28 +                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
   51.29 +                      <Component id="selectLicense" max="32767" attributes="0"/>
   51.30 +                  </Group>
   51.31 +                  <Group type="102" alignment="1" attributes="0">
   51.32 +                      <Component id="updateDefaultProjectLicense" min="-2" max="-2" attributes="0"/>
   51.33 +                      <EmptySpace max="32767" attributes="0"/>
   51.34 +                      <Component id="browseButton" min="-2" max="-2" attributes="0"/>
   51.35 +                  </Group>
   51.36 +              </Group>
   51.37 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.38 +          </Group>
   51.39 +      </Group>
   51.40 +    </DimensionLayout>
   51.41 +    <DimensionLayout dim="1">
   51.42 +      <Group type="103" groupAlignment="0" attributes="0">
   51.43 +          <Group type="102" alignment="0" attributes="0">
   51.44 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.45 +              <Group type="103" groupAlignment="3" attributes="0">
   51.46 +                  <Component id="chooseLabel" alignment="3" min="-2" max="-2" attributes="0"/>
   51.47 +                  <Component id="selectLicense" alignment="3" min="-2" max="-2" attributes="0"/>
   51.48 +              </Group>
   51.49 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.50 +              <Component id="jScrollPane2" pref="223" max="32767" attributes="0"/>
   51.51 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.52 +              <Group type="103" groupAlignment="0" attributes="0">
   51.53 +                  <Component id="browseButton" min="-2" max="-2" attributes="0"/>
   51.54 +                  <Component id="updateDefaultProjectLicense" min="-2" max="-2" attributes="0"/>
   51.55 +              </Group>
   51.56 +              <EmptySpace min="-2" max="-2" attributes="0"/>
   51.57 +          </Group>
   51.58 +      </Group>
   51.59 +    </DimensionLayout>
   51.60 +  </Layout>
   51.61 +  <SubComponents>
   51.62 +    <Component class="javax.swing.JLabel" name="chooseLabel">
   51.63 +      <Properties>
   51.64 +        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
   51.65 +          <ComponentRef name="selectLicense"/>
   51.66 +        </Property>
   51.67 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   51.68 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LicenseChooserPanel.chooseLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   51.69 +        </Property>
   51.70 +      </Properties>
   51.71 +    </Component>
   51.72 +    <Component class="javax.swing.JComboBox" name="selectLicense">
   51.73 +      <Properties>
   51.74 +        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
   51.75 +          <StringArray count="1">
   51.76 +            <StringItem index="0" value="[loading licenses]"/>
   51.77 +          </StringArray>
   51.78 +        </Property>
   51.79 +      </Properties>
   51.80 +      <Events>
   51.81 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="licenseSelected"/>
   51.82 +      </Events>
   51.83 +    </Component>
   51.84 +    <Component class="javax.swing.JButton" name="browseButton">
   51.85 +      <Properties>
   51.86 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   51.87 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LicenseChooserPanel.browseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   51.88 +        </Property>
   51.89 +      </Properties>
   51.90 +      <Events>
   51.91 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseForLicense"/>
   51.92 +      </Events>
   51.93 +    </Component>
   51.94 +    <Component class="javax.swing.JCheckBox" name="updateDefaultProjectLicense">
   51.95 +      <Properties>
   51.96 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   51.97 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LicenseChooserPanel.updateDefaultProjectLicense.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   51.98 +        </Property>
   51.99 +      </Properties>
  51.100 +    </Component>
  51.101 +    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
  51.102 +      <Properties>
  51.103 +        <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
  51.104 +          <Connection component="Form" name="getSize" type="method"/>
  51.105 +        </Property>
  51.106 +      </Properties>
  51.107 +      <AuxValues>
  51.108 +        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
  51.109 +      </AuxValues>
  51.110 +
  51.111 +      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
  51.112 +      <SubComponents>
  51.113 +        <Component class="javax.swing.JEditorPane" name="licenseText">
  51.114 +          <Properties>
  51.115 +            <Property name="editable" type="boolean" value="false"/>
  51.116 +          </Properties>
  51.117 +          <AuxValues>
  51.118 +            <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="licenseText.setContentType(&quot;text/plain&quot;);"/>
  51.119 +          </AuxValues>
  51.120 +        </Component>
  51.121 +      </SubComponents>
  51.122 +    </Container>
  51.123 +  </SubComponents>
  51.124 +</Form>
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LicenseChooserPanel.java	Sun Feb 10 16:18:19 2013 +0100
    52.3 @@ -0,0 +1,302 @@
    52.4 +/*
    52.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    52.6 + *
    52.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    52.8 + *
    52.9 + * The contents of this file are subject to the terms of either the GNU
   52.10 + * General Public License Version 2 only ("GPL") or the Common
   52.11 + * Development and Distribution License("CDDL") (collectively, the
   52.12 + * "License"). You may not use this file except in compliance with the
   52.13 + * License. You can obtain a copy of the License at
   52.14 + * http://www.netbeans.org/cddl-gplv2.html
   52.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   52.16 + * specific language governing permissions and limitations under the
   52.17 + * License.  When distributing the software, include this License Header
   52.18 + * Notice in each file and include the License file at
   52.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   52.20 + * particular file as subject to the "Classpath" exception as provided
   52.21 + * by Sun in the GPL Version 2 section of the License file that
   52.22 + * accompanied this code. If applicable, add the following below the
   52.23 + * License Header, with the fields enclosed by brackets [] replaced by
   52.24 + * your own identifying information:
   52.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   52.26 + *
   52.27 + * If you wish your version of this file to be governed by only the CDDL
   52.28 + * or only the GPL Version 2, indicate your decision by adding
   52.29 + * "[Contributor] elects to include this software in this distribution
   52.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   52.31 + * single choice of license, a recipient has the option to distribute
   52.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   52.33 + * to extend the choice of license to its licensees as provided above.
   52.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   52.35 + * Version 2 license, then the option applies only if the new code is
   52.36 + * made subject to such option by the copyright holder.
   52.37 + *
   52.38 + * Contributor(s):
   52.39 + *
   52.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   52.41 + */
   52.42 +package org.netbeans.modules.licensechanger.wizard;
   52.43 +
   52.44 +import java.awt.Component;
   52.45 +import java.awt.EventQueue;
   52.46 +import java.io.File;
   52.47 +import java.io.IOException;
   52.48 +import javax.swing.DefaultComboBoxModel;
   52.49 +import javax.swing.SwingUtilities;
   52.50 +import javax.swing.event.DocumentEvent;
   52.51 +import javax.swing.event.DocumentListener;
   52.52 +import org.netbeans.modules.licensechanger.api.LicenseHeader;
   52.53 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   52.54 +import org.openide.filesystems.FileChooserBuilder;
   52.55 +import org.openide.util.Exceptions;
   52.56 +import org.openide.util.NbBundle;
   52.57 +import org.openide.util.RequestProcessor;
   52.58 +
   52.59 +/**
   52.60 + *
   52.61 + * @author Tim Boudreau
   52.62 + * @author Nils Hoffmann (Refactoring)
   52.63 + */
   52.64 +public class LicenseChooserPanel extends javax.swing.JPanel implements Runnable, DocumentListener {
   52.65 +
   52.66 +    private volatile boolean licensesLoaded;
   52.67 +    private volatile boolean loadingLicenses;
   52.68 +
   52.69 +    /**
   52.70 +     * Creates new form LicenseChooser
   52.71 +     */
   52.72 +    public LicenseChooserPanel() {
   52.73 +        initComponents();
   52.74 +        enabled(false);
   52.75 +        licenseText.getDocument().addDocumentListener(this);
   52.76 +        licenseText.setText(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT);
   52.77 +        setName("Choose License Header");
   52.78 +    }
   52.79 +
   52.80 +    /**
   52.81 +     * This method is called from within the constructor to initialize the form.
   52.82 +     * WARNING: Do NOT modify this code. The content of this method is always
   52.83 +     * regenerated by the Form Editor.
   52.84 +     */
   52.85 +    @SuppressWarnings("unchecked")
   52.86 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   52.87 +    private void initComponents() {
   52.88 +
   52.89 +        chooseLabel = new javax.swing.JLabel();
   52.90 +        selectLicense = new javax.swing.JComboBox();
   52.91 +        browseButton = new javax.swing.JButton();
   52.92 +        updateDefaultProjectLicense = new javax.swing.JCheckBox();
   52.93 +        jScrollPane2 = new javax.swing.JScrollPane();
   52.94 +        licenseText = new javax.swing.JEditorPane();
   52.95 +
   52.96 +        chooseLabel.setLabelFor(selectLicense);
   52.97 +        chooseLabel.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.chooseLabel.text")); // NOI18N
   52.98 +
   52.99 +        selectLicense.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "[loading licenses]" }));
  52.100 +        selectLicense.addActionListener(new java.awt.event.ActionListener() {
  52.101 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  52.102 +                licenseSelected(evt);
  52.103 +            }
  52.104 +        });
  52.105 +
  52.106 +        browseButton.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.browseButton.text")); // NOI18N
  52.107 +        browseButton.addActionListener(new java.awt.event.ActionListener() {
  52.108 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  52.109 +                browseForLicense(evt);
  52.110 +            }
  52.111 +        });
  52.112 +
  52.113 +        updateDefaultProjectLicense.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.updateDefaultProjectLicense.text")); // NOI18N
  52.114 +
  52.115 +        jScrollPane2.setMaximumSize(getSize());
  52.116 +
  52.117 +        licenseText.setEditable(false);
  52.118 +        jScrollPane2.setViewportView(licenseText);
  52.119 +        licenseText.setContentType("text/plain");
  52.120 +
  52.121 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  52.122 +        this.setLayout(layout);
  52.123 +        layout.setHorizontalGroup(
  52.124 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  52.125 +            .addGroup(layout.createSequentialGroup()
  52.126 +                .addContainerGap()
  52.127 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  52.128 +                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
  52.129 +                    .addGroup(layout.createSequentialGroup()
  52.130 +                        .addComponent(chooseLabel)
  52.131 +                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  52.132 +                        .addComponent(selectLicense, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  52.133 +                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  52.134 +                        .addComponent(updateDefaultProjectLicense)
  52.135 +                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  52.136 +                        .addComponent(browseButton)))
  52.137 +                .addContainerGap())
  52.138 +        );
  52.139 +        layout.setVerticalGroup(
  52.140 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  52.141 +            .addGroup(layout.createSequentialGroup()
  52.142 +                .addContainerGap()
  52.143 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  52.144 +                    .addComponent(chooseLabel)
  52.145 +                    .addComponent(selectLicense, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  52.146 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  52.147 +                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
  52.148 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  52.149 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  52.150 +                    .addComponent(browseButton)
  52.151 +                    .addComponent(updateDefaultProjectLicense))
  52.152 +                .addContainerGap())
  52.153 +        );
  52.154 +    }// </editor-fold>//GEN-END:initComponents
  52.155 +
  52.156 +    private void licenseSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_licenseSelected
  52.157 +        if (loadingLicenses || !selectLicense.isEnabled()) {
  52.158 +            return;
  52.159 +        }
  52.160 +        loadLicenseFromResource((LicenseHeader) selectLicense.getSelectedItem());
  52.161 +    }//GEN-LAST:event_licenseSelected
  52.162 +
  52.163 +    private void browseForLicense(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseForLicense
  52.164 +        File f;
  52.165 +        if ((f = new FileChooserBuilder(LicenseChooserPanel.class).setTitle(
  52.166 +                NbBundle.getMessage(LicenseChooserPanel.class, "BROWSE_LICENSE_TITLE")) //NOI18N
  52.167 +                .setFilesOnly(true).showOpenDialog()) != null) {
  52.168 +            updateDefaultProjectLicense.setSelected(false);
  52.169 +            DefaultComboBoxModel dcbm = (DefaultComboBoxModel) selectLicense.getModel();
  52.170 +            LicenseHeader lh = LicenseHeader.fromFile(f);
  52.171 +            LicenseHeader.addAsNetBeansTemplate(lh);
  52.172 +            for (LicenseHeader header : LicenseHeader.fromTemplates()) {
  52.173 +                if (header.getName().equals(lh.getName())) {
  52.174 +//                    System.out.println("Found newly added template!");
  52.175 +                    dcbm.addElement(header);
  52.176 +                    dcbm.setSelectedItem(header);
  52.177 +                    loadLicenseFromResource(header);
  52.178 +                }
  52.179 +            }
  52.180 +        }
  52.181 +    }//GEN-LAST:event_browseForLicense
  52.182 +
  52.183 +    @Override
  52.184 +    public void addNotify() {
  52.185 +        super.addNotify();
  52.186 +        if (!licensesLoaded && !loadingLicenses) {
  52.187 +            loadingLicenses = true;
  52.188 +            enabled(false);
  52.189 +            RequestProcessor.getDefault().post(this);
  52.190 +        }
  52.191 +    }
  52.192 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  52.193 +    private javax.swing.JButton browseButton;
  52.194 +    private javax.swing.JLabel chooseLabel;
  52.195 +    private javax.swing.JScrollPane jScrollPane2;
  52.196 +    private javax.swing.JEditorPane licenseText;
  52.197 +    private javax.swing.JComboBox selectLicense;
  52.198 +    private javax.swing.JCheckBox updateDefaultProjectLicense;
  52.199 +    // End of variables declaration//GEN-END:variables
  52.200 +
  52.201 +    private void enabled(boolean val) {
  52.202 +        for (Component c : getComponents()) {
  52.203 +            c.setEnabled(val);
  52.204 +        }
  52.205 +    }
  52.206 +
  52.207 +    private void initLicenses() throws IOException {
  52.208 +        assert !EventQueue.isDispatchThread();
  52.209 +        final DefaultComboBoxModel mdl = new DefaultComboBoxModel();
  52.210 +        for (LicenseHeader header : LicenseHeader.fromTemplates()) {
  52.211 +            mdl.addElement(header);
  52.212 +        }
  52.213 +        EventQueue.invokeLater(new Runnable() {
  52.214 +            @Override
  52.215 +            public void run() {
  52.216 +                mdl.setSelectedItem(NbBundle.getMessage(LicenseChooserPanel.class,
  52.217 +                        "MSG_SELECT_A_LICENSE")); //NOI18N
  52.218 +                selectLicense.setModel(mdl);
  52.219 +                enabled(true);
  52.220 +                licensesLoaded = true;
  52.221 +                loadingLicenses = false;
  52.222 +            }
  52.223 +        });
  52.224 +    }
  52.225 +
  52.226 +    @Override
  52.227 +    public void run() {
  52.228 +        try {
  52.229 +            initLicenses();
  52.230 +        } catch (IOException ex) {
  52.231 +            Exceptions.printStackTrace(ex);
  52.232 +        }
  52.233 +    }
  52.234 +
  52.235 +    private void loadLicenseFromResource(LicenseHeader header) {
  52.236 +        enabled(false);
  52.237 +        SwingUtilities.invokeLater(new ResourceLoader(header));
  52.238 +    }
  52.239 +
  52.240 +    public String getLicenseText() {
  52.241 +        return licenseText.getText();
  52.242 +    }
  52.243 +
  52.244 +    public String getLicenseName() {
  52.245 +        Object obj = selectLicense.getSelectedItem();
  52.246 +        if (obj != null && obj instanceof LicenseHeader) {
  52.247 +            LicenseHeader header = (LicenseHeader) obj;
  52.248 +            return header.getName();
  52.249 +        }
  52.250 +        return null;
  52.251 +    }
  52.252 +
  52.253 +    public boolean isUpdateDefaultProjectLicense() {
  52.254 +        return updateDefaultProjectLicense.isSelected();
  52.255 +    }
  52.256 +
  52.257 +    public void setUpdateDefaultProjectLicense(boolean b) {
  52.258 +        updateDefaultProjectLicense.setSelected(b);
  52.259 +    }
  52.260 +
  52.261 +    private void updateLicense() {
  52.262 +        licenseText.setEditable(false);
  52.263 +        String txt = licenseText.getText();
  52.264 +        if (!txt.endsWith("\n")) {
  52.265 +            txt += "\n";
  52.266 +        }
  52.267 +        firePropertyChange(WizardProperties.KEY_LICENSE_TEXT, null, txt);
  52.268 +    }
  52.269 +
  52.270 +    @Override
  52.271 +    public void insertUpdate(DocumentEvent e) {
  52.272 +        updateLicense();
  52.273 +    }
  52.274 +
  52.275 +    @Override
  52.276 +    public void removeUpdate(DocumentEvent e) {
  52.277 +        updateLicense();
  52.278 +    }
  52.279 +
  52.280 +    @Override
  52.281 +    public void changedUpdate(DocumentEvent e) {
  52.282 +        updateLicense();
  52.283 +    }
  52.284 +
  52.285 +    private class ResourceLoader implements Runnable {
  52.286 +
  52.287 +        private LicenseHeader header;
  52.288 +
  52.289 +        ResourceLoader(LicenseHeader header) {
  52.290 +            this.header = header;
  52.291 +        }
  52.292 +
  52.293 +        @Override
  52.294 +        public void run() {
  52.295 +            licenseText.setText(header.getLicenseHeader());
  52.296 +            String mimeType = header.getFileObject().getMIMEType();
  52.297 +            licenseText.setContentType(mimeType);
  52.298 +            enabled(true);
  52.299 +        }
  52.300 +    }
  52.301 +
  52.302 +    public void setLicenseText(String text) {
  52.303 +        licenseText.setText(text);
  52.304 +    }
  52.305 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LicenseChooserWizardPanel.java	Sun Feb 10 16:18:19 2013 +0100
    53.3 @@ -0,0 +1,147 @@
    53.4 +/*
    53.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    53.6 + *
    53.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    53.8 + *
    53.9 + * The contents of this file are subject to the terms of either the GNU
   53.10 + * General Public License Version 2 only ("GPL") or the Common
   53.11 + * Development and Distribution License("CDDL") (collectively, the
   53.12 + * "License"). You may not use this file except in compliance with the
   53.13 + * License. You can obtain a copy of the License at
   53.14 + * http://www.netbeans.org/cddl-gplv2.html
   53.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   53.16 + * specific language governing permissions and limitations under the
   53.17 + * License.  When distributing the software, include this License Header
   53.18 + * Notice in each file and include the License file at
   53.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   53.20 + * particular file as subject to the "Classpath" exception as provided
   53.21 + * by Sun in the GPL Version 2 section of the License file that
   53.22 + * accompanied this code. If applicable, add the following below the
   53.23 + * License Header, with the fields enclosed by brackets [] replaced by
   53.24 + * your own identifying information:
   53.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   53.26 + *
   53.27 + * If you wish your version of this file to be governed by only the CDDL
   53.28 + * or only the GPL Version 2, indicate your decision by adding
   53.29 + * "[Contributor] elects to include this software in this distribution
   53.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   53.31 + * single choice of license, a recipient has the option to distribute
   53.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   53.33 + * to extend the choice of license to its licensees as provided above.
   53.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   53.35 + * Version 2 license, then the option applies only if the new code is
   53.36 + * made subject to such option by the copyright holder.
   53.37 + *
   53.38 + * Contributor(s):
   53.39 + *
   53.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   53.41 + */
   53.42 +package org.netbeans.modules.licensechanger.wizard;
   53.43 +
   53.44 +import java.beans.PropertyChangeEvent;
   53.45 +import java.beans.PropertyChangeListener;
   53.46 +import javax.swing.event.ChangeListener;
   53.47 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   53.48 +import org.openide.WizardDescriptor;
   53.49 +import org.openide.WizardValidationException;
   53.50 +import org.openide.util.ChangeSupport;
   53.51 +import org.openide.util.HelpCtx;
   53.52 +
   53.53 +/**
   53.54 + *
   53.55 + * @author Nils Hoffmann
   53.56 + */
   53.57 +public class LicenseChooserWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   53.58 +
   53.59 +    /**
   53.60 +     * The visual component that displays this panel. If you need to access the
   53.61 +     * component from this class, just use getComponent().
   53.62 +     */
   53.63 +    private LicenseChooserPanel component;
   53.64 +    private WizardDescriptor wiz;
   53.65 +    private boolean valid = false;
   53.66 +    private ChangeSupport cs = new ChangeSupport(this);
   53.67 +
   53.68 +    // Get the visual component for the panel. In this template, the component
   53.69 +    // is kept separate. This can be more efficient: if the wizard is created
   53.70 +    // but never displayed, or not all panels are displayed, it is better to
   53.71 +    // create only those which really need to be visible.
   53.72 +    @Override
   53.73 +    public LicenseChooserPanel getComponent() {
   53.74 +        if (component == null) {
   53.75 +            component = new LicenseChooserPanel();
   53.76 +            component.addPropertyChangeListener(this);
   53.77 +        }
   53.78 +        return component;
   53.79 +    }
   53.80 +
   53.81 +    @Override
   53.82 +    public HelpCtx getHelp() {
   53.83 +        // Show no Help button for this panel:
   53.84 +        return HelpCtx.DEFAULT_HELP;
   53.85 +        // If you have context help:
   53.86 +        // return new HelpCtx("help.key.here");
   53.87 +    }
   53.88 +
   53.89 +    @Override
   53.90 +    public boolean isValid() {
   53.91 +        return valid;
   53.92 +    }
   53.93 +
   53.94 +    @Override
   53.95 +    public void addChangeListener(ChangeListener l) {
   53.96 +        cs.addChangeListener(l);
   53.97 +    }
   53.98 +
   53.99 +    @Override
  53.100 +    public void removeChangeListener(ChangeListener l) {
  53.101 +        cs.removeChangeListener(l);
  53.102 +    }
  53.103 +
  53.104 +    @Override
  53.105 +    public void propertyChange(PropertyChangeEvent pce) {
  53.106 +        cs.fireChange();
  53.107 +        try {
  53.108 +            validate();
  53.109 +        } catch (WizardValidationException ex) {
  53.110 +            if (wiz != null) {
  53.111 +                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Please select a license!");
  53.112 +            }
  53.113 +        }
  53.114 +    }
  53.115 +
  53.116 +    @Override
  53.117 +    public void readSettings(WizardDescriptor wiz) {
  53.118 +        this.wiz = wiz;
  53.119 +        Object obj = wiz.getProperty(WizardProperties.KEY_LICENSE_TEXT);
  53.120 +        if (obj != null && obj instanceof String) {
  53.121 +            getComponent().setLicenseText((String) obj);
  53.122 +        }
  53.123 +        Boolean b = (Boolean) wiz.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
  53.124 +        if (b != null) {
  53.125 +            getComponent().setUpdateDefaultProjectLicense(b);
  53.126 +        }
  53.127 +    }
  53.128 +
  53.129 +    @Override
  53.130 +    public void storeSettings(WizardDescriptor wiz) {
  53.131 +        wiz.putProperty(WizardProperties.KEY_LICENSE_TEXT, getComponent().getLicenseText());
  53.132 +        wiz.putProperty(WizardProperties.KEY_LICENSE_NAME, getComponent().getLicenseName());
  53.133 +        wiz.putProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE, Boolean.valueOf(getComponent().isUpdateDefaultProjectLicense()));
  53.134 +    }
  53.135 +
  53.136 +    @Override
  53.137 +    public void validate() throws WizardValidationException {
  53.138 +        valid = true;
  53.139 +        if (getComponent().getLicenseText() == null
  53.140 +                || getComponent().getLicenseText().equals(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT)) {
  53.141 +            valid = false;
  53.142 +            throw new WizardValidationException(component, "Please select a license!", null);
  53.143 +        }
  53.144 +        if (wiz != null) {
  53.145 +            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  53.146 +            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  53.147 +            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  53.148 +        }
  53.149 +    }
  53.150 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LineEndingsPanel.form	Sun Feb 10 16:18:19 2013 +0100
    54.3 @@ -0,0 +1,119 @@
    54.4 +<?xml version="1.0" encoding="UTF-8" ?>
    54.5 +
    54.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    54.7 +  <NonVisualComponents>
    54.8 +    <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
    54.9 +    </Component>
   54.10 +  </NonVisualComponents>
   54.11 +  <Properties>
   54.12 +    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   54.13 +      <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
   54.14 +        <TitledBorder title="Line Endings">
   54.15 +          <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   54.16 +        </TitledBorder>
   54.17 +      </Border>
   54.18 +    </Property>
   54.19 +  </Properties>
   54.20 +  <AccessibilityProperties>
   54.21 +    <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   54.22 +      <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   54.23 +    </Property>
   54.24 +  </AccessibilityProperties>
   54.25 +  <AuxValues>
   54.26 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
   54.27 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   54.28 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   54.29 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   54.30 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   54.31 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   54.32 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   54.33 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   54.34 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   54.35 +  </AuxValues>
   54.36 +
   54.37 +  <Layout>
   54.38 +    <DimensionLayout dim="0">
   54.39 +      <Group type="103" groupAlignment="0" attributes="0">
   54.40 +          <Group type="102" attributes="0">
   54.41 +              <EmptySpace max="-2" attributes="0"/>
   54.42 +              <Group type="103" groupAlignment="0" attributes="0">
   54.43 +                  <Component id="noChangeButton" alignment="0" min="-2" max="-2" attributes="0"/>
   54.44 +                  <Component id="systemDefaultButton" alignment="0" min="-2" max="-2" attributes="0"/>
   54.45 +                  <Component id="newlineButton" alignment="0" min="-2" max="-2" attributes="0"/>
   54.46 +                  <Component id="forceCrlf" alignment="0" min="-2" max="-2" attributes="0"/>
   54.47 +              </Group>
   54.48 +              <EmptySpace max="32767" attributes="0"/>
   54.49 +          </Group>
   54.50 +      </Group>
   54.51 +    </DimensionLayout>
   54.52 +    <DimensionLayout dim="1">
   54.53 +      <Group type="103" groupAlignment="0" attributes="0">
   54.54 +          <Group type="102" alignment="0" attributes="0">
   54.55 +              <Component id="noChangeButton" min="-2" max="-2" attributes="0"/>
   54.56 +              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   54.57 +              <Component id="systemDefaultButton" min="-2" max="-2" attributes="0"/>
   54.58 +              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   54.59 +              <Component id="newlineButton" min="-2" max="-2" attributes="0"/>
   54.60 +              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   54.61 +              <Component id="forceCrlf" min="-2" max="-2" attributes="0"/>
   54.62 +              <EmptySpace max="32767" attributes="0"/>
   54.63 +          </Group>
   54.64 +      </Group>
   54.65 +    </DimensionLayout>
   54.66 +  </Layout>
   54.67 +  <SubComponents>
   54.68 +    <Component class="javax.swing.JRadioButton" name="noChangeButton">
   54.69 +      <Properties>
   54.70 +        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   54.71 +          <ComponentRef name="buttonGroup1"/>
   54.72 +        </Property>
   54.73 +        <Property name="selected" type="boolean" value="true"/>
   54.74 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   54.75 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.noChangeButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   54.76 +        </Property>
   54.77 +      </Properties>
   54.78 +      <Events>
   54.79 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
   54.80 +      </Events>
   54.81 +    </Component>
   54.82 +    <Component class="javax.swing.JRadioButton" name="systemDefaultButton">
   54.83 +      <Properties>
   54.84 +        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   54.85 +          <ComponentRef name="buttonGroup1"/>
   54.86 +        </Property>
   54.87 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   54.88 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.systemDefaultButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   54.89 +        </Property>
   54.90 +      </Properties>
   54.91 +      <Events>
   54.92 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
   54.93 +      </Events>
   54.94 +    </Component>
   54.95 +    <Component class="javax.swing.JRadioButton" name="newlineButton">
   54.96 +      <Properties>
   54.97 +        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
   54.98 +          <ComponentRef name="buttonGroup1"/>
   54.99 +        </Property>
  54.100 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  54.101 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.newlineButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  54.102 +        </Property>
  54.103 +      </Properties>
  54.104 +      <Events>
  54.105 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
  54.106 +      </Events>
  54.107 +    </Component>
  54.108 +    <Component class="javax.swing.JRadioButton" name="forceCrlf">
  54.109 +      <Properties>
  54.110 +        <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
  54.111 +          <ComponentRef name="buttonGroup1"/>
  54.112 +        </Property>
  54.113 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  54.114 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="LineEndingsPanel.forceCrlf.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  54.115 +        </Property>
  54.116 +      </Properties>
  54.117 +      <Events>
  54.118 +        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
  54.119 +      </Events>
  54.120 +    </Component>
  54.121 +  </SubComponents>
  54.122 +</Form>
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/LineEndingsPanel.java	Sun Feb 10 16:18:19 2013 +0100
    55.3 @@ -0,0 +1,171 @@
    55.4 +/*
    55.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    55.6 + *
    55.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    55.8 + *
    55.9 + * The contents of this file are subject to the terms of either the GNU
   55.10 + * General Public License Version 2 only ("GPL") or the Common
   55.11 + * Development and Distribution License("CDDL") (collectively, the
   55.12 + * "License"). You may not use this file except in compliance with the
   55.13 + * License. You can obtain a copy of the License at
   55.14 + * http://www.netbeans.org/cddl-gplv2.html
   55.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   55.16 + * specific language governing permissions and limitations under the
   55.17 + * License.  When distributing the software, include this License Header
   55.18 + * Notice in each file and include the License file at
   55.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   55.20 + * particular file as subject to the "Classpath" exception as provided
   55.21 + * by Sun in the GPL Version 2 section of the License file that
   55.22 + * accompanied this code. If applicable, add the following below the
   55.23 + * License Header, with the fields enclosed by brackets [] replaced by
   55.24 + * your own identifying information:
   55.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   55.26 + *
   55.27 + * If you wish your version of this file to be governed by only the CDDL
   55.28 + * or only the GPL Version 2, indicate your decision by adding
   55.29 + * "[Contributor] elects to include this software in this distribution
   55.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   55.31 + * single choice of license, a recipient has the option to distribute
   55.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   55.33 + * to extend the choice of license to its licensees as provided above.
   55.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   55.35 + * Version 2 license, then the option applies only if the new code is
   55.36 + * made subject to such option by the copyright holder.
   55.37 + *
   55.38 + * Contributor(s):
   55.39 + *
   55.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   55.41 + */
   55.42 +
   55.43 +/*
   55.44 + * LineEndingsPanel.java
   55.45 + *
   55.46 + * Created on Mar 20, 2009, 12:33:04 AM
   55.47 + */
   55.48 +package org.netbeans.modules.licensechanger.wizard;
   55.49 +
   55.50 +import javax.swing.JRadioButton;
   55.51 +import org.netbeans.modules.licensechanger.wizard.utils.LineEndingPreference;
   55.52 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   55.53 +import org.openide.util.NbPreferences;
   55.54 +
   55.55 +/**
   55.56 + *
   55.57 + * @author Administrator
   55.58 + */
   55.59 +public class LineEndingsPanel extends javax.swing.JPanel {
   55.60 +
   55.61 +    /**
   55.62 +     * Creates new form LineEndingsPanel
   55.63 +     */
   55.64 +    public LineEndingsPanel() {
   55.65 +        initComponents();
   55.66 +        forceCrlf.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_CRLF);
   55.67 +        noChangeButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE);
   55.68 +        newlineButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_NEWLINE);
   55.69 +        systemDefaultButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.SYSTEM_DEFAULT);
   55.70 +    }
   55.71 +
   55.72 +    /**
   55.73 +     * This method is called from within the constructor to initialize the form.
   55.74 +     * WARNING: Do NOT modify this code. The content of this method is always
   55.75 +     * regenerated by the Form Editor.
   55.76 +     */
   55.77 +    @SuppressWarnings("unchecked")
   55.78 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   55.79 +    private void initComponents() {
   55.80 +
   55.81 +        buttonGroup1 = new javax.swing.ButtonGroup();
   55.82 +        noChangeButton = new javax.swing.JRadioButton();
   55.83 +        systemDefaultButton = new javax.swing.JRadioButton();
   55.84 +        newlineButton = new javax.swing.JRadioButton();
   55.85 +        forceCrlf = new javax.swing.JRadioButton();
   55.86 +
   55.87 +        setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title"))); // NOI18N
   55.88 +
   55.89 +        buttonGroup1.add(noChangeButton);
   55.90 +        noChangeButton.setSelected(true);
   55.91 +        noChangeButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.noChangeButton.text_1")); // NOI18N
   55.92 +        noChangeButton.addActionListener(new java.awt.event.ActionListener() {
   55.93 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
   55.94 +                lineEndingPreferenceChanged(evt);
   55.95 +            }
   55.96 +        });
   55.97 +
   55.98 +        buttonGroup1.add(systemDefaultButton);
   55.99 +        systemDefaultButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.systemDefaultButton.text_1")); // NOI18N
  55.100 +        systemDefaultButton.addActionListener(new java.awt.event.ActionListener() {
  55.101 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  55.102 +                lineEndingPreferenceChanged(evt);
  55.103 +            }
  55.104 +        });
  55.105 +
  55.106 +        buttonGroup1.add(newlineButton);
  55.107 +        newlineButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.newlineButton.text_1")); // NOI18N
  55.108 +        newlineButton.addActionListener(new java.awt.event.ActionListener() {
  55.109 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  55.110 +                lineEndingPreferenceChanged(evt);
  55.111 +            }
  55.112 +        });
  55.113 +
  55.114 +        buttonGroup1.add(forceCrlf);
  55.115 +        forceCrlf.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.forceCrlf.text_1")); // NOI18N
  55.116 +        forceCrlf.addActionListener(new java.awt.event.ActionListener() {
  55.117 +            public void actionPerformed(java.awt.event.ActionEvent evt) {
  55.118 +                lineEndingPreferenceChanged(evt);
  55.119 +            }
  55.120 +        });
  55.121 +
  55.122 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  55.123 +        this.setLayout(layout);
  55.124 +        layout.setHorizontalGroup(
  55.125 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  55.126 +            .addGroup(layout.createSequentialGroup()
  55.127 +                .addContainerGap()
  55.128 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  55.129 +                    .addComponent(noChangeButton)
  55.130 +                    .addComponent(systemDefaultButton)
  55.131 +                    .addComponent(newlineButton)
  55.132 +                    .addComponent(forceCrlf))
  55.133 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  55.134 +        );
  55.135 +        layout.setVerticalGroup(
  55.136 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  55.137 +            .addGroup(layout.createSequentialGroup()
  55.138 +                .addComponent(noChangeButton)
  55.139 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  55.140 +                .addComponent(systemDefaultButton)
  55.141 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  55.142 +                .addComponent(newlineButton)
  55.143 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  55.144 +                .addComponent(forceCrlf)
  55.145 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  55.146 +        );
  55.147 +
  55.148 +        getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title")); // NOI18N
  55.149 +    }// </editor-fold>//GEN-END:initComponents
  55.150 +
  55.151 +    private void lineEndingPreferenceChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lineEndingPreferenceChanged
  55.152 +        for (JRadioButton b : new JRadioButton[]{forceCrlf, newlineButton, noChangeButton, systemDefaultButton}) {
  55.153 +            if (b.isSelected()) {
  55.154 +                LineEndingPreference x = (LineEndingPreference) b.getClientProperty(WizardProperties.PROP_ENDING);
  55.155 +                if (x != null) {
  55.156 +                    NbPreferences.forModule(LineEndingsPanel.class).put(WizardProperties.PROP_ENDING, x.name());
  55.157 +                }
  55.158 +                break;
  55.159 +            }
  55.160 +        }
  55.161 +    }//GEN-LAST:event_lineEndingPreferenceChanged
  55.162 +
  55.163 +    public static LineEndingPreference getLineEndingPrefs() {
  55.164 +        String ending = NbPreferences.forModule(LineEndingsPanel.class).get(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE.name());
  55.165 +        return LineEndingPreference.valueOf(ending);
  55.166 +    }
  55.167 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  55.168 +    private javax.swing.ButtonGroup buttonGroup1;
  55.169 +    private javax.swing.JRadioButton forceCrlf;
  55.170 +    private javax.swing.JRadioButton newlineButton;
  55.171 +    private javax.swing.JRadioButton noChangeButton;
  55.172 +    private javax.swing.JRadioButton systemDefaultButton;
  55.173 +    // End of variables declaration//GEN-END:variables
  55.174 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/PreviewPanel.form	Sun Feb 10 16:18:19 2013 +0100
    56.3 @@ -0,0 +1,105 @@
    56.4 +<?xml version="1.0" encoding="UTF-8" ?>
    56.5 +
    56.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    56.7 +  <AuxValues>
    56.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    56.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   56.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   56.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   56.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   56.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   56.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   56.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   56.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   56.17 +  </AuxValues>
   56.18 +
   56.19 +  <Layout>
   56.20 +    <DimensionLayout dim="0">
   56.21 +      <Group type="103" groupAlignment="0" attributes="0">
   56.22 +          <Group type="102" attributes="0">
   56.23 +              <EmptySpace max="-2" attributes="0"/>
   56.24 +              <Group type="103" groupAlignment="0" attributes="0">
   56.25 +                  <Component id="jSplitPane1" alignment="0" max="32767" attributes="0"/>
   56.26 +                  <Component id="jLabel3" alignment="0" max="32767" attributes="0"/>
   56.27 +                  <Group type="102" alignment="0" attributes="0">
   56.28 +                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   56.29 +                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
   56.30 +                  </Group>
   56.31 +              </Group>
   56.32 +              <EmptySpace max="-2" attributes="0"/>
   56.33 +          </Group>
   56.34 +      </Group>
   56.35 +    </DimensionLayout>
   56.36 +    <DimensionLayout dim="1">
   56.37 +      <Group type="103" groupAlignment="0" attributes="0">
   56.38 +          <Group type="102" alignment="1" attributes="0">
   56.39 +              <EmptySpace max="-2" attributes="0"/>
   56.40 +              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   56.41 +              <EmptySpace max="-2" attributes="0"/>
   56.42 +              <Component id="jSplitPane1" pref="384" max="32767" attributes="0"/>
   56.43 +              <EmptySpace max="-2" attributes="0"/>
   56.44 +              <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
   56.45 +          </Group>
   56.46 +      </Group>
   56.47 +    </DimensionLayout>
   56.48 +  </Layout>
   56.49 +  <SubComponents>
   56.50 +    <Container class="javax.swing.JSplitPane" name="jSplitPane1">
   56.51 +      <Properties>
   56.52 +        <Property name="dividerLocation" type="int" value="200"/>
   56.53 +        <Property name="orientation" type="int" value="0"/>
   56.54 +        <Property name="resizeWeight" type="double" value="0.5"/>
   56.55 +      </Properties>
   56.56 +
   56.57 +      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
   56.58 +      <SubComponents>
   56.59 +        <Container class="javax.swing.JScrollPane" name="fileList">
   56.60 +          <AuxValues>
   56.61 +            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new OutlineView()"/>
   56.62 +          </AuxValues>
   56.63 +          <Constraints>
   56.64 +            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
   56.65 +              <JSplitPaneConstraints position="top"/>
   56.66 +            </Constraint>
   56.67 +          </Constraints>
   56.68 +
   56.69 +          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   56.70 +        </Container>
   56.71 +        <Container class="javax.swing.JPanel" name="diffPanel">
   56.72 +          <Constraints>
   56.73 +            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
   56.74 +              <JSplitPaneConstraints position="right"/>
   56.75 +            </Constraint>
   56.76 +          </Constraints>
   56.77 +
   56.78 +          <Layout>
   56.79 +            <DimensionLayout dim="0">
   56.80 +              <Group type="103" groupAlignment="0" attributes="0">
   56.81 +                  <EmptySpace min="0" pref="417" max="32767" attributes="0"/>
   56.82 +              </Group>
   56.83 +            </DimensionLayout>
   56.84 +            <DimensionLayout dim="1">
   56.85 +              <Group type="103" groupAlignment="0" attributes="0">
   56.86 +                  <EmptySpace min="0" pref="178" max="32767" attributes="0"/>
   56.87 +              </Group>
   56.88 +            </DimensionLayout>
   56.89 +          </Layout>
   56.90 +        </Container>
   56.91 +      </SubComponents>
   56.92 +    </Container>
   56.93 +    <Component class="javax.swing.JLabel" name="jLabel3">
   56.94 +      <Properties>
   56.95 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   56.96 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="PreviewPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   56.97 +        </Property>
   56.98 +      </Properties>
   56.99 +    </Component>
  56.100 +    <Component class="javax.swing.JLabel" name="jLabel1">
  56.101 +      <Properties>
  56.102 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
  56.103 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="PreviewPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
  56.104 +        </Property>
  56.105 +      </Properties>
  56.106 +    </Component>
  56.107 +  </SubComponents>
  56.108 +</Form>
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/PreviewPanel.java	Sun Feb 10 16:18:19 2013 +0100
    57.3 @@ -0,0 +1,361 @@
    57.4 +/*
    57.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    57.6 + *
    57.7 + * Copyright 2009 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 2009 Sun Microsystems, Inc.
   57.41 + */
   57.42 +package org.netbeans.modules.licensechanger.wizard;
   57.43 +
   57.44 +import java.awt.EventQueue;
   57.45 +import java.beans.PropertyChangeEvent;
   57.46 +import java.beans.PropertyChangeListener;
   57.47 +import java.io.ByteArrayOutputStream;
   57.48 +import java.io.IOException;
   57.49 +import java.io.PrintWriter;
   57.50 +import java.io.StringReader;
   57.51 +import java.util.Collections;
   57.52 +import java.util.HashSet;
   57.53 +import java.util.Map;
   57.54 +import java.util.Set;
   57.55 +import org.netbeans.api.diff.Diff;
   57.56 +import org.netbeans.api.diff.DiffView;
   57.57 +import org.netbeans.api.diff.StreamSource;
   57.58 +import org.netbeans.modules.licensechanger.api.FileHandler;
   57.59 +import org.netbeans.modules.licensechanger.wizard.utils.FileChildren;
   57.60 +import org.netbeans.modules.licensechanger.wizard.utils.FileChildren.FileItem;
   57.61 +import org.netbeans.modules.licensechanger.wizard.utils.FileLoader;
   57.62 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   57.63 +import org.netbeans.swing.outline.DefaultOutlineModel;
   57.64 +import org.openide.explorer.ExplorerManager;
   57.65 +import org.openide.explorer.view.CheckableNode;
   57.66 +import org.openide.explorer.view.OutlineView;
   57.67 +import org.openide.filesystems.FileObject;
   57.68 +import org.openide.nodes.AbstractNode;
   57.69 +import org.openide.nodes.Children;
   57.70 +import org.openide.nodes.Node;
   57.71 +import org.openide.util.Exceptions;
   57.72 +import org.openide.util.RequestProcessor;
   57.73 +import org.openide.util.RequestProcessor.Task;
   57.74 +
   57.75 +/**
   57.76 + *
   57.77 + * @author Tim Boudreau
   57.78 + * @author Nils Hoffmann (Refactoring, Diff API inclusion)
   57.79 + */
   57.80 +public class PreviewPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener {
   57.81 +
   57.82 +    private final ExplorerManager mgr = new ExplorerManager();
   57.83 +    private ItemLoader loader;
   57.84 +    private String licenseText;
   57.85 +    private Diff diff;
   57.86 +    private Map<String, Object> properties;
   57.87 +
   57.88 +    public PreviewPanel() {
   57.89 +        diff = Diff.getDefault();
   57.90 +        initComponents();
   57.91 +        mgr.addPropertyChangeListener(this);
   57.92 +        jLabel3.setText("  ");
   57.93 +        updateView();
   57.94 +    }
   57.95 +
   57.96 +    private void updateView() {
   57.97 +        OutlineView ov = (OutlineView) fileList;
   57.98 +        ov.getOutline().setRootVisible(false);
   57.99 +        ov.setPopupAllowed(false);
  57.100 +        ov.setTreeSortable(false);
  57.101 +        ov.getOutline().setShowGrid(false);
  57.102 +        String headerName = org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.nodesLabel.text"); // NOI18N
  57.103 +        ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(headerName);
  57.104 +        setName("Preview Changes");
  57.105 +    }
  57.106 +
  57.107 +    public void setFolders(Set<FileObject> folders, Set<FileHandler> fileHandler) {
  57.108 +        Children kids = Children.create(new FileChildren(folders, fileHandler), true);
  57.109 +        mgr.setRootContext(new AbstractNode(kids));
  57.110 +        updateView();
  57.111 +        updateItems();
  57.112 +    }
  57.113 +
  57.114 +    public Set<FileItem> getSelectedItems() {
  57.115 +        Set<FileItem> s = new HashSet<FileItem>();
  57.116 +        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  57.117 +            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  57.118 +            if (cn != null && cn.isSelected()) {
  57.119 +                s.addAll(n.getLookup().lookupAll(FileItem.class));
  57.120 +            }
  57.121 +        }
  57.122 +        return s;
  57.123 +    }
  57.124 +
  57.125 +    private void updateItems() {
  57.126 +        Set<FileItem> s = getSelectedItems();
  57.127 +        firePropertyChange(WizardProperties.KEY_ITEMS, null, s);
  57.128 +    }
  57.129 +
  57.130 +    public void setLicenseText(String licenseText) {
  57.131 +        this.licenseText = licenseText;
  57.132 +        firePropertyChange(WizardProperties.KEY_LICENSE_TEXT, null, this.licenseText);
  57.133 +    }
  57.134 +
  57.135 +    void setProperties(Map<String, Object> properties) {
  57.136 +        this.properties = properties;
  57.137 +    }
  57.138 +
  57.139 +    /**
  57.140 +     * This method is called from within the constructor to initialize the form.
  57.141 +     * WARNING: Do NOT modify this code. The content of this method is always
  57.142 +     * regenerated by the Form Editor.
  57.143 +     */
  57.144 +    @SuppressWarnings("unchecked")
  57.145 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  57.146 +    private void initComponents() {
  57.147 +
  57.148 +        jSplitPane1 = new javax.swing.JSplitPane();
  57.149 +        fileList = new OutlineView();
  57.150 +        diffPanel = new javax.swing.JPanel();
  57.151 +        jLabel3 = new javax.swing.JLabel();
  57.152 +        jLabel1 = new javax.swing.JLabel();
  57.153 +
  57.154 +        jSplitPane1.setDividerLocation(200);
  57.155 +        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
  57.156 +        jSplitPane1.setResizeWeight(0.5);
  57.157 +        jSplitPane1.setTopComponent(fileList);
  57.158 +
  57.159 +        javax.swing.GroupLayout diffPanelLayout = new javax.swing.GroupLayout(diffPanel);
  57.160 +        diffPanel.setLayout(diffPanelLayout);
  57.161 +        diffPanelLayout.setHorizontalGroup(
  57.162 +            diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  57.163 +            .addGap(0, 417, Short.MAX_VALUE)
  57.164 +        );
  57.165 +        diffPanelLayout.setVerticalGroup(
  57.166 +            diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  57.167 +            .addGap(0, 178, Short.MAX_VALUE)
  57.168 +        );
  57.169 +
  57.170 +        jSplitPane1.setRightComponent(diffPanel);
  57.171 +
  57.172 +        jLabel3.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel3.text")); // NOI18N
  57.173 +
  57.174 +        jLabel1.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel1.text")); // NOI18N
  57.175 +
  57.176 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  57.177 +        this.setLayout(layout);
  57.178 +        layout.setHorizontalGroup(
  57.179 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  57.180 +            .addGroup(layout.createSequentialGroup()
  57.181 +                .addContainerGap()
  57.182 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  57.183 +                    .addComponent(jSplitPane1)
  57.184 +                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  57.185 +                    .addGroup(layout.createSequentialGroup()
  57.186 +                        .addComponent(jLabel1)
  57.187 +                        .addGap(0, 0, Short.MAX_VALUE)))
  57.188 +                .addContainerGap())
  57.189 +        );
  57.190 +        layout.setVerticalGroup(
  57.191 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  57.192 +            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  57.193 +                .addContainerGap()
  57.194 +                .addComponent(jLabel1)
  57.195 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  57.196 +                .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
  57.197 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  57.198 +                .addComponent(jLabel3))
  57.199 +        );
  57.200 +    }// </editor-fold>//GEN-END:initComponents
  57.201 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  57.202 +    private javax.swing.JPanel diffPanel;
  57.203 +    private javax.swing.JScrollPane fileList;
  57.204 +    private javax.swing.JLabel jLabel1;
  57.205 +    private javax.swing.JLabel jLabel3;
  57.206 +    private javax.swing.JSplitPane jSplitPane1;
  57.207 +    // End of variables declaration//GEN-END:variables
  57.208 +
  57.209 +    @Override
  57.210 +    public ExplorerManager getExplorerManager() {
  57.211 +        return mgr;
  57.212 +    }
  57.213 +
  57.214 +    @Override
  57.215 +    public void propertyChange(PropertyChangeEvent evt) {
  57.216 +        if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
  57.217 +            Node[] n = mgr.getSelectedNodes();
  57.218 +            if (n.length > 0) {
  57.219 +                FileItem item = n[0].getLookup().lookup(FileItem.class);
  57.220 +                if (item != null) {
  57.221 +                    setFileItem(item);
  57.222 +                    // XXX use FileUtil.getFileDisplayName rather than FileObject.getPath
  57.223 +
  57.224 +                    jLabel3.setText(item.getFile().getPath());
  57.225 +                } else {
  57.226 +//                    before.setText("");
  57.227 +                    jLabel3.setText("  ");
  57.228 +                }
  57.229 +            } else {
  57.230 +//                before.setText("");
  57.231 +//                after.setText("");
  57.232 +                jLabel3.setText("  ");
  57.233 +            }
  57.234 +        }
  57.235 +    }
  57.236 +
  57.237 +    private void setFileItem(FileItem item) {
  57.238 +        if (item.getFile().isValid()) {
  57.239 +            // XXX should use Diff API instead (like refactoring preview)
  57.240 +//            before.setContentType("text/plain");
  57.241 +//            after.setContentType("text/plain");
  57.242 +//            before.setText("Loading " + item.getFile().getPath());
  57.243 +//            after.setText("Loading " + item.getFile().getPath());
  57.244 +            ItemLoader ldr = new ItemLoader(item);
  57.245 +            setLoader(ldr);
  57.246 +        }
  57.247 +    }
  57.248 +
  57.249 +    private synchronized void setLoader(ItemLoader ldr) {
  57.250 +        if (loader != null) {
  57.251 +            loader.cancel();
  57.252 +        }
  57.253 +        this.loader = ldr;
  57.254 +        loader.start();
  57.255 +    }
  57.256 +
  57.257 +    private class ItemLoader implements Runnable {
  57.258 +
  57.259 +        private final Task task;
  57.260 +        private volatile boolean cancelled;
  57.261 +        private final FileItem item;
  57.262 +        private volatile String beforeText = "Cancelled";
  57.263 +        private volatile String afterText = "Cancelled";
  57.264 +
  57.265 +        public ItemLoader(FileItem item) {
  57.266 +            this.item = item;
  57.267 +            task = RequestProcessor.getDefault().create(this);
  57.268 +        }
  57.269 +
  57.270 +        void start() {
  57.271 +            task.schedule(200);
  57.272 +        }
  57.273 +
  57.274 +        public void cancel() {
  57.275 +            cancelled = true;
  57.276 +            task.cancel();
  57.277 +        }
  57.278 +
  57.279 +        private void loadFile() throws IOException {
  57.280 +            beforeText = FileLoader.loadFile(item.getFile());
  57.281 +        }
  57.282 +
  57.283 +        @Override
  57.284 +        public void run() {
  57.285 +            if (cancelled) {
  57.286 +                return;
  57.287 +            }
  57.288 +            if (!EventQueue.isDispatchThread()) {
  57.289 +                try {
  57.290 +                    if (cancelled) {
  57.291 +                        return;
  57.292 +                    }
  57.293 +                    if (!item.getFile().isValid()) {
  57.294 +                        beforeText = "Invalid file";
  57.295 +                        afterText = "Invalid file";
  57.296 +                        return;
  57.297 +                    }
  57.298 +                    if (!item.getFile().canRead()) {
  57.299 +                        beforeText = "Cannot read " + item.getFile().getPath();
  57.300 +                        afterText = "Cannot read " + item.getFile().getPath();
  57.301 +                        return;
  57.302 +                    }
  57.303 +                    if (item.getFile().getSize() >= Integer.MAX_VALUE) {
  57.304 +                        beforeText = "File too long: " + item.getFile().getPath();
  57.305 +                        afterText = "File too long: " + item.getFile().getPath();
  57.306 +                        return;
  57.307 +                    }
  57.308 +                    if (item.getFile().getSize() == 0) {
  57.309 +                        beforeText = "Empty file";
  57.310 +                        afterText = "Empty file";
  57.311 +                        return;
  57.312 +                    }
  57.313 +                    if (cancelled) {
  57.314 +                        return;
  57.315 +                    }
  57.316 +                    try {
  57.317 +                        loadFile();
  57.318 +                    } catch (IOException ex) {
  57.319 +                        ByteArrayOutputStream out = new ByteArrayOutputStream();
  57.320 +                        PrintWriter w = new PrintWriter(out);
  57.321 +                        ex.printStackTrace(w);
  57.322 +                        beforeText = new String(out.toByteArray());
  57.323 +                        afterText = "Error";
  57.324 +                        return;
  57.325 +                    }
  57.326 +                    if (cancelled) {
  57.327 +                        return;
  57.328 +                    }
  57.329 +                    if (beforeText.length() == 0) {
  57.330 +                        afterText = "";
  57.331 +                        return;
  57.332 +                    }
  57.333 +                    afterText = transform(beforeText, item.getHandler());
  57.334 +                } finally {
  57.335 +                    if (!cancelled) {
  57.336 +                        EventQueue.invokeLater(this);
  57.337 +                    }
  57.338 +                }
  57.339 +            } else {
  57.340 +                String contentType = item.getFile().getMIMEType();
  57.341 +                DiffView view;
  57.342 +                try {
  57.343 +                    view = diff.createDiff(StreamSource.createSource("Before", "Before", contentType, new StringReader(beforeText)),
  57.344 +                            StreamSource.createSource("After", "After", contentType, new StringReader(afterText)));
  57.345 +                    int dloc = jSplitPane1.getDividerLocation();
  57.346 +                    jSplitPane1.setBottomComponent(view.getComponent());
  57.347 +                    jSplitPane1.setDividerLocation(dloc);
  57.348 +                } catch (IOException ex) {
  57.349 +                    Exceptions.printStackTrace(ex);
  57.350 +                    int dloc = jSplitPane1.getDividerLocation();
  57.351 +                    jSplitPane1.setBottomComponent(diffPanel);
  57.352 +                    jSplitPane1.setDividerLocation(dloc);
  57.353 +                }
  57.354 +
  57.355 +            }
  57.356 +        }
  57.357 +
  57.358 +        private String transform(String beforeText, FileHandler handler) {
  57.359 +            return handler.transform(beforeText, licenseText,
  57.360 +                    properties == null ? Collections.<String, Object>emptyMap()
  57.361 +                    : properties);
  57.362 +        }
  57.363 +    }
  57.364 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/PreviewWizardPanel.java	Sun Feb 10 16:18:19 2013 +0100
    58.3 @@ -0,0 +1,156 @@
    58.4 +/*
    58.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    58.6 + *
    58.7 + * Copyright 2009 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 2009 Sun Microsystems, Inc.
   58.41 + */
   58.42 +package org.netbeans.modules.licensechanger.wizard;
   58.43 +
   58.44 +import java.beans.PropertyChangeEvent;
   58.45 +import java.beans.PropertyChangeListener;
   58.46 +import java.util.Set;
   58.47 +import javax.swing.event.ChangeListener;
   58.48 +import org.netbeans.modules.licensechanger.api.FileHandler;
   58.49 +import org.netbeans.modules.licensechanger.wizard.utils.FileChildren.FileItem;
   58.50 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   58.51 +import org.openide.WizardDescriptor;
   58.52 +import org.openide.WizardValidationException;
   58.53 +import org.openide.filesystems.FileObject;
   58.54 +import org.openide.util.ChangeSupport;
   58.55 +import org.openide.util.HelpCtx;
   58.56 +
   58.57 +/**
   58.58 + *
   58.59 + * @author Nils Hoffmann
   58.60 + */
   58.61 +public class PreviewWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   58.62 +
   58.63 +    /**
   58.64 +     * The visual component that displays this panel. If you need to access the
   58.65 +     * component from this class, just use getComponent().
   58.66 +     */
   58.67 +    private PreviewPanel component;
   58.68 +    private WizardDescriptor wiz;
   58.69 +    private boolean valid = true;
   58.70 +    private ChangeSupport cs = new ChangeSupport(this);
   58.71 +
   58.72 +    // Get the visual component for the panel. In this template, the component
   58.73 +    // is kept separate. This can be more efficient: if the wizard is created
   58.74 +    // but never displayed, or not all panels are displayed, it is better to
   58.75 +    // create only those which really need to be visible.
   58.76 +    @Override
   58.77 +    public PreviewPanel getComponent() {
   58.78 +        if (component == null) {
   58.79 +            component = new PreviewPanel();
   58.80 +            component.addPropertyChangeListener(this);
   58.81 +        }
   58.82 +        return component;
   58.83 +    }
   58.84 +
   58.85 +    @Override
   58.86 +    public HelpCtx getHelp() {
   58.87 +        // Show no Help button for this panel:
   58.88 +        return HelpCtx.DEFAULT_HELP;
   58.89 +        // If you have context help:
   58.90 +        // return new HelpCtx("help.key.here");
   58.91 +    }
   58.92 +
   58.93 +    @Override
   58.94 +    public boolean isValid() {
   58.95 +        return valid;
   58.96 +    }
   58.97 +
   58.98 +    @Override
   58.99 +    public void addChangeListener(ChangeListener l) {
  58.100 +        cs.addChangeListener(l);
  58.101 +    }
  58.102 +
  58.103 +    @Override
  58.104 +    public void removeChangeListener(ChangeListener l) {
  58.105 +        cs.removeChangeListener(l);
  58.106 +    }
  58.107 +
  58.108 +    @Override
  58.109 +    public void propertyChange(PropertyChangeEvent pce) {
  58.110 +        cs.fireChange();
  58.111 +        try {
  58.112 +            validate();
  58.113 +        } catch (WizardValidationException ex) {
  58.114 +            if (wiz != null) {
  58.115 +                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
  58.116 +            }
  58.117 +        }
  58.118 +    }
  58.119 +
  58.120 +    @Override
  58.121 +    public void readSettings(WizardDescriptor wiz) {
  58.122 +        this.wiz = wiz;
  58.123 +        @SuppressWarnings("unchecked")
  58.124 +        String license = (String) wiz.getProperty(WizardProperties.KEY_LICENSE_TEXT);
  58.125 +        if (license != null) {
  58.126 +            getComponent().setLicenseText(license);
  58.127 +        }
  58.128 +        getComponent().setProperties(wiz.getProperties());
  58.129 +        @SuppressWarnings("unchecked")
  58.130 +        Set<FileHandler> fileHandler = (Set<FileHandler>) wiz.getProperty(WizardProperties.KEY_FILE_HANDLERS);
  58.131 +        @SuppressWarnings("unchecked")
  58.132 +        Set<FileObject> folders = (Set<FileObject>) wiz.getProperty(WizardProperties.KEY_FOLDERS);
  58.133 +        if (fileHandler != null && folders != null) {
  58.134 +            getComponent().setFolders(folders, fileHandler);
  58.135 +        }
  58.136 +        wiz.putProperty(WizardProperties.KEY_ITEMS, null);
  58.137 +    }
  58.138 +
  58.139 +    @Override
  58.140 +    public void storeSettings(WizardDescriptor wiz) {
  58.141 +        wiz.putProperty(WizardProperties.KEY_ITEMS, getComponent().getSelectedItems());
  58.142 +    }
  58.143 +
  58.144 +    @Override
  58.145 +    public void validate() throws WizardValidationException {
  58.146 +        valid = true;
  58.147 +        Set<FileItem> keyItems = getComponent().getSelectedItems();
  58.148 +
  58.149 +        if (keyItems == null || keyItems.isEmpty()) {
  58.150 +            valid = false;
  58.151 +            throw new WizardValidationException(component, "Please select at least one file!", null);
  58.152 +        }
  58.153 +        if (wiz != null) {
  58.154 +            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  58.155 +            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  58.156 +            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  58.157 +        }
  58.158 +    }
  58.159 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/SelectFoldersPanel.form	Sun Feb 10 16:18:19 2013 +0100
    59.3 @@ -0,0 +1,66 @@
    59.4 +<?xml version="1.0" encoding="UTF-8" ?>
    59.5 +
    59.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    59.7 +  <AuxValues>
    59.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    59.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   59.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   59.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   59.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   59.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   59.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   59.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   59.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   59.17 +  </AuxValues>
   59.18 +
   59.19 +  <Layout>
   59.20 +    <DimensionLayout dim="0">
   59.21 +      <Group type="103" groupAlignment="0" attributes="0">
   59.22 +          <Group type="102" alignment="0" attributes="0">
   59.23 +              <EmptySpace max="-2" attributes="0"/>
   59.24 +              <Group type="103" groupAlignment="0" attributes="0">
   59.25 +                  <Component id="jScrollPane1" alignment="0" pref="541" max="32767" attributes="0"/>
   59.26 +                  <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
   59.27 +              </Group>
   59.28 +              <EmptySpace max="-2" attributes="0"/>
   59.29 +          </Group>
   59.30 +      </Group>
   59.31 +    </DimensionLayout>
   59.32 +    <DimensionLayout dim="1">
   59.33 +      <Group type="103" groupAlignment="0" attributes="0">
   59.34 +          <Group type="102" alignment="0" attributes="0">
   59.35 +              <EmptySpace max="-2" attributes="0"/>
   59.36 +              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
   59.37 +              <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
   59.38 +              <Component id="jScrollPane1" pref="364" max="32767" attributes="0"/>
   59.39 +              <EmptySpace max="-2" attributes="0"/>
   59.40 +          </Group>
   59.41 +      </Group>
   59.42 +    </DimensionLayout>
   59.43 +  </Layout>
   59.44 +  <SubComponents>
   59.45 +    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
   59.46 +      <Properties>
   59.47 +        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
   59.48 +          <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
   59.49 +            <LineBorder>
   59.50 +              <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
   59.51 +            </LineBorder>
   59.52 +          </Border>
   59.53 +        </Property>
   59.54 +      </Properties>
   59.55 +      <AuxValues>
   59.56 +        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new OutlineView()"/>
   59.57 +      </AuxValues>
   59.58 +
   59.59 +      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   59.60 +    </Container>
   59.61 +    <Component class="javax.swing.JLabel" name="jLabel1">
   59.62 +      <Properties>
   59.63 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   59.64 +          <ResourceString bundle="org/netbeans/modules/licensechanger/wizard/Bundle.properties" key="SelectFoldersPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   59.65 +        </Property>
   59.66 +      </Properties>
   59.67 +    </Component>
   59.68 +  </SubComponents>
   59.69 +</Form>
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/SelectFoldersPanel.java	Sun Feb 10 16:18:19 2013 +0100
    60.3 @@ -0,0 +1,168 @@
    60.4 +/*
    60.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    60.6 + *
    60.7 + * Copyright 2009 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 2009 Sun Microsystems, Inc.
   60.41 + */
   60.42 +package org.netbeans.modules.licensechanger.wizard;
   60.43 +
   60.44 +import java.util.Comparator;
   60.45 +import java.util.Set;
   60.46 +import java.util.TreeSet;
   60.47 +import org.netbeans.modules.licensechanger.wizard.utils.FolderChildren;
   60.48 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   60.49 +import org.netbeans.swing.outline.DefaultOutlineModel;
   60.50 +import org.openide.explorer.ExplorerManager;
   60.51 +import org.openide.explorer.view.CheckableNode;
   60.52 +import org.openide.explorer.view.OutlineView;
   60.53 +import org.openide.filesystems.FileObject;
   60.54 +import org.openide.nodes.AbstractNode;
   60.55 +import org.openide.nodes.Children;
   60.56 +import org.openide.nodes.Node;
   60.57 +
   60.58 +/**
   60.59 + *
   60.60 + * @author Tim Boudreau
   60.61 + * @author Nils Hoffmann (Refactoring)
   60.62 + */
   60.63 +public class SelectFoldersPanel extends javax.swing.JPanel implements ExplorerManager.Provider {
   60.64 +    
   60.65 +    private final ExplorerManager mgr = new ExplorerManager();
   60.66 +    
   60.67 +    public SelectFoldersPanel() {
   60.68 +        initComponents();
   60.69 +        updateView();
   60.70 +        setName("Select Folders");
   60.71 +    }
   60.72 +    
   60.73 +    private void updateFolders() {
   60.74 +        Set<FileObject> folders = getSelectedFolders();
   60.75 +//        System.out.println("Selected folders: " + folders);
   60.76 +        firePropertyChange(WizardProperties.KEY_FOLDERS, null, folders);
   60.77 +    }
   60.78 +    
   60.79 +    private void enableUI() {
   60.80 +        jLabel1.setEnabled(true);
   60.81 +        updateView();
   60.82 +    }
   60.83 +
   60.84 +    /**
   60.85 +     * This method is called from within the constructor to initialize the form.
   60.86 +     * WARNING: Do NOT modify this code. The content of this method is always
   60.87 +     * regenerated by the Form Editor.
   60.88 +     */
   60.89 +    @SuppressWarnings("unchecked")
   60.90 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   60.91 +    private void initComponents() {
   60.92 +
   60.93 +        jScrollPane1 = new OutlineView();
   60.94 +        jLabel1 = new javax.swing.JLabel();
   60.95 +
   60.96 +        jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
   60.97 +
   60.98 +        jLabel1.setText(org.openide.util.NbBundle.getMessage(SelectFoldersPanel.class, "SelectFoldersPanel.jLabel1.text")); // NOI18N
   60.99 +
  60.100 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  60.101 +        this.setLayout(layout);
  60.102 +        layout.setHorizontalGroup(
  60.103 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  60.104 +            .addGroup(layout.createSequentialGroup()
  60.105 +                .addContainerGap()
  60.106 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  60.107 +                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
  60.108 +                    .addComponent(jLabel1))
  60.109 +                .addContainerGap())
  60.110 +        );
  60.111 +        layout.setVerticalGroup(
  60.112 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  60.113 +            .addGroup(layout.createSequentialGroup()
  60.114 +                .addContainerGap()
  60.115 +                .addComponent(jLabel1)
  60.116 +                .addGap(9, 9, 9)
  60.117 +                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)
  60.118 +                .addContainerGap())
  60.119 +        );
  60.120 +    }// </editor-fold>//GEN-END:initComponents
  60.121 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  60.122 +    private javax.swing.JLabel jLabel1;
  60.123 +    private javax.swing.JScrollPane jScrollPane1;
  60.124 +    // End of variables declaration//GEN-END:variables
  60.125 +
  60.126 +    @Override
  60.127 +    public ExplorerManager getExplorerManager() {
  60.128 +        return mgr;
  60.129 +    }
  60.130 +    
  60.131 +    public void setRootFiles(Set<FileObject> roots) {
  60.132 +        AbstractNode root = new AbstractNode(Children.create(new FolderChildren(roots.toArray(new FileObject[roots.size()])) {
  60.133 +            @Override
  60.134 +            public void onAllNodesCreated() {
  60.135 +                enableUI();
  60.136 +                updateFolders();
  60.137 +            }
  60.138 +        }, true));
  60.139 +        mgr.setRootContext(root);
  60.140 +        firePropertyChange("rootFiles", null, roots);
  60.141 +    }
  60.142 +    
  60.143 +    public Set<FileObject> getSelectedFolders() {
  60.144 +        Set<FileObject> folders = new TreeSet<FileObject>(new Comparator<FileObject>() {
  60.145 +            @Override
  60.146 +            public int compare(FileObject t, FileObject t1) {
  60.147 +                return t.getPath().compareTo(t1.getPath());
  60.148 +            }
  60.149 +        });
  60.150 +        for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
  60.151 +            CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
  60.152 +            if (cn != null && cn.isSelected()) {
  60.153 +                FileObject f = n.getLookup().lookup(FileObject.class);
  60.154 +                if (f != null) {
  60.155 +                    folders.add(f);
  60.156 +                }
  60.157 +            }
  60.158 +        }
  60.159 +        return folders;
  60.160 +    }
  60.161 +    
  60.162 +    private void updateView() {
  60.163 +        OutlineView ov = (OutlineView) jScrollPane1;
  60.164 +        ov.getOutline().setRootVisible(false);
  60.165 +        ov.setPopupAllowed(false);
  60.166 +        ov.setTreeSortable(false);
  60.167 +        String headerName = org.openide.util.NbBundle.getMessage(SelectFoldersPanel.class, "SelectFoldersPanel.nodesLabel.text"); // NOI18N
  60.168 +        ((DefaultOutlineModel) ov.getOutline().getOutlineModel()).setNodesColumnLabel(headerName);
  60.169 +        setName("Select Folders");
  60.170 +    }
  60.171 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/SelectFoldersWizardPanel.java	Sun Feb 10 16:18:19 2013 +0100
    61.3 @@ -0,0 +1,152 @@
    61.4 +/*
    61.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    61.6 + *
    61.7 + * Copyright 2009 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 2009 Sun Microsystems, Inc.
   61.41 + */
   61.42 +package org.netbeans.modules.licensechanger.wizard;
   61.43 +
   61.44 +import java.beans.PropertyChangeEvent;
   61.45 +import java.beans.PropertyChangeListener;
   61.46 +import java.util.Set;
   61.47 +import javax.swing.event.ChangeListener;
   61.48 +import org.netbeans.modules.licensechanger.wizard.utils.WizardProperties;
   61.49 +import org.openide.WizardDescriptor;
   61.50 +import org.openide.WizardValidationException;
   61.51 +import org.openide.filesystems.FileObject;
   61.52 +import org.openide.util.ChangeSupport;
   61.53 +import org.openide.util.HelpCtx;
   61.54 +
   61.55 +/**
   61.56 + *
   61.57 + * @author Nils Hoffmann
   61.58 + */
   61.59 +public class SelectFoldersWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
   61.60 +
   61.61 +    /**
   61.62 +     * The visual component that displays this panel. If you need to access the
   61.63 +     * component from this class, just use getComponent().
   61.64 +     */
   61.65 +    private SelectFoldersPanel component;
   61.66 +    private WizardDescriptor wiz;
   61.67 +    private boolean valid = false;
   61.68 +    private ChangeSupport cs = new ChangeSupport(this);
   61.69 +
   61.70 +    // Get the visual component for the panel. In this template, the component
   61.71 +    // is kept separate. This can be more efficient: if the wizard is created
   61.72 +    // but never displayed, or not all panels are displayed, it is better to
   61.73 +    // create only those which really need to be visible.
   61.74 +    @Override
   61.75 +    public SelectFoldersPanel getComponent() {
   61.76 +        if (component == null) {
   61.77 +            component = new SelectFoldersPanel();
   61.78 +            component.addPropertyChangeListener(this);
   61.79 +        }
   61.80 +        return component;
   61.81 +    }
   61.82 +
   61.83 +    @Override
   61.84 +    public HelpCtx getHelp() {
   61.85 +        // Show no Help button for this panel:
   61.86 +        return HelpCtx.DEFAULT_HELP;
   61.87 +        // If you have context help:
   61.88 +        // return new HelpCtx("help.key.here");
   61.89 +    }
   61.90 +
   61.91 +    @Override
   61.92 +    public boolean isValid() {
   61.93 +        return valid;
   61.94 +    }
   61.95 +
   61.96 +    @Override
   61.97 +    public void addChangeListener(ChangeListener l) {
   61.98 +        cs.addChangeListener(l);
   61.99 +    }
  61.100 +
  61.101 +    @Override
  61.102 +    public void removeChangeListener(ChangeListener l) {
  61.103 +        cs.removeChangeListener(l);
  61.104 +    }
  61.105 +
  61.106 +    @Override
  61.107 +    public void propertyChange(PropertyChangeEvent pce) {
  61.108 +        cs.fireChange();
  61.109 +        try {
  61.110 +            validate();
  61.111 +        } catch (WizardValidationException ex) {
  61.112 +            if (wiz != null) {
  61.113 +                wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
  61.114 +            }
  61.115 +        }
  61.116 +    }
  61.117 +
  61.118 +    @Override
  61.119 +    public void readSettings(WizardDescriptor wiz) {
  61.120 +        this.wiz = wiz;
  61.121 +        @SuppressWarnings("unchecked")
  61.122 +        Set<FileObject> folders = (Set<FileObject>) wiz.getProperty(WizardProperties.KEY_FOLDERS);
  61.123 +        if (folders == null || folders.isEmpty()) {
  61.124 +            Object obj = wiz.getProperty(WizardProperties.KEY_ROOT_FILES);
  61.125 +            if (obj != null) {
  61.126 +                @SuppressWarnings("unchecked")
  61.127 +                Set<FileObject> sobj = (Set<FileObject>) obj;
  61.128 +                getComponent().setRootFiles(sobj);
  61.129 +            }
  61.130 +        } else {
  61.131 +            getComponent().setRootFiles(folders);
  61.132 +        }
  61.133 +    }
  61.134 +
  61.135 +    @Override
  61.136 +    public void storeSettings(WizardDescriptor wiz) {
  61.137 +        Set<FileObject> folders = getComponent().getSelectedFolders();
  61.138 +        wiz.putProperty(WizardProperties.KEY_FOLDERS, folders);
  61.139 +    }
  61.140 +
  61.141 +    @Override
  61.142 +    public void validate() throws WizardValidationException {
  61.143 +        valid = true;
  61.144 +        Set<FileObject> folders = getComponent().getSelectedFolders();
  61.145 +        if (folders == null || folders.isEmpty()) {
  61.146 +            valid = false;
  61.147 +            throw new WizardValidationException(component, "Please select at least one folder!", null);
  61.148 +        }
  61.149 +        if (wiz != null) {
  61.150 +            wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
  61.151 +            wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
  61.152 +            wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
  61.153 +        }
  61.154 +    }
  61.155 +}
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/Bundle.properties	Sun Feb 10 16:18:19 2013 +0100
    62.3 @@ -0,0 +1,1 @@
    62.4 +MSG_WAIT_FOLDERS=Scanning for folders, please wait...
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/CheckableNodeCapability.java	Sun Feb 10 16:18:19 2013 +0100
    63.3 @@ -0,0 +1,74 @@
    63.4 +/*
    63.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    63.6 + *
    63.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    63.8 + *
    63.9 + * The contents of this file are subject to the terms of either the GNU
   63.10 + * General Public License Version 2 only ("GPL") or the Common
   63.11 + * Development and Distribution License("CDDL") (collectively, the
   63.12 + * "License"). You may not use this file except in compliance with the
   63.13 + * License. You can obtain a copy of the License at
   63.14 + * http://www.netbeans.org/cddl-gplv2.html
   63.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   63.16 + * specific language governing permissions and limitations under the
   63.17 + * License.  When distributing the software, include this License Header
   63.18 + * Notice in each file and include the License file at
   63.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   63.20 + * particular file as subject to the "Classpath" exception as provided
   63.21 + * by Sun in the GPL Version 2 section of the License file that
   63.22 + * accompanied this code. If applicable, add the following below the
   63.23 + * License Header, with the fields enclosed by brackets [] replaced by
   63.24 + * your own identifying information:
   63.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   63.26 + *
   63.27 + * If you wish your version of this file to be governed by only the CDDL
   63.28 + * or only the GPL Version 2, indicate your decision by adding
   63.29 + * "[Contributor] elects to include this software in this distribution
   63.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   63.31 + * single choice of license, a recipient has the option to distribute
   63.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   63.33 + * to extend the choice of license to its licensees as provided above.
   63.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   63.35 + * Version 2 license, then the option applies only if the new code is
   63.36 + * made subject to such option by the copyright holder.
   63.37 + *
   63.38 + * Contributor(s):
   63.39 + *
   63.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   63.41 + */
   63.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   63.43 +
   63.44 +import org.openide.explorer.view.CheckableNode;
   63.45 +
   63.46 +/**
   63.47 + * Implements {@link CheckableNode} to allow display and use of checkable nodes
   63.48 + * in views.
   63.49 + *
   63.50 + * @author Nils Hoffmann
   63.51 + */
   63.52 +public class CheckableNodeCapability implements CheckableNode {
   63.53 +
   63.54 +    private boolean checkable = true;
   63.55 +    private boolean checkEnabled = true;
   63.56 +    private boolean selected = true;
   63.57 +
   63.58 +    @Override
   63.59 +    public boolean isCheckable() {
   63.60 +        return checkable;
   63.61 +    }
   63.62 +
   63.63 +    @Override
   63.64 +    public boolean isCheckEnabled() {
   63.65 +        return checkEnabled;
   63.66 +    }
   63.67 +
   63.68 +    @Override
   63.69 +    public Boolean isSelected() {
   63.70 +        return selected;
   63.71 +    }
   63.72 +
   63.73 +    @Override
   63.74 +    public void setSelected(Boolean selected) {
   63.75 +        this.selected = selected.booleanValue();
   63.76 +    }
   63.77 +}
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/FileChildren.java	Sun Feb 10 16:18:19 2013 +0100
    64.3 @@ -0,0 +1,153 @@
    64.4 +/*
    64.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    64.6 + *
    64.7 + * Copyright 2009 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 Sun Microsystems, Inc.
   64.41 + */
   64.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   64.43 +
   64.44 +import java.util.Collection;
   64.45 +import java.util.Collections;
   64.46 +import java.util.HashSet;
   64.47 +import java.util.LinkedList;
   64.48 +import java.util.List;
   64.49 +import java.util.Set;
   64.50 +import javax.swing.Action;
   64.51 +import org.netbeans.modules.licensechanger.api.FileHandler;
   64.52 +import org.openide.filesystems.FileObject;
   64.53 +import org.openide.loaders.DataObject;
   64.54 +import org.openide.loaders.DataObjectNotFoundException;
   64.55 +import org.openide.nodes.ChildFactory;
   64.56 +import org.openide.nodes.FilterNode;
   64.57 +import org.openide.nodes.Node;
   64.58 +import org.openide.util.Exceptions;
   64.59 +import org.openide.util.lookup.Lookups;
   64.60 +import org.openide.util.lookup.ProxyLookup;
   64.61 +
   64.62 +/**
   64.63 + *
   64.64 + * @author Tim Boudreau (original author)
   64.65 + * @author Nils Hoffmann (changed to use CheckableNodeCapability)
   64.66 + */
   64.67 +public class FileChildren extends ChildFactory.Detachable<FileObject> {
   64.68 +
   64.69 +    private final Set<FileObject> folders;
   64.70 +    private final Collection<? extends FileHandler> allHandlers;
   64.71 +    private final Set<FileItem> items = Collections.synchronizedSet(new HashSet<FileItem>());
   64.72 +
   64.73 +    public FileChildren(Set<FileObject> folders, Set<FileHandler> fileHandler) {
   64.74 +        assert folders != null;
   64.75 +        this.folders = new HashSet<FileObject>(folders);
   64.76 +        allHandlers = fileHandler;//Lookup.getDefault().lookupAll(FileHandler.class);
   64.77 +        //settings.put(WizardProperties.KEY_ITEMS, items);
   64.78 +    }
   64.79 +
   64.80 +    @Override
   64.81 +    protected boolean createKeys(List<FileObject> toPopulate) {
   64.82 +        toPopulate.addAll(folders);
   64.83 +        return true;
   64.84 +    }
   64.85 +
   64.86 +    @Override
   64.87 +    protected Node[] createNodesForKey(FileObject key) {
   64.88 +        List<Node> result = new LinkedList<Node>();
   64.89 +        for (FileObject fo : key.getChildren()) {
   64.90 +            if (fo.isData()) {
   64.91 +                for (FileHandler h : allHandlers) {
   64.92 +                    if (h.match(fo)) {
   64.93 +                        try {
   64.94 +                            DataObject dob = DataObject.find(fo);
   64.95 +                            FileItem item = new FileItem(h, fo);
   64.96 +                            items.add(item);
   64.97 +                            FN fn = new FN(dob.getNodeDelegate(), item);
   64.98 +                            boolean shouldChange = !h.shouldSkipFile(fo);
   64.99 +                            result.add(fn);
  64.100 +//                            fn.setValue (CheckboxListView.SELECTED, shouldChange);
  64.101 +                            break;
  64.102 +                        } catch (DataObjectNotFoundException ex) {
  64.103 +                            Exceptions.printStackTrace(ex);
  64.104 +                        }
  64.105 +                    }
  64.106 +                }
  64.107 +            }
  64.108 +        }
  64.109 +        return result.toArray(new Node[result.size()]);
  64.110 +    }
  64.111 +
  64.112 +    public static final class FileItem {
  64.113 +
  64.114 +        FileHandler handler;
  64.115 +        FileObject file;
  64.116 +
  64.117 +        public FileItem(FileHandler handler, FileObject file) {
  64.118 +            this.handler = handler;
  64.119 +            this.file = file;
  64.120 +        }
  64.121 +
  64.122 +        public FileObject getFile() {
  64.123 +            return file;
  64.124 +        }
  64.125 +
  64.126 +        public FileHandler getHandler() {
  64.127 +            return handler;
  64.128 +        }
  64.129 +    }
  64.130 +
  64.131 +    private static final class FN extends FilterNode {
  64.132 +
  64.133 +        FN(Node orig, FileItem item) {
  64.134 +            super(orig, Children.LEAF, new ProxyLookup(
  64.135 +                    Lookups.fixed(item, new CheckableNodeCapability()),
  64.136 +                    orig.getLookup()));
  64.137 +            disableDelegation(DELEGATE_GET_ACTIONS);
  64.138 +            disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
  64.139 +            disableDelegation(DELEGATE_SET_DISPLAY_NAME);
  64.140 +            disableDelegation(DELEGATE_GET_DISPLAY_NAME);
  64.141 +            disableDelegation(DELEGATE_GET_VALUE);
  64.142 +            disableDelegation(DELEGATE_SET_VALUE);
  64.143 +            disableDelegation(DELEGATE_SET_NAME);
  64.144 +            disableDelegation(DELEGATE_GET_NAME);
  64.145 +//            setValue(CheckboxListView.SELECTED, Boolean.TRUE);
  64.146 +            setName(item.file.getPath());
  64.147 +            setDisplayName(item.file.getPath());
  64.148 +            setShortDescription(item.file.getPath());
  64.149 +        }
  64.150 +
  64.151 +        @Override
  64.152 +        public Action[] getActions(boolean ignored) {
  64.153 +            return new Action[0];
  64.154 +        }
  64.155 +    }
  64.156 +}
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/FileLoader.java	Sun Feb 10 16:18:19 2013 +0100
    65.3 @@ -0,0 +1,80 @@
    65.4 +/*
    65.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    65.6 + *
    65.7 + * Copyright 2009 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 Sun Microsystems, Inc.
   65.41 + */
   65.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   65.43 +
   65.44 +import java.io.BufferedInputStream;
   65.45 +import java.io.ByteArrayOutputStream;
   65.46 +import java.io.IOException;
   65.47 +import java.io.InputStream;
   65.48 +import java.io.UnsupportedEncodingException;
   65.49 +import java.nio.charset.Charset;
   65.50 +import org.netbeans.api.queries.FileEncodingQuery;
   65.51 +import org.openide.filesystems.FileObject;
   65.52 +import org.openide.filesystems.FileUtil;
   65.53 +
   65.54 +/**
   65.55 + * @author Tim Boudreau
   65.56 + * @author Nils Hoffmann (Refactoring)
   65.57 + */
   65.58 +public class FileLoader {
   65.59 +
   65.60 +    public static String loadFile(FileObject file) throws IOException {
   65.61 +        Charset encoding = FileEncodingQuery.getEncoding(file);
   65.62 +        InputStream in = new BufferedInputStream(file.getInputStream());
   65.63 +        ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.getSize());
   65.64 +        try {
   65.65 +            FileUtil.copy(in, out);
   65.66 +            try {
   65.67 +                String result = new String(out.toByteArray(), encoding.name());
   65.68 +                String sep = System.getProperty("line.separator");
   65.69 +                //Convert everything internally to use \n
   65.70 +                if (!"\n".equals(sep) && sep != null) {
   65.71 +                    return result.replaceAll(sep, "\n");
   65.72 +                } else {
   65.73 +                    return result;
   65.74 +                }
   65.75 +            } catch (UnsupportedEncodingException q) {
   65.76 +                return new String(out.toByteArray(), FileEncodingQuery.getDefaultEncoding().name());
   65.77 +            }
   65.78 +        } finally {
   65.79 +            in.close();
   65.80 +            out.close();
   65.81 +        }
   65.82 +    }
   65.83 +}
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/FolderChildren.java	Sun Feb 10 16:18:19 2013 +0100
    66.3 @@ -0,0 +1,185 @@
    66.4 +/*
    66.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    66.6 + *
    66.7 + * Copyright 2009 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 2009 Sun Microsystems, Inc.
   66.41 + */
   66.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   66.43 +
   66.44 +import java.awt.EventQueue;
   66.45 +import java.util.List;
   66.46 +import javax.swing.Action;
   66.47 +import org.openide.explorer.view.CheckableNode;
   66.48 +import org.openide.filesystems.FileObject;
   66.49 +import org.openide.filesystems.FileUtil;
   66.50 +import org.openide.loaders.DataObject;
   66.51 +import org.openide.loaders.DataObjectNotFoundException;
   66.52 +import org.openide.nodes.AbstractNode;
   66.53 +import org.openide.nodes.ChildFactory;
   66.54 +import org.openide.nodes.Children;
   66.55 +import org.openide.nodes.FilterNode;
   66.56 +import org.openide.nodes.Node;
   66.57 +import org.openide.util.Exceptions;
   66.58 +import org.openide.util.NbBundle;
   66.59 +import org.openide.util.NbCollections;
   66.60 +import org.openide.util.lookup.Lookups;
   66.61 +import org.openide.util.lookup.ProxyLookup;
   66.62 +
   66.63 +/**
   66.64 + *
   66.65 + * @author Tim Boudreau (original author)
   66.66 + * @author Nils Hoffmann (changed to use CheckableNodeCapability)
   66.67 + */
   66.68 +public abstract class FolderChildren extends ChildFactory.Detachable<FileObject> implements Runnable {
   66.69 +
   66.70 +    private FileObject[] roots;
   66.71 +    volatile int keyCount = 0;
   66.72 +    private int nodeCount = 0;
   66.73 +    private volatile boolean cancelled = false;
   66.74 +
   66.75 +    public FolderChildren(FileObject[] roots) {
   66.76 +        this.roots = roots;
   66.77 +    }
   66.78 +
   66.79 +    @Override
   66.80 +    protected Node createWaitNode() {
   66.81 +        AbstractNode result = new AbstractNode(Children.LEAF);
   66.82 +        result.setDisplayName(NbBundle.getMessage(FolderChildren.class, "MSG_WAIT_FOLDERS"));
   66.83 +        return result;
   66.84 +    }
   66.85 +
   66.86 +    @Override
   66.87 +    public void addNotify() {
   66.88 +        cancelled = false;
   66.89 +        super.addNotify();
   66.90 +        keyCount = 0;
   66.91 +        nodeCount = 0;
   66.92 +    }
   66.93 +
   66.94 +    @Override
   66.95 +    protected void removeNotify() {
   66.96 +        super.removeNotify();
   66.97 +        cancelled = true;
   66.98 +    }
   66.99 +
  66.100 +    private boolean shouldSkipFolder(FileObject folder) {
  66.101 +        // XXX use VisibilityQuery instead
  66.102 +        String path = folder.getPath();
  66.103 +        return path.contains(".svn") || path.contains(".cvs") || path.contains(".hg")
  66.104 +                || path.endsWith(".svn") || path.endsWith(".cvs") || path.endsWith(".hg")
  66.105 +                || path.contains("target") || path.endsWith("target") || path.contains("build") || path.endsWith("build");
  66.106 +    }
  66.107 +
  66.108 +    @Override
  66.109 +    protected boolean createKeys(List<FileObject> toPopulate) {
  66.110 +        for (FileObject f : roots) {
  66.111 +            toPopulate.add(f);
  66.112 +            keyCount++;
  66.113 +            for (FileObject fo : NbCollections.iterable(f.getChildren(true))) {
  66.114 +                if (fo.isFolder()) {
  66.115 +                    if (shouldSkipFolder(fo)) {
  66.116 +                        continue;
  66.117 +                    }
  66.118 +                    toPopulate.add(fo);
  66.119 +                    keyCount++;
  66.120 +                }
  66.121 +                if (cancelled) {
  66.122 +                    return true;
  66.123 +                }
  66.124 +            }
  66.125 +            if (cancelled) {
  66.126 +                return true;
  66.127 +            }
  66.128 +        }
  66.129 +        return true;
  66.130 +    }
  66.131 +
  66.132 +    @Override
  66.133 +    protected Node createNodeForKey(FileObject f) {
  66.134 +        try {
  66.135 +            Node n = DataObject.find(f).getNodeDelegate();
  66.136 +            nodeCount++;
  66.137 +            if (nodeCount == keyCount) {
  66.138 +                EventQueue.invokeLater(this);
  66.139 +            }
  66.140 +            return new FN(n, f);
  66.141 +        } catch (DataObjectNotFoundException ex) {
  66.142 +            Exceptions.printStackTrace(ex);
  66.143 +            return null;
  66.144 +        }
  66.145 +    }
  66.146 +
  66.147 +    public abstract void onAllNodesCreated();
  66.148 +
  66.149 +    @Override
  66.150 +    public void run() {
  66.151 +        onAllNodesCreated();
  66.152 +    }
  66.153 +
  66.154 +    private static final class FN extends FilterNode {
  66.155 +
  66.156 +        FN(Node orig, FileObject f) {
  66.157 +            super(orig, Children.LEAF, new ProxyLookup(
  66.158 +                    Lookups.fixed(f, new CheckableNodeCapability()),
  66.159 +                    orig.getLookup()));
  66.160 +            disableDelegation(DELEGATE_GET_ACTIONS);
  66.161 +            disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
  66.162 +            disableDelegation(DELEGATE_SET_DISPLAY_NAME);
  66.163 +            disableDelegation(DELEGATE_GET_DISPLAY_NAME);
  66.164 +            disableDelegation(DELEGATE_GET_VALUE);
  66.165 +            disableDelegation(DELEGATE_SET_VALUE);
  66.166 +            disableDelegation(DELEGATE_SET_NAME);
  66.167 +            disableDelegation(DELEGATE_GET_NAME);
  66.168 +            String p = f.getPath();
  66.169 +            // XXX this is a pretty arbitrary list... maybe check SharabilityQuery?
  66.170 +            if (!p.endsWith("nbproject")
  66.171 +                    && !p.endsWith("nbproject/private")) { //NOI18N
  66.172 +//                setValue (CheckboxListView.SELECTED, Boolean.TRUE);
  66.173 +            } else {
  66.174 +                CheckableNode cn = getLookup().lookup(CheckableNode.class);
  66.175 +                if (cn != null) {
  66.176 +                    cn.setSelected(false);
  66.177 +                }
  66.178 +            }
  66.179 +            setName(p);
  66.180 +            setDisplayName(FileUtil.getFileDisplayName(f));
  66.181 +        }
  66.182 +
  66.183 +        @Override
  66.184 +        public Action[] getActions(boolean ignored) {
  66.185 +            return new Action[0];
  66.186 +        }
  66.187 +    }
  66.188 +}
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/LicenseChangerRunnable.java	Sun Feb 10 16:18:19 2013 +0100
    67.3 @@ -0,0 +1,212 @@
    67.4 +/*
    67.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    67.6 + *
    67.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    67.8 + *
    67.9 + * The contents of this file are subject to the terms of either the GNU
   67.10 + * General Public License Version 2 only ("GPL") or the Common
   67.11 + * Development and Distribution License("CDDL") (collectively, the
   67.12 + * "License"). You may not use this file except in compliance with the
   67.13 + * License. You can obtain a copy of the License at
   67.14 + * http://www.netbeans.org/cddl-gplv2.html
   67.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   67.16 + * specific language governing permissions and limitations under the
   67.17 + * License.  When distributing the software, include this License Header
   67.18 + * Notice in each file and include the License file at
   67.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   67.20 + * particular file as subject to the "Classpath" exception as provided
   67.21 + * by Sun in the GPL Version 2 section of the License file that
   67.22 + * accompanied this code. If applicable, add the following below the
   67.23 + * License Header, with the fields enclosed by brackets [] replaced by
   67.24 + * your own identifying information:
   67.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   67.26 + *
   67.27 + * If you wish your version of this file to be governed by only the CDDL
   67.28 + * or only the GPL Version 2, indicate your decision by adding
   67.29 + * "[Contributor] elects to include this software in this distribution
   67.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   67.31 + * single choice of license, a recipient has the option to distribute
   67.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   67.33 + * to extend the choice of license to its licensees as provided above.
   67.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   67.35 + * Version 2 license, then the option applies only if the new code is
   67.36 + * made subject to such option by the copyright holder.
   67.37 + *
   67.38 + * Contributor(s):
   67.39 + *
   67.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   67.41 + */
   67.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   67.43 +
   67.44 +import java.io.*;
   67.45 +import java.nio.charset.Charset;
   67.46 +import java.util.Arrays;
   67.47 +import java.util.Set;
   67.48 +import org.netbeans.api.progress.ProgressHandle;
   67.49 +import org.netbeans.api.progress.ProgressHandleFactory;
   67.50 +import org.netbeans.api.project.*;
   67.51 +import org.netbeans.api.queries.FileEncodingQuery;
   67.52 +import org.netbeans.modules.licensechanger.wizard.LineEndingsPanel;
   67.53 +import org.netbeans.modules.maven.model.ModelOperation;
   67.54 +import org.netbeans.modules.maven.model.Utilities;
   67.55 +import org.netbeans.modules.maven.model.pom.POMModel;
   67.56 +import org.netbeans.modules.maven.model.pom.Properties;
   67.57 +import org.openide.WizardDescriptor;
   67.58 +import org.openide.filesystems.*;
   67.59 +import org.openide.util.EditableProperties;
   67.60 +import org.openide.util.Exceptions;
   67.61 +
   67.62 +/**
   67.63 + * @author Tim Boudreau
   67.64 + * @author Nils Hoffmann (Refactoring)
   67.65 + */
   67.66 +public class LicenseChangerRunnable implements Runnable {
   67.67 +
   67.68 +    private final WizardDescriptor wizard;
   67.69 +
   67.70 +    public LicenseChangerRunnable(WizardDescriptor wizard) {
   67.71 +        this.wizard = wizard;
   67.72 +    }
   67.73 +
   67.74 +    @Override
   67.75 +    public void run() {
   67.76 +        ProgressHandle handle = ProgressHandleFactory.createHandle("Changing license headers");
   67.77 +        try {
   67.78 +
   67.79 +            if ((Boolean) wizard.getProperty(WizardProperties.KEY_STORE_IN_USER_PROPERTIES)) {
   67.80 +                ProjectManager.mutex().writeAccess(new Runnable() {
   67.81 +                    @Override
   67.82 +                    public void run() {
   67.83 +                        String copyrightHolder = (String) wizard.getProperty(WizardProperties.KEY_COPYRIGHT_HOLDER);
   67.84 +                        if (copyrightHolder != null && !copyrightHolder.trim().isEmpty()) {
   67.85 +                            try {
   67.86 +                                FileObject userProperties = FileUtil.getConfigFile("Templates/Properties/User.properties");
   67.87 +                                InputStream istream = userProperties.getInputStream();
   67.88 +                                EditableProperties props = new EditableProperties(true);
   67.89 +                                try {
   67.90 +                                    props.load(istream);
   67.91 +                                } finally {
   67.92 +                                    istream.close();
   67.93 +                                }
   67.94 +                                props.setProperty("user", copyrightHolder);
   67.95 +                                OutputStream ostream = userProperties.getOutputStream();
   67.96 +                                try {
   67.97 +                                    props.store(ostream);
   67.98 +                                } finally {
   67.99 +                                    ostream.close();
  67.100 +                                }
  67.101 +                            } catch (IOException ex) {
  67.102 +                                Exceptions.printStackTrace(ex);
  67.103 +                            }
  67.104 +                        }
  67.105 +                    }
  67.106 +                });
  67.107 +            }
  67.108 +            @SuppressWarnings("unchecked")
  67.109 +            Set<FileChildren.FileItem> items = (Set<FileChildren.FileItem>) wizard.getProperty(WizardProperties.KEY_ITEMS);
  67.110 +            final String licenseText = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_TEXT);
  67.111 +            final String licenseName = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_NAME);
  67.112 +            int ix = 0;
  67.113 +            int max = items.size();
  67.114 +            handle.start(max);
  67.115 +            Charset enc;
  67.116 +            for (FileChildren.FileItem item : items) {
  67.117 +                handle.progress(item.getFile().getNameExt(), ix);
  67.118 +                try {
  67.119 +                    String content = FileLoader.loadFile(item.file);
  67.120 +                    String nue = item.handler.transform(content, licenseText, wizard.getProperties());
  67.121 +                    LineEndingPreference pref = LineEndingsPanel.getLineEndingPrefs();
  67.122 +                    nue = LineEndingPreference.convertLineEndings(pref, content, nue);
  67.123 +
  67.124 +                    enc = FileEncodingQuery.getEncoding(item.file);
  67.125 +                    byte[] bytes;
  67.126 +                    try {
  67.127 +                        bytes = nue.getBytes(enc.name());
  67.128 +                    } catch (UnsupportedEncodingException e) {
  67.129 +                        //properties files get resource_bundle_charset
  67.130 +                        bytes = nue.getBytes(FileEncodingQuery.getDefaultEncoding().name());
  67.131 +                    }
  67.132 +                    ByteArrayInputStream in = new ByteArrayInputStream(bytes);
  67.133 +                    BufferedOutputStream out = new BufferedOutputStream(item.file.getOutputStream());
  67.134 +                    try {
  67.135 +                        FileUtil.copy(in, out);
  67.136 +                    } finally {
  67.137 +                        out.close();
  67.138 +                        in.close();
  67.139 +                    }
  67.140 +                } catch (IOException ex) {
  67.141 +                    Exceptions.printStackTrace(ex);
  67.142 +                }
  67.143 +                ix++;
  67.144 +            }
  67.145 +            Boolean updateProjectLicense = (Boolean) wizard.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
  67.146 +            if (updateProjectLicense) {
  67.147 +//                System.out.println("Updating default license header!");
  67.148 +                Project project = (Project) wizard.getProperty(WizardProperties.KEY_PROJECT);
  67.149 +                Sources source = ProjectUtils.getSources(project);
  67.150 +                for (SourceGroup group : source.getSourceGroups(Sources.TYPE_GENERIC)) {
  67.151 +                    try {
  67.152 +                        FileObject nbprojectDir = group.getRootFolder().getFileObject("nbproject");
  67.153 +                        if (nbprojectDir != null) {
  67.154 +                            final FileObject projectProps = FileUtil.createData(nbprojectDir, "project.properties");
  67.155 +                            boolean hasProjectProperties = group.contains(projectProps);
  67.156 +                            if (hasProjectProperties) {
  67.157 +//                                System.out.println("Found project.properties at " + projectProps.getPath());
  67.158 +                                ProjectManager.mutex().writeAccess(new Runnable() {
  67.159 +                                    @Override
  67.160 +                                    public void run() {
  67.161 +                                        try {
  67.162 +                                            InputStream istream = projectProps.getInputStream();
  67.163 +                                            EditableProperties props = new EditableProperties(true);
  67.164 +                                            try {
  67.165 +                                                props.load(istream);
  67.166 +                                            } finally {
  67.167 +                                                istream.close();
  67.168 +                                            }
  67.169 +                                            props.setProperty("project.license", licenseName);
  67.170 +                                            OutputStream ostream = projectProps.getOutputStream();
  67.171 +                                            try {
  67.172 +                                                props.store(ostream);
  67.173 +                                            } finally {
  67.174 +                                                ostream.close();
  67.175 +                                            }
  67.176 +                                        } catch (IOException ex) {
  67.177 +                                            Exceptions.printStackTrace(ex);
  67.178 +                                        }
  67.179 +                                    }
  67.180 +                                });
  67.181 +
  67.182 +                            }
  67.183 +                        } else {
  67.184 +                            //check for pom.xml
  67.185 +                            FileObject pom = group.getRootFolder().getFileObject("pom.xml");
  67.186 +                            if (pom != null) {
  67.187 +//                                System.out.println("Found maven pom.xml at " + pom.getPath());
  67.188 +                                //found pom-based maven project
  67.189 +//                                String netbeansHintLicense = "<netbeans.hint.license>" + licenseName + "</netbeans.hint.license>";
  67.190 +//                                System.out.println("Please add " + netbeansHintLicense + " within your pom.xml <properties> section!");
  67.191 +                                Utilities.performPOMModelOperations(pom, Arrays.asList(new ModelOperation<POMModel>() {
  67.192 +                                    @Override
  67.193 +                                    public void performOperation(POMModel model) {
  67.194 +                                        Properties props = model.getProject().getProperties();
  67.195 +                                        if (props == null) {
  67.196 +                                            props = model.getFactory().createProperties();
  67.197 +                                            props.setProperty("netbeans.hint.license", licenseName);
  67.198 +                                            model.getProject().setProperties(props);
  67.199 +                                        } else {
  67.200 +                                            props.setProperty("netbeans.hint.license", licenseName);
  67.201 +                                        }
  67.202 +                                    }
  67.203 +                                }));
  67.204 +                            }
  67.205 +                        }
  67.206 +                    } catch (IOException ex) {
  67.207 +                        Exceptions.printStackTrace(ex);
  67.208 +                    }
  67.209 +                }
  67.210 +            }
  67.211 +        } finally {
  67.212 +            handle.finish();
  67.213 +        }
  67.214 +    }
  67.215 +}
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/LineEndingPreference.java	Sun Feb 10 16:18:19 2013 +0100
    68.3 @@ -0,0 +1,75 @@
    68.4 +/*
    68.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    68.6 + *
    68.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    68.8 + *
    68.9 + * The contents of this file are subject to the terms of either the GNU
   68.10 + * General Public License Version 2 only ("GPL") or the Common
   68.11 + * Development and Distribution License("CDDL") (collectively, the
   68.12 + * "License"). You may not use this file except in compliance with the
   68.13 + * License. You can obtain a copy of the License at
   68.14 + * http://www.netbeans.org/cddl-gplv2.html
   68.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   68.16 + * specific language governing permissions and limitations under the
   68.17 + * License.  When distributing the software, include this License Header
   68.18 + * Notice in each file and include the License file at
   68.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   68.20 + * particular file as subject to the "Classpath" exception as provided
   68.21 + * by Sun in the GPL Version 2 section of the License file that
   68.22 + * accompanied this code. If applicable, add the following below the
   68.23 + * License Header, with the fields enclosed by brackets [] replaced by
   68.24 + * your own identifying information:
   68.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   68.26 + *
   68.27 + * If you wish your version of this file to be governed by only the CDDL
   68.28 + * or only the GPL Version 2, indicate your decision by adding
   68.29 + * "[Contributor] elects to include this software in this distribution
   68.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   68.31 + * single choice of license, a recipient has the option to distribute
   68.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   68.33 + * to extend the choice of license to its licensees as provided above.
   68.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   68.35 + * Version 2 license, then the option applies only if the new code is
   68.36 + * made subject to such option by the copyright holder.
   68.37 + *
   68.38 + * Contributor(s):
   68.39 + *
   68.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   68.41 + */
   68.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   68.43 +
   68.44 +/**
   68.45 + * User preference for line ending conversion
   68.46 + *
   68.47 + * @author Tim Boudreau
   68.48 + */
   68.49 +public enum LineEndingPreference {
   68.50 +
   68.51 +    FORCE_CRLF,
   68.52 +    NO_CHANGE,
   68.53 +    FORCE_NEWLINE,
   68.54 +    SYSTEM_DEFAULT;
   68.55 +
   68.56 +    public static String convertLineEndings(LineEndingPreference pref, String old, String nue) {
   68.57 +        boolean oldHasCrlf = old.contains("\r\n"); //NOI18N
   68.58 +        switch (pref) {
   68.59 +            case FORCE_CRLF:
   68.60 +                return nue.replaceAll("\n", "\r\n"); //NOI18N
   68.61 +            case FORCE_NEWLINE:
   68.62 +                //We already converted everything to newline only on load
   68.63 +                return nue;
   68.64 +            case NO_CHANGE:
   68.65 +                return oldHasCrlf ? nue.replaceAll("\n", "\r\n") : //NOI18N
   68.66 +                        nue;
   68.67 +            case SYSTEM_DEFAULT:
   68.68 +                String sep = System.getProperty("line.separator"); //NOI18N
   68.69 +                if ("\n".equals(sep)) {
   68.70 +                    return nue;
   68.71 +                } else {
   68.72 +                    return nue.replaceAll("\n", sep);//NOI18N
   68.73 +                }
   68.74 +            default:
   68.75 +                throw new AssertionError();
   68.76 +        }
   68.77 +    }
   68.78 +}
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/wizard/utils/WizardProperties.java	Sun Feb 10 16:18:19 2013 +0100
    69.3 @@ -0,0 +1,64 @@
    69.4 +/*
    69.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    69.6 + *
    69.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    69.8 + *
    69.9 + * The contents of this file are subject to the terms of either the GNU
   69.10 + * General Public License Version 2 only ("GPL") or the Common
   69.11 + * Development and Distribution License("CDDL") (collectively, the
   69.12 + * "License"). You may not use this file except in compliance with the
   69.13 + * License. You can obtain a copy of the License at
   69.14 + * http://www.netbeans.org/cddl-gplv2.html
   69.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   69.16 + * specific language governing permissions and limitations under the
   69.17 + * License.  When distributing the software, include this License Header
   69.18 + * Notice in each file and include the License file at
   69.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   69.20 + * particular file as subject to the "Classpath" exception as provided
   69.21 + * by Sun in the GPL Version 2 section of the License file that
   69.22 + * accompanied this code. If applicable, add the following below the
   69.23 + * License Header, with the fields enclosed by brackets [] replaced by
   69.24 + * your own identifying information:
   69.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   69.26 + *
   69.27 + * If you wish your version of this file to be governed by only the CDDL
   69.28 + * or only the GPL Version 2, indicate your decision by adding
   69.29 + * "[Contributor] elects to include this software in this distribution
   69.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   69.31 + * single choice of license, a recipient has the option to distribute
   69.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   69.33 + * to extend the choice of license to its licensees as provided above.
   69.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   69.35 + * Version 2 license, then the option applies only if the new code is
   69.36 + * made subject to such option by the copyright holder.
   69.37 + *
   69.38 + * Contributor(s):
   69.39 + *
   69.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   69.41 + */
   69.42 +package org.netbeans.modules.licensechanger.wizard.utils;
   69.43 +
   69.44 +/**
   69.45 + * Central class for Wizard-related property keys.
   69.46 + *
   69.47 + * @author Nils Hoffmann
   69.48 + */
   69.49 +public final class WizardProperties {
   69.50 +
   69.51 +    public static final String KEY_FILE_HANDLERS = "fileHandlers";
   69.52 +    public static final String KEY_ITEMS = "fileItems";
   69.53 +    public static final String KEY_LICENSE_TEXT = "licenseText";
   69.54 +    public static final String KEY_LICENSE_NAME = "licenseName";
   69.55 +    public static final String KEY_ROOT_FILES = "rootFiles";
   69.56 +    public static final String KEY_FOLDERS = "folders";
   69.57 +    public static final String KEY_UPDATE_DEFAULT_PROJECT_LICENSE = "updateDefaultProjectLicense";
   69.58 +    public static final String VALUE_DEFAULT_LICENSE_TEXT = "No License";
   69.59 +    public static final String PROP_ENDING = "ending";
   69.60 +    public static final String KEY_ENDING = "line_terminator";
   69.61 +    public static final String KEY_PROJECT = "project";
   69.62 +    public static final String KEY_COPYRIGHT_HOLDER = "project.organization";
   69.63 +    public static final String KEY_STORE_IN_USER_PROPERTIES = "storeInUserProperties";
   69.64 +
   69.65 +    private WizardProperties() {
   69.66 +    }
   69.67 +}
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/TestUtils.java	Sun Feb 10 16:18:19 2013 +0100
    70.3 @@ -0,0 +1,114 @@
    70.4 +/*
    70.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    70.6 + *
    70.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    70.8 + *
    70.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   70.10 + * Other names may be trademarks of their respective owners.
   70.11 + *
   70.12 + * The contents of this file are subject to the terms of either the GNU
   70.13 + * General Public License Version 2 only ("GPL") or the Common
   70.14 + * Development and Distribution License("CDDL") (collectively, the
   70.15 + * "License"). You may not use this file except in compliance with the
   70.16 + * License. You can obtain a copy of the License at
   70.17 + * http://www.netbeans.org/cddl-gplv2.html
   70.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   70.19 + * specific language governing permissions and limitations under the
   70.20 + * License.  When distributing the software, include this License Header
   70.21 + * Notice in each file and include the License file at
   70.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   70.23 + * particular file as subject to the "Classpath" exception as provided
   70.24 + * by Oracle in the GPL Version 2 section of the License file that
   70.25 + * accompanied this code. If applicable, add the following below the
   70.26 + * License Header, with the fields enclosed by brackets [] replaced by
   70.27 + * your own identifying information:
   70.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   70.29 + *
   70.30 + * If you wish your version of this file to be governed by only the CDDL
   70.31 + * or only the GPL Version 2, indicate your decision by adding
   70.32 + * "[Contributor] elects to include this software in this distribution
   70.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   70.34 + * single choice of license, a recipient has the option to distribute
   70.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   70.36 + * to extend the choice of license to its licensees as provided above.
   70.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   70.38 + * Version 2 license, then the option applies only if the new code is
   70.39 + * made subject to such option by the copyright holder.
   70.40 + *
   70.41 + * Contributor(s):
   70.42 + *
   70.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
   70.44 + */
   70.45 +package org.netbeans.modules.licensechanger;
   70.46 +
   70.47 +import java.io.BufferedOutputStream;
   70.48 +import java.io.ByteArrayInputStream;
   70.49 +import java.io.ByteArrayOutputStream;
   70.50 +import java.io.File;
   70.51 +import java.io.FileOutputStream;
   70.52 +import java.io.IOException;
   70.53 +import java.io.InputStream;
   70.54 +import java.io.OutputStream;
   70.55 +import java.nio.charset.Charset;
   70.56 +import static org.junit.Assert.*;
   70.57 +import org.openide.filesystems.FileUtil;
   70.58 +
   70.59 +/**
   70.60 + *
   70.61 + * @author Nils Hoffmann
   70.62 + */
   70.63 +public class TestUtils {
   70.64 +
   70.65 +    public static String getLicense() throws Exception {
   70.66 +        return readFile("fake_license.txt");
   70.67 +    }
   70.68 +
   70.69 +    public static String readFile(Class<?> clazz, String name) throws Exception {
   70.70 +        InputStream in = clazz.getResourceAsStream(name);
   70.71 +        if (in == null) {
   70.72 +            fail("No input stream for " + name);
   70.73 +        }
   70.74 +        ByteArrayOutputStream out = new ByteArrayOutputStream();
   70.75 +        try {
   70.76 +            FileUtil.copy(in, out);
   70.77 +        } finally {
   70.78 +            in.close();
   70.79 +            out.close();
   70.80 +        }
   70.81 +        String result = new String(out.toByteArray(), "UTF-8");
   70.82 +        return result.replace("\r\n", "\n");
   70.83 +    }
   70.84 +
   70.85 +    public static String readFile(String name) throws Exception {
   70.86 +        return TestUtils.readFile(TestUtils.class, name);
   70.87 +    }
   70.88 +    
   70.89 +    public static void writeStream(String s, OutputStream os) throws Exception {
   70.90 +        InputStream is = new ByteArrayInputStream(s.getBytes(Charset.forName("UTF-8")));
   70.91 +        try {
   70.92 +            FileUtil.copy(is, os);
   70.93 +        } catch (IOException ioex) {
   70.94 +            throw ioex;
   70.95 +        } finally {
   70.96 +            if (is != null) {
   70.97 +                try {
   70.98 +                    is.close();
   70.99 +                } catch (IOException ioex) {
  70.100 +                    throw ioex;
  70.101 +                }
  70.102 +            }
  70.103 +            if (os != null) {
  70.104 +                try {
  70.105 +                    os.close();
  70.106 +                } catch (IOException ioex) {
  70.107 +                    throw ioex;
  70.108 +                }
  70.109 +            }
  70.110 +        }
  70.111 +    }
  70.112 +
  70.113 +    public static void writeFile(String s, File f) throws Exception {
  70.114 +        OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
  70.115 +        writeStream(s,os);
  70.116 +    }
  70.117 +}
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/api/LicenseHeaderTest.java	Sun Feb 10 16:18:19 2013 +0100
    71.3 @@ -0,0 +1,178 @@
    71.4 +/*
    71.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    71.6 + *
    71.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    71.8 + *
    71.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   71.10 + * Other names may be trademarks of their respective owners.
   71.11 + *
   71.12 + * The contents of this file are subject to the terms of either the GNU
   71.13 + * General Public License Version 2 only ("GPL") or the Common
   71.14 + * Development and Distribution License("CDDL") (collectively, the
   71.15 + * "License"). You may not use this file except in compliance with the
   71.16 + * License. You can obtain a copy of the License at
   71.17 + * http://www.netbeans.org/cddl-gplv2.html
   71.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   71.19 + * specific language governing permissions and limitations under the
   71.20 + * License.  When distributing the software, include this License Header
   71.21 + * Notice in each file and include the License file at
   71.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   71.23 + * particular file as subject to the "Classpath" exception as provided
   71.24 + * by Oracle in the GPL Version 2 section of the License file that
   71.25 + * accompanied this code. If applicable, add the following below the
   71.26 + * License Header, with the fields enclosed by brackets [] replaced by
   71.27 + * your own identifying information:
   71.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   71.29 + *
   71.30 + * If you wish your version of this file to be governed by only the CDDL
   71.31 + * or only the GPL Version 2, indicate your decision by adding
   71.32 + * "[Contributor] elects to include this software in this distribution
   71.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   71.34 + * single choice of license, a recipient has the option to distribute
   71.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   71.36 + * to extend the choice of license to its licensees as provided above.
   71.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   71.38 + * Version 2 license, then the option applies only if the new code is
   71.39 + * made subject to such option by the copyright holder.
   71.40 + *
   71.41 + * Contributor(s):
   71.42 + *
   71.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
   71.44 + */
   71.45 +package org.netbeans.modules.licensechanger.api;
   71.46 +
   71.47 +import java.io.File;
   71.48 +import java.io.IOException;
   71.49 +import java.util.Collection;
   71.50 +import junit.framework.Assert;
   71.51 +import org.junit.Test;
   71.52 +import org.junit.Before;
   71.53 +import org.junit.experimental.categories.Categories;
   71.54 +import org.netbeans.junit.NbTestCase;
   71.55 +import static org.netbeans.modules.licensechanger.TestUtils.*;
   71.56 +import org.openide.filesystems.FileObject;
   71.57 +import org.openide.filesystems.FileUtil;
   71.58 +import org.openide.util.Exceptions;
   71.59 +
   71.60 +/**
   71.61 + *
   71.62 + * @author Nils Hoffmann
   71.63 + */
   71.64 +public class LicenseHeaderTest extends NbTestCase {
   71.65 +
   71.66 +    private LicenseHeader golden;
   71.67 +
   71.68 +    public LicenseHeaderTest(String name) {
   71.69 +        super(name);
   71.70 +    }
   71.71 +
   71.72 +    @Before
   71.73 +    @Override
   71.74 +    public void setUp() throws Exception {
   71.75 +        super.setUp();
   71.76 +        System.out.println("Creating golden license header");
   71.77 +        File f;
   71.78 +        try {
   71.79 +            f = new File(getWorkDir(), "license-test.txt");
   71.80 +            writeFile(readFile("license-test.txt"), f);
   71.81 +            Assert.assertTrue(f.exists());
   71.82 +            golden = LicenseHeader.fromFile(f);
   71.83 +            System.out.println("Golden: " + golden);
   71.84 +        } catch (IOException ex) {
   71.85 +            Exceptions.printStackTrace(ex);
   71.86 +        }
   71.87 +    }
   71.88 +
   71.89 +    /**
   71.90 +     * Test that file object may not be null, of class LicenseHeader.
   71.91 +     */
   71.92 +    @Test
   71.93 +    public void testNullArgs1() {
   71.94 +        boolean npeCaught = false;
   71.95 +        try {
   71.96 +            LicenseHeader actual = LicenseHeader.fromFileObject(null, golden.getName(), false);
   71.97 +        } catch (NullPointerException npe) {
   71.98 +            npeCaught = true;
   71.99 +        }
  71.100 +        Assert.assertTrue(npeCaught);
  71.101 +    }
  71.102 +    
  71.103 +    /**
  71.104 +     * Test that file object may not be null, of class LicenseHeader.
  71.105 +     */
  71.106 +    @Test
  71.107 +    public void testNullArgs2() {
  71.108 +        boolean npeCaught = false;
  71.109 +        try {
  71.110 +            LicenseHeader actual = LicenseHeader.fromFileObject(null, golden.getName());
  71.111 +        } catch (NullPointerException npe) {
  71.112 +            npeCaught = true;
  71.113 +        }
  71.114 +        Assert.assertTrue(npeCaught);
  71.115 +    }
  71.116 +    
  71.117 +    /**
  71.118 +     * Test that file object may not be null, of class LicenseHeader.
  71.119 +     */
  71.120 +    @Test
  71.121 +    public void testNullArgs3() {
  71.122 +        boolean npeCaught = false;
  71.123 +        try {
  71.124 +            LicenseHeader actual = LicenseHeader.fromFile(null);
  71.125 +        } catch (NullPointerException npe) {
  71.126 +            npeCaught = true;
  71.127 +        }
  71.128 +        Assert.assertTrue(npeCaught);
  71.129 +    }
  71.130 +    
  71.131 +    /**
  71.132 +     * Test retrieval of license header name from file object, of class LicenseHeader.
  71.133 +     */
  71.134 +    @Test
  71.135 +    public void testNullArgs4() {
  71.136 +        LicenseHeader actual = LicenseHeader.fromFileObject(golden.getFileObject(), null, false);
  71.137 +    }
  71.138 +
  71.139 +    /**
  71.140 +     * Test of fromFileObject method, of class LicenseHeader.
  71.141 +     */
  71.142 +    @Test
  71.143 +    public void testFromFileObject_3args() {
  71.144 +        LicenseHeader actual = LicenseHeader.fromFileObject(golden.getFileObject(), golden.getName(), false);
  71.145 +        Assert.assertEquals(golden, actual);
  71.146 +    }
  71.147 +
  71.148 +    /**
  71.149 +     * Test of fromFileObject method, of class LicenseHeader.
  71.150 +     */
  71.151 +    @Test
  71.152 +    public void testFromFileObject_FileObject_String() {
  71.153 +        LicenseHeader actual = LicenseHeader.fromFileObject(golden.getFileObject(), golden.getName());
  71.154 +        Assert.assertEquals(golden, actual);
  71.155 +    }
  71.156 +
  71.157 +    /**
  71.158 +     * Test of fromFile method, of class LicenseHeader.
  71.159 +     */
  71.160 +    @Test
  71.161 +    public void testFromFile() {
  71.162 +        LicenseHeader actual = LicenseHeader.fromFile(FileUtil.toFile(golden.getFileObject()));
  71.163 +        Assert.assertEquals(golden, actual);
  71.164 +    }
  71.165 +
  71.166 +    /**
  71.167 +     * Test of addAsNetBeansTemplate and fromTemplates methods, of class
  71.168 +     * LicenseHeader.
  71.169 +     */
  71.170 +    @Test
  71.171 +    public void testAddAsNetBeansTemplateFromTemplates() throws Exception {
  71.172 +        FileObject configRoot = FileUtil.getConfigRoot();
  71.173 +        FileObject licenseTemplates = configRoot.getFileObject("Templates").createFolder("Licenses");
  71.174 +        LicenseHeader goldenTemplate = LicenseHeader.addAsNetBeansTemplate(golden);
  71.175 +        Assert.assertFalse(golden.isNetBeansTemplate());
  71.176 +        Assert.assertTrue(goldenTemplate.isNetBeansTemplate());
  71.177 +        Assert.assertFalse(goldenTemplate.getLicenseHeader().isEmpty());
  71.178 +        Collection<? extends LicenseHeader> licenses = LicenseHeader.fromTemplates();
  71.179 +        Assert.assertTrue(licenses.contains(goldenTemplate));
  71.180 +    }
  71.181 +}
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/fake_license.txt	Sun Feb 10 16:18:19 2013 +0100
    72.3 @@ -0,0 +1,29 @@
    72.4 +Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
    72.5 +All rights reversed.
    72.6 +
    72.7 +Redistribution and use in source, binary or corpuscular forms, with or without
    72.8 +modification, are prohibited under all circumstances unless the following
    72.9 +conditions have been met:
   72.10 +
   72.11 +  1. You have an eyeball growing in the palm of your left hand
   72.12 +
   72.13 +  2. Seven dwarfs really like your golden hair
   72.14 +
   72.15 +  3. The moon has reversed its course a multiple of times divisible by
   72.16 +     the eighteenth prime number in the last year
   72.17 +
   72.18 +THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
   72.19 +INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
   72.20 +DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
   72.21 +OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
   72.22 +ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
   72.23 +SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
   72.24 +LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
   72.25 +BALL DROP, BECOMING A LAWYER.
   72.26 +
   72.27 +BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
   72.28 +AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
   72.29 +AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
   72.30 +INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
   72.31 +
   72.32 +RUN, RUN NOW, AND RUN VERY FAST.
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/license-test.txt	Sun Feb 10 16:18:19 2013 +0100
    73.3 @@ -0,0 +1,45 @@
    73.4 +<#if licenseFirst??>
    73.5 +${licenseFirst}
    73.6 +</#if>
    73.7 +${licensePrefix}DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    73.8 +${licensePrefix?replace(" +$", "", "r")}
    73.9 +${licensePrefix}Copyright ${date?date?string("yyyy")} Oracle and/or its affiliates. All rights reserved.
   73.10 +${licensePrefix?replace(" +$", "", "r")}
   73.11 +${licensePrefix}Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   73.12 +${licensePrefix}Other names may be trademarks of their respective owners.
   73.13 +${licensePrefix?replace(" +$", "", "r")}
   73.14 +${licensePrefix}The contents of this file are subject to the terms of either the GNU
   73.15 +${licensePrefix}General Public License Version 2 only ("GPL") or the Common
   73.16 +${licensePrefix}Development and Distribution License("CDDL") (collectively, the
   73.17 +${licensePrefix}"License"). You may not use this file except in compliance with the
   73.18 +${licensePrefix}License. You can obtain a copy of the License at
   73.19 +${licensePrefix}http://www.netbeans.org/cddl-gplv2.html
   73.20 +${licensePrefix}or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   73.21 +${licensePrefix}specific language governing permissions and limitations under the
   73.22 +${licensePrefix}License.  When distributing the software, include this License Header
   73.23 +${licensePrefix}Notice in each file and include the License file at
   73.24 +${licensePrefix}nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   73.25 +${licensePrefix}particular file as subject to the "Classpath" exception as provided
   73.26 +${licensePrefix}by Oracle in the GPL Version 2 section of the License file that
   73.27 +${licensePrefix}accompanied this code. If applicable, add the following below the
   73.28 +${licensePrefix}License Header, with the fields enclosed by brackets [] replaced by
   73.29 +${licensePrefix}your own identifying information:
   73.30 +${licensePrefix}"Portions Copyrighted [year] [name of copyright owner]"
   73.31 +${licensePrefix?replace(" +$", "", "r")}
   73.32 +${licensePrefix}If you wish your version of this file to be governed by only the CDDL
   73.33 +${licensePrefix}or only the GPL Version 2, indicate your decision by adding
   73.34 +${licensePrefix}"[Contributor] elects to include this software in this distribution
   73.35 +${licensePrefix}under the [CDDL or GPL Version 2] license." If you do not indicate a
   73.36 +${licensePrefix}single choice of license, a recipient has the option to distribute
   73.37 +${licensePrefix}your version of this file under either the CDDL, the GPL Version 2 or
   73.38 +${licensePrefix}to extend the choice of license to its licensees as provided above.
   73.39 +${licensePrefix}However, if you add GPL Version 2 code and therefore, elected the GPL
   73.40 +${licensePrefix}Version 2 license, then the option applies only if the new code is
   73.41 +${licensePrefix}made subject to such option by the copyright holder.
   73.42 +${licensePrefix?replace(" +$", "", "r")}
   73.43 +${licensePrefix}Contributor(s):
   73.44 +${licensePrefix?replace(" +$", "", "r")}
   73.45 +${licensePrefix}Portions Copyrighted ${date?date?string("yyyy")} Sun Microsystems, Inc.
   73.46 +<#if licenseLast??>
   73.47 +${licenseLast}
   73.48 +</#if>
   73.49 \ No newline at end of file
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/GroovyFileHandlerTest.java	Sun Feb 10 16:18:19 2013 +0100
    74.3 @@ -0,0 +1,119 @@
    74.4 +/*
    74.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    74.6 + *
    74.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    74.8 + *
    74.9 + * The contents of this file are subject to the terms of either the GNU
   74.10 + * General Public License Version 2 only ("GPL") or the Common
   74.11 + * Development and Distribution License("CDDL") (collectively, the
   74.12 + * "License"). You may not use this file except in compliance with the
   74.13 + * License. You can obtain a copy of the License at
   74.14 + * http://www.netbeans.org/cddl-gplv2.html
   74.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   74.16 + * specific language governing permissions and limitations under the
   74.17 + * License.  When distributing the software, include this License Header
   74.18 + * Notice in each file and include the License file at
   74.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   74.20 + * particular file as subject to the "Classpath" exception as provided
   74.21 + * by Sun in the GPL Version 2 section of the License file that
   74.22 + * accompanied this code. If applicable, add the following below the
   74.23 + * License Header, with the fields enclosed by brackets [] replaced by
   74.24 + * your own identifying information:
   74.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   74.26 + *
   74.27 + * If you wish your version of this file to be governed by only the CDDL
   74.28 + * or only the GPL Version 2, indicate your decision by adding
   74.29 + * "[Contributor] elects to include this software in this distribution
   74.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   74.31 + * single choice of license, a recipient has the option to distribute
   74.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   74.33 + * to extend the choice of license to its licensees as provided above.
   74.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   74.35 + * Version 2 license, then the option applies only if the new code is
   74.36 + * made subject to such option by the copyright holder.
   74.37 + *
   74.38 + * Contributor(s):
   74.39 + *
   74.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   74.41 + */
   74.42 +package org.netbeans.modules.licensechanger.spi.handlers;
   74.43 +
   74.44 +import java.util.Collections;
   74.45 +import java.util.Map;
   74.46 +import static org.junit.Assert.*;
   74.47 +import org.junit.Test;
   74.48 +import static org.netbeans.modules.licensechanger.TestUtils.*;
   74.49 +import org.netbeans.modules.licensechanger.api.FileHandler;
   74.50 +
   74.51 +/**
   74.52 + * Test cases for groovy license replacement.
   74.53 + *
   74.54 + * @author Nils Hoffmann
   74.55 + */
   74.56 +public class GroovyFileHandlerTest {
   74.57 +
   74.58 +    private final Map<String, Object> props = Collections.emptyMap();
   74.59 +
   74.60 +    void runTest(String infix) throws Exception {
   74.61 +        String golden = getGolden(infix);
   74.62 +        String license = getLicense();
   74.63 +        for (int i = 1; i <= 12; i++) {
   74.64 +            String header = "resources/groovy/header_" + i + ".txt";
   74.65 +            String template = "resources/groovy/groovy_" + infix + "_template.txt";
   74.66 +            System.out.println("Test " + " header_" + i + ".txt with groovy_" + infix + "_template.txt");
   74.67 +            testOneVersion(golden, license, merge(header, template));
   74.68 +        }
   74.69 +    }
   74.70 +
   74.71 +    @Test
   74.72 +    public void testGroovyClass() throws Exception {
   74.73 +        System.out.println("testGroovyClass");
   74.74 +        runTest("class");
   74.75 +    }
   74.76 +
   74.77 +    /**
   74.78 +     * FIXME This test currently fails due to the removal of the author comment.
   74.79 +     * This is probably intended, but might prove to be a bug for groovy files,
   74.80 +     * as it would unexpectedly remove comments.
   74.81 +     *
   74.82 +     * @throws Exception
   74.83 +     */
   74.84 +    @Test(expected = AssertionError.class)
   74.85 +    public void testGroovyClassNoPackage() throws Exception {
   74.86 +        System.out.println("testGroovyClassNoPackage");
   74.87 +        runTest("class_nopackage");
   74.88 +    }
   74.89 +
   74.90 +    @Test
   74.91 +    public void testGroovyScript() throws Exception {
   74.92 +        System.out.println("testGroovyScript");
   74.93 +        runTest("script");
   74.94 +    }
   74.95 +
   74.96 +    private void testOneVersion(String golden, String license, String original) throws Exception {
   74.97 +        GroovyFileHandler instance = new GroovyFileHandler();
   74.98 +        String processed = instance.transform(original, license, props);
   74.99 +        assertEqualsLineByLine(golden, processed);
  74.100 +    }
  74.101 +
  74.102 +    static void assertEqualsLineByLine(String golden, String processed) {
  74.103 +        String[] g = FileHandler.splitIntoLines(golden);
  74.104 +        String[] p = FileHandler.splitIntoLines(processed);
  74.105 +        for (int i = 0; i < Math.min(g.length, p.length); i++) {
  74.106 +            if (!g[i].equals(p[i])) {
  74.107 +                assertEquals("Difference between files at line " + i + "\n", g[i], p[i]);
  74.108 +            }
  74.109 +        }
  74.110 +    }
  74.111 +
  74.112 +    private static String merge(String header, String template) throws Exception {
  74.113 +        StringBuilder sb = new StringBuilder();
  74.114 +        sb.append(readFile(GroovyFileHandlerTest.class,header));
  74.115 +        sb.append(readFile(GroovyFileHandlerTest.class,template));
  74.116 +        return sb.toString();
  74.117 +    }
  74.118 +
  74.119 +    private static String getGolden(String infix) throws Exception {
  74.120 +        return readFile(GroovyFileHandlerTest.class,"resources/groovy/groovy_" + infix + "_golden.txt");
  74.121 +    }
  74.122 +}
    75.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandlerTest.java	Fri Feb 08 11:02:28 2013 +0100
    75.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandlerTest.java	Sun Feb 10 16:18:19 2013 +0100
    75.3 @@ -36,33 +36,29 @@
    75.4   *
    75.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    75.6   */
    75.7 -
    75.8  package org.netbeans.modules.licensechanger.spi.handlers;
    75.9  
   75.10 -import java.io.ByteArrayOutputStream;
   75.11 -import java.io.InputStream;
   75.12  import java.util.Collections;
   75.13  import java.util.Map;
   75.14  import static org.junit.Assert.*;
   75.15  import org.junit.Test;
   75.16 +import static org.netbeans.modules.licensechanger.TestUtils.*;
   75.17  import org.netbeans.modules.licensechanger.api.FileHandler;
   75.18 -import org.openide.filesystems.FileUtil;
   75.19 -import org.openide.util.Utilities;
   75.20  
   75.21  /**
   75.22   *
   75.23   * @author Tim Boudreau
   75.24   */
   75.25  public class JavaFileHandlerTest {
   75.26 -    
   75.27 -    private final Map<String,Object> props = Collections.emptyMap();
   75.28 +
   75.29 +    private final Map<String, Object> props = Collections.emptyMap();
   75.30  
   75.31      @Test
   75.32      public void testStuff() throws Exception {
   75.33          System.out.println("testStuff");
   75.34          String golden = getGolden();
   75.35          String license = getLicense();
   75.36 -        for (int i=1; i <= 12; i++) {
   75.37 +        for (int i = 1; i <= 12; i++) {
   75.38              String filename = "java_" + i + ".txt";
   75.39              testOneVersion(golden, license, filename);
   75.40          }
   75.41 @@ -71,20 +67,19 @@
   75.42      private void testOneVersion(String golden, String license, String filename) throws Exception {
   75.43          System.out.println("Test " + filename);
   75.44          JavaFileHandler instance = new JavaFileHandler();
   75.45 -        String original = readFile (filename);
   75.46 +        String original = readFile(JavaFileHandlerTest.class,filename);
   75.47          String processed = instance.transform(original, license, props);
   75.48 -        assertEqualsLineByLine (golden, processed, filename);
   75.49 +        assertEqualsLineByLine(golden, processed, filename);
   75.50      }
   75.51  
   75.52 -    static void assertEqualsLineByLine (String golden, String processed, String filename) {
   75.53 +    static void assertEqualsLineByLine(String golden, String processed, String filename) {
   75.54          String[] g = FileHandler.splitIntoLines(golden);
   75.55          String[] p = FileHandler.splitIntoLines(processed);
   75.56 -        for (int i=0; i < Math.min (g.length, p.length); i++) {
   75.57 -            assertEquals ("Difference in " + filename + " at line " + i + "\n", g[i], p[i]);
   75.58 +        for (int i = 0; i < Math.min(g.length, p.length); i++) {
   75.59 +            assertEquals("Difference in " + filename + " at line " + i + "\n", g[i], p[i]);
   75.60          }
   75.61      }
   75.62  
   75.63 -
   75.64  //    static void assertEqualsLineByLine (String golden, String processed, String filename) {
   75.65  //        StringTokenizer a = new StringTokenizer (golden, "\n");
   75.66  //        StringTokenizer b = new StringTokenizer (processed, "\n");
   75.67 @@ -100,30 +95,7 @@
   75.68  //        }
   75.69  //
   75.70  //    }
   75.71 -
   75.72      private static String getGolden() throws Exception {
   75.73 -        return readFile ("java_golden.txt");
   75.74 +        return readFile(JavaFileHandlerTest.class,"java_golden.txt");
   75.75      }
   75.76 -
   75.77 -    static String getLicense() throws Exception {
   75.78 -        return readFile ("fake_license.txt");
   75.79 -    }
   75.80 -
   75.81 -    static String readFile (String name) throws Exception {
   75.82 -        InputStream in = JavaFileHandlerTest.class.getResourceAsStream(name);
   75.83 -        if (in == null) {
   75.84 -            fail ("No input stream for " + name);
   75.85 -        }
   75.86 -        ByteArrayOutputStream out = new ByteArrayOutputStream();
   75.87 -        try {
   75.88 -            FileUtil.copy (in, out);
   75.89 -        } finally {
   75.90 -            in.close();
   75.91 -            out.close();
   75.92 -        }
   75.93 -        String result = new String (out.toByteArray(), "UTF-8");
   75.94 -        result = Utilities.replaceString(result, "\r\n", "\n");
   75.95 -        return result;
   75.96 -    }
   75.97 - 
   75.98 -}
   75.99 \ No newline at end of file
  75.100 +}
    76.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandlerTest.java	Fri Feb 08 11:02:28 2013 +0100
    76.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandlerTest.java	Sun Feb 10 16:18:19 2013 +0100
    76.3 @@ -36,47 +36,47 @@
    76.4   *
    76.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    76.6   */
    76.7 -
    76.8  package org.netbeans.modules.licensechanger.spi.handlers;
    76.9  
   76.10  import java.util.Collections;
   76.11  import java.util.Map;
   76.12 -import org.netbeans.modules.licensechanger.spi.handlers.PropertiesFileHandler;
   76.13 +import static org.junit.Assert.*;
   76.14  import org.junit.Test;
   76.15 -import static org.junit.Assert.*;
   76.16 +import static org.netbeans.modules.licensechanger.TestUtils.*;
   76.17  
   76.18  /**
   76.19   *
   76.20   * @author Tim Boudreau
   76.21   */
   76.22  public class PropertiesFileHandlerTest {
   76.23 -    private final Map<String,Object> props = Collections.emptyMap();
   76.24 +
   76.25 +    private final Map<String, Object> props = Collections.emptyMap();
   76.26  
   76.27      @Test
   76.28      public void testStuff() throws Exception {
   76.29          System.out.println("testStuff");
   76.30          String golden = getGolden();
   76.31 -        String license = JavaFileHandlerTest.getLicense();
   76.32 -        for (int i=1; i <= 4; i++) {
   76.33 -            testOneVersion (golden, license, "props_" + i + ".txt");
   76.34 +        String license = getLicense();
   76.35 +        for (int i = 1; i <= 4; i++) {
   76.36 +            testOneVersion(golden, license, "props_" + i + ".txt");
   76.37          }
   76.38 -        assertEquals (0, 0);
   76.39 +        assertEquals(0, 0);
   76.40      }
   76.41  
   76.42      private void testOneVersion(String golden, String license, String filename) throws Exception {
   76.43          System.out.println("Test " + filename);
   76.44          PropertiesFileHandler instance = new PropertiesFileHandler();
   76.45 -        String original = JavaFileHandlerTest.readFile (filename);
   76.46 +        String original = readFile(PropertiesFileHandlerTest.class,filename);
   76.47          String processed = instance.transform(original, license, props);
   76.48  //        if (!original.equals(processed)) {
   76.49  //            System.out.println("************************************");
   76.50  //            System.out.println(processed);
   76.51  //            System.out.println("************************************");
   76.52  //        }
   76.53 -        JavaFileHandlerTest.assertEqualsLineByLine (golden, processed, filename);
   76.54 +        JavaFileHandlerTest.assertEqualsLineByLine(golden, processed, filename);
   76.55      }
   76.56  
   76.57      private static String getGolden() throws Exception {
   76.58 -        return JavaFileHandlerTest.readFile ("props_golden.txt");
   76.59 +        return readFile(PropertiesFileHandlerTest.class,"props_golden.txt");
   76.60      }
   76.61 -}
   76.62 \ No newline at end of file
   76.63 +}
    77.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandlerTest.java	Fri Feb 08 11:02:28 2013 +0100
    77.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandlerTest.java	Sun Feb 10 16:18:19 2013 +0100
    77.3 @@ -36,37 +36,37 @@
    77.4   *
    77.5   * Portions Copyrighted 2009 Sun Microsystems, Inc.
    77.6   */
    77.7 -
    77.8  package org.netbeans.modules.licensechanger.spi.handlers;
    77.9  
   77.10  import java.util.Collections;
   77.11  import java.util.Map;
   77.12 -import org.netbeans.modules.licensechanger.spi.handlers.XmlFileHandler;
   77.13  import java.util.StringTokenizer;
   77.14  import java.util.regex.Matcher;
   77.15 +import static org.junit.Assert.*;
   77.16  import org.junit.Test;
   77.17  import org.netbeans.modules.licensechanger.api.FileHandler;
   77.18 -import static org.junit.Assert.*;
   77.19 +import static org.netbeans.modules.licensechanger.TestUtils.*;
   77.20  
   77.21  /**
   77.22   *
   77.23   * @author Tim Boudreau
   77.24   */
   77.25  public class XmlFileHandlerTest {
   77.26 -    private final Map<String,Object> props = Collections.emptyMap();
   77.27 -    
   77.28 +
   77.29 +    private final Map<String, Object> props = Collections.emptyMap();
   77.30 +
   77.31      @Test
   77.32      public void testDeclarationFinder() throws Exception {
   77.33          String xml = getGolden();
   77.34 -        assertDeclarationFound (xml, "xml_golden.txt");
   77.35 -        for (int i=1; i <= 8; i++) {
   77.36 +        assertDeclarationFound(xml, "xml_golden.txt");
   77.37 +        for (int i = 1; i <= 8; i++) {
   77.38              String filename = "xml_" + i + ".txt";
   77.39 -            String content = JavaFileHandlerTest.readFile(filename);
   77.40 +            String content = readFile(XmlFileHandlerTest.class, filename);
   77.41              assertDeclarationFound(content, filename);
   77.42          }
   77.43      }
   77.44  
   77.45 -    private void assertDeclarationFound (String content, String filename) {
   77.46 +    private void assertDeclarationFound(String content, String filename) {
   77.47          String[] lines = FileHandler.splitIntoLines(content);
   77.48          boolean found = false;
   77.49          for (int i = 0; i < lines.length; i++) {
   77.50 @@ -79,15 +79,15 @@
   77.51                  break;
   77.52              }
   77.53          }
   77.54 -        assertTrue ("Did not find xml declaration in " + filename, found);
   77.55 +        assertTrue("Did not find xml declaration in " + filename, found);
   77.56      }
   77.57  
   77.58      @Test
   77.59      public void testStuff() throws Exception {
   77.60          System.out.println("testStuff");
   77.61          String golden = getGolden();
   77.62 -        String license = JavaFileHandlerTest.getLicense();
   77.63 -        for (int i=1; i <= 8; i++) {
   77.64 +        String license = getLicense();
   77.65 +        for (int i = 1; i <= 8; i++) {
   77.66              String filename = "xml_" + i + ".txt";
   77.67              testOneVersion(golden, license, filename);
   77.68          }
   77.69 @@ -96,14 +96,14 @@
   77.70      private void testOneVersion(String golden, String license, String filename) throws Exception {
   77.71          System.out.println("Test " + filename);
   77.72          XmlFileHandler instance = new XmlFileHandler();
   77.73 -        String original = JavaFileHandlerTest.readFile (filename);
   77.74 +        String original = readFile(XmlFileHandlerTest.class, filename);
   77.75          String processed = instance.transform(original, license, props);
   77.76 -        assertEqualsLineByLine (golden, processed, filename);
   77.77 +        assertEqualsLineByLine(golden, processed, filename);
   77.78      }
   77.79  
   77.80 -    static void assertEqualsLineByLine (String golden, String processed, String filename) {
   77.81 -        StringTokenizer a = new StringTokenizer (golden, "\n");
   77.82 -        StringTokenizer b = new StringTokenizer (processed, "\n");
   77.83 +    static void assertEqualsLineByLine(String golden, String processed, String filename) {
   77.84 +        StringTokenizer a = new StringTokenizer(golden, "\n");
   77.85 +        StringTokenizer b = new StringTokenizer(processed, "\n");
   77.86          int ix = 0;
   77.87          while (a.hasMoreTokens() && b.hasMoreTokens()) {
   77.88              String as = a.nextToken();
   77.89 @@ -111,13 +111,13 @@
   77.90              if (!as.equals(bs)) {
   77.91                  System.err.println("PROCESSED OUTPUT ");
   77.92              }
   77.93 -            assertEquals ("Difference in " + filename + " at line " + ix + "\n", as, bs);
   77.94 +            assertEquals("Difference in " + filename + " at line " + ix + "\n", as, bs);
   77.95              ix++;
   77.96          }
   77.97  
   77.98      }
   77.99  
  77.100      private static String getGolden() throws Exception {
  77.101 -        return JavaFileHandlerTest.readFile ("xml_golden.txt");
  77.102 +        return readFile(XmlFileHandlerTest.class, "xml_golden.txt");
  77.103      }
  77.104 -}
  77.105 \ No newline at end of file
  77.106 +}
    78.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/fake_license.txt	Fri Feb 08 11:02:28 2013 +0100
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,29 +0,0 @@
    78.4 -Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
    78.5 -All rights reversed.
    78.6 -
    78.7 -Redistribution and use in source, binary or corpuscular forms, with or without
    78.8 -modification, are prohibited under all circumstances unless the following
    78.9 -conditions have been met:
   78.10 -
   78.11 -  1. You have an eyeball growing in the palm of your left hand
   78.12 -
   78.13 -  2. Seven dwarfs really like your golden hair
   78.14 -
   78.15 -  3. The moon has reversed its course a multiple of times divisible by
   78.16 -     the eighteenth prime number in the last year
   78.17 -
   78.18 -THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
   78.19 -INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
   78.20 -DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
   78.21 -OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
   78.22 -ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
   78.23 -SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
   78.24 -LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
   78.25 -BALL DROP, BECOMING A LAWYER.
   78.26 -
   78.27 -BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
   78.28 -AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
   78.29 -AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
   78.30 -INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
   78.31 -
   78.32 -RUN, RUN NOW, AND RUN VERY FAST.
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_class_golden.txt	Sun Feb 10 16:18:19 2013 +0100
    79.3 @@ -0,0 +1,44 @@
    79.4 +/*
    79.5 + * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
    79.6 + * All rights reversed.
    79.7 + *
    79.8 + * Redistribution and use in source, binary or corpuscular forms, with or without
    79.9 + * modification, are prohibited under all circumstances unless the following
   79.10 + * conditions have been met:
   79.11 + *
   79.12 + *   1. You have an eyeball growing in the palm of your left hand
   79.13 + *
   79.14 + *   2. Seven dwarfs really like your golden hair
   79.15 + *
   79.16 + *   3. The moon has reversed its course a multiple of times divisible by
   79.17 + *      the eighteenth prime number in the last year
   79.18 + *
   79.19 + * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
   79.20 + * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
   79.21 + * DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
   79.22 + * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
   79.23 + * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
   79.24 + * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
   79.25 + * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
   79.26 + * BALL DROP, BECOMING A LAWYER.
   79.27 + *
   79.28 + * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
   79.29 + * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
   79.30 + * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
   79.31 + * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
   79.32 + *
   79.33 + * RUN, RUN NOW, AND RUN VERY FAST.
   79.34 + */
   79.35 +package org.netbeans.modules.licensechanger;
   79.36 +/**
   79.37 + * Groovy allows classes to have explicit packages.
   79.38 + * @author Nils Hoffmann
   79.39 + */
   79.40 +public class Yodeling {
   79.41 +    Boolean traditional
   79.42 +    
   79.43 +    void yodle() {
   79.44 +        println (traditional?"Holla-ha-iittiie!":"Oh-di-lay-ee-ay, di-lay-dee-oh, de-lay-ee")
   79.45 +    }
   79.46 +}
   79.47 +
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_class_nopackage_golden.txt	Sun Feb 10 16:18:19 2013 +0100
    80.3 @@ -0,0 +1,44 @@
    80.4 +/*
    80.5 + * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
    80.6 + * All rights reversed.
    80.7 + *
    80.8 + * Redistribution and use in source, binary or corpuscular forms, with or without
    80.9 + * modification, are prohibited under all circumstances unless the following
   80.10 + * conditions have been met:
   80.11 + *
   80.12 + *   1. You have an eyeball growing in the palm of your left hand
   80.13 + *
   80.14 + *   2. Seven dwarfs really like your golden hair
   80.15 + *
   80.16 + *   3. The moon has reversed its course a multiple of times divisible by
   80.17 + *      the eighteenth prime number in the last year
   80.18 + *
   80.19 + * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
   80.20 + * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
   80.21 + * DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
   80.22 + * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
   80.23 + * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
   80.24 + * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
   80.25 + * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
   80.26 + * BALL DROP, BECOMING A LAWYER.
   80.27 + *
   80.28 + * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
   80.29 + * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
   80.30 + * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
   80.31 + * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
   80.32 + *
   80.33 + * RUN, RUN NOW, AND RUN VERY FAST.
   80.34 + */
   80.35 +
   80.36 +/**
   80.37 + * Groovy allows classes without explicit package.
   80.38 + * @author Nils Hoffmann
   80.39 + */
   80.40 +public class Yodeling {
   80.41 +    Boolean traditional
   80.42 +    
   80.43 +    void yodle() {
   80.44 +        println (traditional?"Holla-ha-iittiie!":"Oh-di-lay-ee-ay, di-lay-dee-oh, de-lay-ee")
   80.45 +    }
   80.46 +}
   80.47 +
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_class_nopackage_template.txt	Sun Feb 10 16:18:19 2013 +0100
    81.3 @@ -0,0 +1,12 @@
    81.4 +/**
    81.5 + * Groovy allows classes without explicit package.
    81.6 + * @author Nils Hoffmann
    81.7 + */
    81.8 +public class Yodeling {
    81.9 +    Boolean traditional
   81.10 +    
   81.11 +    void yodle() {
   81.12 +        println (traditional?"Holla-ha-iittiie!":"Oh-di-lay-ee-ay, di-lay-dee-oh, de-lay-ee")
   81.13 +    }
   81.14 +}
   81.15 +
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_class_template.txt	Sun Feb 10 16:18:19 2013 +0100
    82.3 @@ -0,0 +1,13 @@
    82.4 +package org.netbeans.modules.licensechanger;
    82.5 +/**
    82.6 + * Groovy allows classes to have explicit packages.
    82.7 + * @author Nils Hoffmann
    82.8 + */
    82.9 +public class Yodeling {
   82.10 +    Boolean traditional
   82.11 +    
   82.12 +    void yodle() {
   82.13 +        println (traditional?"Holla-ha-iittiie!":"Oh-di-lay-ee-ay, di-lay-dee-oh, de-lay-ee")
   82.14 +    }
   82.15 +}
   82.16 +
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_script_golden.txt	Sun Feb 10 16:18:19 2013 +0100
    83.3 @@ -0,0 +1,33 @@
    83.4 +/*
    83.5 + * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
    83.6 + * All rights reversed.
    83.7 + *
    83.8 + * Redistribution and use in source, binary or corpuscular forms, with or without
    83.9 + * modification, are prohibited under all circumstances unless the following
   83.10 + * conditions have been met:
   83.11 + *
   83.12 + *   1. You have an eyeball growing in the palm of your left hand
   83.13 + *
   83.14 + *   2. Seven dwarfs really like your golden hair
   83.15 + *
   83.16 + *   3. The moon has reversed its course a multiple of times divisible by
   83.17 + *      the eighteenth prime number in the last year
   83.18 + *
   83.19 + * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
   83.20 + * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
   83.21 + * DISCLAIMED.  IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
   83.22 + * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
   83.23 + * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
   83.24 + * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
   83.25 + * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
   83.26 + * BALL DROP, BECOMING A LAWYER.
   83.27 + *
   83.28 + * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
   83.29 + * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
   83.30 + * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
   83.31 + * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
   83.32 + *
   83.33 + * RUN, RUN NOW, AND RUN VERY FAST.
   83.34 + */
   83.35 +println "It's alive!"
   83.36 +
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/groovy_script_template.txt	Sun Feb 10 16:18:19 2013 +0100
    84.3 @@ -0,0 +1,2 @@
    84.4 +println "It's alive!"
    84.5 +
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_1.txt	Sun Feb 10 16:18:19 2013 +0100
    85.3 @@ -0,0 +1,39 @@
    85.4 +/*
    85.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    85.6 + *
    85.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    85.8 + *
    85.9 + * The contents of this file are subject to the terms of either the GNU
   85.10 + * General Public License Version 2 only ("GPL") or the Common
   85.11 + * Development and Distribution License("CDDL") (collectively, the
   85.12 + * "License"). You may not use this file except in compliance with the
   85.13 + * License. You can obtain a copy of the License at
   85.14 + * http://www.netbeans.org/cddl-gplv2.html
   85.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   85.16 + * specific language governing permissions and limitations under the
   85.17 + * License.  When distributing the software, include this License Header
   85.18 + * Notice in each file and include the License file at
   85.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   85.20 + * particular file as subject to the "Classpath" exception as provided
   85.21 + * by Sun in the GPL Version 2 section of the License file that
   85.22 + * accompanied this code. If applicable, add the following below the
   85.23 + * License Header, with the fields enclosed by brackets [] replaced by
   85.24 + * your own identifying information:
   85.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   85.26 + *
   85.27 + * If you wish your version of this file to be governed by only the CDDL
   85.28 + * or only the GPL Version 2, indicate your decision by adding
   85.29 + * "[Contributor] elects to include this software in this distribution
   85.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   85.31 + * single choice of license, a recipient has the option to distribute
   85.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   85.33 + * to extend the choice of license to its licensees as provided above.
   85.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   85.35 + * Version 2 license, then the option applies only if the new code is
   85.36 + * made subject to such option by the copyright holder.
   85.37 + *
   85.38 + * Contributor(s):
   85.39 + *
   85.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   85.41 + */
   85.42 +
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_10.txt	Sun Feb 10 16:18:19 2013 +0100
    86.3 @@ -0,0 +1,45 @@
    86.4 +/*
    86.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    86.6 + *
    86.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    86.8 + *
    86.9 + * The contents of this file are subject to the terms of either the GNU
   86.10 + * General Public License Version 2 only ("GPL") or the Common
   86.11 + * Development and Distribution License("CDDL") (collectively, the
   86.12 + * "License"). You may not use this file except in compliance with the
   86.13 + * License. You can obtain a copy of the License at
   86.14 + * http://www.netbeans.org/cddl-gplv2.html
   86.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   86.16 + * specific language governing permissions and limitations under the
   86.17 + * License.  When distributing the software, include this License Header
   86.18 + * Notice in each file and include the License file at
   86.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   86.20 + * particular file as subject to the "Classpath" exception as provided
   86.21 + * by Sun in the GPL Version 2 section of the License file that
   86.22 + * accompanied this code. If applicable, add the following below the
   86.23 + * License Header, with the fields enclosed by brackets [] replaced by
   86.24 + * your own identifying information:
   86.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   86.26 + *
   86.27 + * If you wish your version of this file to be governed by only the CDDL
   86.28 + * or only the GPL Version 2, indicate your decision by adding
   86.29 + * "[Contributor] elects to include this software in this distribution
   86.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   86.31 + * single choice of license, a recipient has the option to distribute
   86.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   86.33 + * to extend the choice of license to its licensees as provided above.
   86.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   86.35 + * Version 2 license, then the option applies only if the new code is
   86.36 + * made subject to such option by the copyright holder.
   86.37 + *
   86.38 + * Contributor(s):
   86.39 + *
   86.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   86.41 + */
   86.42 +/* Created on March 14, 2009 
   86.43 + * by some IDE or other
   86.44 + */
   86.45 +
   86.46 +//blah blah blah
   86.47 +//blah blah blah
   86.48 +
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_11.txt	Sun Feb 10 16:18:19 2013 +0100
    87.3 @@ -0,0 +1,49 @@
    87.4 +/*
    87.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    87.6 + *
    87.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    87.8 + *
    87.9 + * The contents of this file are subject to the terms of either the GNU
   87.10 + * General Public License Version 2 only ("GPL") or the Common
   87.11 + * Development and Distribution License("CDDL") (collectively, the
   87.12 + * "License"). You may not use this file except in compliance with the
   87.13 + * License. You can obtain a copy of the License at
   87.14 + * http://www.netbeans.org/cddl-gplv2.html
   87.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   87.16 + * specific language governing permissions and limitations under the */
   87.17 +
   87.18 +//BLAH BLAH BLAH
   87.19 +//BLAH BLAH BLAH
   87.20 +
   87.21 +     /* License.  When distributing the software, include this License Header
   87.22 + * Notice in each file and include the License file at
   87.23 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   87.24 + * particular file as subject to the "Classpath" exception as provided
   87.25 + * by Sun in the GPL Version 2 section of the License file that
   87.26 + * accompanied this code. If applicable, add the following below the
   87.27 + * License Header, with the fields enclosed by brackets [] replaced by
   87.28 + * your own identifying information:
   87.29 + * "Portions Copyrighted [year] [name of copyright owner]"
   87.30 + *
   87.31 + * If you wish your version of this file to be governed by only the CDDL
   87.32 + * or only the GPL Version 2, indicate your decision by adding
   87.33 + * "[Contributor] elects to include this software in this distribution
   87.34 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   87.35 + * single choice of license, a recipient has the option to distribute
   87.36 + * your version of this file under either the CDDL, the GPL Version 2 or
   87.37 + * to extend the choice of license to its licensees as provided above.
   87.38 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   87.39 + * Version 2 license, then the option applies only if the new code is
   87.40 + * made subject to such option by the copyright holder.
   87.41 + *
   87.42 + * Contributor(s):
   87.43 + *
   87.44 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   87.45 + */
   87.46 +/* Created on March 14, 2009 
   87.47 + * by some IDE or other
   87.48 + */
   87.49 +
   87.50 +//blah blah blah
   87.51 +//blah blah blah
   87.52 +
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_12.txt	Sun Feb 10 16:18:19 2013 +0100
    88.3 @@ -0,0 +1,48 @@
    88.4 +/*
    88.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    88.6 + *
    88.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    88.8 + *
    88.9 + * The contents of this file are subject to the terms of either the GNU
   88.10 + * General Public License Version 2 only ("GPL") or the Common
   88.11 + * Development and Distribution License("CDDL") (collectively, the
   88.12 + * "License"). You may not use this file except in compliance with the
   88.13 + * License. You can obtain a copy of the License at
   88.14 + * http://www.netbeans.org/cddl-gplv2.html
   88.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   88.16 + * specific language governing permissions and limitations under the
   88.17 +*/
   88.18 +//BLAH BLAH BLAH
   88.19 +//BLAH BLAH BLAH
   88.20 +     /* License.  When distributing the software, include this License Header
   88.21 + * Notice in each file and include the License file at
   88.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   88.23 + * particular file as subject to the "Classpath" exception as provided
   88.24 + * by Sun in the GPL Version 2 section of the License file that
   88.25 + * accompanied this code. If applicable, add the following below the
   88.26 + * License Header, with the fields enclosed by brackets [] replaced by
   88.27 + * your own identifying information:
   88.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   88.29 + *
   88.30 + * If you wish your version of this file to be governed by only the CDDL
   88.31 + * or only the GPL Version 2, indicate your decision by adding
   88.32 + * "[Contributor] elects to include this software in this distribution
   88.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   88.34 + * single choice of license, a recipient has the option to distribute
   88.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   88.36 + * to extend the choice of license to its licensees as provided above.
   88.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   88.38 + * Version 2 license, then the option applies only if the new code is
   88.39 + * made subject to such option by the copyright holder.
   88.40 + *
   88.41 + * Contributor(s):
   88.42 + *
   88.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   88.44 + */
   88.45 +/* Created on March 14, 2009 
   88.46 + * by some IDE or other
   88.47 + */
   88.48 +
   88.49 +//blah blah blah
   88.50 +//blah blah blah
   88.51 +
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_2.txt	Sun Feb 10 16:18:19 2013 +0100
    89.3 @@ -0,0 +1,41 @@
    89.4 +
    89.5 +
    89.6 +/*
    89.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    89.8 + *
    89.9 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   89.10 + *
   89.11 + * The contents of this file are subject to the terms of either the GNU
   89.12 + * General Public License Version 2 only ("GPL") or the Common
   89.13 + * Development and Distribution License("CDDL") (collectively, the
   89.14 + * "License"). You may not use this file except in compliance with the
   89.15 + * License. You can obtain a copy of the License at
   89.16 + * http://www.netbeans.org/cddl-gplv2.html
   89.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   89.18 + * specific language governing permissions and limitations under the
   89.19 + * License.  When distributing the software, include this License Header
   89.20 + * Notice in each file and include the License file at
   89.21 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   89.22 + * particular file as subject to the "Classpath" exception as provided
   89.23 + * by Sun in the GPL Version 2 section of the License file that
   89.24 + * accompanied this code. If applicable, add the following below the
   89.25 + * License Header, with the fields enclosed by brackets [] replaced by
   89.26 + * your own identifying information:
   89.27 + * "Portions Copyrighted [year] [name of copyright owner]"
   89.28 + *
   89.29 + * If you wish your version of this file to be governed by only the CDDL
   89.30 + * or only the GPL Version 2, indicate your decision by adding
   89.31 + * "[Contributor] elects to include this software in this distribution
   89.32 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   89.33 + * single choice of license, a recipient has the option to distribute
   89.34 + * your version of this file under either the CDDL, the GPL Version 2 or
   89.35 + * to extend the choice of license to its licensees as provided above.
   89.36 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   89.37 + * Version 2 license, then the option applies only if the new code is
   89.38 + * made subject to such option by the copyright holder.
   89.39 + *
   89.40 + * Contributor(s):
   89.41 + *
   89.42 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   89.43 + */
   89.44 +
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_3.txt	Sun Feb 10 16:18:19 2013 +0100
    90.3 @@ -0,0 +1,39 @@
    90.4 +/*
    90.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    90.6 + *
    90.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    90.8 + *
    90.9 + * The contents of this file are subject to the terms of either the GNU
   90.10 + * General Public License Version 2 only ("GPL") or the Common
   90.11 + * Development and Distribution License("CDDL") (collectively, the
   90.12 + * "License"). You may not use this file except in compliance with the
   90.13 + * License. You can obtain a copy of the License at
   90.14 + * http://www.netbeans.org/cddl-gplv2.html
   90.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   90.16 + * specific language governing permissions and limitations under the
   90.17 + * License.  When distributing the software, include this License Header
   90.18 + * Notice in each file and include the License file at
   90.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   90.20 + * particular file as subject to the "Classpath" exception as provided
   90.21 + * by Sun in the GPL Version 2 section of the License file that
   90.22 + * accompanied this code. If applicable, add the following below the
   90.23 + * License Header, with the fields enclosed by brackets [] replaced by
   90.24 + * your own identifying information:
   90.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   90.26 + *
   90.27 + * If you wish your version of this file to be governed by only the CDDL
   90.28 + * or only the GPL Version 2, indicate your decision by adding
   90.29 + * "[Contributor] elects to include this software in this distribution
   90.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   90.31 + * single choice of license, a recipient has the option to distribute
   90.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   90.33 + * to extend the choice of license to its licensees as provided above.
   90.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   90.35 + * Version 2 license, then the option applies only if the new code is
   90.36 + * made subject to such option by the copyright holder.
   90.37 + *
   90.38 + * Contributor(s):
   90.39 + *
   90.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   90.41 + */
   90.42 +
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_4.txt	Sun Feb 10 16:18:19 2013 +0100
    91.3 @@ -0,0 +1,42 @@
    91.4 +
    91.5 +    //Hello world
    91.6 +
    91.7 +/*
    91.8 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    91.9 + *
   91.10 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
   91.11 + *
   91.12 + * The contents of this file are subject to the terms of either the GNU
   91.13 + * General Public License Version 2 only ("GPL") or the Common
   91.14 + * Development and Distribution License("CDDL") (collectively, the
   91.15 + * "License"). You may not use this file except in compliance with the
   91.16 + * License. You can obtain a copy of the License at
   91.17 + * http://www.netbeans.org/cddl-gplv2.html
   91.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   91.19 + * specific language governing permissions and limitations under the
   91.20 + * License.  When distributing the software, include this License Header
   91.21 + * Notice in each file and include the License file at
   91.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   91.23 + * particular file as subject to the "Classpath" exception as provided
   91.24 + * by Sun in the GPL Version 2 section of the License file that
   91.25 + * accompanied this code. If applicable, add the following below the
   91.26 + * License Header, with the fields enclosed by brackets [] replaced by
   91.27 + * your own identifying information:
   91.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   91.29 + *
   91.30 + * If you wish your version of this file to be governed by only the CDDL
   91.31 + * or only the GPL Version 2, indicate your decision by adding
   91.32 + * "[Contributor] elects to include this software in this distribution
   91.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   91.34 + * single choice of license, a recipient has the option to distribute
   91.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   91.36 + * to extend the choice of license to its licensees as provided above.
   91.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   91.38 + * Version 2 license, then the option applies only if the new code is
   91.39 + * made subject to such option by the copyright holder.
   91.40 + *
   91.41 + * Contributor(s):
   91.42 + *
   91.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   91.44 + */
   91.45 +
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_5.txt	Sun Feb 10 16:18:19 2013 +0100
    92.3 @@ -0,0 +1,4 @@
    92.4 +//This is another kind of license comment
    92.5 +//We should make sure it catches this too
    92.6 +//We really want to get rid of all stuff before the package statement
    92.7 +
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_7.txt	Sun Feb 10 16:18:19 2013 +0100
    93.3 @@ -0,0 +1,40 @@
    93.4 +/*
    93.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    93.6 + *
    93.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    93.8 + *
    93.9 + * The contents of this file are subject to the terms of either the GNU
   93.10 + * General Public License Version 2 only ("GPL") or the Common
   93.11 + * Development and Distribution License("CDDL") (collectively, the
   93.12 + * "License"). You may not use this file except in compliance with the
   93.13 + * License. You can obtain a copy of the License at
   93.14 + * http://www.netbeans.org/cddl-gplv2.html
   93.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   93.16 + * specific language governing permissions and limitations under the
   93.17 + * License.  When distributing the software, include this License Header
   93.18 + * Notice in each file and include the License file at
   93.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   93.20 + * particular file as subject to the "Classpath" exception as provided
   93.21 + * by Sun in the GPL Version 2 section of the License file that
   93.22 + * accompanied this code. If applicable, add the following below the
   93.23 + * License Header, with the fields enclosed by brackets [] replaced by
   93.24 + * your own identifying information:
   93.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   93.26 + *
   93.27 + * If you wish your version of this file to be governed by only the CDDL
   93.28 + * or only the GPL Version 2, indicate your decision by adding
   93.29 + * "[Contributor] elects to include this software in this distribution
   93.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   93.31 + * single choice of license, a recipient has the option to distribute
   93.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   93.33 + * to extend the choice of license to its licensees as provided above.
   93.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   93.35 + * Version 2 license, then the option applies only if the new code is
   93.36 + * made subject to such option by the copyright holder.
   93.37 + *
   93.38 + * Contributor(s):
   93.39 + *
   93.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   93.41 + */
   93.42 +/* Created on March 14, 2009 */
   93.43 +
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_8.txt	Sun Feb 10 16:18:19 2013 +0100
    94.3 @@ -0,0 +1,41 @@
    94.4 +/*
    94.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    94.6 + *
    94.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    94.8 + *
    94.9 + * The contents of this file are subject to the terms of either the GNU
   94.10 + * General Public License Version 2 only ("GPL") or the Common
   94.11 + * Development and Distribution License("CDDL") (collectively, the
   94.12 + * "License"). You may not use this file except in compliance with the
   94.13 + * License. You can obtain a copy of the License at
   94.14 + * http://www.netbeans.org/cddl-gplv2.html
   94.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   94.16 + * specific language governing permissions and limitations under the
   94.17 + * License.  When distributing the software, include this License Header
   94.18 + * Notice in each file and include the License file at
   94.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   94.20 + * particular file as subject to the "Classpath" exception as provided
   94.21 + * by Sun in the GPL Version 2 section of the License file that
   94.22 + * accompanied this code. If applicable, add the following below the
   94.23 + * License Header, with the fields enclosed by brackets [] replaced by
   94.24 + * your own identifying information:
   94.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   94.26 + *
   94.27 + * If you wish your version of this file to be governed by only the CDDL
   94.28 + * or only the GPL Version 2, indicate your decision by adding
   94.29 + * "[Contributor] elects to include this software in this distribution
   94.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   94.31 + * single choice of license, a recipient has the option to distribute
   94.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   94.33 + * to extend the choice of license to its licensees as provided above.
   94.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   94.35 + * Version 2 license, then the option applies only if the new code is
   94.36 + * made subject to such option by the copyright holder.
   94.37 + *
   94.38 + * Contributor(s):
   94.39 + *
   94.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   94.41 + */
   94.42 +/* Created on March 14, 2009 
   94.43 + * by some IDE or other */
   94.44 +
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/resources/groovy/header_9.txt	Sun Feb 10 16:18:19 2013 +0100
    95.3 @@ -0,0 +1,42 @@
    95.4 +/*
    95.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    95.6 + *
    95.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
    95.8 + *
    95.9 + * The contents of this file are subject to the terms of either the GNU
   95.10 + * General Public License Version 2 only ("GPL") or the Common
   95.11 + * Development and Distribution License("CDDL") (collectively, the
   95.12 + * "License"). You may not use this file except in compliance with the
   95.13 + * License. You can obtain a copy of the License at
   95.14 + * http://www.netbeans.org/cddl-gplv2.html
   95.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   95.16 + * specific language governing permissions and limitations under the
   95.17 + * License.  When distributing the software, include this License Header
   95.18 + * Notice in each file and include the License file at
   95.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   95.20 + * particular file as subject to the "Classpath" exception as provided
   95.21 + * by Sun in the GPL Version 2 section of the License file that
   95.22 + * accompanied this code. If applicable, add the following below the
   95.23 + * License Header, with the fields enclosed by brackets [] replaced by
   95.24 + * your own identifying information:
   95.25 + * "Portions Copyrighted [year] [name of copyright owner]"
   95.26 + *
   95.27 + * If you wish your version of this file to be governed by only the CDDL
   95.28 + * or only the GPL Version 2, indicate your decision by adding
   95.29 + * "[Contributor] elects to include this software in this distribution
   95.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   95.31 + * single choice of license, a recipient has the option to distribute
   95.32 + * your version of this file under either the CDDL, the GPL Version 2 or
   95.33 + * to extend the choice of license to its licensees as provided above.
   95.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   95.35 + * Version 2 license, then the option applies only if the new code is
   95.36 + * made subject to such option by the copyright holder.
   95.37 + *
   95.38 + * Contributor(s):
   95.39 + *
   95.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   95.41 + */
   95.42 +/* Created on March 14, 2009 
   95.43 + * by some IDE or other
   95.44 + */
   95.45 +