Fixed LicenseChanger to compile against NB 7.2. Updated wizard API dependency to Dialog API. LicenseChanger now automatically offers installed license templates. Included Diff API for better preview of applied changes.
1.1 --- a/licensechanger/build.xml Thu Aug 30 10:56:16 2012 +0200
1.2 +++ b/licensechanger/build.xml Thu Sep 13 09:10:03 2012 +0200
1.3 @@ -1,34 +1,8 @@
1.4 <?xml version="1.0" encoding="UTF-8"?>
1.5 -<project basedir="." default="netbeans" name="contrib/licensechanger">
1.6 -
1.7 - <import file="../../nbbuild/templates/projectized.xml"/>
1.8 -
1.9 - <target name="compile" depends="projectized-common.compile">
1.10 - <mkdir dir="${build.classes.dir}/org/netbeans/modules/licensechanger/licenses"/>
1.11 - <copy todir="${build.classes.dir}/org/netbeans/modules/licensechanger/licenses">
1.12 - <fileset dir="${basedir}/../../nbbuild/licenses">
1.13 - <!-- XXX would it be better to just include the ones we _do_ want? -->
1.14 - <exclude name="ANTLR-2"/>
1.15 - <exclude name="Apache-1.1-xmlunit_variant"/>
1.16 - <exclude name="Apache-2.0-Vera-Perseus"/>
1.17 - <exclude name="Apache-JDOM"/>
1.18 - <exclude name="BSD-jsch-variant"/>
1.19 - <exclude name="DOM4J-BSD"/>
1.20 - <exclude name="GPL-with-Proguard-exception"/>
1.21 - <exclude name="HttpUnit"/>
1.22 - <exclude name="Northwoods"/>
1.23 - <exclude name="Subversion"/>
1.24 - <exclude name="TEL_For_NB_dbxGUI"/>
1.25 - <exclude name="cobertura"/>
1.26 - <exclude name="freemarker"/>
1.27 - <exclude name="prefuse-BSD"/>
1.28 - </fileset>
1.29 - </copy>
1.30 - <fileset dir="${build.classes.dir}/org/netbeans/modules/licensechanger/licenses" id="license.files"/>
1.31 - <pathconvert property="license.files.nl" pathsep=" " refid="license.files">
1.32 - <mapper type="flatten"/>
1.33 - </pathconvert>
1.34 - <echo file="${build.classes.dir}/org/netbeans/modules/licensechanger/licenses.txt" message="${license.files.nl}"/>
1.35 - </target>
1.36 -
1.37 +<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
1.38 +<!-- for some information on what you could do (e.g. targets to override). -->
1.39 +<!-- If you delete this file and reopen the project it will be recreated. -->
1.40 +<project name="org.netbeans.modules.licensechanger" default="netbeans" basedir=".">
1.41 + <description>Builds, tests, and runs the project org.netbeans.modules.licensechanger.</description>
1.42 + <import file="nbproject/build-impl.xml"/>
1.43 </project>
2.1 --- a/licensechanger/external/binaries-list Thu Aug 30 10:56:16 2012 +0200
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,1 +0,0 @@
2.4 -6457C7671CCE963183972513BA7DE661512A3653 wizard.java.net.264.jar
3.1 --- a/licensechanger/manifest.mf Thu Aug 30 10:56:16 2012 +0200
3.2 +++ b/licensechanger/manifest.mf Thu Sep 13 09:10:03 2012 +0200
3.3 @@ -2,5 +2,8 @@
3.4 OpenIDE-Module: org.netbeans.modules.licensechanger/1
3.5 OpenIDE-Module-Layer: org/netbeans/modules/licensechanger/layer.xml
3.6 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/licensechanger/Bundle.properties
3.7 -OpenIDE-Module-Specification-Version: 1.8
3.8 +OpenIDE-Module-Requires:
3.9 + javax.script.ScriptEngine.FreeMarker,
3.10 + javax.script.ScriptEngine.freemarker
3.11 +OpenIDE-Module-Specification-Version: 1.9
3.12
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/licensechanger/nbproject/build-impl.xml Thu Sep 13 09:10:03 2012 +0200
4.3 @@ -0,0 +1,42 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.5 +<!--
4.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
4.7 +*** EDIT ../build.xml INSTEAD ***
4.8 +-->
4.9 +<project name="org.netbeans.modules.licensechanger-impl" basedir="..">
4.10 + <fail message="Please build using Ant 1.7.1 or higher.">
4.11 + <condition>
4.12 + <not>
4.13 + <antversion atleast="1.7.1"/>
4.14 + </not>
4.15 + </condition>
4.16 + </fail>
4.17 + <property file="nbproject/private/platform-private.properties"/>
4.18 + <property file="nbproject/platform.properties"/>
4.19 + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
4.20 + <attribute name="name"/>
4.21 + <attribute name="value"/>
4.22 + <sequential>
4.23 + <property name="@{name}" value="${@{value}}"/>
4.24 + </sequential>
4.25 + </macrodef>
4.26 + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
4.27 + <attribute name="property"/>
4.28 + <attribute name="value"/>
4.29 + <sequential>
4.30 + <property name="@{property}" value="@{value}"/>
4.31 + </sequential>
4.32 + </macrodef>
4.33 + <property file="${user.properties.file}"/>
4.34 + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.35 + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.36 + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
4.37 + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
4.38 + <condition>
4.39 + <not>
4.40 + <contains string="${cluster.path.evaluated}" substring="platform"/>
4.41 + </not>
4.42 + </condition>
4.43 + </fail>
4.44 + <import file="${harness.dir}/build.xml"/>
4.45 +</project>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/licensechanger/nbproject/genfiles.properties Thu Sep 13 09:10:03 2012 +0200
5.3 @@ -0,0 +1,8 @@
5.4 +build.xml.data.CRC32=5f509671
5.5 +build.xml.script.CRC32=d3b0f448
5.6 +build.xml.stylesheet.CRC32=a56c6a5b@2.47.2
5.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
5.9 +nbproject/build-impl.xml.data.CRC32=5f509671
5.10 +nbproject/build-impl.xml.script.CRC32=b50b3f1d
5.11 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.47.2
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/licensechanger/nbproject/platform.properties Thu Sep 13 09:10:03 2012 +0200
6.3 @@ -0,0 +1,19 @@
6.4 +cluster.path=\
6.5 + ${nbplatform.active.dir}/dlight:\
6.6 + ${nbplatform.active.dir}/harness:\
6.7 + ${nbplatform.active.dir}/cnd:\
6.8 + ${nbplatform.active.dir}/apisupport:\
6.9 + ${nbplatform.active.dir}/enterprise:\
6.10 + ${nbplatform.active.dir}/java:\
6.11 + ${nbplatform.active.dir}/websvccommon:\
6.12 + ${nbplatform.active.dir}/platform:\
6.13 + ${nbplatform.active.dir}/webcommon:\
6.14 + ${nbplatform.active.dir}/groovy:\
6.15 + ${nbplatform.active.dir}/nb:\
6.16 + ${nbplatform.active.dir}/javafx:\
6.17 + ${nbplatform.active.dir}/mobility:\
6.18 + ${nbplatform.active.dir}/php:\
6.19 + ${nbplatform.active.dir}/ergonomics:\
6.20 + ${nbplatform.active.dir}/profiler:\
6.21 + ${nbplatform.active.dir}/ide
6.22 +nbplatform.active=default
7.1 --- a/licensechanger/nbproject/project.properties Thu Aug 30 10:56:16 2012 +0200
7.2 +++ b/licensechanger/nbproject/project.properties Thu Sep 13 09:10:03 2012 +0200
7.3 @@ -1,4 +1,5 @@
7.4 -javac.source=1.5
7.5 +javac.source=1.6
7.6 javac.compilerargs=-Xlint -Xlint:-serial
7.7 +nbm.homepage=http://hg.netbeans.org/main/contrib
7.8 nbm.module.author=Tim Boudreau
7.9 -release.external/wizard.java.net.264.jar=modules/ext/wizard.java.net.264.jar
7.10 +project.license=cddl-netbeans-sun
8.1 --- a/licensechanger/nbproject/project.xml Thu Aug 30 10:56:16 2012 +0200
8.2 +++ b/licensechanger/nbproject/project.xml Thu Sep 13 09:10:03 2012 +0200
8.3 @@ -4,14 +4,49 @@
8.4 <configuration>
8.5 <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
8.6 <code-name-base>org.netbeans.modules.licensechanger</code-name-base>
8.7 + <standalone/>
8.8 <module-dependencies>
8.9 <dependency>
8.10 - <code-name-base>org.jdesktop.layout</code-name-base>
8.11 + <code-name-base>org.netbeans.api.progress</code-name-base>
8.12 <build-prerequisite/>
8.13 <compile-dependency/>
8.14 <run-dependency>
8.15 <release-version>1</release-version>
8.16 - <specification-version>1.7</specification-version>
8.17 + <specification-version>1.26.1</specification-version>
8.18 + </run-dependency>
8.19 + </dependency>
8.20 + <dependency>
8.21 + <code-name-base>org.netbeans.libs.freemarker</code-name-base>
8.22 + <run-dependency>
8.23 + <release-version>1</release-version>
8.24 + <specification-version>2.17.1.238</specification-version>
8.25 + </run-dependency>
8.26 + </dependency>
8.27 + <dependency>
8.28 + <code-name-base>org.netbeans.modules.diff</code-name-base>
8.29 + <build-prerequisite/>
8.30 + <compile-dependency/>
8.31 + <run-dependency>
8.32 + <release-version>1</release-version>
8.33 + <specification-version>1.35.1.42.1</specification-version>
8.34 + </run-dependency>
8.35 + </dependency>
8.36 + <dependency>
8.37 + <code-name-base>org.netbeans.modules.projectapi</code-name-base>
8.38 + <build-prerequisite/>
8.39 + <compile-dependency/>
8.40 + <run-dependency>
8.41 + <release-version>1</release-version>
8.42 + <specification-version>1.40.1</specification-version>
8.43 + </run-dependency>
8.44 + </dependency>
8.45 + <dependency>
8.46 + <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
8.47 + <build-prerequisite/>
8.48 + <compile-dependency/>
8.49 + <run-dependency>
8.50 + <release-version>1</release-version>
8.51 + <specification-version>1.53.1.8</specification-version>
8.52 </run-dependency>
8.53 </dependency>
8.54 <dependency>
8.55 @@ -20,7 +55,7 @@
8.56 <compile-dependency/>
8.57 <run-dependency>
8.58 <release-version>1</release-version>
8.59 - <specification-version>1.14</specification-version>
8.60 + <specification-version>1.25.1</specification-version>
8.61 </run-dependency>
8.62 </dependency>
8.63 <dependency>
8.64 @@ -28,7 +63,15 @@
8.65 <build-prerequisite/>
8.66 <compile-dependency/>
8.67 <run-dependency>
8.68 - <specification-version>7.6</specification-version>
8.69 + <specification-version>7.39.1</specification-version>
8.70 + </run-dependency>
8.71 + </dependency>
8.72 + <dependency>
8.73 + <code-name-base>org.openide.dialogs</code-name-base>
8.74 + <build-prerequisite/>
8.75 + <compile-dependency/>
8.76 + <run-dependency>
8.77 + <specification-version>7.23.1</specification-version>
8.78 </run-dependency>
8.79 </dependency>
8.80 <dependency>
8.81 @@ -36,7 +79,7 @@
8.82 <build-prerequisite/>
8.83 <compile-dependency/>
8.84 <run-dependency>
8.85 - <specification-version>6.18</specification-version>
8.86 + <specification-version>6.40.1</specification-version>
8.87 </run-dependency>
8.88 </dependency>
8.89 <dependency>
8.90 @@ -44,7 +87,7 @@
8.91 <build-prerequisite/>
8.92 <compile-dependency/>
8.93 <run-dependency>
8.94 - <specification-version>7.21</specification-version>
8.95 + <specification-version>7.53.2</specification-version>
8.96 </run-dependency>
8.97 </dependency>
8.98 <dependency>
8.99 @@ -52,7 +95,7 @@
8.100 <build-prerequisite/>
8.101 <compile-dependency/>
8.102 <run-dependency>
8.103 - <specification-version>7.5</specification-version>
8.104 + <specification-version>7.32.1</specification-version>
8.105 </run-dependency>
8.106 </dependency>
8.107 <dependency>
8.108 @@ -60,7 +103,15 @@
8.109 <build-prerequisite/>
8.110 <compile-dependency/>
8.111 <run-dependency>
8.112 - <specification-version>7.8</specification-version>
8.113 + <specification-version>7.25.1</specification-version>
8.114 + </run-dependency>
8.115 + </dependency>
8.116 + <dependency>
8.117 + <code-name-base>org.openide.text</code-name-base>
8.118 + <build-prerequisite/>
8.119 + <compile-dependency/>
8.120 + <run-dependency>
8.121 + <specification-version>6.43.3</specification-version>
8.122 </run-dependency>
8.123 </dependency>
8.124 <dependency>
8.125 @@ -68,7 +119,7 @@
8.126 <build-prerequisite/>
8.127 <compile-dependency/>
8.128 <run-dependency>
8.129 - <specification-version>8.0</specification-version>
8.130 + <specification-version>8.19.2</specification-version>
8.131 </run-dependency>
8.132 </dependency>
8.133 <dependency>
8.134 @@ -76,7 +127,15 @@
8.135 <build-prerequisite/>
8.136 <compile-dependency/>
8.137 <run-dependency>
8.138 - <specification-version>8.0</specification-version>
8.139 + <specification-version>8.11.1</specification-version>
8.140 + </run-dependency>
8.141 + </dependency>
8.142 + <dependency>
8.143 + <code-name-base>org.openide.windows</code-name-base>
8.144 + <build-prerequisite/>
8.145 + <compile-dependency/>
8.146 + <run-dependency>
8.147 + <specification-version>6.48.2</specification-version>
8.148 </run-dependency>
8.149 </dependency>
8.150 </module-dependencies>
8.151 @@ -87,15 +146,16 @@
8.152 <code-name-base>org.netbeans.libs.junit4</code-name-base>
8.153 <compile-dependency/>
8.154 </test-dependency>
8.155 + <test-dependency>
8.156 + <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
8.157 + <recursive/>
8.158 + <compile-dependency/>
8.159 + </test-dependency>
8.160 </test-type>
8.161 </test-dependencies>
8.162 <public-packages>
8.163 <package>org.netbeans.modules.licensechanger.api</package>
8.164 </public-packages>
8.165 - <class-path-extension>
8.166 - <runtime-relative-path>ext/wizard.java.net.264.jar</runtime-relative-path>
8.167 - <binary-origin>external/wizard.java.net.264.jar</binary-origin>
8.168 - </class-path-extension>
8.169 </data>
8.170 </configuration>
8.171 </project>
9.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/Bundle.properties Thu Aug 30 10:56:16 2012 +0200
9.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/Bundle.properties Thu Sep 13 09:10:03 2012 +0200
9.3 @@ -2,31 +2,4 @@
9.4 OpenIDE-Module-Long-Description=\
9.5 Provides an action on folders to change the license headers on all files underneath
9.6 OpenIDE-Module-Name=License Changer
9.7 -BROWSE_LICENSE_TITLE=Locate License File
9.8 -MSG_SELECT_A_LICENSE=Select a License or Browse for file
9.9 -ERR_COULD_NOT_LOAD=Could not load {0}
9.10 -LicenseChooserPanel.chooseLabel.text=Choose License
9.11 -LicenseChooserPanel.browseButton.text=Browse
9.12 -MSG_WAIT_FOLDERS=Scanning for folders, please wait...
9.13 -OpenIDE-Module-Short-Description=Provides an action on folders to change the license headers on all files underneath
9.14 -SelectFoldersPanel.jLabel1.text=Uncheck Folders that Should Be Ignored
9.15 -PreviewPanel.jLabel1.text=Before
9.16 -PreviewPanel.jLabel2.text=After
9.17 -LineEndingsPanel.border.title=Line Endings
9.18 -ChooseFileTypesPanel.jLabel1.text=Choose and Customize File Types
9.19 -ChooseFileTypesPanel.noCustomizerLabel.text=[no customizer]
9.20 -ChooseFileTypesPanel.customizerPanel.border.title=File Type Settings
9.21 -
9.22 -WIZARD_TITLE=Add/Replace License Headers
9.23 -chooseFileTypes=Select File Types
9.24 -chooseLicense=Select License
9.25 -chooseFolders=Prune Folders
9.26 -chooseFiles=Choose Files
9.27 -preview=Preview
9.28 -LBL_CHANGE_LICENSE=Change License Headers
9.29 -
9.30 -PreviewPanel.jLabel3.text=jLabel3
9.31 -LineEndingsPanel.noChangeButton.text=Do Not Change
9.32 -LineEndingsPanel.systemDefaultButton.text=Force System Default
9.33 -LineEndingsPanel.newlineButton.text=Force Newline
9.34 -LineEndingsPanel.forceCrlf.text=Force CRLF
9.35 +OpenIDE-Module-Short-Description=Provides an action on folders to change the license headers on all files underneath
9.36 \ No newline at end of file
10.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/ChangeLicenseAction.java Thu Aug 30 10:56:16 2012 +0200
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,98 +0,0 @@
10.4 -/*
10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 - *
10.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
10.8 - *
10.9 - * The contents of this file are subject to the terms of either the GNU
10.10 - * General Public License Version 2 only ("GPL") or the Common
10.11 - * Development and Distribution License("CDDL") (collectively, the
10.12 - * "License"). You may not use this file except in compliance with the
10.13 - * License. You can obtain a copy of the License at
10.14 - * http://www.netbeans.org/cddl-gplv2.html
10.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.16 - * specific language governing permissions and limitations under the
10.17 - * License. When distributing the software, include this License Header
10.18 - * Notice in each file and include the License file at
10.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
10.20 - * particular file as subject to the "Classpath" exception as provided
10.21 - * by Sun in the GPL Version 2 section of the License file that
10.22 - * accompanied this code. If applicable, add the following below the
10.23 - * License Header, with the fields enclosed by brackets [] replaced by
10.24 - * your own identifying information:
10.25 - * "Portions Copyrighted [year] [name of copyright owner]"
10.26 - *
10.27 - * If you wish your version of this file to be governed by only the CDDL
10.28 - * or only the GPL Version 2, indicate your decision by adding
10.29 - * "[Contributor] elects to include this software in this distribution
10.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
10.31 - * single choice of license, a recipient has the option to distribute
10.32 - * your version of this file under either the CDDL, the GPL Version 2 or
10.33 - * to extend the choice of license to its licensees as provided above.
10.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
10.35 - * Version 2 license, then the option applies only if the new code is
10.36 - * made subject to such option by the copyright holder.
10.37 - *
10.38 - * Contributor(s):
10.39 - *
10.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
10.41 - */
10.42 -
10.43 -package org.netbeans.modules.licensechanger;
10.44 -
10.45 -import java.awt.event.ActionEvent;
10.46 -import java.util.HashSet;
10.47 -import java.util.Set;
10.48 -import javax.swing.AbstractAction;
10.49 -import javax.swing.Action;
10.50 -import org.netbeans.api.wizard.WizardDisplayer;
10.51 -import org.openide.filesystems.FileObject;
10.52 -import org.openide.loaders.DataObject;
10.53 -import org.openide.util.ContextAwareAction;
10.54 -import org.openide.util.Lookup;
10.55 -import org.openide.util.LookupEvent;
10.56 -import org.openide.util.LookupListener;
10.57 -import org.openide.util.NbBundle;
10.58 -import org.openide.util.Utilities;
10.59 -
10.60 -/**
10.61 - *
10.62 - * @author Tim Boudreau
10.63 - */
10.64 -public class ChangeLicenseAction extends AbstractAction implements ContextAwareAction, LookupListener {
10.65 - private final Lookup lkp;
10.66 - private final Lookup.Result<DataObject> res;
10.67 -
10.68 - public ChangeLicenseAction() {
10.69 - this (Utilities.actionsGlobalContext());
10.70 - }
10.71 -
10.72 - ChangeLicenseAction (Lookup lkp) {
10.73 - this.lkp = lkp;
10.74 - res = lkp.lookupResult(DataObject.class);
10.75 - putValue (NAME, NbBundle.getMessage(ChangeLicenseAction.class,
10.76 - "LBL_CHANGE_LICENSE")); //NOI18N
10.77 - res.allItems();
10.78 - }
10.79 -
10.80 - public void actionPerformed(ActionEvent e) {
10.81 - Set<FileObject> files = new HashSet<FileObject>();
10.82 - for (DataObject ob : res.allInstances()) {
10.83 - files.add (ob.getPrimaryFile());
10.84 - }
10.85 - WizardPP wiz = new WizardPP (files.toArray(new FileObject[files.size()]));
10.86 - WizardDisplayer.showWizard(wiz.createWizard());
10.87 - }
10.88 -
10.89 - public Action createContextAwareInstance(Lookup actionContext) {
10.90 - return new ChangeLicenseAction(actionContext);
10.91 - }
10.92 -
10.93 - public void resultChanged(LookupEvent ev) {
10.94 - boolean enable = true;
10.95 - for (DataObject ob : res.allInstances()) {
10.96 - enable = ob.getPrimaryFile().isValid() && ob.getPrimaryFile().isFolder();
10.97 - }
10.98 - setEnabled (enable);
10.99 - }
10.100 -
10.101 -}
11.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/CheckboxListView.java Thu Aug 30 10:56:16 2012 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,353 +0,0 @@
11.4 -package org.netbeans.modules.licensechanger;
11.5 -
11.6 -import java.awt.Component;
11.7 -import java.awt.Dimension;
11.8 -import java.awt.Graphics;
11.9 -import java.awt.Insets;
11.10 -import java.awt.event.KeyAdapter;
11.11 -import java.awt.event.KeyEvent;
11.12 -import java.awt.event.MouseEvent;
11.13 -import java.awt.event.MouseListener;
11.14 -import javax.swing.BorderFactory;
11.15 -import javax.swing.JCheckBox;
11.16 -import javax.swing.JComponent;
11.17 -import javax.swing.JList;
11.18 -import javax.swing.ListSelectionModel;
11.19 -import javax.swing.SwingUtilities;
11.20 -import javax.swing.UIManager;
11.21 -import org.openide.awt.HtmlRenderer.Renderer;
11.22 -import org.openide.explorer.ExplorerManager;
11.23 -import org.openide.explorer.ExplorerManager.Provider;
11.24 -import org.openide.explorer.view.ListView;
11.25 -import org.openide.explorer.view.NodeRenderer;
11.26 -import org.openide.nodes.Node;
11.27 -
11.28 -/**
11.29 - * A JList-based list of Nodes which show checkboxes.
11.30 - *
11.31 - * @author Tim Boudreau
11.32 - */
11.33 -public class CheckboxListView extends ListView {
11.34 - public static final String SELECTED = "selected"; //NOI18N
11.35 - private final EventHandler ml = new EventHandler();
11.36 - private boolean checkboxesEnabled = true;
11.37 - private NodeCheckObserver observer;
11.38 -
11.39 - public CheckboxListView() {
11.40 - setPopupAllowed(false);
11.41 - setViewportBorder(BorderFactory.createMatteBorder(5, 5, 5, 5,
11.42 - UIManager.getColor("text"))); //NOI18N
11.43 - }
11.44 -
11.45 - @Override
11.46 - public void addNotify() {
11.47 - super.addNotify();
11.48 - //Need to do this here since overriding createList does not work -
11.49 - //the list is being created somewhere else; this is the best place
11.50 - //to intercept it
11.51 - list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
11.52 - if (checkboxesEnabled) {
11.53 - enableCheckboxes();
11.54 - }
11.55 - }
11.56 -
11.57 - private boolean enabled = true;
11.58 - public void setCheckboxesEnabled(boolean enabled) {
11.59 - this.enabled = enabled;
11.60 - }
11.61 -
11.62 - public void setListEnabled(boolean enabled) {
11.63 - list.setEnabled(enabled);
11.64 - }
11.65 -
11.66 - /**
11.67 - * Set an observer, which will be notified when nodes are checked or
11.68 - * unchecked.
11.69 - * @param observer
11.70 - */
11.71 - public final void setNodeCheckObserver (NodeCheckObserver observer) {
11.72 - this.observer = observer;
11.73 - }
11.74 -
11.75 - @Override
11.76 - public void removeNotify() {
11.77 - super.removeNotify();
11.78 - if (checkboxesEnabled) {
11.79 - disableCheckboxes();
11.80 - }
11.81 - }
11.82 -
11.83 - public synchronized final void setCheckboxesVisible(boolean val) {
11.84 - if (val != checkboxesEnabled) {
11.85 - checkboxesEnabled = val;
11.86 - if (isDisplayable()) {
11.87 - if (val) {
11.88 - enableCheckboxes();
11.89 - } else {
11.90 - disableCheckboxes();
11.91 - }
11.92 - }
11.93 - }
11.94 - }
11.95 -
11.96 - private void enableCheckboxes() {
11.97 - list.addMouseListener(ml);
11.98 - list.addKeyListener(ml);
11.99 - list.setCellRenderer(new CheckboxCellRenderer());
11.100 - repaint();
11.101 - }
11.102 -
11.103 - private void disableCheckboxes() {
11.104 - list.removeMouseListener(ml);
11.105 - list.removeKeyListener(ml);
11.106 - list.setCellRenderer(new NodeRenderer());
11.107 - repaint();
11.108 - }
11.109 -
11.110 - public void setCheckedNodes(Iterable<Node> nodes) {
11.111 - clearCheckedNodes();
11.112 - for (Node n : nodes) {
11.113 - n.setValue(SELECTED, Boolean.TRUE);
11.114 - }
11.115 - repaint();
11.116 - }
11.117 -
11.118 - public void clearCheckedNodes() {
11.119 - for (Node n : allNodes()) {
11.120 - boolean val = Boolean.TRUE.equals(n.getValue(SELECTED));
11.121 - if (observer != null) {
11.122 - observer.onNodeUnchecked(n);
11.123 - }
11.124 - n.setValue(SELECTED, Boolean.FALSE);
11.125 - }
11.126 - repaint();
11.127 - }
11.128 -
11.129 - private void selectNode(int index) {
11.130 - if (!enabled) {
11.131 - return;
11.132 - }
11.133 - if (index < 0) {
11.134 - return;
11.135 - }
11.136 - ExplorerManager.Provider prov = (Provider) SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
11.137 - if (prov != null) {
11.138 - Node[] n = prov.getExplorerManager().getRootContext().getChildren().getNodes();
11.139 - if (index < n.length) {
11.140 - Boolean val = (Boolean) n[index].getValue(SELECTED);
11.141 - boolean wasSet = val != null && val.booleanValue();
11.142 - n[index].setValue(SELECTED, !wasSet);
11.143 - if (observer != null) {
11.144 - if (!wasSet) {
11.145 - observer.onNodeChecked(n[index]);
11.146 - } else {
11.147 - observer.onNodeUnchecked(n[index]);
11.148 - }
11.149 - }
11.150 - repaint();
11.151 - }
11.152 - }
11.153 - }
11.154 -
11.155 - private Node[] allNodes() {
11.156 - ExplorerManager.Provider prov = (Provider)
11.157 - SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
11.158 - return prov == null ? new Node[0] :
11.159 - prov.getExplorerManager().getRootContext().getChildren().getNodes();
11.160 - }
11.161 -
11.162 - private boolean isChecked(int index) {
11.163 - if (index < 0) {
11.164 - return false;
11.165 - }
11.166 - Node[] n = allNodes();
11.167 - return index > n.length - 1 ? false :
11.168 - Boolean.TRUE.equals(n[index].getValue(SELECTED));
11.169 - }
11.170 -
11.171 - private class EventHandler extends KeyAdapter implements MouseListener {
11.172 -
11.173 - @Override
11.174 - public void mouseClicked(MouseEvent e) {
11.175 - if (e.getClickCount() == 2) {
11.176 - selectNode(findIndex(e));
11.177 - e.consume();
11.178 - }
11.179 - }
11.180 -
11.181 - private int findIndex(MouseEvent e) {
11.182 - JList jl = (JList) e.getSource();
11.183 - int result = jl.locationToIndex(e.getPoint());
11.184 - return result;
11.185 - }
11.186 - int pressIndex = -1;
11.187 -
11.188 - @Override
11.189 - public void mousePressed(MouseEvent e) {
11.190 - pressIndex = findIndex(e);
11.191 - }
11.192 -
11.193 - @Override
11.194 - public void mouseReleased(MouseEvent e) {
11.195 - int ix = findIndex(e);
11.196 - if (pressIndex == ix) {
11.197 - if (e.getX() <= 24) {
11.198 - selectNode(ix);
11.199 - e.consume();
11.200 - }
11.201 - }
11.202 - pressIndex = -1;
11.203 - }
11.204 -
11.205 - @Override
11.206 - public void mouseEntered(MouseEvent e) {
11.207 - //do nothing
11.208 - }
11.209 -
11.210 - @Override
11.211 - public void mouseExited(MouseEvent e) {
11.212 - //do nothing
11.213 - }
11.214 -
11.215 - @Override
11.216 - public void keyTyped(KeyEvent e) {
11.217 - JList jl = (JList) e.getSource();
11.218 - if (e.getKeyChar() == '\n' && e.getModifiers() == 0) {
11.219 - selectNode(jl.getSelectedIndex());
11.220 - e.consume();
11.221 - }
11.222 - }
11.223 - }
11.224 -
11.225 - private final class CheckboxCellRenderer extends NodeRenderer {
11.226 -
11.227 - final WrapperComponent rr = new WrapperComponent();
11.228 -
11.229 - @Override
11.230 - public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean cellHasFocus) {
11.231 - cellHasFocus = false;
11.232 - Component c = super.getListCellRendererComponent(list, value, index, sel, cellHasFocus);
11.233 - Renderer r = (Renderer) c;
11.234 - r.setIndent(20);
11.235 - rr.setSelected(isChecked(index));
11.236 - rr.setToPaint(c);
11.237 - rr.setEnabled (enabled);
11.238 - c.setEnabled (enabled);
11.239 - return rr;
11.240 - }
11.241 - }
11.242 -
11.243 - private static class WrapperComponent extends JComponent {
11.244 -
11.245 - Component toPaint;
11.246 - private final JCheckBox box = new JCheckBox();
11.247 -
11.248 - WrapperComponent() {
11.249 - add(box);
11.250 - box.setBorder(BorderFactory.createEmptyBorder());
11.251 - }
11.252 -
11.253 - void setToPaint(Component toPaint) {
11.254 - if (this.toPaint != toPaint) {
11.255 - if (this.toPaint != null) {
11.256 - remove(this.toPaint);
11.257 - }
11.258 - this.toPaint = toPaint;
11.259 - box.setBackground(toPaint.getBackground());
11.260 - add(toPaint);
11.261 - }
11.262 - doLayout();
11.263 - }
11.264 -
11.265 - @Override
11.266 - public Dimension getPreferredSize() {
11.267 - Dimension a = box.getPreferredSize();
11.268 - Dimension b = toPaint == null ? new Dimension(0, 0) : toPaint.getPreferredSize();
11.269 - return new Dimension(a.width + b.width, Math.max(22, Math.max(a.height, b.height) + 1));
11.270 - }
11.271 -
11.272 - @Override
11.273 - public void doLayout() {
11.274 - Dimension a = box.getPreferredSize();
11.275 - Dimension size = getPreferredSize();
11.276 - Insets ins = getInsets();
11.277 - size.height -= ins.top + ins.bottom;
11.278 - int x = ins.left;
11.279 - int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
11.280 - box.setBounds(x, y, a.width, a.height);
11.281 - x += a.width;
11.282 - if (toPaint != null) {
11.283 - Dimension c = toPaint.getPreferredSize();
11.284 - toPaint.setBounds (x, 0, getWidth() - x, c.height);
11.285 - }
11.286 - }
11.287 -
11.288 - @Override
11.289 - public void paint (Graphics g) {
11.290 - doLayout();
11.291 - box.paint (g);
11.292 - if (toPaint != null) {
11.293 - toPaint.paint (g);
11.294 - }
11.295 - }
11.296 -
11.297 - /*
11.298 - @Override
11.299 - public void doLayout() {
11.300 - Dimension a = box.getPreferredSize();
11.301 - System.err.println("Box preferred size " + a);
11.302 - Dimension size = getPreferredSize();
11.303 - System.err.println("My Preferred Size " + size);
11.304 - Insets ins = getInsets();
11.305 - size.height -= ins.top + ins.bottom;
11.306 - int x = ins.left;
11.307 - int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
11.308 - box.setBounds(x, y, a.width, a.height);
11.309 - x += a.width;
11.310 - if (toPaint != null) {
11.311 - a = toPaint.getPreferredSize();
11.312 - System.err.println("toPaint preferred size " + a);
11.313 - a.height = Math.max(22, a.height);
11.314 - y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
11.315 - toPaint.setBounds(x, y, a.width, a.height);
11.316 -// toPaint.setBounds (x, 0, getWidth() - x, getHeight());
11.317 - }
11.318 -
11.319 - System.err.println("---------------------------------------");
11.320 - System.err.println("toPaint bounds " + toPaint.getBounds());
11.321 - System.err.println("toPaint text " + ((JLabel) toPaint).getText());
11.322 - System.err.println("toPaint fg " + toPaint.getForeground());
11.323 - }
11.324 - */
11.325 -
11.326 - void setSelected(boolean val) {
11.327 - box.setSelected(val);
11.328 - }
11.329 -/*
11.330 - @Override
11.331 - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
11.332 - //do nothing
11.333 - }
11.334 -
11.335 - @Override
11.336 - public void repaint(int x, int y, int w, int h) {
11.337 - }
11.338 -
11.339 - @Override
11.340 - public void invalidate() {
11.341 - }
11.342 -
11.343 - @Override
11.344 - public void revalidate() {
11.345 - }
11.346 -
11.347 - @Override
11.348 - public void repaint() {
11.349 - }
11.350 -
11.351 - @Override
11.352 - public void validate() {
11.353 - }
11.354 - */
11.355 - }
11.356 -}
12.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/ChooseFileTypesPanel.form Thu Aug 30 10:56:16 2012 +0200
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,117 +0,0 @@
12.4 -<?xml version="1.0" encoding="UTF-8" ?>
12.5 -
12.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
12.7 - <AuxValues>
12.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
12.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
12.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
12.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
12.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
12.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
12.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
12.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
12.17 - </AuxValues>
12.18 -
12.19 - <Layout>
12.20 - <DimensionLayout dim="0">
12.21 - <Group type="103" groupAlignment="0" attributes="0">
12.22 - <Group type="102" attributes="0">
12.23 - <EmptySpace max="-2" attributes="0"/>
12.24 - <Group type="103" groupAlignment="0" attributes="0">
12.25 - <Component id="jScrollPane1" alignment="0" pref="804" max="32767" attributes="0"/>
12.26 - <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
12.27 - <Group type="102" alignment="1" attributes="0">
12.28 - <Component id="customizerPanel" pref="559" max="32767" attributes="0"/>
12.29 - <EmptySpace type="separate" max="-2" attributes="0"/>
12.30 - <Component id="lineEndingsPanel1" min="-2" pref="227" max="-2" attributes="0"/>
12.31 - </Group>
12.32 - </Group>
12.33 - <EmptySpace max="-2" attributes="0"/>
12.34 - </Group>
12.35 - </Group>
12.36 - </DimensionLayout>
12.37 - <DimensionLayout dim="1">
12.38 - <Group type="103" groupAlignment="0" attributes="0">
12.39 - <Group type="102" alignment="0" attributes="0">
12.40 - <EmptySpace max="-2" attributes="0"/>
12.41 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
12.42 - <EmptySpace max="-2" attributes="0"/>
12.43 - <Component id="jScrollPane1" min="-2" pref="112" max="-2" attributes="0"/>
12.44 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
12.45 - <Group type="103" groupAlignment="0" attributes="0">
12.46 - <Component id="customizerPanel" pref="361" max="32767" attributes="0"/>
12.47 - <Component id="lineEndingsPanel1" alignment="0" pref="361" max="32767" attributes="0"/>
12.48 - </Group>
12.49 - <EmptySpace max="-2" attributes="0"/>
12.50 - </Group>
12.51 - </Group>
12.52 - </DimensionLayout>
12.53 - </Layout>
12.54 - <SubComponents>
12.55 - <Component class="javax.swing.JLabel" name="jLabel1">
12.56 - <Properties>
12.57 - <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
12.58 - <FontInfo relative="true">
12.59 - <Font bold="true" component="jLabel1" property="font" relativeSize="true" size="0"/>
12.60 - </FontInfo>
12.61 - </Property>
12.62 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
12.63 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="ChooseFileTypesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
12.64 - </Property>
12.65 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
12.66 - <Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
12.67 - <MatteColorBorder bottom="1" left="0" right="0" top="0"/>
12.68 - </Border>
12.69 - </Property>
12.70 - </Properties>
12.71 - </Component>
12.72 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
12.73 - <Properties>
12.74 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
12.75 - <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
12.76 - <LineBorder>
12.77 - <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
12.78 - </LineBorder>
12.79 - </Border>
12.80 - </Property>
12.81 - </Properties>
12.82 - <AuxValues>
12.83 - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
12.84 - </AuxValues>
12.85 -
12.86 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
12.87 - </Container>
12.88 - <Component class="org.netbeans.modules.licensechanger.LineEndingsPanel" name="lineEndingsPanel1">
12.89 - </Component>
12.90 - <Container class="javax.swing.JPanel" name="customizerPanel">
12.91 - <Properties>
12.92 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
12.93 - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
12.94 - <TitledBorder title="File Type Settings">
12.95 - <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
12.96 - </TitledBorder>
12.97 - </Border>
12.98 - </Property>
12.99 - </Properties>
12.100 -
12.101 - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
12.102 - <SubComponents>
12.103 - <Component class="javax.swing.JLabel" name="noCustomizerLabel">
12.104 - <Properties>
12.105 - <Property name="horizontalAlignment" type="int" value="0"/>
12.106 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
12.107 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
12.108 - </Property>
12.109 - <Property name="enabled" type="boolean" value="false"/>
12.110 - </Properties>
12.111 - <Constraints>
12.112 - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
12.113 - <BorderConstraints direction="Center"/>
12.114 - </Constraint>
12.115 - </Constraints>
12.116 - </Component>
12.117 - </SubComponents>
12.118 - </Container>
12.119 - </SubComponents>
12.120 -</Form>
13.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/ChooseFileTypesPanel.java Thu Aug 30 10:56:16 2012 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,216 +0,0 @@
13.4 -/*
13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 - *
13.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
13.8 - *
13.9 - * The contents of this file are subject to the terms of either the GNU
13.10 - * General Public License Version 2 only ("GPL") or the Common
13.11 - * Development and Distribution License("CDDL") (collectively, the
13.12 - * "License"). You may not use this file except in compliance with the
13.13 - * License. You can obtain a copy of the License at
13.14 - * http://www.netbeans.org/cddl-gplv2.html
13.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.16 - * specific language governing permissions and limitations under the
13.17 - * License. When distributing the software, include this License Header
13.18 - * Notice in each file and include the License file at
13.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.20 - * particular file as subject to the "Classpath" exception as provided
13.21 - * by Sun in the GPL Version 2 section of the License file that
13.22 - * accompanied this code. If applicable, add the following below the
13.23 - * License Header, with the fields enclosed by brackets [] replaced by
13.24 - * your own identifying information:
13.25 - * "Portions Copyrighted [year] [name of copyright owner]"
13.26 - *
13.27 - * If you wish your version of this file to be governed by only the CDDL
13.28 - * or only the GPL Version 2, indicate your decision by adding
13.29 - * "[Contributor] elects to include this software in this distribution
13.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.31 - * single choice of license, a recipient has the option to distribute
13.32 - * your version of this file under either the CDDL, the GPL Version 2 or
13.33 - * to extend the choice of license to its licensees as provided above.
13.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
13.35 - * Version 2 license, then the option applies only if the new code is
13.36 - * made subject to such option by the copyright holder.
13.37 - *
13.38 - * Contributor(s):
13.39 - *
13.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
13.41 - */
13.42 -
13.43 -/*
13.44 - * NewJPanel.java
13.45 - *
13.46 - * Created on Mar 20, 2009, 1:14:43 AM
13.47 - */
13.48 -
13.49 -package org.netbeans.modules.licensechanger;
13.50 -
13.51 -import java.beans.PropertyChangeEvent;
13.52 -import java.beans.PropertyChangeListener;
13.53 -import java.util.HashSet;
13.54 -import java.util.List;
13.55 -import java.util.Map;
13.56 -import java.util.Set;
13.57 -import org.netbeans.modules.licensechanger.api.Customizable;
13.58 -import org.netbeans.modules.licensechanger.api.FileHandler;
13.59 -import org.openide.explorer.ExplorerManager;
13.60 -import org.openide.nodes.AbstractNode;
13.61 -import org.openide.nodes.ChildFactory;
13.62 -import org.openide.nodes.Children;
13.63 -import org.openide.nodes.Node;
13.64 -import org.openide.util.Lookup;
13.65 -import org.openide.util.lookup.Lookups;
13.66 -
13.67 -/**
13.68 - *
13.69 - * @author Tim Boudreau
13.70 - */
13.71 -public class ChooseFileTypesPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
13.72 - private final ExplorerManager mgr = new ExplorerManager();
13.73 -
13.74 - public static final String KEY_FILE_HANDLERS = "fileHandlers";
13.75 - private Map<Object, Object> settings;
13.76 - public ChooseFileTypesPanel(Map<Object, Object> settings) {
13.77 - initComponents();
13.78 - mgr.setRootContext(new AbstractNode (Children.create(new FileHandlerChildren(), false)));
13.79 - settings.put(KEY_FILE_HANDLERS, Lookup.getDefault().lookupAll(FileHandler.class));
13.80 - this.settings = settings;
13.81 - ((CheckboxListView) jScrollPane1).setNodeCheckObserver(this);
13.82 - ((CheckboxListView) jScrollPane1).setListEnabled(true);
13.83 - ((CheckboxListView) jScrollPane1).setCheckboxesEnabled(true);
13.84 - ((CheckboxListView) jScrollPane1).setCheckboxesVisible(true);
13.85 - mgr.addPropertyChangeListener(this);
13.86 - }
13.87 -
13.88 - private void updateMap() {
13.89 - Set<FileHandler> handlers = new HashSet<FileHandler>();
13.90 - for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
13.91 - if (Boolean.TRUE.equals(n.getValue(CheckboxListView.SELECTED))) {
13.92 - handlers.addAll (n.getLookup().lookupAll(FileHandler.class));
13.93 - }
13.94 - }
13.95 - settings.put(KEY_FILE_HANDLERS, handlers);
13.96 - }
13.97 -
13.98 - /** This method is called from within the constructor to
13.99 - * initialize the form.
13.100 - * WARNING: Do NOT modify this code. The content of this method is
13.101 - * always regenerated by the Form Editor.
13.102 - */
13.103 - @SuppressWarnings("unchecked")
13.104 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
13.105 - private void initComponents() {
13.106 -
13.107 - jLabel1 = new javax.swing.JLabel();
13.108 - jScrollPane1 = new CheckboxListView();
13.109 - lineEndingsPanel1 = new org.netbeans.modules.licensechanger.LineEndingsPanel();
13.110 - customizerPanel = new javax.swing.JPanel();
13.111 - noCustomizerLabel = new javax.swing.JLabel();
13.112 -
13.113 - jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
13.114 - jLabel1.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.jLabel1.text")); // NOI18N
13.115 - jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
13.116 -
13.117 - jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
13.118 -
13.119 - customizerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title"))); // NOI18N
13.120 - customizerPanel.setLayout(new java.awt.BorderLayout());
13.121 -
13.122 - noCustomizerLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
13.123 - noCustomizerLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
13.124 - noCustomizerLabel.setEnabled(false);
13.125 - customizerPanel.add(noCustomizerLabel, java.awt.BorderLayout.CENTER);
13.126 -
13.127 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
13.128 - this.setLayout(layout);
13.129 - layout.setHorizontalGroup(
13.130 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
13.131 - .add(layout.createSequentialGroup()
13.132 - .addContainerGap()
13.133 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
13.134 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 804, Short.MAX_VALUE)
13.135 - .add(jLabel1)
13.136 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
13.137 - .add(customizerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
13.138 - .add(18, 18, 18)
13.139 - .add(lineEndingsPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 227, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
13.140 - .addContainerGap())
13.141 - );
13.142 - layout.setVerticalGroup(
13.143 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
13.144 - .add(layout.createSequentialGroup()
13.145 - .addContainerGap()
13.146 - .add(jLabel1)
13.147 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
13.148 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
13.149 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
13.150 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
13.151 - .add(customizerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
13.152 - .add(lineEndingsPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE))
13.153 - .addContainerGap())
13.154 - );
13.155 - }// </editor-fold>//GEN-END:initComponents
13.156 -
13.157 -
13.158 - // Variables declaration - do not modify//GEN-BEGIN:variables
13.159 - private javax.swing.JPanel customizerPanel;
13.160 - private javax.swing.JLabel jLabel1;
13.161 - private javax.swing.JScrollPane jScrollPane1;
13.162 - private org.netbeans.modules.licensechanger.LineEndingsPanel lineEndingsPanel1;
13.163 - private javax.swing.JLabel noCustomizerLabel;
13.164 - // End of variables declaration//GEN-END:variables
13.165 -
13.166 - public ExplorerManager getExplorerManager() {
13.167 - return mgr;
13.168 - }
13.169 -
13.170 - public Set<FileHandler> getFileHandlers() {
13.171 - Set <FileHandler> result = new HashSet<FileHandler>();
13.172 - for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
13.173 - if (Boolean.TRUE.equals(n.getValue(CheckboxListView.SELECTED))) {
13.174 - result.addAll (n.getLookup().lookupAll(FileHandler.class));
13.175 - }
13.176 - }
13.177 - return result;
13.178 - }
13.179 -
13.180 - public void propertyChange(PropertyChangeEvent evt) {
13.181 - if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
13.182 - Node[] n = mgr.getSelectedNodes();
13.183 - updateCustomizer (n.length == 1 ? n[0].getLookup().lookup(Customizable.class) : null);
13.184 - }
13.185 - }
13.186 -
13.187 - public void onNodeChecked(Node node) {
13.188 - updateMap();
13.189 - }
13.190 -
13.191 - public void onNodeUnchecked(Node node) {
13.192 - updateMap();
13.193 - }
13.194 -
13.195 - private static final class FileHandlerChildren extends ChildFactory<FileHandler> {
13.196 - @Override
13.197 - protected boolean createKeys(List<FileHandler> toPopulate) {
13.198 - toPopulate.addAll (Lookup.getDefault().lookupAll(FileHandler.class));
13.199 - return true;
13.200 - }
13.201 -
13.202 - @Override
13.203 - protected Node createNodeForKey(FileHandler key) {
13.204 - AbstractNode result = new AbstractNode (Children.LEAF, Lookups.singleton(key));
13.205 - result.setDisplayName(key.getDisplayName());
13.206 - result.setValue (CheckboxListView.SELECTED, Boolean.TRUE);
13.207 - return result;
13.208 - }
13.209 - }
13.210 -
13.211 - private void updateCustomizer(Customizable c) {
13.212 - customizerPanel.removeAll();
13.213 - customizerPanel.add (c == null ? noCustomizerLabel : c.getCustomizer());
13.214 - invalidate();
13.215 - revalidate();
13.216 - repaint();
13.217 - }
13.218 -
13.219 -}
14.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/FileChildren.java Thu Aug 30 10:56:16 2012 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,157 +0,0 @@
14.4 -/*
14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.6 - *
14.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
14.8 - *
14.9 - * The contents of this file are subject to the terms of either the GNU
14.10 - * General Public License Version 2 only ("GPL") or the Common
14.11 - * Development and Distribution License("CDDL") (collectively, the
14.12 - * "License"). You may not use this file except in compliance with the
14.13 - * License. You can obtain a copy of the License at
14.14 - * http://www.netbeans.org/cddl-gplv2.html
14.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.16 - * specific language governing permissions and limitations under the
14.17 - * License. When distributing the software, include this License Header
14.18 - * Notice in each file and include the License file at
14.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
14.20 - * particular file as subject to the "Classpath" exception as provided
14.21 - * by Sun in the GPL Version 2 section of the License file that
14.22 - * accompanied this code. If applicable, add the following below the
14.23 - * License Header, with the fields enclosed by brackets [] replaced by
14.24 - * your own identifying information:
14.25 - * "Portions Copyrighted [year] [name of copyright owner]"
14.26 - *
14.27 - * If you wish your version of this file to be governed by only the CDDL
14.28 - * or only the GPL Version 2, indicate your decision by adding
14.29 - * "[Contributor] elects to include this software in this distribution
14.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.31 - * single choice of license, a recipient has the option to distribute
14.32 - * your version of this file under either the CDDL, the GPL Version 2 or
14.33 - * to extend the choice of license to its licensees as provided above.
14.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
14.35 - * Version 2 license, then the option applies only if the new code is
14.36 - * made subject to such option by the copyright holder.
14.37 - *
14.38 - * Contributor(s):
14.39 - *
14.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
14.41 - */
14.42 -package org.netbeans.modules.licensechanger;
14.43 -
14.44 -import java.util.Collection;
14.45 -import java.util.Collections;
14.46 -import java.util.HashSet;
14.47 -import java.util.LinkedList;
14.48 -import java.util.List;
14.49 -import java.util.Map;
14.50 -import java.util.Set;
14.51 -import javax.swing.Action;
14.52 -import org.netbeans.modules.licensechanger.api.FileHandler;
14.53 -import org.openide.filesystems.FileObject;
14.54 -import org.openide.loaders.DataObject;
14.55 -import org.openide.loaders.DataObjectNotFoundException;
14.56 -import org.openide.nodes.ChildFactory;
14.57 -import org.openide.nodes.FilterNode;
14.58 -import org.openide.nodes.Node;
14.59 -import org.openide.util.Exceptions;
14.60 -import org.openide.util.Lookup;
14.61 -import org.openide.util.lookup.Lookups;
14.62 -import org.openide.util.lookup.ProxyLookup;
14.63 -
14.64 -/**
14.65 - *
14.66 - * @author Tim Boudreau
14.67 - */
14.68 -public class FileChildren extends ChildFactory.Detachable<FileObject> {
14.69 -
14.70 - private final Set<FileObject> folders;
14.71 - private final Collection<? extends FileHandler> allHandlers;
14.72 - private final Map<Object, Object> settings;
14.73 - private final Set<FileItem> items = Collections.synchronizedSet(new HashSet<FileItem>());
14.74 -
14.75 - FileChildren(Set<FileObject> folders, Map<Object, Object> settings) {
14.76 - assert folders != null;
14.77 - assert settings != null;
14.78 - this.settings = settings;
14.79 - this.folders = new HashSet<FileObject>(folders);
14.80 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
14.81 - settings.put(PreviewPanel.KEY_ITEMS, items);
14.82 - }
14.83 -
14.84 - @Override
14.85 - protected boolean createKeys(List<FileObject> toPopulate) {
14.86 - toPopulate.addAll(folders);
14.87 - return true;
14.88 - }
14.89 -
14.90 - @Override
14.91 - protected Node[] createNodesForKey(FileObject key) {
14.92 - List<Node> result = new LinkedList<Node>();
14.93 - for (FileObject fo : key.getChildren()) {
14.94 - if (fo.isData()) {
14.95 - for (FileHandler h : allHandlers) {
14.96 - if (h.match(fo)) {
14.97 - try {
14.98 - DataObject dob = DataObject.find(fo);
14.99 - FileItem item = new FileItem(h, fo);
14.100 - items.add(item);
14.101 - FN fn = new FN (dob.getNodeDelegate(), item);
14.102 - boolean shouldChange = !h.shouldSkipFile(fo);
14.103 - result.add(fn);
14.104 - fn.setValue (CheckboxListView.SELECTED, shouldChange);
14.105 - break;
14.106 - } catch (DataObjectNotFoundException ex) {
14.107 - Exceptions.printStackTrace(ex);
14.108 - }
14.109 - }
14.110 - }
14.111 - }
14.112 - }
14.113 - return result.toArray(new Node[result.size()]);
14.114 - }
14.115 -
14.116 - static final class FileItem {
14.117 -
14.118 - FileHandler handler;
14.119 - FileObject file;
14.120 -
14.121 - public FileItem(FileHandler handler, FileObject file) {
14.122 - this.handler = handler;
14.123 - this.file = file;
14.124 - }
14.125 -
14.126 - public FileObject getFile() {
14.127 - return file;
14.128 - }
14.129 -
14.130 - public FileHandler getHandler() {
14.131 - return handler;
14.132 - }
14.133 - }
14.134 -
14.135 - private static final class FN extends FilterNode {
14.136 -
14.137 - FN(Node orig, FileItem item) {
14.138 - super(orig, Children.LEAF, new ProxyLookup(
14.139 - Lookups.singleton(item),
14.140 - orig.getLookup()));
14.141 - disableDelegation(DELEGATE_GET_ACTIONS);
14.142 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
14.143 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
14.144 - disableDelegation(DELEGATE_GET_DISPLAY_NAME);
14.145 - disableDelegation(DELEGATE_GET_VALUE);
14.146 - disableDelegation(DELEGATE_SET_VALUE);
14.147 - disableDelegation(DELEGATE_SET_NAME);
14.148 - disableDelegation(DELEGATE_GET_NAME);
14.149 - setValue(CheckboxListView.SELECTED, Boolean.TRUE);
14.150 - setName(item.file.getPath());
14.151 - setDisplayName(item.file.getPath());
14.152 - setShortDescription(item.file.getPath());
14.153 - }
14.154 -
14.155 - @Override
14.156 - public Action[] getActions(boolean ignored) {
14.157 - return new Action[0];
14.158 - }
14.159 - }
14.160 -}
15.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/FolderChildren.java Thu Aug 30 10:56:16 2012 +0200
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,175 +0,0 @@
15.4 -/*
15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 - *
15.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
15.8 - *
15.9 - * The contents of this file are subject to the terms of either the GNU
15.10 - * General Public License Version 2 only ("GPL") or the Common
15.11 - * Development and Distribution License("CDDL") (collectively, the
15.12 - * "License"). You may not use this file except in compliance with the
15.13 - * License. You can obtain a copy of the License at
15.14 - * http://www.netbeans.org/cddl-gplv2.html
15.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.16 - * specific language governing permissions and limitations under the
15.17 - * License. When distributing the software, include this License Header
15.18 - * Notice in each file and include the License file at
15.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
15.20 - * particular file as subject to the "Classpath" exception as provided
15.21 - * by Sun in the GPL Version 2 section of the License file that
15.22 - * accompanied this code. If applicable, add the following below the
15.23 - * License Header, with the fields enclosed by brackets [] replaced by
15.24 - * your own identifying information:
15.25 - * "Portions Copyrighted [year] [name of copyright owner]"
15.26 - *
15.27 - * If you wish your version of this file to be governed by only the CDDL
15.28 - * or only the GPL Version 2, indicate your decision by adding
15.29 - * "[Contributor] elects to include this software in this distribution
15.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
15.31 - * single choice of license, a recipient has the option to distribute
15.32 - * your version of this file under either the CDDL, the GPL Version 2 or
15.33 - * to extend the choice of license to its licensees as provided above.
15.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
15.35 - * Version 2 license, then the option applies only if the new code is
15.36 - * made subject to such option by the copyright holder.
15.37 - *
15.38 - * Contributor(s):
15.39 - *
15.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
15.41 - */
15.42 -
15.43 -package org.netbeans.modules.licensechanger;
15.44 -
15.45 -import java.awt.EventQueue;
15.46 -import java.util.List;
15.47 -import javax.swing.Action;
15.48 -import org.openide.filesystems.FileObject;
15.49 -import org.openide.filesystems.FileUtil;
15.50 -import org.openide.loaders.DataObject;
15.51 -import org.openide.loaders.DataObjectNotFoundException;
15.52 -import org.openide.nodes.AbstractNode;
15.53 -import org.openide.nodes.ChildFactory;
15.54 -import org.openide.nodes.Children;
15.55 -import org.openide.nodes.FilterNode;
15.56 -import org.openide.nodes.Node;
15.57 -import org.openide.util.Exceptions;
15.58 -import org.openide.util.NbBundle;
15.59 -import org.openide.util.NbCollections;
15.60 -import org.openide.util.lookup.Lookups;
15.61 -import org.openide.util.lookup.ProxyLookup;
15.62 -
15.63 -/**
15.64 - *
15.65 - * @author Tim Boudreau
15.66 - */
15.67 -abstract class FolderChildren extends ChildFactory.Detachable<FileObject> implements Runnable {
15.68 - private FileObject[] roots;
15.69 - volatile int keyCount = 0;
15.70 - private int nodeCount = 0;
15.71 - private volatile boolean cancelled = false;
15.72 -
15.73 - FolderChildren (FileObject[] roots) {
15.74 - this.roots = roots;
15.75 - }
15.76 -
15.77 - @Override
15.78 - protected Node createWaitNode() {
15.79 - AbstractNode result = new AbstractNode(Children.LEAF);
15.80 - result.setDisplayName(NbBundle.getMessage(FolderChildren.class, "MSG_WAIT_FOLDERS"));
15.81 - return result;
15.82 - }
15.83 -
15.84 - @Override
15.85 - public void addNotify() {
15.86 - cancelled = false;
15.87 - super.addNotify();
15.88 - keyCount = 0;
15.89 - nodeCount = 0;
15.90 - }
15.91 -
15.92 - @Override
15.93 - protected void removeNotify() {
15.94 - super.removeNotify();
15.95 - cancelled = true;
15.96 - }
15.97 -
15.98 - private boolean shouldSkipFolder (FileObject folder) {
15.99 - // XXX use VisibilityQuery instead
15.100 - String path = folder.getPath();
15.101 - return path.contains(".svn") || path.contains(".cvs") || path.contains(".hg") ||
15.102 - path.endsWith(".svn") || path.endsWith(".cvs") || path.endsWith(".hg");
15.103 - }
15.104 -
15.105 - @Override
15.106 - protected boolean createKeys(List<FileObject> toPopulate) {
15.107 - for (FileObject f : roots) {
15.108 - toPopulate.add(f);
15.109 - keyCount++;
15.110 - for (FileObject fo : NbCollections.iterable(f.getChildren(true))) {
15.111 - if (fo.isFolder()) {
15.112 - if (shouldSkipFolder(fo)) {
15.113 - continue;
15.114 - }
15.115 - toPopulate.add(fo);
15.116 - keyCount++;
15.117 - }
15.118 - if (cancelled) {
15.119 - return true;
15.120 - }
15.121 - }
15.122 - if (cancelled) {
15.123 - return true;
15.124 - }
15.125 - }
15.126 - return true;
15.127 - }
15.128 -
15.129 - @Override
15.130 - protected Node createNodeForKey(FileObject f) {
15.131 - try {
15.132 - Node n = DataObject.find(f).getNodeDelegate();
15.133 - nodeCount++;
15.134 - if (nodeCount == keyCount) {
15.135 - EventQueue.invokeLater(this);
15.136 - }
15.137 - return new FN(n, f);
15.138 - } catch (DataObjectNotFoundException ex) {
15.139 - Exceptions.printStackTrace(ex);
15.140 - return null;
15.141 - }
15.142 - }
15.143 -
15.144 - public abstract void onAllNodesCreated();
15.145 -
15.146 - public void run() {
15.147 - onAllNodesCreated();
15.148 - }
15.149 -
15.150 - private static final class FN extends FilterNode {
15.151 - FN(Node orig, FileObject f) {
15.152 - super (orig, Children.LEAF, new ProxyLookup(
15.153 - Lookups.singleton(f),
15.154 - orig.getLookup()));
15.155 - disableDelegation(DELEGATE_GET_ACTIONS);
15.156 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
15.157 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
15.158 - disableDelegation(DELEGATE_GET_DISPLAY_NAME);
15.159 - disableDelegation(DELEGATE_GET_VALUE);
15.160 - disableDelegation(DELEGATE_SET_VALUE);
15.161 - disableDelegation(DELEGATE_SET_NAME);
15.162 - disableDelegation(DELEGATE_GET_NAME);
15.163 - String p = f.getPath();
15.164 - // XXX this is a pretty arbitrary list... maybe check SharabilityQuery?
15.165 - if (!p.endsWith("nbproject") &&
15.166 - !p.endsWith("nbproject/private")) { //NOI18N
15.167 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
15.168 - }
15.169 - setName(p);
15.170 - setDisplayName(FileUtil.getFileDisplayName(f));
15.171 - }
15.172 -
15.173 - @Override
15.174 - public Action[] getActions(boolean ignored) {
15.175 - return new Action[0];
15.176 - }
15.177 - }
15.178 -}
16.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/LicenseChooserPanel.form Thu Aug 30 10:56:16 2012 +0200
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,101 +0,0 @@
16.4 -<?xml version="1.0" encoding="UTF-8" ?>
16.5 -
16.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
16.7 - <AuxValues>
16.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
16.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
16.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
16.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
16.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
16.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
16.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
16.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
16.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
16.17 - </AuxValues>
16.18 -
16.19 - <Layout>
16.20 - <DimensionLayout dim="0">
16.21 - <Group type="103" groupAlignment="0" attributes="0">
16.22 - <Group type="102" attributes="0">
16.23 - <EmptySpace max="-2" attributes="0"/>
16.24 - <Group type="103" groupAlignment="0" attributes="0">
16.25 - <Component id="jScrollPane1" alignment="0" pref="380" max="32767" attributes="0"/>
16.26 - <Group type="102" alignment="0" attributes="0">
16.27 - <Component id="chooseLabel" min="-2" max="-2" attributes="0"/>
16.28 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
16.29 - <Component id="selectLicense" pref="296" max="32767" attributes="0"/>
16.30 - </Group>
16.31 - <Component id="browseButton" alignment="1" min="-2" max="-2" attributes="0"/>
16.32 - </Group>
16.33 - <EmptySpace max="-2" attributes="0"/>
16.34 - </Group>
16.35 - </Group>
16.36 - </DimensionLayout>
16.37 - <DimensionLayout dim="1">
16.38 - <Group type="103" groupAlignment="0" attributes="0">
16.39 - <Group type="102" alignment="0" attributes="0">
16.40 - <EmptySpace max="-2" attributes="0"/>
16.41 - <Group type="103" groupAlignment="3" attributes="0">
16.42 - <Component id="chooseLabel" alignment="3" min="-2" max="-2" attributes="0"/>
16.43 - <Component id="selectLicense" alignment="3" min="-2" max="-2" attributes="0"/>
16.44 - </Group>
16.45 - <EmptySpace type="separate" max="-2" attributes="0"/>
16.46 - <Component id="jScrollPane1" min="-2" pref="188" max="-2" attributes="0"/>
16.47 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
16.48 - <Component id="browseButton" min="-2" max="-2" attributes="0"/>
16.49 - <EmptySpace max="32767" attributes="0"/>
16.50 - </Group>
16.51 - </Group>
16.52 - </DimensionLayout>
16.53 - </Layout>
16.54 - <SubComponents>
16.55 - <Component class="javax.swing.JLabel" name="chooseLabel">
16.56 - <Properties>
16.57 - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
16.58 - <ComponentRef name="selectLicense"/>
16.59 - </Property>
16.60 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
16.61 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LicenseChooserPanel.chooseLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
16.62 - </Property>
16.63 - </Properties>
16.64 - </Component>
16.65 - <Component class="javax.swing.JComboBox" name="selectLicense">
16.66 - <Properties>
16.67 - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
16.68 - <StringArray count="1">
16.69 - <StringItem index="0" value="[loading licenses]"/>
16.70 - </StringArray>
16.71 - </Property>
16.72 - </Properties>
16.73 - <Events>
16.74 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="licenseSelected"/>
16.75 - </Events>
16.76 - </Component>
16.77 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
16.78 - <AuxValues>
16.79 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
16.80 - </AuxValues>
16.81 -
16.82 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
16.83 - <SubComponents>
16.84 - <Component class="javax.swing.JTextArea" name="licenseText">
16.85 - <Properties>
16.86 - <Property name="columns" type="int" value="20"/>
16.87 - <Property name="rows" type="int" value="5"/>
16.88 - <Property name="name" type="java.lang.String" value="licenseText" noResource="true"/>
16.89 - </Properties>
16.90 - </Component>
16.91 - </SubComponents>
16.92 - </Container>
16.93 - <Component class="javax.swing.JButton" name="browseButton">
16.94 - <Properties>
16.95 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
16.96 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LicenseChooserPanel.browseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
16.97 - </Property>
16.98 - </Properties>
16.99 - <Events>
16.100 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseForLicense"/>
16.101 - </Events>
16.102 - </Component>
16.103 - </SubComponents>
16.104 -</Form>
17.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/LicenseChooserPanel.java Thu Aug 30 10:56:16 2012 +0200
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,340 +0,0 @@
17.4 -/*
17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 - *
17.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
17.8 - *
17.9 - * The contents of this file are subject to the terms of either the GNU
17.10 - * General Public License Version 2 only ("GPL") or the Common
17.11 - * Development and Distribution License("CDDL") (collectively, the
17.12 - * "License"). You may not use this file except in compliance with the
17.13 - * License. You can obtain a copy of the License at
17.14 - * http://www.netbeans.org/cddl-gplv2.html
17.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.16 - * specific language governing permissions and limitations under the
17.17 - * License. When distributing the software, include this License Header
17.18 - * Notice in each file and include the License file at
17.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17.20 - * particular file as subject to the "Classpath" exception as provided
17.21 - * by Sun in the GPL Version 2 section of the License file that
17.22 - * accompanied this code. If applicable, add the following below the
17.23 - * License Header, with the fields enclosed by brackets [] replaced by
17.24 - * your own identifying information:
17.25 - * "Portions Copyrighted [year] [name of copyright owner]"
17.26 - *
17.27 - * If you wish your version of this file to be governed by only the CDDL
17.28 - * or only the GPL Version 2, indicate your decision by adding
17.29 - * "[Contributor] elects to include this software in this distribution
17.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
17.31 - * single choice of license, a recipient has the option to distribute
17.32 - * your version of this file under either the CDDL, the GPL Version 2 or
17.33 - * to extend the choice of license to its licensees as provided above.
17.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
17.35 - * Version 2 license, then the option applies only if the new code is
17.36 - * made subject to such option by the copyright holder.
17.37 - *
17.38 - * Contributor(s):
17.39 - *
17.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
17.41 - */
17.42 -package org.netbeans.modules.licensechanger;
17.43 -
17.44 -import java.awt.Component;
17.45 -import java.awt.EventQueue;
17.46 -import java.io.BufferedInputStream;
17.47 -import java.io.ByteArrayOutputStream;
17.48 -import java.io.File;
17.49 -import java.io.FileInputStream;
17.50 -import java.io.IOException;
17.51 -import java.io.InputStream;
17.52 -import java.util.Map;
17.53 -import java.util.StringTokenizer;
17.54 -import javax.swing.DefaultComboBoxModel;
17.55 -import javax.swing.event.DocumentEvent;
17.56 -import javax.swing.event.DocumentListener;
17.57 -import org.openide.filesystems.FileChooserBuilder;
17.58 -import org.openide.filesystems.FileUtil;
17.59 -import org.openide.util.Exceptions;
17.60 -import org.openide.util.NbBundle;
17.61 -import org.openide.util.RequestProcessor;
17.62 -
17.63 -/**
17.64 - *
17.65 - * @author Tim Boudreau
17.66 - */
17.67 -public class LicenseChooserPanel extends javax.swing.JPanel implements Runnable, DocumentListener {
17.68 -
17.69 - private volatile boolean licensesLoaded;
17.70 - private volatile boolean loadingLicenses;
17.71 - private boolean inLoadFromFile;
17.72 - public static final String KEY_LICENSE_TEXT = "licenseText";
17.73 - private Map<Object, Object> settings;
17.74 - /** Creates new form LicenseChooser */
17.75 - public LicenseChooserPanel(Map<Object,Object> settings) {
17.76 - this.settings = settings;
17.77 - initComponents();
17.78 - enabled(false);
17.79 - settings.put (KEY_LICENSE_TEXT, "No License");
17.80 - licenseText.getDocument().addDocumentListener(this);
17.81 - }
17.82 -
17.83 - /** This method is called from within the constructor to
17.84 - * initialize the form.
17.85 - * WARNING: Do NOT modify this code. The content of this method is
17.86 - * always regenerated by the Form Editor.
17.87 - */
17.88 - @SuppressWarnings("unchecked")
17.89 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
17.90 - private void initComponents() {
17.91 -
17.92 - chooseLabel = new javax.swing.JLabel();
17.93 - selectLicense = new javax.swing.JComboBox();
17.94 - jScrollPane1 = new javax.swing.JScrollPane();
17.95 - licenseText = new javax.swing.JTextArea();
17.96 - browseButton = new javax.swing.JButton();
17.97 -
17.98 - chooseLabel.setLabelFor(selectLicense);
17.99 - chooseLabel.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.chooseLabel.text")); // NOI18N
17.100 -
17.101 - selectLicense.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "[loading licenses]" }));
17.102 - selectLicense.addActionListener(new java.awt.event.ActionListener() {
17.103 - public void actionPerformed(java.awt.event.ActionEvent evt) {
17.104 - licenseSelected(evt);
17.105 - }
17.106 - });
17.107 -
17.108 - licenseText.setColumns(20);
17.109 - licenseText.setRows(5);
17.110 - licenseText.setName("licenseText"); // NOI18N
17.111 - jScrollPane1.setViewportView(licenseText);
17.112 -
17.113 - browseButton.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.browseButton.text")); // NOI18N
17.114 - browseButton.addActionListener(new java.awt.event.ActionListener() {
17.115 - public void actionPerformed(java.awt.event.ActionEvent evt) {
17.116 - browseForLicense(evt);
17.117 - }
17.118 - });
17.119 -
17.120 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
17.121 - this.setLayout(layout);
17.122 - layout.setHorizontalGroup(
17.123 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
17.124 - .add(layout.createSequentialGroup()
17.125 - .addContainerGap()
17.126 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
17.127 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
17.128 - .add(layout.createSequentialGroup()
17.129 - .add(chooseLabel)
17.130 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
17.131 - .add(selectLicense, 0, 296, Short.MAX_VALUE))
17.132 - .add(org.jdesktop.layout.GroupLayout.TRAILING, browseButton))
17.133 - .addContainerGap())
17.134 - );
17.135 - layout.setVerticalGroup(
17.136 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
17.137 - .add(layout.createSequentialGroup()
17.138 - .addContainerGap()
17.139 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
17.140 - .add(chooseLabel)
17.141 - .add(selectLicense, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
17.142 - .add(18, 18, 18)
17.143 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 188, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
17.144 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
17.145 - .add(browseButton)
17.146 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
17.147 - );
17.148 - }// </editor-fold>//GEN-END:initComponents
17.149 -
17.150 - private void licenseSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_licenseSelected
17.151 - if (loadingLicenses || inLoadFromFile || !selectLicense.isEnabled()) {
17.152 - return;
17.153 - }
17.154 - loadLicenseFromResource (selectLicense.getSelectedItem().toString());
17.155 - }//GEN-LAST:event_licenseSelected
17.156 -
17.157 - private void browseForLicense(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseForLicense
17.158 - File f;
17.159 - if ((f = new FileChooserBuilder(LicenseChooserPanel.class).setTitle(
17.160 - NbBundle.getMessage(LicenseChooserPanel.class, "BROWSE_LICENSE_TITLE")) //NOI18N
17.161 - .setFilesOnly(true).showOpenDialog()) != null) {
17.162 - loadLicenseFromFile(f);
17.163 - }
17.164 - }//GEN-LAST:event_browseForLicense
17.165 -
17.166 - @Override
17.167 - public void addNotify() {
17.168 - super.addNotify();
17.169 - if (!licensesLoaded && !loadingLicenses) {
17.170 - loadingLicenses = true;
17.171 - enabled(false);
17.172 - RequestProcessor.getDefault().post(this);
17.173 - }
17.174 - }
17.175 - // Variables declaration - do not modify//GEN-BEGIN:variables
17.176 - private javax.swing.JButton browseButton;
17.177 - private javax.swing.JLabel chooseLabel;
17.178 - private javax.swing.JScrollPane jScrollPane1;
17.179 - private javax.swing.JTextArea licenseText;
17.180 - private javax.swing.JComboBox selectLicense;
17.181 - // End of variables declaration//GEN-END:variables
17.182 -
17.183 - private void enabled(boolean val) {
17.184 - for (Component c : getComponents()) {
17.185 - c.setEnabled(val);
17.186 - }
17.187 - }
17.188 -
17.189 - private void initLicenses() throws IOException {
17.190 - assert !EventQueue.isDispatchThread();
17.191 - final DefaultComboBoxModel mdl = new DefaultComboBoxModel();
17.192 - InputStream in = new BufferedInputStream(LicenseChooserPanel.class.getResourceAsStream("licenses.txt"));
17.193 - ByteArrayOutputStream out = new ByteArrayOutputStream();
17.194 - try {
17.195 - FileUtil.copy(in, out);
17.196 - String s = new String(out.toByteArray());
17.197 - StringTokenizer tok = new StringTokenizer(s);
17.198 - while (tok.hasMoreTokens()) {
17.199 - String curr = tok.nextToken();
17.200 - int ix = curr.lastIndexOf("/");
17.201 - if (ix >= 0 && ix < curr.length() - 1) {
17.202 - curr = curr.substring(ix + 1);
17.203 - }
17.204 - mdl.addElement(curr);
17.205 - }
17.206 - } catch (IOException ioe) {
17.207 - Exceptions.printStackTrace(ioe);
17.208 - } finally {
17.209 - in.close();
17.210 - out.close();
17.211 - EventQueue.invokeLater(new Runnable() {
17.212 - public void run() {
17.213 - mdl.setSelectedItem (NbBundle.getMessage(LicenseChooserPanel.class,
17.214 - "MSG_SELECT_A_LICENSE")); //NOI18N
17.215 - selectLicense.setModel(mdl);
17.216 - enabled(true);
17.217 - licensesLoaded = true;
17.218 - loadingLicenses = false;
17.219 - }
17.220 - });
17.221 - }
17.222 - }
17.223 -
17.224 - public void run() {
17.225 - try {
17.226 - initLicenses();
17.227 - } catch (IOException ex) {
17.228 - Exceptions.printStackTrace(ex);
17.229 - }
17.230 - }
17.231 -
17.232 - private void loadLicenseFromFile(File f) {
17.233 - inLoadFromFile = true;
17.234 - enabled(false);
17.235 - RequestProcessor.getDefault().post(new FileLoader(f));
17.236 - }
17.237 -
17.238 - private void loadLicenseFromResource(String name) {
17.239 - inLoadFromFile = true;
17.240 - enabled(false);
17.241 - RequestProcessor.getDefault().post(new ResourceLoader(name));
17.242 - }
17.243 -
17.244 - public String getLicenseText() {
17.245 - return licenseText.getText();
17.246 - }
17.247 -
17.248 - private void updateLicense() {
17.249 - String txt = licenseText.getText();
17.250 - if (!txt.endsWith("\n")) {
17.251 - txt += "\n";
17.252 - }
17.253 - settings.put(KEY_LICENSE_TEXT, txt);
17.254 - }
17.255 -
17.256 - public void insertUpdate(DocumentEvent e) {
17.257 - updateLicense();
17.258 - }
17.259 -
17.260 - public void removeUpdate(DocumentEvent e) {
17.261 - updateLicense();
17.262 - }
17.263 -
17.264 - public void changedUpdate(DocumentEvent e) {
17.265 - updateLicense();
17.266 - }
17.267 -
17.268 - private class FileLoader implements Runnable {
17.269 -
17.270 - private final File file;
17.271 - private String text;
17.272 -
17.273 - FileLoader(File f) {
17.274 - this.file = f;
17.275 - }
17.276 -
17.277 - public void run() {
17.278 - if (!EventQueue.isDispatchThread()) {
17.279 - try {
17.280 - InputStream in = new BufferedInputStream(new FileInputStream(file));
17.281 - ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.length());
17.282 - try {
17.283 - FileUtil.copy(in, out);
17.284 - } finally {
17.285 - in.close();
17.286 - out.close();
17.287 - }
17.288 - text = new String(out.toByteArray());
17.289 - } catch (IOException ioe) {
17.290 - ioe.printStackTrace();
17.291 - text = NbBundle.getMessage (LicenseChooserPanel.class,
17.292 - "ERR_COULD_NOT_LOAD", file.getPath()); //NOI18N
17.293 - } finally {
17.294 - EventQueue.invokeLater(this);
17.295 - }
17.296 - } else {
17.297 - selectLicense.setSelectedItem(file.getName());
17.298 - inLoadFromFile = false;
17.299 - licenseText.setText(text);
17.300 - settings.put(KEY_LICENSE_TEXT, text);
17.301 - enabled(true);
17.302 - }
17.303 - }
17.304 - }
17.305 -
17.306 - private class ResourceLoader implements Runnable {
17.307 -
17.308 - private String name;
17.309 - private String text;
17.310 -
17.311 - ResourceLoader(String name) {
17.312 - this.name = name;
17.313 - }
17.314 -
17.315 - public void run() {
17.316 - if (!EventQueue.isDispatchThread()) {
17.317 - try {
17.318 - InputStream in = new BufferedInputStream(
17.319 - LicenseChooserPanel.class.getResourceAsStream("licenses/" + name));
17.320 - ByteArrayOutputStream out = new ByteArrayOutputStream();
17.321 - try {
17.322 - FileUtil.copy (in, out);
17.323 - } finally {
17.324 - in.close();
17.325 - out.close();
17.326 - }
17.327 - text = new String (out.toByteArray());
17.328 - } catch (IOException ioe) {
17.329 - ioe.printStackTrace();
17.330 - text = NbBundle.getMessage (LicenseChooserPanel.class,
17.331 - "ERR_COULD_NOT_LOAD", name); //NOI18N
17.332 - } finally {
17.333 - EventQueue.invokeLater(this);
17.334 - }
17.335 - } else {
17.336 - inLoadFromFile = false;
17.337 - licenseText.setText(text);
17.338 - settings.put(KEY_LICENSE_TEXT, text);
17.339 - enabled(true);
17.340 - }
17.341 - }
17.342 - }
17.343 -}
18.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/LineEndingPreference.java Thu Aug 30 10:56:16 2012 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,52 +0,0 @@
18.4 -/*
18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 - *
18.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
18.8 - *
18.9 - * The contents of this file are subject to the terms of either the GNU
18.10 - * General Public License Version 2 only ("GPL") or the Common
18.11 - * Development and Distribution License("CDDL") (collectively, the
18.12 - * "License"). You may not use this file except in compliance with the
18.13 - * License. You can obtain a copy of the License at
18.14 - * http://www.netbeans.org/cddl-gplv2.html
18.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.16 - * specific language governing permissions and limitations under the
18.17 - * License. When distributing the software, include this License Header
18.18 - * Notice in each file and include the License file at
18.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18.20 - * particular file as subject to the "Classpath" exception as provided
18.21 - * by Sun in the GPL Version 2 section of the License file that
18.22 - * accompanied this code. If applicable, add the following below the
18.23 - * License Header, with the fields enclosed by brackets [] replaced by
18.24 - * your own identifying information:
18.25 - * "Portions Copyrighted [year] [name of copyright owner]"
18.26 - *
18.27 - * If you wish your version of this file to be governed by only the CDDL
18.28 - * or only the GPL Version 2, indicate your decision by adding
18.29 - * "[Contributor] elects to include this software in this distribution
18.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
18.31 - * single choice of license, a recipient has the option to distribute
18.32 - * your version of this file under either the CDDL, the GPL Version 2 or
18.33 - * to extend the choice of license to its licensees as provided above.
18.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
18.35 - * Version 2 license, then the option applies only if the new code is
18.36 - * made subject to such option by the copyright holder.
18.37 - *
18.38 - * Contributor(s):
18.39 - *
18.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
18.41 - */
18.42 -
18.43 -package org.netbeans.modules.licensechanger;
18.44 -
18.45 -/**
18.46 - * User preference for line ending conversion
18.47 - *
18.48 - * @author Tim Boudreau
18.49 - */
18.50 -public enum LineEndingPreference {
18.51 - FORCE_CRLF,
18.52 - NO_CHANGE,
18.53 - FORCE_NEWLINE,
18.54 - SYSTEM_DEFAULT;
18.55 -}
19.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/LineEndingsPanel.form Thu Aug 30 10:56:16 2012 +0200
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,114 +0,0 @@
19.4 -<?xml version="1.0" encoding="UTF-8" ?>
19.5 -
19.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
19.7 - <NonVisualComponents>
19.8 - <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
19.9 - </Component>
19.10 - </NonVisualComponents>
19.11 - <Properties>
19.12 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
19.13 - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
19.14 - <TitledBorder title="Line Endings">
19.15 - <ResourceString PropertyName="titleX" bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
19.16 - </TitledBorder>
19.17 - </Border>
19.18 - </Property>
19.19 - </Properties>
19.20 - <AuxValues>
19.21 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
19.22 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
19.23 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
19.24 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
19.25 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
19.26 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
19.27 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
19.28 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
19.29 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
19.30 - </AuxValues>
19.31 -
19.32 - <Layout>
19.33 - <DimensionLayout dim="0">
19.34 - <Group type="103" groupAlignment="0" attributes="0">
19.35 - <Group type="102" attributes="0">
19.36 - <EmptySpace max="-2" attributes="0"/>
19.37 - <Group type="103" groupAlignment="0" attributes="0">
19.38 - <Component id="noChangeButton" alignment="0" min="-2" max="-2" attributes="0"/>
19.39 - <Component id="systemDefaultButton" alignment="0" min="-2" max="-2" attributes="0"/>
19.40 - <Component id="newlineButton" alignment="0" min="-2" max="-2" attributes="0"/>
19.41 - <Component id="forceCrlf" alignment="0" min="-2" max="-2" attributes="0"/>
19.42 - </Group>
19.43 - <EmptySpace max="32767" attributes="0"/>
19.44 - </Group>
19.45 - </Group>
19.46 - </DimensionLayout>
19.47 - <DimensionLayout dim="1">
19.48 - <Group type="103" groupAlignment="0" attributes="0">
19.49 - <Group type="102" alignment="0" attributes="0">
19.50 - <Component id="noChangeButton" min="-2" max="-2" attributes="0"/>
19.51 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
19.52 - <Component id="systemDefaultButton" min="-2" max="-2" attributes="0"/>
19.53 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
19.54 - <Component id="newlineButton" min="-2" max="-2" attributes="0"/>
19.55 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
19.56 - <Component id="forceCrlf" min="-2" max="-2" attributes="0"/>
19.57 - <EmptySpace max="32767" attributes="0"/>
19.58 - </Group>
19.59 - </Group>
19.60 - </DimensionLayout>
19.61 - </Layout>
19.62 - <SubComponents>
19.63 - <Component class="javax.swing.JRadioButton" name="noChangeButton">
19.64 - <Properties>
19.65 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
19.66 - <ComponentRef name="buttonGroup1"/>
19.67 - </Property>
19.68 - <Property name="selected" type="boolean" value="true"/>
19.69 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
19.70 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LineEndingsPanel.noChangeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
19.71 - </Property>
19.72 - </Properties>
19.73 - <Events>
19.74 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
19.75 - </Events>
19.76 - </Component>
19.77 - <Component class="javax.swing.JRadioButton" name="systemDefaultButton">
19.78 - <Properties>
19.79 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
19.80 - <ComponentRef name="buttonGroup1"/>
19.81 - </Property>
19.82 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
19.83 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LineEndingsPanel.systemDefaultButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
19.84 - </Property>
19.85 - </Properties>
19.86 - <Events>
19.87 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
19.88 - </Events>
19.89 - </Component>
19.90 - <Component class="javax.swing.JRadioButton" name="newlineButton">
19.91 - <Properties>
19.92 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
19.93 - <ComponentRef name="buttonGroup1"/>
19.94 - </Property>
19.95 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
19.96 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LineEndingsPanel.newlineButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
19.97 - </Property>
19.98 - </Properties>
19.99 - <Events>
19.100 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
19.101 - </Events>
19.102 - </Component>
19.103 - <Component class="javax.swing.JRadioButton" name="forceCrlf">
19.104 - <Properties>
19.105 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
19.106 - <ComponentRef name="buttonGroup1"/>
19.107 - </Property>
19.108 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
19.109 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="LineEndingsPanel.forceCrlf.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
19.110 - </Property>
19.111 - </Properties>
19.112 - <Events>
19.113 - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lineEndingPreferenceChanged"/>
19.114 - </Events>
19.115 - </Component>
19.116 - </SubComponents>
19.117 -</Form>
20.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/LineEndingsPanel.java Thu Aug 30 10:56:16 2012 +0200
20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
20.3 @@ -1,171 +0,0 @@
20.4 -/*
20.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
20.6 - *
20.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
20.8 - *
20.9 - * The contents of this file are subject to the terms of either the GNU
20.10 - * General Public License Version 2 only ("GPL") or the Common
20.11 - * Development and Distribution License("CDDL") (collectively, the
20.12 - * "License"). You may not use this file except in compliance with the
20.13 - * License. You can obtain a copy of the License at
20.14 - * http://www.netbeans.org/cddl-gplv2.html
20.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
20.16 - * specific language governing permissions and limitations under the
20.17 - * License. When distributing the software, include this License Header
20.18 - * Notice in each file and include the License file at
20.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
20.20 - * particular file as subject to the "Classpath" exception as provided
20.21 - * by Sun in the GPL Version 2 section of the License file that
20.22 - * accompanied this code. If applicable, add the following below the
20.23 - * License Header, with the fields enclosed by brackets [] replaced by
20.24 - * your own identifying information:
20.25 - * "Portions Copyrighted [year] [name of copyright owner]"
20.26 - *
20.27 - * If you wish your version of this file to be governed by only the CDDL
20.28 - * or only the GPL Version 2, indicate your decision by adding
20.29 - * "[Contributor] elects to include this software in this distribution
20.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
20.31 - * single choice of license, a recipient has the option to distribute
20.32 - * your version of this file under either the CDDL, the GPL Version 2 or
20.33 - * to extend the choice of license to its licensees as provided above.
20.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
20.35 - * Version 2 license, then the option applies only if the new code is
20.36 - * made subject to such option by the copyright holder.
20.37 - *
20.38 - * Contributor(s):
20.39 - *
20.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
20.41 - */
20.42 -
20.43 -/*
20.44 - * LineEndingsPanel.java
20.45 - *
20.46 - * Created on Mar 20, 2009, 12:33:04 AM
20.47 - */
20.48 -
20.49 -package org.netbeans.modules.licensechanger;
20.50 -
20.51 -import javax.swing.JRadioButton;
20.52 -import org.openide.util.NbPreferences;
20.53 -
20.54 -/**
20.55 - *
20.56 - * @author Administrator
20.57 - */
20.58 -public class LineEndingsPanel extends javax.swing.JPanel {
20.59 - private static final String PROP_ENDING = "ending";
20.60 - public static final String PREFS_KEY_ENDING = "line_terminator";
20.61 -
20.62 - /** Creates new form LineEndingsPanel */
20.63 - public LineEndingsPanel() {
20.64 - initComponents();
20.65 - forceCrlf.putClientProperty(PROP_ENDING, LineEndingPreference.FORCE_CRLF);
20.66 - noChangeButton.putClientProperty(PROP_ENDING, LineEndingPreference.NO_CHANGE);
20.67 - newlineButton.putClientProperty(PROP_ENDING, LineEndingPreference.FORCE_NEWLINE);
20.68 - systemDefaultButton.putClientProperty (PROP_ENDING, LineEndingPreference.SYSTEM_DEFAULT);
20.69 - }
20.70 -
20.71 - /** This method is called from within the constructor to
20.72 - * initialize the form.
20.73 - * WARNING: Do NOT modify this code. The content of this method is
20.74 - * always regenerated by the Form Editor.
20.75 - */
20.76 - @SuppressWarnings("unchecked")
20.77 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
20.78 - private void initComponents() {
20.79 -
20.80 - buttonGroup1 = new javax.swing.ButtonGroup();
20.81 - noChangeButton = new javax.swing.JRadioButton();
20.82 - systemDefaultButton = new javax.swing.JRadioButton();
20.83 - newlineButton = new javax.swing.JRadioButton();
20.84 - forceCrlf = new javax.swing.JRadioButton();
20.85 -
20.86 - setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title"))); // NOI18N
20.87 -
20.88 - buttonGroup1.add(noChangeButton);
20.89 - noChangeButton.setSelected(true);
20.90 - noChangeButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.noChangeButton.text")); // NOI18N
20.91 - noChangeButton.addActionListener(new java.awt.event.ActionListener() {
20.92 - public void actionPerformed(java.awt.event.ActionEvent evt) {
20.93 - lineEndingPreferenceChanged(evt);
20.94 - }
20.95 - });
20.96 -
20.97 - buttonGroup1.add(systemDefaultButton);
20.98 - systemDefaultButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.systemDefaultButton.text")); // NOI18N
20.99 - systemDefaultButton.addActionListener(new java.awt.event.ActionListener() {
20.100 - public void actionPerformed(java.awt.event.ActionEvent evt) {
20.101 - lineEndingPreferenceChanged(evt);
20.102 - }
20.103 - });
20.104 -
20.105 - buttonGroup1.add(newlineButton);
20.106 - newlineButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.newlineButton.text")); // NOI18N
20.107 - newlineButton.addActionListener(new java.awt.event.ActionListener() {
20.108 - public void actionPerformed(java.awt.event.ActionEvent evt) {
20.109 - lineEndingPreferenceChanged(evt);
20.110 - }
20.111 - });
20.112 -
20.113 - buttonGroup1.add(forceCrlf);
20.114 - forceCrlf.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.forceCrlf.text")); // NOI18N
20.115 - forceCrlf.addActionListener(new java.awt.event.ActionListener() {
20.116 - public void actionPerformed(java.awt.event.ActionEvent evt) {
20.117 - lineEndingPreferenceChanged(evt);
20.118 - }
20.119 - });
20.120 -
20.121 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
20.122 - this.setLayout(layout);
20.123 - layout.setHorizontalGroup(
20.124 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
20.125 - .add(layout.createSequentialGroup()
20.126 - .addContainerGap()
20.127 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
20.128 - .add(noChangeButton)
20.129 - .add(systemDefaultButton)
20.130 - .add(newlineButton)
20.131 - .add(forceCrlf))
20.132 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
20.133 - );
20.134 - layout.setVerticalGroup(
20.135 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
20.136 - .add(layout.createSequentialGroup()
20.137 - .add(noChangeButton)
20.138 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
20.139 - .add(systemDefaultButton)
20.140 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
20.141 - .add(newlineButton)
20.142 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
20.143 - .add(forceCrlf)
20.144 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
20.145 - );
20.146 - }// </editor-fold>//GEN-END:initComponents
20.147 -
20.148 - private void lineEndingPreferenceChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lineEndingPreferenceChanged
20.149 - for (JRadioButton b : new JRadioButton[] { forceCrlf, newlineButton, noChangeButton, systemDefaultButton }) {
20.150 - if (b.isSelected()) {
20.151 - LineEndingPreference x = (LineEndingPreference) b.getClientProperty(PROP_ENDING);
20.152 - if (x != null) {
20.153 - NbPreferences.forModule(LineEndingsPanel.class).put(PROP_ENDING, x.name());
20.154 - }
20.155 - break;
20.156 - }
20.157 - }
20.158 - }//GEN-LAST:event_lineEndingPreferenceChanged
20.159 -
20.160 - public static LineEndingPreference getLineEndingPrefs() {
20.161 - String ending = NbPreferences.forModule(LineEndingsPanel.class).get(PROP_ENDING, LineEndingPreference.NO_CHANGE.name());
20.162 - return LineEndingPreference.valueOf(ending);
20.163 - }
20.164 -
20.165 -
20.166 - // Variables declaration - do not modify//GEN-BEGIN:variables
20.167 - private javax.swing.ButtonGroup buttonGroup1;
20.168 - private javax.swing.JRadioButton forceCrlf;
20.169 - private javax.swing.JRadioButton newlineButton;
20.170 - private javax.swing.JRadioButton noChangeButton;
20.171 - private javax.swing.JRadioButton systemDefaultButton;
20.172 - // End of variables declaration//GEN-END:variables
20.173 -
20.174 -}
21.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/NodeCheckObserver.java Thu Aug 30 10:56:16 2012 +0200
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,12 +0,0 @@
21.4 -package org.netbeans.modules.licensechanger;
21.5 -
21.6 -import org.openide.nodes.Node;
21.7 -
21.8 -/**
21.9 - *
21.10 - * @author Tim Boudreau
21.11 - */
21.12 -public interface NodeCheckObserver {
21.13 - public void onNodeChecked (Node node);
21.14 - public void onNodeUnchecked (Node node);
21.15 -}
22.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/Offsets.java Thu Aug 30 10:56:16 2012 +0200
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,62 +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;
22.44 -
22.45 -/**
22.46 - *
22.47 - * @author Tim Boudreau
22.48 - */
22.49 -public final class Offsets {
22.50 - private final int start;
22.51 - private final int end;
22.52 -
22.53 - public Offsets(int start, int end) {
22.54 - this.start = start;
22.55 - this.end = end;
22.56 - }
22.57 -
22.58 - public int getEnd() {
22.59 - return end;
22.60 - }
22.61 -
22.62 - public int getStart() {
22.63 - return start;
22.64 - }
22.65 -}
23.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/PreviewPanel.form Thu Aug 30 10:56:16 2012 +0200
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,231 +0,0 @@
23.4 -<?xml version="1.0" encoding="UTF-8" ?>
23.5 -
23.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
23.7 - <AuxValues>
23.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
23.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
23.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
23.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
23.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
23.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
23.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
23.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
23.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
23.17 - </AuxValues>
23.18 -
23.19 - <Layout>
23.20 - <DimensionLayout dim="0">
23.21 - <Group type="103" groupAlignment="0" attributes="0">
23.22 - <Group type="102" alignment="1" attributes="0">
23.23 - <EmptySpace max="-2" attributes="0"/>
23.24 - <Group type="103" groupAlignment="1" attributes="0">
23.25 - <Component id="jSplitPane1" alignment="0" pref="543" max="32767" attributes="0"/>
23.26 - <Component id="jLabel3" alignment="0" pref="543" max="32767" attributes="0"/>
23.27 - </Group>
23.28 - <EmptySpace max="-2" attributes="0"/>
23.29 - </Group>
23.30 - </Group>
23.31 - </DimensionLayout>
23.32 - <DimensionLayout dim="1">
23.33 - <Group type="103" groupAlignment="0" attributes="0">
23.34 - <Group type="102" alignment="1" attributes="0">
23.35 - <EmptySpace max="-2" attributes="0"/>
23.36 - <Component id="jSplitPane1" pref="408" max="32767" attributes="0"/>
23.37 - <EmptySpace max="-2" attributes="0"/>
23.38 - <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
23.39 - </Group>
23.40 - </Group>
23.41 - </DimensionLayout>
23.42 - </Layout>
23.43 - <SubComponents>
23.44 - <Container class="javax.swing.JSplitPane" name="jSplitPane1">
23.45 - <Properties>
23.46 - <Property name="dividerLocation" type="int" value="200"/>
23.47 - <Property name="orientation" type="int" value="0"/>
23.48 - <Property name="resizeWeight" type="double" value="0.5"/>
23.49 - </Properties>
23.50 -
23.51 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
23.52 - <SubComponents>
23.53 - <Container class="javax.swing.JScrollPane" name="fileList">
23.54 - <Properties>
23.55 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.56 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
23.57 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
23.58 - </Border>
23.59 - </Property>
23.60 - </Properties>
23.61 - <AuxValues>
23.62 - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
23.63 - </AuxValues>
23.64 - <Constraints>
23.65 - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
23.66 - <JSplitPaneConstraints position="top"/>
23.67 - </Constraint>
23.68 - </Constraints>
23.69 -
23.70 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
23.71 - </Container>
23.72 - <Container class="javax.swing.JSplitPane" name="jSplitPane2">
23.73 - <Properties>
23.74 - <Property name="dividerLocation" type="int" value="295"/>
23.75 - <Property name="resizeWeight" type="double" value="0.5"/>
23.76 - </Properties>
23.77 - <Constraints>
23.78 - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
23.79 - <JSplitPaneConstraints position="right"/>
23.80 - </Constraint>
23.81 - </Constraints>
23.82 -
23.83 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
23.84 - <SubComponents>
23.85 - <Container class="javax.swing.JPanel" name="jPanel1">
23.86 - <Constraints>
23.87 - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
23.88 - <JSplitPaneConstraints position="left"/>
23.89 - </Constraint>
23.90 - </Constraints>
23.91 -
23.92 - <Layout>
23.93 - <DimensionLayout dim="0">
23.94 - <Group type="103" groupAlignment="0" attributes="0">
23.95 - <Group type="102" alignment="0" attributes="0">
23.96 - <EmptySpace max="-2" attributes="0"/>
23.97 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
23.98 - <EmptySpace pref="252" max="32767" attributes="0"/>
23.99 - </Group>
23.100 - <Component id="jScrollPane1" alignment="1" pref="294" max="32767" attributes="0"/>
23.101 - </Group>
23.102 - </DimensionLayout>
23.103 - <DimensionLayout dim="1">
23.104 - <Group type="103" groupAlignment="0" attributes="0">
23.105 - <Group type="102" alignment="0" attributes="0">
23.106 - <EmptySpace max="-2" attributes="0"/>
23.107 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
23.108 - <EmptySpace max="-2" attributes="0"/>
23.109 - <Component id="jScrollPane1" pref="161" max="32767" attributes="0"/>
23.110 - </Group>
23.111 - </Group>
23.112 - </DimensionLayout>
23.113 - </Layout>
23.114 - <SubComponents>
23.115 - <Component class="javax.swing.JLabel" name="jLabel1">
23.116 - <Properties>
23.117 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
23.118 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="PreviewPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
23.119 - </Property>
23.120 - </Properties>
23.121 - </Component>
23.122 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
23.123 - <Properties>
23.124 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.125 - <Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
23.126 - <MatteColorBorder bottom="0" left="0" right="0" top="1">
23.127 - <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
23.128 - </MatteColorBorder>
23.129 - </Border>
23.130 - </Property>
23.131 - </Properties>
23.132 - <AuxValues>
23.133 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
23.134 - </AuxValues>
23.135 -
23.136 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
23.137 - <SubComponents>
23.138 - <Component class="javax.swing.JEditorPane" name="before">
23.139 - <Properties>
23.140 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.141 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
23.142 - <EmptyBorder/>
23.143 - </Border>
23.144 - </Property>
23.145 - </Properties>
23.146 - </Component>
23.147 - </SubComponents>
23.148 - </Container>
23.149 - </SubComponents>
23.150 - </Container>
23.151 - <Container class="javax.swing.JPanel" name="jPanel2">
23.152 - <Constraints>
23.153 - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
23.154 - <JSplitPaneConstraints position="right"/>
23.155 - </Constraint>
23.156 - </Constraints>
23.157 -
23.158 - <Layout>
23.159 - <DimensionLayout dim="0">
23.160 - <Group type="103" groupAlignment="0" attributes="0">
23.161 - <Group type="102" attributes="0">
23.162 - <EmptySpace max="-2" attributes="0"/>
23.163 - <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
23.164 - <EmptySpace pref="205" max="32767" attributes="0"/>
23.165 - </Group>
23.166 - <Component id="jScrollPane2" alignment="0" pref="240" max="32767" attributes="0"/>
23.167 - </Group>
23.168 - </DimensionLayout>
23.169 - <DimensionLayout dim="1">
23.170 - <Group type="103" groupAlignment="0" attributes="0">
23.171 - <Group type="102" alignment="0" attributes="0">
23.172 - <EmptySpace max="-2" attributes="0"/>
23.173 - <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
23.174 - <EmptySpace max="-2" attributes="0"/>
23.175 - <Component id="jScrollPane2" pref="161" max="32767" attributes="0"/>
23.176 - </Group>
23.177 - </Group>
23.178 - </DimensionLayout>
23.179 - </Layout>
23.180 - <SubComponents>
23.181 - <Component class="javax.swing.JLabel" name="jLabel2">
23.182 - <Properties>
23.183 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
23.184 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="PreviewPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
23.185 - </Property>
23.186 - </Properties>
23.187 - </Component>
23.188 - <Container class="javax.swing.JScrollPane" name="jScrollPane2">
23.189 - <Properties>
23.190 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.191 - <Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
23.192 - <MatteColorBorder bottom="0" left="0" right="0" top="1">
23.193 - <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
23.194 - </MatteColorBorder>
23.195 - </Border>
23.196 - </Property>
23.197 - <Property name="viewportBorder" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.198 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
23.199 - <EmptyBorder bottom="0" left="0" right="0" top="0"/>
23.200 - </Border>
23.201 - </Property>
23.202 - </Properties>
23.203 - <AuxValues>
23.204 - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
23.205 - </AuxValues>
23.206 -
23.207 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
23.208 - <SubComponents>
23.209 - <Component class="javax.swing.JEditorPane" name="after">
23.210 - <Properties>
23.211 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
23.212 - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
23.213 - <EmptyBorder/>
23.214 - </Border>
23.215 - </Property>
23.216 - </Properties>
23.217 - </Component>
23.218 - </SubComponents>
23.219 - </Container>
23.220 - </SubComponents>
23.221 - </Container>
23.222 - </SubComponents>
23.223 - </Container>
23.224 - </SubComponents>
23.225 - </Container>
23.226 - <Component class="javax.swing.JLabel" name="jLabel3">
23.227 - <Properties>
23.228 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
23.229 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="PreviewPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
23.230 - </Property>
23.231 - </Properties>
23.232 - </Component>
23.233 - </SubComponents>
23.234 -</Form>
24.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/PreviewPanel.java Thu Aug 30 10:56:16 2012 +0200
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,408 +0,0 @@
24.4 -/*
24.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
24.6 - *
24.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24.8 - *
24.9 - * The contents of this file are subject to the terms of either the GNU
24.10 - * General Public License Version 2 only ("GPL") or the Common
24.11 - * Development and Distribution License("CDDL") (collectively, the
24.12 - * "License"). You may not use this file except in compliance with the
24.13 - * License. You can obtain a copy of the License at
24.14 - * http://www.netbeans.org/cddl-gplv2.html
24.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
24.16 - * specific language governing permissions and limitations under the
24.17 - * License. When distributing the software, include this License Header
24.18 - * Notice in each file and include the License file at
24.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
24.20 - * particular file as subject to the "Classpath" exception as provided
24.21 - * by Sun in the GPL Version 2 section of the License file that
24.22 - * accompanied this code. If applicable, add the following below the
24.23 - * License Header, with the fields enclosed by brackets [] replaced by
24.24 - * your own identifying information:
24.25 - * "Portions Copyrighted [year] [name of copyright owner]"
24.26 - *
24.27 - * If you wish your version of this file to be governed by only the CDDL
24.28 - * or only the GPL Version 2, indicate your decision by adding
24.29 - * "[Contributor] elects to include this software in this distribution
24.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
24.31 - * single choice of license, a recipient has the option to distribute
24.32 - * your version of this file under either the CDDL, the GPL Version 2 or
24.33 - * to extend the choice of license to its licensees as provided above.
24.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
24.35 - * Version 2 license, then the option applies only if the new code is
24.36 - * made subject to such option by the copyright holder.
24.37 - *
24.38 - * Contributor(s):
24.39 - *
24.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
24.41 - */
24.42 -package org.netbeans.modules.licensechanger;
24.43 -
24.44 -import java.awt.EventQueue;
24.45 -import java.beans.PropertyChangeEvent;
24.46 -import java.beans.PropertyChangeListener;
24.47 -import java.io.BufferedInputStream;
24.48 -import java.io.ByteArrayOutputStream;
24.49 -import java.io.IOException;
24.50 -import java.io.InputStream;
24.51 -import java.io.PrintWriter;
24.52 -import java.io.UnsupportedEncodingException;
24.53 -import java.nio.charset.Charset;
24.54 -import java.util.HashSet;
24.55 -import java.util.Map;
24.56 -import java.util.Set;
24.57 -import org.netbeans.api.queries.FileEncodingQuery;
24.58 -import org.netbeans.modules.licensechanger.FileChildren.FileItem;
24.59 -import org.netbeans.modules.licensechanger.api.FileHandler;
24.60 -import org.openide.explorer.ExplorerManager;
24.61 -import org.openide.filesystems.FileObject;
24.62 -import org.openide.filesystems.FileUtil;
24.63 -import org.openide.nodes.AbstractNode;
24.64 -import org.openide.nodes.Children;
24.65 -import org.openide.nodes.Node;
24.66 -import org.openide.util.RequestProcessor;
24.67 -import org.openide.util.RequestProcessor.Task;
24.68 -import org.openide.util.Utilities;
24.69 -
24.70 -/**
24.71 - *
24.72 - * @author Tim Boudreau
24.73 - */
24.74 -public class PreviewPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
24.75 -
24.76 - private final ExplorerManager mgr = new ExplorerManager();
24.77 - private ItemLoader loader;
24.78 - private String licenseText;
24.79 - private Map<Object, Object> settings;
24.80 - public static final String KEY_ITEMS = "fileItems";
24.81 -
24.82 - public PreviewPanel(Map<Object, Object> settings) {
24.83 - this.settings = settings;
24.84 - Set<FileObject> folders = (Set<FileObject>) settings.get(SelectFoldersPanel.KEY_FOLDERS);
24.85 - this.licenseText = (String) settings.get(LicenseChooserPanel.KEY_LICENSE_TEXT);
24.86 - initComponents();
24.87 - Children kids = Children.create(new FileChildren(folders, settings), true);
24.88 - mgr.setRootContext(new AbstractNode(kids));
24.89 - mgr.addPropertyChangeListener(this);
24.90 - view().setNodeCheckObserver(this);
24.91 - jLabel3.setText (" ");
24.92 - }
24.93 -
24.94 - private void updateItems() {
24.95 - Set<FileItem> s = new HashSet<FileItem>();
24.96 - for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
24.97 - if (Boolean.TRUE.equals(n.getValue(CheckboxListView.SELECTED))) {
24.98 - s.addAll(n.getLookup().lookupAll(FileItem.class));
24.99 - }
24.100 - }
24.101 - settings.put(KEY_ITEMS, s);
24.102 - }
24.103 -
24.104 - private CheckboxListView view() {
24.105 - return (CheckboxListView) fileList;
24.106 - }
24.107 -
24.108 - public void setLicenseText(String licenseText) {
24.109 - this.licenseText = licenseText;
24.110 - }
24.111 -
24.112 - /** This method is called from within the constructor to
24.113 - * initialize the form.
24.114 - * WARNING: Do NOT modify this code. The content of this method is
24.115 - * always regenerated by the Form Editor.
24.116 - */
24.117 - @SuppressWarnings("unchecked")
24.118 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
24.119 - private void initComponents() {
24.120 -
24.121 - jSplitPane1 = new javax.swing.JSplitPane();
24.122 - fileList = new CheckboxListView();
24.123 - jSplitPane2 = new javax.swing.JSplitPane();
24.124 - jPanel1 = new javax.swing.JPanel();
24.125 - jLabel1 = new javax.swing.JLabel();
24.126 - jScrollPane1 = new javax.swing.JScrollPane();
24.127 - before = new javax.swing.JEditorPane();
24.128 - jPanel2 = new javax.swing.JPanel();
24.129 - jLabel2 = new javax.swing.JLabel();
24.130 - jScrollPane2 = new javax.swing.JScrollPane();
24.131 - after = new javax.swing.JEditorPane();
24.132 - jLabel3 = new javax.swing.JLabel();
24.133 -
24.134 - jSplitPane1.setDividerLocation(200);
24.135 - jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
24.136 - jSplitPane1.setResizeWeight(0.5);
24.137 -
24.138 - fileList.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
24.139 - jSplitPane1.setTopComponent(fileList);
24.140 -
24.141 - jSplitPane2.setDividerLocation(295);
24.142 - jSplitPane2.setResizeWeight(0.5);
24.143 -
24.144 - jLabel1.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel1.text")); // NOI18N
24.145 -
24.146 - jScrollPane1.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 0, 0, 0, javax.swing.UIManager.getDefaults().getColor("controlShadow")));
24.147 -
24.148 - before.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
24.149 - jScrollPane1.setViewportView(before);
24.150 -
24.151 - org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
24.152 - jPanel1.setLayout(jPanel1Layout);
24.153 - jPanel1Layout.setHorizontalGroup(
24.154 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.155 - .add(jPanel1Layout.createSequentialGroup()
24.156 - .addContainerGap()
24.157 - .add(jLabel1)
24.158 - .addContainerGap(252, Short.MAX_VALUE))
24.159 - .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
24.160 - );
24.161 - jPanel1Layout.setVerticalGroup(
24.162 - jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.163 - .add(jPanel1Layout.createSequentialGroup()
24.164 - .addContainerGap()
24.165 - .add(jLabel1)
24.166 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
24.167 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE))
24.168 - );
24.169 -
24.170 - jSplitPane2.setLeftComponent(jPanel1);
24.171 -
24.172 - jLabel2.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel2.text")); // NOI18N
24.173 -
24.174 - jScrollPane2.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 0, 0, 0, javax.swing.UIManager.getDefaults().getColor("controlShadow")));
24.175 - jScrollPane2.setViewportBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
24.176 -
24.177 - after.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
24.178 - jScrollPane2.setViewportView(after);
24.179 -
24.180 - org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
24.181 - jPanel2.setLayout(jPanel2Layout);
24.182 - jPanel2Layout.setHorizontalGroup(
24.183 - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.184 - .add(jPanel2Layout.createSequentialGroup()
24.185 - .addContainerGap()
24.186 - .add(jLabel2)
24.187 - .addContainerGap(205, Short.MAX_VALUE))
24.188 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
24.189 - );
24.190 - jPanel2Layout.setVerticalGroup(
24.191 - jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.192 - .add(jPanel2Layout.createSequentialGroup()
24.193 - .addContainerGap()
24.194 - .add(jLabel2)
24.195 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
24.196 - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE))
24.197 - );
24.198 -
24.199 - jSplitPane2.setRightComponent(jPanel2);
24.200 -
24.201 - jSplitPane1.setRightComponent(jSplitPane2);
24.202 -
24.203 - jLabel3.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel3.text")); // NOI18N
24.204 -
24.205 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
24.206 - this.setLayout(layout);
24.207 - layout.setHorizontalGroup(
24.208 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.209 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
24.210 - .addContainerGap()
24.211 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
24.212 - .add(org.jdesktop.layout.GroupLayout.LEADING, jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE)
24.213 - .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE))
24.214 - .addContainerGap())
24.215 - );
24.216 - layout.setVerticalGroup(
24.217 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
24.218 - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
24.219 - .addContainerGap()
24.220 - .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)
24.221 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
24.222 - .add(jLabel3))
24.223 - );
24.224 - }// </editor-fold>//GEN-END:initComponents
24.225 - // Variables declaration - do not modify//GEN-BEGIN:variables
24.226 - private javax.swing.JEditorPane after;
24.227 - private javax.swing.JEditorPane before;
24.228 - private javax.swing.JScrollPane fileList;
24.229 - private javax.swing.JLabel jLabel1;
24.230 - private javax.swing.JLabel jLabel2;
24.231 - private javax.swing.JLabel jLabel3;
24.232 - private javax.swing.JPanel jPanel1;
24.233 - private javax.swing.JPanel jPanel2;
24.234 - private javax.swing.JScrollPane jScrollPane1;
24.235 - private javax.swing.JScrollPane jScrollPane2;
24.236 - private javax.swing.JSplitPane jSplitPane1;
24.237 - private javax.swing.JSplitPane jSplitPane2;
24.238 - // End of variables declaration//GEN-END:variables
24.239 -
24.240 - public ExplorerManager getExplorerManager() {
24.241 - return mgr;
24.242 - }
24.243 -
24.244 - public void propertyChange(PropertyChangeEvent evt) {
24.245 - if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
24.246 - Node[] n = mgr.getSelectedNodes();
24.247 - if (n.length > 0) {
24.248 - FileItem item = n[0].getLookup().lookup(FileItem.class);
24.249 - if (item != null) {
24.250 - setFileItem(item);
24.251 - // XXX use FileUtil.getFileDisplayName rather than FileObject.getPath
24.252 - jLabel3.setText (item.file.getPath());
24.253 - } else {
24.254 - before.setText("");
24.255 - jLabel3.setText (" ");
24.256 - }
24.257 - } else {
24.258 - before.setText("");
24.259 - after.setText("");
24.260 - jLabel3.setText(" ");
24.261 - }
24.262 - }
24.263 - }
24.264 -
24.265 - private void setFileItem(FileItem item) {
24.266 - if (item.file.isValid()) {
24.267 - // XXX should use Diff API instead (like refactoring preview)
24.268 - before.setContentType("text/plain");
24.269 - after.setContentType("text/plain");
24.270 - before.setText("Loading " + item.file.getPath());
24.271 - after.setText("Loading " + item.file.getPath());
24.272 - ItemLoader ldr = new ItemLoader(item);
24.273 - setLoader(ldr);
24.274 - }
24.275 - }
24.276 -
24.277 - private synchronized void setLoader(ItemLoader ldr) {
24.278 - if (loader != null) {
24.279 - loader.cancel();
24.280 - }
24.281 - this.loader = ldr;
24.282 - loader.start();
24.283 - }
24.284 -
24.285 - public void onNodeChecked(Node node) {
24.286 - updateItems();
24.287 - }
24.288 -
24.289 - public void onNodeUnchecked(Node node) {
24.290 - updateItems();
24.291 - }
24.292 -
24.293 - static String loadFile(FileObject file) throws IOException {
24.294 - Charset encoding = FileEncodingQuery.getEncoding(file);
24.295 - InputStream in = new BufferedInputStream(file.getInputStream());
24.296 - ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.getSize());
24.297 - try {
24.298 - FileUtil.copy(in, out);
24.299 - try {
24.300 - String result = new String(out.toByteArray(), encoding.name());
24.301 - String sep = System.getProperty ("line.separator");
24.302 - //Convert everything internally to use \n
24.303 - if (!"\n".equals(sep) && sep != null) {
24.304 - return Utilities.replaceString(result, sep, "\n");
24.305 - } else {
24.306 - return result;
24.307 - }
24.308 - } catch (UnsupportedEncodingException q) {
24.309 - return new String(out.toByteArray(), FileEncodingQuery.getDefaultEncoding().name());
24.310 - }
24.311 - } finally {
24.312 - in.close();
24.313 - out.close();
24.314 - }
24.315 - }
24.316 -
24.317 - private class ItemLoader implements Runnable {
24.318 -
24.319 - private final Task task;
24.320 - private volatile boolean cancelled;
24.321 - private final FileItem item;
24.322 - private volatile String beforeText = "Cancelled";
24.323 - private volatile String afterText = "Cancelled";
24.324 -
24.325 - public ItemLoader(FileItem item) {
24.326 - this.item = item;
24.327 - task = RequestProcessor.getDefault().create(this);
24.328 - }
24.329 -
24.330 - void start() {
24.331 - task.schedule(200);
24.332 - }
24.333 -
24.334 - public void cancel() {
24.335 - cancelled = true;
24.336 - task.cancel();
24.337 - }
24.338 -
24.339 - private void loadFile() throws IOException {
24.340 - beforeText = PreviewPanel.loadFile(item.file);
24.341 - }
24.342 -
24.343 - public void run() {
24.344 - if (cancelled) {
24.345 - return;
24.346 - }
24.347 - if (!EventQueue.isDispatchThread()) {
24.348 - try {
24.349 - if (cancelled) {
24.350 - return;
24.351 - }
24.352 - if (!item.file.isValid()) {
24.353 - beforeText = "Invalid file";
24.354 - afterText = "Invalid file";
24.355 - return;
24.356 - }
24.357 - if (!item.file.canRead()) {
24.358 - beforeText = "Cannot read " + item.file.getPath();
24.359 - afterText = "Cannot read " + item.file.getPath();
24.360 - return;
24.361 - }
24.362 - if (item.file.getSize() >= Integer.MAX_VALUE) {
24.363 - beforeText = "File too long: " + item.file.getPath();
24.364 - afterText = "File too long: " + item.file.getPath();
24.365 - return;
24.366 - }
24.367 - if (item.file.getSize() == 0) {
24.368 - beforeText = "Empty file";
24.369 - afterText = "Empty file";
24.370 - return;
24.371 - }
24.372 - if (cancelled) {
24.373 - return;
24.374 - }
24.375 - try {
24.376 - loadFile();
24.377 - } catch (IOException ex) {
24.378 - ByteArrayOutputStream out = new ByteArrayOutputStream();
24.379 - PrintWriter w = new PrintWriter(out);
24.380 - ex.printStackTrace(w);
24.381 - beforeText = new String(out.toByteArray());
24.382 - afterText = "Error";
24.383 - return;
24.384 - }
24.385 - if (cancelled) {
24.386 - return;
24.387 - }
24.388 - if (beforeText.length() == 0) {
24.389 - afterText = "";
24.390 - return;
24.391 - }
24.392 - afterText = transform(beforeText, item.handler);
24.393 - } finally {
24.394 - if (!cancelled) {
24.395 - EventQueue.invokeLater(this);
24.396 - }
24.397 - }
24.398 - } else {
24.399 - String contentType = item.file.getMIMEType();
24.400 - before.setContentType(contentType);
24.401 - after.setContentType(contentType);
24.402 - before.setText(beforeText);
24.403 - after.setText(afterText);
24.404 - }
24.405 - }
24.406 -
24.407 - private String transform(String beforeText, FileHandler handler) {
24.408 - return handler.transform(beforeText, licenseText);
24.409 - }
24.410 - }
24.411 -}
25.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/SelectFoldersPanel.form Thu Aug 30 10:56:16 2012 +0200
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,66 +0,0 @@
25.4 -<?xml version="1.0" encoding="UTF-8" ?>
25.5 -
25.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
25.7 - <AuxValues>
25.8 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
25.9 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
25.10 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
25.11 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
25.12 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
25.13 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
25.14 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
25.15 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
25.16 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
25.17 - </AuxValues>
25.18 -
25.19 - <Layout>
25.20 - <DimensionLayout dim="0">
25.21 - <Group type="103" groupAlignment="0" attributes="0">
25.22 - <Group type="102" alignment="0" attributes="0">
25.23 - <EmptySpace max="-2" attributes="0"/>
25.24 - <Group type="103" groupAlignment="0" attributes="0">
25.25 - <Component id="jScrollPane1" alignment="0" pref="541" max="32767" attributes="0"/>
25.26 - <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
25.27 - </Group>
25.28 - <EmptySpace max="-2" attributes="0"/>
25.29 - </Group>
25.30 - </Group>
25.31 - </DimensionLayout>
25.32 - <DimensionLayout dim="1">
25.33 - <Group type="103" groupAlignment="0" attributes="0">
25.34 - <Group type="102" alignment="0" attributes="0">
25.35 - <EmptySpace max="-2" attributes="0"/>
25.36 - <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
25.37 - <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
25.38 - <Component id="jScrollPane1" pref="364" max="32767" attributes="0"/>
25.39 - <EmptySpace max="-2" attributes="0"/>
25.40 - </Group>
25.41 - </Group>
25.42 - </DimensionLayout>
25.43 - </Layout>
25.44 - <SubComponents>
25.45 - <Container class="javax.swing.JScrollPane" name="jScrollPane1">
25.46 - <Properties>
25.47 - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
25.48 - <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
25.49 - <LineBorder>
25.50 - <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
25.51 - </LineBorder>
25.52 - </Border>
25.53 - </Property>
25.54 - </Properties>
25.55 - <AuxValues>
25.56 - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
25.57 - </AuxValues>
25.58 -
25.59 - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
25.60 - </Container>
25.61 - <Component class="javax.swing.JLabel" name="jLabel1">
25.62 - <Properties>
25.63 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
25.64 - <ResourceString bundle="org/netbeans/modules/licensechanger/Bundle.properties" key="SelectFoldersPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
25.65 - </Property>
25.66 - </Properties>
25.67 - </Component>
25.68 - </SubComponents>
25.69 -</Form>
26.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/SelectFoldersPanel.java Thu Aug 30 10:56:16 2012 +0200
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,168 +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 -package org.netbeans.modules.licensechanger;
26.43 -
26.44 -import java.util.HashSet;
26.45 -import java.util.Map;
26.46 -import java.util.Set;
26.47 -import org.openide.explorer.ExplorerManager;
26.48 -import org.openide.filesystems.FileObject;
26.49 -import org.openide.nodes.AbstractNode;
26.50 -import org.openide.nodes.Children;
26.51 -import org.openide.nodes.Node;
26.52 -
26.53 -/**
26.54 - *
26.55 - * @author Tim Boudreau
26.56 - */
26.57 -public class SelectFoldersPanel extends javax.swing.JPanel implements ExplorerManager.Provider, NodeCheckObserver {
26.58 - private final ExplorerManager mgr = new ExplorerManager();
26.59 - public static final String KEY_FOLDERS = "folders";
26.60 - private final Map<Object, Object> settings;
26.61 -
26.62 - public SelectFoldersPanel(FileObject[] roots, Map<Object,Object> settings) {
26.63 - this.settings = settings;
26.64 - initComponents();
26.65 - AbstractNode root = new AbstractNode (Children.create(new FolderChildren(roots) {
26.66 - @Override
26.67 - public void onAllNodesCreated() {
26.68 - enableUI();
26.69 - updateFolders();
26.70 - }
26.71 - }, true));
26.72 - mgr.setRootContext(root);
26.73 - view().setCheckboxesVisible(false);
26.74 - view().setCheckboxesEnabled(false);
26.75 - view().setListEnabled(false);
26.76 - view().setNodeCheckObserver(this);
26.77 - }
26.78 -
26.79 - private void updateFolders() {
26.80 - Set <FileObject> folders = new HashSet<FileObject>();
26.81 - for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
26.82 - if (Boolean.TRUE.equals(n.getValue(CheckboxListView.SELECTED))) {
26.83 - FileObject f = n.getLookup().lookup(FileObject.class);
26.84 - if (f != null) {
26.85 - folders.add(f);
26.86 - }
26.87 - }
26.88 - }
26.89 - settings.put (KEY_FOLDERS, folders);
26.90 - }
26.91 -
26.92 - private void enableUI() {
26.93 - view().setCheckboxesVisible(true);
26.94 - view().setCheckboxesEnabled(true);
26.95 - jLabel1.setEnabled(true);
26.96 - view().setListEnabled(true);
26.97 - }
26.98 -
26.99 - private CheckboxListView view() {
26.100 - return (CheckboxListView) jScrollPane1;
26.101 - }
26.102 -
26.103 - public Set<? extends FileObject> getFolders() {
26.104 - Set<FileObject> result = new HashSet<FileObject>();
26.105 - for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
26.106 - if (Boolean.TRUE.equals(n.getValue(CheckboxListView.SELECTED))) {
26.107 - FileObject f = n.getLookup().lookup(FileObject.class);
26.108 - if (f != null) {
26.109 - result.add(f);
26.110 - }
26.111 - }
26.112 - }
26.113 - return result;
26.114 - }
26.115 -
26.116 - /** This method is called from within the constructor to
26.117 - * initialize the form.
26.118 - * WARNING: Do NOT modify this code. The content of this method is
26.119 - * always regenerated by the Form Editor.
26.120 - */
26.121 - @SuppressWarnings("unchecked")
26.122 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
26.123 - private void initComponents() {
26.124 -
26.125 - jScrollPane1 = new CheckboxListView();
26.126 - jLabel1 = new javax.swing.JLabel();
26.127 -
26.128 - jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
26.129 -
26.130 - jLabel1.setText(org.openide.util.NbBundle.getMessage(SelectFoldersPanel.class, "SelectFoldersPanel.jLabel1.text")); // NOI18N
26.131 -
26.132 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
26.133 - this.setLayout(layout);
26.134 - layout.setHorizontalGroup(
26.135 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
26.136 - .add(layout.createSequentialGroup()
26.137 - .addContainerGap()
26.138 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
26.139 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
26.140 - .add(jLabel1))
26.141 - .addContainerGap())
26.142 - );
26.143 - layout.setVerticalGroup(
26.144 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
26.145 - .add(layout.createSequentialGroup()
26.146 - .addContainerGap()
26.147 - .add(jLabel1)
26.148 - .add(9, 9, 9)
26.149 - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)
26.150 - .addContainerGap())
26.151 - );
26.152 - }// </editor-fold>//GEN-END:initComponents
26.153 -
26.154 -
26.155 - // Variables declaration - do not modify//GEN-BEGIN:variables
26.156 - private javax.swing.JLabel jLabel1;
26.157 - private javax.swing.JScrollPane jScrollPane1;
26.158 - // End of variables declaration//GEN-END:variables
26.159 -
26.160 - public ExplorerManager getExplorerManager() {
26.161 - return mgr;
26.162 - }
26.163 -
26.164 - public void onNodeChecked(Node node) {
26.165 - updateFolders();
26.166 - }
26.167 -
26.168 - public void onNodeUnchecked(Node node) {
26.169 - updateFolders();
26.170 - }
26.171 -}
27.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/WizardPP.java Thu Aug 30 10:56:16 2012 +0200
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,201 +0,0 @@
27.4 -/*
27.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
27.6 - *
27.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27.8 - *
27.9 - * The contents of this file are subject to the terms of either the GNU
27.10 - * General Public License Version 2 only ("GPL") or the Common
27.11 - * Development and Distribution License("CDDL") (collectively, the
27.12 - * "License"). You may not use this file except in compliance with the
27.13 - * License. You can obtain a copy of the License at
27.14 - * http://www.netbeans.org/cddl-gplv2.html
27.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
27.16 - * specific language governing permissions and limitations under the
27.17 - * License. When distributing the software, include this License Header
27.18 - * Notice in each file and include the License file at
27.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
27.20 - * particular file as subject to the "Classpath" exception as provided
27.21 - * by Sun in the GPL Version 2 section of the License file that
27.22 - * accompanied this code. If applicable, add the following below the
27.23 - * License Header, with the fields enclosed by brackets [] replaced by
27.24 - * your own identifying information:
27.25 - * "Portions Copyrighted [year] [name of copyright owner]"
27.26 - *
27.27 - * If you wish your version of this file to be governed by only the CDDL
27.28 - * or only the GPL Version 2, indicate your decision by adding
27.29 - * "[Contributor] elects to include this software in this distribution
27.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
27.31 - * single choice of license, a recipient has the option to distribute
27.32 - * your version of this file under either the CDDL, the GPL Version 2 or
27.33 - * to extend the choice of license to its licensees as provided above.
27.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
27.35 - * Version 2 license, then the option applies only if the new code is
27.36 - * made subject to such option by the copyright holder.
27.37 - *
27.38 - * Contributor(s):
27.39 - *
27.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
27.41 - */
27.42 -package org.netbeans.modules.licensechanger;
27.43 -
27.44 -import java.io.BufferedOutputStream;
27.45 -import java.io.ByteArrayInputStream;
27.46 -import java.io.IOException;
27.47 -import java.io.UnsupportedEncodingException;
27.48 -import java.nio.charset.Charset;
27.49 -import java.util.HashMap;
27.50 -import java.util.Map;
27.51 -import java.util.Set;
27.52 -import javax.swing.JComponent;
27.53 -import org.netbeans.api.queries.FileEncodingQuery;
27.54 -import org.netbeans.modules.licensechanger.FileChildren.FileItem;
27.55 -import org.netbeans.spi.wizard.DeferredWizardResult;
27.56 -import org.netbeans.spi.wizard.ResultProgressHandle;
27.57 -import org.netbeans.spi.wizard.WizardController;
27.58 -import org.netbeans.spi.wizard.WizardException;
27.59 -import org.netbeans.spi.wizard.WizardPanelProvider;
27.60 -import org.openide.filesystems.FileObject;
27.61 -import org.openide.filesystems.FileUtil;
27.62 -import org.openide.util.Exceptions;
27.63 -import org.openide.util.NbBundle;
27.64 -import org.openide.util.Utilities;
27.65 -
27.66 -/**
27.67 - *
27.68 - * @author Tim Boudreau
27.69 - */
27.70 -class WizardPP extends WizardPanelProvider {
27.71 - private FileObject[] roots;
27.72 - private enum Steps {
27.73 - chooseFileTypes,
27.74 - chooseLicense,
27.75 - chooseFolders,
27.76 - preview;
27.77 -
27.78 - public String getDisplayName() {
27.79 - return gs(name());
27.80 - }
27.81 - }
27.82 -
27.83 - public WizardPP(FileObject[] roots) {
27.84 - super(gs("WIZARD_TITLE"), new String[]{
27.85 - Steps.chooseFileTypes.name(),
27.86 - Steps.chooseLicense.name(),
27.87 - Steps.chooseFolders.name(),
27.88 - Steps.preview.name(),
27.89 - },
27.90 - new String[]{
27.91 - Steps.chooseFileTypes.getDisplayName(),
27.92 - Steps.chooseLicense.getDisplayName(),
27.93 - Steps.chooseFolders.getDisplayName(),
27.94 - Steps.preview.getDisplayName(),
27.95 - });
27.96 - this.roots = roots;
27.97 - }
27.98 -
27.99 - private static String gs(String key) {
27.100 - return NbBundle.getMessage(WizardPP.class, key);
27.101 - }
27.102 -
27.103 - @Override
27.104 - protected Object finish(Map settings) throws WizardException {
27.105 - return new DeferredWizardResult() {
27.106 -
27.107 - @Override
27.108 - public void start(Map settings, ResultProgressHandle handle) {
27.109 - handle.setBusy("Finding items");
27.110 - Set<FileItem> items = (Set<FileItem>) settings.get(PreviewPanel.KEY_ITEMS);
27.111 - String licenseText = (String) settings.get(LicenseChooserPanel.KEY_LICENSE_TEXT);
27.112 - int ix=0;
27.113 - int max = items.size();
27.114 - Charset enc;
27.115 - for (FileItem item : items) {
27.116 - handle.setProgress(item.getFile().getNameExt(), ix, max);
27.117 - try {
27.118 - String content = PreviewPanel.loadFile(item.file);
27.119 - String nue = item.handler.transform(content, licenseText);
27.120 - nue = convertLineEndings (content, nue);
27.121 -
27.122 - enc = FileEncodingQuery.getEncoding(item.file);
27.123 - BufferedOutputStream out = new BufferedOutputStream (item.file.getOutputStream());
27.124 - byte[] bytes;
27.125 - try {
27.126 - bytes = nue.getBytes(enc.name());
27.127 - } catch (UnsupportedEncodingException e) {
27.128 - //properties files get resource_bundle_charset
27.129 - bytes = nue.getBytes(FileEncodingQuery.getDefaultEncoding().name());
27.130 - }
27.131 - ByteArrayInputStream in = new ByteArrayInputStream (bytes);
27.132 - try {
27.133 - FileUtil.copy(in, out);
27.134 - } finally {
27.135 - out.close();
27.136 - in.close();
27.137 - }
27.138 - } catch (IOException ex) {
27.139 - Exceptions.printStackTrace(ex);
27.140 - }
27.141 - ix++;
27.142 - }
27.143 - handle.finished(null);
27.144 - }
27.145 - };
27.146 - }
27.147 -
27.148 - private static String convertLineEndings (String old, String nue) {
27.149 - LineEndingPreference pref = LineEndingsPanel.getLineEndingPrefs();
27.150 - boolean oldHasCrlf = old.contains("\r\n"); //NOI18N
27.151 - switch (pref) {
27.152 - case FORCE_CRLF :
27.153 - return Utilities.replaceString(nue, "\n", "\r\n"); //NOI18N
27.154 - case FORCE_NEWLINE :
27.155 - //We already converted everything to newline only on load
27.156 - return nue;
27.157 - case NO_CHANGE :
27.158 - return oldHasCrlf ? Utilities.replaceString(nue, "\n", "\r\n") : //NOI18N
27.159 - nue;
27.160 - case SYSTEM_DEFAULT :
27.161 - String sep = System.getProperty( "line.separator" ); //NOI18N
27.162 - if ("\n".equals(sep)) {
27.163 - return nue;
27.164 - } else {
27.165 - return Utilities.replaceString (nue, "\n", sep); //NOI18N
27.166 - }
27.167 - default :
27.168 - throw new AssertionError();
27.169 - }
27.170 - }
27.171 -
27.172 - @Override
27.173 - protected void recycleExistingPanel(String id, WizardController controller, Map wizardData, JComponent panel) {
27.174 - //XXX update things
27.175 - super.recycleExistingPanel(id, controller, wizardData, panel);
27.176 - }
27.177 -
27.178 - Map<Steps, JComponent> panelForStep = new HashMap<Steps, JComponent>();
27.179 -
27.180 - @Override
27.181 - protected JComponent createPanel(WizardController arg0, String stepId, Map args) {
27.182 - Steps step = Steps.valueOf(stepId);
27.183 - JComponent result = panelForStep.get(step);
27.184 - if (result == null) {
27.185 - switch (step) {
27.186 - case chooseFileTypes :
27.187 - result = new ChooseFileTypesPanel(args);
27.188 - break;
27.189 - case chooseFolders :
27.190 - result = new SelectFoldersPanel(roots, args);
27.191 - break;
27.192 - case chooseLicense :
27.193 - result = new LicenseChooserPanel(args);
27.194 - break;
27.195 - case preview :
27.196 - result = new PreviewPanel(args);
27.197 - break;
27.198 - default :
27.199 - throw new AssertionError();
27.200 - }
27.201 - }
27.202 - return result;
27.203 - }
27.204 -}
28.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/FileHandler.java Thu Aug 30 10:56:16 2012 +0200
28.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/FileHandler.java Thu Sep 13 09:10:03 2012 +0200
28.3 @@ -38,16 +38,27 @@
28.4 */
28.5 package org.netbeans.modules.licensechanger.api;
28.6
28.7 +import java.io.IOException;
28.8 +import java.io.StringWriter;
28.9 import java.util.ArrayList;
28.10 +import java.util.Date;
28.11 import java.util.List;
28.12 +import java.util.Properties;
28.13 import java.util.regex.Matcher;
28.14 import java.util.regex.Pattern;
28.15 -import org.netbeans.modules.licensechanger.*;
28.16 +import javax.script.Bindings;
28.17 +import javax.script.ScriptEngine;
28.18 +import javax.script.ScriptEngineManager;
28.19 +import javax.script.ScriptException;
28.20 +import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
28.21 import org.openide.filesystems.FileObject;
28.22 +import org.openide.filesystems.FileUtil;
28.23 +import org.openide.util.Exceptions;
28.24
28.25 /**
28.26 *
28.27 * @author Tim Boudreau
28.28 + * @author Nils Hoffmann (Refactoring, Freemarker Variables, resolveLicenseTemplate)
28.29 */
28.30 public abstract class FileHandler {
28.31
28.32 @@ -61,24 +72,113 @@
28.33
28.34 protected abstract String escape(String licenseText);
28.35
28.36 + protected abstract String licenseFirst();
28.37 +
28.38 + protected abstract String licensePrefix();
28.39 +
28.40 + protected abstract String licenseLast();
28.41 +
28.42 + /**
28.43 + * Uses the freemarker template engine to resolve the licenseText. If no
28.44 + * freemarker script engine is found, a {@link RuntimeException} is thrown.
28.45 + * This method will access user information under {@code Templates/Properties/User.properties}
28.46 + * in order to resolve various tokens, e.g. 'user'. If that file does not
28.47 + * exist, a {@link RuntimeException} will be thrown, wrapping the original {@link IOException}.
28.48 + * Should the freemarker engine encounter a {@link ScriptException}, this
28.49 + * will also be wrapped in a {@link RuntimeException}.
28.50 + *
28.51 + * @param licenseText
28.52 + * @return the resolved licenseText
28.53 + * @throws RuntimeException
28.54 + */
28.55 + public String resolveLicenseTemplate(String licenseText) throws RuntimeException {
28.56 + if (licenseText.contains("${licenseFirst}") && licenseText.contains("${licensePrefix}") && licenseText.contains("${licenseLast}")) {
28.57 + System.out.println("License is a freemarker template!");
28.58 + //freemarker template
28.59 + ScriptEngineManager sem = new ScriptEngineManager();
28.60 + ScriptEngine se = sem.getEngineByName("freemarker");
28.61 + if (se != null) {
28.62 + Bindings bindings = se.createBindings();
28.63 + FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Properties/User.properties");
28.64 + Properties props = new Properties();
28.65 + try {
28.66 + props.load(licenseTemplates.getInputStream());
28.67 + for (String key : props.stringPropertyNames()) {
28.68 + bindings.put(key, props.getProperty(key));
28.69 + }
28.70 + } catch (IOException ex) {
28.71 + Exceptions.printStackTrace(ex);
28.72 + throw new RuntimeException(ex);
28.73 + }
28.74 + bindings.put("licenseFirst", licenseFirst());
28.75 + bindings.put("licensePrefix", licensePrefix());
28.76 + bindings.put("licenseLast", licenseLast());
28.77 + bindings.put("date", new Date());
28.78 + if (props.containsKey("project.organization")) {
28.79 + Project project = new Project(props.getProperty("project.organization"));
28.80 + System.out.println("Using project.organization: " + props.getProperty("project.organization"));
28.81 + bindings.put("project", project);
28.82 + bindings.put("user", null);
28.83 + } else {
28.84 + String user = props.getProperty("user", System.getProperty("user.name"));
28.85 + System.out.println("Using user: " + user);
28.86 + bindings.put("project", new Project(null));
28.87 + bindings.put("user", user);
28.88 + }
28.89 + StringWriter writer = new StringWriter();
28.90 + try {
28.91 + se.getContext().setWriter(writer);
28.92 + se.eval(licenseText, bindings);
28.93 + return writer.toString();
28.94 + } catch (ScriptException ex) {
28.95 + Exceptions.printStackTrace(ex);
28.96 + throw new RuntimeException(ex);
28.97 + }
28.98 + } else {
28.99 + throw new RuntimeException("Could not find script engine 'freemarker'!");
28.100 + }
28.101 + } else if (licenseText.contains(licenseFirst()) && licenseText.contains(licensePrefix()) && licenseText.contains(licenseLast())) {
28.102 + System.out.println("License is already escaped!");
28.103 + //probably already escaped
28.104 + return licenseText;
28.105 + } else {
28.106 + System.out.println("License is plain!");
28.107 + //unescaped
28.108 + return escape(licenseText);
28.109 + }
28.110 + }
28.111 +
28.112 public String transform(String origText, String licenseText) {
28.113 Offsets offsets = getReplaceOffsets(origText);
28.114 System.err.println("Will delete from " + offsets.getStart() + " to " + offsets.getEnd());
28.115 StringBuilder after = new StringBuilder(origText);
28.116 - String escaped = escape(licenseText);
28.117 + String escaped = resolveLicenseTemplate(licenseText);
28.118 after.delete(offsets.getStart(), offsets.getEnd());
28.119 after.insert(offsets.getStart(), escaped);
28.120 return after.toString();
28.121 }
28.122
28.123 + /**
28.124 + * Freemarker expects project.organization to be the field 'organization' in
28.125 + * an object. This provided a thin wrapper for that.
28.126 + */
28.127 + private class Project {
28.128 +
28.129 + public String organization;
28.130 +
28.131 + public Project(String organization) {
28.132 + this.organization = organization;
28.133 + }
28.134 + }
28.135 static Pattern p = Pattern.compile("(.*?)\\n|\\z", Pattern.UNIX_LINES);
28.136 - public static String[] splitIntoLines (CharSequence content) {
28.137 - List <String> result = new ArrayList<String>(40);
28.138 +
28.139 + public static String[] splitIntoLines(CharSequence content) {
28.140 + List<String> result = new ArrayList<String>(40);
28.141 Matcher m = p.matcher(content);
28.142 while (m.find()) {
28.143 if (m.groupCount() == 1) {
28.144 if (m.group(1) != null) {
28.145 - result.add (m.group(1));
28.146 + result.add(m.group(1));
28.147 }
28.148 }
28.149 }
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/LicenseHeader.java Thu Sep 13 09:10:03 2012 +0200
29.3 @@ -0,0 +1,157 @@
29.4 +/*
29.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
29.6 + *
29.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29.8 + *
29.9 + * The contents of this file are subject to the terms of either the GNU
29.10 + * General Public License Version 2 only ("GPL") or the Common
29.11 + * Development and Distribution License("CDDL") (collectively, the
29.12 + * "License"). You may not use this file except in compliance with the
29.13 + * License. You can obtain a copy of the License at
29.14 + * http://www.netbeans.org/cddl-gplv2.html
29.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
29.16 + * specific language governing permissions and limitations under the
29.17 + * License. When distributing the software, include this License Header
29.18 + * Notice in each file and include the License file at
29.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
29.20 + * particular file as subject to the "Classpath" exception as provided
29.21 + * by Sun in the GPL Version 2 section of the License file that
29.22 + * accompanied this code. If applicable, add the following below the
29.23 + * License Header, with the fields enclosed by brackets [] replaced by
29.24 + * your own identifying information:
29.25 + * "Portions Copyrighted [year] [name of copyright owner]"
29.26 + *
29.27 + * If you wish your version of this file to be governed by only the CDDL
29.28 + * or only the GPL Version 2, indicate your decision by adding
29.29 + * "[Contributor] elects to include this software in this distribution
29.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
29.31 + * single choice of license, a recipient has the option to distribute
29.32 + * your version of this file under either the CDDL, the GPL Version 2 or
29.33 + * to extend the choice of license to its licensees as provided above.
29.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
29.35 + * Version 2 license, then the option applies only if the new code is
29.36 + * made subject to such option by the copyright holder.
29.37 + *
29.38 + * Contributor(s):
29.39 + *
29.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
29.41 + */
29.42 +
29.43 +package org.netbeans.modules.licensechanger.api;
29.44 +
29.45 +import java.io.*;
29.46 +import java.nio.charset.Charset;
29.47 +import java.util.Collection;
29.48 +import java.util.LinkedList;
29.49 +import java.util.List;
29.50 +import org.openide.filesystems.FileObject;
29.51 +import org.openide.filesystems.FileUtil;
29.52 +import org.openide.util.Exceptions;
29.53 +
29.54 +/**
29.55 + * License header resource/file abstraction class with static
29.56 + * methods to load a license header from file or registered license template.
29.57 + * @author Nils Hoffmann
29.58 + */
29.59 +public final class LicenseHeader {
29.60 +
29.61 + public static LicenseHeader fromFileObject(FileObject file, String licenseName, boolean isNetBeansTemplate) {
29.62 + String name = licenseName==null?file.getName():licenseName;
29.63 + String content;
29.64 + InputStream in;
29.65 + try {
29.66 + in = new BufferedInputStream(file.getInputStream());
29.67 + ByteArrayOutputStream out = new ByteArrayOutputStream();
29.68 + FileUtil.copy(in, out);
29.69 + content = new String(out.toByteArray());
29.70 + LicenseHeader header = new LicenseHeader(name, content, file, isNetBeansTemplate);
29.71 + return header;
29.72 + } catch (IOException ex) {
29.73 + Exceptions.printStackTrace(ex);
29.74 + return null;
29.75 + }
29.76 + }
29.77 +
29.78 + public static LicenseHeader fromFileObject(FileObject file, String licenseName) {
29.79 + return fromFileObject(file, licenseName, false);
29.80 + }
29.81 +
29.82 + public static LicenseHeader fromFile(File file) {
29.83 + return fromFileObject(FileUtil.toFileObject(file),null);
29.84 + }
29.85 +
29.86 + public static Collection<? extends LicenseHeader> fromTemplates() {
29.87 + FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Licenses");
29.88 + List<LicenseHeader> templateLicenses = new LinkedList<LicenseHeader>();
29.89 + for(FileObject license:licenseTemplates.getChildren()) {
29.90 + String name = license.getName();
29.91 + name = name.substring("license-".length());
29.92 + LicenseHeader licenseHeader = LicenseHeader.fromFileObject(license,name,true);
29.93 + if(licenseHeader.getLicenseHeader() == null || licenseHeader.getLicenseHeader().isEmpty()) {
29.94 + System.err.println("License file "+name+" seems to be empty! Skipping...");
29.95 + }else{
29.96 + licenseHeader.setIsNetBeansTemplate(true);
29.97 + templateLicenses.add(licenseHeader);
29.98 + }
29.99 + }
29.100 + return templateLicenses;
29.101 + }
29.102 +
29.103 + public static void addAsNetBeansTemplate(LicenseHeader header) {
29.104 + String filename = "license-"+header.getName()+".txt";
29.105 + FileObject licenseTemplates = FileUtil.getConfigFile("Templates/Licenses");
29.106 + BufferedWriter bos = null;
29.107 + try {
29.108 + FileObject templateFile = licenseTemplates.createData(filename);
29.109 + bos = new BufferedWriter(new OutputStreamWriter(templateFile.getOutputStream(),Charset.forName("UTF-8")));
29.110 + bos.write(header.getLicenseHeader());
29.111 + header.setIsNetBeansTemplate(true);
29.112 + } catch (IOException ex) {
29.113 + Exceptions.printStackTrace(ex);
29.114 + } finally {
29.115 + try {
29.116 + bos.close();
29.117 + } catch (IOException ex) {
29.118 + Exceptions.printStackTrace(ex);
29.119 + }
29.120 + }
29.121 + }
29.122 +
29.123 + private final String name;
29.124 + private final String licenseHeader;
29.125 + private final FileObject fo;
29.126 + private boolean isNetBeansTemplate = false;
29.127 +
29.128 + private LicenseHeader(String name, String licenseHeader, FileObject fo, boolean isNetBeansTemplate) {
29.129 + this.name = name;
29.130 + this.licenseHeader = licenseHeader;
29.131 + this.fo = fo;
29.132 + this.isNetBeansTemplate = isNetBeansTemplate;
29.133 + }
29.134 +
29.135 + public String getName() {
29.136 + return name;
29.137 + }
29.138 +
29.139 + public String getLicenseHeader() {
29.140 + return licenseHeader;
29.141 + }
29.142 +
29.143 + public FileObject getFileObject() {
29.144 + return this.fo;
29.145 + }
29.146 +
29.147 + public boolean isIsNetBeansTemplate() {
29.148 + return isNetBeansTemplate;
29.149 + }
29.150 +
29.151 + public void setIsNetBeansTemplate(boolean isNetBeansTemplate) {
29.152 + this.isNetBeansTemplate = isNetBeansTemplate;
29.153 + }
29.154 +
29.155 + @Override
29.156 + public String toString() {
29.157 + return name;
29.158 + }
29.159 +
29.160 +}
30.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/api/RegexpFileHandler.java Thu Aug 30 10:56:16 2012 +0200
30.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/api/RegexpFileHandler.java Thu Sep 13 09:10:03 2012 +0200
30.3 @@ -39,9 +39,9 @@
30.4
30.5 package org.netbeans.modules.licensechanger.api;
30.6
30.7 -import org.netbeans.modules.licensechanger.*;
30.8 import java.util.regex.Matcher;
30.9 import java.util.regex.Pattern;
30.10 +import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
30.11
30.12 /**
30.13 *
31.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/Bundle.properties Thu Aug 30 10:56:16 2012 +0200
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,42 +0,0 @@
31.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
31.5 -#
31.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
31.7 -#
31.8 -# The contents of this file are subject to the terms of either the GNU
31.9 -# General Public License Version 2 only ("GPL") or the Common
31.10 -# Development and Distribution License("CDDL") (collectively, the
31.11 -# "License"). You may not use this file except in compliance with the
31.12 -# License. You can obtain a copy of the License at
31.13 -# http://www.netbeans.org/cddl-gplv2.html
31.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
31.15 -# specific language governing permissions and limitations under the
31.16 -# License. When distributing the software, include this License Header
31.17 -# Notice in each file and include the License file at
31.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
31.19 -# particular file as subject to the "Classpath" exception as provided
31.20 -# by Sun in the GPL Version 2 section of the License file that
31.21 -# accompanied this code. If applicable, add the following below the
31.22 -# License Header, with the fields enclosed by brackets [] replaced by
31.23 -# your own identifying information:
31.24 -# "Portions Copyrighted [year] [name of copyright owner]"
31.25 -#
31.26 -# If you wish your version of this file to be governed by only the CDDL
31.27 -# or only the GPL Version 2, indicate your decision by adding
31.28 -# "[Contributor] elects to include this software in this distribution
31.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
31.30 -# single choice of license, a recipient has the option to distribute
31.31 -# your version of this file under either the CDDL, the GPL Version 2 or
31.32 -# to extend the choice of license to its licensees as provided above.
31.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
31.34 -# Version 2 license, then the option applies only if the new code is
31.35 -# made subject to such option by the copyright holder.
31.36 -#
31.37 -# Contributor(s):
31.38 -#
31.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
31.40 -NAME_JAVA_FILES=Java Files
31.41 -NAME_JAVAFX_FILES=JavaFX Files
31.42 -NAME_PROPERTIES_FILES=Properties Files
31.43 -NAME_XML_FILES=XML Files
31.44 -XmlHandlerCustomizer.beforeButton.text=Insert License Before XML Declaration
31.45 -XmlHandlerCustomizer.afterButton.text=Insert License After XML Declaration
32.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/JavaFileHandler.java Thu Aug 30 10:56:16 2012 +0200
32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
32.3 @@ -1,197 +0,0 @@
32.4 -/*
32.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
32.6 - *
32.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
32.8 - *
32.9 - * The contents of this file are subject to the terms of either the GNU
32.10 - * General Public License Version 2 only ("GPL") or the Common
32.11 - * Development and Distribution License("CDDL") (collectively, the
32.12 - * "License"). You may not use this file except in compliance with the
32.13 - * License. You can obtain a copy of the License at
32.14 - * http://www.netbeans.org/cddl-gplv2.html
32.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
32.16 - * specific language governing permissions and limitations under the
32.17 - * License. When distributing the software, include this License Header
32.18 - * Notice in each file and include the License file at
32.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
32.20 - * particular file as subject to the "Classpath" exception as provided
32.21 - * by Sun in the GPL Version 2 section of the License file that
32.22 - * accompanied this code. If applicable, add the following below the
32.23 - * License Header, with the fields enclosed by brackets [] replaced by
32.24 - * your own identifying information:
32.25 - * "Portions Copyrighted [year] [name of copyright owner]"
32.26 - *
32.27 - * If you wish your version of this file to be governed by only the CDDL
32.28 - * or only the GPL Version 2, indicate your decision by adding
32.29 - * "[Contributor] elects to include this software in this distribution
32.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
32.31 - * single choice of license, a recipient has the option to distribute
32.32 - * your version of this file under either the CDDL, the GPL Version 2 or
32.33 - * to extend the choice of license to its licensees as provided above.
32.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
32.35 - * Version 2 license, then the option applies only if the new code is
32.36 - * made subject to such option by the copyright holder.
32.37 - *
32.38 - * Contributor(s):
32.39 - *
32.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
32.41 - */
32.42 -package org.netbeans.modules.licensechanger.handlers;
32.43 -
32.44 -import org.netbeans.modules.licensechanger.Offsets;
32.45 -import org.netbeans.modules.licensechanger.api.FileHandler;
32.46 -import org.openide.filesystems.FileObject;
32.47 -import org.openide.util.NbBundle;
32.48 -
32.49 -/**
32.50 - *
32.51 - * @author Tim Boudreau
32.52 - */
32.53 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
32.54 -public class JavaFileHandler extends FileHandler {
32.55 -
32.56 - public String getDisplayName() {
32.57 - return NbBundle.getMessage(JavaFileHandler.class, "NAME_JAVA_FILES"); //NOI18N
32.58 - }
32.59 -
32.60 - @Override
32.61 - public boolean match(FileObject file) {
32.62 - return "text/x-java".equals(file.getMIMEType()); //NOI18N
32.63 - }
32.64 -
32.65 - @Override
32.66 - public boolean shouldSkipFile(FileObject file) {
32.67 - return false;
32.68 - }
32.69 -
32.70 - @Override
32.71 - protected Offsets getReplaceOffsets(CharSequence seq) {
32.72 - String[] lines = splitIntoLines(seq);
32.73 - LineVisitor v = new LineVisitor();
32.74 - for (int i=0; i < lines.length; i++) {
32.75 - String line = lines[i];
32.76 - if (!v.visitLine(line)) {
32.77 - break;
32.78 - }
32.79 - }
32.80 - return new Offsets (0, v.delCount);
32.81 - }
32.82 -
32.83 - private static final class LineVisitor {
32.84 - private boolean inComment;
32.85 - int delCount;
32.86 - public boolean visitLine (String line) {
32.87 - String trimmed = line.trim();
32.88 - if (trimmed.startsWith("//") || trimmed.startsWith("/*") && trimmed.endsWith("*/")) {
32.89 - return visitCommentLine(line);
32.90 - } else if (trimmed.length() == 0) {
32.91 - return visitEmptyLine (line);
32.92 - } else if (inComment) {
32.93 - return visitLineInComment (line);
32.94 - } else {
32.95 - return visitLineAndTestForComment (line);
32.96 - }
32.97 - }
32.98 -
32.99 - private boolean visitCommentLine(String line) {
32.100 - delCount += line.length() + 1;
32.101 - return true;
32.102 - }
32.103 -
32.104 - private boolean visitEmptyLine(String line) {
32.105 - delCount += line.length() + 1;
32.106 - return true;
32.107 - }
32.108 -
32.109 - private boolean visitLineAndTestForComment(String line) {
32.110 - if (line.trim().startsWith("/*")) {
32.111 - inComment = true;
32.112 - delCount += line.length() + 1;
32.113 - return true;
32.114 - }
32.115 - return false;
32.116 - }
32.117 -
32.118 - private boolean visitLineInComment(String line) {
32.119 - if (line.trim().endsWith("*/")) {
32.120 - inComment = false;
32.121 - delCount += line.length() + 1;
32.122 - return true;
32.123 - }
32.124 - int ix = line.indexOf("*/");
32.125 - if (ix >= 0) {
32.126 - delCount += ix + 2;
32.127 - return false;
32.128 - } else {
32.129 - delCount += line.length() + 1;
32.130 - return true;
32.131 - }
32.132 - }
32.133 - }
32.134 -
32.135 -
32.136 -// @Override
32.137 -// protected Offsets getReplaceOffsets(CharSequence seq) {
32.138 -// int end2 = 0;
32.139 -// boolean inComment = false;
32.140 -// boolean maybeLast = false;
32.141 -// int lineLen;
32.142 -// for (StringTokenizer tok = new StringTokenizer(seq.toString(), "\n", true); tok.hasMoreTokens();) {
32.143 -// String line = tok.nextToken();
32.144 -// lineLen = line.length();
32.145 -// System.err.println("InComment? " + inComment + " Check line: " + line);
32.146 -// String trimmed = line.trim();
32.147 -// boolean lineWasComment = trimmed.length() == 0 || trimmed.startsWith("//");
32.148 -// System.err.println(" was comment? " + lineWasComment);
32.149 -// if (maybeLast && !lineWasComment && !trimmed.startsWith("/*")) {
32.150 -// break;
32.151 -// }
32.152 -// if (!lineWasComment && !inComment) {
32.153 -// int cmtStartIx = trimmed.indexOf("/*");
32.154 -// if (cmtStartIx >= 0) {
32.155 -// int cmtEndIx = trimmed.indexOf("*/");
32.156 -// if (cmtEndIx < 0) {
32.157 -// inComment = true;
32.158 -// } else if (trimmed.endsWith("*/")) {
32.159 -// inComment = false;
32.160 -// lineWasComment = true;
32.161 -// continue;
32.162 -// }
32.163 -// }
32.164 -// } else if (!lineWasComment && inComment) {
32.165 -// int cmtEndIx = line.indexOf("*/");
32.166 -// if (cmtEndIx >= 0 && !trimmed.endsWith("*/")) {
32.167 -// // e.g. blah blah */package foo.bar;
32.168 -// break;
32.169 -// } else if (cmtEndIx > 0) {
32.170 -// maybeLast = true;
32.171 -// inComment = false;
32.172 -// }
32.173 -// }
32.174 -// if (!lineWasComment && !inComment && !maybeLast) {
32.175 -// break;
32.176 -// }
32.177 -// end2 += lineLen;
32.178 -// }
32.179 -// return new Offsets(0, end2);
32.180 -// }
32.181 -
32.182 - protected String escape(String licenseText) {
32.183 - StringBuilder sb = new StringBuilder(licenseText.length() + 30);
32.184 - String[] lines = splitIntoLines (licenseText);
32.185 - sb.append ("/*\n");
32.186 - for (int i = 0; i < lines.length; i++) {
32.187 - String line = lines[i];
32.188 - boolean empty = line.trim().length() == 0;
32.189 - if (empty) {
32.190 - sb.append (" *");
32.191 - } else {
32.192 - sb.append (" * ");
32.193 - sb.append (line);
32.194 - }
32.195 - sb.append("\n");
32.196 - }
32.197 - sb.append(" */\n");
32.198 - return sb.toString();
32.199 - }
32.200 -}
33.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/JavaFxFileHandler.java Thu Aug 30 10:56:16 2012 +0200
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,57 +0,0 @@
33.4 -/*
33.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33.6 - *
33.7 - * Copyright 2010 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 2010 Sun Microsystems, Inc.
33.41 - */
33.42 -
33.43 -package org.netbeans.modules.licensechanger.handlers;
33.44 -
33.45 -import org.openide.filesystems.FileObject;
33.46 -import org.openide.util.NbBundle;
33.47 -
33.48 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
33.49 -public class JavaFxFileHandler extends JavaFileHandler {
33.50 - @Override
33.51 - public String getDisplayName() {
33.52 - return NbBundle.getMessage(JavaFxFileHandler.class, "NAME_JAVAFX_FILES"); //NOI18N
33.53 - }
33.54 -
33.55 - @Override
33.56 - public boolean match(FileObject file) {
33.57 - return "text/x-fx".equals(file.getMIMEType()); //NOI18N
33.58 - }
33.59 -}
33.60 -
34.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/PropertiesFileHandler.java Thu Aug 30 10:56:16 2012 +0200
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,106 +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.handlers;
34.44 -
34.45 -import org.netbeans.modules.licensechanger.Offsets;
34.46 -import org.netbeans.modules.licensechanger.api.FileHandler;
34.47 -import org.openide.filesystems.FileObject;
34.48 -import org.openide.util.NbBundle;
34.49 -
34.50 -/**
34.51 - * License transformer for properties files
34.52 - *
34.53 - * @author Tim Boudreau
34.54 - */
34.55 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
34.56 -public class PropertiesFileHandler extends FileHandler {
34.57 -
34.58 - public String getDisplayName() {
34.59 - return NbBundle.getMessage (JavaFileHandler.class, "NAME_PROPERTIES_FILES"); //NOI18N
34.60 - }
34.61 -
34.62 - @Override
34.63 - public boolean match(FileObject file) {
34.64 - return "properties".equals (file.getExt());
34.65 - }
34.66 -
34.67 - @Override
34.68 - public boolean shouldSkipFile(FileObject file) {
34.69 - String n = file.getNameExt();
34.70 - return "project.properties".equals(n) || "private.properties".equals(n) || //NOI18N
34.71 - "platform-private.properties".equals(n) || "genfiles.properties".equals(n)
34.72 - || "config.properties".equals(n) || "nblibraries-private.properties".equals(n) ||
34.73 - "nblibraries.properties".equals(n); //NOI18N
34.74 - }
34.75 -
34.76 - @Override
34.77 - protected Offsets getReplaceOffsets(CharSequence seq) {
34.78 - String[] lines = splitIntoLines(seq);
34.79 - int end = 0;
34.80 - for (int i = 0; i < lines.length; i++) {
34.81 - String line = lines[i];
34.82 - if (line.trim().length() == 0) {
34.83 - end += line.length() + 1;
34.84 - } else if (line.trim().startsWith("#")) {
34.85 - end += line.length() + 1;
34.86 - } else {
34.87 - break;
34.88 - }
34.89 - }
34.90 - return new Offsets (0, end);
34.91 - }
34.92 -
34.93 - @Override
34.94 - protected String escape(String licenseText) {
34.95 - String[] lines = splitIntoLines(licenseText);
34.96 - StringBuilder sb = new StringBuilder();
34.97 - for (int i = 0; i < lines.length; i++) {
34.98 - String line = lines[i];
34.99 - if (line.trim().length() == 0) {
34.100 - sb.append ("#");
34.101 - } else {
34.102 - sb.append ("# ");
34.103 - sb.append (line);
34.104 - }
34.105 - sb.append ("\n");
34.106 - }
34.107 - return sb.toString();
34.108 - }
34.109 -}
35.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/XmlFileHandler.java Thu Aug 30 10:56:16 2012 +0200
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,237 +0,0 @@
35.4 -/*
35.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
35.6 - *
35.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
35.8 - *
35.9 - * The contents of this file are subject to the terms of either the GNU
35.10 - * General Public License Version 2 only ("GPL") or the Common
35.11 - * Development and Distribution License("CDDL") (collectively, the
35.12 - * "License"). You may not use this file except in compliance with the
35.13 - * License. You can obtain a copy of the License at
35.14 - * http://www.netbeans.org/cddl-gplv2.html
35.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
35.16 - * specific language governing permissions and limitations under the
35.17 - * License. When distributing the software, include this License Header
35.18 - * Notice in each file and include the License file at
35.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
35.20 - * particular file as subject to the "Classpath" exception as provided
35.21 - * by Sun in the GPL Version 2 section of the License file that
35.22 - * accompanied this code. If applicable, add the following below the
35.23 - * License Header, with the fields enclosed by brackets [] replaced by
35.24 - * your own identifying information:
35.25 - * "Portions Copyrighted [year] [name of copyright owner]"
35.26 - *
35.27 - * If you wish your version of this file to be governed by only the CDDL
35.28 - * or only the GPL Version 2, indicate your decision by adding
35.29 - * "[Contributor] elects to include this software in this distribution
35.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
35.31 - * single choice of license, a recipient has the option to distribute
35.32 - * your version of this file under either the CDDL, the GPL Version 2 or
35.33 - * to extend the choice of license to its licensees as provided above.
35.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
35.35 - * Version 2 license, then the option applies only if the new code is
35.36 - * made subject to such option by the copyright holder.
35.37 - *
35.38 - * Contributor(s):
35.39 - *
35.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
35.41 - */
35.42 -
35.43 -package org.netbeans.modules.licensechanger.handlers;
35.44 -
35.45 -import java.awt.Component;
35.46 -import java.io.CharConversionException;
35.47 -import java.util.regex.Matcher;
35.48 -import java.util.regex.Pattern;
35.49 -import org.netbeans.modules.licensechanger.Offsets;
35.50 -import org.netbeans.modules.licensechanger.api.Customizable;
35.51 -import org.netbeans.modules.licensechanger.api.FileHandler;
35.52 -import org.openide.filesystems.FileObject;
35.53 -import org.openide.util.Exceptions;
35.54 -import org.openide.util.NbBundle;
35.55 -import org.openide.util.NbPreferences;
35.56 -import org.openide.xml.XMLUtil;
35.57 -
35.58 -/**
35.59 - *
35.60 - * @author Tim Boudreau
35.61 - */
35.62 -@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
35.63 -public class XmlFileHandler extends FileHandler implements Customizable {
35.64 -
35.65 - @Override
35.66 - public boolean match(FileObject file) {
35.67 - String ext = file.getExt();
35.68 - String mime = file.getMIMEType();
35.69 - return "xml".equals (file.getExt()) || "text/xml".equals(mime) ||
35.70 - "application/xml".equals(mime) || mime.endsWith("+xml");
35.71 - }
35.72 -
35.73 - @Override
35.74 - public boolean shouldSkipFile(FileObject file) {
35.75 - String n = file.getNameExt();
35.76 - return "project.xml".equals(n) ||
35.77 - "private.xml".equals(n) || "build.xml".equals(n) ||
35.78 - "build-impl.xml".equals(n);
35.79 - }
35.80 -
35.81 - @Override
35.82 - public String getDisplayName() {
35.83 - return NbBundle.getMessage(XmlFileHandler.class, "NAME_XML_FILES");
35.84 - }
35.85 -
35.86 - @Override
35.87 - protected Offsets getReplaceOffsets(CharSequence seq) {
35.88 - String[] lines = splitIntoLines(seq);
35.89 - LineVisitor v = new LineVisitor();
35.90 - for (int i=0; i < lines.length; i++) {
35.91 - String line = lines[i];
35.92 - if (!v.visitLine(line)) {
35.93 - break;
35.94 - }
35.95 - }
35.96 - return new Offsets (v.start, v.delCount);
35.97 - }
35.98 -
35.99 - @Override
35.100 - protected String escape(String licenseText) {
35.101 - try {
35.102 - licenseText = XMLUtil.toElementContent(licenseText);
35.103 - } catch (CharConversionException ex) {
35.104 - Exceptions.printStackTrace(ex);
35.105 - }
35.106 - return "<!--\n" + licenseText + "\n-->\n";
35.107 - }
35.108 -
35.109 - static Pattern xmlDeclaration = Pattern.compile ("(<\\?xml.*?\\?>)");
35.110 -
35.111 - public Component getCustomizer() {
35.112 - return new XmlHandlerCustomizer();
35.113 - }
35.114 -
35.115 - public static boolean isInsertAtTopOfFile() {
35.116 - return NbPreferences.forModule(XmlFileHandler.class).getBoolean("atTop", false);
35.117 - }
35.118 -
35.119 - public static void setInsertAtTopOfFile (boolean val) {
35.120 - NbPreferences.forModule(XmlFileHandler.class).putBoolean("atTop", val);
35.121 - }
35.122 -
35.123 - private static final class XmlDeclarationLocator {
35.124 - int declarationStartIndex;
35.125 - int declarationEndIndex;
35.126 - boolean isMidLine;
35.127 - public boolean visitLine(String line) {
35.128 - Matcher m = xmlDeclaration.matcher (line);
35.129 - if (m.find()) {
35.130 - declarationStartIndex += m.start(1);
35.131 - declarationEndIndex = declarationStartIndex + m.end(1);
35.132 - isMidLine = m.end(1) < line.length() - 1;
35.133 - return false;
35.134 - } else {
35.135 - declarationStartIndex += line.length() + 1;
35.136 - return true;
35.137 - }
35.138 - }
35.139 -
35.140 - boolean foundDeclaration() {
35.141 - return declarationEndIndex != 0;
35.142 - }
35.143 - }
35.144 -
35.145 - @Override
35.146 - public String transform(String origText, String licenseText) {
35.147 - String[] lines = splitIntoLines(origText);
35.148 - XmlDeclarationLocator v = new XmlDeclarationLocator();
35.149 - for (int i=0; i < lines.length; i++) {
35.150 - if (!v.visitLine(lines[i])) {
35.151 - break;
35.152 - }
35.153 - }
35.154 - if (v.foundDeclaration()) {
35.155 - StringBuilder sb = new StringBuilder (origText);
35.156 - sb.delete(0, v.declarationStartIndex);
35.157 - origText = sb.toString();
35.158 - }
35.159 - String license = escape (licenseText);
35.160 - license = "\n" + license;
35.161 - StringBuilder sb = new StringBuilder (origText);
35.162 - Offsets o = getReplaceOffsets(sb);
35.163 - sb.delete(o.getStart(), o.getEnd());
35.164 - lines = splitIntoLines(origText);
35.165 - v = new XmlDeclarationLocator();
35.166 - for (int i=0; i < lines.length; i++) {
35.167 - if (!v.visitLine(lines[i])) {
35.168 - break;
35.169 - }
35.170 - }
35.171 - if (v.foundDeclaration()) {
35.172 - sb.insert(v.declarationEndIndex, license);
35.173 - } else {
35.174 - sb.insert(isInsertAtTopOfFile() ? 0 : o.getStart(), license);
35.175 - }
35.176 - return sb.toString();
35.177 - }
35.178 -
35.179 -
35.180 -
35.181 - private static final class LineVisitor {
35.182 - private boolean inComment;
35.183 - int delCount;
35.184 - int start;
35.185 - public boolean visitLine (String line) {
35.186 - if (start == 0) {
35.187 - if (line.trim().startsWith("<?xml ")) {
35.188 - start += line.length() + 1;
35.189 - delCount += start;
35.190 - return true;
35.191 - }
35.192 - }
35.193 - String trimmed = line.trim();
35.194 - if (trimmed.startsWith("<!--") && trimmed.endsWith("-->")) {
35.195 - return visitCommentLine(line);
35.196 - } else if (trimmed.length() == 0) {
35.197 - return visitEmptyLine (line);
35.198 - } else if (inComment) {
35.199 - return visitLineInComment (line);
35.200 - } else {
35.201 - return visitLineAndTestForComment (line);
35.202 - }
35.203 - }
35.204 -
35.205 - private boolean visitCommentLine(String line) {
35.206 - delCount += line.length() + 1;
35.207 - return true;
35.208 - }
35.209 -
35.210 - private boolean visitEmptyLine(String line) {
35.211 - delCount += line.length() + 1;
35.212 - return true;
35.213 - }
35.214 -
35.215 - private boolean visitLineAndTestForComment(String line) {
35.216 - if (line.trim().startsWith("<!--")) {
35.217 - inComment = true;
35.218 - delCount += line.length() + 1;
35.219 - return true;
35.220 - }
35.221 - return false;
35.222 - }
35.223 -
35.224 - private boolean visitLineInComment(String line) {
35.225 - if (line.trim().endsWith("-->")) {
35.226 - inComment = false;
35.227 - delCount += line.length() + 1;
35.228 - return true;
35.229 - }
35.230 - int ix = line.indexOf("-->");
35.231 - if (ix >= 0) {
35.232 - delCount += ix + 3;
35.233 - return false;
35.234 - } else {
35.235 - delCount += line.length() + 1;
35.236 - return true;
35.237 - }
35.238 - }
35.239 - }
35.240 -}
36.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/XmlHandlerCustomizer.form Thu Aug 30 10:56:16 2012 +0200
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,74 +0,0 @@
36.4 -<?xml version="1.0" encoding="UTF-8" ?>
36.5 -
36.6 -<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
36.7 - <NonVisualComponents>
36.8 - <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
36.9 - </Component>
36.10 - </NonVisualComponents>
36.11 - <AuxValues>
36.12 - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
36.13 - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
36.14 - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
36.15 - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
36.16 - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
36.17 - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
36.18 - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
36.19 - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
36.20 - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
36.21 - </AuxValues>
36.22 -
36.23 - <Layout>
36.24 - <DimensionLayout dim="0">
36.25 - <Group type="103" groupAlignment="0" attributes="0">
36.26 - <Group type="102" attributes="0">
36.27 - <EmptySpace max="-2" attributes="0"/>
36.28 - <Group type="103" groupAlignment="0" attributes="0">
36.29 - <Component id="beforeButton" alignment="0" min="-2" max="-2" attributes="0"/>
36.30 - <Component id="afterButton" alignment="0" min="-2" max="-2" attributes="0"/>
36.31 - </Group>
36.32 - <EmptySpace max="32767" attributes="0"/>
36.33 - </Group>
36.34 - </Group>
36.35 - </DimensionLayout>
36.36 - <DimensionLayout dim="1">
36.37 - <Group type="103" groupAlignment="0" attributes="0">
36.38 - <Group type="102" alignment="0" attributes="0">
36.39 - <EmptySpace max="-2" attributes="0"/>
36.40 - <Component id="beforeButton" min="-2" max="-2" attributes="0"/>
36.41 - <EmptySpace type="unrelated" max="-2" attributes="0"/>
36.42 - <Component id="afterButton" min="-2" max="-2" attributes="0"/>
36.43 - <EmptySpace max="32767" attributes="0"/>
36.44 - </Group>
36.45 - </Group>
36.46 - </DimensionLayout>
36.47 - </Layout>
36.48 - <SubComponents>
36.49 - <Component class="javax.swing.JRadioButton" name="beforeButton">
36.50 - <Properties>
36.51 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
36.52 - <ComponentRef name="buttonGroup1"/>
36.53 - </Property>
36.54 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
36.55 - <ResourceString bundle="org/netbeans/modules/licensechanger/handlers/Bundle.properties" key="XmlHandlerCustomizer.beforeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
36.56 - </Property>
36.57 - </Properties>
36.58 - <Events>
36.59 - <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="licensePreferenceChanged"/>
36.60 - </Events>
36.61 - </Component>
36.62 - <Component class="javax.swing.JRadioButton" name="afterButton">
36.63 - <Properties>
36.64 - <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
36.65 - <ComponentRef name="buttonGroup1"/>
36.66 - </Property>
36.67 - <Property name="selected" type="boolean" value="true"/>
36.68 - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
36.69 - <ResourceString bundle="org/netbeans/modules/licensechanger/handlers/Bundle.properties" key="XmlHandlerCustomizer.afterButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
36.70 - </Property>
36.71 - </Properties>
36.72 - <Events>
36.73 - <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="licensePreferenceChanged"/>
36.74 - </Events>
36.75 - </Component>
36.76 - </SubComponents>
36.77 -</Form>
37.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/handlers/XmlHandlerCustomizer.java Thu Aug 30 10:56:16 2012 +0200
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,119 +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 -package org.netbeans.modules.licensechanger.handlers;
37.43 -
37.44 -/**
37.45 - *
37.46 - * @author Tim Boudreau
37.47 - */
37.48 -public class XmlHandlerCustomizer extends javax.swing.JPanel {
37.49 - boolean init;
37.50 - /** Creates new form XmlHandlerCustomizer */
37.51 - public XmlHandlerCustomizer() {
37.52 - initComponents();
37.53 - afterButton.setSelected (!XmlFileHandler.isInsertAtTopOfFile());
37.54 - beforeButton.setSelected(!afterButton.isSelected());
37.55 - init = true;
37.56 - }
37.57 -
37.58 - /** This method is called from within the constructor to
37.59 - * initialize the form.
37.60 - * WARNING: Do NOT modify this code. The content of this method is
37.61 - * always regenerated by the Form Editor.
37.62 - */
37.63 - @SuppressWarnings("unchecked")
37.64 - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
37.65 - private void initComponents() {
37.66 -
37.67 - buttonGroup1 = new javax.swing.ButtonGroup();
37.68 - beforeButton = new javax.swing.JRadioButton();
37.69 - afterButton = new javax.swing.JRadioButton();
37.70 -
37.71 - buttonGroup1.add(beforeButton);
37.72 - beforeButton.setText(org.openide.util.NbBundle.getMessage(XmlHandlerCustomizer.class, "XmlHandlerCustomizer.beforeButton.text")); // NOI18N
37.73 - beforeButton.addItemListener(new java.awt.event.ItemListener() {
37.74 - public void itemStateChanged(java.awt.event.ItemEvent evt) {
37.75 - licensePreferenceChanged(evt);
37.76 - }
37.77 - });
37.78 -
37.79 - buttonGroup1.add(afterButton);
37.80 - afterButton.setSelected(true);
37.81 - afterButton.setText(org.openide.util.NbBundle.getMessage(XmlHandlerCustomizer.class, "XmlHandlerCustomizer.afterButton.text")); // NOI18N
37.82 - afterButton.addItemListener(new java.awt.event.ItemListener() {
37.83 - public void itemStateChanged(java.awt.event.ItemEvent evt) {
37.84 - licensePreferenceChanged(evt);
37.85 - }
37.86 - });
37.87 -
37.88 - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
37.89 - this.setLayout(layout);
37.90 - layout.setHorizontalGroup(
37.91 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
37.92 - .add(layout.createSequentialGroup()
37.93 - .addContainerGap()
37.94 - .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
37.95 - .add(beforeButton)
37.96 - .add(afterButton))
37.97 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
37.98 - );
37.99 - layout.setVerticalGroup(
37.100 - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
37.101 - .add(layout.createSequentialGroup()
37.102 - .addContainerGap()
37.103 - .add(beforeButton)
37.104 - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
37.105 - .add(afterButton)
37.106 - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
37.107 - );
37.108 - }// </editor-fold>//GEN-END:initComponents
37.109 -
37.110 - private void licensePreferenceChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_licensePreferenceChanged
37.111 - if (!init) return;
37.112 - XmlFileHandler.setInsertAtTopOfFile(beforeButton.isSelected());
37.113 - }//GEN-LAST:event_licensePreferenceChanged
37.114 -
37.115 -
37.116 - // Variables declaration - do not modify//GEN-BEGIN:variables
37.117 - private javax.swing.JRadioButton afterButton;
37.118 - private javax.swing.JRadioButton beforeButton;
37.119 - private javax.swing.ButtonGroup buttonGroup1;
37.120 - // End of variables declaration//GEN-END:variables
37.121 -
37.122 -}
38.1 --- a/licensechanger/src/org/netbeans/modules/licensechanger/layer.xml Thu Aug 30 10:56:16 2012 +0200
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,21 +0,0 @@
38.4 -<?xml version="1.0" encoding="UTF-8"?>
38.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
38.6 -<filesystem>
38.7 - <folder name="Actions">
38.8 - <folder name="Tools">
38.9 - <file name="org-netbeans-modules-licensechanger-ChangeLicenseAction.instance"/>
38.10 - </folder>
38.11 - </folder>
38.12 - <folder name="Loaders">
38.13 - <folder name="folder">
38.14 - <folder name="any">
38.15 - <folder name="Actions">
38.16 - <file name="org-netbeans-modules-licensechanger-ChangeLicenseAction.shadow">
38.17 - <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-licensechanger-ChangeLicenseAction.instance"/>
38.18 - <attr name="position" intvalue="951"/>
38.19 - </file>
38.20 - </folder>
38.21 - </folder>
38.22 - </folder>
38.23 - </folder>
38.24 -</filesystem>
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/Bundle.properties Thu Sep 13 09:10:03 2012 +0200
39.3 @@ -0,0 +1,42 @@
39.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
39.5 +#
39.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
39.7 +#
39.8 +# The contents of this file are subject to the terms of either the GNU
39.9 +# General Public License Version 2 only ("GPL") or the Common
39.10 +# Development and Distribution License("CDDL") (collectively, the
39.11 +# "License"). You may not use this file except in compliance with the
39.12 +# License. You can obtain a copy of the License at
39.13 +# http://www.netbeans.org/cddl-gplv2.html
39.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
39.15 +# specific language governing permissions and limitations under the
39.16 +# License. When distributing the software, include this License Header
39.17 +# Notice in each file and include the License file at
39.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
39.19 +# particular file as subject to the "Classpath" exception as provided
39.20 +# by Sun in the GPL Version 2 section of the License file that
39.21 +# accompanied this code. If applicable, add the following below the
39.22 +# License Header, with the fields enclosed by brackets [] replaced by
39.23 +# your own identifying information:
39.24 +# "Portions Copyrighted [year] [name of copyright owner]"
39.25 +#
39.26 +# If you wish your version of this file to be governed by only the CDDL
39.27 +# or only the GPL Version 2, indicate your decision by adding
39.28 +# "[Contributor] elects to include this software in this distribution
39.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
39.30 +# single choice of license, a recipient has the option to distribute
39.31 +# your version of this file under either the CDDL, the GPL Version 2 or
39.32 +# to extend the choice of license to its licensees as provided above.
39.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
39.34 +# Version 2 license, then the option applies only if the new code is
39.35 +# made subject to such option by the copyright holder.
39.36 +#
39.37 +# Contributor(s):
39.38 +#
39.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
39.40 +NAME_JAVA_FILES=Java Files
39.41 +NAME_JAVAFX_FILES=JavaFX Files
39.42 +NAME_PROPERTIES_FILES=Properties Files
39.43 +NAME_XML_FILES=XML Files
39.44 +XmlHandlerCustomizer.beforeButton.text=Insert License Before XML Declaration
39.45 +XmlHandlerCustomizer.afterButton.text=Insert License After XML Declaration
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandler.java Thu Sep 13 09:10:03 2012 +0200
40.3 @@ -0,0 +1,214 @@
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 +package org.netbeans.modules.licensechanger.spi.handlers;
40.43 +
40.44 +import org.netbeans.modules.licensechanger.api.FileHandler;
40.45 +import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
40.46 +import org.openide.filesystems.FileObject;
40.47 +import org.openide.util.NbBundle;
40.48 +
40.49 +/**
40.50 + *
40.51 + * @author Tim Boudreau
40.52 + */
40.53 +@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
40.54 +public class JavaFileHandler extends FileHandler {
40.55 +
40.56 + @Override
40.57 + public String getDisplayName() {
40.58 + return NbBundle.getMessage(JavaFileHandler.class, "NAME_JAVA_FILES"); //NOI18N
40.59 + }
40.60 +
40.61 + @Override
40.62 + public boolean match(FileObject file) {
40.63 + return "text/x-java".equals(file.getMIMEType()); //NOI18N
40.64 + }
40.65 +
40.66 + @Override
40.67 + public boolean shouldSkipFile(FileObject file) {
40.68 + return false;
40.69 + }
40.70 +
40.71 + @Override
40.72 + protected Offsets getReplaceOffsets(CharSequence seq) {
40.73 + String[] lines = splitIntoLines(seq);
40.74 + LineVisitor v = new LineVisitor();
40.75 + for (int i=0; i < lines.length; i++) {
40.76 + String line = lines[i];
40.77 + if (!v.visitLine(line)) {
40.78 + break;
40.79 + }
40.80 + }
40.81 + return new Offsets (0, v.delCount);
40.82 + }
40.83 +
40.84 + @Override
40.85 + protected String licenseFirst() {
40.86 + return "/* ";
40.87 + }
40.88 +
40.89 + @Override
40.90 + protected String licensePrefix() {
40.91 + return " * ";
40.92 + }
40.93 +
40.94 + @Override
40.95 + protected String licenseLast() {
40.96 + return " */";
40.97 + }
40.98 +
40.99 + private static final class LineVisitor {
40.100 + private boolean inComment;
40.101 + int delCount;
40.102 + public boolean visitLine (String line) {
40.103 + String trimmed = line.trim();
40.104 + if (trimmed.startsWith("//") || trimmed.startsWith("/*") && trimmed.endsWith("*/")) {
40.105 + return visitCommentLine(line);
40.106 + } else if (trimmed.length() == 0) {
40.107 + return visitEmptyLine (line);
40.108 + } else if (inComment) {
40.109 + return visitLineInComment (line);
40.110 + } else {
40.111 + return visitLineAndTestForComment (line);
40.112 + }
40.113 + }
40.114 +
40.115 + private boolean visitCommentLine(String line) {
40.116 + delCount += line.length() + 1;
40.117 + return true;
40.118 + }
40.119 +
40.120 + private boolean visitEmptyLine(String line) {
40.121 + delCount += line.length() + 1;
40.122 + return true;
40.123 + }
40.124 +
40.125 + private boolean visitLineAndTestForComment(String line) {
40.126 + if (line.trim().startsWith("/*")) {
40.127 + inComment = true;
40.128 + delCount += line.length() + 1;
40.129 + return true;
40.130 + }
40.131 + return false;
40.132 + }
40.133 +
40.134 + private boolean visitLineInComment(String line) {
40.135 + if (line.trim().endsWith("*/")) {
40.136 + inComment = false;
40.137 + delCount += line.length() + 1;
40.138 + return true;
40.139 + }
40.140 + int ix = line.indexOf("*/");
40.141 + if (ix >= 0) {
40.142 + delCount += ix + 2;
40.143 + return false;
40.144 + } else {
40.145 + delCount += line.length() + 1;
40.146 + return true;
40.147 + }
40.148 + }
40.149 + }
40.150 +
40.151 +
40.152 +// @Override
40.153 +// protected Offsets getReplaceOffsets(CharSequence seq) {
40.154 +// int end2 = 0;
40.155 +// boolean inComment = false;
40.156 +// boolean maybeLast = false;
40.157 +// int lineLen;
40.158 +// for (StringTokenizer tok = new StringTokenizer(seq.toString(), "\n", true); tok.hasMoreTokens();) {
40.159 +// String line = tok.nextToken();
40.160 +// lineLen = line.length();
40.161 +// System.err.println("InComment? " + inComment + " Check line: " + line);
40.162 +// String trimmed = line.trim();
40.163 +// boolean lineWasComment = trimmed.length() == 0 || trimmed.startsWith("//");
40.164 +// System.err.println(" was comment? " + lineWasComment);
40.165 +// if (maybeLast && !lineWasComment && !trimmed.startsWith("/*")) {
40.166 +// break;
40.167 +// }
40.168 +// if (!lineWasComment && !inComment) {
40.169 +// int cmtStartIx = trimmed.indexOf("/*");
40.170 +// if (cmtStartIx >= 0) {
40.171 +// int cmtEndIx = trimmed.indexOf("*/");
40.172 +// if (cmtEndIx < 0) {
40.173 +// inComment = true;
40.174 +// } else if (trimmed.endsWith("*/")) {
40.175 +// inComment = false;
40.176 +// lineWasComment = true;
40.177 +// continue;
40.178 +// }
40.179 +// }
40.180 +// } else if (!lineWasComment && inComment) {
40.181 +// int cmtEndIx = line.indexOf("*/");
40.182 +// if (cmtEndIx >= 0 && !trimmed.endsWith("*/")) {
40.183 +// // e.g. blah blah */package foo.bar;
40.184 +// break;
40.185 +// } else if (cmtEndIx > 0) {
40.186 +// maybeLast = true;
40.187 +// inComment = false;
40.188 +// }
40.189 +// }
40.190 +// if (!lineWasComment && !inComment && !maybeLast) {
40.191 +// break;
40.192 +// }
40.193 +// end2 += lineLen;
40.194 +// }
40.195 +// return new Offsets(0, end2);
40.196 +// }
40.197 +
40.198 + @Override
40.199 + protected String escape(String licenseText) {
40.200 + StringBuilder sb = new StringBuilder(licenseText.length() + 30);
40.201 + String[] lines = splitIntoLines (licenseText);
40.202 + sb.append ("/*\n");
40.203 + for (int i = 0; i < lines.length; i++) {
40.204 + String line = lines[i];
40.205 + boolean empty = line.trim().length() == 0;
40.206 + if (empty) {
40.207 + sb.append (" *");
40.208 + } else {
40.209 + sb.append (" * ");
40.210 + sb.append (line);
40.211 + }
40.212 + sb.append("\n");
40.213 + }
40.214 + sb.append(" */\n");
40.215 + return sb.toString();
40.216 + }
40.217 +}
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFxFileHandler.java Thu Sep 13 09:10:03 2012 +0200
41.3 @@ -0,0 +1,57 @@
41.4 +/*
41.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
41.6 + *
41.7 + * Copyright 2010 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 2010 Sun Microsystems, Inc.
41.41 + */
41.42 +
41.43 +package org.netbeans.modules.licensechanger.spi.handlers;
41.44 +
41.45 +import org.openide.filesystems.FileObject;
41.46 +import org.openide.util.NbBundle;
41.47 +
41.48 +@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
41.49 +public class JavaFxFileHandler extends JavaFileHandler {
41.50 + @Override
41.51 + public String getDisplayName() {
41.52 + return NbBundle.getMessage(JavaFxFileHandler.class, "NAME_JAVAFX_FILES"); //NOI18N
41.53 + }
41.54 +
41.55 + @Override
41.56 + public boolean match(FileObject file) {
41.57 + return "text/x-fx".equals(file.getMIMEType()); //NOI18N
41.58 + }
41.59 +}
41.60 +
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandler.java Thu Sep 13 09:10:03 2012 +0200
42.3 @@ -0,0 +1,122 @@
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.handlers;
42.44 +
42.45 +import org.netbeans.modules.licensechanger.api.FileHandler;
42.46 +import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
42.47 +import org.openide.filesystems.FileObject;
42.48 +import org.openide.util.NbBundle;
42.49 +
42.50 +/**
42.51 + * License transformer for properties files
42.52 + *
42.53 + * @author Tim Boudreau
42.54 + */
42.55 +@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
42.56 +public class PropertiesFileHandler extends FileHandler {
42.57 +
42.58 + @Override
42.59 + public String getDisplayName() {
42.60 + return NbBundle.getMessage (JavaFileHandler.class, "NAME_PROPERTIES_FILES"); //NOI18N
42.61 + }
42.62 +
42.63 + @Override
42.64 + public boolean match(FileObject file) {
42.65 + return "properties".equals (file.getExt());
42.66 + }
42.67 +
42.68 + @Override
42.69 + public boolean shouldSkipFile(FileObject file) {
42.70 + String n = file.getNameExt();
42.71 + return "project.properties".equals(n) || "private.properties".equals(n) || //NOI18N
42.72 + "platform-private.properties".equals(n) || "genfiles.properties".equals(n)
42.73 + || "config.properties".equals(n) || "nblibraries-private.properties".equals(n) ||
42.74 + "nblibraries.properties".equals(n); //NOI18N
42.75 + }
42.76 +
42.77 + @Override
42.78 + protected Offsets getReplaceOffsets(CharSequence seq) {
42.79 + String[] lines = splitIntoLines(seq);
42.80 + int end = 0;
42.81 + for (int i = 0; i < lines.length; i++) {
42.82 + String line = lines[i];
42.83 + if (line.trim().length() == 0) {
42.84 + end += line.length() + 1;
42.85 + } else if (line.trim().startsWith("#")) {
42.86 + end += line.length() + 1;
42.87 + } else {
42.88 + break;
42.89 + }
42.90 + }
42.91 + return new Offsets (0, end);
42.92 + }
42.93 +
42.94 + @Override
42.95 + protected String escape(String licenseText) {
42.96 + String[] lines = splitIntoLines(licenseText);
42.97 + StringBuilder sb = new StringBuilder();
42.98 + for (int i = 0; i < lines.length; i++) {
42.99 + String line = lines[i];
42.100 + if (line.trim().length() == 0) {
42.101 + sb.append ("#");
42.102 + } else {
42.103 + sb.append ("# ");
42.104 + sb.append (line);
42.105 + }
42.106 + sb.append ("\n");
42.107 + }
42.108 + return sb.toString();
42.109 + }
42.110 +
42.111 + @Override
42.112 + protected String licenseFirst() {
42.113 + return licensePrefix();
42.114 + }
42.115 +
42.116 + @Override
42.117 + protected String licensePrefix() {
42.118 + return "# ";
42.119 + }
42.120 +
42.121 + @Override
42.122 + protected String licenseLast() {
42.123 + return licensePrefix();
42.124 + }
42.125 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandler.java Thu Sep 13 09:10:03 2012 +0200
43.3 @@ -0,0 +1,254 @@
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.handlers;
43.44 +
43.45 +import java.awt.Component;
43.46 +import java.io.CharConversionException;
43.47 +import java.util.regex.Matcher;
43.48 +import java.util.regex.Pattern;
43.49 +import org.netbeans.modules.licensechanger.api.Customizable;
43.50 +import org.netbeans.modules.licensechanger.api.FileHandler;
43.51 +import org.netbeans.modules.licensechanger.spi.wizard.utils.Offsets;
43.52 +import org.openide.filesystems.FileObject;
43.53 +import org.openide.util.Exceptions;
43.54 +import org.openide.util.NbBundle;
43.55 +import org.openide.util.NbPreferences;
43.56 +import org.openide.xml.XMLUtil;
43.57 +
43.58 +/**
43.59 + *
43.60 + * @author Tim Boudreau
43.61 + */
43.62 +@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.licensechanger.api.FileHandler.class)
43.63 +public class XmlFileHandler extends FileHandler{// implements Customizable {
43.64 +
43.65 + @Override
43.66 + public boolean match(FileObject file) {
43.67 + String ext = file.getExt();
43.68 + String mime = file.getMIMEType();
43.69 + return "xml".equals (file.getExt()) || "text/xml".equals(mime) ||
43.70 + "application/xml".equals(mime) || mime.endsWith("+xml");
43.71 + }
43.72 +
43.73 + @Override
43.74 + public boolean shouldSkipFile(FileObject file) {
43.75 + String n = file.getNameExt();
43.76 + return "project.xml".equals(n) ||
43.77 + "private.xml".equals(n) || "build.xml".equals(n) ||
43.78 + "build-impl.xml".equals(n) || "pom.xml".equals(n);
43.79 + }
43.80 +
43.81 + @Override
43.82 + public String getDisplayName() {
43.83 + return NbBundle.getMessage(XmlFileHandler.class, "NAME_XML_FILES");
43.84 + }
43.85 +
43.86 + @Override
43.87 + protected Offsets getReplaceOffsets(CharSequence seq) {
43.88 + String[] lines = splitIntoLines(seq);
43.89 + LineVisitor v = new LineVisitor();
43.90 + for (int i=0; i < lines.length; i++) {
43.91 + String line = lines[i];
43.92 + if (!v.visitLine(line)) {
43.93 + break;
43.94 + }
43.95 + }
43.96 + return new Offsets (v.start, v.delCount);
43.97 + }
43.98 +
43.99 + @Override
43.100 + protected String escape(String licenseText) {
43.101 + try {
43.102 + licenseText = XMLUtil.toElementContent(licenseText);
43.103 + } catch (CharConversionException ex) {
43.104 + Exceptions.printStackTrace(ex);
43.105 + }
43.106 + return "<!--\n" + licenseText + "\n-->\n";
43.107 + }
43.108 +
43.109 + static Pattern xmlDeclaration = Pattern.compile ("(<\\?xml.*?\\?>)");
43.110 +
43.111 +// @Override
43.112 +// public Component getCustomizer() {
43.113 +// return new XmlHandlerCustomizer();
43.114 +// }
43.115 +
43.116 + public static boolean isInsertAtTopOfFile() {
43.117 + return NbPreferences.forModule(XmlFileHandler.class).getBoolean("atTop", false);
43.118 + }
43.119 +
43.120 + public static void setInsertAtTopOfFile (boolean val) {
43.121 + NbPreferences.forModule(XmlFileHandler.class).putBoolean("atTop", val);
43.122 + }
43.123 +
43.124 + @Override
43.125 + protected String licenseFirst() {
43.126 + return "<!--";
43.127 + }
43.128 +
43.129 + @Override
43.130 + protected String licensePrefix() {
43.131 + return "";
43.132 + }
43.133 +
43.134 + @Override
43.135 + protected String licenseLast() {
43.136 + return "-->";
43.137 + }
43.138 +
43.139 + private static final class XmlDeclarationLocator {
43.140 + int declarationStartIndex;
43.141 + int declarationEndIndex;
43.142 + boolean isMidLine;
43.143 + public boolean visitLine(String line) {
43.144 + Matcher m = xmlDeclaration.matcher (line);
43.145 + if (m.find()) {
43.146 + declarationStartIndex += m.start(1);
43.147 + declarationEndIndex = declarationStartIndex + m.end(1);
43.148 + isMidLine = m.end(1) < line.length() - 1;
43.149 + return false;
43.150 + } else {
43.151 + declarationStartIndex += line.length() + 1;
43.152 + return true;
43.153 + }
43.154 + }
43.155 +
43.156 + boolean foundDeclaration() {
43.157 + return declarationEndIndex != 0;
43.158 + }
43.159 + }
43.160 +
43.161 + @Override
43.162 + public String transform(String origText, String licenseText) {
43.163 + String[] lines = splitIntoLines(origText);
43.164 + XmlDeclarationLocator v = new XmlDeclarationLocator();
43.165 + for (int i=0; i < lines.length; i++) {
43.166 + if (!v.visitLine(lines[i])) {
43.167 + break;
43.168 + }
43.169 + }
43.170 + if (v.foundDeclaration()) {
43.171 + StringBuilder sb = new StringBuilder (origText);
43.172 + sb.delete(0, v.declarationStartIndex);
43.173 + origText = sb.toString();
43.174 + }
43.175 +// String license = escape (licenseText);
43.176 + String license = resolveLicenseTemplate(licenseText);
43.177 + license = "\n" + license;
43.178 + StringBuilder sb = new StringBuilder (origText);
43.179 + Offsets o = getReplaceOffsets(sb);
43.180 + sb.delete(o.getStart(), o.getEnd());
43.181 + lines = splitIntoLines(origText);
43.182 + v = new XmlDeclarationLocator();
43.183 + for (int i=0; i < lines.length; i++) {
43.184 + if (!v.visitLine(lines[i])) {
43.185 + break;
43.186 + }
43.187 + }
43.188 + if (v.foundDeclaration()) {
43.189 + sb.insert(v.declarationEndIndex, license);
43.190 + } else {
43.191 + sb.insert(isInsertAtTopOfFile() ? 0 : o.getStart(), license);
43.192 + }
43.193 + return sb.toString();
43.194 + }
43.195 +
43.196 +
43.197 +
43.198 + private static final class LineVisitor {
43.199 + private boolean inComment;
43.200 + int delCount;
43.201 + int start;
43.202 + public boolean visitLine (String line) {
43.203 + if (start == 0) {
43.204 + if (line.trim().startsWith("<?xml ")) {
43.205 + start += line.length() + 1;
43.206 + delCount += start;
43.207 + return true;
43.208 + }
43.209 + }
43.210 + String trimmed = line.trim();
43.211 + if (trimmed.startsWith("<!--") && trimmed.endsWith("-->")) {
43.212 + return visitCommentLine(line);
43.213 + } else if (trimmed.length() == 0) {
43.214 + return visitEmptyLine (line);
43.215 + } else if (inComment) {
43.216 + return visitLineInComment (line);
43.217 + } else {
43.218 + return visitLineAndTestForComment (line);
43.219 + }
43.220 + }
43.221 +
43.222 + private boolean visitCommentLine(String line) {
43.223 + delCount += line.length() + 1;
43.224 + return true;
43.225 + }
43.226 +
43.227 + private boolean visitEmptyLine(String line) {
43.228 + delCount += line.length() + 1;
43.229 + return true;
43.230 + }
43.231 +
43.232 + private boolean visitLineAndTestForComment(String line) {
43.233 + if (line.trim().startsWith("<!--")) {
43.234 + inComment = true;
43.235 + delCount += line.length() + 1;
43.236 + return true;
43.237 + }
43.238 + return false;
43.239 + }
43.240 +
43.241 + private boolean visitLineInComment(String line) {
43.242 + if (line.trim().endsWith("-->")) {
43.243 + inComment = false;
43.244 + delCount += line.length() + 1;
43.245 + return true;
43.246 + }
43.247 + int ix = line.indexOf("-->");
43.248 + if (ix >= 0) {
43.249 + delCount += ix + 3;
43.250 + return false;
43.251 + } else {
43.252 + delCount += line.length() + 1;
43.253 + return true;
43.254 + }
43.255 + }
43.256 + }
43.257 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlHandlerCustomizer.form Thu Sep 13 09:10:03 2012 +0200
44.3 @@ -0,0 +1,74 @@
44.4 +<?xml version="1.0" encoding="UTF-8" ?>
44.5 +
44.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
44.7 + <NonVisualComponents>
44.8 + <Component class="javax.swing.ButtonGroup" name="buttonGroup1">
44.9 + </Component>
44.10 + </NonVisualComponents>
44.11 + <AuxValues>
44.12 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
44.13 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
44.14 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
44.15 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
44.16 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
44.17 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
44.18 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
44.19 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
44.20 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
44.21 + </AuxValues>
44.22 +
44.23 + <Layout>
44.24 + <DimensionLayout dim="0">
44.25 + <Group type="103" groupAlignment="0" attributes="0">
44.26 + <Group type="102" attributes="0">
44.27 + <EmptySpace max="-2" attributes="0"/>
44.28 + <Group type="103" groupAlignment="0" attributes="0">
44.29 + <Component id="beforeButton" alignment="0" min="-2" max="-2" attributes="0"/>
44.30 + <Component id="afterButton" alignment="0" min="-2" max="-2" attributes="0"/>
44.31 + </Group>
44.32 + <EmptySpace max="32767" attributes="0"/>
44.33 + </Group>
44.34 + </Group>
44.35 + </DimensionLayout>
44.36 + <DimensionLayout dim="1">
44.37 + <Group type="103" groupAlignment="0" attributes="0">
44.38 + <Group type="102" alignment="0" attributes="0">
44.39 + <EmptySpace max="-2" attributes="0"/>
44.40 + <Component id="beforeButton" min="-2" max="-2" attributes="0"/>
44.41 + <EmptySpace type="unrelated" max="-2" attributes="0"/>
44.42 + <Component id="afterButton" min="-2" max="-2" attributes="0"/>
44.43 + <EmptySpace max="32767" attributes="0"/>
44.44 + </Group>
44.45 + </Group>
44.46 + </DimensionLayout>
44.47 + </Layout>
44.48 + <SubComponents>
44.49 + <Component class="javax.swing.JRadioButton" name="beforeButton">
44.50 + <Properties>
44.51 + <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
44.52 + <ComponentRef name="buttonGroup1"/>
44.53 + </Property>
44.54 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
44.55 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/handlers/Bundle.properties" key="XmlHandlerCustomizer.beforeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
44.56 + </Property>
44.57 + </Properties>
44.58 + <Events>
44.59 + <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="licensePreferenceChanged"/>
44.60 + </Events>
44.61 + </Component>
44.62 + <Component class="javax.swing.JRadioButton" name="afterButton">
44.63 + <Properties>
44.64 + <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
44.65 + <ComponentRef name="buttonGroup1"/>
44.66 + </Property>
44.67 + <Property name="selected" type="boolean" value="true"/>
44.68 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
44.69 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/handlers/Bundle.properties" key="XmlHandlerCustomizer.afterButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
44.70 + </Property>
44.71 + </Properties>
44.72 + <Events>
44.73 + <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="licensePreferenceChanged"/>
44.74 + </Events>
44.75 + </Component>
44.76 + </SubComponents>
44.77 +</Form>
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/handlers/XmlHandlerCustomizer.java Thu Sep 13 09:10:03 2012 +0200
45.3 @@ -0,0 +1,119 @@
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 +package org.netbeans.modules.licensechanger.spi.handlers;
45.43 +
45.44 +/**
45.45 + *
45.46 + * @author Tim Boudreau
45.47 + */
45.48 +public class XmlHandlerCustomizer extends javax.swing.JPanel {
45.49 + boolean init;
45.50 + /** Creates new form XmlHandlerCustomizer */
45.51 + public XmlHandlerCustomizer() {
45.52 + initComponents();
45.53 + afterButton.setSelected (!XmlFileHandler.isInsertAtTopOfFile());
45.54 + beforeButton.setSelected(!afterButton.isSelected());
45.55 + init = true;
45.56 + }
45.57 +
45.58 + /** This method is called from within the constructor to
45.59 + * initialize the form.
45.60 + * WARNING: Do NOT modify this code. The content of this method is
45.61 + * always regenerated by the Form Editor.
45.62 + */
45.63 + @SuppressWarnings("unchecked")
45.64 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
45.65 + private void initComponents() {
45.66 +
45.67 + buttonGroup1 = new javax.swing.ButtonGroup();
45.68 + beforeButton = new javax.swing.JRadioButton();
45.69 + afterButton = new javax.swing.JRadioButton();
45.70 +
45.71 + buttonGroup1.add(beforeButton);
45.72 + beforeButton.setText(org.openide.util.NbBundle.getMessage(XmlHandlerCustomizer.class, "XmlHandlerCustomizer.beforeButton.text")); // NOI18N
45.73 + beforeButton.addItemListener(new java.awt.event.ItemListener() {
45.74 + public void itemStateChanged(java.awt.event.ItemEvent evt) {
45.75 + licensePreferenceChanged(evt);
45.76 + }
45.77 + });
45.78 +
45.79 + buttonGroup1.add(afterButton);
45.80 + afterButton.setSelected(true);
45.81 + afterButton.setText(org.openide.util.NbBundle.getMessage(XmlHandlerCustomizer.class, "XmlHandlerCustomizer.afterButton.text")); // NOI18N
45.82 + afterButton.addItemListener(new java.awt.event.ItemListener() {
45.83 + public void itemStateChanged(java.awt.event.ItemEvent evt) {
45.84 + licensePreferenceChanged(evt);
45.85 + }
45.86 + });
45.87 +
45.88 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
45.89 + this.setLayout(layout);
45.90 + layout.setHorizontalGroup(
45.91 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
45.92 + .addGroup(layout.createSequentialGroup()
45.93 + .addContainerGap()
45.94 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
45.95 + .addComponent(beforeButton)
45.96 + .addComponent(afterButton))
45.97 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
45.98 + );
45.99 + layout.setVerticalGroup(
45.100 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
45.101 + .addGroup(layout.createSequentialGroup()
45.102 + .addContainerGap()
45.103 + .addComponent(beforeButton)
45.104 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
45.105 + .addComponent(afterButton)
45.106 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
45.107 + );
45.108 + }// </editor-fold>//GEN-END:initComponents
45.109 +
45.110 + private void licensePreferenceChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_licensePreferenceChanged
45.111 + if (!init) return;
45.112 + XmlFileHandler.setInsertAtTopOfFile(beforeButton.isSelected());
45.113 + }//GEN-LAST:event_licensePreferenceChanged
45.114 +
45.115 +
45.116 + // Variables declaration - do not modify//GEN-BEGIN:variables
45.117 + private javax.swing.JRadioButton afterButton;
45.118 + private javax.swing.JRadioButton beforeButton;
45.119 + private javax.swing.ButtonGroup buttonGroup1;
45.120 + // End of variables declaration//GEN-END:variables
45.121 +
45.122 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties Thu Sep 13 09:10:03 2012 +0200
46.3 @@ -0,0 +1,30 @@
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 +LicenseChooserPanel.chooseLabel.text=Choose License
46.8 +LicenseChooserPanel.browseButton.text=Browse
46.9 +SelectFoldersPanel.jLabel1.text=Uncheck Folders that Should Be Ignored
46.10 +LineEndingsPanel.border.title=Line Endings
46.11 +ChooseFileTypesPanel.jLabel1.text=Choose and Customize File Types
46.12 +ChooseFileTypesPanel.noCustomizerLabel.text=[no customizer]
46.13 +ChooseFileTypesPanel.customizerPanel.border.title=File Type Settings
46.14 +
46.15 +WIZARD_TITLE=Add/Replace License Headers
46.16 +chooseFileTypes=Select File Types
46.17 +chooseLicense=Select License
46.18 +chooseFolders=Prune Folders
46.19 +chooseFiles=Choose Files
46.20 +preview=Preview
46.21 +LBL_CHANGE_LICENSE=Change License Headers
46.22 +
46.23 +PreviewPanel.jLabel3.text=jLabel3
46.24 +LineEndingsPanel.noChangeButton.text=Do Not Change
46.25 +LineEndingsPanel.systemDefaultButton.text=Force System Default
46.26 +LineEndingsPanel.newlineButton.text=Force Newline
46.27 +LineEndingsPanel.forceCrlf.text=Force CRLF
46.28 +LineEndingsPanel.newlineButton.text_1=Force Newline
46.29 +LineEndingsPanel.systemDefaultButton.text_1=Force System Default
46.30 +LineEndingsPanel.noChangeButton.text_1=Do Not Change
46.31 +LineEndingsPanel.forceCrlf.text_1=Force CRLF
46.32 +LicenseChooserPanel.updateDefaultProjectLicense.text=Set as default project license
46.33 +PreviewPanel.fileList.border.title=Select File for Preview
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.form Thu Sep 13 09:10:03 2012 +0200
47.3 @@ -0,0 +1,135 @@
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 + <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
47.27 + <Group type="102" alignment="1" attributes="0">
47.28 + <Component id="customizerPanel" pref="559" max="32767" attributes="0"/>
47.29 + <EmptySpace max="-2" attributes="0"/>
47.30 + <Component id="lineEndingsPanel1" min="-2" pref="239" max="-2" attributes="0"/>
47.31 + </Group>
47.32 + </Group>
47.33 + <EmptySpace max="-2" attributes="0"/>
47.34 + </Group>
47.35 + </Group>
47.36 + </DimensionLayout>
47.37 + <DimensionLayout dim="1">
47.38 + <Group type="103" groupAlignment="0" attributes="0">
47.39 + <Group type="102" alignment="0" attributes="0">
47.40 + <EmptySpace max="-2" attributes="0"/>
47.41 + <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
47.42 + <EmptySpace max="-2" attributes="0"/>
47.43 + <Component id="jScrollPane1" min="-2" pref="112" 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 min="0" pref="0" max="32767" attributes="0"/>
47.50 + </Group>
47.51 + </Group>
47.52 + <EmptySpace max="-2" attributes="0"/>
47.53 + </Group>
47.54 + </Group>
47.55 + </DimensionLayout>
47.56 + </Layout>
47.57 + <SubComponents>
47.58 + <Component class="javax.swing.JLabel" name="jLabel1">
47.59 + <Properties>
47.60 + <Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
47.61 + <FontInfo relative="true">
47.62 + <Font bold="true" component="jLabel1" property="font" relativeSize="true" size="0"/>
47.63 + </FontInfo>
47.64 + </Property>
47.65 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47.66 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
47.67 + </Property>
47.68 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
47.69 + <Border info="org.netbeans.modules.form.compat2.border.MatteColorBorderInfo">
47.70 + <MatteColorBorder bottom="1" left="0" right="0" top="0"/>
47.71 + </Border>
47.72 + </Property>
47.73 + </Properties>
47.74 + <AccessibilityProperties>
47.75 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47.76 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
47.77 + </Property>
47.78 + </AccessibilityProperties>
47.79 + </Component>
47.80 + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
47.81 + <Properties>
47.82 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
47.83 + <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
47.84 + <LineBorder>
47.85 + <Color PropertyName="color" blue="99" green="a8" id="controlShadow" palette="3" red="ac" type="palette"/>
47.86 + </LineBorder>
47.87 + </Border>
47.88 + </Property>
47.89 + </Properties>
47.90 + <AuxValues>
47.91 + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
47.92 + </AuxValues>
47.93 +
47.94 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
47.95 + </Container>
47.96 + <Container class="javax.swing.JPanel" name="customizerPanel">
47.97 + <Properties>
47.98 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
47.99 + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
47.100 + <TitledBorder title="File Type Settings">
47.101 + <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, "{key}")"/>
47.102 + </TitledBorder>
47.103 + </Border>
47.104 + </Property>
47.105 + </Properties>
47.106 + <AccessibilityProperties>
47.107 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47.108 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.customizerPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
47.109 + </Property>
47.110 + </AccessibilityProperties>
47.111 +
47.112 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
47.113 + <SubComponents>
47.114 + <Component class="javax.swing.JLabel" name="noCustomizerLabel">
47.115 + <Properties>
47.116 + <Property name="horizontalAlignment" type="int" value="0"/>
47.117 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47.118 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
47.119 + </Property>
47.120 + <Property name="enabled" type="boolean" value="false"/>
47.121 + </Properties>
47.122 + <AccessibilityProperties>
47.123 + <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47.124 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="ChooseFileTypesPanel.noCustomizerLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
47.125 + </Property>
47.126 + </AccessibilityProperties>
47.127 + <Constraints>
47.128 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
47.129 + <BorderConstraints direction="Center"/>
47.130 + </Constraint>
47.131 + </Constraints>
47.132 + </Component>
47.133 + </SubComponents>
47.134 + </Container>
47.135 + <Component class="org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel" name="lineEndingsPanel1">
47.136 + </Component>
47.137 + </SubComponents>
47.138 +</Form>
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesPanel.java Thu Sep 13 09:10:03 2012 +0200
48.3 @@ -0,0 +1,224 @@
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 +
48.49 +package org.netbeans.modules.licensechanger.spi.wizard;
48.50 +
48.51 +import java.beans.PropertyChangeEvent;
48.52 +import java.beans.PropertyChangeListener;
48.53 +import java.util.HashSet;
48.54 +import java.util.List;
48.55 +import java.util.Set;
48.56 +import org.netbeans.modules.licensechanger.api.Customizable;
48.57 +import org.netbeans.modules.licensechanger.api.FileHandler;
48.58 +import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckableNodeCapability;
48.59 +import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
48.60 +import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
48.61 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
48.62 +import org.openide.explorer.ExplorerManager;
48.63 +import org.openide.explorer.view.CheckableNode;
48.64 +import org.openide.nodes.AbstractNode;
48.65 +import org.openide.nodes.ChildFactory;
48.66 +import org.openide.nodes.Children;
48.67 +import org.openide.nodes.Node;
48.68 +import org.openide.util.Lookup;
48.69 +import org.openide.util.lookup.Lookups;
48.70 +
48.71 +/**
48.72 + *
48.73 + * @author Tim Boudreau
48.74 + * @author Nils Hoffmann (Refactoring)
48.75 + */
48.76 +public class ChooseFileTypesPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
48.77 + private final ExplorerManager mgr = new ExplorerManager();
48.78 +
48.79 + public ChooseFileTypesPanel() {
48.80 + initComponents();
48.81 + mgr.setRootContext(new AbstractNode (Children.create(new FileHandlerChildren(), false)));
48.82 + ((CheckboxListView) jScrollPane1).setNodeCheckObserver(this);
48.83 + ((CheckboxListView) jScrollPane1).setListEnabled(true);
48.84 + ((CheckboxListView) jScrollPane1).setCheckboxesEnabled(true);
48.85 + ((CheckboxListView) jScrollPane1).setCheckboxesVisible(true);
48.86 + mgr.addPropertyChangeListener(this);
48.87 + setName("Choose File Types");
48.88 + updateMap();
48.89 + }
48.90 +
48.91 + private void updateMap() {
48.92 + Set<FileHandler> handlers = getFileHandlers();
48.93 + firePropertyChange(WizardProperties.KEY_FILE_HANDLERS, null, handlers);
48.94 + }
48.95 +
48.96 + /** This method is called from within the constructor to
48.97 + * initialize the form.
48.98 + * WARNING: Do NOT modify this code. The content of this method is
48.99 + * always regenerated by the Form Editor.
48.100 + */
48.101 + @SuppressWarnings("unchecked")
48.102 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
48.103 + private void initComponents() {
48.104 +
48.105 + jLabel1 = new javax.swing.JLabel();
48.106 + jScrollPane1 = new CheckboxListView();
48.107 + customizerPanel = new javax.swing.JPanel();
48.108 + noCustomizerLabel = new javax.swing.JLabel();
48.109 + lineEndingsPanel1 = new org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel();
48.110 +
48.111 + jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
48.112 + jLabel1.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.jLabel1.text")); // NOI18N
48.113 + jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(0, 0, 0)));
48.114 +
48.115 + jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
48.116 +
48.117 + customizerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title"))); // NOI18N
48.118 + customizerPanel.setLayout(new java.awt.BorderLayout());
48.119 +
48.120 + noCustomizerLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
48.121 + noCustomizerLabel.setText(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
48.122 + noCustomizerLabel.setEnabled(false);
48.123 + customizerPanel.add(noCustomizerLabel, java.awt.BorderLayout.CENTER);
48.124 + noCustomizerLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.noCustomizerLabel.text")); // NOI18N
48.125 +
48.126 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
48.127 + this.setLayout(layout);
48.128 + layout.setHorizontalGroup(
48.129 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48.130 + .addGroup(layout.createSequentialGroup()
48.131 + .addContainerGap()
48.132 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48.133 + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 804, Short.MAX_VALUE)
48.134 + .addComponent(jLabel1)
48.135 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
48.136 + .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
48.137 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
48.138 + .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE)))
48.139 + .addContainerGap())
48.140 + );
48.141 + layout.setVerticalGroup(
48.142 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48.143 + .addGroup(layout.createSequentialGroup()
48.144 + .addContainerGap()
48.145 + .addComponent(jLabel1)
48.146 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
48.147 + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
48.148 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
48.149 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48.150 + .addComponent(customizerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
48.151 + .addGroup(layout.createSequentialGroup()
48.152 + .addComponent(lineEndingsPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
48.153 + .addGap(0, 0, Short.MAX_VALUE)))
48.154 + .addContainerGap())
48.155 + );
48.156 +
48.157 + jLabel1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title")); // NOI18N
48.158 + customizerPanel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ChooseFileTypesPanel.class, "ChooseFileTypesPanel.customizerPanel.border.title")); // NOI18N
48.159 + }// </editor-fold>//GEN-END:initComponents
48.160 +
48.161 +
48.162 + // Variables declaration - do not modify//GEN-BEGIN:variables
48.163 + private javax.swing.JPanel customizerPanel;
48.164 + private javax.swing.JLabel jLabel1;
48.165 + private javax.swing.JScrollPane jScrollPane1;
48.166 + private org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel lineEndingsPanel1;
48.167 + private javax.swing.JLabel noCustomizerLabel;
48.168 + // End of variables declaration//GEN-END:variables
48.169 +
48.170 + @Override
48.171 + public ExplorerManager getExplorerManager() {
48.172 + return mgr;
48.173 + }
48.174 +
48.175 + public Set<FileHandler> getFileHandlers() {
48.176 + Set <FileHandler> result = new HashSet<FileHandler>();
48.177 + for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
48.178 + CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
48.179 + if (cn!= null && cn.isSelected()) {
48.180 + result.addAll (n.getLookup().lookupAll(FileHandler.class));
48.181 + }
48.182 + }
48.183 + return result;
48.184 + }
48.185 +
48.186 + @Override
48.187 + public void propertyChange(PropertyChangeEvent evt) {
48.188 + if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
48.189 + Node[] n = mgr.getSelectedNodes();
48.190 + updateCustomizer (n.length == 1 ? n[0].getLookup().lookup(Customizable.class) : null);
48.191 + }
48.192 + }
48.193 +
48.194 + @Override
48.195 + public void onNodeChecked(Node node) {
48.196 + updateMap();
48.197 + }
48.198 +
48.199 + @Override
48.200 + public void onNodeUnchecked(Node node) {
48.201 + updateMap();
48.202 + }
48.203 +
48.204 + private static final class FileHandlerChildren extends ChildFactory<FileHandler> {
48.205 + @Override
48.206 + protected boolean createKeys(List<FileHandler> toPopulate) {
48.207 + toPopulate.addAll (Lookup.getDefault().lookupAll(FileHandler.class));
48.208 + return true;
48.209 + }
48.210 +
48.211 + @Override
48.212 + protected Node createNodeForKey(FileHandler key) {
48.213 + AbstractNode result = new AbstractNode (Children.LEAF, Lookups.fixed(key,new CheckableNodeCapability()));
48.214 + result.setDisplayName(key.getDisplayName());
48.215 + return result;
48.216 + }
48.217 + }
48.218 +
48.219 + private void updateCustomizer(Customizable c) {
48.220 + customizerPanel.removeAll();
48.221 + customizerPanel.add (c == null ? noCustomizerLabel : c.getCustomizer());
48.222 + invalidate();
48.223 + revalidate();
48.224 + repaint();
48.225 + }
48.226 +
48.227 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/ChooseFileTypesWizardPanel.java Thu Sep 13 09:10:03 2012 +0200
49.3 @@ -0,0 +1,122 @@
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 +
49.43 +package org.netbeans.modules.licensechanger.spi.wizard;
49.44 +
49.45 +import java.beans.PropertyChangeEvent;
49.46 +import java.beans.PropertyChangeListener;
49.47 +import javax.swing.event.ChangeListener;
49.48 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
49.49 +import org.openide.WizardDescriptor;
49.50 +import org.openide.WizardValidationException;
49.51 +import org.openide.util.ChangeSupport;
49.52 +import org.openide.util.HelpCtx;
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 + }
49.114 +
49.115 + @Override
49.116 + public void storeSettings(WizardDescriptor wiz) {
49.117 + wiz.putProperty(WizardProperties.KEY_FILE_HANDLERS, getComponent().getFileHandlers());
49.118 + }
49.119 +
49.120 + @Override
49.121 + public void validate() throws WizardValidationException {
49.122 + valid = true;
49.123 + }
49.124 +
49.125 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChangerWizardAction.java Thu Sep 13 09:10:03 2012 +0200
50.3 @@ -0,0 +1,132 @@
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 +
50.43 +package org.netbeans.modules.licensechanger.spi.wizard;
50.44 +
50.45 +import java.awt.Component;
50.46 +import java.awt.event.ActionEvent;
50.47 +import java.awt.event.ActionListener;
50.48 +import java.text.MessageFormat;
50.49 +import java.util.ArrayList;
50.50 +import java.util.HashSet;
50.51 +import java.util.List;
50.52 +import java.util.Set;
50.53 +import javax.swing.JComponent;
50.54 +import org.netbeans.api.project.*;
50.55 +import org.netbeans.modules.licensechanger.spi.wizard.utils.LicenseChangerRunnable;
50.56 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
50.57 +import org.openide.DialogDisplayer;
50.58 +import org.openide.WizardDescriptor;
50.59 +import org.openide.awt.ActionID;
50.60 +import org.openide.awt.ActionReference;
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 + * @author Nils Hoffmann
50.69 + */
50.70 +@ActionID(
50.71 + category = "Tools",
50.72 +id = "org.netbeans.modules.licensechanger.wizard.LicenseChangerWizardAction")
50.73 +@ActionRegistration(
50.74 + displayName = "#CTL_LicenseChangerWizardAction")
50.75 +@ActionReference(path = "Loaders/folder/any/Actions", position = 1550)
50.76 +@NbBundle.Messages("CTL_LicenseChangerWizardAction=Change License Header")
50.77 +public final class LicenseChangerWizardAction implements ActionListener {
50.78 +
50.79 + private List<DataObject> context;
50.80 +
50.81 + public LicenseChangerWizardAction(List<DataObject> context) {
50.82 + this.context = context;
50.83 + }
50.84 +
50.85 + @Override
50.86 + public void actionPerformed(ActionEvent e) {
50.87 + Set<FileObject> files = new HashSet<FileObject>();
50.88 + Project owningProject = null;
50.89 + for (DataObject ob : context) {
50.90 + FileObject fo = ob.getPrimaryFile();
50.91 + Project proj = FileOwnerQuery.getOwner(fo);
50.92 + if(owningProject == null) {
50.93 + owningProject = proj;
50.94 + //TODO implement better exclusion of build directories
50.95 + files.add (fo);
50.96 + } else {
50.97 + if(owningProject.equals(proj)) {
50.98 + files.add(fo);
50.99 + } else {
50.100 + Exceptions.printStackTrace(new IllegalStateException("Can only handle folders below one project!"));
50.101 + return;
50.102 + }
50.103 + }
50.104 + }
50.105 +
50.106 + List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
50.107 + panels.add(new ChooseFileTypesWizardPanel());
50.108 + panels.add(new LicenseChooserWizardPanel());
50.109 + panels.add(new SelectFoldersWizardPanel());
50.110 + panels.add(new PreviewWizardPanel());
50.111 + String[] steps = new String[panels.size()];
50.112 + for (int i = 0; i < panels.size(); i++) {
50.113 + Component c = panels.get(i).getComponent();
50.114 + // Default step name to component name of panel.
50.115 + steps[i] = c.getName();
50.116 + if (c instanceof JComponent) { // assume Swing components
50.117 + JComponent jc = (JComponent) c;
50.118 + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
50.119 + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
50.120 + jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
50.121 + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
50.122 + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
50.123 + }
50.124 + }
50.125 + WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
50.126 + // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
50.127 + wiz.setTitleFormat(new MessageFormat("{0}"));
50.128 + wiz.setTitle("Change licenses");
50.129 + wiz.putProperty(WizardProperties.KEY_ROOT_FILES, files);
50.130 + wiz.putProperty(WizardProperties.KEY_PROJECT, owningProject);
50.131 + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
50.132 + RequestProcessor.getDefault().post(new LicenseChangerRunnable(wiz));
50.133 + }
50.134 + }
50.135 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.form Thu Sep 13 09:10:03 2012 +0200
51.3 @@ -0,0 +1,116 @@
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 max="-2" attributes="0"/>
51.24 + <Group type="103" groupAlignment="0" attributes="0">
51.25 + <Component id="jScrollPane2" 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 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 max="-2" attributes="0"/>
51.50 + <Component id="jScrollPane2" pref="223" max="32767" attributes="0"/>
51.51 + <EmptySpace 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 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/spi/wizard/Bundle.properties" key="LicenseChooserPanel.chooseLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LicenseChooserPanel.browseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LicenseChooserPanel.updateDefaultProjectLicense.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
51.98 + </Property>
51.99 + </Properties>
51.100 + </Component>
51.101 + <Container class="javax.swing.JScrollPane" name="jScrollPane2">
51.102 + <AuxValues>
51.103 + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
51.104 + </AuxValues>
51.105 +
51.106 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
51.107 + <SubComponents>
51.108 + <Component class="javax.swing.JEditorPane" name="licenseText">
51.109 + <Properties>
51.110 + <Property name="editable" type="boolean" value="false"/>
51.111 + </Properties>
51.112 + <AuxValues>
51.113 + <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="licenseText.setContentType("text/plain");"/>
51.114 + </AuxValues>
51.115 + </Component>
51.116 + </SubComponents>
51.117 + </Container>
51.118 + </SubComponents>
51.119 +</Form>
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LicenseChooserPanel.java Thu Sep 13 09:10:03 2012 +0200
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 +
52.43 +package org.netbeans.modules.licensechanger.spi.wizard;
52.44 +
52.45 +import java.awt.Component;
52.46 +import java.awt.EventQueue;
52.47 +import java.io.File;
52.48 +import java.io.IOException;
52.49 +import javax.swing.DefaultComboBoxModel;
52.50 +import javax.swing.SwingUtilities;
52.51 +import javax.swing.event.DocumentEvent;
52.52 +import javax.swing.event.DocumentListener;
52.53 +import org.netbeans.modules.licensechanger.api.LicenseHeader;
52.54 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
52.55 +import org.openide.filesystems.FileChooserBuilder;
52.56 +import org.openide.util.Exceptions;
52.57 +import org.openide.util.NbBundle;
52.58 +import org.openide.util.RequestProcessor;
52.59 +
52.60 +/**
52.61 + *
52.62 + * @author Tim Boudreau
52.63 + * @author Nils Hoffmann (Refactoring)
52.64 + */
52.65 +public class LicenseChooserPanel extends javax.swing.JPanel implements Runnable, DocumentListener {
52.66 +
52.67 + private volatile boolean licensesLoaded;
52.68 + private volatile boolean loadingLicenses;
52.69 +
52.70 + /**
52.71 + * Creates new form LicenseChooser
52.72 + */
52.73 + public LicenseChooserPanel() {
52.74 + initComponents();
52.75 + enabled(false);
52.76 + licenseText.getDocument().addDocumentListener(this);
52.77 + licenseText.setText(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT);
52.78 + setName("Choose License Header");
52.79 + }
52.80 +
52.81 + /**
52.82 + * This method is called from within the constructor to initialize the form.
52.83 + * WARNING: Do NOT modify this code. The content of this method is always
52.84 + * regenerated by the Form Editor.
52.85 + */
52.86 + @SuppressWarnings("unchecked")
52.87 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
52.88 + private void initComponents() {
52.89 +
52.90 + chooseLabel = new javax.swing.JLabel();
52.91 + selectLicense = new javax.swing.JComboBox();
52.92 + browseButton = new javax.swing.JButton();
52.93 + updateDefaultProjectLicense = new javax.swing.JCheckBox();
52.94 + jScrollPane2 = new javax.swing.JScrollPane();
52.95 + licenseText = new javax.swing.JEditorPane();
52.96 +
52.97 + chooseLabel.setLabelFor(selectLicense);
52.98 + chooseLabel.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.chooseLabel.text")); // NOI18N
52.99 +
52.100 + selectLicense.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "[loading licenses]" }));
52.101 + selectLicense.addActionListener(new java.awt.event.ActionListener() {
52.102 + public void actionPerformed(java.awt.event.ActionEvent evt) {
52.103 + licenseSelected(evt);
52.104 + }
52.105 + });
52.106 +
52.107 + browseButton.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.browseButton.text")); // NOI18N
52.108 + browseButton.addActionListener(new java.awt.event.ActionListener() {
52.109 + public void actionPerformed(java.awt.event.ActionEvent evt) {
52.110 + browseForLicense(evt);
52.111 + }
52.112 + });
52.113 +
52.114 + updateDefaultProjectLicense.setText(org.openide.util.NbBundle.getMessage(LicenseChooserPanel.class, "LicenseChooserPanel.updateDefaultProjectLicense.text")); // NOI18N
52.115 +
52.116 + licenseText.setEditable(false);
52.117 + jScrollPane2.setViewportView(licenseText);
52.118 + licenseText.setContentType("text/plain");
52.119 +
52.120 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
52.121 + this.setLayout(layout);
52.122 + layout.setHorizontalGroup(
52.123 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
52.124 + .addGroup(layout.createSequentialGroup()
52.125 + .addContainerGap()
52.126 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
52.127 + .addComponent(jScrollPane2)
52.128 + .addGroup(layout.createSequentialGroup()
52.129 + .addComponent(chooseLabel)
52.130 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
52.131 + .addComponent(selectLicense, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
52.132 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
52.133 + .addComponent(updateDefaultProjectLicense)
52.134 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
52.135 + .addComponent(browseButton)))
52.136 + .addContainerGap())
52.137 + );
52.138 + layout.setVerticalGroup(
52.139 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
52.140 + .addGroup(layout.createSequentialGroup()
52.141 + .addContainerGap()
52.142 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
52.143 + .addComponent(chooseLabel)
52.144 + .addComponent(selectLicense, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
52.145 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
52.146 + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
52.147 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
52.148 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
52.149 + .addComponent(browseButton)
52.150 + .addComponent(updateDefaultProjectLicense))
52.151 + .addContainerGap())
52.152 + );
52.153 + }// </editor-fold>//GEN-END:initComponents
52.154 +
52.155 + private void licenseSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_licenseSelected
52.156 + if (loadingLicenses || !selectLicense.isEnabled()) {
52.157 + return;
52.158 + }
52.159 + loadLicenseFromResource((LicenseHeader) selectLicense.getSelectedItem());
52.160 + }//GEN-LAST:event_licenseSelected
52.161 +
52.162 + private void browseForLicense(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseForLicense
52.163 + File f;
52.164 + if ((f = new FileChooserBuilder(LicenseChooserPanel.class).setTitle(
52.165 + NbBundle.getMessage(LicenseChooserPanel.class, "BROWSE_LICENSE_TITLE")) //NOI18N
52.166 + .setFilesOnly(true).showOpenDialog()) != null) {
52.167 + updateDefaultProjectLicense.setSelected(false);
52.168 + DefaultComboBoxModel dcbm = (DefaultComboBoxModel) selectLicense.getModel();
52.169 + LicenseHeader lh = LicenseHeader.fromFile(f);
52.170 + LicenseHeader.addAsNetBeansTemplate(lh);
52.171 + for(LicenseHeader header:LicenseHeader.fromTemplates()) {
52.172 + if(header.getName().equals(lh.getName())) {
52.173 + System.out.println("Found newly added template!");
52.174 + dcbm.addElement(header);
52.175 + dcbm.setSelectedItem(header);
52.176 + loadLicenseFromResource(header);
52.177 + }
52.178 + }
52.179 + }
52.180 + }//GEN-LAST:event_browseForLicense
52.181 +
52.182 + @Override
52.183 + public void addNotify() {
52.184 + super.addNotify();
52.185 + if (!licensesLoaded && !loadingLicenses) {
52.186 + loadingLicenses = true;
52.187 + enabled(false);
52.188 + RequestProcessor.getDefault().post(this);
52.189 + }
52.190 + }
52.191 + // Variables declaration - do not modify//GEN-BEGIN:variables
52.192 + private javax.swing.JButton browseButton;
52.193 + private javax.swing.JLabel chooseLabel;
52.194 + private javax.swing.JScrollPane jScrollPane2;
52.195 + private javax.swing.JEditorPane licenseText;
52.196 + private javax.swing.JComboBox selectLicense;
52.197 + private javax.swing.JCheckBox updateDefaultProjectLicense;
52.198 + // End of variables declaration//GEN-END:variables
52.199 +
52.200 + private void enabled(boolean val) {
52.201 + for (Component c : getComponents()) {
52.202 + c.setEnabled(val);
52.203 + }
52.204 + }
52.205 +
52.206 + private void initLicenses() throws IOException {
52.207 + assert !EventQueue.isDispatchThread();
52.208 + final DefaultComboBoxModel mdl = new DefaultComboBoxModel();
52.209 + for(LicenseHeader header:LicenseHeader.fromTemplates()) {
52.210 + mdl.addElement(header);
52.211 + }
52.212 + EventQueue.invokeLater(new Runnable() {
52.213 + @Override
52.214 + public void run() {
52.215 + mdl.setSelectedItem(NbBundle.getMessage(LicenseChooserPanel.class,
52.216 + "MSG_SELECT_A_LICENSE")); //NOI18N
52.217 + selectLicense.setModel(mdl);
52.218 + enabled(true);
52.219 + licensesLoaded = true;
52.220 + loadingLicenses = false;
52.221 + }
52.222 + });
52.223 + }
52.224 +
52.225 + @Override
52.226 + public void run() {
52.227 + try {
52.228 + initLicenses();
52.229 + } catch (IOException ex) {
52.230 + Exceptions.printStackTrace(ex);
52.231 + }
52.232 + }
52.233 +
52.234 + private void loadLicenseFromResource(LicenseHeader header) {
52.235 + enabled(false);
52.236 + SwingUtilities.invokeLater(new ResourceLoader(header));
52.237 + }
52.238 +
52.239 + public String getLicenseText() {
52.240 + return licenseText.getText();
52.241 + }
52.242 +
52.243 + public String getLicenseName() {
52.244 + Object obj = selectLicense.getSelectedItem();
52.245 + if(obj!= null && obj instanceof LicenseHeader) {
52.246 + LicenseHeader header = (LicenseHeader)obj;
52.247 + return header.getName();
52.248 + }
52.249 + return null;
52.250 + }
52.251 +
52.252 + public boolean isUpdateDefaultProjectLicense() {
52.253 + return updateDefaultProjectLicense.isSelected();
52.254 + }
52.255 +
52.256 + public void setUpdateDefaultProjectLicense(boolean b) {
52.257 + updateDefaultProjectLicense.setSelected(b);
52.258 + }
52.259 +
52.260 + private void updateLicense() {
52.261 + System.out.println("Update license called");
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/spi/wizard/LicenseChooserWizardPanel.java Thu Sep 13 09:10:03 2012 +0200
53.3 @@ -0,0 +1,149 @@
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 +
53.43 +package org.netbeans.modules.licensechanger.spi.wizard;
53.44 +
53.45 +import java.beans.PropertyChangeEvent;
53.46 +import java.beans.PropertyChangeListener;
53.47 +import javax.swing.event.ChangeListener;
53.48 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
53.49 +import org.openide.WizardDescriptor;
53.50 +import org.openide.WizardValidationException;
53.51 +import org.openide.util.ChangeSupport;
53.52 +import org.openide.util.HelpCtx;
53.53 +
53.54 +/**
53.55 + *
53.56 + * @author Nils Hoffmann
53.57 + */
53.58 +public class LicenseChooserWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
53.59 +
53.60 + /**
53.61 + * The visual component that displays this panel. If you need to access the
53.62 + * component from this class, just use getComponent().
53.63 + */
53.64 + private LicenseChooserPanel component;
53.65 + private WizardDescriptor wiz;
53.66 + private boolean valid = false;
53.67 + private ChangeSupport cs = new ChangeSupport(this);
53.68 +
53.69 + // Get the visual component for the panel. In this template, the component
53.70 + // is kept separate. This can be more efficient: if the wizard is created
53.71 + // but never displayed, or not all panels are displayed, it is better to
53.72 + // create only those which really need to be visible.
53.73 + @Override
53.74 + public LicenseChooserPanel getComponent() {
53.75 + if (component == null) {
53.76 + component = new LicenseChooserPanel();
53.77 + component.addPropertyChangeListener(this);
53.78 + }
53.79 + return component;
53.80 + }
53.81 +
53.82 + @Override
53.83 + public HelpCtx getHelp() {
53.84 + // Show no Help button for this panel:
53.85 + return HelpCtx.DEFAULT_HELP;
53.86 + // If you have context help:
53.87 + // return new HelpCtx("help.key.here");
53.88 + }
53.89 +
53.90 + @Override
53.91 + public boolean isValid() {
53.92 + return valid;
53.93 + }
53.94 +
53.95 + @Override
53.96 + public void addChangeListener(ChangeListener l) {
53.97 + cs.addChangeListener(l);
53.98 + }
53.99 +
53.100 + @Override
53.101 + public void removeChangeListener(ChangeListener l) {
53.102 + cs.removeChangeListener(l);
53.103 + }
53.104 +
53.105 + @Override
53.106 + public void propertyChange(PropertyChangeEvent pce) {
53.107 + cs.fireChange();
53.108 + try{
53.109 + validate();
53.110 + }catch(WizardValidationException ex) {
53.111 + if(wiz!=null) {
53.112 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Please select a license!");
53.113 + }
53.114 + }
53.115 + }
53.116 +
53.117 + @Override
53.118 + public void readSettings(WizardDescriptor wiz) {
53.119 + this.wiz = wiz;
53.120 + Object obj = wiz.getProperty(WizardProperties.KEY_LICENSE_TEXT);
53.121 + if (obj != null && obj instanceof String) {
53.122 + getComponent().setLicenseText((String) obj);
53.123 + }
53.124 + Boolean b = (Boolean)wiz.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
53.125 + if(b != null) {
53.126 + getComponent().setUpdateDefaultProjectLicense(b);
53.127 + }
53.128 + }
53.129 +
53.130 + @Override
53.131 + public void storeSettings(WizardDescriptor wiz) {
53.132 + wiz.putProperty(WizardProperties.KEY_LICENSE_TEXT, getComponent().getLicenseText());
53.133 + wiz.putProperty(WizardProperties.KEY_LICENSE_NAME, getComponent().getLicenseName());
53.134 + wiz.putProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE, Boolean.valueOf(getComponent().isUpdateDefaultProjectLicense()));
53.135 + }
53.136 +
53.137 + @Override
53.138 + public void validate() throws WizardValidationException {
53.139 + valid = true;
53.140 + if (getComponent().getLicenseText() == null ||
53.141 + getComponent().getLicenseText().equals(WizardProperties.VALUE_DEFAULT_LICENSE_TEXT)) {
53.142 + valid = false;
53.143 + throw new WizardValidationException(component, "Please select a license!", null);
53.144 + }
53.145 + if(wiz!=null) {
53.146 + wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
53.147 + wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
53.148 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
53.149 + }
53.150 + }
53.151 +
53.152 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/LineEndingsPanel.form Thu Sep 13 09:10:03 2012 +0200
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.noChangeButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.systemDefaultButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.newlineButton.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/Bundle.properties" key="LineEndingsPanel.forceCrlf.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/LineEndingsPanel.java Thu Sep 13 09:10:03 2012 +0200
55.3 @@ -0,0 +1,173 @@
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 +
55.49 +package org.netbeans.modules.licensechanger.spi.wizard;
55.50 +
55.51 +import javax.swing.JRadioButton;
55.52 +import org.netbeans.modules.licensechanger.spi.wizard.utils.LineEndingPreference;
55.53 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
55.54 +import org.openide.util.NbPreferences;
55.55 +
55.56 +/**
55.57 + *
55.58 + * @author Administrator
55.59 + */
55.60 +public class LineEndingsPanel extends javax.swing.JPanel {
55.61 +
55.62 + /** Creates new form LineEndingsPanel */
55.63 + public LineEndingsPanel() {
55.64 + initComponents();
55.65 + forceCrlf.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_CRLF);
55.66 + noChangeButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE);
55.67 + newlineButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.FORCE_NEWLINE);
55.68 + systemDefaultButton.putClientProperty(WizardProperties.PROP_ENDING, LineEndingPreference.SYSTEM_DEFAULT);
55.69 + }
55.70 +
55.71 + /** This method is called from within the constructor to
55.72 + * initialize the form.
55.73 + * WARNING: Do NOT modify this code. The content of this method is
55.74 + * always regenerated by the Form Editor.
55.75 + */
55.76 + @SuppressWarnings("unchecked")
55.77 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
55.78 + private void initComponents() {
55.79 +
55.80 + buttonGroup1 = new javax.swing.ButtonGroup();
55.81 + noChangeButton = new javax.swing.JRadioButton();
55.82 + systemDefaultButton = new javax.swing.JRadioButton();
55.83 + newlineButton = new javax.swing.JRadioButton();
55.84 + forceCrlf = new javax.swing.JRadioButton();
55.85 +
55.86 + setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title"))); // NOI18N
55.87 +
55.88 + buttonGroup1.add(noChangeButton);
55.89 + noChangeButton.setSelected(true);
55.90 + noChangeButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.noChangeButton.text_1")); // NOI18N
55.91 + noChangeButton.addActionListener(new java.awt.event.ActionListener() {
55.92 + public void actionPerformed(java.awt.event.ActionEvent evt) {
55.93 + lineEndingPreferenceChanged(evt);
55.94 + }
55.95 + });
55.96 +
55.97 + buttonGroup1.add(systemDefaultButton);
55.98 + systemDefaultButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.systemDefaultButton.text_1")); // NOI18N
55.99 + systemDefaultButton.addActionListener(new java.awt.event.ActionListener() {
55.100 + public void actionPerformed(java.awt.event.ActionEvent evt) {
55.101 + lineEndingPreferenceChanged(evt);
55.102 + }
55.103 + });
55.104 +
55.105 + buttonGroup1.add(newlineButton);
55.106 + newlineButton.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.newlineButton.text_1")); // NOI18N
55.107 + newlineButton.addActionListener(new java.awt.event.ActionListener() {
55.108 + public void actionPerformed(java.awt.event.ActionEvent evt) {
55.109 + lineEndingPreferenceChanged(evt);
55.110 + }
55.111 + });
55.112 +
55.113 + buttonGroup1.add(forceCrlf);
55.114 + forceCrlf.setText(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.forceCrlf.text_1")); // NOI18N
55.115 + forceCrlf.addActionListener(new java.awt.event.ActionListener() {
55.116 + public void actionPerformed(java.awt.event.ActionEvent evt) {
55.117 + lineEndingPreferenceChanged(evt);
55.118 + }
55.119 + });
55.120 +
55.121 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
55.122 + this.setLayout(layout);
55.123 + layout.setHorizontalGroup(
55.124 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55.125 + .addGroup(layout.createSequentialGroup()
55.126 + .addContainerGap()
55.127 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55.128 + .addComponent(noChangeButton)
55.129 + .addComponent(systemDefaultButton)
55.130 + .addComponent(newlineButton)
55.131 + .addComponent(forceCrlf))
55.132 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
55.133 + );
55.134 + layout.setVerticalGroup(
55.135 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55.136 + .addGroup(layout.createSequentialGroup()
55.137 + .addComponent(noChangeButton)
55.138 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
55.139 + .addComponent(systemDefaultButton)
55.140 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
55.141 + .addComponent(newlineButton)
55.142 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
55.143 + .addComponent(forceCrlf)
55.144 + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
55.145 + );
55.146 +
55.147 + getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(LineEndingsPanel.class, "LineEndingsPanel.border.title")); // NOI18N
55.148 + }// </editor-fold>//GEN-END:initComponents
55.149 +
55.150 + private void lineEndingPreferenceChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lineEndingPreferenceChanged
55.151 + for (JRadioButton b : new JRadioButton[] { forceCrlf, newlineButton, noChangeButton, systemDefaultButton }) {
55.152 + if (b.isSelected()) {
55.153 + LineEndingPreference x = (LineEndingPreference) b.getClientProperty(WizardProperties.PROP_ENDING);
55.154 + if (x != null) {
55.155 + NbPreferences.forModule(LineEndingsPanel.class).put(WizardProperties.PROP_ENDING, x.name());
55.156 + }
55.157 + break;
55.158 + }
55.159 + }
55.160 + }//GEN-LAST:event_lineEndingPreferenceChanged
55.161 +
55.162 + public static LineEndingPreference getLineEndingPrefs() {
55.163 + String ending = NbPreferences.forModule(LineEndingsPanel.class).get(WizardProperties.PROP_ENDING, LineEndingPreference.NO_CHANGE.name());
55.164 + return LineEndingPreference.valueOf(ending);
55.165 + }
55.166 +
55.167 +
55.168 + // Variables declaration - do not modify//GEN-BEGIN:variables
55.169 + private javax.swing.ButtonGroup buttonGroup1;
55.170 + private javax.swing.JRadioButton forceCrlf;
55.171 + private javax.swing.JRadioButton newlineButton;
55.172 + private javax.swing.JRadioButton noChangeButton;
55.173 + private javax.swing.JRadioButton systemDefaultButton;
55.174 + // End of variables declaration//GEN-END:variables
55.175 +
55.176 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.form Thu Sep 13 09:10:03 2012 +0200
56.3 @@ -0,0 +1,101 @@
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" alignment="1" attributes="0">
56.23 + <EmptySpace max="-2" attributes="0"/>
56.24 + <Group type="103" groupAlignment="1" 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>
56.28 + <EmptySpace max="-2" attributes="0"/>
56.29 + </Group>
56.30 + </Group>
56.31 + </DimensionLayout>
56.32 + <DimensionLayout dim="1">
56.33 + <Group type="103" groupAlignment="0" attributes="0">
56.34 + <Group type="102" alignment="1" attributes="0">
56.35 + <EmptySpace max="-2" attributes="0"/>
56.36 + <Component id="jSplitPane1" pref="408" max="32767" attributes="0"/>
56.37 + <EmptySpace max="-2" attributes="0"/>
56.38 + <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
56.39 + </Group>
56.40 + </Group>
56.41 + </DimensionLayout>
56.42 + </Layout>
56.43 + <SubComponents>
56.44 + <Container class="javax.swing.JSplitPane" name="jSplitPane1">
56.45 + <Properties>
56.46 + <Property name="dividerLocation" type="int" value="200"/>
56.47 + <Property name="orientation" type="int" value="0"/>
56.48 + <Property name="resizeWeight" type="double" value="0.5"/>
56.49 + </Properties>
56.50 +
56.51 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
56.52 + <SubComponents>
56.53 + <Container class="javax.swing.JScrollPane" name="fileList">
56.54 + <Properties>
56.55 + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
56.56 + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
56.57 + <TitledBorder title="Select File for Preview">
56.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, "{key}")"/>
56.59 + </TitledBorder>
56.60 + </Border>
56.61 + </Property>
56.62 + </Properties>
56.63 + <AuxValues>
56.64 + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new CheckboxListView()"/>
56.65 + </AuxValues>
56.66 + <Constraints>
56.67 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
56.68 + <JSplitPaneConstraints position="top"/>
56.69 + </Constraint>
56.70 + </Constraints>
56.71 +
56.72 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
56.73 + </Container>
56.74 + <Container class="javax.swing.JPanel" name="diffPanel">
56.75 + <Constraints>
56.76 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
56.77 + <JSplitPaneConstraints position="right"/>
56.78 + </Constraint>
56.79 + </Constraints>
56.80 +
56.81 + <Layout>
56.82 + <DimensionLayout dim="0">
56.83 + <Group type="103" groupAlignment="0" attributes="0">
56.84 + <EmptySpace min="0" pref="417" max="32767" attributes="0"/>
56.85 + </Group>
56.86 + </DimensionLayout>
56.87 + <DimensionLayout dim="1">
56.88 + <Group type="103" groupAlignment="0" attributes="0">
56.89 + <EmptySpace min="0" pref="202" max="32767" attributes="0"/>
56.90 + </Group>
56.91 + </DimensionLayout>
56.92 + </Layout>
56.93 + </Container>
56.94 + </SubComponents>
56.95 + </Container>
56.96 + <Component class="javax.swing.JLabel" name="jLabel3">
56.97 + <Properties>
56.98 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
56.99 + <ResourceString bundle="org/netbeans/modules/licensechanger/spi/wizard/Bundle.properties" key="PreviewPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
56.100 + </Property>
56.101 + </Properties>
56.102 + </Component>
56.103 + </SubComponents>
56.104 +</Form>
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewPanel.java Thu Sep 13 09:10:03 2012 +0200
57.3 @@ -0,0 +1,353 @@
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 +
57.43 +package org.netbeans.modules.licensechanger.spi.wizard;
57.44 +
57.45 +import java.awt.EventQueue;
57.46 +import java.beans.PropertyChangeEvent;
57.47 +import java.beans.PropertyChangeListener;
57.48 +import java.io.ByteArrayOutputStream;
57.49 +import java.io.IOException;
57.50 +import java.io.PrintWriter;
57.51 +import java.io.StringReader;
57.52 +import java.util.HashMap;
57.53 +import java.util.HashSet;
57.54 +import java.util.Map;
57.55 +import java.util.Set;
57.56 +import org.netbeans.api.diff.Diff;
57.57 +import org.netbeans.api.diff.DiffView;
57.58 +import org.netbeans.api.diff.StreamSource;
57.59 +import org.netbeans.modules.licensechanger.api.FileHandler;
57.60 +import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
57.61 +import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren;
57.62 +import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren.FileItem;
57.63 +import org.netbeans.modules.licensechanger.spi.wizard.utils.FileLoader;
57.64 +import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
57.65 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
57.66 +import org.openide.explorer.ExplorerManager;
57.67 +import org.openide.explorer.view.CheckableNode;
57.68 +import org.openide.filesystems.FileObject;
57.69 +import org.openide.nodes.AbstractNode;
57.70 +import org.openide.nodes.Children;
57.71 +import org.openide.nodes.Node;
57.72 +import org.openide.util.Exceptions;
57.73 +import org.openide.util.RequestProcessor;
57.74 +import org.openide.util.RequestProcessor.Task;
57.75 +
57.76 +/**
57.77 + *
57.78 + * @author Tim Boudreau
57.79 + * @author Nils Hoffmann (Refactoring, Diff API inclusion)
57.80 + */
57.81 +public class PreviewPanel extends javax.swing.JPanel implements ExplorerManager.Provider, PropertyChangeListener, NodeCheckObserver {
57.82 +
57.83 + private final ExplorerManager mgr = new ExplorerManager();
57.84 + private ItemLoader loader;
57.85 + private String licenseText;
57.86 + private Diff diff;
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 + view().setNodeCheckObserver(this);
57.94 + setName("Preview Changes");
57.95 + }
57.96 +
57.97 + public void setFolders(Set<FileObject> folders, Set<FileHandler> fileHandler) {
57.98 + Children kids = Children.create(new FileChildren(folders,fileHandler), true);
57.99 + mgr.setRootContext(new AbstractNode(kids));
57.100 + view().setCheckboxesVisible(true);
57.101 + view().setCheckboxesEnabled(true);
57.102 + view().setListEnabled(true);
57.103 + updateItems();
57.104 + }
57.105 +
57.106 + public Set<FileItem> getSelectedItems() {
57.107 + Set<FileItem> s = new HashSet<FileItem>();
57.108 + for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
57.109 + CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
57.110 + if (cn!= null && cn.isSelected()) {
57.111 + s.addAll(n.getLookup().lookupAll(FileItem.class));
57.112 + }
57.113 + }
57.114 + return s;
57.115 + }
57.116 +
57.117 + private void updateItems() {
57.118 + Set<FileItem> s = getSelectedItems();
57.119 + firePropertyChange(WizardProperties.KEY_ITEMS, null, s);
57.120 + }
57.121 +
57.122 + private CheckboxListView view() {
57.123 + return (CheckboxListView) fileList;
57.124 + }
57.125 +
57.126 + public void setLicenseText(String licenseText) {
57.127 + this.licenseText = licenseText;
57.128 + firePropertyChange(WizardProperties.KEY_LICENSE_TEXT, null, this.licenseText);
57.129 + }
57.130 +
57.131 + /** This method is called from within the constructor to
57.132 + * initialize the form.
57.133 + * WARNING: Do NOT modify this code. The content of this method is
57.134 + * always regenerated by the Form Editor.
57.135 + */
57.136 + @SuppressWarnings("unchecked")
57.137 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
57.138 + private void initComponents() {
57.139 +
57.140 + jSplitPane1 = new javax.swing.JSplitPane();
57.141 + fileList = new CheckboxListView();
57.142 + diffPanel = new javax.swing.JPanel();
57.143 + jLabel3 = new javax.swing.JLabel();
57.144 +
57.145 + jSplitPane1.setDividerLocation(200);
57.146 + jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
57.147 + jSplitPane1.setResizeWeight(0.5);
57.148 +
57.149 + fileList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.fileList.border.title"))); // NOI18N
57.150 + jSplitPane1.setTopComponent(fileList);
57.151 +
57.152 + javax.swing.GroupLayout diffPanelLayout = new javax.swing.GroupLayout(diffPanel);
57.153 + diffPanel.setLayout(diffPanelLayout);
57.154 + diffPanelLayout.setHorizontalGroup(
57.155 + diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
57.156 + .addGap(0, 417, Short.MAX_VALUE)
57.157 + );
57.158 + diffPanelLayout.setVerticalGroup(
57.159 + diffPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
57.160 + .addGap(0, 202, Short.MAX_VALUE)
57.161 + );
57.162 +
57.163 + jSplitPane1.setRightComponent(diffPanel);
57.164 +
57.165 + jLabel3.setText(org.openide.util.NbBundle.getMessage(PreviewPanel.class, "PreviewPanel.jLabel3.text")); // NOI18N
57.166 +
57.167 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
57.168 + this.setLayout(layout);
57.169 + layout.setHorizontalGroup(
57.170 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
57.171 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
57.172 + .addContainerGap()
57.173 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
57.174 + .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.LEADING)
57.175 + .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
57.176 + .addContainerGap())
57.177 + );
57.178 + layout.setVerticalGroup(
57.179 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
57.180 + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
57.181 + .addContainerGap()
57.182 + .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)
57.183 + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
57.184 + .addComponent(jLabel3))
57.185 + );
57.186 + }// </editor-fold>//GEN-END:initComponents
57.187 + // Variables declaration - do not modify//GEN-BEGIN:variables
57.188 + private javax.swing.JPanel diffPanel;
57.189 + private javax.swing.JScrollPane fileList;
57.190 + private javax.swing.JLabel jLabel3;
57.191 + private javax.swing.JSplitPane jSplitPane1;
57.192 + // End of variables declaration//GEN-END:variables
57.193 +
57.194 + @Override
57.195 + public ExplorerManager getExplorerManager() {
57.196 + return mgr;
57.197 + }
57.198 +
57.199 + @Override
57.200 + public void propertyChange(PropertyChangeEvent evt) {
57.201 + if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
57.202 + Node[] n = mgr.getSelectedNodes();
57.203 + if (n.length > 0) {
57.204 + FileItem item = n[0].getLookup().lookup(FileItem.class);
57.205 + if (item != null) {
57.206 + setFileItem(item);
57.207 + // XXX use FileUtil.getFileDisplayName rather than FileObject.getPath
57.208 + jLabel3.setText (item.getFile().getPath());
57.209 + } else {
57.210 +// before.setText("");
57.211 + jLabel3.setText (" ");
57.212 + }
57.213 + } else {
57.214 +// before.setText("");
57.215 +// after.setText("");
57.216 + jLabel3.setText(" ");
57.217 + }
57.218 + }
57.219 + }
57.220 +
57.221 + private void setFileItem(FileItem item) {
57.222 + if (item.getFile().isValid()) {
57.223 + // XXX should use Diff API instead (like refactoring preview)
57.224 +// before.setContentType("text/plain");
57.225 +// after.setContentType("text/plain");
57.226 +// before.setText("Loading " + item.getFile().getPath());
57.227 +// after.setText("Loading " + item.getFile().getPath());
57.228 + ItemLoader ldr = new ItemLoader(item);
57.229 + setLoader(ldr);
57.230 + }
57.231 + }
57.232 +
57.233 + private synchronized void setLoader(ItemLoader ldr) {
57.234 + if (loader != null) {
57.235 + loader.cancel();
57.236 + }
57.237 + this.loader = ldr;
57.238 + loader.start();
57.239 + }
57.240 +
57.241 + @Override
57.242 + public void onNodeChecked(Node node) {
57.243 + updateItems();
57.244 + }
57.245 +
57.246 + @Override
57.247 + public void onNodeUnchecked(Node node) {
57.248 + updateItems();
57.249 + }
57.250 +
57.251 + private class ItemLoader implements Runnable {
57.252 +
57.253 + private final Task task;
57.254 + private volatile boolean cancelled;
57.255 + private final FileItem item;
57.256 + private volatile String beforeText = "Cancelled";
57.257 + private volatile String afterText = "Cancelled";
57.258 +
57.259 + public ItemLoader(FileItem item) {
57.260 + this.item = item;
57.261 + task = RequestProcessor.getDefault().create(this);
57.262 + }
57.263 +
57.264 + void start() {
57.265 + task.schedule(200);
57.266 + }
57.267 +
57.268 + public void cancel() {
57.269 + cancelled = true;
57.270 + task.cancel();
57.271 + }
57.272 +
57.273 + private void loadFile() throws IOException {
57.274 + beforeText = FileLoader.loadFile(item.getFile());
57.275 + }
57.276 +
57.277 + @Override
57.278 + public void run() {
57.279 + if (cancelled) {
57.280 + return;
57.281 + }
57.282 + if (!EventQueue.isDispatchThread()) {
57.283 + try {
57.284 + if (cancelled) {
57.285 + return;
57.286 + }
57.287 + if (!item.getFile().isValid()) {
57.288 + beforeText = "Invalid file";
57.289 + afterText = "Invalid file";
57.290 + return;
57.291 + }
57.292 + if (!item.getFile().canRead()) {
57.293 + beforeText = "Cannot read " + item.getFile().getPath();
57.294 + afterText = "Cannot read " + item.getFile().getPath();
57.295 + return;
57.296 + }
57.297 + if (item.getFile().getSize() >= Integer.MAX_VALUE) {
57.298 + beforeText = "File too long: " + item.getFile().getPath();
57.299 + afterText = "File too long: " + item.getFile().getPath();
57.300 + return;
57.301 + }
57.302 + if (item.getFile().getSize() == 0) {
57.303 + beforeText = "Empty file";
57.304 + afterText = "Empty file";
57.305 + return;
57.306 + }
57.307 + if (cancelled) {
57.308 + return;
57.309 + }
57.310 + try {
57.311 + loadFile();
57.312 + } catch (IOException ex) {
57.313 + ByteArrayOutputStream out = new ByteArrayOutputStream();
57.314 + PrintWriter w = new PrintWriter(out);
57.315 + ex.printStackTrace(w);
57.316 + beforeText = new String(out.toByteArray());
57.317 + afterText = "Error";
57.318 + return;
57.319 + }
57.320 + if (cancelled) {
57.321 + return;
57.322 + }
57.323 + if (beforeText.length() == 0) {
57.324 + afterText = "";
57.325 + return;
57.326 + }
57.327 + afterText = transform(beforeText, item.getHandler());
57.328 + } finally {
57.329 + if (!cancelled) {
57.330 + EventQueue.invokeLater(this);
57.331 + }
57.332 + }
57.333 + } else {
57.334 + String contentType = item.getFile().getMIMEType();
57.335 + DiffView view;
57.336 + try {
57.337 + view = diff.createDiff(StreamSource.createSource("Before", "Before", contentType, new StringReader(beforeText)),
57.338 + StreamSource.createSource("After", "After", contentType, new StringReader(afterText)));
57.339 + int dloc = jSplitPane1.getDividerLocation();
57.340 + jSplitPane1.setBottomComponent(view.getComponent());
57.341 + jSplitPane1.setDividerLocation(dloc);
57.342 + } catch (IOException ex) {
57.343 + Exceptions.printStackTrace(ex);
57.344 + int dloc = jSplitPane1.getDividerLocation();
57.345 + jSplitPane1.setBottomComponent(diffPanel);
57.346 + jSplitPane1.setDividerLocation(dloc);
57.347 + }
57.348 +
57.349 + }
57.350 + }
57.351 +
57.352 + private String transform(String beforeText, FileHandler handler) {
57.353 + return handler.transform(beforeText, licenseText);
57.354 + }
57.355 + }
57.356 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/PreviewWizardPanel.java Thu Sep 13 09:10:03 2012 +0200
58.3 @@ -0,0 +1,153 @@
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 +
58.43 +package org.netbeans.modules.licensechanger.spi.wizard;
58.44 +
58.45 +import java.beans.PropertyChangeEvent;
58.46 +import java.beans.PropertyChangeListener;
58.47 +import java.util.Set;
58.48 +import javax.swing.event.ChangeListener;
58.49 +import org.netbeans.modules.licensechanger.api.FileHandler;
58.50 +import org.netbeans.modules.licensechanger.spi.wizard.utils.FileChildren.FileItem;
58.51 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
58.52 +import org.openide.WizardDescriptor;
58.53 +import org.openide.WizardValidationException;
58.54 +import org.openide.filesystems.FileObject;
58.55 +import org.openide.util.ChangeSupport;
58.56 +import org.openide.util.HelpCtx;
58.57 +
58.58 +/**
58.59 + *
58.60 + * @author Nils Hoffmann
58.61 + */
58.62 +public class PreviewWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener{
58.63 +
58.64 + /**
58.65 + * The visual component that displays this panel. If you need to access the
58.66 + * component from this class, just use getComponent().
58.67 + */
58.68 + private PreviewPanel component;
58.69 + private WizardDescriptor wiz;
58.70 + private boolean valid = true;
58.71 + private ChangeSupport cs = new ChangeSupport(this);
58.72 +
58.73 + // Get the visual component for the panel. In this template, the component
58.74 + // is kept separate. This can be more efficient: if the wizard is created
58.75 + // but never displayed, or not all panels are displayed, it is better to
58.76 + // create only those which really need to be visible.
58.77 + @Override
58.78 + public PreviewPanel getComponent() {
58.79 + if (component == null) {
58.80 + component = new PreviewPanel();
58.81 + component.addPropertyChangeListener(this);
58.82 + }
58.83 + return component;
58.84 + }
58.85 +
58.86 + @Override
58.87 + public HelpCtx getHelp() {
58.88 + // Show no Help button for this panel:
58.89 + return HelpCtx.DEFAULT_HELP;
58.90 + // If you have context help:
58.91 + // return new HelpCtx("help.key.here");
58.92 + }
58.93 +
58.94 + @Override
58.95 + public boolean isValid() {
58.96 + return valid;
58.97 + }
58.98 +
58.99 + @Override
58.100 + public void addChangeListener(ChangeListener l) {
58.101 + cs.addChangeListener(l);
58.102 + }
58.103 +
58.104 + @Override
58.105 + public void removeChangeListener(ChangeListener l) {
58.106 + cs.removeChangeListener(l);
58.107 + }
58.108 +
58.109 + @Override
58.110 + public void propertyChange(PropertyChangeEvent pce) {
58.111 + cs.fireChange();
58.112 + try {
58.113 + validate();
58.114 + } catch (WizardValidationException ex) {
58.115 + if(wiz!=null) {
58.116 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
58.117 + }
58.118 + }
58.119 + }
58.120 +
58.121 + @Override
58.122 + public void readSettings(WizardDescriptor wiz) {
58.123 + this.wiz = wiz;
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 + Set<FileHandler> fileHandler = (Set<FileHandler>)wiz.getProperty(WizardProperties.KEY_FILE_HANDLERS);
58.129 + Set<FileObject> folders = (Set<FileObject>)wiz.getProperty(WizardProperties.KEY_FOLDERS);
58.130 + if(fileHandler!=null && folders != null) {
58.131 + getComponent().setFolders(folders, fileHandler);
58.132 + }
58.133 + wiz.putProperty(WizardProperties.KEY_ITEMS, null);
58.134 + }
58.135 +
58.136 + @Override
58.137 + public void storeSettings(WizardDescriptor wiz) {
58.138 + wiz.putProperty(WizardProperties.KEY_ITEMS, getComponent().getSelectedItems());
58.139 + }
58.140 +
58.141 + @Override
58.142 + public void validate() throws WizardValidationException {
58.143 + valid = true;
58.144 + Set<FileItem> keyItems = (Set<FileItem>)getComponent().getSelectedItems();
58.145 +
58.146 + if(keyItems==null || keyItems.isEmpty()) {
58.147 + valid = false;
58.148 + throw new WizardValidationException(component, "Please select at least one file!", null);
58.149 + }
58.150 + if(wiz!=null) {
58.151 + wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
58.152 + wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
58.153 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
58.154 + }
58.155 + }
58.156 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersPanel.form Thu Sep 13 09:10:03 2012 +0200
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 CheckboxListView()"/>
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/spi/wizard/Bundle.properties" key="SelectFoldersPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
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/spi/wizard/SelectFoldersPanel.java Thu Sep 13 09:10:03 2012 +0200
60.3 @@ -0,0 +1,169 @@
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 +
60.43 +package org.netbeans.modules.licensechanger.spi.wizard;
60.44 +
60.45 +import java.util.HashSet;
60.46 +import java.util.Set;
60.47 +import org.netbeans.modules.licensechanger.spi.wizard.utils.CheckboxListView;
60.48 +import org.netbeans.modules.licensechanger.spi.wizard.utils.FolderChildren;
60.49 +import org.netbeans.modules.licensechanger.spi.wizard.utils.NodeCheckObserver;
60.50 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
60.51 +import org.openide.explorer.ExplorerManager;
60.52 +import org.openide.explorer.view.CheckableNode;
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, NodeCheckObserver {
60.64 +
60.65 + private final ExplorerManager mgr = new ExplorerManager();
60.66 +
60.67 + public SelectFoldersPanel() {
60.68 + initComponents();
60.69 + view().setNodeCheckObserver(this);
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 + view().setCheckboxesVisible(true);
60.81 + view().setCheckboxesEnabled(true);
60.82 + jLabel1.setEnabled(true);
60.83 + view().setListEnabled(true);
60.84 + }
60.85 +
60.86 + private CheckboxListView view() {
60.87 + return (CheckboxListView) jScrollPane1;
60.88 + }
60.89 +
60.90 + /**
60.91 + * This method is called from within the constructor to initialize the form.
60.92 + * WARNING: Do NOT modify this code. The content of this method is always
60.93 + * regenerated by the Form Editor.
60.94 + */
60.95 + @SuppressWarnings("unchecked")
60.96 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
60.97 + private void initComponents() {
60.98 +
60.99 + jScrollPane1 = new CheckboxListView();
60.100 + jLabel1 = new javax.swing.JLabel();
60.101 +
60.102 + jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
60.103 +
60.104 + jLabel1.setText(org.openide.util.NbBundle.getMessage(SelectFoldersPanel.class, "SelectFoldersPanel.jLabel1.text")); // NOI18N
60.105 +
60.106 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
60.107 + this.setLayout(layout);
60.108 + layout.setHorizontalGroup(
60.109 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
60.110 + .addGroup(layout.createSequentialGroup()
60.111 + .addContainerGap()
60.112 + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
60.113 + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
60.114 + .addComponent(jLabel1))
60.115 + .addContainerGap())
60.116 + );
60.117 + layout.setVerticalGroup(
60.118 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
60.119 + .addGroup(layout.createSequentialGroup()
60.120 + .addContainerGap()
60.121 + .addComponent(jLabel1)
60.122 + .addGap(9, 9, 9)
60.123 + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE)
60.124 + .addContainerGap())
60.125 + );
60.126 + }// </editor-fold>//GEN-END:initComponents
60.127 + // Variables declaration - do not modify//GEN-BEGIN:variables
60.128 + private javax.swing.JLabel jLabel1;
60.129 + private javax.swing.JScrollPane jScrollPane1;
60.130 + // End of variables declaration//GEN-END:variables
60.131 +
60.132 + @Override
60.133 + public ExplorerManager getExplorerManager() {
60.134 + return mgr;
60.135 + }
60.136 +
60.137 + @Override
60.138 + public void onNodeChecked(Node node) {
60.139 + updateFolders();
60.140 + }
60.141 +
60.142 + @Override
60.143 + public void onNodeUnchecked(Node node) {
60.144 + updateFolders();
60.145 + }
60.146 +
60.147 + public void setRootFiles(Set<FileObject> roots) {
60.148 + AbstractNode root = new AbstractNode(Children.create(new FolderChildren(roots.toArray(new FileObject[roots.size()])) {
60.149 + @Override
60.150 + public void onAllNodesCreated() {
60.151 + enableUI();
60.152 + updateFolders();
60.153 + }
60.154 + }, true));
60.155 + mgr.setRootContext(root);
60.156 + firePropertyChange("rootFiles", null, roots);
60.157 + }
60.158 +
60.159 + public Set<FileObject> getSelectedFolders() {
60.160 + Set<FileObject> folders = new HashSet<FileObject>();
60.161 + for (Node n : mgr.getRootContext().getChildren().getNodes(true)) {
60.162 + CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
60.163 + if (cn != null && cn.isSelected()) {
60.164 + FileObject f = n.getLookup().lookup(FileObject.class);
60.165 + if (f != null) {
60.166 + folders.add(f);
60.167 + }
60.168 + }
60.169 + }
60.170 + return folders;
60.171 + }
60.172 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/SelectFoldersWizardPanel.java Thu Sep 13 09:10:03 2012 +0200
61.3 @@ -0,0 +1,150 @@
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 +
61.43 +package org.netbeans.modules.licensechanger.spi.wizard;
61.44 +
61.45 +import java.beans.PropertyChangeEvent;
61.46 +import java.beans.PropertyChangeListener;
61.47 +import java.util.Set;
61.48 +import javax.swing.event.ChangeListener;
61.49 +import org.netbeans.modules.licensechanger.spi.wizard.utils.WizardProperties;
61.50 +import org.openide.WizardDescriptor;
61.51 +import org.openide.WizardValidationException;
61.52 +import org.openide.filesystems.FileObject;
61.53 +import org.openide.util.ChangeSupport;
61.54 +import org.openide.util.HelpCtx;
61.55 +
61.56 +/**
61.57 + *
61.58 + * @author Nils Hoffmann
61.59 + */
61.60 +public class SelectFoldersWizardPanel implements WizardDescriptor.ValidatingPanel<WizardDescriptor>, PropertyChangeListener {
61.61 +
61.62 + /**
61.63 + * The visual component that displays this panel. If you need to access the
61.64 + * component from this class, just use getComponent().
61.65 + */
61.66 + private SelectFoldersPanel component;
61.67 + private WizardDescriptor wiz;
61.68 + private boolean valid = false;
61.69 + private ChangeSupport cs = new ChangeSupport(this);
61.70 +
61.71 + // Get the visual component for the panel. In this template, the component
61.72 + // is kept separate. This can be more efficient: if the wizard is created
61.73 + // but never displayed, or not all panels are displayed, it is better to
61.74 + // create only those which really need to be visible.
61.75 + @Override
61.76 + public SelectFoldersPanel getComponent() {
61.77 + if (component == null) {
61.78 + component = new SelectFoldersPanel();
61.79 + component.addPropertyChangeListener(this);
61.80 + }
61.81 + return component;
61.82 + }
61.83 +
61.84 + @Override
61.85 + public HelpCtx getHelp() {
61.86 + // Show no Help button for this panel:
61.87 + return HelpCtx.DEFAULT_HELP;
61.88 + // If you have context help:
61.89 + // return new HelpCtx("help.key.here");
61.90 + }
61.91 +
61.92 + @Override
61.93 + public boolean isValid() {
61.94 + return valid;
61.95 + }
61.96 +
61.97 + @Override
61.98 + public void addChangeListener(ChangeListener l) {
61.99 + cs.addChangeListener(l);
61.100 + }
61.101 +
61.102 + @Override
61.103 + public void removeChangeListener(ChangeListener l) {
61.104 + cs.removeChangeListener(l);
61.105 + }
61.106 +
61.107 + @Override
61.108 + public void propertyChange(PropertyChangeEvent pce) {
61.109 + cs.fireChange();
61.110 + try{
61.111 + validate();
61.112 + }catch(WizardValidationException ex) {
61.113 + if(wiz!=null) {
61.114 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, ex.getMessage());
61.115 + }
61.116 + }
61.117 + }
61.118 +
61.119 + @Override
61.120 + public void readSettings(WizardDescriptor wiz) {
61.121 + this.wiz = wiz;
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 + getComponent().setRootFiles((Set<FileObject>)obj);
61.127 + }
61.128 + }else{
61.129 + getComponent().setRootFiles(folders);
61.130 + }
61.131 + }
61.132 +
61.133 + @Override
61.134 + public void storeSettings(WizardDescriptor wiz) {
61.135 + Set<FileObject> folders = getComponent().getSelectedFolders();
61.136 + wiz.putProperty(WizardProperties.KEY_FOLDERS, folders);
61.137 + }
61.138 +
61.139 + @Override
61.140 + public void validate() throws WizardValidationException {
61.141 + valid = true;
61.142 + Set<FileObject> folders = getComponent().getSelectedFolders();
61.143 + if(folders==null || folders.isEmpty()) {
61.144 + valid = false;
61.145 + throw new WizardValidationException(component, "Please select at least one folder!", null);
61.146 + }
61.147 + if(wiz!=null) {
61.148 + wiz.putProperty(WizardDescriptor.PROP_INFO_MESSAGE, null);
61.149 + wiz.putProperty(WizardDescriptor.PROP_WARNING_MESSAGE, null);
61.150 + wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);
61.151 + }
61.152 + }
61.153 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Bundle.properties Thu Sep 13 09:10:03 2012 +0200
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/spi/wizard/utils/CheckableNodeCapability.java Thu Sep 13 09:10:03 2012 +0200
63.3 @@ -0,0 +1,76 @@
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 +
63.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
63.44 +
63.45 +import org.openide.explorer.view.CheckableNode;
63.46 +
63.47 +/**
63.48 + * Implements {@see CheckableNode} to allow display and
63.49 + * use of checkable nodes in views.
63.50 + *
63.51 + * @author Nils Hoffmann
63.52 + */
63.53 +public class CheckableNodeCapability implements CheckableNode {
63.54 +
63.55 + private boolean checkable = true;
63.56 + private boolean checkEnabled = true;
63.57 + private boolean selected = true;
63.58 +
63.59 + @Override
63.60 + public boolean isCheckable() {
63.61 + return checkable;
63.62 + }
63.63 +
63.64 + @Override
63.65 + public boolean isCheckEnabled() {
63.66 + return checkEnabled;
63.67 + }
63.68 +
63.69 + @Override
63.70 + public Boolean isSelected() {
63.71 + return selected;
63.72 + }
63.73 +
63.74 + @Override
63.75 + public void setSelected(Boolean selected) {
63.76 + this.selected = selected.booleanValue();
63.77 + }
63.78 +
63.79 +}
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/CheckboxListView.java Thu Sep 13 09:10:03 2012 +0200
64.3 @@ -0,0 +1,421 @@
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 +
64.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
64.44 +
64.45 +import java.awt.Component;
64.46 +import java.awt.Dimension;
64.47 +import java.awt.Graphics;
64.48 +import java.awt.Insets;
64.49 +import java.awt.event.KeyAdapter;
64.50 +import java.awt.event.KeyEvent;
64.51 +import java.awt.event.MouseEvent;
64.52 +import java.awt.event.MouseListener;
64.53 +import javax.swing.BorderFactory;
64.54 +import javax.swing.JCheckBox;
64.55 +import javax.swing.JComponent;
64.56 +import javax.swing.JList;
64.57 +import javax.swing.ListSelectionModel;
64.58 +import javax.swing.SwingUtilities;
64.59 +import javax.swing.UIManager;
64.60 +import org.openide.awt.HtmlRenderer.Renderer;
64.61 +import org.openide.explorer.ExplorerManager;
64.62 +import org.openide.explorer.ExplorerManager.Provider;
64.63 +import org.openide.explorer.view.CheckableNode;
64.64 +import org.openide.explorer.view.ListView;
64.65 +import org.openide.explorer.view.NodeRenderer;
64.66 +import org.openide.nodes.Node;
64.67 +
64.68 +/**
64.69 + * A JList-based list of Nodes which show checkboxes.
64.70 + *
64.71 + * @author Tim Boudreau (original author)
64.72 + * @author Nils Hoffmann (changed to use CheckableNodeCapability)
64.73 + */
64.74 +public class CheckboxListView extends ListView {
64.75 +
64.76 +// public static final String SELECTED = "selected"; //NOI18N
64.77 + private final EventHandler ml = new EventHandler();
64.78 + private boolean checkboxesEnabled = true;
64.79 + private NodeCheckObserver observer;
64.80 +
64.81 + public CheckboxListView() {
64.82 + setPopupAllowed(false);
64.83 + setViewportBorder(BorderFactory.createMatteBorder(5, 5, 5, 5,
64.84 + UIManager.getColor("text"))); //NOI18N
64.85 + }
64.86 +
64.87 + @Override
64.88 + public void addNotify() {
64.89 + super.addNotify();
64.90 + //Need to do this here since overriding createList does not work -
64.91 + //the list is being created somewhere else; this is the best place
64.92 + //to intercept it
64.93 + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
64.94 + if (checkboxesEnabled) {
64.95 + enableCheckboxes();
64.96 + }
64.97 + }
64.98 + private boolean enabled = true;
64.99 +
64.100 + public void setCheckboxesEnabled(boolean enabled) {
64.101 + this.enabled = enabled;
64.102 + }
64.103 +
64.104 + public void setListEnabled(boolean enabled) {
64.105 + list.setEnabled(enabled);
64.106 + }
64.107 +
64.108 + /**
64.109 + * Set an observer, which will be notified when nodes are checked or
64.110 + * unchecked.
64.111 + *
64.112 + * @param observer
64.113 + */
64.114 + public final void setNodeCheckObserver(NodeCheckObserver observer) {
64.115 + this.observer = observer;
64.116 + }
64.117 +
64.118 + @Override
64.119 + public void removeNotify() {
64.120 + super.removeNotify();
64.121 + if (checkboxesEnabled) {
64.122 + disableCheckboxes();
64.123 + }
64.124 + }
64.125 +
64.126 + public synchronized final void setCheckboxesVisible(boolean val) {
64.127 + if (val != checkboxesEnabled) {
64.128 + checkboxesEnabled = val;
64.129 + if (isDisplayable()) {
64.130 + if (val) {
64.131 + enableCheckboxes();
64.132 + } else {
64.133 + disableCheckboxes();
64.134 + }
64.135 + }
64.136 + }
64.137 + }
64.138 +
64.139 + private void enableCheckboxes() {
64.140 + list.addMouseListener(ml);
64.141 + list.addKeyListener(ml);
64.142 + list.setCellRenderer(new CheckboxCellRenderer());
64.143 + repaint();
64.144 + }
64.145 +
64.146 + private void disableCheckboxes() {
64.147 + list.removeMouseListener(ml);
64.148 + list.removeKeyListener(ml);
64.149 + list.setCellRenderer(new NodeRenderer());
64.150 + repaint();
64.151 + }
64.152 +
64.153 + public void setCheckedNodes(Iterable<Node> nodes) {
64.154 + clearCheckedNodes();
64.155 + for (Node n : nodes) {
64.156 + CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
64.157 + if (cn != null) {
64.158 + cn.setSelected(Boolean.TRUE);
64.159 + }
64.160 +// n.setValue(SELECTED, Boolean.TRUE);
64.161 + }
64.162 + repaint();
64.163 + }
64.164 +
64.165 + public void clearCheckedNodes() {
64.166 + for (Node n : allNodes()) {
64.167 + CheckableNode cn = n.getLookup().lookup(CheckableNode.class);
64.168 + if (cn != null) {
64.169 + cn.setSelected(Boolean.FALSE);
64.170 + if (observer != null) {
64.171 + observer.onNodeUnchecked(n);
64.172 + }
64.173 + }
64.174 +// boolean val = Boolean.TRUE.equals(n.getValue(SELECTED));
64.175 +//
64.176 +// n.setValue(SELECTED, Boolean.FALSE);
64.177 + }
64.178 + repaint();
64.179 + }
64.180 +
64.181 + private void selectNode(int index) {
64.182 + if (!enabled) {
64.183 + return;
64.184 + }
64.185 + if (index < 0) {
64.186 + return;
64.187 + }
64.188 + ExplorerManager.Provider prov = (Provider) SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
64.189 + if (prov != null) {
64.190 + Node[] n = prov.getExplorerManager().getRootContext().getChildren().getNodes();
64.191 + if (index < n.length) {
64.192 + CheckableNode cn = n[index].getLookup().lookup(CheckableNode.class);
64.193 + if (cn != null) {
64.194 + boolean wasSet = cn.isSelected();
64.195 + if (wasSet) {
64.196 + cn.setSelected(Boolean.FALSE);
64.197 + } else {
64.198 + cn.setSelected(Boolean.TRUE);
64.199 + }
64.200 + if (observer != null) {
64.201 + if (!wasSet) {
64.202 + observer.onNodeChecked(n[index]);
64.203 + } else {
64.204 + observer.onNodeUnchecked(n[index]);
64.205 + }
64.206 + }
64.207 + repaint();
64.208 + }
64.209 +// Boolean val = (Boolean) n[index].getValue(SELECTED);
64.210 +// boolean wasSet = val != null && val.booleanValue();
64.211 +// n[index].setValue(SELECTED, !wasSet);
64.212 + }
64.213 + }
64.214 + }
64.215 +
64.216 + private Node[] allNodes() {
64.217 + ExplorerManager.Provider prov = (Provider) SwingUtilities.getAncestorOfClass(ExplorerManager.Provider.class, this);
64.218 + return prov == null ? new Node[0]
64.219 + : prov.getExplorerManager().getRootContext().getChildren().getNodes();
64.220 + }
64.221 +
64.222 + private boolean isChecked(int index) {
64.223 + if (index < 0) {
64.224 + return false;
64.225 + }
64.226 + Node[] n = allNodes();
64.227 + if(index>n.length-1) {
64.228 + return false;
64.229 + }
64.230 + CheckableNode cn = n[index].getLookup().lookup(CheckableNode.class);
64.231 + if (cn != null) {
64.232 + return cn.isSelected();
64.233 + }else{
64.234 + return false;
64.235 + }
64.236 +// return index > n.length - 1 ? false
64.237 +// : Boolean.TRUE.equals(n[index].getValue(SELECTED));
64.238 + }
64.239 +
64.240 + private class EventHandler extends KeyAdapter implements MouseListener {
64.241 +
64.242 + @Override
64.243 + public void mouseClicked(MouseEvent e) {
64.244 + if (e.getClickCount() == 2) {
64.245 + selectNode(findIndex(e));
64.246 + e.consume();
64.247 + }
64.248 + }
64.249 +
64.250 + private int findIndex(MouseEvent e) {
64.251 + JList jl = (JList) e.getSource();
64.252 + int result = jl.locationToIndex(e.getPoint());
64.253 + return result;
64.254 + }
64.255 + int pressIndex = -1;
64.256 +
64.257 + @Override
64.258 + public void mousePressed(MouseEvent e) {
64.259 + pressIndex = findIndex(e);
64.260 + }
64.261 +
64.262 + @Override
64.263 + public void mouseReleased(MouseEvent e) {
64.264 + int ix = findIndex(e);
64.265 + if (pressIndex == ix) {
64.266 + if (e.getX() <= 24) {
64.267 + selectNode(ix);
64.268 + e.consume();
64.269 + }
64.270 + }
64.271 + pressIndex = -1;
64.272 + }
64.273 +
64.274 + @Override
64.275 + public void mouseEntered(MouseEvent e) {
64.276 + //do nothing
64.277 + }
64.278 +
64.279 + @Override
64.280 + public void mouseExited(MouseEvent e) {
64.281 + //do nothing
64.282 + }
64.283 +
64.284 + @Override
64.285 + public void keyTyped(KeyEvent e) {
64.286 + JList jl = (JList) e.getSource();
64.287 + if (e.getKeyChar() == '\n' && e.getModifiers() == 0) {
64.288 + selectNode(jl.getSelectedIndex());
64.289 + e.consume();
64.290 + }
64.291 + }
64.292 + }
64.293 +
64.294 + private final class CheckboxCellRenderer extends NodeRenderer {
64.295 +
64.296 + final WrapperComponent rr = new WrapperComponent();
64.297 +
64.298 + @Override
64.299 + public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean cellHasFocus) {
64.300 + cellHasFocus = false;
64.301 + Component c = super.getListCellRendererComponent(list, value, index, sel, cellHasFocus);
64.302 + Renderer r = (Renderer) c;
64.303 + r.setIndent(20);
64.304 + rr.setSelected(isChecked(index));
64.305 + rr.setToPaint(c);
64.306 + rr.setEnabled(enabled);
64.307 + c.setEnabled(enabled);
64.308 + return rr;
64.309 + }
64.310 + }
64.311 +
64.312 + private static class WrapperComponent extends JComponent {
64.313 +
64.314 + Component toPaint;
64.315 + private final JCheckBox box = new JCheckBox();
64.316 +
64.317 + WrapperComponent() {
64.318 + add(box);
64.319 + box.setBorder(BorderFactory.createEmptyBorder());
64.320 + }
64.321 +
64.322 + void setToPaint(Component toPaint) {
64.323 + if (this.toPaint != toPaint) {
64.324 + if (this.toPaint != null) {
64.325 + remove(this.toPaint);
64.326 + }
64.327 + this.toPaint = toPaint;
64.328 + box.setBackground(toPaint.getBackground());
64.329 + add(toPaint);
64.330 + }
64.331 + doLayout();
64.332 + }
64.333 +
64.334 + @Override
64.335 + public Dimension getPreferredSize() {
64.336 + Dimension a = box.getPreferredSize();
64.337 + Dimension b = toPaint == null ? new Dimension(0, 0) : toPaint.getPreferredSize();
64.338 + return new Dimension(a.width + b.width, Math.max(22, Math.max(a.height, b.height) + 1));
64.339 + }
64.340 +
64.341 + @Override
64.342 + public void doLayout() {
64.343 + Dimension a = box.getPreferredSize();
64.344 + Dimension size = getPreferredSize();
64.345 + Insets ins = getInsets();
64.346 + size.height -= ins.top + ins.bottom;
64.347 + int x = ins.left;
64.348 + int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
64.349 + box.setBounds(x, y, a.width, a.height);
64.350 + x += a.width;
64.351 + if (toPaint != null) {
64.352 + Dimension c = toPaint.getPreferredSize();
64.353 + toPaint.setBounds(x, 0, getWidth() - x, c.height);
64.354 + }
64.355 + }
64.356 +
64.357 + @Override
64.358 + public void paint(Graphics g) {
64.359 + doLayout();
64.360 + box.paint(g);
64.361 + if (toPaint != null) {
64.362 + toPaint.paint(g);
64.363 + }
64.364 + }
64.365 +
64.366 + /*
64.367 + @Override
64.368 + public void doLayout() {
64.369 + Dimension a = box.getPreferredSize();
64.370 + System.err.println("Box preferred size " + a);
64.371 + Dimension size = getPreferredSize();
64.372 + System.err.println("My Preferred Size " + size);
64.373 + Insets ins = getInsets();
64.374 + size.height -= ins.top + ins.bottom;
64.375 + int x = ins.left;
64.376 + int y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
64.377 + box.setBounds(x, y, a.width, a.height);
64.378 + x += a.width;
64.379 + if (toPaint != null) {
64.380 + a = toPaint.getPreferredSize();
64.381 + System.err.println("toPaint preferred size " + a);
64.382 + a.height = Math.max(22, a.height);
64.383 + y = a.height == size.height ? ins.top : ins.top + ((size.height / 2) - (a.height / 2));
64.384 + toPaint.setBounds(x, y, a.width, a.height);
64.385 + // toPaint.setBounds (x, 0, getWidth() - x, getHeight());
64.386 + }
64.387 +
64.388 + System.err.println("---------------------------------------");
64.389 + System.err.println("toPaint bounds " + toPaint.getBounds());
64.390 + System.err.println("toPaint text " + ((JLabel) toPaint).getText());
64.391 + System.err.println("toPaint fg " + toPaint.getForeground());
64.392 + }
64.393 + */
64.394 + void setSelected(boolean val) {
64.395 + box.setSelected(val);
64.396 + }
64.397 + /*
64.398 + @Override
64.399 + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
64.400 + //do nothing
64.401 + }
64.402 +
64.403 + @Override
64.404 + public void repaint(int x, int y, int w, int h) {
64.405 + }
64.406 +
64.407 + @Override
64.408 + public void invalidate() {
64.409 + }
64.410 +
64.411 + @Override
64.412 + public void revalidate() {
64.413 + }
64.414 +
64.415 + @Override
64.416 + public void repaint() {
64.417 + }
64.418 +
64.419 + @Override
64.420 + public void validate() {
64.421 + }
64.422 + */
64.423 + }
64.424 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileChildren.java Thu Sep 13 09:10:03 2012 +0200
65.3 @@ -0,0 +1,155 @@
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 +
65.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
65.44 +
65.45 +import java.util.Collection;
65.46 +import java.util.Collections;
65.47 +import java.util.HashSet;
65.48 +import java.util.LinkedList;
65.49 +import java.util.List;
65.50 +import java.util.Set;
65.51 +import javax.swing.Action;
65.52 +import org.netbeans.modules.licensechanger.api.FileHandler;
65.53 +import org.openide.filesystems.FileObject;
65.54 +import org.openide.loaders.DataObject;
65.55 +import org.openide.loaders.DataObjectNotFoundException;
65.56 +import org.openide.nodes.ChildFactory;
65.57 +import org.openide.nodes.FilterNode;
65.58 +import org.openide.nodes.Node;
65.59 +import org.openide.util.Exceptions;
65.60 +import org.openide.util.Lookup;
65.61 +import org.openide.util.lookup.Lookups;
65.62 +import org.openide.util.lookup.ProxyLookup;
65.63 +
65.64 +/**
65.65 + *
65.66 + * @author Tim Boudreau (original author)
65.67 + * @author Nils Hoffmann (changed to use CheckableNodeCapability)
65.68 + */
65.69 +public class FileChildren extends ChildFactory.Detachable<FileObject> {
65.70 +
65.71 + private final Set<FileObject> folders;
65.72 + private final Collection<? extends FileHandler> allHandlers;
65.73 + private final Set<FileItem> items = Collections.synchronizedSet(new HashSet<FileItem>());
65.74 +
65.75 + public FileChildren(Set<FileObject> folders, Set<FileHandler> fileHandler) {
65.76 + assert folders != null;
65.77 + this.folders = new HashSet<FileObject>(folders);
65.78 + allHandlers = fileHandler;//Lookup.getDefault().lookupAll(FileHandler.class);
65.79 + //settings.put(WizardProperties.KEY_ITEMS, items);
65.80 + }
65.81 +
65.82 + @Override
65.83 + protected boolean createKeys(List<FileObject> toPopulate) {
65.84 + toPopulate.addAll(folders);
65.85 + return true;
65.86 + }
65.87 +
65.88 + @Override
65.89 + protected Node[] createNodesForKey(FileObject key) {
65.90 + List<Node> result = new LinkedList<Node>();
65.91 + for (FileObject fo : key.getChildren()) {
65.92 + if (fo.isData()) {
65.93 + for (FileHandler h : allHandlers) {
65.94 + if (h.match(fo)) {
65.95 + try {
65.96 + DataObject dob = DataObject.find(fo);
65.97 + FileItem item = new FileItem(h, fo);
65.98 + items.add(item);
65.99 + FN fn = new FN (dob.getNodeDelegate(), item);
65.100 + boolean shouldChange = !h.shouldSkipFile(fo);
65.101 + result.add(fn);
65.102 +// fn.setValue (CheckboxListView.SELECTED, shouldChange);
65.103 + break;
65.104 + } catch (DataObjectNotFoundException ex) {
65.105 + Exceptions.printStackTrace(ex);
65.106 + }
65.107 + }
65.108 + }
65.109 + }
65.110 + }
65.111 + return result.toArray(new Node[result.size()]);
65.112 + }
65.113 +
65.114 + public static final class FileItem {
65.115 +
65.116 + FileHandler handler;
65.117 + FileObject file;
65.118 +
65.119 + public FileItem(FileHandler handler, FileObject file) {
65.120 + this.handler = handler;
65.121 + this.file = file;
65.122 + }
65.123 +
65.124 + public FileObject getFile() {
65.125 + return file;
65.126 + }
65.127 +
65.128 + public FileHandler getHandler() {
65.129 + return handler;
65.130 + }
65.131 + }
65.132 +
65.133 + private static final class FN extends FilterNode {
65.134 +
65.135 + FN(Node orig, FileItem item) {
65.136 + super(orig, Children.LEAF, new ProxyLookup(
65.137 + Lookups.fixed(item,new CheckableNodeCapability()),
65.138 + orig.getLookup()));
65.139 + disableDelegation(DELEGATE_GET_ACTIONS);
65.140 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
65.141 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
65.142 + disableDelegation(DELEGATE_GET_DISPLAY_NAME);
65.143 + disableDelegation(DELEGATE_GET_VALUE);
65.144 + disableDelegation(DELEGATE_SET_VALUE);
65.145 + disableDelegation(DELEGATE_SET_NAME);
65.146 + disableDelegation(DELEGATE_GET_NAME);
65.147 +// setValue(CheckboxListView.SELECTED, Boolean.TRUE);
65.148 + setName(item.file.getPath());
65.149 + setDisplayName(item.file.getPath());
65.150 + setShortDescription(item.file.getPath());
65.151 + }
65.152 +
65.153 + @Override
65.154 + public Action[] getActions(boolean ignored) {
65.155 + return new Action[0];
65.156 + }
65.157 + }
65.158 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FileLoader.java Thu Sep 13 09:10:03 2012 +0200
66.3 @@ -0,0 +1,81 @@
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 +
66.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
66.44 +
66.45 +import java.io.BufferedInputStream;
66.46 +import java.io.ByteArrayOutputStream;
66.47 +import java.io.IOException;
66.48 +import java.io.InputStream;
66.49 +import java.io.UnsupportedEncodingException;
66.50 +import java.nio.charset.Charset;
66.51 +import org.netbeans.api.queries.FileEncodingQuery;
66.52 +import org.openide.filesystems.FileObject;
66.53 +import org.openide.filesystems.FileUtil;
66.54 +import org.openide.util.Utilities;
66.55 +
66.56 +/**
66.57 + * @author Tim Boudreau
66.58 + * @author Nils Hoffmann (Refactoring)
66.59 + */
66.60 +public class FileLoader {
66.61 + public static String loadFile(FileObject file) throws IOException {
66.62 + Charset encoding = FileEncodingQuery.getEncoding(file);
66.63 + InputStream in = new BufferedInputStream(file.getInputStream());
66.64 + ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.getSize());
66.65 + try {
66.66 + FileUtil.copy(in, out);
66.67 + try {
66.68 + String result = new String(out.toByteArray(), encoding.name());
66.69 + String sep = System.getProperty ("line.separator");
66.70 + //Convert everything internally to use \n
66.71 + if (!"\n".equals(sep) && sep != null) {
66.72 + return Utilities.replaceString(result, sep, "\n");
66.73 + } else {
66.74 + return result;
66.75 + }
66.76 + } catch (UnsupportedEncodingException q) {
66.77 + return new String(out.toByteArray(), FileEncodingQuery.getDefaultEncoding().name());
66.78 + }
66.79 + } finally {
66.80 + in.close();
66.81 + out.close();
66.82 + }
66.83 + }
66.84 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/FolderChildren.java Thu Sep 13 09:10:03 2012 +0200
67.3 @@ -0,0 +1,186 @@
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 +
67.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
67.44 +
67.45 +import java.awt.EventQueue;
67.46 +import java.util.List;
67.47 +import javax.swing.Action;
67.48 +import org.netbeans.api.queries.VisibilityQuery;
67.49 +import org.openide.explorer.view.CheckableNode;
67.50 +import org.openide.filesystems.FileObject;
67.51 +import org.openide.filesystems.FileUtil;
67.52 +import org.openide.loaders.DataObject;
67.53 +import org.openide.loaders.DataObjectNotFoundException;
67.54 +import org.openide.nodes.AbstractNode;
67.55 +import org.openide.nodes.ChildFactory;
67.56 +import org.openide.nodes.Children;
67.57 +import org.openide.nodes.FilterNode;
67.58 +import org.openide.nodes.Node;
67.59 +import org.openide.util.Exceptions;
67.60 +import org.openide.util.NbBundle;
67.61 +import org.openide.util.NbCollections;
67.62 +import org.openide.util.lookup.Lookups;
67.63 +import org.openide.util.lookup.ProxyLookup;
67.64 +
67.65 +/**
67.66 + *
67.67 + * @author Tim Boudreau (original author)
67.68 + * @author Nils Hoffmann (changed to use CheckableNodeCapability)
67.69 + */
67.70 +public abstract class FolderChildren extends ChildFactory.Detachable<FileObject> implements Runnable {
67.71 + private FileObject[] roots;
67.72 + volatile int keyCount = 0;
67.73 + private int nodeCount = 0;
67.74 + private volatile boolean cancelled = false;
67.75 +
67.76 + public FolderChildren (FileObject[] roots) {
67.77 + this.roots = roots;
67.78 + }
67.79 +
67.80 + @Override
67.81 + protected Node createWaitNode() {
67.82 + AbstractNode result = new AbstractNode(Children.LEAF);
67.83 + result.setDisplayName(NbBundle.getMessage(FolderChildren.class, "MSG_WAIT_FOLDERS"));
67.84 + return result;
67.85 + }
67.86 +
67.87 + @Override
67.88 + public void addNotify() {
67.89 + cancelled = false;
67.90 + super.addNotify();
67.91 + keyCount = 0;
67.92 + nodeCount = 0;
67.93 + }
67.94 +
67.95 + @Override
67.96 + protected void removeNotify() {
67.97 + super.removeNotify();
67.98 + cancelled = true;
67.99 + }
67.100 +
67.101 + private boolean shouldSkipFolder (FileObject folder) {
67.102 + // XXX use VisibilityQuery instead
67.103 + String path = folder.getPath();
67.104 + return path.contains(".svn") || path.contains(".cvs") || path.contains(".hg") ||
67.105 + path.endsWith(".svn") || path.endsWith(".cvs") || path.endsWith(".hg") ||
67.106 + path.contains("target") || path.endsWith("target") || path.contains("build") || path.endsWith("build");
67.107 + }
67.108 +
67.109 + @Override
67.110 + protected boolean createKeys(List<FileObject> toPopulate) {
67.111 + for (FileObject f : roots) {
67.112 + toPopulate.add(f);
67.113 + keyCount++;
67.114 + for (FileObject fo : NbCollections.iterable(f.getChildren(true))) {
67.115 + if (fo.isFolder()) {
67.116 + if (shouldSkipFolder(fo)) {
67.117 + continue;
67.118 + }
67.119 + toPopulate.add(fo);
67.120 + keyCount++;
67.121 + }
67.122 + if (cancelled) {
67.123 + return true;
67.124 + }
67.125 + }
67.126 + if (cancelled) {
67.127 + return true;
67.128 + }
67.129 + }
67.130 + return true;
67.131 + }
67.132 +
67.133 + @Override
67.134 + protected Node createNodeForKey(FileObject f) {
67.135 + try {
67.136 + Node n = DataObject.find(f).getNodeDelegate();
67.137 + nodeCount++;
67.138 + if (nodeCount == keyCount) {
67.139 + EventQueue.invokeLater(this);
67.140 + }
67.141 + return new FN(n, f);
67.142 + } catch (DataObjectNotFoundException ex) {
67.143 + Exceptions.printStackTrace(ex);
67.144 + return null;
67.145 + }
67.146 + }
67.147 +
67.148 + public abstract void onAllNodesCreated();
67.149 +
67.150 + @Override
67.151 + public void run() {
67.152 + onAllNodesCreated();
67.153 + }
67.154 +
67.155 + private static final class FN extends FilterNode {
67.156 + FN(Node orig, FileObject f) {
67.157 + super (orig, Children.LEAF, new ProxyLookup(
67.158 + Lookups.fixed(f,new CheckableNodeCapability()),
67.159 + orig.getLookup()));
67.160 + disableDelegation(DELEGATE_GET_ACTIONS);
67.161 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
67.162 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
67.163 + disableDelegation(DELEGATE_GET_DISPLAY_NAME);
67.164 + disableDelegation(DELEGATE_GET_VALUE);
67.165 + disableDelegation(DELEGATE_SET_VALUE);
67.166 + disableDelegation(DELEGATE_SET_NAME);
67.167 + disableDelegation(DELEGATE_GET_NAME);
67.168 + String p = f.getPath();
67.169 + // XXX this is a pretty arbitrary list... maybe check SharabilityQuery?
67.170 + if (!p.endsWith("nbproject") &&
67.171 + !p.endsWith("nbproject/private")) { //NOI18N
67.172 +// setValue (CheckboxListView.SELECTED, Boolean.TRUE);
67.173 +
67.174 + }else{
67.175 + CheckableNode cn = getLookup().lookup(CheckableNode.class);
67.176 + if(cn!=null) {
67.177 + cn.setSelected(false);
67.178 + }
67.179 + }
67.180 + setName(p);
67.181 + setDisplayName(FileUtil.getFileDisplayName(f));
67.182 + }
67.183 +
67.184 + @Override
67.185 + public Action[] getActions(boolean ignored) {
67.186 + return new Action[0];
67.187 + }
67.188 + }
67.189 +}
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LicenseChangerRunnable.java Thu Sep 13 09:10:03 2012 +0200
68.3 @@ -0,0 +1,163 @@
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.spi.wizard.utils;
68.43 +
68.44 +import java.io.*;
68.45 +import java.nio.charset.Charset;
68.46 +import java.util.Properties;
68.47 +import java.util.Set;
68.48 +import org.netbeans.api.progress.ProgressHandle;
68.49 +import org.netbeans.api.progress.ProgressHandleFactory;
68.50 +import org.netbeans.api.project.*;
68.51 +import org.netbeans.api.project.ui.OpenProjects;
68.52 +import org.netbeans.api.queries.FileEncodingQuery;
68.53 +import org.netbeans.modules.licensechanger.spi.wizard.LineEndingsPanel;
68.54 +import org.openide.WizardDescriptor;
68.55 +import org.openide.filesystems.*;
68.56 +import org.openide.filesystems.FileUtil;
68.57 +import org.openide.util.EditableProperties;
68.58 +import org.openide.util.Exceptions;
68.59 +
68.60 +/**
68.61 + * @author Tim Boudreau
68.62 + * @author Nils Hoffmann (Refactoring)
68.63 + */
68.64 +public class LicenseChangerRunnable implements Runnable {
68.65 +
68.66 + private final WizardDescriptor wizard;
68.67 +
68.68 + public LicenseChangerRunnable(WizardDescriptor wizard) {
68.69 + this.wizard = wizard;
68.70 + }
68.71 +
68.72 + @Override
68.73 + public void run() {
68.74 + ProgressHandle handle = ProgressHandleFactory.createHandle("Changing license headers");
68.75 + try {
68.76 + Set<FileChildren.FileItem> items = (Set<FileChildren.FileItem>) wizard.getProperty(WizardProperties.KEY_ITEMS);
68.77 + final String licenseText = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_TEXT);
68.78 + final String licenseName = (String) wizard.getProperty(WizardProperties.KEY_LICENSE_NAME);
68.79 + int ix = 0;
68.80 + int max = items.size();
68.81 + handle.start(max);
68.82 + Charset enc;
68.83 + for (FileChildren.FileItem item : items) {
68.84 + handle.progress(item.getFile().getNameExt(), ix);
68.85 + try {
68.86 + String content = FileLoader.loadFile(item.file);
68.87 + String nue = item.handler.transform(content, licenseText);
68.88 + LineEndingPreference pref = LineEndingsPanel.getLineEndingPrefs();
68.89 + nue = LineEndingPreference.convertLineEndings(pref, content, nue);
68.90 +
68.91 + enc = FileEncodingQuery.getEncoding(item.file);
68.92 + BufferedOutputStream out = new BufferedOutputStream(item.file.getOutputStream());
68.93 + byte[] bytes;
68.94 + try {
68.95 + bytes = nue.getBytes(enc.name());
68.96 + } catch (UnsupportedEncodingException e) {
68.97 + //properties files get resource_bundle_charset
68.98 + bytes = nue.getBytes(FileEncodingQuery.getDefaultEncoding().name());
68.99 + }
68.100 + ByteArrayInputStream in = new ByteArrayInputStream(bytes);
68.101 + try {
68.102 + FileUtil.copy(in, out);
68.103 + } finally {
68.104 + out.close();
68.105 + in.close();
68.106 + }
68.107 + } catch (IOException ex) {
68.108 + Exceptions.printStackTrace(ex);
68.109 + }
68.110 + ix++;
68.111 + }
68.112 + Boolean updateProjectLicense = (Boolean) wizard.getProperty(WizardProperties.KEY_UPDATE_DEFAULT_PROJECT_LICENSE);
68.113 + if (updateProjectLicense) {
68.114 + System.out.println("Updating default license header!");
68.115 + Project project = (Project) wizard.getProperty(WizardProperties.KEY_PROJECT);
68.116 + Sources source = ProjectUtils.getSources(project);
68.117 + for (SourceGroup group : source.getSourceGroups(Sources.TYPE_GENERIC)) {
68.118 + try {
68.119 + FileObject nbprojectDir = group.getRootFolder().getFileObject("nbproject");
68.120 + if (nbprojectDir != null) {
68.121 + final FileObject projectProps = FileUtil.createData(nbprojectDir, "project.properties");
68.122 + boolean hasProjectProperties = group.contains(projectProps);
68.123 + if (hasProjectProperties) {
68.124 + System.out.println("Found project.properties at " + projectProps.getPath());
68.125 + ProjectManager.mutex().writeAccess(new Runnable() {
68.126 +
68.127 + @Override
68.128 + public void run() {
68.129 + try {
68.130 + InputStream istream = projectProps.getInputStream();
68.131 + EditableProperties props = new EditableProperties(true);
68.132 + props.load(istream);
68.133 + istream.close();
68.134 + props.setProperty("project.license", licenseName);
68.135 + OutputStream ostream = projectProps.getOutputStream();
68.136 + props.store(ostream);
68.137 + ostream.close();
68.138 + } catch (IOException ex) {
68.139 + Exceptions.printStackTrace(ex);
68.140 + } finally {
68.141 + }
68.142 + }
68.143 + });
68.144 +
68.145 + }
68.146 + } else {
68.147 + //TODO implement handling of maven-based projects and others
68.148 + //check for pom.xml
68.149 + FileObject pom = group.getRootFolder().getFileObject("pom.xml");
68.150 + if (pom != null) {
68.151 + System.out.println("Found maven pom.xml at " + pom.getPath());
68.152 + //found pom-based maven project
68.153 + String netbeansHintLicense = "<netbeans.hint.license>" + licenseName + "</netbeans.hint.license>";
68.154 + System.out.println("Please add " + netbeansHintLicense + " within your pom.xml <properties> section!");
68.155 + }
68.156 + }
68.157 + } catch (IOException ex) {
68.158 + Exceptions.printStackTrace(ex);
68.159 + }
68.160 + }
68.161 + }
68.162 + } finally {
68.163 + handle.finish();
68.164 + }
68.165 + }
68.166 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/LineEndingPreference.java Thu Sep 13 09:10:03 2012 +0200
69.3 @@ -0,0 +1,77 @@
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 +
69.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
69.44 +
69.45 +import org.openide.util.Utilities;
69.46 +
69.47 +/**
69.48 + * User preference for line ending conversion
69.49 + *
69.50 + * @author Tim Boudreau
69.51 + */
69.52 +public enum LineEndingPreference {
69.53 + FORCE_CRLF,
69.54 + NO_CHANGE,
69.55 + FORCE_NEWLINE,
69.56 + SYSTEM_DEFAULT;
69.57 +
69.58 + public static String convertLineEndings (LineEndingPreference pref, String old, String nue) {
69.59 + boolean oldHasCrlf = old.contains("\r\n"); //NOI18N
69.60 + switch (pref) {
69.61 + case FORCE_CRLF :
69.62 + return Utilities.replaceString(nue, "\n", "\r\n"); //NOI18N
69.63 + case FORCE_NEWLINE :
69.64 + //We already converted everything to newline only on load
69.65 + return nue;
69.66 + case NO_CHANGE :
69.67 + return oldHasCrlf ? Utilities.replaceString(nue, "\n", "\r\n") : //NOI18N
69.68 + nue;
69.69 + case SYSTEM_DEFAULT :
69.70 + String sep = System.getProperty( "line.separator" ); //NOI18N
69.71 + if ("\n".equals(sep)) {
69.72 + return nue;
69.73 + } else {
69.74 + return Utilities.replaceString (nue, "\n", sep); //NOI18N
69.75 + }
69.76 + default :
69.77 + throw new AssertionError();
69.78 + }
69.79 + }
69.80 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/NodeCheckObserver.java Thu Sep 13 09:10:03 2012 +0200
70.3 @@ -0,0 +1,51 @@
70.4 +/*
70.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
70.6 + *
70.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
70.8 + *
70.9 + * The contents of this file are subject to the terms of either the GNU
70.10 + * General Public License Version 2 only ("GPL") or the Common
70.11 + * Development and Distribution License("CDDL") (collectively, the
70.12 + * "License"). You may not use this file except in compliance with the
70.13 + * License. You can obtain a copy of the License at
70.14 + * http://www.netbeans.org/cddl-gplv2.html
70.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
70.16 + * specific language governing permissions and limitations under the
70.17 + * License. When distributing the software, include this License Header
70.18 + * Notice in each file and include the License file at
70.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
70.20 + * particular file as subject to the "Classpath" exception as provided
70.21 + * by Sun in the GPL Version 2 section of the License file that
70.22 + * accompanied this code. If applicable, add the following below the
70.23 + * License Header, with the fields enclosed by brackets [] replaced by
70.24 + * your own identifying information:
70.25 + * "Portions Copyrighted [year] [name of copyright owner]"
70.26 + *
70.27 + * If you wish your version of this file to be governed by only the CDDL
70.28 + * or only the GPL Version 2, indicate your decision by adding
70.29 + * "[Contributor] elects to include this software in this distribution
70.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
70.31 + * single choice of license, a recipient has the option to distribute
70.32 + * your version of this file under either the CDDL, the GPL Version 2 or
70.33 + * to extend the choice of license to its licensees as provided above.
70.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
70.35 + * Version 2 license, then the option applies only if the new code is
70.36 + * made subject to such option by the copyright holder.
70.37 + *
70.38 + * Contributor(s):
70.39 + *
70.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
70.41 + */
70.42 +
70.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
70.44 +
70.45 +import org.openide.nodes.Node;
70.46 +
70.47 +/**
70.48 + *
70.49 + * @author Tim Boudreau
70.50 + */
70.51 +public interface NodeCheckObserver {
70.52 + public void onNodeChecked (Node node);
70.53 + public void onNodeUnchecked (Node node);
70.54 +}
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/Offsets.java Thu Sep 13 09:10:03 2012 +0200
71.3 @@ -0,0 +1,62 @@
71.4 +/*
71.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
71.6 + *
71.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
71.8 + *
71.9 + * The contents of this file are subject to the terms of either the GNU
71.10 + * General Public License Version 2 only ("GPL") or the Common
71.11 + * Development and Distribution License("CDDL") (collectively, the
71.12 + * "License"). You may not use this file except in compliance with the
71.13 + * License. You can obtain a copy of the License at
71.14 + * http://www.netbeans.org/cddl-gplv2.html
71.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
71.16 + * specific language governing permissions and limitations under the
71.17 + * License. When distributing the software, include this License Header
71.18 + * Notice in each file and include the License file at
71.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
71.20 + * particular file as subject to the "Classpath" exception as provided
71.21 + * by Sun in the GPL Version 2 section of the License file that
71.22 + * accompanied this code. If applicable, add the following below the
71.23 + * License Header, with the fields enclosed by brackets [] replaced by
71.24 + * your own identifying information:
71.25 + * "Portions Copyrighted [year] [name of copyright owner]"
71.26 + *
71.27 + * If you wish your version of this file to be governed by only the CDDL
71.28 + * or only the GPL Version 2, indicate your decision by adding
71.29 + * "[Contributor] elects to include this software in this distribution
71.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
71.31 + * single choice of license, a recipient has the option to distribute
71.32 + * your version of this file under either the CDDL, the GPL Version 2 or
71.33 + * to extend the choice of license to its licensees as provided above.
71.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
71.35 + * Version 2 license, then the option applies only if the new code is
71.36 + * made subject to such option by the copyright holder.
71.37 + *
71.38 + * Contributor(s):
71.39 + *
71.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
71.41 + */
71.42 +
71.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
71.44 +
71.45 +/**
71.46 + *
71.47 + * @author Tim Boudreau
71.48 + */
71.49 +public final class Offsets {
71.50 + private final int start;
71.51 + private final int end;
71.52 +
71.53 + public Offsets(int start, int end) {
71.54 + this.start = start;
71.55 + this.end = end;
71.56 + }
71.57 +
71.58 + public int getEnd() {
71.59 + return end;
71.60 + }
71.61 +
71.62 + public int getStart() {
71.63 + return start;
71.64 + }
71.65 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/licensechanger/src/org/netbeans/modules/licensechanger/spi/wizard/utils/WizardProperties.java Thu Sep 13 09:10:03 2012 +0200
72.3 @@ -0,0 +1,60 @@
72.4 +/*
72.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
72.6 + *
72.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
72.8 + *
72.9 + * The contents of this file are subject to the terms of either the GNU
72.10 + * General Public License Version 2 only ("GPL") or the Common
72.11 + * Development and Distribution License("CDDL") (collectively, the
72.12 + * "License"). You may not use this file except in compliance with the
72.13 + * License. You can obtain a copy of the License at
72.14 + * http://www.netbeans.org/cddl-gplv2.html
72.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
72.16 + * specific language governing permissions and limitations under the
72.17 + * License. When distributing the software, include this License Header
72.18 + * Notice in each file and include the License file at
72.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
72.20 + * particular file as subject to the "Classpath" exception as provided
72.21 + * by Sun in the GPL Version 2 section of the License file that
72.22 + * accompanied this code. If applicable, add the following below the
72.23 + * License Header, with the fields enclosed by brackets [] replaced by
72.24 + * your own identifying information:
72.25 + * "Portions Copyrighted [year] [name of copyright owner]"
72.26 + *
72.27 + * If you wish your version of this file to be governed by only the CDDL
72.28 + * or only the GPL Version 2, indicate your decision by adding
72.29 + * "[Contributor] elects to include this software in this distribution
72.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
72.31 + * single choice of license, a recipient has the option to distribute
72.32 + * your version of this file under either the CDDL, the GPL Version 2 or
72.33 + * to extend the choice of license to its licensees as provided above.
72.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
72.35 + * Version 2 license, then the option applies only if the new code is
72.36 + * made subject to such option by the copyright holder.
72.37 + *
72.38 + * Contributor(s):
72.39 + *
72.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
72.41 + */
72.42 +
72.43 +package org.netbeans.modules.licensechanger.spi.wizard.utils;
72.44 +
72.45 +/**
72.46 + * Central class for Wizard-related property keys.
72.47 + *
72.48 + * @author Nils Hoffmann
72.49 + */
72.50 +public class WizardProperties {
72.51 +
72.52 + public static final String KEY_FILE_HANDLERS = "fileHandlers";
72.53 + public static final String KEY_ITEMS = "fileItems";
72.54 + public static final String KEY_LICENSE_TEXT = "licenseText";
72.55 + public static final String KEY_LICENSE_NAME = "licenseName";
72.56 + public static final String KEY_ROOT_FILES = "rootFiles";
72.57 + public static final String KEY_FOLDERS = "folders";
72.58 + public static final String KEY_UPDATE_DEFAULT_PROJECT_LICENSE = "updateDefaultProjectLicense";
72.59 + public static final String VALUE_DEFAULT_LICENSE_TEXT = "No License";
72.60 + public static final String PROP_ENDING = "ending";
72.61 + public static final String KEY_ENDING = "line_terminator";
72.62 + public static final String KEY_PROJECT = "project";
72.63 +}
73.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/JavaFileHandlerTest.java Thu Aug 30 10:56:16 2012 +0200
73.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
73.3 @@ -1,125 +0,0 @@
73.4 -/*
73.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
73.6 - *
73.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
73.8 - *
73.9 - * The contents of this file are subject to the terms of either the GNU
73.10 - * General Public License Version 2 only ("GPL") or the Common
73.11 - * Development and Distribution License("CDDL") (collectively, the
73.12 - * "License"). You may not use this file except in compliance with the
73.13 - * License. You can obtain a copy of the License at
73.14 - * http://www.netbeans.org/cddl-gplv2.html
73.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
73.16 - * specific language governing permissions and limitations under the
73.17 - * License. When distributing the software, include this License Header
73.18 - * Notice in each file and include the License file at
73.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
73.20 - * particular file as subject to the "Classpath" exception as provided
73.21 - * by Sun in the GPL Version 2 section of the License file that
73.22 - * accompanied this code. If applicable, add the following below the
73.23 - * License Header, with the fields enclosed by brackets [] replaced by
73.24 - * your own identifying information:
73.25 - * "Portions Copyrighted [year] [name of copyright owner]"
73.26 - *
73.27 - * If you wish your version of this file to be governed by only the CDDL
73.28 - * or only the GPL Version 2, indicate your decision by adding
73.29 - * "[Contributor] elects to include this software in this distribution
73.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
73.31 - * single choice of license, a recipient has the option to distribute
73.32 - * your version of this file under either the CDDL, the GPL Version 2 or
73.33 - * to extend the choice of license to its licensees as provided above.
73.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
73.35 - * Version 2 license, then the option applies only if the new code is
73.36 - * made subject to such option by the copyright holder.
73.37 - *
73.38 - * Contributor(s):
73.39 - *
73.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
73.41 - */
73.42 -
73.43 -package org.netbeans.modules.licensechanger.handlers;
73.44 -
73.45 -import java.io.ByteArrayOutputStream;
73.46 -import java.io.InputStream;
73.47 -import org.junit.Test;
73.48 -import org.netbeans.modules.licensechanger.api.FileHandler;
73.49 -import org.openide.filesystems.FileUtil;
73.50 -import org.openide.util.Utilities;
73.51 -import static org.junit.Assert.*;
73.52 -
73.53 -/**
73.54 - *
73.55 - * @author Tim Boudreau
73.56 - */
73.57 -public class JavaFileHandlerTest {
73.58 -
73.59 - @Test
73.60 - public void testStuff() throws Exception {
73.61 - System.out.println("testStuff");
73.62 - String golden = getGolden();
73.63 - String license = getLicense();
73.64 - for (int i=1; i <= 12; i++) {
73.65 - String filename = "java_" + i + ".txt";
73.66 - testOneVersion(golden, license, filename);
73.67 - }
73.68 - }
73.69 -
73.70 - private void testOneVersion(String golden, String license, String filename) throws Exception {
73.71 - System.out.println("Test " + filename);
73.72 - JavaFileHandler instance = new JavaFileHandler();
73.73 - String original = readFile (filename);
73.74 - String processed = instance.transform(original, license);
73.75 - assertEqualsLineByLine (golden, processed, filename);
73.76 - }
73.77 -
73.78 - static void assertEqualsLineByLine (String golden, String processed, String filename) {
73.79 - String[] g = FileHandler.splitIntoLines(golden);
73.80 - String[] p = FileHandler.splitIntoLines(processed);
73.81 - for (int i=0; i < Math.min (g.length, p.length); i++) {
73.82 - assertEquals ("Difference in " + filename + " at line " + i + "\n", g[i], p[i]);
73.83 - }
73.84 - }
73.85 -
73.86 -
73.87 -// static void assertEqualsLineByLine (String golden, String processed, String filename) {
73.88 -// StringTokenizer a = new StringTokenizer (golden, "\n");
73.89 -// StringTokenizer b = new StringTokenizer (processed, "\n");
73.90 -// int ix = 0;
73.91 -// while (a.hasMoreTokens() && b.hasMoreTokens()) {
73.92 -// String as = a.nextToken();
73.93 -// String bs = b.nextToken();
73.94 -// if (!as.equals(bs)) {
73.95 -// System.err.println("PROCESSED OUTPUT ");
73.96 -// }
73.97 -// assertEquals ("Difference in " + filename + " at line " + ix + "\n", as, bs);
73.98 -// ix++;
73.99 -// }
73.100 -//
73.101 -// }
73.102 -
73.103 - private static String getGolden() throws Exception {
73.104 - return readFile ("java_golden.txt");
73.105 - }
73.106 -
73.107 - static String getLicense() throws Exception {
73.108 - return readFile ("fake_license.txt");
73.109 - }
73.110 -
73.111 - static String readFile (String name) throws Exception {
73.112 - InputStream in = JavaFileHandlerTest.class.getResourceAsStream(name);
73.113 - if (in == null) {
73.114 - fail ("No input stream for " + name);
73.115 - }
73.116 - ByteArrayOutputStream out = new ByteArrayOutputStream();
73.117 - try {
73.118 - FileUtil.copy (in, out);
73.119 - } finally {
73.120 - in.close();
73.121 - out.close();
73.122 - }
73.123 - String result = new String (out.toByteArray(), "UTF-8");
73.124 - result = Utilities.replaceString(result, "\r\n", "\n");
73.125 - return result;
73.126 - }
73.127 -
73.128 -}
73.129 \ No newline at end of file
74.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/PropertiesFileHandlerTest.java Thu Aug 30 10:56:16 2012 +0200
74.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
74.3 @@ -1,78 +0,0 @@
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 -
74.43 -package org.netbeans.modules.licensechanger.handlers;
74.44 -
74.45 -import org.junit.Test;
74.46 -import static org.junit.Assert.*;
74.47 -
74.48 -/**
74.49 - *
74.50 - * @author Tim Boudreau
74.51 - */
74.52 -public class PropertiesFileHandlerTest {
74.53 -
74.54 - @Test
74.55 - public void testStuff() throws Exception {
74.56 - System.out.println("testStuff");
74.57 - String golden = getGolden();
74.58 - String license = JavaFileHandlerTest.getLicense();
74.59 - for (int i=1; i <= 4; i++) {
74.60 - testOneVersion (golden, license, "props_" + i + ".txt");
74.61 - }
74.62 - assertEquals (0, 0);
74.63 - }
74.64 -
74.65 - private void testOneVersion(String golden, String license, String filename) throws Exception {
74.66 - System.out.println("Test " + filename);
74.67 - PropertiesFileHandler instance = new PropertiesFileHandler();
74.68 - String original = JavaFileHandlerTest.readFile (filename);
74.69 - String processed = instance.transform(original, license);
74.70 -// if (!original.equals(processed)) {
74.71 -// System.out.println("************************************");
74.72 -// System.out.println(processed);
74.73 -// System.out.println("************************************");
74.74 -// }
74.75 - JavaFileHandlerTest.assertEqualsLineByLine (golden, processed, filename);
74.76 - }
74.77 -
74.78 - private static String getGolden() throws Exception {
74.79 - return JavaFileHandlerTest.readFile ("props_golden.txt");
74.80 - }
74.81 -}
74.82 \ No newline at end of file
75.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/XmlFileHandlerTest.java Thu Aug 30 10:56:16 2012 +0200
75.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
75.3 @@ -1,118 +0,0 @@
75.4 -/*
75.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
75.6 - *
75.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
75.8 - *
75.9 - * The contents of this file are subject to the terms of either the GNU
75.10 - * General Public License Version 2 only ("GPL") or the Common
75.11 - * Development and Distribution License("CDDL") (collectively, the
75.12 - * "License"). You may not use this file except in compliance with the
75.13 - * License. You can obtain a copy of the License at
75.14 - * http://www.netbeans.org/cddl-gplv2.html
75.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
75.16 - * specific language governing permissions and limitations under the
75.17 - * License. When distributing the software, include this License Header
75.18 - * Notice in each file and include the License file at
75.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
75.20 - * particular file as subject to the "Classpath" exception as provided
75.21 - * by Sun in the GPL Version 2 section of the License file that
75.22 - * accompanied this code. If applicable, add the following below the
75.23 - * License Header, with the fields enclosed by brackets [] replaced by
75.24 - * your own identifying information:
75.25 - * "Portions Copyrighted [year] [name of copyright owner]"
75.26 - *
75.27 - * If you wish your version of this file to be governed by only the CDDL
75.28 - * or only the GPL Version 2, indicate your decision by adding
75.29 - * "[Contributor] elects to include this software in this distribution
75.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
75.31 - * single choice of license, a recipient has the option to distribute
75.32 - * your version of this file under either the CDDL, the GPL Version 2 or
75.33 - * to extend the choice of license to its licensees as provided above.
75.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
75.35 - * Version 2 license, then the option applies only if the new code is
75.36 - * made subject to such option by the copyright holder.
75.37 - *
75.38 - * Contributor(s):
75.39 - *
75.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
75.41 - */
75.42 -
75.43 -package org.netbeans.modules.licensechanger.handlers;
75.44 -
75.45 -import java.util.StringTokenizer;
75.46 -import java.util.regex.Matcher;
75.47 -import org.junit.Test;
75.48 -import org.netbeans.modules.licensechanger.api.FileHandler;
75.49 -import static org.junit.Assert.*;
75.50 -
75.51 -/**
75.52 - *
75.53 - * @author Tim Boudreau
75.54 - */
75.55 -public class XmlFileHandlerTest {
75.56 - @Test
75.57 - public void testDeclarationFinder() throws Exception {
75.58 - String xml = getGolden();
75.59 - assertDeclarationFound (xml, "xml_golden.txt");
75.60 - for (int i=1; i <= 8; i++) {
75.61 - String filename = "xml_" + i + ".txt";
75.62 - String content = JavaFileHandlerTest.readFile(filename);
75.63 - assertDeclarationFound(content, filename);
75.64 - }
75.65 - }
75.66 -
75.67 - private void assertDeclarationFound (String content, String filename) {
75.68 - String[] lines = FileHandler.splitIntoLines(content);
75.69 - boolean found = false;
75.70 - for (int i = 0; i < lines.length; i++) {
75.71 - String line = lines[i];
75.72 - Matcher m = XmlFileHandler.xmlDeclaration.matcher(line);
75.73 - found = m.find();
75.74 - if (found) {
75.75 - System.err.println("Found declaration in line " + line + " of " + filename + "\n"
75.76 - + m.group(1));
75.77 - break;
75.78 - }
75.79 - }
75.80 - assertTrue ("Did not find xml declaration in " + filename, found);
75.81 - }
75.82 -
75.83 - @Test
75.84 - public void testStuff() throws Exception {
75.85 - System.out.println("testStuff");
75.86 - String golden = getGolden();
75.87 - String license = JavaFileHandlerTest.getLicense();
75.88 - for (int i=1; i <= 8; i++) {
75.89 - String filename = "xml_" + i + ".txt";
75.90 - testOneVersion(golden, license, filename);
75.91 - }
75.92 - }
75.93 -
75.94 - private void testOneVersion(String golden, String license, String filename) throws Exception {
75.95 - System.out.println("Test " + filename);
75.96 - XmlFileHandler instance = new XmlFileHandler();
75.97 - String original = JavaFileHandlerTest.readFile (filename);
75.98 - String processed = instance.transform(original, license);
75.99 - assertEqualsLineByLine (golden, processed, filename);
75.100 - }
75.101 -
75.102 - static void assertEqualsLineByLine (String golden, String processed, String filename) {
75.103 - StringTokenizer a = new StringTokenizer (golden, "\n");
75.104 - StringTokenizer b = new StringTokenizer (processed, "\n");
75.105 - int ix = 0;
75.106 - while (a.hasMoreTokens() && b.hasMoreTokens()) {
75.107 - String as = a.nextToken();
75.108 - String bs = b.nextToken();
75.109 - if (!as.equals(bs)) {
75.110 - System.err.println("PROCESSED OUTPUT ");
75.111 - }
75.112 - assertEquals ("Difference in " + filename + " at line " + ix + "\n", as, bs);
75.113 - ix++;
75.114 - }
75.115 -
75.116 - }
75.117 -
75.118 - private static String getGolden() throws Exception {
75.119 - return JavaFileHandlerTest.readFile ("xml_golden.txt");
75.120 - }
75.121 -}
75.122 \ No newline at end of file
76.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/fake_license.txt Thu Aug 30 10:56:16 2012 +0200
76.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
76.3 @@ -1,29 +0,0 @@
76.4 -Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
76.5 -All rights reversed.
76.6 -
76.7 -Redistribution and use in source, binary or corpuscular forms, with or without
76.8 -modification, are prohibited under all circumstances unless the following
76.9 -conditions have been met:
76.10 -
76.11 - 1. You have an eyeball growing in the palm of your left hand
76.12 -
76.13 - 2. Seven dwarfs really like your golden hair
76.14 -
76.15 - 3. The moon has reversed its course a multiple of times divisible by
76.16 - the eighteenth prime number in the last year
76.17 -
76.18 -THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
76.19 -INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
76.20 -DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
76.21 -OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
76.22 -ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
76.23 -SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
76.24 -LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
76.25 -BALL DROP, BECOMING A LAWYER.
76.26 -
76.27 -BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
76.28 -AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
76.29 -AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
76.30 -INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
76.31 -
76.32 -RUN, RUN NOW, AND RUN VERY FAST.
77.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_1.txt Thu Aug 30 10:56:16 2012 +0200
77.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
77.3 @@ -1,139 +0,0 @@
77.4 -/*
77.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
77.6 - *
77.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
77.8 - *
77.9 - * The contents of this file are subject to the terms of either the GNU
77.10 - * General Public License Version 2 only ("GPL") or the Common
77.11 - * Development and Distribution License("CDDL") (collectively, the
77.12 - * "License"). You may not use this file except in compliance with the
77.13 - * License. You can obtain a copy of the License at
77.14 - * http://www.netbeans.org/cddl-gplv2.html
77.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
77.16 - * specific language governing permissions and limitations under the
77.17 - * License. When distributing the software, include this License Header
77.18 - * Notice in each file and include the License file at
77.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
77.20 - * particular file as subject to the "Classpath" exception as provided
77.21 - * by Sun in the GPL Version 2 section of the License file that
77.22 - * accompanied this code. If applicable, add the following below the
77.23 - * License Header, with the fields enclosed by brackets [] replaced by
77.24 - * your own identifying information:
77.25 - * "Portions Copyrighted [year] [name of copyright owner]"
77.26 - *
77.27 - * If you wish your version of this file to be governed by only the CDDL
77.28 - * or only the GPL Version 2, indicate your decision by adding
77.29 - * "[Contributor] elects to include this software in this distribution
77.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
77.31 - * single choice of license, a recipient has the option to distribute
77.32 - * your version of this file under either the CDDL, the GPL Version 2 or
77.33 - * to extend the choice of license to its licensees as provided above.
77.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
77.35 - * Version 2 license, then the option applies only if the new code is
77.36 - * made subject to such option by the copyright holder.
77.37 - *
77.38 - * Contributor(s):
77.39 - *
77.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
77.41 - */
77.42 -
77.43 -package org.netbeans.modules.licensechanger;
77.44 -
77.45 -import java.util.Collection;
77.46 -import java.util.HashSet;
77.47 -import java.util.LinkedList;
77.48 -import java.util.List;
77.49 -import java.util.Set;
77.50 -import javax.swing.Action;
77.51 -import org.netbeans.modules.licensechanger.api.FileHandler;
77.52 -import org.openide.filesystems.FileObject;
77.53 -import org.openide.loaders.DataObject;
77.54 -import org.openide.loaders.DataObjectNotFoundException;
77.55 -import org.openide.nodes.ChildFactory;
77.56 -import org.openide.nodes.FilterNode;
77.57 -import org.openide.nodes.Node;
77.58 -import org.openide.util.Exceptions;
77.59 -import org.openide.util.Lookup;
77.60 -import org.openide.util.lookup.Lookups;
77.61 -import org.openide.util.lookup.ProxyLookup;
77.62 -
77.63 -/**
77.64 - *
77.65 - * @author Tim Boudreau
77.66 - */
77.67 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
77.68 - private final Set<FileObject> folders;
77.69 - private final Collection <? extends FileHandler> allHandlers;
77.70 - FileChildren (Set<FileObject> folders) {
77.71 - this.folders = new HashSet(folders);
77.72 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
77.73 - }
77.74 -
77.75 - @Override
77.76 - protected boolean createKeys(List<FileObject> toPopulate) {
77.77 - toPopulate.addAll (folders);
77.78 - return true;
77.79 - }
77.80 -
77.81 - @Override
77.82 - protected Node[] createNodesForKey(FileObject key) {
77.83 - List<Node> result = new LinkedList<Node>();
77.84 -outer: for (FileObject fo : key.getChildren()) {
77.85 - if (fo.isData()) {
77.86 - for (FileHandler h : allHandlers) {
77.87 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
77.88 - try {
77.89 - DataObject dob = DataObject.find(fo);
77.90 - FileItem item = new FileItem (h, fo);
77.91 - result.add (new FN (dob.getNodeDelegate(), item));
77.92 - break outer;
77.93 - } catch (DataObjectNotFoundException ex) {
77.94 - Exceptions.printStackTrace(ex);
77.95 - }
77.96 - }
77.97 - }
77.98 - }
77.99 - }
77.100 - return result.toArray(new Node[result.size()]);
77.101 - }
77.102 -
77.103 - static final class FileItem {
77.104 - FileHandler handler;
77.105 - FileObject file;
77.106 -
77.107 - public FileItem(FileHandler handler, FileObject file) {
77.108 - this.handler = handler;
77.109 - this.file = file;
77.110 - }
77.111 -
77.112 - public FileObject getFile() {
77.113 - return file;
77.114 - }
77.115 -
77.116 - public FileHandler getHandler() {
77.117 - return handler;
77.118 - }
77.119 -
77.120 - }
77.121 -
77.122 - private static final class FN extends FilterNode {
77.123 - FN(Node orig, FileItem item) {
77.124 - super (orig, Children.LEAF, new ProxyLookup(
77.125 - Lookups.singleton(item),
77.126 - orig.getLookup()));
77.127 - disableDelegation(DELEGATE_GET_ACTIONS);
77.128 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
77.129 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
77.130 - disableDelegation(DELEGATE_GET_VALUE);
77.131 - disableDelegation(DELEGATE_SET_VALUE);
77.132 - disableDelegation(DELEGATE_SET_NAME);
77.133 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
77.134 - setDisplayName (item.file.getPath());
77.135 - }
77.136 -
77.137 - @Override
77.138 - public Action[] getActions(boolean ignored) {
77.139 - return new Action[0];
77.140 - }
77.141 - }
77.142 -}
78.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_10.txt Thu Aug 30 10:56:16 2012 +0200
78.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
78.3 @@ -1,145 +0,0 @@
78.4 -/*
78.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
78.6 - *
78.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
78.8 - *
78.9 - * The contents of this file are subject to the terms of either the GNU
78.10 - * General Public License Version 2 only ("GPL") or the Common
78.11 - * Development and Distribution License("CDDL") (collectively, the
78.12 - * "License"). You may not use this file except in compliance with the
78.13 - * License. You can obtain a copy of the License at
78.14 - * http://www.netbeans.org/cddl-gplv2.html
78.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
78.16 - * specific language governing permissions and limitations under the
78.17 - * License. When distributing the software, include this License Header
78.18 - * Notice in each file and include the License file at
78.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
78.20 - * particular file as subject to the "Classpath" exception as provided
78.21 - * by Sun in the GPL Version 2 section of the License file that
78.22 - * accompanied this code. If applicable, add the following below the
78.23 - * License Header, with the fields enclosed by brackets [] replaced by
78.24 - * your own identifying information:
78.25 - * "Portions Copyrighted [year] [name of copyright owner]"
78.26 - *
78.27 - * If you wish your version of this file to be governed by only the CDDL
78.28 - * or only the GPL Version 2, indicate your decision by adding
78.29 - * "[Contributor] elects to include this software in this distribution
78.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
78.31 - * single choice of license, a recipient has the option to distribute
78.32 - * your version of this file under either the CDDL, the GPL Version 2 or
78.33 - * to extend the choice of license to its licensees as provided above.
78.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
78.35 - * Version 2 license, then the option applies only if the new code is
78.36 - * made subject to such option by the copyright holder.
78.37 - *
78.38 - * Contributor(s):
78.39 - *
78.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
78.41 - */
78.42 -/* Created on March 14, 2009
78.43 - * by some IDE or other
78.44 - */
78.45 -
78.46 -//blah blah blah
78.47 -//blah blah blah
78.48 -
78.49 -package org.netbeans.modules.licensechanger;
78.50 -
78.51 -import java.util.Collection;
78.52 -import java.util.HashSet;
78.53 -import java.util.LinkedList;
78.54 -import java.util.List;
78.55 -import java.util.Set;
78.56 -import javax.swing.Action;
78.57 -import org.netbeans.modules.licensechanger.api.FileHandler;
78.58 -import org.openide.filesystems.FileObject;
78.59 -import org.openide.loaders.DataObject;
78.60 -import org.openide.loaders.DataObjectNotFoundException;
78.61 -import org.openide.nodes.ChildFactory;
78.62 -import org.openide.nodes.FilterNode;
78.63 -import org.openide.nodes.Node;
78.64 -import org.openide.util.Exceptions;
78.65 -import org.openide.util.Lookup;
78.66 -import org.openide.util.lookup.Lookups;
78.67 -import org.openide.util.lookup.ProxyLookup;
78.68 -
78.69 -/**
78.70 - *
78.71 - * @author Tim Boudreau
78.72 - */
78.73 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
78.74 - private final Set<FileObject> folders;
78.75 - private final Collection <? extends FileHandler> allHandlers;
78.76 - FileChildren (Set<FileObject> folders) {
78.77 - this.folders = new HashSet(folders);
78.78 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
78.79 - }
78.80 -
78.81 - @Override
78.82 - protected boolean createKeys(List<FileObject> toPopulate) {
78.83 - toPopulate.addAll (folders);
78.84 - return true;
78.85 - }
78.86 -
78.87 - @Override
78.88 - protected Node[] createNodesForKey(FileObject key) {
78.89 - List<Node> result = new LinkedList<Node>();
78.90 -outer: for (FileObject fo : key.getChildren()) {
78.91 - if (fo.isData()) {
78.92 - for (FileHandler h : allHandlers) {
78.93 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
78.94 - try {
78.95 - DataObject dob = DataObject.find(fo);
78.96 - FileItem item = new FileItem (h, fo);
78.97 - result.add (new FN (dob.getNodeDelegate(), item));
78.98 - break outer;
78.99 - } catch (DataObjectNotFoundException ex) {
78.100 - Exceptions.printStackTrace(ex);
78.101 - }
78.102 - }
78.103 - }
78.104 - }
78.105 - }
78.106 - return result.toArray(new Node[result.size()]);
78.107 - }
78.108 -
78.109 - static final class FileItem {
78.110 - FileHandler handler;
78.111 - FileObject file;
78.112 -
78.113 - public FileItem(FileHandler handler, FileObject file) {
78.114 - this.handler = handler;
78.115 - this.file = file;
78.116 - }
78.117 -
78.118 - public FileObject getFile() {
78.119 - return file;
78.120 - }
78.121 -
78.122 - public FileHandler getHandler() {
78.123 - return handler;
78.124 - }
78.125 -
78.126 - }
78.127 -
78.128 - private static final class FN extends FilterNode {
78.129 - FN(Node orig, FileItem item) {
78.130 - super (orig, Children.LEAF, new ProxyLookup(
78.131 - Lookups.singleton(item),
78.132 - orig.getLookup()));
78.133 - disableDelegation(DELEGATE_GET_ACTIONS);
78.134 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
78.135 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
78.136 - disableDelegation(DELEGATE_GET_VALUE);
78.137 - disableDelegation(DELEGATE_SET_VALUE);
78.138 - disableDelegation(DELEGATE_SET_NAME);
78.139 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
78.140 - setDisplayName (item.file.getPath());
78.141 - }
78.142 -
78.143 - @Override
78.144 - public Action[] getActions(boolean ignored) {
78.145 - return new Action[0];
78.146 - }
78.147 - }
78.148 -}
79.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_11.txt Thu Aug 30 10:56:16 2012 +0200
79.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
79.3 @@ -1,149 +0,0 @@
79.4 -/*
79.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
79.6 - *
79.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
79.8 - *
79.9 - * The contents of this file are subject to the terms of either the GNU
79.10 - * General Public License Version 2 only ("GPL") or the Common
79.11 - * Development and Distribution License("CDDL") (collectively, the
79.12 - * "License"). You may not use this file except in compliance with the
79.13 - * License. You can obtain a copy of the License at
79.14 - * http://www.netbeans.org/cddl-gplv2.html
79.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
79.16 - * specific language governing permissions and limitations under the */
79.17 -
79.18 -//BLAH BLAH BLAH
79.19 -//BLAH BLAH BLAH
79.20 -
79.21 - /* License. When distributing the software, include this License Header
79.22 - * Notice in each file and include the License file at
79.23 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
79.24 - * particular file as subject to the "Classpath" exception as provided
79.25 - * by Sun in the GPL Version 2 section of the License file that
79.26 - * accompanied this code. If applicable, add the following below the
79.27 - * License Header, with the fields enclosed by brackets [] replaced by
79.28 - * your own identifying information:
79.29 - * "Portions Copyrighted [year] [name of copyright owner]"
79.30 - *
79.31 - * If you wish your version of this file to be governed by only the CDDL
79.32 - * or only the GPL Version 2, indicate your decision by adding
79.33 - * "[Contributor] elects to include this software in this distribution
79.34 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
79.35 - * single choice of license, a recipient has the option to distribute
79.36 - * your version of this file under either the CDDL, the GPL Version 2 or
79.37 - * to extend the choice of license to its licensees as provided above.
79.38 - * However, if you add GPL Version 2 code and therefore, elected the GPL
79.39 - * Version 2 license, then the option applies only if the new code is
79.40 - * made subject to such option by the copyright holder.
79.41 - *
79.42 - * Contributor(s):
79.43 - *
79.44 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
79.45 - */
79.46 -/* Created on March 14, 2009
79.47 - * by some IDE or other
79.48 - */
79.49 -
79.50 -//blah blah blah
79.51 -//blah blah blah
79.52 -
79.53 -package org.netbeans.modules.licensechanger;
79.54 -
79.55 -import java.util.Collection;
79.56 -import java.util.HashSet;
79.57 -import java.util.LinkedList;
79.58 -import java.util.List;
79.59 -import java.util.Set;
79.60 -import javax.swing.Action;
79.61 -import org.netbeans.modules.licensechanger.api.FileHandler;
79.62 -import org.openide.filesystems.FileObject;
79.63 -import org.openide.loaders.DataObject;
79.64 -import org.openide.loaders.DataObjectNotFoundException;
79.65 -import org.openide.nodes.ChildFactory;
79.66 -import org.openide.nodes.FilterNode;
79.67 -import org.openide.nodes.Node;
79.68 -import org.openide.util.Exceptions;
79.69 -import org.openide.util.Lookup;
79.70 -import org.openide.util.lookup.Lookups;
79.71 -import org.openide.util.lookup.ProxyLookup;
79.72 -
79.73 -/**
79.74 - *
79.75 - * @author Tim Boudreau
79.76 - */
79.77 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
79.78 - private final Set<FileObject> folders;
79.79 - private final Collection <? extends FileHandler> allHandlers;
79.80 - FileChildren (Set<FileObject> folders) {
79.81 - this.folders = new HashSet(folders);
79.82 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
79.83 - }
79.84 -
79.85 - @Override
79.86 - protected boolean createKeys(List<FileObject> toPopulate) {
79.87 - toPopulate.addAll (folders);
79.88 - return true;
79.89 - }
79.90 -
79.91 - @Override
79.92 - protected Node[] createNodesForKey(FileObject key) {
79.93 - List<Node> result = new LinkedList<Node>();
79.94 -outer: for (FileObject fo : key.getChildren()) {
79.95 - if (fo.isData()) {
79.96 - for (FileHandler h : allHandlers) {
79.97 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
79.98 - try {
79.99 - DataObject dob = DataObject.find(fo);
79.100 - FileItem item = new FileItem (h, fo);
79.101 - result.add (new FN (dob.getNodeDelegate(), item));
79.102 - break outer;
79.103 - } catch (DataObjectNotFoundException ex) {
79.104 - Exceptions.printStackTrace(ex);
79.105 - }
79.106 - }
79.107 - }
79.108 - }
79.109 - }
79.110 - return result.toArray(new Node[result.size()]);
79.111 - }
79.112 -
79.113 - static final class FileItem {
79.114 - FileHandler handler;
79.115 - FileObject file;
79.116 -
79.117 - public FileItem(FileHandler handler, FileObject file) {
79.118 - this.handler = handler;
79.119 - this.file = file;
79.120 - }
79.121 -
79.122 - public FileObject getFile() {
79.123 - return file;
79.124 - }
79.125 -
79.126 - public FileHandler getHandler() {
79.127 - return handler;
79.128 - }
79.129 -
79.130 - }
79.131 -
79.132 - private static final class FN extends FilterNode {
79.133 - FN(Node orig, FileItem item) {
79.134 - super (orig, Children.LEAF, new ProxyLookup(
79.135 - Lookups.singleton(item),
79.136 - orig.getLookup()));
79.137 - disableDelegation(DELEGATE_GET_ACTIONS);
79.138 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
79.139 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
79.140 - disableDelegation(DELEGATE_GET_VALUE);
79.141 - disableDelegation(DELEGATE_SET_VALUE);
79.142 - disableDelegation(DELEGATE_SET_NAME);
79.143 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
79.144 - setDisplayName (item.file.getPath());
79.145 - }
79.146 -
79.147 - @Override
79.148 - public Action[] getActions(boolean ignored) {
79.149 - return new Action[0];
79.150 - }
79.151 - }
79.152 -}
80.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_12.txt Thu Aug 30 10:56:16 2012 +0200
80.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
80.3 @@ -1,148 +0,0 @@
80.4 -/*
80.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
80.6 - *
80.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
80.8 - *
80.9 - * The contents of this file are subject to the terms of either the GNU
80.10 - * General Public License Version 2 only ("GPL") or the Common
80.11 - * Development and Distribution License("CDDL") (collectively, the
80.12 - * "License"). You may not use this file except in compliance with the
80.13 - * License. You can obtain a copy of the License at
80.14 - * http://www.netbeans.org/cddl-gplv2.html
80.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
80.16 - * specific language governing permissions and limitations under the
80.17 -*/
80.18 -//BLAH BLAH BLAH
80.19 -//BLAH BLAH BLAH
80.20 - /* License. When distributing the software, include this License Header
80.21 - * Notice in each file and include the License file at
80.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
80.23 - * particular file as subject to the "Classpath" exception as provided
80.24 - * by Sun in the GPL Version 2 section of the License file that
80.25 - * accompanied this code. If applicable, add the following below the
80.26 - * License Header, with the fields enclosed by brackets [] replaced by
80.27 - * your own identifying information:
80.28 - * "Portions Copyrighted [year] [name of copyright owner]"
80.29 - *
80.30 - * If you wish your version of this file to be governed by only the CDDL
80.31 - * or only the GPL Version 2, indicate your decision by adding
80.32 - * "[Contributor] elects to include this software in this distribution
80.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
80.34 - * single choice of license, a recipient has the option to distribute
80.35 - * your version of this file under either the CDDL, the GPL Version 2 or
80.36 - * to extend the choice of license to its licensees as provided above.
80.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
80.38 - * Version 2 license, then the option applies only if the new code is
80.39 - * made subject to such option by the copyright holder.
80.40 - *
80.41 - * Contributor(s):
80.42 - *
80.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
80.44 - */
80.45 -/* Created on March 14, 2009
80.46 - * by some IDE or other
80.47 - */
80.48 -
80.49 -//blah blah blah
80.50 -//blah blah blah
80.51 -
80.52 -package org.netbeans.modules.licensechanger;
80.53 -
80.54 -import java.util.Collection;
80.55 -import java.util.HashSet;
80.56 -import java.util.LinkedList;
80.57 -import java.util.List;
80.58 -import java.util.Set;
80.59 -import javax.swing.Action;
80.60 -import org.netbeans.modules.licensechanger.api.FileHandler;
80.61 -import org.openide.filesystems.FileObject;
80.62 -import org.openide.loaders.DataObject;
80.63 -import org.openide.loaders.DataObjectNotFoundException;
80.64 -import org.openide.nodes.ChildFactory;
80.65 -import org.openide.nodes.FilterNode;
80.66 -import org.openide.nodes.Node;
80.67 -import org.openide.util.Exceptions;
80.68 -import org.openide.util.Lookup;
80.69 -import org.openide.util.lookup.Lookups;
80.70 -import org.openide.util.lookup.ProxyLookup;
80.71 -
80.72 -/**
80.73 - *
80.74 - * @author Tim Boudreau
80.75 - */
80.76 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
80.77 - private final Set<FileObject> folders;
80.78 - private final Collection <? extends FileHandler> allHandlers;
80.79 - FileChildren (Set<FileObject> folders) {
80.80 - this.folders = new HashSet(folders);
80.81 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
80.82 - }
80.83 -
80.84 - @Override
80.85 - protected boolean createKeys(List<FileObject> toPopulate) {
80.86 - toPopulate.addAll (folders);
80.87 - return true;
80.88 - }
80.89 -
80.90 - @Override
80.91 - protected Node[] createNodesForKey(FileObject key) {
80.92 - List<Node> result = new LinkedList<Node>();
80.93 -outer: for (FileObject fo : key.getChildren()) {
80.94 - if (fo.isData()) {
80.95 - for (FileHandler h : allHandlers) {
80.96 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
80.97 - try {
80.98 - DataObject dob = DataObject.find(fo);
80.99 - FileItem item = new FileItem (h, fo);
80.100 - result.add (new FN (dob.getNodeDelegate(), item));
80.101 - break outer;
80.102 - } catch (DataObjectNotFoundException ex) {
80.103 - Exceptions.printStackTrace(ex);
80.104 - }
80.105 - }
80.106 - }
80.107 - }
80.108 - }
80.109 - return result.toArray(new Node[result.size()]);
80.110 - }
80.111 -
80.112 - static final class FileItem {
80.113 - FileHandler handler;
80.114 - FileObject file;
80.115 -
80.116 - public FileItem(FileHandler handler, FileObject file) {
80.117 - this.handler = handler;
80.118 - this.file = file;
80.119 - }
80.120 -
80.121 - public FileObject getFile() {
80.122 - return file;
80.123 - }
80.124 -
80.125 - public FileHandler getHandler() {
80.126 - return handler;
80.127 - }
80.128 -
80.129 - }
80.130 -
80.131 - private static final class FN extends FilterNode {
80.132 - FN(Node orig, FileItem item) {
80.133 - super (orig, Children.LEAF, new ProxyLookup(
80.134 - Lookups.singleton(item),
80.135 - orig.getLookup()));
80.136 - disableDelegation(DELEGATE_GET_ACTIONS);
80.137 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
80.138 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
80.139 - disableDelegation(DELEGATE_GET_VALUE);
80.140 - disableDelegation(DELEGATE_SET_VALUE);
80.141 - disableDelegation(DELEGATE_SET_NAME);
80.142 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
80.143 - setDisplayName (item.file.getPath());
80.144 - }
80.145 -
80.146 - @Override
80.147 - public Action[] getActions(boolean ignored) {
80.148 - return new Action[0];
80.149 - }
80.150 - }
80.151 -}
81.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_2.txt Thu Aug 30 10:56:16 2012 +0200
81.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
81.3 @@ -1,139 +0,0 @@
81.4 -
81.5 -
81.6 -/*
81.7 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
81.8 - *
81.9 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
81.10 - *
81.11 - * The contents of this file are subject to the terms of either the GNU
81.12 - * General Public License Version 2 only ("GPL") or the Common
81.13 - * Development and Distribution License("CDDL") (collectively, the
81.14 - * "License"). You may not use this file except in compliance with the
81.15 - * License. You can obtain a copy of the License at
81.16 - * http://www.netbeans.org/cddl-gplv2.html
81.17 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
81.18 - * specific language governing permissions and limitations under the
81.19 - * License. When distributing the software, include this License Header
81.20 - * Notice in each file and include the License file at
81.21 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
81.22 - * particular file as subject to the "Classpath" exception as provided
81.23 - * by Sun in the GPL Version 2 section of the License file that
81.24 - * accompanied this code. If applicable, add the following below the
81.25 - * License Header, with the fields enclosed by brackets [] replaced by
81.26 - * your own identifying information:
81.27 - * "Portions Copyrighted [year] [name of copyright owner]"
81.28 - *
81.29 - * If you wish your version of this file to be governed by only the CDDL
81.30 - * or only the GPL Version 2, indicate your decision by adding
81.31 - * "[Contributor] elects to include this software in this distribution
81.32 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
81.33 - * single choice of license, a recipient has the option to distribute
81.34 - * your version of this file under either the CDDL, the GPL Version 2 or
81.35 - * to extend the choice of license to its licensees as provided above.
81.36 - * However, if you add GPL Version 2 code and therefore, elected the GPL
81.37 - * Version 2 license, then the option applies only if the new code is
81.38 - * made subject to such option by the copyright holder.
81.39 - *
81.40 - * Contributor(s):
81.41 - *
81.42 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
81.43 - */package org.netbeans.modules.licensechanger;
81.44 -
81.45 -import java.util.Collection;
81.46 -import java.util.HashSet;
81.47 -import java.util.LinkedList;
81.48 -import java.util.List;
81.49 -import java.util.Set;
81.50 -import javax.swing.Action;
81.51 -import org.netbeans.modules.licensechanger.api.FileHandler;
81.52 -import org.openide.filesystems.FileObject;
81.53 -import org.openide.loaders.DataObject;
81.54 -import org.openide.loaders.DataObjectNotFoundException;
81.55 -import org.openide.nodes.ChildFactory;
81.56 -import org.openide.nodes.FilterNode;
81.57 -import org.openide.nodes.Node;
81.58 -import org.openide.util.Exceptions;
81.59 -import org.openide.util.Lookup;
81.60 -import org.openide.util.lookup.Lookups;
81.61 -import org.openide.util.lookup.ProxyLookup;
81.62 -
81.63 -/**
81.64 - *
81.65 - * @author Tim Boudreau
81.66 - */
81.67 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
81.68 - private final Set<FileObject> folders;
81.69 - private final Collection <? extends FileHandler> allHandlers;
81.70 - FileChildren (Set<FileObject> folders) {
81.71 - this.folders = new HashSet(folders);
81.72 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
81.73 - }
81.74 -
81.75 - @Override
81.76 - protected boolean createKeys(List<FileObject> toPopulate) {
81.77 - toPopulate.addAll (folders);
81.78 - return true;
81.79 - }
81.80 -
81.81 - @Override
81.82 - protected Node[] createNodesForKey(FileObject key) {
81.83 - List<Node> result = new LinkedList<Node>();
81.84 -outer: for (FileObject fo : key.getChildren()) {
81.85 - if (fo.isData()) {
81.86 - for (FileHandler h : allHandlers) {
81.87 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
81.88 - try {
81.89 - DataObject dob = DataObject.find(fo);
81.90 - FileItem item = new FileItem (h, fo);
81.91 - result.add (new FN (dob.getNodeDelegate(), item));
81.92 - break outer;
81.93 - } catch (DataObjectNotFoundException ex) {
81.94 - Exceptions.printStackTrace(ex);
81.95 - }
81.96 - }
81.97 - }
81.98 - }
81.99 - }
81.100 - return result.toArray(new Node[result.size()]);
81.101 - }
81.102 -
81.103 - static final class FileItem {
81.104 - FileHandler handler;
81.105 - FileObject file;
81.106 -
81.107 - public FileItem(FileHandler handler, FileObject file) {
81.108 - this.handler = handler;
81.109 - this.file = file;
81.110 - }
81.111 -
81.112 - public FileObject getFile() {
81.113 - return file;
81.114 - }
81.115 -
81.116 - public FileHandler getHandler() {
81.117 - return handler;
81.118 - }
81.119 -
81.120 - }
81.121 -
81.122 - private static final class FN extends FilterNode {
81.123 - FN(Node orig, FileItem item) {
81.124 - super (orig, Children.LEAF, new ProxyLookup(
81.125 - Lookups.singleton(item),
81.126 - orig.getLookup()));
81.127 - disableDelegation(DELEGATE_GET_ACTIONS);
81.128 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
81.129 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
81.130 - disableDelegation(DELEGATE_GET_VALUE);
81.131 - disableDelegation(DELEGATE_SET_VALUE);
81.132 - disableDelegation(DELEGATE_SET_NAME);
81.133 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
81.134 - setDisplayName (item.file.getPath());
81.135 - }
81.136 -
81.137 - @Override
81.138 - public Action[] getActions(boolean ignored) {
81.139 - return new Action[0];
81.140 - }
81.141 - }
81.142 -}
82.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_3.txt Thu Aug 30 10:56:16 2012 +0200
82.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
82.3 @@ -1,137 +0,0 @@
82.4 -/*
82.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
82.6 - *
82.7 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
82.8 - *
82.9 - * The contents of this file are subject to the terms of either the GNU
82.10 - * General Public License Version 2 only ("GPL") or the Common
82.11 - * Development and Distribution License("CDDL") (collectively, the
82.12 - * "License"). You may not use this file except in compliance with the
82.13 - * License. You can obtain a copy of the License at
82.14 - * http://www.netbeans.org/cddl-gplv2.html
82.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
82.16 - * specific language governing permissions and limitations under the
82.17 - * License. When distributing the software, include this License Header
82.18 - * Notice in each file and include the License file at
82.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
82.20 - * particular file as subject to the "Classpath" exception as provided
82.21 - * by Sun in the GPL Version 2 section of the License file that
82.22 - * accompanied this code. If applicable, add the following below the
82.23 - * License Header, with the fields enclosed by brackets [] replaced by
82.24 - * your own identifying information:
82.25 - * "Portions Copyrighted [year] [name of copyright owner]"
82.26 - *
82.27 - * If you wish your version of this file to be governed by only the CDDL
82.28 - * or only the GPL Version 2, indicate your decision by adding
82.29 - * "[Contributor] elects to include this software in this distribution
82.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
82.31 - * single choice of license, a recipient has the option to distribute
82.32 - * your version of this file under either the CDDL, the GPL Version 2 or
82.33 - * to extend the choice of license to its licensees as provided above.
82.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
82.35 - * Version 2 license, then the option applies only if the new code is
82.36 - * made subject to such option by the copyright holder.
82.37 - *
82.38 - * Contributor(s):
82.39 - *
82.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
82.41 - */package org.netbeans.modules.licensechanger;
82.42 -
82.43 -import java.util.Collection;
82.44 -import java.util.HashSet;
82.45 -import java.util.LinkedList;
82.46 -import java.util.List;
82.47 -import java.util.Set;
82.48 -import javax.swing.Action;
82.49 -import org.netbeans.modules.licensechanger.api.FileHandler;
82.50 -import org.openide.filesystems.FileObject;
82.51 -import org.openide.loaders.DataObject;
82.52 -import org.openide.loaders.DataObjectNotFoundException;
82.53 -import org.openide.nodes.ChildFactory;
82.54 -import org.openide.nodes.FilterNode;
82.55 -import org.openide.nodes.Node;
82.56 -import org.openide.util.Exceptions;
82.57 -import org.openide.util.Lookup;
82.58 -import org.openide.util.lookup.Lookups;
82.59 -import org.openide.util.lookup.ProxyLookup;
82.60 -
82.61 -/**
82.62 - *
82.63 - * @author Tim Boudreau
82.64 - */
82.65 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
82.66 - private final Set<FileObject> folders;
82.67 - private final Collection <? extends FileHandler> allHandlers;
82.68 - FileChildren (Set<FileObject> folders) {
82.69 - this.folders = new HashSet(folders);
82.70 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
82.71 - }
82.72 -
82.73 - @Override
82.74 - protected boolean createKeys(List<FileObject> toPopulate) {
82.75 - toPopulate.addAll (folders);
82.76 - return true;
82.77 - }
82.78 -
82.79 - @Override
82.80 - protected Node[] createNodesForKey(FileObject key) {
82.81 - List<Node> result = new LinkedList<Node>();
82.82 -outer: for (FileObject fo : key.getChildren()) {
82.83 - if (fo.isData()) {
82.84 - for (FileHandler h : allHandlers) {
82.85 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
82.86 - try {
82.87 - DataObject dob = DataObject.find(fo);
82.88 - FileItem item = new FileItem (h, fo);
82.89 - result.add (new FN (dob.getNodeDelegate(), item));
82.90 - break outer;
82.91 - } catch (DataObjectNotFoundException ex) {
82.92 - Exceptions.printStackTrace(ex);
82.93 - }
82.94 - }
82.95 - }
82.96 - }
82.97 - }
82.98 - return result.toArray(new Node[result.size()]);
82.99 - }
82.100 -
82.101 - static final class FileItem {
82.102 - FileHandler handler;
82.103 - FileObject file;
82.104 -
82.105 - public FileItem(FileHandler handler, FileObject file) {
82.106 - this.handler = handler;
82.107 - this.file = file;
82.108 - }
82.109 -
82.110 - public FileObject getFile() {
82.111 - return file;
82.112 - }
82.113 -
82.114 - public FileHandler getHandler() {
82.115 - return handler;
82.116 - }
82.117 -
82.118 - }
82.119 -
82.120 - private static final class FN extends FilterNode {
82.121 - FN(Node orig, FileItem item) {
82.122 - super (orig, Children.LEAF, new ProxyLookup(
82.123 - Lookups.singleton(item),
82.124 - orig.getLookup()));
82.125 - disableDelegation(DELEGATE_GET_ACTIONS);
82.126 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
82.127 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
82.128 - disableDelegation(DELEGATE_GET_VALUE);
82.129 - disableDelegation(DELEGATE_SET_VALUE);
82.130 - disableDelegation(DELEGATE_SET_NAME);
82.131 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
82.132 - setDisplayName (item.file.getPath());
82.133 - }
82.134 -
82.135 - @Override
82.136 - public Action[] getActions(boolean ignored) {
82.137 - return new Action[0];
82.138 - }
82.139 - }
82.140 -}
83.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_4.txt Thu Aug 30 10:56:16 2012 +0200
83.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
83.3 @@ -1,140 +0,0 @@
83.4 -
83.5 - //Hello world
83.6 -
83.7 -/*
83.8 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
83.9 - *
83.10 - * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
83.11 - *
83.12 - * The contents of this file are subject to the terms of either the GNU
83.13 - * General Public License Version 2 only ("GPL") or the Common
83.14 - * Development and Distribution License("CDDL") (collectively, the
83.15 - * "License"). You may not use this file except in compliance with the
83.16 - * License. You can obtain a copy of the License at
83.17 - * http://www.netbeans.org/cddl-gplv2.html
83.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
83.19 - * specific language governing permissions and limitations under the
83.20 - * License. When distributing the software, include this License Header
83.21 - * Notice in each file and include the License file at
83.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
83.23 - * particular file as subject to the "Classpath" exception as provided
83.24 - * by Sun in the GPL Version 2 section of the License file that
83.25 - * accompanied this code. If applicable, add the following below the
83.26 - * License Header, with the fields enclosed by brackets [] replaced by
83.27 - * your own identifying information:
83.28 - * "Portions Copyrighted [year] [name of copyright owner]"
83.29 - *
83.30 - * If you wish your version of this file to be governed by only the CDDL
83.31 - * or only the GPL Version 2, indicate your decision by adding
83.32 - * "[Contributor] elects to include this software in this distribution
83.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
83.34 - * single choice of license, a recipient has the option to distribute
83.35 - * your version of this file under either the CDDL, the GPL Version 2 or
83.36 - * to extend the choice of license to its licensees as provided above.
83.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
83.38 - * Version 2 license, then the option applies only if the new code is
83.39 - * made subject to such option by the copyright holder.
83.40 - *
83.41 - * Contributor(s):
83.42 - *
83.43 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
83.44 - */package org.netbeans.modules.licensechanger;
83.45 -
83.46 -import java.util.Collection;
83.47 -import java.util.HashSet;
83.48 -import java.util.LinkedList;
83.49 -import java.util.List;
83.50 -import java.util.Set;
83.51 -import javax.swing.Action;
83.52 -import org.netbeans.modules.licensechanger.api.FileHandler;
83.53 -import org.openide.filesystems.FileObject;
83.54 -import org.openide.loaders.DataObject;
83.55 -import org.openide.loaders.DataObjectNotFoundException;
83.56 -import org.openide.nodes.ChildFactory;
83.57 -import org.openide.nodes.FilterNode;
83.58 -import org.openide.nodes.Node;
83.59 -import org.openide.util.Exceptions;
83.60 -import org.openide.util.Lookup;
83.61 -import org.openide.util.lookup.Lookups;
83.62 -import org.openide.util.lookup.ProxyLookup;
83.63 -
83.64 -/**
83.65 - *
83.66 - * @author Tim Boudreau
83.67 - */
83.68 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
83.69 - private final Set<FileObject> folders;
83.70 - private final Collection <? extends FileHandler> allHandlers;
83.71 - FileChildren (Set<FileObject> folders) {
83.72 - this.folders = new HashSet(folders);
83.73 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
83.74 - }
83.75 -
83.76 - @Override
83.77 - protected boolean createKeys(List<FileObject> toPopulate) {
83.78 - toPopulate.addAll (folders);
83.79 - return true;
83.80 - }
83.81 -
83.82 - @Override
83.83 - protected Node[] createNodesForKey(FileObject key) {
83.84 - List<Node> result = new LinkedList<Node>();
83.85 -outer: for (FileObject fo : key.getChildren()) {
83.86 - if (fo.isData()) {
83.87 - for (FileHandler h : allHandlers) {
83.88 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
83.89 - try {
83.90 - DataObject dob = DataObject.find(fo);
83.91 - FileItem item = new FileItem (h, fo);
83.92 - result.add (new FN (dob.getNodeDelegate(), item));
83.93 - break outer;
83.94 - } catch (DataObjectNotFoundException ex) {
83.95 - Exceptions.printStackTrace(ex);
83.96 - }
83.97 - }
83.98 - }
83.99 - }
83.100 - }
83.101 - return result.toArray(new Node[result.size()]);
83.102 - }
83.103 -
83.104 - static final class FileItem {
83.105 - FileHandler handler;
83.106 - FileObject file;
83.107 -
83.108 - public FileItem(FileHandler handler, FileObject file) {
83.109 - this.handler = handler;
83.110 - this.file = file;
83.111 - }
83.112 -
83.113 - public FileObject getFile() {
83.114 - return file;
83.115 - }
83.116 -
83.117 - public FileHandler getHandler() {
83.118 - return handler;
83.119 - }
83.120 -
83.121 - }
83.122 -
83.123 - private static final class FN extends FilterNode {
83.124 - FN(Node orig, FileItem item) {
83.125 - super (orig, Children.LEAF, new ProxyLookup(
83.126 - Lookups.singleton(item),
83.127 - orig.getLookup()));
83.128 - disableDelegation(DELEGATE_GET_ACTIONS);
83.129 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
83.130 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
83.131 - disableDelegation(DELEGATE_GET_VALUE);
83.132 - disableDelegation(DELEGATE_SET_VALUE);
83.133 - disableDelegation(DELEGATE_SET_NAME);
83.134 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
83.135 - setDisplayName (item.file.getPath());
83.136 - }
83.137 -
83.138 - @Override
83.139 - public Action[] getActions(boolean ignored) {
83.140 - return new Action[0];
83.141 - }
83.142 - }
83.143 -}
84.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_5.txt Thu Aug 30 10:56:16 2012 +0200
84.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
84.3 @@ -1,103 +0,0 @@
84.4 -//This is another kind of license comment
84.5 -//We should make sure it catches this too
84.6 -//We really want to get rid of all stuff before the package statement
84.7 -package org.netbeans.modules.licensechanger;
84.8 -
84.9 -import java.util.Collection;
84.10 -import java.util.HashSet;
84.11 -import java.util.LinkedList;
84.12 -import java.util.List;
84.13 -import java.util.Set;
84.14 -import javax.swing.Action;
84.15 -import org.netbeans.modules.licensechanger.api.FileHandler;
84.16 -import org.openide.filesystems.FileObject;
84.17 -import org.openide.loaders.DataObject;
84.18 -import org.openide.loaders.DataObjectNotFoundException;
84.19 -import org.openide.nodes.ChildFactory;
84.20 -import org.openide.nodes.FilterNode;
84.21 -import org.openide.nodes.Node;
84.22 -import org.openide.util.Exceptions;
84.23 -import org.openide.util.Lookup;
84.24 -import org.openide.util.lookup.Lookups;
84.25 -import org.openide.util.lookup.ProxyLookup;
84.26 -
84.27 -/**
84.28 - *
84.29 - * @author Tim Boudreau
84.30 - */
84.31 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
84.32 - private final Set<FileObject> folders;
84.33 - private final Collection <? extends FileHandler> allHandlers;
84.34 - FileChildren (Set<FileObject> folders) {
84.35 - this.folders = new HashSet(folders);
84.36 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
84.37 - }
84.38 -
84.39 - @Override
84.40 - protected boolean createKeys(List<FileObject> toPopulate) {
84.41 - toPopulate.addAll (folders);
84.42 - return true;
84.43 - }
84.44 -
84.45 - @Override
84.46 - protected Node[] createNodesForKey(FileObject key) {
84.47 - List<Node> result = new LinkedList<Node>();
84.48 -outer: for (FileObject fo : key.getChildren()) {
84.49 - if (fo.isData()) {
84.50 - for (FileHandler h : allHandlers) {
84.51 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
84.52 - try {
84.53 - DataObject dob = DataObject.find(fo);
84.54 - FileItem item = new FileItem (h, fo);
84.55 - result.add (new FN (dob.getNodeDelegate(), item));
84.56 - break outer;
84.57 - } catch (DataObjectNotFoundException ex) {
84.58 - Exceptions.printStackTrace(ex);
84.59 - }
84.60 - }
84.61 - }
84.62 - }
84.63 - }
84.64 - return result.toArray(new Node[result.size()]);
84.65 - }
84.66 -
84.67 - static final class FileItem {
84.68 - FileHandler handler;
84.69 - FileObject file;
84.70 -
84.71 - public FileItem(FileHandler handler, FileObject file) {
84.72 - this.handler = handler;
84.73 - this.file = file;
84.74 - }
84.75 -
84.76 - public FileObject getFile() {
84.77 - return file;
84.78 - }
84.79 -
84.80 - public FileHandler getHandler() {
84.81 - return handler;
84.82 - }
84.83 -
84.84 - }
84.85 -
84.86 - private static final class FN extends FilterNode {
84.87 - FN(Node orig, FileItem item) {
84.88 - super (orig, Children.LEAF, new ProxyLookup(
84.89 - Lookups.singleton(item),
84.90 - orig.getLookup()));
84.91 - disableDelegation(DELEGATE_GET_ACTIONS);
84.92 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
84.93 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
84.94 - disableDelegation(DELEGATE_GET_VALUE);
84.95 - disableDelegation(DELEGATE_SET_VALUE);
84.96 - disableDelegation(DELEGATE_SET_NAME);
84.97 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
84.98 - setDisplayName (item.file.getPath());
84.99 - }
84.100 -
84.101 - @Override
84.102 - public Action[] getActions(boolean ignored) {
84.103 - return new Action[0];
84.104 - }
84.105 - }
84.106 -}
85.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_6.txt Thu Aug 30 10:56:16 2012 +0200
85.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
85.3 @@ -1,100 +0,0 @@
85.4 -package org.netbeans.modules.licensechanger;
85.5 -
85.6 -import java.util.Collection;
85.7 -import java.util.HashSet;
85.8 -import java.util.LinkedList;
85.9 -import java.util.List;
85.10 -import java.util.Set;
85.11 -import javax.swing.Action;
85.12 -import org.netbeans.modules.licensechanger.api.FileHandler;
85.13 -import org.openide.filesystems.FileObject;
85.14 -import org.openide.loaders.DataObject;
85.15 -import org.openide.loaders.DataObjectNotFoundException;
85.16 -import org.openide.nodes.ChildFactory;
85.17 -import org.openide.nodes.FilterNode;
85.18 -import org.openide.nodes.Node;
85.19 -import org.openide.util.Exceptions;
85.20 -import org.openide.util.Lookup;
85.21 -import org.openide.util.lookup.Lookups;
85.22 -import org.openide.util.lookup.ProxyLookup;
85.23 -
85.24 -/**
85.25 - *
85.26 - * @author Tim Boudreau
85.27 - */
85.28 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
85.29 - private final Set<FileObject> folders;
85.30 - private final Collection <? extends FileHandler> allHandlers;
85.31 - FileChildren (Set<FileObject> folders) {
85.32 - this.folders = new HashSet(folders);
85.33 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
85.34 - }
85.35 -
85.36 - @Override
85.37 - protected boolean createKeys(List<FileObject> toPopulate) {
85.38 - toPopulate.addAll (folders);
85.39 - return true;
85.40 - }
85.41 -
85.42 - @Override
85.43 - protected Node[] createNodesForKey(FileObject key) {
85.44 - List<Node> result = new LinkedList<Node>();
85.45 -outer: for (FileObject fo : key.getChildren()) {
85.46 - if (fo.isData()) {
85.47 - for (FileHandler h : allHandlers) {
85.48 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
85.49 - try {
85.50 - DataObject dob = DataObject.find(fo);
85.51 - FileItem item = new FileItem (h, fo);
85.52 - result.add (new FN (dob.getNodeDelegate(), item));
85.53 - break outer;
85.54 - } catch (DataObjectNotFoundException ex) {
85.55 - Exceptions.printStackTrace(ex);
85.56 - }
85.57 - }
85.58 - }
85.59 - }
85.60 - }
85.61 - return result.toArray(new Node[result.size()]);
85.62 - }
85.63 -
85.64 - static final class FileItem {
85.65 - FileHandler handler;
85.66 - FileObject file;
85.67 -
85.68 - public FileItem(FileHandler handler, FileObject file) {
85.69 - this.handler = handler;
85.70 - this.file = file;
85.71 - }
85.72 -
85.73 - public FileObject getFile() {
85.74 - return file;
85.75 - }
85.76 -
85.77 - public FileHandler getHandler() {
85.78 - return handler;
85.79 - }
85.80 -
85.81 - }
85.82 -
85.83 - private static final class FN extends FilterNode {
85.84 - FN(Node orig, FileItem item) {
85.85 - super (orig, Children.LEAF, new ProxyLookup(
85.86 - Lookups.singleton(item),
85.87 - orig.getLookup()));
85.88 - disableDelegation(DELEGATE_GET_ACTIONS);
85.89 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
85.90 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
85.91 - disableDelegation(DELEGATE_GET_VALUE);
85.92 - disableDelegation(DELEGATE_SET_VALUE);
85.93 - disableDelegation(DELEGATE_SET_NAME);
85.94 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
85.95 - setDisplayName (item.file.getPath());
85.96 - }
85.97 -
85.98 - @Override
85.99 - public Action[] getActions(boolean ignored) {
85.100 - return new Action[0];
85.101 - }
85.102 - }
85.103 -}
86.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_7.txt Thu Aug 30 10:56:16 2012 +0200
86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
86.3 @@ -1,140 +0,0 @@
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 -
86.44 -package org.netbeans.modules.licensechanger;
86.45 -
86.46 -import java.util.Collection;
86.47 -import java.util.HashSet;
86.48 -import java.util.LinkedList;
86.49 -import java.util.List;
86.50 -import java.util.Set;
86.51 -import javax.swing.Action;
86.52 -import org.netbeans.modules.licensechanger.api.FileHandler;
86.53 -import org.openide.filesystems.FileObject;
86.54 -import org.openide.loaders.DataObject;
86.55 -import org.openide.loaders.DataObjectNotFoundException;
86.56 -import org.openide.nodes.ChildFactory;
86.57 -import org.openide.nodes.FilterNode;
86.58 -import org.openide.nodes.Node;
86.59 -import org.openide.util.Exceptions;
86.60 -import org.openide.util.Lookup;
86.61 -import org.openide.util.lookup.Lookups;
86.62 -import org.openide.util.lookup.ProxyLookup;
86.63 -
86.64 -/**
86.65 - *
86.66 - * @author Tim Boudreau
86.67 - */
86.68 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
86.69 - private final Set<FileObject> folders;
86.70 - private final Collection <? extends FileHandler> allHandlers;
86.71 - FileChildren (Set<FileObject> folders) {
86.72 - this.folders = new HashSet(folders);
86.73 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
86.74 - }
86.75 -
86.76 - @Override
86.77 - protected boolean createKeys(List<FileObject> toPopulate) {
86.78 - toPopulate.addAll (folders);
86.79 - return true;
86.80 - }
86.81 -
86.82 - @Override
86.83 - protected Node[] createNodesForKey(FileObject key) {
86.84 - List<Node> result = new LinkedList<Node>();
86.85 -outer: for (FileObject fo : key.getChildren()) {
86.86 - if (fo.isData()) {
86.87 - for (FileHandler h : allHandlers) {
86.88 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
86.89 - try {
86.90 - DataObject dob = DataObject.find(fo);
86.91 - FileItem item = new FileItem (h, fo);
86.92 - result.add (new FN (dob.getNodeDelegate(), item));
86.93 - break outer;
86.94 - } catch (DataObjectNotFoundException ex) {
86.95 - Exceptions.printStackTrace(ex);
86.96 - }
86.97 - }
86.98 - }
86.99 - }
86.100 - }
86.101 - return result.toArray(new Node[result.size()]);
86.102 - }
86.103 -
86.104 - static final class FileItem {
86.105 - FileHandler handler;
86.106 - FileObject file;
86.107 -
86.108 - public FileItem(FileHandler handler, FileObject file) {
86.109 - this.handler = handler;
86.110 - this.file = file;
86.111 - }
86.112 -
86.113 - public FileObject getFile() {
86.114 - return file;
86.115 - }
86.116 -
86.117 - public FileHandler getHandler() {
86.118 - return handler;
86.119 - }
86.120 -
86.121 - }
86.122 -
86.123 - private static final class FN extends FilterNode {
86.124 - FN(Node orig, FileItem item) {
86.125 - super (orig, Children.LEAF, new ProxyLookup(
86.126 - Lookups.singleton(item),
86.127 - orig.getLookup()));
86.128 - disableDelegation(DELEGATE_GET_ACTIONS);
86.129 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
86.130 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
86.131 - disableDelegation(DELEGATE_GET_VALUE);
86.132 - disableDelegation(DELEGATE_SET_VALUE);
86.133 - disableDelegation(DELEGATE_SET_NAME);
86.134 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
86.135 - setDisplayName (item.file.getPath());
86.136 - }
86.137 -
86.138 - @Override
86.139 - public Action[] getActions(boolean ignored) {
86.140 - return new Action[0];
86.141 - }
86.142 - }
86.143 -}
87.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_8.txt Thu Aug 30 10:56:16 2012 +0200
87.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
87.3 @@ -1,141 +0,0 @@
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 - * License. When distributing the software, include this License Header
87.18 - * Notice in each file and include the License file at
87.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
87.20 - * particular file as subject to the "Classpath" exception as provided
87.21 - * by Sun in the GPL Version 2 section of the License file that
87.22 - * accompanied this code. If applicable, add the following below the
87.23 - * License Header, with the fields enclosed by brackets [] replaced by
87.24 - * your own identifying information:
87.25 - * "Portions Copyrighted [year] [name of copyright owner]"
87.26 - *
87.27 - * If you wish your version of this file to be governed by only the CDDL
87.28 - * or only the GPL Version 2, indicate your decision by adding
87.29 - * "[Contributor] elects to include this software in this distribution
87.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
87.31 - * single choice of license, a recipient has the option to distribute
87.32 - * your version of this file under either the CDDL, the GPL Version 2 or
87.33 - * to extend the choice of license to its licensees as provided above.
87.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
87.35 - * Version 2 license, then the option applies only if the new code is
87.36 - * made subject to such option by the copyright holder.
87.37 - *
87.38 - * Contributor(s):
87.39 - *
87.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
87.41 - */
87.42 -/* Created on March 14, 2009
87.43 - * by some IDE or other */
87.44 -
87.45 -package org.netbeans.modules.licensechanger;
87.46 -
87.47 -import java.util.Collection;
87.48 -import java.util.HashSet;
87.49 -import java.util.LinkedList;
87.50 -import java.util.List;
87.51 -import java.util.Set;
87.52 -import javax.swing.Action;
87.53 -import org.netbeans.modules.licensechanger.api.FileHandler;
87.54 -import org.openide.filesystems.FileObject;
87.55 -import org.openide.loaders.DataObject;
87.56 -import org.openide.loaders.DataObjectNotFoundException;
87.57 -import org.openide.nodes.ChildFactory;
87.58 -import org.openide.nodes.FilterNode;
87.59 -import org.openide.nodes.Node;
87.60 -import org.openide.util.Exceptions;
87.61 -import org.openide.util.Lookup;
87.62 -import org.openide.util.lookup.Lookups;
87.63 -import org.openide.util.lookup.ProxyLookup;
87.64 -
87.65 -/**
87.66 - *
87.67 - * @author Tim Boudreau
87.68 - */
87.69 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
87.70 - private final Set<FileObject> folders;
87.71 - private final Collection <? extends FileHandler> allHandlers;
87.72 - FileChildren (Set<FileObject> folders) {
87.73 - this.folders = new HashSet(folders);
87.74 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
87.75 - }
87.76 -
87.77 - @Override
87.78 - protected boolean createKeys(List<FileObject> toPopulate) {
87.79 - toPopulate.addAll (folders);
87.80 - return true;
87.81 - }
87.82 -
87.83 - @Override
87.84 - protected Node[] createNodesForKey(FileObject key) {
87.85 - List<Node> result = new LinkedList<Node>();
87.86 -outer: for (FileObject fo : key.getChildren()) {
87.87 - if (fo.isData()) {
87.88 - for (FileHandler h : allHandlers) {
87.89 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
87.90 - try {
87.91 - DataObject dob = DataObject.find(fo);
87.92 - FileItem item = new FileItem (h, fo);
87.93 - result.add (new FN (dob.getNodeDelegate(), item));
87.94 - break outer;
87.95 - } catch (DataObjectNotFoundException ex) {
87.96 - Exceptions.printStackTrace(ex);
87.97 - }
87.98 - }
87.99 - }
87.100 - }
87.101 - }
87.102 - return result.toArray(new Node[result.size()]);
87.103 - }
87.104 -
87.105 - static final class FileItem {
87.106 - FileHandler handler;
87.107 - FileObject file;
87.108 -
87.109 - public FileItem(FileHandler handler, FileObject file) {
87.110 - this.handler = handler;
87.111 - this.file = file;
87.112 - }
87.113 -
87.114 - public FileObject getFile() {
87.115 - return file;
87.116 - }
87.117 -
87.118 - public FileHandler getHandler() {
87.119 - return handler;
87.120 - }
87.121 -
87.122 - }
87.123 -
87.124 - private static final class FN extends FilterNode {
87.125 - FN(Node orig, FileItem item) {
87.126 - super (orig, Children.LEAF, new ProxyLookup(
87.127 - Lookups.singleton(item),
87.128 - orig.getLookup()));
87.129 - disableDelegation(DELEGATE_GET_ACTIONS);
87.130 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
87.131 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
87.132 - disableDelegation(DELEGATE_GET_VALUE);
87.133 - disableDelegation(DELEGATE_SET_VALUE);
87.134 - disableDelegation(DELEGATE_SET_NAME);
87.135 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
87.136 - setDisplayName (item.file.getPath());
87.137 - }
87.138 -
87.139 - @Override
87.140 - public Action[] getActions(boolean ignored) {
87.141 - return new Action[0];
87.142 - }
87.143 - }
87.144 -}
88.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_9.txt Thu Aug 30 10:56:16 2012 +0200
88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
88.3 @@ -1,142 +0,0 @@
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 - * License. When distributing the software, include this License Header
88.18 - * Notice in each file and include the License file at
88.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
88.20 - * particular file as subject to the "Classpath" exception as provided
88.21 - * by Sun in the GPL Version 2 section of the License file that
88.22 - * accompanied this code. If applicable, add the following below the
88.23 - * License Header, with the fields enclosed by brackets [] replaced by
88.24 - * your own identifying information:
88.25 - * "Portions Copyrighted [year] [name of copyright owner]"
88.26 - *
88.27 - * If you wish your version of this file to be governed by only the CDDL
88.28 - * or only the GPL Version 2, indicate your decision by adding
88.29 - * "[Contributor] elects to include this software in this distribution
88.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
88.31 - * single choice of license, a recipient has the option to distribute
88.32 - * your version of this file under either the CDDL, the GPL Version 2 or
88.33 - * to extend the choice of license to its licensees as provided above.
88.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
88.35 - * Version 2 license, then the option applies only if the new code is
88.36 - * made subject to such option by the copyright holder.
88.37 - *
88.38 - * Contributor(s):
88.39 - *
88.40 - * Portions Copyrighted 2009 Sun Microsystems, Inc.
88.41 - */
88.42 -/* Created on March 14, 2009
88.43 - * by some IDE or other
88.44 - */
88.45 -
88.46 -package org.netbeans.modules.licensechanger;
88.47 -
88.48 -import java.util.Collection;
88.49 -import java.util.HashSet;
88.50 -import java.util.LinkedList;
88.51 -import java.util.List;
88.52 -import java.util.Set;
88.53 -import javax.swing.Action;
88.54 -import org.netbeans.modules.licensechanger.api.FileHandler;
88.55 -import org.openide.filesystems.FileObject;
88.56 -import org.openide.loaders.DataObject;
88.57 -import org.openide.loaders.DataObjectNotFoundException;
88.58 -import org.openide.nodes.ChildFactory;
88.59 -import org.openide.nodes.FilterNode;
88.60 -import org.openide.nodes.Node;
88.61 -import org.openide.util.Exceptions;
88.62 -import org.openide.util.Lookup;
88.63 -import org.openide.util.lookup.Lookups;
88.64 -import org.openide.util.lookup.ProxyLookup;
88.65 -
88.66 -/**
88.67 - *
88.68 - * @author Tim Boudreau
88.69 - */
88.70 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
88.71 - private final Set<FileObject> folders;
88.72 - private final Collection <? extends FileHandler> allHandlers;
88.73 - FileChildren (Set<FileObject> folders) {
88.74 - this.folders = new HashSet(folders);
88.75 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
88.76 - }
88.77 -
88.78 - @Override
88.79 - protected boolean createKeys(List<FileObject> toPopulate) {
88.80 - toPopulate.addAll (folders);
88.81 - return true;
88.82 - }
88.83 -
88.84 - @Override
88.85 - protected Node[] createNodesForKey(FileObject key) {
88.86 - List<Node> result = new LinkedList<Node>();
88.87 -outer: for (FileObject fo : key.getChildren()) {
88.88 - if (fo.isData()) {
88.89 - for (FileHandler h : allHandlers) {
88.90 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
88.91 - try {
88.92 - DataObject dob = DataObject.find(fo);
88.93 - FileItem item = new FileItem (h, fo);
88.94 - result.add (new FN (dob.getNodeDelegate(), item));
88.95 - break outer;
88.96 - } catch (DataObjectNotFoundException ex) {
88.97 - Exceptions.printStackTrace(ex);
88.98 - }
88.99 - }
88.100 - }
88.101 - }
88.102 - }
88.103 - return result.toArray(new Node[result.size()]);
88.104 - }
88.105 -
88.106 - static final class FileItem {
88.107 - FileHandler handler;
88.108 - FileObject file;
88.109 -
88.110 - public FileItem(FileHandler handler, FileObject file) {
88.111 - this.handler = handler;
88.112 - this.file = file;
88.113 - }
88.114 -
88.115 - public FileObject getFile() {
88.116 - return file;
88.117 - }
88.118 -
88.119 - public FileHandler getHandler() {
88.120 - return handler;
88.121 - }
88.122 -
88.123 - }
88.124 -
88.125 - private static final class FN extends FilterNode {
88.126 - FN(Node orig, FileItem item) {
88.127 - super (orig, Children.LEAF, new ProxyLookup(
88.128 - Lookups.singleton(item),
88.129 - orig.getLookup()));
88.130 - disableDelegation(DELEGATE_GET_ACTIONS);
88.131 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
88.132 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
88.133 - disableDelegation(DELEGATE_GET_VALUE);
88.134 - disableDelegation(DELEGATE_SET_VALUE);
88.135 - disableDelegation(DELEGATE_SET_NAME);
88.136 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
88.137 - setDisplayName (item.file.getPath());
88.138 - }
88.139 -
88.140 - @Override
88.141 - public Action[] getActions(boolean ignored) {
88.142 - return new Action[0];
88.143 - }
88.144 - }
88.145 -}
89.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/java_golden.txt Thu Aug 30 10:56:16 2012 +0200
89.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
89.3 @@ -1,131 +0,0 @@
89.4 -/*
89.5 - * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
89.6 - * All rights reversed.
89.7 - *
89.8 - * Redistribution and use in source, binary or corpuscular forms, with or without
89.9 - * modification, are prohibited under all circumstances unless the following
89.10 - * conditions have been met:
89.11 - *
89.12 - * 1. You have an eyeball growing in the palm of your left hand
89.13 - *
89.14 - * 2. Seven dwarfs really like your golden hair
89.15 - *
89.16 - * 3. The moon has reversed its course a multiple of times divisible by
89.17 - * the eighteenth prime number in the last year
89.18 - *
89.19 - * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
89.20 - * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
89.21 - * DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
89.22 - * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
89.23 - * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
89.24 - * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
89.25 - * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
89.26 - * BALL DROP, BECOMING A LAWYER.
89.27 - *
89.28 - * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
89.29 - * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
89.30 - * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
89.31 - * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
89.32 - *
89.33 - * RUN, RUN NOW, AND RUN VERY FAST.
89.34 - */
89.35 -package org.netbeans.modules.licensechanger;
89.36 -
89.37 -import java.util.Collection;
89.38 -import java.util.HashSet;
89.39 -import java.util.LinkedList;
89.40 -import java.util.List;
89.41 -import java.util.Set;
89.42 -import javax.swing.Action;
89.43 -import org.netbeans.modules.licensechanger.api.FileHandler;
89.44 -import org.openide.filesystems.FileObject;
89.45 -import org.openide.loaders.DataObject;
89.46 -import org.openide.loaders.DataObjectNotFoundException;
89.47 -import org.openide.nodes.ChildFactory;
89.48 -import org.openide.nodes.FilterNode;
89.49 -import org.openide.nodes.Node;
89.50 -import org.openide.util.Exceptions;
89.51 -import org.openide.util.Lookup;
89.52 -import org.openide.util.lookup.Lookups;
89.53 -import org.openide.util.lookup.ProxyLookup;
89.54 -
89.55 -/**
89.56 - *
89.57 - * @author Tim Boudreau
89.58 - */
89.59 -public class FileChildren extends ChildFactory.Detachable <FileObject> {
89.60 - private final Set<FileObject> folders;
89.61 - private final Collection <? extends FileHandler> allHandlers;
89.62 - FileChildren (Set<FileObject> folders) {
89.63 - this.folders = new HashSet(folders);
89.64 - allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
89.65 - }
89.66 -
89.67 - @Override
89.68 - protected boolean createKeys(List<FileObject> toPopulate) {
89.69 - toPopulate.addAll (folders);
89.70 - return true;
89.71 - }
89.72 -
89.73 - @Override
89.74 - protected Node[] createNodesForKey(FileObject key) {
89.75 - List<Node> result = new LinkedList<Node>();
89.76 -outer: for (FileObject fo : key.getChildren()) {
89.77 - if (fo.isData()) {
89.78 - for (FileHandler h : allHandlers) {
89.79 - if (h.match(fo) && !h.shouldSkipFile(fo)) {
89.80 - try {
89.81 - DataObject dob = DataObject.find(fo);
89.82 - FileItem item = new FileItem (h, fo);
89.83 - result.add (new FN (dob.getNodeDelegate(), item));
89.84 - break outer;
89.85 - } catch (DataObjectNotFoundException ex) {
89.86 - Exceptions.printStackTrace(ex);
89.87 - }
89.88 - }
89.89 - }
89.90 - }
89.91 - }
89.92 - return result.toArray(new Node[result.size()]);
89.93 - }
89.94 -
89.95 - static final class FileItem {
89.96 - FileHandler handler;
89.97 - FileObject file;
89.98 -
89.99 - public FileItem(FileHandler handler, FileObject file) {
89.100 - this.handler = handler;
89.101 - this.file = file;
89.102 - }
89.103 -
89.104 - public FileObject getFile() {
89.105 - return file;
89.106 - }
89.107 -
89.108 - public FileHandler getHandler() {
89.109 - return handler;
89.110 - }
89.111 -
89.112 - }
89.113 -
89.114 - private static final class FN extends FilterNode {
89.115 - FN(Node orig, FileItem item) {
89.116 - super (orig, Children.LEAF, new ProxyLookup(
89.117 - Lookups.singleton(item),
89.118 - orig.getLookup()));
89.119 - disableDelegation(DELEGATE_GET_ACTIONS);
89.120 - disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
89.121 - disableDelegation(DELEGATE_SET_DISPLAY_NAME);
89.122 - disableDelegation(DELEGATE_GET_VALUE);
89.123 - disableDelegation(DELEGATE_SET_VALUE);
89.124 - disableDelegation(DELEGATE_SET_NAME);
89.125 - setValue (CheckboxListView.SELECTED, Boolean.TRUE);
89.126 - setDisplayName (item.file.getPath());
89.127 - }
89.128 -
89.129 - @Override
89.130 - public Action[] getActions(boolean ignored) {
89.131 - return new Action[0];
89.132 - }
89.133 - }
89.134 -}
90.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/props_1.txt Thu Aug 30 10:56:16 2012 +0200
90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
90.3 @@ -1,5 +0,0 @@
90.4 -#Just one comment
90.5 -NAME_JAVA_FILES=Java Files
90.6 -NAME_PROPERTIES_FILES=Properties Files
90.7 -NAME_XML_FILES=XML Files
90.8 -
91.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/props_2.txt Thu Aug 30 10:56:16 2012 +0200
91.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
91.3 @@ -1,40 +0,0 @@
91.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
91.5 -#
91.6 -# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
91.7 -#
91.8 -# The contents of this file are subject to the terms of either the GNU
91.9 -# General Public License Version 2 only ("GPL") or the Common
91.10 -# Development and Distribution License("CDDL") (collectively, the
91.11 -# "License"). You may not use this file except in compliance with the
91.12 -# License. You can obtain a copy of the License at
91.13 -# http://www.netbeans.org/cddl-gplv2.html
91.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
91.15 -# specific language governing permissions and limitations under the
91.16 -# License. When distributing the software, include this License Header
91.17 -# Notice in each file and include the License file at
91.18 -# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
91.19 -# particular file as subject to the "Classpath" exception as provided
91.20 -# by Sun in the GPL Version 2 section of the License file that
91.21 -# accompanied this code. If applicable, add the following below the
91.22 -# License Header, with the fields enclosed by brackets [] replaced by
91.23 -# your own identifying information:
91.24 -# "Portions Copyrighted [year] [name of copyright owner]"
91.25 -#
91.26 -# If you wish your version of this file to be governed by only the CDDL
91.27 -# or only the GPL Version 2, indicate your decision by adding
91.28 -# "[Contributor] elects to include this software in this distribution
91.29 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
91.30 -# single choice of license, a recipient has the option to distribute
91.31 -# your version of this file under either the CDDL, the GPL Version 2 or
91.32 -# to extend the choice of license to its licensees as provided above.
91.33 -# However, if you add GPL Version 2 code and therefore, elected the GPL
91.34 -# Version 2 license, then the option applies only if the new code is
91.35 -# made subject to such option by the copyright holder.
91.36 -#
91.37 -# Contributor(s):
91.38 -#
91.39 -# Portions Copyrighted 2009 Sun Microsystems, Inc.
91.40 -NAME_JAVA_FILES=Java Files
91.41 -NAME_PROPERTIES_FILES=Properties Files
91.42 -NAME_XML_FILES=XML Files
91.43 -
92.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/props_3.txt Thu Aug 30 10:56:16 2012 +0200
92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
92.3 @@ -1,4 +0,0 @@
92.4 -NAME_JAVA_FILES=Java Files
92.5 -NAME_PROPERTIES_FILES=Properties Files
92.6 -NAME_XML_FILES=XML Files
92.7 -
93.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/props_4.txt Thu Aug 30 10:56:16 2012 +0200
93.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
93.3 @@ -1,24 +0,0 @@
93.4 -
93.5 -
93.6 -
93.7 -
93.8 -
93.9 -
93.10 -
93.11 -
93.12 -
93.13 -
93.14 -
93.15 -
93.16 -
93.17 -
93.18 -
93.19 -
93.20 -
93.21 -
93.22 -
93.23 -
93.24 -NAME_JAVA_FILES=Java Files
93.25 -NAME_PROPERTIES_FILES=Properties Files
93.26 -NAME_XML_FILES=XML Files
93.27 -
94.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/props_golden.txt Thu Aug 30 10:56:16 2012 +0200
94.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
94.3 @@ -1,33 +0,0 @@
94.4 -# Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
94.5 -# All rights reversed.
94.6 -#
94.7 -# Redistribution and use in source, binary or corpuscular forms, with or without
94.8 -# modification, are prohibited under all circumstances unless the following
94.9 -# conditions have been met:
94.10 -#
94.11 -# 1. You have an eyeball growing in the palm of your left hand
94.12 -#
94.13 -# 2. Seven dwarfs really like your golden hair
94.14 -#
94.15 -# 3. The moon has reversed its course a multiple of times divisible by
94.16 -# the eighteenth prime number in the last year
94.17 -#
94.18 -# THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
94.19 -# INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
94.20 -# DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
94.21 -# OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
94.22 -# ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
94.23 -# SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
94.24 -# LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
94.25 -# BALL DROP, BECOMING A LAWYER.
94.26 -#
94.27 -# BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
94.28 -# AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
94.29 -# AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
94.30 -# INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
94.31 -#
94.32 -# RUN, RUN NOW, AND RUN VERY FAST.
94.33 -NAME_JAVA_FILES=Java Files
94.34 -NAME_PROPERTIES_FILES=Properties Files
94.35 -NAME_XML_FILES=XML Files
94.36 -
95.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_1.txt Thu Aug 30 10:56:16 2012 +0200
95.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
95.3 @@ -1,96 +0,0 @@
95.4 -<?xml version="1.0" encoding="UTF-8"?>
95.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
95.6 -<filesystem>
95.7 - <folder name="Navigator">
95.8 - <folder name="Panels">
95.9 - <folder name="text">
95.10 - <folder name="html">
95.11 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
95.12 - </folder>
95.13 - <folder name="plain">
95.14 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
95.15 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
95.16 - </file>
95.17 - </folder>
95.18 - </folder>
95.19 - <folder name="content">
95.20 - <folder name="unknown">
95.21 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
95.22 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
95.23 - </file>
95.24 - </folder>
95.25 - </folder>
95.26 - </folder>
95.27 - </folder>
95.28 - <folder name="GenericNavigator">
95.29 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.30 - <folder name="text">
95.31 - <folder name="html">
95.32 -
95.33 - <file name="Headers.patternItem" url="headers_pattern.txt">
95.34 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.35 - <attr name="position" intvalue="100"/>
95.36 - </file>
95.37 -
95.38 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
95.39 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.40 - <attr name="position" intvalue="200"/>
95.41 - </file>
95.42 -
95.43 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
95.44 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.45 - <attr name="position" intvalue="400"/>
95.46 - </file>
95.47 -
95.48 - <file name="Images.patternItem" url="images_pattern.txt">
95.49 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.50 - <attr name="position" intvalue="300"/>
95.51 - </file>
95.52 -
95.53 - </folder>
95.54 - <folder name="plain">
95.55 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
95.56 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.57 - <attr name="position" intvalue="100"/>
95.58 - </file>
95.59 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
95.60 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.61 - <attr name="position" intvalue="200"/>
95.62 - </file>
95.63 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
95.64 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.65 - <attr name="position" intvalue="300"/>
95.66 - </file>
95.67 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
95.68 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.69 - <attr name="position" intvalue="400"/>
95.70 - </file>
95.71 - </folder>
95.72 - </folder>
95.73 - <folder name="content">
95.74 - <folder name="unknown">
95.75 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
95.76 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.77 - <attr name="position" intvalue="100"/>
95.78 - </file>
95.79 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
95.80 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.81 - <attr name="position" intvalue="200"/>
95.82 - </file>
95.83 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
95.84 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.85 - <attr name="position" intvalue="300"/>
95.86 - </file>
95.87 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
95.88 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
95.89 - <attr name="position" intvalue="400"/>
95.90 - </file>
95.91 - </folder>
95.92 - </folder>
95.93 - </folder>
95.94 - <folder name="OptionsDialog">
95.95 - <folder name="Advanced">
95.96 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
95.97 - </folder>
95.98 - </folder>
95.99 -</filesystem>
96.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_2.txt Thu Aug 30 10:56:16 2012 +0200
96.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
96.3 @@ -1,99 +0,0 @@
96.4 -<?xml version="1.0" encoding="UTF-8"?>
96.5 -<!-- This is the old license
96.6 -it is not a very interesting license
96.7 -but it is here -->
96.8 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
96.9 -<filesystem>
96.10 - <folder name="Navigator">
96.11 - <folder name="Panels">
96.12 - <folder name="text">
96.13 - <folder name="html">
96.14 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
96.15 - </folder>
96.16 - <folder name="plain">
96.17 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
96.18 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
96.19 - </file>
96.20 - </folder>
96.21 - </folder>
96.22 - <folder name="content">
96.23 - <folder name="unknown">
96.24 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
96.25 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
96.26 - </file>
96.27 - </folder>
96.28 - </folder>
96.29 - </folder>
96.30 - </folder>
96.31 - <folder name="GenericNavigator">
96.32 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.33 - <folder name="text">
96.34 - <folder name="html">
96.35 -
96.36 - <file name="Headers.patternItem" url="headers_pattern.txt">
96.37 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.38 - <attr name="position" intvalue="100"/>
96.39 - </file>
96.40 -
96.41 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
96.42 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.43 - <attr name="position" intvalue="200"/>
96.44 - </file>
96.45 -
96.46 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
96.47 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.48 - <attr name="position" intvalue="400"/>
96.49 - </file>
96.50 -
96.51 - <file name="Images.patternItem" url="images_pattern.txt">
96.52 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.53 - <attr name="position" intvalue="300"/>
96.54 - </file>
96.55 -
96.56 - </folder>
96.57 - <folder name="plain">
96.58 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
96.59 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.60 - <attr name="position" intvalue="100"/>
96.61 - </file>
96.62 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
96.63 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.64 - <attr name="position" intvalue="200"/>
96.65 - </file>
96.66 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
96.67 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.68 - <attr name="position" intvalue="300"/>
96.69 - </file>
96.70 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
96.71 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.72 - <attr name="position" intvalue="400"/>
96.73 - </file>
96.74 - </folder>
96.75 - </folder>
96.76 - <folder name="content">
96.77 - <folder name="unknown">
96.78 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
96.79 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.80 - <attr name="position" intvalue="100"/>
96.81 - </file>
96.82 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
96.83 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.84 - <attr name="position" intvalue="200"/>
96.85 - </file>
96.86 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
96.87 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.88 - <attr name="position" intvalue="300"/>
96.89 - </file>
96.90 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
96.91 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
96.92 - <attr name="position" intvalue="400"/>
96.93 - </file>
96.94 - </folder>
96.95 - </folder>
96.96 - </folder>
96.97 - <folder name="OptionsDialog">
96.98 - <folder name="Advanced">
96.99 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
96.100 - </folder>
96.101 - </folder>
96.102 -</filesystem>
97.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_3.txt Thu Aug 30 10:56:16 2012 +0200
97.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
97.3 @@ -1,100 +0,0 @@
97.4 -<?xml version="1.0" encoding="UTF-8"?>
97.5 -<!-- This is the old license
97.6 -it is not a very interesting license
97.7 -but it is here
97.8 --->
97.9 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
97.10 -<filesystem>
97.11 - <folder name="Navigator">
97.12 - <folder name="Panels">
97.13 - <folder name="text">
97.14 - <folder name="html">
97.15 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
97.16 - </folder>
97.17 - <folder name="plain">
97.18 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
97.19 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
97.20 - </file>
97.21 - </folder>
97.22 - </folder>
97.23 - <folder name="content">
97.24 - <folder name="unknown">
97.25 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
97.26 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
97.27 - </file>
97.28 - </folder>
97.29 - </folder>
97.30 - </folder>
97.31 - </folder>
97.32 - <folder name="GenericNavigator">
97.33 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.34 - <folder name="text">
97.35 - <folder name="html">
97.36 -
97.37 - <file name="Headers.patternItem" url="headers_pattern.txt">
97.38 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.39 - <attr name="position" intvalue="100"/>
97.40 - </file>
97.41 -
97.42 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
97.43 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.44 - <attr name="position" intvalue="200"/>
97.45 - </file>
97.46 -
97.47 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
97.48 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.49 - <attr name="position" intvalue="400"/>
97.50 - </file>
97.51 -
97.52 - <file name="Images.patternItem" url="images_pattern.txt">
97.53 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.54 - <attr name="position" intvalue="300"/>
97.55 - </file>
97.56 -
97.57 - </folder>
97.58 - <folder name="plain">
97.59 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
97.60 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.61 - <attr name="position" intvalue="100"/>
97.62 - </file>
97.63 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
97.64 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.65 - <attr name="position" intvalue="200"/>
97.66 - </file>
97.67 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
97.68 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.69 - <attr name="position" intvalue="300"/>
97.70 - </file>
97.71 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
97.72 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.73 - <attr name="position" intvalue="400"/>
97.74 - </file>
97.75 - </folder>
97.76 - </folder>
97.77 - <folder name="content">
97.78 - <folder name="unknown">
97.79 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
97.80 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.81 - <attr name="position" intvalue="100"/>
97.82 - </file>
97.83 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
97.84 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.85 - <attr name="position" intvalue="200"/>
97.86 - </file>
97.87 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
97.88 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.89 - <attr name="position" intvalue="300"/>
97.90 - </file>
97.91 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
97.92 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
97.93 - <attr name="position" intvalue="400"/>
97.94 - </file>
97.95 - </folder>
97.96 - </folder>
97.97 - </folder>
97.98 - <folder name="OptionsDialog">
97.99 - <folder name="Advanced">
97.100 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
97.101 - </folder>
97.102 - </folder>
97.103 -</filesystem>
98.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_4.txt Thu Aug 30 10:56:16 2012 +0200
98.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
98.3 @@ -1,100 +0,0 @@
98.4 -<?xml version="1.0" encoding="UTF-8"?>
98.5 -<!-- This is the old license -->
98.6 -<!-- it is not a very interesting license -->
98.7 -<!-- but it is here -->
98.8 -
98.9 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
98.10 -<filesystem>
98.11 - <folder name="Navigator">
98.12 - <folder name="Panels">
98.13 - <folder name="text">
98.14 - <folder name="html">
98.15 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
98.16 - </folder>
98.17 - <folder name="plain">
98.18 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
98.19 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
98.20 - </file>
98.21 - </folder>
98.22 - </folder>
98.23 - <folder name="content">
98.24 - <folder name="unknown">
98.25 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
98.26 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
98.27 - </file>
98.28 - </folder>
98.29 - </folder>
98.30 - </folder>
98.31 - </folder>
98.32 - <folder name="GenericNavigator">
98.33 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.34 - <folder name="text">
98.35 - <folder name="html">
98.36 -
98.37 - <file name="Headers.patternItem" url="headers_pattern.txt">
98.38 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.39 - <attr name="position" intvalue="100"/>
98.40 - </file>
98.41 -
98.42 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
98.43 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.44 - <attr name="position" intvalue="200"/>
98.45 - </file>
98.46 -
98.47 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
98.48 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.49 - <attr name="position" intvalue="400"/>
98.50 - </file>
98.51 -
98.52 - <file name="Images.patternItem" url="images_pattern.txt">
98.53 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.54 - <attr name="position" intvalue="300"/>
98.55 - </file>
98.56 -
98.57 - </folder>
98.58 - <folder name="plain">
98.59 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
98.60 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.61 - <attr name="position" intvalue="100"/>
98.62 - </file>
98.63 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
98.64 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.65 - <attr name="position" intvalue="200"/>
98.66 - </file>
98.67 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
98.68 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.69 - <attr name="position" intvalue="300"/>
98.70 - </file>
98.71 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
98.72 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.73 - <attr name="position" intvalue="400"/>
98.74 - </file>
98.75 - </folder>
98.76 - </folder>
98.77 - <folder name="content">
98.78 - <folder name="unknown">
98.79 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
98.80 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.81 - <attr name="position" intvalue="100"/>
98.82 - </file>
98.83 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
98.84 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.85 - <attr name="position" intvalue="200"/>
98.86 - </file>
98.87 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
98.88 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.89 - <attr name="position" intvalue="300"/>
98.90 - </file>
98.91 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
98.92 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
98.93 - <attr name="position" intvalue="400"/>
98.94 - </file>
98.95 - </folder>
98.96 - </folder>
98.97 - </folder>
98.98 - <folder name="OptionsDialog">
98.99 - <folder name="Advanced">
98.100 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
98.101 - </folder>
98.102 - </folder>
98.103 -</filesystem>
99.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_5.txt Thu Aug 30 10:56:16 2012 +0200
99.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
99.3 @@ -1,102 +0,0 @@
99.4 -<!-- This is the old license -->
99.5 -<!-- it is not a very interesting license -->
99.6 -<!-- but it is here -->
99.7 -<?xml version="1.0" encoding="UTF-8"?>
99.8 -
99.9 -
99.10 -
99.11 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
99.12 -<filesystem>
99.13 - <folder name="Navigator">
99.14 - <folder name="Panels">
99.15 - <folder name="text">
99.16 - <folder name="html">
99.17 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
99.18 - </folder>
99.19 - <folder name="plain">
99.20 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
99.21 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
99.22 - </file>
99.23 - </folder>
99.24 - </folder>
99.25 - <folder name="content">
99.26 - <folder name="unknown">
99.27 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
99.28 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
99.29 - </file>
99.30 - </folder>
99.31 - </folder>
99.32 - </folder>
99.33 - </folder>
99.34 - <folder name="GenericNavigator">
99.35 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.36 - <folder name="text">
99.37 - <folder name="html">
99.38 -
99.39 - <file name="Headers.patternItem" url="headers_pattern.txt">
99.40 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.41 - <attr name="position" intvalue="100"/>
99.42 - </file>
99.43 -
99.44 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
99.45 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.46 - <attr name="position" intvalue="200"/>
99.47 - </file>
99.48 -
99.49 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
99.50 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.51 - <attr name="position" intvalue="400"/>
99.52 - </file>
99.53 -
99.54 - <file name="Images.patternItem" url="images_pattern.txt">
99.55 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.56 - <attr name="position" intvalue="300"/>
99.57 - </file>
99.58 -
99.59 - </folder>
99.60 - <folder name="plain">
99.61 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
99.62 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.63 - <attr name="position" intvalue="100"/>
99.64 - </file>
99.65 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
99.66 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.67 - <attr name="position" intvalue="200"/>
99.68 - </file>
99.69 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
99.70 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.71 - <attr name="position" intvalue="300"/>
99.72 - </file>
99.73 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
99.74 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.75 - <attr name="position" intvalue="400"/>
99.76 - </file>
99.77 - </folder>
99.78 - </folder>
99.79 - <folder name="content">
99.80 - <folder name="unknown">
99.81 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
99.82 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.83 - <attr name="position" intvalue="100"/>
99.84 - </file>
99.85 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
99.86 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.87 - <attr name="position" intvalue="200"/>
99.88 - </file>
99.89 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
99.90 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.91 - <attr name="position" intvalue="300"/>
99.92 - </file>
99.93 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
99.94 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
99.95 - <attr name="position" intvalue="400"/>
99.96 - </file>
99.97 - </folder>
99.98 - </folder>
99.99 - </folder>
99.100 - <folder name="OptionsDialog">
99.101 - <folder name="Advanced">
99.102 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
99.103 - </folder>
99.104 - </folder>
99.105 -</filesystem>
100.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_6.txt Thu Aug 30 10:56:16 2012 +0200
100.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
100.3 @@ -1,96 +0,0 @@
100.4 -
100.5 -<!-- This is the old license --><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
100.6 -<filesystem>
100.7 - <folder name="Navigator">
100.8 - <folder name="Panels">
100.9 - <folder name="text">
100.10 - <folder name="html">
100.11 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
100.12 - </folder>
100.13 - <folder name="plain">
100.14 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
100.15 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
100.16 - </file>
100.17 - </folder>
100.18 - </folder>
100.19 - <folder name="content">
100.20 - <folder name="unknown">
100.21 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
100.22 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
100.23 - </file>
100.24 - </folder>
100.25 - </folder>
100.26 - </folder>
100.27 - </folder>
100.28 - <folder name="GenericNavigator">
100.29 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.30 - <folder name="text">
100.31 - <folder name="html">
100.32 -
100.33 - <file name="Headers.patternItem" url="headers_pattern.txt">
100.34 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.35 - <attr name="position" intvalue="100"/>
100.36 - </file>
100.37 -
100.38 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
100.39 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.40 - <attr name="position" intvalue="200"/>
100.41 - </file>
100.42 -
100.43 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
100.44 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.45 - <attr name="position" intvalue="400"/>
100.46 - </file>
100.47 -
100.48 - <file name="Images.patternItem" url="images_pattern.txt">
100.49 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.50 - <attr name="position" intvalue="300"/>
100.51 - </file>
100.52 -
100.53 - </folder>
100.54 - <folder name="plain">
100.55 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
100.56 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.57 - <attr name="position" intvalue="100"/>
100.58 - </file>
100.59 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
100.60 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.61 - <attr name="position" intvalue="200"/>
100.62 - </file>
100.63 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
100.64 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.65 - <attr name="position" intvalue="300"/>
100.66 - </file>
100.67 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
100.68 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.69 - <attr name="position" intvalue="400"/>
100.70 - </file>
100.71 - </folder>
100.72 - </folder>
100.73 - <folder name="content">
100.74 - <folder name="unknown">
100.75 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
100.76 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.77 - <attr name="position" intvalue="100"/>
100.78 - </file>
100.79 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
100.80 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.81 - <attr name="position" intvalue="200"/>
100.82 - </file>
100.83 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
100.84 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.85 - <attr name="position" intvalue="300"/>
100.86 - </file>
100.87 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
100.88 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
100.89 - <attr name="position" intvalue="400"/>
100.90 - </file>
100.91 - </folder>
100.92 - </folder>
100.93 - </folder>
100.94 - <folder name="OptionsDialog">
100.95 - <folder name="Advanced">
100.96 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
100.97 - </folder>
100.98 - </folder>
100.99 -</filesystem>
101.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_7.txt Thu Aug 30 10:56:16 2012 +0200
101.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
101.3 @@ -1,101 +0,0 @@
101.4 -<?xml version="1.0" encoding="UTF-8"?>
101.5 -
101.6 -<!-- This is the old license -->
101.7 -<!-- it is not a very interesting license -->
101.8 -<!-- but it is here -->
101.9 -
101.10 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
101.11 -<filesystem>
101.12 - <folder name="Navigator">
101.13 - <folder name="Panels">
101.14 - <folder name="text">
101.15 - <folder name="html">
101.16 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
101.17 - </folder>
101.18 - <folder name="plain">
101.19 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
101.20 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
101.21 - </file>
101.22 - </folder>
101.23 - </folder>
101.24 - <folder name="content">
101.25 - <folder name="unknown">
101.26 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
101.27 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
101.28 - </file>
101.29 - </folder>
101.30 - </folder>
101.31 - </folder>
101.32 - </folder>
101.33 - <folder name="GenericNavigator">
101.34 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.35 - <folder name="text">
101.36 - <folder name="html">
101.37 -
101.38 - <file name="Headers.patternItem" url="headers_pattern.txt">
101.39 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.40 - <attr name="position" intvalue="100"/>
101.41 - </file>
101.42 -
101.43 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
101.44 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.45 - <attr name="position" intvalue="200"/>
101.46 - </file>
101.47 -
101.48 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
101.49 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.50 - <attr name="position" intvalue="400"/>
101.51 - </file>
101.52 -
101.53 - <file name="Images.patternItem" url="images_pattern.txt">
101.54 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.55 - <attr name="position" intvalue="300"/>
101.56 - </file>
101.57 -
101.58 - </folder>
101.59 - <folder name="plain">
101.60 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
101.61 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.62 - <attr name="position" intvalue="100"/>
101.63 - </file>
101.64 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
101.65 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.66 - <attr name="position" intvalue="200"/>
101.67 - </file>
101.68 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
101.69 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.70 - <attr name="position" intvalue="300"/>
101.71 - </file>
101.72 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
101.73 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.74 - <attr name="position" intvalue="400"/>
101.75 - </file>
101.76 - </folder>
101.77 - </folder>
101.78 - <folder name="content">
101.79 - <folder name="unknown">
101.80 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
101.81 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.82 - <attr name="position" intvalue="100"/>
101.83 - </file>
101.84 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
101.85 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.86 - <attr name="position" intvalue="200"/>
101.87 - </file>
101.88 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
101.89 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.90 - <attr name="position" intvalue="300"/>
101.91 - </file>
101.92 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
101.93 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
101.94 - <attr name="position" intvalue="400"/>
101.95 - </file>
101.96 - </folder>
101.97 - </folder>
101.98 - </folder>
101.99 - <folder name="OptionsDialog">
101.100 - <folder name="Advanced">
101.101 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
101.102 - </folder>
101.103 - </folder>
101.104 -</filesystem>
102.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_8.txt Thu Aug 30 10:56:16 2012 +0200
102.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
102.3 @@ -1,101 +0,0 @@
102.4 -<?xml version="1.0" encoding="UTF-8"?>
102.5 -
102.6 -<!-- This is the old license -->
102.7 -<!-- it is not a very interesting license -->
102.8 -<!-- but it is here -->
102.9 -
102.10 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
102.11 -<filesystem>
102.12 - <folder name="Navigator">
102.13 - <folder name="Panels">
102.14 - <folder name="text">
102.15 - <folder name="html">
102.16 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
102.17 - </folder>
102.18 - <folder name="plain">
102.19 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
102.20 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
102.21 - </file>
102.22 - </folder>
102.23 - </folder>
102.24 - <folder name="content">
102.25 - <folder name="unknown">
102.26 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
102.27 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
102.28 - </file>
102.29 - </folder>
102.30 - </folder>
102.31 - </folder>
102.32 - </folder>
102.33 - <folder name="GenericNavigator">
102.34 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.35 - <folder name="text">
102.36 - <folder name="html">
102.37 -
102.38 - <file name="Headers.patternItem" url="headers_pattern.txt">
102.39 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.40 - <attr name="position" intvalue="100"/>
102.41 - </file>
102.42 -
102.43 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
102.44 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.45 - <attr name="position" intvalue="200"/>
102.46 - </file>
102.47 -
102.48 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
102.49 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.50 - <attr name="position" intvalue="400"/>
102.51 - </file>
102.52 -
102.53 - <file name="Images.patternItem" url="images_pattern.txt">
102.54 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.55 - <attr name="position" intvalue="300"/>
102.56 - </file>
102.57 -
102.58 - </folder>
102.59 - <folder name="plain">
102.60 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
102.61 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.62 - <attr name="position" intvalue="100"/>
102.63 - </file>
102.64 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
102.65 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.66 - <attr name="position" intvalue="200"/>
102.67 - </file>
102.68 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
102.69 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.70 - <attr name="position" intvalue="300"/>
102.71 - </file>
102.72 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
102.73 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.74 - <attr name="position" intvalue="400"/>
102.75 - </file>
102.76 - </folder>
102.77 - </folder>
102.78 - <folder name="content">
102.79 - <folder name="unknown">
102.80 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
102.81 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.82 - <attr name="position" intvalue="100"/>
102.83 - </file>
102.84 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
102.85 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.86 - <attr name="position" intvalue="200"/>
102.87 - </file>
102.88 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
102.89 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.90 - <attr name="position" intvalue="300"/>
102.91 - </file>
102.92 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
102.93 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
102.94 - <attr name="position" intvalue="400"/>
102.95 - </file>
102.96 - </folder>
102.97 - </folder>
102.98 - </folder>
102.99 - <folder name="OptionsDialog">
102.100 - <folder name="Advanced">
102.101 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
102.102 - </folder>
102.103 - </folder>
102.104 -</filesystem>
103.1 --- a/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/handlers/xml_golden.txt Thu Aug 30 10:56:16 2012 +0200
103.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
103.3 @@ -1,127 +0,0 @@
103.4 -<?xml version="1.0" encoding="UTF-8"?>
103.5 -<!--
103.6 -Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
103.7 -All rights reversed.
103.8 -
103.9 -Redistribution and use in source, binary or corpuscular forms, with or without
103.10 -modification, are prohibited under all circumstances unless the following
103.11 -conditions have been met:
103.12 -
103.13 - 1. You have an eyeball growing in the palm of your left hand
103.14 -
103.15 - 2. Seven dwarfs really like your golden hair
103.16 -
103.17 - 3. The moon has reversed its course a multiple of times divisible by
103.18 - the eighteenth prime number in the last year
103.19 -
103.20 -THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
103.21 -INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
103.22 -DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
103.23 -OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
103.24 -ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
103.25 -SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
103.26 -LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
103.27 -BALL DROP, BECOMING A LAWYER.
103.28 -
103.29 -BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
103.30 -AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
103.31 -AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
103.32 -INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
103.33 -
103.34 -RUN, RUN NOW, AND RUN VERY FAST.
103.35 --->
103.36 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
103.37 -<filesystem>
103.38 - <folder name="Navigator">
103.39 - <folder name="Panels">
103.40 - <folder name="text">
103.41 - <folder name="html">
103.42 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
103.43 - </folder>
103.44 - <folder name="plain">
103.45 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
103.46 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
103.47 - </file>
103.48 - </folder>
103.49 - </folder>
103.50 - <folder name="content">
103.51 - <folder name="unknown">
103.52 - <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
103.53 - <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
103.54 - </file>
103.55 - </folder>
103.56 - </folder>
103.57 - </folder>
103.58 - </folder>
103.59 - <folder name="GenericNavigator">
103.60 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.61 - <folder name="text">
103.62 - <folder name="html">
103.63 -
103.64 - <file name="Headers.patternItem" url="headers_pattern.txt">
103.65 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.66 - <attr name="position" intvalue="100"/>
103.67 - </file>
103.68 -
103.69 - <file name="Hyperlinks.patternItem" url="links_pattern.txt">
103.70 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.71 - <attr name="position" intvalue="200"/>
103.72 - </file>
103.73 -
103.74 - <file name="ListItems.patternItem" url="listitem_pattern.txt">
103.75 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.76 - <attr name="position" intvalue="400"/>
103.77 - </file>
103.78 -
103.79 - <file name="Images.patternItem" url="images_pattern.txt">
103.80 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.81 - <attr name="position" intvalue="300"/>
103.82 - </file>
103.83 -
103.84 - </folder>
103.85 - <folder name="plain">
103.86 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
103.87 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.88 - <attr name="position" intvalue="100"/>
103.89 - </file>
103.90 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
103.91 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.92 - <attr name="position" intvalue="200"/>
103.93 - </file>
103.94 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
103.95 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.96 - <attr name="position" intvalue="300"/>
103.97 - </file>
103.98 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
103.99 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.100 - <attr name="position" intvalue="400"/>
103.101 - </file>
103.102 - </folder>
103.103 - </folder>
103.104 - <folder name="content">
103.105 - <folder name="unknown">
103.106 - <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
103.107 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.108 - <attr name="position" intvalue="100"/>
103.109 - </file>
103.110 - <file name="Sentences.patternItem" url="sentences_pattern.txt">
103.111 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.112 - <attr name="position" intvalue="200"/>
103.113 - </file>
103.114 - <file name="Quotations.patternItem" url="quotations_pattern.txt">
103.115 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.116 - <attr name="position" intvalue="300"/>
103.117 - </file>
103.118 - <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
103.119 - <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
103.120 - <attr name="position" intvalue="400"/>
103.121 - </file>
103.122 - </folder>
103.123 - </folder>
103.124 - </folder>
103.125 - <folder name="OptionsDialog">
103.126 - <folder name="Advanced">
103.127 - <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
103.128 - </folder>
103.129 - </folder>
103.130 -</filesystem>
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
104.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/JavaFileHandlerTest.java Thu Sep 13 09:10:03 2012 +0200
104.3 @@ -0,0 +1,125 @@
104.4 +/*
104.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
104.6 + *
104.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
104.8 + *
104.9 + * The contents of this file are subject to the terms of either the GNU
104.10 + * General Public License Version 2 only ("GPL") or the Common
104.11 + * Development and Distribution License("CDDL") (collectively, the
104.12 + * "License"). You may not use this file except in compliance with the
104.13 + * License. You can obtain a copy of the License at
104.14 + * http://www.netbeans.org/cddl-gplv2.html
104.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
104.16 + * specific language governing permissions and limitations under the
104.17 + * License. When distributing the software, include this License Header
104.18 + * Notice in each file and include the License file at
104.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
104.20 + * particular file as subject to the "Classpath" exception as provided
104.21 + * by Sun in the GPL Version 2 section of the License file that
104.22 + * accompanied this code. If applicable, add the following below the
104.23 + * License Header, with the fields enclosed by brackets [] replaced by
104.24 + * your own identifying information:
104.25 + * "Portions Copyrighted [year] [name of copyright owner]"
104.26 + *
104.27 + * If you wish your version of this file to be governed by only the CDDL
104.28 + * or only the GPL Version 2, indicate your decision by adding
104.29 + * "[Contributor] elects to include this software in this distribution
104.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
104.31 + * single choice of license, a recipient has the option to distribute
104.32 + * your version of this file under either the CDDL, the GPL Version 2 or
104.33 + * to extend the choice of license to its licensees as provided above.
104.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
104.35 + * Version 2 license, then the option applies only if the new code is
104.36 + * made subject to such option by the copyright holder.
104.37 + *
104.38 + * Contributor(s):
104.39 + *
104.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
104.41 + */
104.42 +
104.43 +package org.netbeans.modules.licensechanger.spi.handlers;
104.44 +
104.45 +import java.io.ByteArrayOutputStream;
104.46 +import java.io.InputStream;
104.47 +import static org.junit.Assert.*;
104.48 +import org.junit.Test;
104.49 +import org.netbeans.modules.licensechanger.api.FileHandler;
104.50 +import org.openide.filesystems.FileUtil;
104.51 +import org.openide.util.Utilities;
104.52 +
104.53 +/**
104.54 + *
104.55 + * @author Tim Boudreau
104.56 + */
104.57 +public class JavaFileHandlerTest {
104.58 +
104.59 + @Test
104.60 + public void testStuff() throws Exception {
104.61 + System.out.println("testStuff");
104.62 + String golden = getGolden();
104.63 + String license = getLicense();
104.64 + for (int i=1; i <= 12; i++) {
104.65 + String filename = "java_" + i + ".txt";
104.66 + testOneVersion(golden, license, filename);
104.67 + }
104.68 + }
104.69 +
104.70 + private void testOneVersion(String golden, String license, String filename) throws Exception {
104.71 + System.out.println("Test " + filename);
104.72 + JavaFileHandler instance = new JavaFileHandler();
104.73 + String original = readFile (filename);
104.74 + String processed = instance.transform(original, license);
104.75 + assertEqualsLineByLine (golden, processed, filename);
104.76 + }
104.77 +
104.78 + static void assertEqualsLineByLine (String golden, String processed, String filename) {
104.79 + String[] g = FileHandler.splitIntoLines(golden);
104.80 + String[] p = FileHandler.splitIntoLines(processed);
104.81 + for (int i=0; i < Math.min (g.length, p.length); i++) {
104.82 + assertEquals ("Difference in " + filename + " at line " + i + "\n", g[i], p[i]);
104.83 + }
104.84 + }
104.85 +
104.86 +
104.87 +// static void assertEqualsLineByLine (String golden, String processed, String filename) {
104.88 +// StringTokenizer a = new StringTokenizer (golden, "\n");
104.89 +// StringTokenizer b = new StringTokenizer (processed, "\n");
104.90 +// int ix = 0;
104.91 +// while (a.hasMoreTokens() && b.hasMoreTokens()) {
104.92 +// String as = a.nextToken();
104.93 +// String bs = b.nextToken();
104.94 +// if (!as.equals(bs)) {
104.95 +// System.err.println("PROCESSED OUTPUT ");
104.96 +// }
104.97 +// assertEquals ("Difference in " + filename + " at line " + ix + "\n", as, bs);
104.98 +// ix++;
104.99 +// }
104.100 +//
104.101 +// }
104.102 +
104.103 + private static String getGolden() throws Exception {
104.104 + return readFile ("java_golden.txt");
104.105 + }
104.106 +
104.107 + static String getLicense() throws Exception {
104.108 + return readFile ("fake_license.txt");
104.109 + }
104.110 +
104.111 + static String readFile (String name) throws Exception {
104.112 + InputStream in = JavaFileHandlerTest.class.getResourceAsStream(name);
104.113 + if (in == null) {
104.114 + fail ("No input stream for " + name);
104.115 + }
104.116 + ByteArrayOutputStream out = new ByteArrayOutputStream();
104.117 + try {
104.118 + FileUtil.copy (in, out);
104.119 + } finally {
104.120 + in.close();
104.121 + out.close();
104.122 + }
104.123 + String result = new String (out.toByteArray(), "UTF-8");
104.124 + result = Utilities.replaceString(result, "\r\n", "\n");
104.125 + return result;
104.126 + }
104.127 +
104.128 +}
104.129 \ No newline at end of file
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
105.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/PropertiesFileHandlerTest.java Thu Sep 13 09:10:03 2012 +0200
105.3 @@ -0,0 +1,79 @@
105.4 +/*
105.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
105.6 + *
105.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
105.8 + *
105.9 + * The contents of this file are subject to the terms of either the GNU
105.10 + * General Public License Version 2 only ("GPL") or the Common
105.11 + * Development and Distribution License("CDDL") (collectively, the
105.12 + * "License"). You may not use this file except in compliance with the
105.13 + * License. You can obtain a copy of the License at
105.14 + * http://www.netbeans.org/cddl-gplv2.html
105.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
105.16 + * specific language governing permissions and limitations under the
105.17 + * License. When distributing the software, include this License Header
105.18 + * Notice in each file and include the License file at
105.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
105.20 + * particular file as subject to the "Classpath" exception as provided
105.21 + * by Sun in the GPL Version 2 section of the License file that
105.22 + * accompanied this code. If applicable, add the following below the
105.23 + * License Header, with the fields enclosed by brackets [] replaced by
105.24 + * your own identifying information:
105.25 + * "Portions Copyrighted [year] [name of copyright owner]"
105.26 + *
105.27 + * If you wish your version of this file to be governed by only the CDDL
105.28 + * or only the GPL Version 2, indicate your decision by adding
105.29 + * "[Contributor] elects to include this software in this distribution
105.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
105.31 + * single choice of license, a recipient has the option to distribute
105.32 + * your version of this file under either the CDDL, the GPL Version 2 or
105.33 + * to extend the choice of license to its licensees as provided above.
105.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
105.35 + * Version 2 license, then the option applies only if the new code is
105.36 + * made subject to such option by the copyright holder.
105.37 + *
105.38 + * Contributor(s):
105.39 + *
105.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
105.41 + */
105.42 +
105.43 +package org.netbeans.modules.licensechanger.spi.handlers;
105.44 +
105.45 +import org.netbeans.modules.licensechanger.spi.handlers.PropertiesFileHandler;
105.46 +import org.junit.Test;
105.47 +import static org.junit.Assert.*;
105.48 +
105.49 +/**
105.50 + *
105.51 + * @author Tim Boudreau
105.52 + */
105.53 +public class PropertiesFileHandlerTest {
105.54 +
105.55 + @Test
105.56 + public void testStuff() throws Exception {
105.57 + System.out.println("testStuff");
105.58 + String golden = getGolden();
105.59 + String license = JavaFileHandlerTest.getLicense();
105.60 + for (int i=1; i <= 4; i++) {
105.61 + testOneVersion (golden, license, "props_" + i + ".txt");
105.62 + }
105.63 + assertEquals (0, 0);
105.64 + }
105.65 +
105.66 + private void testOneVersion(String golden, String license, String filename) throws Exception {
105.67 + System.out.println("Test " + filename);
105.68 + PropertiesFileHandler instance = new PropertiesFileHandler();
105.69 + String original = JavaFileHandlerTest.readFile (filename);
105.70 + String processed = instance.transform(original, license);
105.71 +// if (!original.equals(processed)) {
105.72 +// System.out.println("************************************");
105.73 +// System.out.println(processed);
105.74 +// System.out.println("************************************");
105.75 +// }
105.76 + JavaFileHandlerTest.assertEqualsLineByLine (golden, processed, filename);
105.77 + }
105.78 +
105.79 + private static String getGolden() throws Exception {
105.80 + return JavaFileHandlerTest.readFile ("props_golden.txt");
105.81 + }
105.82 +}
105.83 \ No newline at end of file
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
106.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/XmlFileHandlerTest.java Thu Sep 13 09:10:03 2012 +0200
106.3 @@ -0,0 +1,119 @@
106.4 +/*
106.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
106.6 + *
106.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
106.8 + *
106.9 + * The contents of this file are subject to the terms of either the GNU
106.10 + * General Public License Version 2 only ("GPL") or the Common
106.11 + * Development and Distribution License("CDDL") (collectively, the
106.12 + * "License"). You may not use this file except in compliance with the
106.13 + * License. You can obtain a copy of the License at
106.14 + * http://www.netbeans.org/cddl-gplv2.html
106.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
106.16 + * specific language governing permissions and limitations under the
106.17 + * License. When distributing the software, include this License Header
106.18 + * Notice in each file and include the License file at
106.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
106.20 + * particular file as subject to the "Classpath" exception as provided
106.21 + * by Sun in the GPL Version 2 section of the License file that
106.22 + * accompanied this code. If applicable, add the following below the
106.23 + * License Header, with the fields enclosed by brackets [] replaced by
106.24 + * your own identifying information:
106.25 + * "Portions Copyrighted [year] [name of copyright owner]"
106.26 + *
106.27 + * If you wish your version of this file to be governed by only the CDDL
106.28 + * or only the GPL Version 2, indicate your decision by adding
106.29 + * "[Contributor] elects to include this software in this distribution
106.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
106.31 + * single choice of license, a recipient has the option to distribute
106.32 + * your version of this file under either the CDDL, the GPL Version 2 or
106.33 + * to extend the choice of license to its licensees as provided above.
106.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
106.35 + * Version 2 license, then the option applies only if the new code is
106.36 + * made subject to such option by the copyright holder.
106.37 + *
106.38 + * Contributor(s):
106.39 + *
106.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
106.41 + */
106.42 +
106.43 +package org.netbeans.modules.licensechanger.spi.handlers;
106.44 +
106.45 +import org.netbeans.modules.licensechanger.spi.handlers.XmlFileHandler;
106.46 +import java.util.StringTokenizer;
106.47 +import java.util.regex.Matcher;
106.48 +import org.junit.Test;
106.49 +import org.netbeans.modules.licensechanger.api.FileHandler;
106.50 +import static org.junit.Assert.*;
106.51 +
106.52 +/**
106.53 + *
106.54 + * @author Tim Boudreau
106.55 + */
106.56 +public class XmlFileHandlerTest {
106.57 + @Test
106.58 + public void testDeclarationFinder() throws Exception {
106.59 + String xml = getGolden();
106.60 + assertDeclarationFound (xml, "xml_golden.txt");
106.61 + for (int i=1; i <= 8; i++) {
106.62 + String filename = "xml_" + i + ".txt";
106.63 + String content = JavaFileHandlerTest.readFile(filename);
106.64 + assertDeclarationFound(content, filename);
106.65 + }
106.66 + }
106.67 +
106.68 + private void assertDeclarationFound (String content, String filename) {
106.69 + String[] lines = FileHandler.splitIntoLines(content);
106.70 + boolean found = false;
106.71 + for (int i = 0; i < lines.length; i++) {
106.72 + String line = lines[i];
106.73 + Matcher m = XmlFileHandler.xmlDeclaration.matcher(line);
106.74 + found = m.find();
106.75 + if (found) {
106.76 + System.err.println("Found declaration in line " + line + " of " + filename + "\n"
106.77 + + m.group(1));
106.78 + break;
106.79 + }
106.80 + }
106.81 + assertTrue ("Did not find xml declaration in " + filename, found);
106.82 + }
106.83 +
106.84 + @Test
106.85 + public void testStuff() throws Exception {
106.86 + System.out.println("testStuff");
106.87 + String golden = getGolden();
106.88 + String license = JavaFileHandlerTest.getLicense();
106.89 + for (int i=1; i <= 8; i++) {
106.90 + String filename = "xml_" + i + ".txt";
106.91 + testOneVersion(golden, license, filename);
106.92 + }
106.93 + }
106.94 +
106.95 + private void testOneVersion(String golden, String license, String filename) throws Exception {
106.96 + System.out.println("Test " + filename);
106.97 + XmlFileHandler instance = new XmlFileHandler();
106.98 + String original = JavaFileHandlerTest.readFile (filename);
106.99 + String processed = instance.transform(original, license);
106.100 + assertEqualsLineByLine (golden, processed, filename);
106.101 + }
106.102 +
106.103 + static void assertEqualsLineByLine (String golden, String processed, String filename) {
106.104 + StringTokenizer a = new StringTokenizer (golden, "\n");
106.105 + StringTokenizer b = new StringTokenizer (processed, "\n");
106.106 + int ix = 0;
106.107 + while (a.hasMoreTokens() && b.hasMoreTokens()) {
106.108 + String as = a.nextToken();
106.109 + String bs = b.nextToken();
106.110 + if (!as.equals(bs)) {
106.111 + System.err.println("PROCESSED OUTPUT ");
106.112 + }
106.113 + assertEquals ("Difference in " + filename + " at line " + ix + "\n", as, bs);
106.114 + ix++;
106.115 + }
106.116 +
106.117 + }
106.118 +
106.119 + private static String getGolden() throws Exception {
106.120 + return JavaFileHandlerTest.readFile ("xml_golden.txt");
106.121 + }
106.122 +}
106.123 \ No newline at end of file
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
107.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/fake_license.txt Thu Sep 13 09:10:03 2012 +0200
107.3 @@ -0,0 +1,29 @@
107.4 +Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
107.5 +All rights reversed.
107.6 +
107.7 +Redistribution and use in source, binary or corpuscular forms, with or without
107.8 +modification, are prohibited under all circumstances unless the following
107.9 +conditions have been met:
107.10 +
107.11 + 1. You have an eyeball growing in the palm of your left hand
107.12 +
107.13 + 2. Seven dwarfs really like your golden hair
107.14 +
107.15 + 3. The moon has reversed its course a multiple of times divisible by
107.16 + the eighteenth prime number in the last year
107.17 +
107.18 +THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
107.19 +INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
107.20 +DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
107.21 +OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
107.22 +ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
107.23 +SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
107.24 +LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
107.25 +BALL DROP, BECOMING A LAWYER.
107.26 +
107.27 +BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
107.28 +AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
107.29 +AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
107.30 +INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
107.31 +
107.32 +RUN, RUN NOW, AND RUN VERY FAST.
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
108.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_1.txt Thu Sep 13 09:10:03 2012 +0200
108.3 @@ -0,0 +1,139 @@
108.4 +/*
108.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
108.6 + *
108.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
108.8 + *
108.9 + * The contents of this file are subject to the terms of either the GNU
108.10 + * General Public License Version 2 only ("GPL") or the Common
108.11 + * Development and Distribution License("CDDL") (collectively, the
108.12 + * "License"). You may not use this file except in compliance with the
108.13 + * License. You can obtain a copy of the License at
108.14 + * http://www.netbeans.org/cddl-gplv2.html
108.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
108.16 + * specific language governing permissions and limitations under the
108.17 + * License. When distributing the software, include this License Header
108.18 + * Notice in each file and include the License file at
108.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
108.20 + * particular file as subject to the "Classpath" exception as provided
108.21 + * by Sun in the GPL Version 2 section of the License file that
108.22 + * accompanied this code. If applicable, add the following below the
108.23 + * License Header, with the fields enclosed by brackets [] replaced by
108.24 + * your own identifying information:
108.25 + * "Portions Copyrighted [year] [name of copyright owner]"
108.26 + *
108.27 + * If you wish your version of this file to be governed by only the CDDL
108.28 + * or only the GPL Version 2, indicate your decision by adding
108.29 + * "[Contributor] elects to include this software in this distribution
108.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
108.31 + * single choice of license, a recipient has the option to distribute
108.32 + * your version of this file under either the CDDL, the GPL Version 2 or
108.33 + * to extend the choice of license to its licensees as provided above.
108.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
108.35 + * Version 2 license, then the option applies only if the new code is
108.36 + * made subject to such option by the copyright holder.
108.37 + *
108.38 + * Contributor(s):
108.39 + *
108.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
108.41 + */
108.42 +
108.43 +package org.netbeans.modules.licensechanger;
108.44 +
108.45 +import java.util.Collection;
108.46 +import java.util.HashSet;
108.47 +import java.util.LinkedList;
108.48 +import java.util.List;
108.49 +import java.util.Set;
108.50 +import javax.swing.Action;
108.51 +import org.netbeans.modules.licensechanger.api.FileHandler;
108.52 +import org.openide.filesystems.FileObject;
108.53 +import org.openide.loaders.DataObject;
108.54 +import org.openide.loaders.DataObjectNotFoundException;
108.55 +import org.openide.nodes.ChildFactory;
108.56 +import org.openide.nodes.FilterNode;
108.57 +import org.openide.nodes.Node;
108.58 +import org.openide.util.Exceptions;
108.59 +import org.openide.util.Lookup;
108.60 +import org.openide.util.lookup.Lookups;
108.61 +import org.openide.util.lookup.ProxyLookup;
108.62 +
108.63 +/**
108.64 + *
108.65 + * @author Tim Boudreau
108.66 + */
108.67 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
108.68 + private final Set<FileObject> folders;
108.69 + private final Collection <? extends FileHandler> allHandlers;
108.70 + FileChildren (Set<FileObject> folders) {
108.71 + this.folders = new HashSet(folders);
108.72 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
108.73 + }
108.74 +
108.75 + @Override
108.76 + protected boolean createKeys(List<FileObject> toPopulate) {
108.77 + toPopulate.addAll (folders);
108.78 + return true;
108.79 + }
108.80 +
108.81 + @Override
108.82 + protected Node[] createNodesForKey(FileObject key) {
108.83 + List<Node> result = new LinkedList<Node>();
108.84 +outer: for (FileObject fo : key.getChildren()) {
108.85 + if (fo.isData()) {
108.86 + for (FileHandler h : allHandlers) {
108.87 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
108.88 + try {
108.89 + DataObject dob = DataObject.find(fo);
108.90 + FileItem item = new FileItem (h, fo);
108.91 + result.add (new FN (dob.getNodeDelegate(), item));
108.92 + break outer;
108.93 + } catch (DataObjectNotFoundException ex) {
108.94 + Exceptions.printStackTrace(ex);
108.95 + }
108.96 + }
108.97 + }
108.98 + }
108.99 + }
108.100 + return result.toArray(new Node[result.size()]);
108.101 + }
108.102 +
108.103 + static final class FileItem {
108.104 + FileHandler handler;
108.105 + FileObject file;
108.106 +
108.107 + public FileItem(FileHandler handler, FileObject file) {
108.108 + this.handler = handler;
108.109 + this.file = file;
108.110 + }
108.111 +
108.112 + public FileObject getFile() {
108.113 + return file;
108.114 + }
108.115 +
108.116 + public FileHandler getHandler() {
108.117 + return handler;
108.118 + }
108.119 +
108.120 + }
108.121 +
108.122 + private static final class FN extends FilterNode {
108.123 + FN(Node orig, FileItem item) {
108.124 + super (orig, Children.LEAF, new ProxyLookup(
108.125 + Lookups.singleton(item),
108.126 + orig.getLookup()));
108.127 + disableDelegation(DELEGATE_GET_ACTIONS);
108.128 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
108.129 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
108.130 + disableDelegation(DELEGATE_GET_VALUE);
108.131 + disableDelegation(DELEGATE_SET_VALUE);
108.132 + disableDelegation(DELEGATE_SET_NAME);
108.133 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
108.134 + setDisplayName (item.file.getPath());
108.135 + }
108.136 +
108.137 + @Override
108.138 + public Action[] getActions(boolean ignored) {
108.139 + return new Action[0];
108.140 + }
108.141 + }
108.142 +}
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
109.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_10.txt Thu Sep 13 09:10:03 2012 +0200
109.3 @@ -0,0 +1,145 @@
109.4 +/*
109.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
109.6 + *
109.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
109.8 + *
109.9 + * The contents of this file are subject to the terms of either the GNU
109.10 + * General Public License Version 2 only ("GPL") or the Common
109.11 + * Development and Distribution License("CDDL") (collectively, the
109.12 + * "License"). You may not use this file except in compliance with the
109.13 + * License. You can obtain a copy of the License at
109.14 + * http://www.netbeans.org/cddl-gplv2.html
109.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
109.16 + * specific language governing permissions and limitations under the
109.17 + * License. When distributing the software, include this License Header
109.18 + * Notice in each file and include the License file at
109.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
109.20 + * particular file as subject to the "Classpath" exception as provided
109.21 + * by Sun in the GPL Version 2 section of the License file that
109.22 + * accompanied this code. If applicable, add the following below the
109.23 + * License Header, with the fields enclosed by brackets [] replaced by
109.24 + * your own identifying information:
109.25 + * "Portions Copyrighted [year] [name of copyright owner]"
109.26 + *
109.27 + * If you wish your version of this file to be governed by only the CDDL
109.28 + * or only the GPL Version 2, indicate your decision by adding
109.29 + * "[Contributor] elects to include this software in this distribution
109.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
109.31 + * single choice of license, a recipient has the option to distribute
109.32 + * your version of this file under either the CDDL, the GPL Version 2 or
109.33 + * to extend the choice of license to its licensees as provided above.
109.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
109.35 + * Version 2 license, then the option applies only if the new code is
109.36 + * made subject to such option by the copyright holder.
109.37 + *
109.38 + * Contributor(s):
109.39 + *
109.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
109.41 + */
109.42 +/* Created on March 14, 2009
109.43 + * by some IDE or other
109.44 + */
109.45 +
109.46 +//blah blah blah
109.47 +//blah blah blah
109.48 +
109.49 +package org.netbeans.modules.licensechanger;
109.50 +
109.51 +import java.util.Collection;
109.52 +import java.util.HashSet;
109.53 +import java.util.LinkedList;
109.54 +import java.util.List;
109.55 +import java.util.Set;
109.56 +import javax.swing.Action;
109.57 +import org.netbeans.modules.licensechanger.api.FileHandler;
109.58 +import org.openide.filesystems.FileObject;
109.59 +import org.openide.loaders.DataObject;
109.60 +import org.openide.loaders.DataObjectNotFoundException;
109.61 +import org.openide.nodes.ChildFactory;
109.62 +import org.openide.nodes.FilterNode;
109.63 +import org.openide.nodes.Node;
109.64 +import org.openide.util.Exceptions;
109.65 +import org.openide.util.Lookup;
109.66 +import org.openide.util.lookup.Lookups;
109.67 +import org.openide.util.lookup.ProxyLookup;
109.68 +
109.69 +/**
109.70 + *
109.71 + * @author Tim Boudreau
109.72 + */
109.73 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
109.74 + private final Set<FileObject> folders;
109.75 + private final Collection <? extends FileHandler> allHandlers;
109.76 + FileChildren (Set<FileObject> folders) {
109.77 + this.folders = new HashSet(folders);
109.78 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
109.79 + }
109.80 +
109.81 + @Override
109.82 + protected boolean createKeys(List<FileObject> toPopulate) {
109.83 + toPopulate.addAll (folders);
109.84 + return true;
109.85 + }
109.86 +
109.87 + @Override
109.88 + protected Node[] createNodesForKey(FileObject key) {
109.89 + List<Node> result = new LinkedList<Node>();
109.90 +outer: for (FileObject fo : key.getChildren()) {
109.91 + if (fo.isData()) {
109.92 + for (FileHandler h : allHandlers) {
109.93 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
109.94 + try {
109.95 + DataObject dob = DataObject.find(fo);
109.96 + FileItem item = new FileItem (h, fo);
109.97 + result.add (new FN (dob.getNodeDelegate(), item));
109.98 + break outer;
109.99 + } catch (DataObjectNotFoundException ex) {
109.100 + Exceptions.printStackTrace(ex);
109.101 + }
109.102 + }
109.103 + }
109.104 + }
109.105 + }
109.106 + return result.toArray(new Node[result.size()]);
109.107 + }
109.108 +
109.109 + static final class FileItem {
109.110 + FileHandler handler;
109.111 + FileObject file;
109.112 +
109.113 + public FileItem(FileHandler handler, FileObject file) {
109.114 + this.handler = handler;
109.115 + this.file = file;
109.116 + }
109.117 +
109.118 + public FileObject getFile() {
109.119 + return file;
109.120 + }
109.121 +
109.122 + public FileHandler getHandler() {
109.123 + return handler;
109.124 + }
109.125 +
109.126 + }
109.127 +
109.128 + private static final class FN extends FilterNode {
109.129 + FN(Node orig, FileItem item) {
109.130 + super (orig, Children.LEAF, new ProxyLookup(
109.131 + Lookups.singleton(item),
109.132 + orig.getLookup()));
109.133 + disableDelegation(DELEGATE_GET_ACTIONS);
109.134 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
109.135 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
109.136 + disableDelegation(DELEGATE_GET_VALUE);
109.137 + disableDelegation(DELEGATE_SET_VALUE);
109.138 + disableDelegation(DELEGATE_SET_NAME);
109.139 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
109.140 + setDisplayName (item.file.getPath());
109.141 + }
109.142 +
109.143 + @Override
109.144 + public Action[] getActions(boolean ignored) {
109.145 + return new Action[0];
109.146 + }
109.147 + }
109.148 +}
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
110.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_11.txt Thu Sep 13 09:10:03 2012 +0200
110.3 @@ -0,0 +1,149 @@
110.4 +/*
110.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
110.6 + *
110.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
110.8 + *
110.9 + * The contents of this file are subject to the terms of either the GNU
110.10 + * General Public License Version 2 only ("GPL") or the Common
110.11 + * Development and Distribution License("CDDL") (collectively, the
110.12 + * "License"). You may not use this file except in compliance with the
110.13 + * License. You can obtain a copy of the License at
110.14 + * http://www.netbeans.org/cddl-gplv2.html
110.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
110.16 + * specific language governing permissions and limitations under the */
110.17 +
110.18 +//BLAH BLAH BLAH
110.19 +//BLAH BLAH BLAH
110.20 +
110.21 + /* License. When distributing the software, include this License Header
110.22 + * Notice in each file and include the License file at
110.23 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
110.24 + * particular file as subject to the "Classpath" exception as provided
110.25 + * by Sun in the GPL Version 2 section of the License file that
110.26 + * accompanied this code. If applicable, add the following below the
110.27 + * License Header, with the fields enclosed by brackets [] replaced by
110.28 + * your own identifying information:
110.29 + * "Portions Copyrighted [year] [name of copyright owner]"
110.30 + *
110.31 + * If you wish your version of this file to be governed by only the CDDL
110.32 + * or only the GPL Version 2, indicate your decision by adding
110.33 + * "[Contributor] elects to include this software in this distribution
110.34 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
110.35 + * single choice of license, a recipient has the option to distribute
110.36 + * your version of this file under either the CDDL, the GPL Version 2 or
110.37 + * to extend the choice of license to its licensees as provided above.
110.38 + * However, if you add GPL Version 2 code and therefore, elected the GPL
110.39 + * Version 2 license, then the option applies only if the new code is
110.40 + * made subject to such option by the copyright holder.
110.41 + *
110.42 + * Contributor(s):
110.43 + *
110.44 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
110.45 + */
110.46 +/* Created on March 14, 2009
110.47 + * by some IDE or other
110.48 + */
110.49 +
110.50 +//blah blah blah
110.51 +//blah blah blah
110.52 +
110.53 +package org.netbeans.modules.licensechanger;
110.54 +
110.55 +import java.util.Collection;
110.56 +import java.util.HashSet;
110.57 +import java.util.LinkedList;
110.58 +import java.util.List;
110.59 +import java.util.Set;
110.60 +import javax.swing.Action;
110.61 +import org.netbeans.modules.licensechanger.api.FileHandler;
110.62 +import org.openide.filesystems.FileObject;
110.63 +import org.openide.loaders.DataObject;
110.64 +import org.openide.loaders.DataObjectNotFoundException;
110.65 +import org.openide.nodes.ChildFactory;
110.66 +import org.openide.nodes.FilterNode;
110.67 +import org.openide.nodes.Node;
110.68 +import org.openide.util.Exceptions;
110.69 +import org.openide.util.Lookup;
110.70 +import org.openide.util.lookup.Lookups;
110.71 +import org.openide.util.lookup.ProxyLookup;
110.72 +
110.73 +/**
110.74 + *
110.75 + * @author Tim Boudreau
110.76 + */
110.77 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
110.78 + private final Set<FileObject> folders;
110.79 + private final Collection <? extends FileHandler> allHandlers;
110.80 + FileChildren (Set<FileObject> folders) {
110.81 + this.folders = new HashSet(folders);
110.82 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
110.83 + }
110.84 +
110.85 + @Override
110.86 + protected boolean createKeys(List<FileObject> toPopulate) {
110.87 + toPopulate.addAll (folders);
110.88 + return true;
110.89 + }
110.90 +
110.91 + @Override
110.92 + protected Node[] createNodesForKey(FileObject key) {
110.93 + List<Node> result = new LinkedList<Node>();
110.94 +outer: for (FileObject fo : key.getChildren()) {
110.95 + if (fo.isData()) {
110.96 + for (FileHandler h : allHandlers) {
110.97 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
110.98 + try {
110.99 + DataObject dob = DataObject.find(fo);
110.100 + FileItem item = new FileItem (h, fo);
110.101 + result.add (new FN (dob.getNodeDelegate(), item));
110.102 + break outer;
110.103 + } catch (DataObjectNotFoundException ex) {
110.104 + Exceptions.printStackTrace(ex);
110.105 + }
110.106 + }
110.107 + }
110.108 + }
110.109 + }
110.110 + return result.toArray(new Node[result.size()]);
110.111 + }
110.112 +
110.113 + static final class FileItem {
110.114 + FileHandler handler;
110.115 + FileObject file;
110.116 +
110.117 + public FileItem(FileHandler handler, FileObject file) {
110.118 + this.handler = handler;
110.119 + this.file = file;
110.120 + }
110.121 +
110.122 + public FileObject getFile() {
110.123 + return file;
110.124 + }
110.125 +
110.126 + public FileHandler getHandler() {
110.127 + return handler;
110.128 + }
110.129 +
110.130 + }
110.131 +
110.132 + private static final class FN extends FilterNode {
110.133 + FN(Node orig, FileItem item) {
110.134 + super (orig, Children.LEAF, new ProxyLookup(
110.135 + Lookups.singleton(item),
110.136 + orig.getLookup()));
110.137 + disableDelegation(DELEGATE_GET_ACTIONS);
110.138 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
110.139 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
110.140 + disableDelegation(DELEGATE_GET_VALUE);
110.141 + disableDelegation(DELEGATE_SET_VALUE);
110.142 + disableDelegation(DELEGATE_SET_NAME);
110.143 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
110.144 + setDisplayName (item.file.getPath());
110.145 + }
110.146 +
110.147 + @Override
110.148 + public Action[] getActions(boolean ignored) {
110.149 + return new Action[0];
110.150 + }
110.151 + }
110.152 +}
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
111.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_12.txt Thu Sep 13 09:10:03 2012 +0200
111.3 @@ -0,0 +1,148 @@
111.4 +/*
111.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
111.6 + *
111.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
111.8 + *
111.9 + * The contents of this file are subject to the terms of either the GNU
111.10 + * General Public License Version 2 only ("GPL") or the Common
111.11 + * Development and Distribution License("CDDL") (collectively, the
111.12 + * "License"). You may not use this file except in compliance with the
111.13 + * License. You can obtain a copy of the License at
111.14 + * http://www.netbeans.org/cddl-gplv2.html
111.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
111.16 + * specific language governing permissions and limitations under the
111.17 +*/
111.18 +//BLAH BLAH BLAH
111.19 +//BLAH BLAH BLAH
111.20 + /* License. When distributing the software, include this License Header
111.21 + * Notice in each file and include the License file at
111.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
111.23 + * particular file as subject to the "Classpath" exception as provided
111.24 + * by Sun in the GPL Version 2 section of the License file that
111.25 + * accompanied this code. If applicable, add the following below the
111.26 + * License Header, with the fields enclosed by brackets [] replaced by
111.27 + * your own identifying information:
111.28 + * "Portions Copyrighted [year] [name of copyright owner]"
111.29 + *
111.30 + * If you wish your version of this file to be governed by only the CDDL
111.31 + * or only the GPL Version 2, indicate your decision by adding
111.32 + * "[Contributor] elects to include this software in this distribution
111.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
111.34 + * single choice of license, a recipient has the option to distribute
111.35 + * your version of this file under either the CDDL, the GPL Version 2 or
111.36 + * to extend the choice of license to its licensees as provided above.
111.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
111.38 + * Version 2 license, then the option applies only if the new code is
111.39 + * made subject to such option by the copyright holder.
111.40 + *
111.41 + * Contributor(s):
111.42 + *
111.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
111.44 + */
111.45 +/* Created on March 14, 2009
111.46 + * by some IDE or other
111.47 + */
111.48 +
111.49 +//blah blah blah
111.50 +//blah blah blah
111.51 +
111.52 +package org.netbeans.modules.licensechanger;
111.53 +
111.54 +import java.util.Collection;
111.55 +import java.util.HashSet;
111.56 +import java.util.LinkedList;
111.57 +import java.util.List;
111.58 +import java.util.Set;
111.59 +import javax.swing.Action;
111.60 +import org.netbeans.modules.licensechanger.api.FileHandler;
111.61 +import org.openide.filesystems.FileObject;
111.62 +import org.openide.loaders.DataObject;
111.63 +import org.openide.loaders.DataObjectNotFoundException;
111.64 +import org.openide.nodes.ChildFactory;
111.65 +import org.openide.nodes.FilterNode;
111.66 +import org.openide.nodes.Node;
111.67 +import org.openide.util.Exceptions;
111.68 +import org.openide.util.Lookup;
111.69 +import org.openide.util.lookup.Lookups;
111.70 +import org.openide.util.lookup.ProxyLookup;
111.71 +
111.72 +/**
111.73 + *
111.74 + * @author Tim Boudreau
111.75 + */
111.76 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
111.77 + private final Set<FileObject> folders;
111.78 + private final Collection <? extends FileHandler> allHandlers;
111.79 + FileChildren (Set<FileObject> folders) {
111.80 + this.folders = new HashSet(folders);
111.81 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
111.82 + }
111.83 +
111.84 + @Override
111.85 + protected boolean createKeys(List<FileObject> toPopulate) {
111.86 + toPopulate.addAll (folders);
111.87 + return true;
111.88 + }
111.89 +
111.90 + @Override
111.91 + protected Node[] createNodesForKey(FileObject key) {
111.92 + List<Node> result = new LinkedList<Node>();
111.93 +outer: for (FileObject fo : key.getChildren()) {
111.94 + if (fo.isData()) {
111.95 + for (FileHandler h : allHandlers) {
111.96 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
111.97 + try {
111.98 + DataObject dob = DataObject.find(fo);
111.99 + FileItem item = new FileItem (h, fo);
111.100 + result.add (new FN (dob.getNodeDelegate(), item));
111.101 + break outer;
111.102 + } catch (DataObjectNotFoundException ex) {
111.103 + Exceptions.printStackTrace(ex);
111.104 + }
111.105 + }
111.106 + }
111.107 + }
111.108 + }
111.109 + return result.toArray(new Node[result.size()]);
111.110 + }
111.111 +
111.112 + static final class FileItem {
111.113 + FileHandler handler;
111.114 + FileObject file;
111.115 +
111.116 + public FileItem(FileHandler handler, FileObject file) {
111.117 + this.handler = handler;
111.118 + this.file = file;
111.119 + }
111.120 +
111.121 + public FileObject getFile() {
111.122 + return file;
111.123 + }
111.124 +
111.125 + public FileHandler getHandler() {
111.126 + return handler;
111.127 + }
111.128 +
111.129 + }
111.130 +
111.131 + private static final class FN extends FilterNode {
111.132 + FN(Node orig, FileItem item) {
111.133 + super (orig, Children.LEAF, new ProxyLookup(
111.134 + Lookups.singleton(item),
111.135 + orig.getLookup()));
111.136 + disableDelegation(DELEGATE_GET_ACTIONS);
111.137 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
111.138 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
111.139 + disableDelegation(DELEGATE_GET_VALUE);
111.140 + disableDelegation(DELEGATE_SET_VALUE);
111.141 + disableDelegation(DELEGATE_SET_NAME);
111.142 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
111.143 + setDisplayName (item.file.getPath());
111.144 + }
111.145 +
111.146 + @Override
111.147 + public Action[] getActions(boolean ignored) {
111.148 + return new Action[0];
111.149 + }
111.150 + }
111.151 +}
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
112.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_2.txt Thu Sep 13 09:10:03 2012 +0200
112.3 @@ -0,0 +1,139 @@
112.4 +
112.5 +
112.6 +/*
112.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
112.8 + *
112.9 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
112.10 + *
112.11 + * The contents of this file are subject to the terms of either the GNU
112.12 + * General Public License Version 2 only ("GPL") or the Common
112.13 + * Development and Distribution License("CDDL") (collectively, the
112.14 + * "License"). You may not use this file except in compliance with the
112.15 + * License. You can obtain a copy of the License at
112.16 + * http://www.netbeans.org/cddl-gplv2.html
112.17 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
112.18 + * specific language governing permissions and limitations under the
112.19 + * License. When distributing the software, include this License Header
112.20 + * Notice in each file and include the License file at
112.21 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
112.22 + * particular file as subject to the "Classpath" exception as provided
112.23 + * by Sun in the GPL Version 2 section of the License file that
112.24 + * accompanied this code. If applicable, add the following below the
112.25 + * License Header, with the fields enclosed by brackets [] replaced by
112.26 + * your own identifying information:
112.27 + * "Portions Copyrighted [year] [name of copyright owner]"
112.28 + *
112.29 + * If you wish your version of this file to be governed by only the CDDL
112.30 + * or only the GPL Version 2, indicate your decision by adding
112.31 + * "[Contributor] elects to include this software in this distribution
112.32 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
112.33 + * single choice of license, a recipient has the option to distribute
112.34 + * your version of this file under either the CDDL, the GPL Version 2 or
112.35 + * to extend the choice of license to its licensees as provided above.
112.36 + * However, if you add GPL Version 2 code and therefore, elected the GPL
112.37 + * Version 2 license, then the option applies only if the new code is
112.38 + * made subject to such option by the copyright holder.
112.39 + *
112.40 + * Contributor(s):
112.41 + *
112.42 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
112.43 + */package org.netbeans.modules.licensechanger;
112.44 +
112.45 +import java.util.Collection;
112.46 +import java.util.HashSet;
112.47 +import java.util.LinkedList;
112.48 +import java.util.List;
112.49 +import java.util.Set;
112.50 +import javax.swing.Action;
112.51 +import org.netbeans.modules.licensechanger.api.FileHandler;
112.52 +import org.openide.filesystems.FileObject;
112.53 +import org.openide.loaders.DataObject;
112.54 +import org.openide.loaders.DataObjectNotFoundException;
112.55 +import org.openide.nodes.ChildFactory;
112.56 +import org.openide.nodes.FilterNode;
112.57 +import org.openide.nodes.Node;
112.58 +import org.openide.util.Exceptions;
112.59 +import org.openide.util.Lookup;
112.60 +import org.openide.util.lookup.Lookups;
112.61 +import org.openide.util.lookup.ProxyLookup;
112.62 +
112.63 +/**
112.64 + *
112.65 + * @author Tim Boudreau
112.66 + */
112.67 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
112.68 + private final Set<FileObject> folders;
112.69 + private final Collection <? extends FileHandler> allHandlers;
112.70 + FileChildren (Set<FileObject> folders) {
112.71 + this.folders = new HashSet(folders);
112.72 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
112.73 + }
112.74 +
112.75 + @Override
112.76 + protected boolean createKeys(List<FileObject> toPopulate) {
112.77 + toPopulate.addAll (folders);
112.78 + return true;
112.79 + }
112.80 +
112.81 + @Override
112.82 + protected Node[] createNodesForKey(FileObject key) {
112.83 + List<Node> result = new LinkedList<Node>();
112.84 +outer: for (FileObject fo : key.getChildren()) {
112.85 + if (fo.isData()) {
112.86 + for (FileHandler h : allHandlers) {
112.87 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
112.88 + try {
112.89 + DataObject dob = DataObject.find(fo);
112.90 + FileItem item = new FileItem (h, fo);
112.91 + result.add (new FN (dob.getNodeDelegate(), item));
112.92 + break outer;
112.93 + } catch (DataObjectNotFoundException ex) {
112.94 + Exceptions.printStackTrace(ex);
112.95 + }
112.96 + }
112.97 + }
112.98 + }
112.99 + }
112.100 + return result.toArray(new Node[result.size()]);
112.101 + }
112.102 +
112.103 + static final class FileItem {
112.104 + FileHandler handler;
112.105 + FileObject file;
112.106 +
112.107 + public FileItem(FileHandler handler, FileObject file) {
112.108 + this.handler = handler;
112.109 + this.file = file;
112.110 + }
112.111 +
112.112 + public FileObject getFile() {
112.113 + return file;
112.114 + }
112.115 +
112.116 + public FileHandler getHandler() {
112.117 + return handler;
112.118 + }
112.119 +
112.120 + }
112.121 +
112.122 + private static final class FN extends FilterNode {
112.123 + FN(Node orig, FileItem item) {
112.124 + super (orig, Children.LEAF, new ProxyLookup(
112.125 + Lookups.singleton(item),
112.126 + orig.getLookup()));
112.127 + disableDelegation(DELEGATE_GET_ACTIONS);
112.128 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
112.129 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
112.130 + disableDelegation(DELEGATE_GET_VALUE);
112.131 + disableDelegation(DELEGATE_SET_VALUE);
112.132 + disableDelegation(DELEGATE_SET_NAME);
112.133 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
112.134 + setDisplayName (item.file.getPath());
112.135 + }
112.136 +
112.137 + @Override
112.138 + public Action[] getActions(boolean ignored) {
112.139 + return new Action[0];
112.140 + }
112.141 + }
112.142 +}
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
113.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_3.txt Thu Sep 13 09:10:03 2012 +0200
113.3 @@ -0,0 +1,137 @@
113.4 +/*
113.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
113.6 + *
113.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
113.8 + *
113.9 + * The contents of this file are subject to the terms of either the GNU
113.10 + * General Public License Version 2 only ("GPL") or the Common
113.11 + * Development and Distribution License("CDDL") (collectively, the
113.12 + * "License"). You may not use this file except in compliance with the
113.13 + * License. You can obtain a copy of the License at
113.14 + * http://www.netbeans.org/cddl-gplv2.html
113.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
113.16 + * specific language governing permissions and limitations under the
113.17 + * License. When distributing the software, include this License Header
113.18 + * Notice in each file and include the License file at
113.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
113.20 + * particular file as subject to the "Classpath" exception as provided
113.21 + * by Sun in the GPL Version 2 section of the License file that
113.22 + * accompanied this code. If applicable, add the following below the
113.23 + * License Header, with the fields enclosed by brackets [] replaced by
113.24 + * your own identifying information:
113.25 + * "Portions Copyrighted [year] [name of copyright owner]"
113.26 + *
113.27 + * If you wish your version of this file to be governed by only the CDDL
113.28 + * or only the GPL Version 2, indicate your decision by adding
113.29 + * "[Contributor] elects to include this software in this distribution
113.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
113.31 + * single choice of license, a recipient has the option to distribute
113.32 + * your version of this file under either the CDDL, the GPL Version 2 or
113.33 + * to extend the choice of license to its licensees as provided above.
113.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
113.35 + * Version 2 license, then the option applies only if the new code is
113.36 + * made subject to such option by the copyright holder.
113.37 + *
113.38 + * Contributor(s):
113.39 + *
113.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
113.41 + */package org.netbeans.modules.licensechanger;
113.42 +
113.43 +import java.util.Collection;
113.44 +import java.util.HashSet;
113.45 +import java.util.LinkedList;
113.46 +import java.util.List;
113.47 +import java.util.Set;
113.48 +import javax.swing.Action;
113.49 +import org.netbeans.modules.licensechanger.api.FileHandler;
113.50 +import org.openide.filesystems.FileObject;
113.51 +import org.openide.loaders.DataObject;
113.52 +import org.openide.loaders.DataObjectNotFoundException;
113.53 +import org.openide.nodes.ChildFactory;
113.54 +import org.openide.nodes.FilterNode;
113.55 +import org.openide.nodes.Node;
113.56 +import org.openide.util.Exceptions;
113.57 +import org.openide.util.Lookup;
113.58 +import org.openide.util.lookup.Lookups;
113.59 +import org.openide.util.lookup.ProxyLookup;
113.60 +
113.61 +/**
113.62 + *
113.63 + * @author Tim Boudreau
113.64 + */
113.65 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
113.66 + private final Set<FileObject> folders;
113.67 + private final Collection <? extends FileHandler> allHandlers;
113.68 + FileChildren (Set<FileObject> folders) {
113.69 + this.folders = new HashSet(folders);
113.70 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
113.71 + }
113.72 +
113.73 + @Override
113.74 + protected boolean createKeys(List<FileObject> toPopulate) {
113.75 + toPopulate.addAll (folders);
113.76 + return true;
113.77 + }
113.78 +
113.79 + @Override
113.80 + protected Node[] createNodesForKey(FileObject key) {
113.81 + List<Node> result = new LinkedList<Node>();
113.82 +outer: for (FileObject fo : key.getChildren()) {
113.83 + if (fo.isData()) {
113.84 + for (FileHandler h : allHandlers) {
113.85 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
113.86 + try {
113.87 + DataObject dob = DataObject.find(fo);
113.88 + FileItem item = new FileItem (h, fo);
113.89 + result.add (new FN (dob.getNodeDelegate(), item));
113.90 + break outer;
113.91 + } catch (DataObjectNotFoundException ex) {
113.92 + Exceptions.printStackTrace(ex);
113.93 + }
113.94 + }
113.95 + }
113.96 + }
113.97 + }
113.98 + return result.toArray(new Node[result.size()]);
113.99 + }
113.100 +
113.101 + static final class FileItem {
113.102 + FileHandler handler;
113.103 + FileObject file;
113.104 +
113.105 + public FileItem(FileHandler handler, FileObject file) {
113.106 + this.handler = handler;
113.107 + this.file = file;
113.108 + }
113.109 +
113.110 + public FileObject getFile() {
113.111 + return file;
113.112 + }
113.113 +
113.114 + public FileHandler getHandler() {
113.115 + return handler;
113.116 + }
113.117 +
113.118 + }
113.119 +
113.120 + private static final class FN extends FilterNode {
113.121 + FN(Node orig, FileItem item) {
113.122 + super (orig, Children.LEAF, new ProxyLookup(
113.123 + Lookups.singleton(item),
113.124 + orig.getLookup()));
113.125 + disableDelegation(DELEGATE_GET_ACTIONS);
113.126 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
113.127 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
113.128 + disableDelegation(DELEGATE_GET_VALUE);
113.129 + disableDelegation(DELEGATE_SET_VALUE);
113.130 + disableDelegation(DELEGATE_SET_NAME);
113.131 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
113.132 + setDisplayName (item.file.getPath());
113.133 + }
113.134 +
113.135 + @Override
113.136 + public Action[] getActions(boolean ignored) {
113.137 + return new Action[0];
113.138 + }
113.139 + }
113.140 +}
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
114.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_4.txt Thu Sep 13 09:10:03 2012 +0200
114.3 @@ -0,0 +1,140 @@
114.4 +
114.5 + //Hello world
114.6 +
114.7 +/*
114.8 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
114.9 + *
114.10 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
114.11 + *
114.12 + * The contents of this file are subject to the terms of either the GNU
114.13 + * General Public License Version 2 only ("GPL") or the Common
114.14 + * Development and Distribution License("CDDL") (collectively, the
114.15 + * "License"). You may not use this file except in compliance with the
114.16 + * License. You can obtain a copy of the License at
114.17 + * http://www.netbeans.org/cddl-gplv2.html
114.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
114.19 + * specific language governing permissions and limitations under the
114.20 + * License. When distributing the software, include this License Header
114.21 + * Notice in each file and include the License file at
114.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
114.23 + * particular file as subject to the "Classpath" exception as provided
114.24 + * by Sun in the GPL Version 2 section of the License file that
114.25 + * accompanied this code. If applicable, add the following below the
114.26 + * License Header, with the fields enclosed by brackets [] replaced by
114.27 + * your own identifying information:
114.28 + * "Portions Copyrighted [year] [name of copyright owner]"
114.29 + *
114.30 + * If you wish your version of this file to be governed by only the CDDL
114.31 + * or only the GPL Version 2, indicate your decision by adding
114.32 + * "[Contributor] elects to include this software in this distribution
114.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
114.34 + * single choice of license, a recipient has the option to distribute
114.35 + * your version of this file under either the CDDL, the GPL Version 2 or
114.36 + * to extend the choice of license to its licensees as provided above.
114.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
114.38 + * Version 2 license, then the option applies only if the new code is
114.39 + * made subject to such option by the copyright holder.
114.40 + *
114.41 + * Contributor(s):
114.42 + *
114.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
114.44 + */package org.netbeans.modules.licensechanger;
114.45 +
114.46 +import java.util.Collection;
114.47 +import java.util.HashSet;
114.48 +import java.util.LinkedList;
114.49 +import java.util.List;
114.50 +import java.util.Set;
114.51 +import javax.swing.Action;
114.52 +import org.netbeans.modules.licensechanger.api.FileHandler;
114.53 +import org.openide.filesystems.FileObject;
114.54 +import org.openide.loaders.DataObject;
114.55 +import org.openide.loaders.DataObjectNotFoundException;
114.56 +import org.openide.nodes.ChildFactory;
114.57 +import org.openide.nodes.FilterNode;
114.58 +import org.openide.nodes.Node;
114.59 +import org.openide.util.Exceptions;
114.60 +import org.openide.util.Lookup;
114.61 +import org.openide.util.lookup.Lookups;
114.62 +import org.openide.util.lookup.ProxyLookup;
114.63 +
114.64 +/**
114.65 + *
114.66 + * @author Tim Boudreau
114.67 + */
114.68 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
114.69 + private final Set<FileObject> folders;
114.70 + private final Collection <? extends FileHandler> allHandlers;
114.71 + FileChildren (Set<FileObject> folders) {
114.72 + this.folders = new HashSet(folders);
114.73 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
114.74 + }
114.75 +
114.76 + @Override
114.77 + protected boolean createKeys(List<FileObject> toPopulate) {
114.78 + toPopulate.addAll (folders);
114.79 + return true;
114.80 + }
114.81 +
114.82 + @Override
114.83 + protected Node[] createNodesForKey(FileObject key) {
114.84 + List<Node> result = new LinkedList<Node>();
114.85 +outer: for (FileObject fo : key.getChildren()) {
114.86 + if (fo.isData()) {
114.87 + for (FileHandler h : allHandlers) {
114.88 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
114.89 + try {
114.90 + DataObject dob = DataObject.find(fo);
114.91 + FileItem item = new FileItem (h, fo);
114.92 + result.add (new FN (dob.getNodeDelegate(), item));
114.93 + break outer;
114.94 + } catch (DataObjectNotFoundException ex) {
114.95 + Exceptions.printStackTrace(ex);
114.96 + }
114.97 + }
114.98 + }
114.99 + }
114.100 + }
114.101 + return result.toArray(new Node[result.size()]);
114.102 + }
114.103 +
114.104 + static final class FileItem {
114.105 + FileHandler handler;
114.106 + FileObject file;
114.107 +
114.108 + public FileItem(FileHandler handler, FileObject file) {
114.109 + this.handler = handler;
114.110 + this.file = file;
114.111 + }
114.112 +
114.113 + public FileObject getFile() {
114.114 + return file;
114.115 + }
114.116 +
114.117 + public FileHandler getHandler() {
114.118 + return handler;
114.119 + }
114.120 +
114.121 + }
114.122 +
114.123 + private static final class FN extends FilterNode {
114.124 + FN(Node orig, FileItem item) {
114.125 + super (orig, Children.LEAF, new ProxyLookup(
114.126 + Lookups.singleton(item),
114.127 + orig.getLookup()));
114.128 + disableDelegation(DELEGATE_GET_ACTIONS);
114.129 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
114.130 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
114.131 + disableDelegation(DELEGATE_GET_VALUE);
114.132 + disableDelegation(DELEGATE_SET_VALUE);
114.133 + disableDelegation(DELEGATE_SET_NAME);
114.134 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
114.135 + setDisplayName (item.file.getPath());
114.136 + }
114.137 +
114.138 + @Override
114.139 + public Action[] getActions(boolean ignored) {
114.140 + return new Action[0];
114.141 + }
114.142 + }
114.143 +}
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
115.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_5.txt Thu Sep 13 09:10:03 2012 +0200
115.3 @@ -0,0 +1,103 @@
115.4 +//This is another kind of license comment
115.5 +//We should make sure it catches this too
115.6 +//We really want to get rid of all stuff before the package statement
115.7 +package org.netbeans.modules.licensechanger;
115.8 +
115.9 +import java.util.Collection;
115.10 +import java.util.HashSet;
115.11 +import java.util.LinkedList;
115.12 +import java.util.List;
115.13 +import java.util.Set;
115.14 +import javax.swing.Action;
115.15 +import org.netbeans.modules.licensechanger.api.FileHandler;
115.16 +import org.openide.filesystems.FileObject;
115.17 +import org.openide.loaders.DataObject;
115.18 +import org.openide.loaders.DataObjectNotFoundException;
115.19 +import org.openide.nodes.ChildFactory;
115.20 +import org.openide.nodes.FilterNode;
115.21 +import org.openide.nodes.Node;
115.22 +import org.openide.util.Exceptions;
115.23 +import org.openide.util.Lookup;
115.24 +import org.openide.util.lookup.Lookups;
115.25 +import org.openide.util.lookup.ProxyLookup;
115.26 +
115.27 +/**
115.28 + *
115.29 + * @author Tim Boudreau
115.30 + */
115.31 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
115.32 + private final Set<FileObject> folders;
115.33 + private final Collection <? extends FileHandler> allHandlers;
115.34 + FileChildren (Set<FileObject> folders) {
115.35 + this.folders = new HashSet(folders);
115.36 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
115.37 + }
115.38 +
115.39 + @Override
115.40 + protected boolean createKeys(List<FileObject> toPopulate) {
115.41 + toPopulate.addAll (folders);
115.42 + return true;
115.43 + }
115.44 +
115.45 + @Override
115.46 + protected Node[] createNodesForKey(FileObject key) {
115.47 + List<Node> result = new LinkedList<Node>();
115.48 +outer: for (FileObject fo : key.getChildren()) {
115.49 + if (fo.isData()) {
115.50 + for (FileHandler h : allHandlers) {
115.51 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
115.52 + try {
115.53 + DataObject dob = DataObject.find(fo);
115.54 + FileItem item = new FileItem (h, fo);
115.55 + result.add (new FN (dob.getNodeDelegate(), item));
115.56 + break outer;
115.57 + } catch (DataObjectNotFoundException ex) {
115.58 + Exceptions.printStackTrace(ex);
115.59 + }
115.60 + }
115.61 + }
115.62 + }
115.63 + }
115.64 + return result.toArray(new Node[result.size()]);
115.65 + }
115.66 +
115.67 + static final class FileItem {
115.68 + FileHandler handler;
115.69 + FileObject file;
115.70 +
115.71 + public FileItem(FileHandler handler, FileObject file) {
115.72 + this.handler = handler;
115.73 + this.file = file;
115.74 + }
115.75 +
115.76 + public FileObject getFile() {
115.77 + return file;
115.78 + }
115.79 +
115.80 + public FileHandler getHandler() {
115.81 + return handler;
115.82 + }
115.83 +
115.84 + }
115.85 +
115.86 + private static final class FN extends FilterNode {
115.87 + FN(Node orig, FileItem item) {
115.88 + super (orig, Children.LEAF, new ProxyLookup(
115.89 + Lookups.singleton(item),
115.90 + orig.getLookup()));
115.91 + disableDelegation(DELEGATE_GET_ACTIONS);
115.92 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
115.93 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
115.94 + disableDelegation(DELEGATE_GET_VALUE);
115.95 + disableDelegation(DELEGATE_SET_VALUE);
115.96 + disableDelegation(DELEGATE_SET_NAME);
115.97 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
115.98 + setDisplayName (item.file.getPath());
115.99 + }
115.100 +
115.101 + @Override
115.102 + public Action[] getActions(boolean ignored) {
115.103 + return new Action[0];
115.104 + }
115.105 + }
115.106 +}
116.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
116.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_6.txt Thu Sep 13 09:10:03 2012 +0200
116.3 @@ -0,0 +1,100 @@
116.4 +package org.netbeans.modules.licensechanger;
116.5 +
116.6 +import java.util.Collection;
116.7 +import java.util.HashSet;
116.8 +import java.util.LinkedList;
116.9 +import java.util.List;
116.10 +import java.util.Set;
116.11 +import javax.swing.Action;
116.12 +import org.netbeans.modules.licensechanger.api.FileHandler;
116.13 +import org.openide.filesystems.FileObject;
116.14 +import org.openide.loaders.DataObject;
116.15 +import org.openide.loaders.DataObjectNotFoundException;
116.16 +import org.openide.nodes.ChildFactory;
116.17 +import org.openide.nodes.FilterNode;
116.18 +import org.openide.nodes.Node;
116.19 +import org.openide.util.Exceptions;
116.20 +import org.openide.util.Lookup;
116.21 +import org.openide.util.lookup.Lookups;
116.22 +import org.openide.util.lookup.ProxyLookup;
116.23 +
116.24 +/**
116.25 + *
116.26 + * @author Tim Boudreau
116.27 + */
116.28 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
116.29 + private final Set<FileObject> folders;
116.30 + private final Collection <? extends FileHandler> allHandlers;
116.31 + FileChildren (Set<FileObject> folders) {
116.32 + this.folders = new HashSet(folders);
116.33 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
116.34 + }
116.35 +
116.36 + @Override
116.37 + protected boolean createKeys(List<FileObject> toPopulate) {
116.38 + toPopulate.addAll (folders);
116.39 + return true;
116.40 + }
116.41 +
116.42 + @Override
116.43 + protected Node[] createNodesForKey(FileObject key) {
116.44 + List<Node> result = new LinkedList<Node>();
116.45 +outer: for (FileObject fo : key.getChildren()) {
116.46 + if (fo.isData()) {
116.47 + for (FileHandler h : allHandlers) {
116.48 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
116.49 + try {
116.50 + DataObject dob = DataObject.find(fo);
116.51 + FileItem item = new FileItem (h, fo);
116.52 + result.add (new FN (dob.getNodeDelegate(), item));
116.53 + break outer;
116.54 + } catch (DataObjectNotFoundException ex) {
116.55 + Exceptions.printStackTrace(ex);
116.56 + }
116.57 + }
116.58 + }
116.59 + }
116.60 + }
116.61 + return result.toArray(new Node[result.size()]);
116.62 + }
116.63 +
116.64 + static final class FileItem {
116.65 + FileHandler handler;
116.66 + FileObject file;
116.67 +
116.68 + public FileItem(FileHandler handler, FileObject file) {
116.69 + this.handler = handler;
116.70 + this.file = file;
116.71 + }
116.72 +
116.73 + public FileObject getFile() {
116.74 + return file;
116.75 + }
116.76 +
116.77 + public FileHandler getHandler() {
116.78 + return handler;
116.79 + }
116.80 +
116.81 + }
116.82 +
116.83 + private static final class FN extends FilterNode {
116.84 + FN(Node orig, FileItem item) {
116.85 + super (orig, Children.LEAF, new ProxyLookup(
116.86 + Lookups.singleton(item),
116.87 + orig.getLookup()));
116.88 + disableDelegation(DELEGATE_GET_ACTIONS);
116.89 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
116.90 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
116.91 + disableDelegation(DELEGATE_GET_VALUE);
116.92 + disableDelegation(DELEGATE_SET_VALUE);
116.93 + disableDelegation(DELEGATE_SET_NAME);
116.94 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
116.95 + setDisplayName (item.file.getPath());
116.96 + }
116.97 +
116.98 + @Override
116.99 + public Action[] getActions(boolean ignored) {
116.100 + return new Action[0];
116.101 + }
116.102 + }
116.103 +}
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_7.txt Thu Sep 13 09:10:03 2012 +0200
117.3 @@ -0,0 +1,140 @@
117.4 +/*
117.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
117.6 + *
117.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
117.8 + *
117.9 + * The contents of this file are subject to the terms of either the GNU
117.10 + * General Public License Version 2 only ("GPL") or the Common
117.11 + * Development and Distribution License("CDDL") (collectively, the
117.12 + * "License"). You may not use this file except in compliance with the
117.13 + * License. You can obtain a copy of the License at
117.14 + * http://www.netbeans.org/cddl-gplv2.html
117.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
117.16 + * specific language governing permissions and limitations under the
117.17 + * License. When distributing the software, include this License Header
117.18 + * Notice in each file and include the License file at
117.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
117.20 + * particular file as subject to the "Classpath" exception as provided
117.21 + * by Sun in the GPL Version 2 section of the License file that
117.22 + * accompanied this code. If applicable, add the following below the
117.23 + * License Header, with the fields enclosed by brackets [] replaced by
117.24 + * your own identifying information:
117.25 + * "Portions Copyrighted [year] [name of copyright owner]"
117.26 + *
117.27 + * If you wish your version of this file to be governed by only the CDDL
117.28 + * or only the GPL Version 2, indicate your decision by adding
117.29 + * "[Contributor] elects to include this software in this distribution
117.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
117.31 + * single choice of license, a recipient has the option to distribute
117.32 + * your version of this file under either the CDDL, the GPL Version 2 or
117.33 + * to extend the choice of license to its licensees as provided above.
117.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
117.35 + * Version 2 license, then the option applies only if the new code is
117.36 + * made subject to such option by the copyright holder.
117.37 + *
117.38 + * Contributor(s):
117.39 + *
117.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
117.41 + */
117.42 +/* Created on March 14, 2009 */
117.43 +
117.44 +package org.netbeans.modules.licensechanger;
117.45 +
117.46 +import java.util.Collection;
117.47 +import java.util.HashSet;
117.48 +import java.util.LinkedList;
117.49 +import java.util.List;
117.50 +import java.util.Set;
117.51 +import javax.swing.Action;
117.52 +import org.netbeans.modules.licensechanger.api.FileHandler;
117.53 +import org.openide.filesystems.FileObject;
117.54 +import org.openide.loaders.DataObject;
117.55 +import org.openide.loaders.DataObjectNotFoundException;
117.56 +import org.openide.nodes.ChildFactory;
117.57 +import org.openide.nodes.FilterNode;
117.58 +import org.openide.nodes.Node;
117.59 +import org.openide.util.Exceptions;
117.60 +import org.openide.util.Lookup;
117.61 +import org.openide.util.lookup.Lookups;
117.62 +import org.openide.util.lookup.ProxyLookup;
117.63 +
117.64 +/**
117.65 + *
117.66 + * @author Tim Boudreau
117.67 + */
117.68 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
117.69 + private final Set<FileObject> folders;
117.70 + private final Collection <? extends FileHandler> allHandlers;
117.71 + FileChildren (Set<FileObject> folders) {
117.72 + this.folders = new HashSet(folders);
117.73 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
117.74 + }
117.75 +
117.76 + @Override
117.77 + protected boolean createKeys(List<FileObject> toPopulate) {
117.78 + toPopulate.addAll (folders);
117.79 + return true;
117.80 + }
117.81 +
117.82 + @Override
117.83 + protected Node[] createNodesForKey(FileObject key) {
117.84 + List<Node> result = new LinkedList<Node>();
117.85 +outer: for (FileObject fo : key.getChildren()) {
117.86 + if (fo.isData()) {
117.87 + for (FileHandler h : allHandlers) {
117.88 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
117.89 + try {
117.90 + DataObject dob = DataObject.find(fo);
117.91 + FileItem item = new FileItem (h, fo);
117.92 + result.add (new FN (dob.getNodeDelegate(), item));
117.93 + break outer;
117.94 + } catch (DataObjectNotFoundException ex) {
117.95 + Exceptions.printStackTrace(ex);
117.96 + }
117.97 + }
117.98 + }
117.99 + }
117.100 + }
117.101 + return result.toArray(new Node[result.size()]);
117.102 + }
117.103 +
117.104 + static final class FileItem {
117.105 + FileHandler handler;
117.106 + FileObject file;
117.107 +
117.108 + public FileItem(FileHandler handler, FileObject file) {
117.109 + this.handler = handler;
117.110 + this.file = file;
117.111 + }
117.112 +
117.113 + public FileObject getFile() {
117.114 + return file;
117.115 + }
117.116 +
117.117 + public FileHandler getHandler() {
117.118 + return handler;
117.119 + }
117.120 +
117.121 + }
117.122 +
117.123 + private static final class FN extends FilterNode {
117.124 + FN(Node orig, FileItem item) {
117.125 + super (orig, Children.LEAF, new ProxyLookup(
117.126 + Lookups.singleton(item),
117.127 + orig.getLookup()));
117.128 + disableDelegation(DELEGATE_GET_ACTIONS);
117.129 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
117.130 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
117.131 + disableDelegation(DELEGATE_GET_VALUE);
117.132 + disableDelegation(DELEGATE_SET_VALUE);
117.133 + disableDelegation(DELEGATE_SET_NAME);
117.134 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
117.135 + setDisplayName (item.file.getPath());
117.136 + }
117.137 +
117.138 + @Override
117.139 + public Action[] getActions(boolean ignored) {
117.140 + return new Action[0];
117.141 + }
117.142 + }
117.143 +}
118.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
118.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_8.txt Thu Sep 13 09:10:03 2012 +0200
118.3 @@ -0,0 +1,141 @@
118.4 +/*
118.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
118.6 + *
118.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
118.8 + *
118.9 + * The contents of this file are subject to the terms of either the GNU
118.10 + * General Public License Version 2 only ("GPL") or the Common
118.11 + * Development and Distribution License("CDDL") (collectively, the
118.12 + * "License"). You may not use this file except in compliance with the
118.13 + * License. You can obtain a copy of the License at
118.14 + * http://www.netbeans.org/cddl-gplv2.html
118.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
118.16 + * specific language governing permissions and limitations under the
118.17 + * License. When distributing the software, include this License Header
118.18 + * Notice in each file and include the License file at
118.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
118.20 + * particular file as subject to the "Classpath" exception as provided
118.21 + * by Sun in the GPL Version 2 section of the License file that
118.22 + * accompanied this code. If applicable, add the following below the
118.23 + * License Header, with the fields enclosed by brackets [] replaced by
118.24 + * your own identifying information:
118.25 + * "Portions Copyrighted [year] [name of copyright owner]"
118.26 + *
118.27 + * If you wish your version of this file to be governed by only the CDDL
118.28 + * or only the GPL Version 2, indicate your decision by adding
118.29 + * "[Contributor] elects to include this software in this distribution
118.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
118.31 + * single choice of license, a recipient has the option to distribute
118.32 + * your version of this file under either the CDDL, the GPL Version 2 or
118.33 + * to extend the choice of license to its licensees as provided above.
118.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
118.35 + * Version 2 license, then the option applies only if the new code is
118.36 + * made subject to such option by the copyright holder.
118.37 + *
118.38 + * Contributor(s):
118.39 + *
118.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
118.41 + */
118.42 +/* Created on March 14, 2009
118.43 + * by some IDE or other */
118.44 +
118.45 +package org.netbeans.modules.licensechanger;
118.46 +
118.47 +import java.util.Collection;
118.48 +import java.util.HashSet;
118.49 +import java.util.LinkedList;
118.50 +import java.util.List;
118.51 +import java.util.Set;
118.52 +import javax.swing.Action;
118.53 +import org.netbeans.modules.licensechanger.api.FileHandler;
118.54 +import org.openide.filesystems.FileObject;
118.55 +import org.openide.loaders.DataObject;
118.56 +import org.openide.loaders.DataObjectNotFoundException;
118.57 +import org.openide.nodes.ChildFactory;
118.58 +import org.openide.nodes.FilterNode;
118.59 +import org.openide.nodes.Node;
118.60 +import org.openide.util.Exceptions;
118.61 +import org.openide.util.Lookup;
118.62 +import org.openide.util.lookup.Lookups;
118.63 +import org.openide.util.lookup.ProxyLookup;
118.64 +
118.65 +/**
118.66 + *
118.67 + * @author Tim Boudreau
118.68 + */
118.69 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
118.70 + private final Set<FileObject> folders;
118.71 + private final Collection <? extends FileHandler> allHandlers;
118.72 + FileChildren (Set<FileObject> folders) {
118.73 + this.folders = new HashSet(folders);
118.74 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
118.75 + }
118.76 +
118.77 + @Override
118.78 + protected boolean createKeys(List<FileObject> toPopulate) {
118.79 + toPopulate.addAll (folders);
118.80 + return true;
118.81 + }
118.82 +
118.83 + @Override
118.84 + protected Node[] createNodesForKey(FileObject key) {
118.85 + List<Node> result = new LinkedList<Node>();
118.86 +outer: for (FileObject fo : key.getChildren()) {
118.87 + if (fo.isData()) {
118.88 + for (FileHandler h : allHandlers) {
118.89 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
118.90 + try {
118.91 + DataObject dob = DataObject.find(fo);
118.92 + FileItem item = new FileItem (h, fo);
118.93 + result.add (new FN (dob.getNodeDelegate(), item));
118.94 + break outer;
118.95 + } catch (DataObjectNotFoundException ex) {
118.96 + Exceptions.printStackTrace(ex);
118.97 + }
118.98 + }
118.99 + }
118.100 + }
118.101 + }
118.102 + return result.toArray(new Node[result.size()]);
118.103 + }
118.104 +
118.105 + static final class FileItem {
118.106 + FileHandler handler;
118.107 + FileObject file;
118.108 +
118.109 + public FileItem(FileHandler handler, FileObject file) {
118.110 + this.handler = handler;
118.111 + this.file = file;
118.112 + }
118.113 +
118.114 + public FileObject getFile() {
118.115 + return file;
118.116 + }
118.117 +
118.118 + public FileHandler getHandler() {
118.119 + return handler;
118.120 + }
118.121 +
118.122 + }
118.123 +
118.124 + private static final class FN extends FilterNode {
118.125 + FN(Node orig, FileItem item) {
118.126 + super (orig, Children.LEAF, new ProxyLookup(
118.127 + Lookups.singleton(item),
118.128 + orig.getLookup()));
118.129 + disableDelegation(DELEGATE_GET_ACTIONS);
118.130 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
118.131 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
118.132 + disableDelegation(DELEGATE_GET_VALUE);
118.133 + disableDelegation(DELEGATE_SET_VALUE);
118.134 + disableDelegation(DELEGATE_SET_NAME);
118.135 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
118.136 + setDisplayName (item.file.getPath());
118.137 + }
118.138 +
118.139 + @Override
118.140 + public Action[] getActions(boolean ignored) {
118.141 + return new Action[0];
118.142 + }
118.143 + }
118.144 +}
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
119.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_9.txt Thu Sep 13 09:10:03 2012 +0200
119.3 @@ -0,0 +1,142 @@
119.4 +/*
119.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
119.6 + *
119.7 + * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
119.8 + *
119.9 + * The contents of this file are subject to the terms of either the GNU
119.10 + * General Public License Version 2 only ("GPL") or the Common
119.11 + * Development and Distribution License("CDDL") (collectively, the
119.12 + * "License"). You may not use this file except in compliance with the
119.13 + * License. You can obtain a copy of the License at
119.14 + * http://www.netbeans.org/cddl-gplv2.html
119.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
119.16 + * specific language governing permissions and limitations under the
119.17 + * License. When distributing the software, include this License Header
119.18 + * Notice in each file and include the License file at
119.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
119.20 + * particular file as subject to the "Classpath" exception as provided
119.21 + * by Sun in the GPL Version 2 section of the License file that
119.22 + * accompanied this code. If applicable, add the following below the
119.23 + * License Header, with the fields enclosed by brackets [] replaced by
119.24 + * your own identifying information:
119.25 + * "Portions Copyrighted [year] [name of copyright owner]"
119.26 + *
119.27 + * If you wish your version of this file to be governed by only the CDDL
119.28 + * or only the GPL Version 2, indicate your decision by adding
119.29 + * "[Contributor] elects to include this software in this distribution
119.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
119.31 + * single choice of license, a recipient has the option to distribute
119.32 + * your version of this file under either the CDDL, the GPL Version 2 or
119.33 + * to extend the choice of license to its licensees as provided above.
119.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
119.35 + * Version 2 license, then the option applies only if the new code is
119.36 + * made subject to such option by the copyright holder.
119.37 + *
119.38 + * Contributor(s):
119.39 + *
119.40 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
119.41 + */
119.42 +/* Created on March 14, 2009
119.43 + * by some IDE or other
119.44 + */
119.45 +
119.46 +package org.netbeans.modules.licensechanger;
119.47 +
119.48 +import java.util.Collection;
119.49 +import java.util.HashSet;
119.50 +import java.util.LinkedList;
119.51 +import java.util.List;
119.52 +import java.util.Set;
119.53 +import javax.swing.Action;
119.54 +import org.netbeans.modules.licensechanger.api.FileHandler;
119.55 +import org.openide.filesystems.FileObject;
119.56 +import org.openide.loaders.DataObject;
119.57 +import org.openide.loaders.DataObjectNotFoundException;
119.58 +import org.openide.nodes.ChildFactory;
119.59 +import org.openide.nodes.FilterNode;
119.60 +import org.openide.nodes.Node;
119.61 +import org.openide.util.Exceptions;
119.62 +import org.openide.util.Lookup;
119.63 +import org.openide.util.lookup.Lookups;
119.64 +import org.openide.util.lookup.ProxyLookup;
119.65 +
119.66 +/**
119.67 + *
119.68 + * @author Tim Boudreau
119.69 + */
119.70 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
119.71 + private final Set<FileObject> folders;
119.72 + private final Collection <? extends FileHandler> allHandlers;
119.73 + FileChildren (Set<FileObject> folders) {
119.74 + this.folders = new HashSet(folders);
119.75 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
119.76 + }
119.77 +
119.78 + @Override
119.79 + protected boolean createKeys(List<FileObject> toPopulate) {
119.80 + toPopulate.addAll (folders);
119.81 + return true;
119.82 + }
119.83 +
119.84 + @Override
119.85 + protected Node[] createNodesForKey(FileObject key) {
119.86 + List<Node> result = new LinkedList<Node>();
119.87 +outer: for (FileObject fo : key.getChildren()) {
119.88 + if (fo.isData()) {
119.89 + for (FileHandler h : allHandlers) {
119.90 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
119.91 + try {
119.92 + DataObject dob = DataObject.find(fo);
119.93 + FileItem item = new FileItem (h, fo);
119.94 + result.add (new FN (dob.getNodeDelegate(), item));
119.95 + break outer;
119.96 + } catch (DataObjectNotFoundException ex) {
119.97 + Exceptions.printStackTrace(ex);
119.98 + }
119.99 + }
119.100 + }
119.101 + }
119.102 + }
119.103 + return result.toArray(new Node[result.size()]);
119.104 + }
119.105 +
119.106 + static final class FileItem {
119.107 + FileHandler handler;
119.108 + FileObject file;
119.109 +
119.110 + public FileItem(FileHandler handler, FileObject file) {
119.111 + this.handler = handler;
119.112 + this.file = file;
119.113 + }
119.114 +
119.115 + public FileObject getFile() {
119.116 + return file;
119.117 + }
119.118 +
119.119 + public FileHandler getHandler() {
119.120 + return handler;
119.121 + }
119.122 +
119.123 + }
119.124 +
119.125 + private static final class FN extends FilterNode {
119.126 + FN(Node orig, FileItem item) {
119.127 + super (orig, Children.LEAF, new ProxyLookup(
119.128 + Lookups.singleton(item),
119.129 + orig.getLookup()));
119.130 + disableDelegation(DELEGATE_GET_ACTIONS);
119.131 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
119.132 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
119.133 + disableDelegation(DELEGATE_GET_VALUE);
119.134 + disableDelegation(DELEGATE_SET_VALUE);
119.135 + disableDelegation(DELEGATE_SET_NAME);
119.136 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
119.137 + setDisplayName (item.file.getPath());
119.138 + }
119.139 +
119.140 + @Override
119.141 + public Action[] getActions(boolean ignored) {
119.142 + return new Action[0];
119.143 + }
119.144 + }
119.145 +}
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/java_golden.txt Thu Sep 13 09:10:03 2012 +0200
120.3 @@ -0,0 +1,131 @@
120.4 +/*
120.5 + * Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
120.6 + * All rights reversed.
120.7 + *
120.8 + * Redistribution and use in source, binary or corpuscular forms, with or without
120.9 + * modification, are prohibited under all circumstances unless the following
120.10 + * conditions have been met:
120.11 + *
120.12 + * 1. You have an eyeball growing in the palm of your left hand
120.13 + *
120.14 + * 2. Seven dwarfs really like your golden hair
120.15 + *
120.16 + * 3. The moon has reversed its course a multiple of times divisible by
120.17 + * the eighteenth prime number in the last year
120.18 + *
120.19 + * THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
120.20 + * INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
120.21 + * DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
120.22 + * OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
120.23 + * ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
120.24 + * SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
120.25 + * LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
120.26 + * BALL DROP, BECOMING A LAWYER.
120.27 + *
120.28 + * BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
120.29 + * AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
120.30 + * AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
120.31 + * INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
120.32 + *
120.33 + * RUN, RUN NOW, AND RUN VERY FAST.
120.34 + */
120.35 +package org.netbeans.modules.licensechanger;
120.36 +
120.37 +import java.util.Collection;
120.38 +import java.util.HashSet;
120.39 +import java.util.LinkedList;
120.40 +import java.util.List;
120.41 +import java.util.Set;
120.42 +import javax.swing.Action;
120.43 +import org.netbeans.modules.licensechanger.api.FileHandler;
120.44 +import org.openide.filesystems.FileObject;
120.45 +import org.openide.loaders.DataObject;
120.46 +import org.openide.loaders.DataObjectNotFoundException;
120.47 +import org.openide.nodes.ChildFactory;
120.48 +import org.openide.nodes.FilterNode;
120.49 +import org.openide.nodes.Node;
120.50 +import org.openide.util.Exceptions;
120.51 +import org.openide.util.Lookup;
120.52 +import org.openide.util.lookup.Lookups;
120.53 +import org.openide.util.lookup.ProxyLookup;
120.54 +
120.55 +/**
120.56 + *
120.57 + * @author Tim Boudreau
120.58 + */
120.59 +public class FileChildren extends ChildFactory.Detachable <FileObject> {
120.60 + private final Set<FileObject> folders;
120.61 + private final Collection <? extends FileHandler> allHandlers;
120.62 + FileChildren (Set<FileObject> folders) {
120.63 + this.folders = new HashSet(folders);
120.64 + allHandlers = Lookup.getDefault().lookupAll(FileHandler.class);
120.65 + }
120.66 +
120.67 + @Override
120.68 + protected boolean createKeys(List<FileObject> toPopulate) {
120.69 + toPopulate.addAll (folders);
120.70 + return true;
120.71 + }
120.72 +
120.73 + @Override
120.74 + protected Node[] createNodesForKey(FileObject key) {
120.75 + List<Node> result = new LinkedList<Node>();
120.76 +outer: for (FileObject fo : key.getChildren()) {
120.77 + if (fo.isData()) {
120.78 + for (FileHandler h : allHandlers) {
120.79 + if (h.match(fo) && !h.shouldSkipFile(fo)) {
120.80 + try {
120.81 + DataObject dob = DataObject.find(fo);
120.82 + FileItem item = new FileItem (h, fo);
120.83 + result.add (new FN (dob.getNodeDelegate(), item));
120.84 + break outer;
120.85 + } catch (DataObjectNotFoundException ex) {
120.86 + Exceptions.printStackTrace(ex);
120.87 + }
120.88 + }
120.89 + }
120.90 + }
120.91 + }
120.92 + return result.toArray(new Node[result.size()]);
120.93 + }
120.94 +
120.95 + static final class FileItem {
120.96 + FileHandler handler;
120.97 + FileObject file;
120.98 +
120.99 + public FileItem(FileHandler handler, FileObject file) {
120.100 + this.handler = handler;
120.101 + this.file = file;
120.102 + }
120.103 +
120.104 + public FileObject getFile() {
120.105 + return file;
120.106 + }
120.107 +
120.108 + public FileHandler getHandler() {
120.109 + return handler;
120.110 + }
120.111 +
120.112 + }
120.113 +
120.114 + private static final class FN extends FilterNode {
120.115 + FN(Node orig, FileItem item) {
120.116 + super (orig, Children.LEAF, new ProxyLookup(
120.117 + Lookups.singleton(item),
120.118 + orig.getLookup()));
120.119 + disableDelegation(DELEGATE_GET_ACTIONS);
120.120 + disableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
120.121 + disableDelegation(DELEGATE_SET_DISPLAY_NAME);
120.122 + disableDelegation(DELEGATE_GET_VALUE);
120.123 + disableDelegation(DELEGATE_SET_VALUE);
120.124 + disableDelegation(DELEGATE_SET_NAME);
120.125 + setValue (CheckboxListView.SELECTED, Boolean.TRUE);
120.126 + setDisplayName (item.file.getPath());
120.127 + }
120.128 +
120.129 + @Override
120.130 + public Action[] getActions(boolean ignored) {
120.131 + return new Action[0];
120.132 + }
120.133 + }
120.134 +}
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/props_1.txt Thu Sep 13 09:10:03 2012 +0200
121.3 @@ -0,0 +1,5 @@
121.4 +#Just one comment
121.5 +NAME_JAVA_FILES=Java Files
121.6 +NAME_PROPERTIES_FILES=Properties Files
121.7 +NAME_XML_FILES=XML Files
121.8 +
122.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
122.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/props_2.txt Thu Sep 13 09:10:03 2012 +0200
122.3 @@ -0,0 +1,40 @@
122.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
122.5 +#
122.6 +# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
122.7 +#
122.8 +# The contents of this file are subject to the terms of either the GNU
122.9 +# General Public License Version 2 only ("GPL") or the Common
122.10 +# Development and Distribution License("CDDL") (collectively, the
122.11 +# "License"). You may not use this file except in compliance with the
122.12 +# License. You can obtain a copy of the License at
122.13 +# http://www.netbeans.org/cddl-gplv2.html
122.14 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
122.15 +# specific language governing permissions and limitations under the
122.16 +# License. When distributing the software, include this License Header
122.17 +# Notice in each file and include the License file at
122.18 +# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
122.19 +# particular file as subject to the "Classpath" exception as provided
122.20 +# by Sun in the GPL Version 2 section of the License file that
122.21 +# accompanied this code. If applicable, add the following below the
122.22 +# License Header, with the fields enclosed by brackets [] replaced by
122.23 +# your own identifying information:
122.24 +# "Portions Copyrighted [year] [name of copyright owner]"
122.25 +#
122.26 +# If you wish your version of this file to be governed by only the CDDL
122.27 +# or only the GPL Version 2, indicate your decision by adding
122.28 +# "[Contributor] elects to include this software in this distribution
122.29 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
122.30 +# single choice of license, a recipient has the option to distribute
122.31 +# your version of this file under either the CDDL, the GPL Version 2 or
122.32 +# to extend the choice of license to its licensees as provided above.
122.33 +# However, if you add GPL Version 2 code and therefore, elected the GPL
122.34 +# Version 2 license, then the option applies only if the new code is
122.35 +# made subject to such option by the copyright holder.
122.36 +#
122.37 +# Contributor(s):
122.38 +#
122.39 +# Portions Copyrighted 2009 Sun Microsystems, Inc.
122.40 +NAME_JAVA_FILES=Java Files
122.41 +NAME_PROPERTIES_FILES=Properties Files
122.42 +NAME_XML_FILES=XML Files
122.43 +
123.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
123.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/props_3.txt Thu Sep 13 09:10:03 2012 +0200
123.3 @@ -0,0 +1,4 @@
123.4 +NAME_JAVA_FILES=Java Files
123.5 +NAME_PROPERTIES_FILES=Properties Files
123.6 +NAME_XML_FILES=XML Files
123.7 +
124.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
124.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/props_4.txt Thu Sep 13 09:10:03 2012 +0200
124.3 @@ -0,0 +1,24 @@
124.4 +
124.5 +
124.6 +
124.7 +
124.8 +
124.9 +
124.10 +
124.11 +
124.12 +
124.13 +
124.14 +
124.15 +
124.16 +
124.17 +
124.18 +
124.19 +
124.20 +
124.21 +
124.22 +
124.23 +
124.24 +NAME_JAVA_FILES=Java Files
124.25 +NAME_PROPERTIES_FILES=Properties Files
124.26 +NAME_XML_FILES=XML Files
124.27 +
125.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/props_golden.txt Thu Sep 13 09:10:03 2012 +0200
125.3 @@ -0,0 +1,33 @@
125.4 +# Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
125.5 +# All rights reversed.
125.6 +#
125.7 +# Redistribution and use in source, binary or corpuscular forms, with or without
125.8 +# modification, are prohibited under all circumstances unless the following
125.9 +# conditions have been met:
125.10 +#
125.11 +# 1. You have an eyeball growing in the palm of your left hand
125.12 +#
125.13 +# 2. Seven dwarfs really like your golden hair
125.14 +#
125.15 +# 3. The moon has reversed its course a multiple of times divisible by
125.16 +# the eighteenth prime number in the last year
125.17 +#
125.18 +# THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
125.19 +# INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
125.20 +# DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
125.21 +# OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
125.22 +# ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
125.23 +# SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
125.24 +# LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
125.25 +# BALL DROP, BECOMING A LAWYER.
125.26 +#
125.27 +# BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
125.28 +# AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
125.29 +# AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
125.30 +# INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
125.31 +#
125.32 +# RUN, RUN NOW, AND RUN VERY FAST.
125.33 +NAME_JAVA_FILES=Java Files
125.34 +NAME_PROPERTIES_FILES=Properties Files
125.35 +NAME_XML_FILES=XML Files
125.36 +
126.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_1.txt Thu Sep 13 09:10:03 2012 +0200
126.3 @@ -0,0 +1,96 @@
126.4 +<?xml version="1.0" encoding="UTF-8"?>
126.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
126.6 +<filesystem>
126.7 + <folder name="Navigator">
126.8 + <folder name="Panels">
126.9 + <folder name="text">
126.10 + <folder name="html">
126.11 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
126.12 + </folder>
126.13 + <folder name="plain">
126.14 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
126.15 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
126.16 + </file>
126.17 + </folder>
126.18 + </folder>
126.19 + <folder name="content">
126.20 + <folder name="unknown">
126.21 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
126.22 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
126.23 + </file>
126.24 + </folder>
126.25 + </folder>
126.26 + </folder>
126.27 + </folder>
126.28 + <folder name="GenericNavigator">
126.29 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.30 + <folder name="text">
126.31 + <folder name="html">
126.32 +
126.33 + <file name="Headers.patternItem" url="headers_pattern.txt">
126.34 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.35 + <attr name="position" intvalue="100"/>
126.36 + </file>
126.37 +
126.38 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
126.39 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.40 + <attr name="position" intvalue="200"/>
126.41 + </file>
126.42 +
126.43 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
126.44 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.45 + <attr name="position" intvalue="400"/>
126.46 + </file>
126.47 +
126.48 + <file name="Images.patternItem" url="images_pattern.txt">
126.49 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.50 + <attr name="position" intvalue="300"/>
126.51 + </file>
126.52 +
126.53 + </folder>
126.54 + <folder name="plain">
126.55 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
126.56 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.57 + <attr name="position" intvalue="100"/>
126.58 + </file>
126.59 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
126.60 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.61 + <attr name="position" intvalue="200"/>
126.62 + </file>
126.63 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
126.64 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.65 + <attr name="position" intvalue="300"/>
126.66 + </file>
126.67 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
126.68 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.69 + <attr name="position" intvalue="400"/>
126.70 + </file>
126.71 + </folder>
126.72 + </folder>
126.73 + <folder name="content">
126.74 + <folder name="unknown">
126.75 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
126.76 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.77 + <attr name="position" intvalue="100"/>
126.78 + </file>
126.79 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
126.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.81 + <attr name="position" intvalue="200"/>
126.82 + </file>
126.83 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
126.84 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.85 + <attr name="position" intvalue="300"/>
126.86 + </file>
126.87 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
126.88 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
126.89 + <attr name="position" intvalue="400"/>
126.90 + </file>
126.91 + </folder>
126.92 + </folder>
126.93 + </folder>
126.94 + <folder name="OptionsDialog">
126.95 + <folder name="Advanced">
126.96 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
126.97 + </folder>
126.98 + </folder>
126.99 +</filesystem>
127.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
127.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_2.txt Thu Sep 13 09:10:03 2012 +0200
127.3 @@ -0,0 +1,99 @@
127.4 +<?xml version="1.0" encoding="UTF-8"?>
127.5 +<!-- This is the old license
127.6 +it is not a very interesting license
127.7 +but it is here -->
127.8 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
127.9 +<filesystem>
127.10 + <folder name="Navigator">
127.11 + <folder name="Panels">
127.12 + <folder name="text">
127.13 + <folder name="html">
127.14 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
127.15 + </folder>
127.16 + <folder name="plain">
127.17 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
127.18 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
127.19 + </file>
127.20 + </folder>
127.21 + </folder>
127.22 + <folder name="content">
127.23 + <folder name="unknown">
127.24 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
127.25 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
127.26 + </file>
127.27 + </folder>
127.28 + </folder>
127.29 + </folder>
127.30 + </folder>
127.31 + <folder name="GenericNavigator">
127.32 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.33 + <folder name="text">
127.34 + <folder name="html">
127.35 +
127.36 + <file name="Headers.patternItem" url="headers_pattern.txt">
127.37 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.38 + <attr name="position" intvalue="100"/>
127.39 + </file>
127.40 +
127.41 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
127.42 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.43 + <attr name="position" intvalue="200"/>
127.44 + </file>
127.45 +
127.46 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
127.47 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.48 + <attr name="position" intvalue="400"/>
127.49 + </file>
127.50 +
127.51 + <file name="Images.patternItem" url="images_pattern.txt">
127.52 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.53 + <attr name="position" intvalue="300"/>
127.54 + </file>
127.55 +
127.56 + </folder>
127.57 + <folder name="plain">
127.58 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
127.59 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.60 + <attr name="position" intvalue="100"/>
127.61 + </file>
127.62 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
127.63 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.64 + <attr name="position" intvalue="200"/>
127.65 + </file>
127.66 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
127.67 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.68 + <attr name="position" intvalue="300"/>
127.69 + </file>
127.70 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
127.71 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.72 + <attr name="position" intvalue="400"/>
127.73 + </file>
127.74 + </folder>
127.75 + </folder>
127.76 + <folder name="content">
127.77 + <folder name="unknown">
127.78 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
127.79 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.80 + <attr name="position" intvalue="100"/>
127.81 + </file>
127.82 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
127.83 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.84 + <attr name="position" intvalue="200"/>
127.85 + </file>
127.86 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
127.87 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.88 + <attr name="position" intvalue="300"/>
127.89 + </file>
127.90 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
127.91 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
127.92 + <attr name="position" intvalue="400"/>
127.93 + </file>
127.94 + </folder>
127.95 + </folder>
127.96 + </folder>
127.97 + <folder name="OptionsDialog">
127.98 + <folder name="Advanced">
127.99 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
127.100 + </folder>
127.101 + </folder>
127.102 +</filesystem>
128.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_3.txt Thu Sep 13 09:10:03 2012 +0200
128.3 @@ -0,0 +1,100 @@
128.4 +<?xml version="1.0" encoding="UTF-8"?>
128.5 +<!-- This is the old license
128.6 +it is not a very interesting license
128.7 +but it is here
128.8 +-->
128.9 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
128.10 +<filesystem>
128.11 + <folder name="Navigator">
128.12 + <folder name="Panels">
128.13 + <folder name="text">
128.14 + <folder name="html">
128.15 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
128.16 + </folder>
128.17 + <folder name="plain">
128.18 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
128.19 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
128.20 + </file>
128.21 + </folder>
128.22 + </folder>
128.23 + <folder name="content">
128.24 + <folder name="unknown">
128.25 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
128.26 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
128.27 + </file>
128.28 + </folder>
128.29 + </folder>
128.30 + </folder>
128.31 + </folder>
128.32 + <folder name="GenericNavigator">
128.33 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.34 + <folder name="text">
128.35 + <folder name="html">
128.36 +
128.37 + <file name="Headers.patternItem" url="headers_pattern.txt">
128.38 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.39 + <attr name="position" intvalue="100"/>
128.40 + </file>
128.41 +
128.42 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
128.43 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.44 + <attr name="position" intvalue="200"/>
128.45 + </file>
128.46 +
128.47 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
128.48 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.49 + <attr name="position" intvalue="400"/>
128.50 + </file>
128.51 +
128.52 + <file name="Images.patternItem" url="images_pattern.txt">
128.53 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.54 + <attr name="position" intvalue="300"/>
128.55 + </file>
128.56 +
128.57 + </folder>
128.58 + <folder name="plain">
128.59 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
128.60 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.61 + <attr name="position" intvalue="100"/>
128.62 + </file>
128.63 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
128.64 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.65 + <attr name="position" intvalue="200"/>
128.66 + </file>
128.67 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
128.68 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.69 + <attr name="position" intvalue="300"/>
128.70 + </file>
128.71 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
128.72 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.73 + <attr name="position" intvalue="400"/>
128.74 + </file>
128.75 + </folder>
128.76 + </folder>
128.77 + <folder name="content">
128.78 + <folder name="unknown">
128.79 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
128.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.81 + <attr name="position" intvalue="100"/>
128.82 + </file>
128.83 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
128.84 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.85 + <attr name="position" intvalue="200"/>
128.86 + </file>
128.87 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
128.88 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.89 + <attr name="position" intvalue="300"/>
128.90 + </file>
128.91 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
128.92 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
128.93 + <attr name="position" intvalue="400"/>
128.94 + </file>
128.95 + </folder>
128.96 + </folder>
128.97 + </folder>
128.98 + <folder name="OptionsDialog">
128.99 + <folder name="Advanced">
128.100 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
128.101 + </folder>
128.102 + </folder>
128.103 +</filesystem>
129.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_4.txt Thu Sep 13 09:10:03 2012 +0200
129.3 @@ -0,0 +1,100 @@
129.4 +<?xml version="1.0" encoding="UTF-8"?>
129.5 +<!-- This is the old license -->
129.6 +<!-- it is not a very interesting license -->
129.7 +<!-- but it is here -->
129.8 +
129.9 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
129.10 +<filesystem>
129.11 + <folder name="Navigator">
129.12 + <folder name="Panels">
129.13 + <folder name="text">
129.14 + <folder name="html">
129.15 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
129.16 + </folder>
129.17 + <folder name="plain">
129.18 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
129.19 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
129.20 + </file>
129.21 + </folder>
129.22 + </folder>
129.23 + <folder name="content">
129.24 + <folder name="unknown">
129.25 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
129.26 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
129.27 + </file>
129.28 + </folder>
129.29 + </folder>
129.30 + </folder>
129.31 + </folder>
129.32 + <folder name="GenericNavigator">
129.33 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.34 + <folder name="text">
129.35 + <folder name="html">
129.36 +
129.37 + <file name="Headers.patternItem" url="headers_pattern.txt">
129.38 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.39 + <attr name="position" intvalue="100"/>
129.40 + </file>
129.41 +
129.42 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
129.43 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.44 + <attr name="position" intvalue="200"/>
129.45 + </file>
129.46 +
129.47 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
129.48 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.49 + <attr name="position" intvalue="400"/>
129.50 + </file>
129.51 +
129.52 + <file name="Images.patternItem" url="images_pattern.txt">
129.53 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.54 + <attr name="position" intvalue="300"/>
129.55 + </file>
129.56 +
129.57 + </folder>
129.58 + <folder name="plain">
129.59 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
129.60 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.61 + <attr name="position" intvalue="100"/>
129.62 + </file>
129.63 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
129.64 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.65 + <attr name="position" intvalue="200"/>
129.66 + </file>
129.67 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
129.68 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.69 + <attr name="position" intvalue="300"/>
129.70 + </file>
129.71 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
129.72 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.73 + <attr name="position" intvalue="400"/>
129.74 + </file>
129.75 + </folder>
129.76 + </folder>
129.77 + <folder name="content">
129.78 + <folder name="unknown">
129.79 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
129.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.81 + <attr name="position" intvalue="100"/>
129.82 + </file>
129.83 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
129.84 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.85 + <attr name="position" intvalue="200"/>
129.86 + </file>
129.87 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
129.88 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.89 + <attr name="position" intvalue="300"/>
129.90 + </file>
129.91 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
129.92 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
129.93 + <attr name="position" intvalue="400"/>
129.94 + </file>
129.95 + </folder>
129.96 + </folder>
129.97 + </folder>
129.98 + <folder name="OptionsDialog">
129.99 + <folder name="Advanced">
129.100 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
129.101 + </folder>
129.102 + </folder>
129.103 +</filesystem>
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
130.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_5.txt Thu Sep 13 09:10:03 2012 +0200
130.3 @@ -0,0 +1,102 @@
130.4 +<!-- This is the old license -->
130.5 +<!-- it is not a very interesting license -->
130.6 +<!-- but it is here -->
130.7 +<?xml version="1.0" encoding="UTF-8"?>
130.8 +
130.9 +
130.10 +
130.11 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
130.12 +<filesystem>
130.13 + <folder name="Navigator">
130.14 + <folder name="Panels">
130.15 + <folder name="text">
130.16 + <folder name="html">
130.17 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
130.18 + </folder>
130.19 + <folder name="plain">
130.20 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
130.21 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
130.22 + </file>
130.23 + </folder>
130.24 + </folder>
130.25 + <folder name="content">
130.26 + <folder name="unknown">
130.27 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
130.28 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
130.29 + </file>
130.30 + </folder>
130.31 + </folder>
130.32 + </folder>
130.33 + </folder>
130.34 + <folder name="GenericNavigator">
130.35 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.36 + <folder name="text">
130.37 + <folder name="html">
130.38 +
130.39 + <file name="Headers.patternItem" url="headers_pattern.txt">
130.40 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.41 + <attr name="position" intvalue="100"/>
130.42 + </file>
130.43 +
130.44 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
130.45 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.46 + <attr name="position" intvalue="200"/>
130.47 + </file>
130.48 +
130.49 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
130.50 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.51 + <attr name="position" intvalue="400"/>
130.52 + </file>
130.53 +
130.54 + <file name="Images.patternItem" url="images_pattern.txt">
130.55 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.56 + <attr name="position" intvalue="300"/>
130.57 + </file>
130.58 +
130.59 + </folder>
130.60 + <folder name="plain">
130.61 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
130.62 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.63 + <attr name="position" intvalue="100"/>
130.64 + </file>
130.65 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
130.66 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.67 + <attr name="position" intvalue="200"/>
130.68 + </file>
130.69 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
130.70 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.71 + <attr name="position" intvalue="300"/>
130.72 + </file>
130.73 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
130.74 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.75 + <attr name="position" intvalue="400"/>
130.76 + </file>
130.77 + </folder>
130.78 + </folder>
130.79 + <folder name="content">
130.80 + <folder name="unknown">
130.81 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
130.82 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.83 + <attr name="position" intvalue="100"/>
130.84 + </file>
130.85 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
130.86 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.87 + <attr name="position" intvalue="200"/>
130.88 + </file>
130.89 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
130.90 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.91 + <attr name="position" intvalue="300"/>
130.92 + </file>
130.93 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
130.94 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
130.95 + <attr name="position" intvalue="400"/>
130.96 + </file>
130.97 + </folder>
130.98 + </folder>
130.99 + </folder>
130.100 + <folder name="OptionsDialog">
130.101 + <folder name="Advanced">
130.102 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
130.103 + </folder>
130.104 + </folder>
130.105 +</filesystem>
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
131.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_6.txt Thu Sep 13 09:10:03 2012 +0200
131.3 @@ -0,0 +1,96 @@
131.4 +
131.5 +<!-- This is the old license --><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
131.6 +<filesystem>
131.7 + <folder name="Navigator">
131.8 + <folder name="Panels">
131.9 + <folder name="text">
131.10 + <folder name="html">
131.11 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
131.12 + </folder>
131.13 + <folder name="plain">
131.14 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
131.15 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
131.16 + </file>
131.17 + </folder>
131.18 + </folder>
131.19 + <folder name="content">
131.20 + <folder name="unknown">
131.21 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
131.22 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
131.23 + </file>
131.24 + </folder>
131.25 + </folder>
131.26 + </folder>
131.27 + </folder>
131.28 + <folder name="GenericNavigator">
131.29 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.30 + <folder name="text">
131.31 + <folder name="html">
131.32 +
131.33 + <file name="Headers.patternItem" url="headers_pattern.txt">
131.34 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.35 + <attr name="position" intvalue="100"/>
131.36 + </file>
131.37 +
131.38 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
131.39 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.40 + <attr name="position" intvalue="200"/>
131.41 + </file>
131.42 +
131.43 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
131.44 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.45 + <attr name="position" intvalue="400"/>
131.46 + </file>
131.47 +
131.48 + <file name="Images.patternItem" url="images_pattern.txt">
131.49 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.50 + <attr name="position" intvalue="300"/>
131.51 + </file>
131.52 +
131.53 + </folder>
131.54 + <folder name="plain">
131.55 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
131.56 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.57 + <attr name="position" intvalue="100"/>
131.58 + </file>
131.59 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
131.60 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.61 + <attr name="position" intvalue="200"/>
131.62 + </file>
131.63 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
131.64 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.65 + <attr name="position" intvalue="300"/>
131.66 + </file>
131.67 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
131.68 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.69 + <attr name="position" intvalue="400"/>
131.70 + </file>
131.71 + </folder>
131.72 + </folder>
131.73 + <folder name="content">
131.74 + <folder name="unknown">
131.75 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
131.76 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.77 + <attr name="position" intvalue="100"/>
131.78 + </file>
131.79 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
131.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.81 + <attr name="position" intvalue="200"/>
131.82 + </file>
131.83 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
131.84 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.85 + <attr name="position" intvalue="300"/>
131.86 + </file>
131.87 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
131.88 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
131.89 + <attr name="position" intvalue="400"/>
131.90 + </file>
131.91 + </folder>
131.92 + </folder>
131.93 + </folder>
131.94 + <folder name="OptionsDialog">
131.95 + <folder name="Advanced">
131.96 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
131.97 + </folder>
131.98 + </folder>
131.99 +</filesystem>
132.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
132.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_7.txt Thu Sep 13 09:10:03 2012 +0200
132.3 @@ -0,0 +1,101 @@
132.4 +<?xml version="1.0" encoding="UTF-8"?>
132.5 +
132.6 +<!-- This is the old license -->
132.7 +<!-- it is not a very interesting license -->
132.8 +<!-- but it is here -->
132.9 +
132.10 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
132.11 +<filesystem>
132.12 + <folder name="Navigator">
132.13 + <folder name="Panels">
132.14 + <folder name="text">
132.15 + <folder name="html">
132.16 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
132.17 + </folder>
132.18 + <folder name="plain">
132.19 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
132.20 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
132.21 + </file>
132.22 + </folder>
132.23 + </folder>
132.24 + <folder name="content">
132.25 + <folder name="unknown">
132.26 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
132.27 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
132.28 + </file>
132.29 + </folder>
132.30 + </folder>
132.31 + </folder>
132.32 + </folder>
132.33 + <folder name="GenericNavigator">
132.34 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.35 + <folder name="text">
132.36 + <folder name="html">
132.37 +
132.38 + <file name="Headers.patternItem" url="headers_pattern.txt">
132.39 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.40 + <attr name="position" intvalue="100"/>
132.41 + </file>
132.42 +
132.43 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
132.44 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.45 + <attr name="position" intvalue="200"/>
132.46 + </file>
132.47 +
132.48 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
132.49 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.50 + <attr name="position" intvalue="400"/>
132.51 + </file>
132.52 +
132.53 + <file name="Images.patternItem" url="images_pattern.txt">
132.54 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.55 + <attr name="position" intvalue="300"/>
132.56 + </file>
132.57 +
132.58 + </folder>
132.59 + <folder name="plain">
132.60 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
132.61 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.62 + <attr name="position" intvalue="100"/>
132.63 + </file>
132.64 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
132.65 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.66 + <attr name="position" intvalue="200"/>
132.67 + </file>
132.68 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
132.69 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.70 + <attr name="position" intvalue="300"/>
132.71 + </file>
132.72 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
132.73 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.74 + <attr name="position" intvalue="400"/>
132.75 + </file>
132.76 + </folder>
132.77 + </folder>
132.78 + <folder name="content">
132.79 + <folder name="unknown">
132.80 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
132.81 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.82 + <attr name="position" intvalue="100"/>
132.83 + </file>
132.84 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
132.85 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.86 + <attr name="position" intvalue="200"/>
132.87 + </file>
132.88 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
132.89 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.90 + <attr name="position" intvalue="300"/>
132.91 + </file>
132.92 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
132.93 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
132.94 + <attr name="position" intvalue="400"/>
132.95 + </file>
132.96 + </folder>
132.97 + </folder>
132.98 + </folder>
132.99 + <folder name="OptionsDialog">
132.100 + <folder name="Advanced">
132.101 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
132.102 + </folder>
132.103 + </folder>
132.104 +</filesystem>
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
133.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_8.txt Thu Sep 13 09:10:03 2012 +0200
133.3 @@ -0,0 +1,101 @@
133.4 +<?xml version="1.0" encoding="UTF-8"?>
133.5 +
133.6 +<!-- This is the old license -->
133.7 +<!-- it is not a very interesting license -->
133.8 +<!-- but it is here -->
133.9 +
133.10 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
133.11 +<filesystem>
133.12 + <folder name="Navigator">
133.13 + <folder name="Panels">
133.14 + <folder name="text">
133.15 + <folder name="html">
133.16 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
133.17 + </folder>
133.18 + <folder name="plain">
133.19 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
133.20 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
133.21 + </file>
133.22 + </folder>
133.23 + </folder>
133.24 + <folder name="content">
133.25 + <folder name="unknown">
133.26 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
133.27 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
133.28 + </file>
133.29 + </folder>
133.30 + </folder>
133.31 + </folder>
133.32 + </folder>
133.33 + <folder name="GenericNavigator">
133.34 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.35 + <folder name="text">
133.36 + <folder name="html">
133.37 +
133.38 + <file name="Headers.patternItem" url="headers_pattern.txt">
133.39 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.40 + <attr name="position" intvalue="100"/>
133.41 + </file>
133.42 +
133.43 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
133.44 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.45 + <attr name="position" intvalue="200"/>
133.46 + </file>
133.47 +
133.48 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
133.49 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.50 + <attr name="position" intvalue="400"/>
133.51 + </file>
133.52 +
133.53 + <file name="Images.patternItem" url="images_pattern.txt">
133.54 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.55 + <attr name="position" intvalue="300"/>
133.56 + </file>
133.57 +
133.58 + </folder>
133.59 + <folder name="plain">
133.60 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
133.61 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.62 + <attr name="position" intvalue="100"/>
133.63 + </file>
133.64 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
133.65 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.66 + <attr name="position" intvalue="200"/>
133.67 + </file>
133.68 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
133.69 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.70 + <attr name="position" intvalue="300"/>
133.71 + </file>
133.72 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
133.73 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.74 + <attr name="position" intvalue="400"/>
133.75 + </file>
133.76 + </folder>
133.77 + </folder>
133.78 + <folder name="content">
133.79 + <folder name="unknown">
133.80 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
133.81 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.82 + <attr name="position" intvalue="100"/>
133.83 + </file>
133.84 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
133.85 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.86 + <attr name="position" intvalue="200"/>
133.87 + </file>
133.88 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
133.89 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.90 + <attr name="position" intvalue="300"/>
133.91 + </file>
133.92 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
133.93 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
133.94 + <attr name="position" intvalue="400"/>
133.95 + </file>
133.96 + </folder>
133.97 + </folder>
133.98 + </folder>
133.99 + <folder name="OptionsDialog">
133.100 + <folder name="Advanced">
133.101 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
133.102 + </folder>
133.103 + </folder>
133.104 +</filesystem>
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
134.2 +++ b/licensechanger/test/unit/src/org/netbeans/modules/licensechanger/spi/handlers/xml_golden.txt Thu Sep 13 09:10:03 2012 +0200
134.3 @@ -0,0 +1,127 @@
134.4 +<?xml version="1.0" encoding="UTF-8"?>
134.5 +<!--
134.6 +Copyright (c) 1892-2193 Centrifugal Bumblepuppy, SRO, Inc., LLC, WTF
134.7 +All rights reversed.
134.8 +
134.9 +Redistribution and use in source, binary or corpuscular forms, with or without
134.10 +modification, are prohibited under all circumstances unless the following
134.11 +conditions have been met:
134.12 +
134.13 + 1. You have an eyeball growing in the palm of your left hand
134.14 +
134.15 + 2. Seven dwarfs really like your golden hair
134.16 +
134.17 + 3. The moon has reversed its course a multiple of times divisible by
134.18 + the eighteenth prime number in the last year
134.19 +
134.20 +THIS MALWARE IS PROVIDED ``AS IS'' AND ANY IMPLICIT OR IMPLIED WARRANTIES
134.21 +INCLUDING BUT NOT LIMITED TO EXPECTATION OF CONTINUED SURVIVAL ARE
134.22 +DISCLAIMED. IN NO EVENT SHALL CENTRIFUGAL BUMBLEPUPPY, SRO, INC., LLC, WTF
134.23 +OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
134.24 +ECTOPLASMIC OR GEOTHERMAL DAMAGES, INCLUDING BUT NOT LIMITED TO:
134.25 +SPONTANEOUS HUMAN COMBUSTION, THRID ARM SYNDROME, BAD BREATH, OVOID HEART;
134.26 +LOSS OF SOUL, ENUII OR EXISTENTIAL INFLAMMATION; OXYGEN EVASION SYNDROME,
134.27 +BALL DROP, BECOMING A LAWYER.
134.28 +
134.29 +BY USING THIS SOFTWARE YOU AGREE TO THE HARVESTING OF YOUR GENETIC MATERIAL
134.30 +AND/OR OFFSPRING WITHIN THE FIRST THOUSAND YEARS SUBSEQUENT TO FIRST USE, AND
134.31 +AGREE TO THE USE OF REANIMATION TECHNOLOGIES IF CENTRIFUGAL BUMBLEPUPPY, SRO,
134.32 +INC., LLC, WTF DEEMS IT NECESSARY AT THEIR SOLE DISCRETION.
134.33 +
134.34 +RUN, RUN NOW, AND RUN VERY FAST.
134.35 +-->
134.36 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
134.37 +<filesystem>
134.38 + <folder name="Navigator">
134.39 + <folder name="Panels">
134.40 + <folder name="text">
134.41 + <folder name="html">
134.42 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
134.43 + </folder>
134.44 + <folder name="plain">
134.45 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
134.46 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
134.47 + </file>
134.48 + </folder>
134.49 + </folder>
134.50 + <folder name="content">
134.51 + <folder name="unknown">
134.52 + <file name="org-netbeans-modules-genericnavigator-GenericNavPanel.shadow">
134.53 + <attr name="originalFile" stringvalue="/Navigator/Panels/text/html/org-netbeans-modules-genericnavigator-GenericNavPanel.instance"/>
134.54 + </file>
134.55 + </folder>
134.56 + </folder>
134.57 + </folder>
134.58 + </folder>
134.59 + <folder name="GenericNavigator">
134.60 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.61 + <folder name="text">
134.62 + <folder name="html">
134.63 +
134.64 + <file name="Headers.patternItem" url="headers_pattern.txt">
134.65 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.66 + <attr name="position" intvalue="100"/>
134.67 + </file>
134.68 +
134.69 + <file name="Hyperlinks.patternItem" url="links_pattern.txt">
134.70 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.71 + <attr name="position" intvalue="200"/>
134.72 + </file>
134.73 +
134.74 + <file name="ListItems.patternItem" url="listitem_pattern.txt">
134.75 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.76 + <attr name="position" intvalue="400"/>
134.77 + </file>
134.78 +
134.79 + <file name="Images.patternItem" url="images_pattern.txt">
134.80 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.81 + <attr name="position" intvalue="300"/>
134.82 + </file>
134.83 +
134.84 + </folder>
134.85 + <folder name="plain">
134.86 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
134.87 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.88 + <attr name="position" intvalue="100"/>
134.89 + </file>
134.90 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
134.91 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.92 + <attr name="position" intvalue="200"/>
134.93 + </file>
134.94 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
134.95 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.96 + <attr name="position" intvalue="300"/>
134.97 + </file>
134.98 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
134.99 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.100 + <attr name="position" intvalue="400"/>
134.101 + </file>
134.102 + </folder>
134.103 + </folder>
134.104 + <folder name="content">
134.105 + <folder name="unknown">
134.106 + <file name="Paragraphs.patternItem" url="paragraphs_pattern.txt">
134.107 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.108 + <attr name="position" intvalue="100"/>
134.109 + </file>
134.110 + <file name="Sentences.patternItem" url="sentences_pattern.txt">
134.111 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.112 + <attr name="position" intvalue="200"/>
134.113 + </file>
134.114 + <file name="Quotations.patternItem" url="quotations_pattern.txt">
134.115 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.116 + <attr name="position" intvalue="300"/>
134.117 + </file>
134.118 + <file name="HyphenBullets.patternItem" url="hyphen_bullets_pattern.txt">
134.119 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org/netbeans/modules/genericnavigator/Bundle"/>
134.120 + <attr name="position" intvalue="400"/>
134.121 + </file>
134.122 + </folder>
134.123 + </folder>
134.124 + </folder>
134.125 + <folder name="OptionsDialog">
134.126 + <folder name="Advanced">
134.127 + <file name="org-netbeans-modules-genericnavigator-GenericNavigatorOptionsAdvancedOption.instance"/>
134.128 + </folder>
134.129 + </folder>
134.130 +</filesystem>